problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03243
u662430503
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['import math\ndef main():\n n=int(input())\n a=int(n/100)\n if a*100+a*10+a>n:\n print(a*100+a*10+a)\n else:\n print((a+1)*100+(a+1)*10+a+1)\nmain()', 'import math\ndef main():\n n=int(input())\n a=int(n/100)\n if a*100+a*10+a>=n:\n print(a*100+a*10+a)\n else:\n print((a+1)*100+(a+1)*10+a+1)\nmain()']
['Wrong Answer', 'Accepted']
['s755077416', 's356846024']
[9108.0, 9108.0]
[30.0, 26.0]
[149, 150]
p03243
u666844906
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\ni = int(N/111)\nif N % 111 != 0:\n i = i + 1\nelse:\n i = 1\nprint(i)', 'N = int(input())\ni = int(N/111)\nif N % 111 != 0:\n i = i + 1\nelse:\n i = i\nprint(i*111)\n']
['Wrong Answer', 'Accepted']
['s328990750', 's470093460']
[3064.0, 2940.0]
[17.0, 17.0]
[83, 88]
p03243
u672475305
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n =input()\nlst = []\nans = []\nfor i in range(3):\n num = int(n[i]*3)\n lst.append(num)\nfor i in range(3):\n if lst[i] > int(n):\n ans.append(lst[i])\nprint(min(ans))', 'n =int(input())\ni = int(n/111)\nif n % 111 != 0:\n i += 1\nprint(i * 111)']
['Runtime Error', 'Accepted']
['s522006803', 's031309806']
[3060.0, 2940.0]
[17.0, 17.0]
[175, 73]
p03243
u673338219
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nk = 0\nif int(n/111) == n/111:\n k = n/111\nelse:\n k = int(n/111) + 1\nprint(111*k)', 'n = int(input())\nk = 0\nif int(n/111) == n/111:\n k = n/111\nelse k = int(n/111) + 1\nprint(111*k)', 'n = int(input())\nk = 0\nif int(n/111) == n/111:\n k = int(n/111)\nelse:\n k = int(n/111) + 1\nprint(111*k)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s023019248', 's358033190', 's332629923']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[98, 95, 103]
p03243
u677312543
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = input()\n\nfor i in range(1, 10):\n if n <= i*111:\n print(i*111)\n exit()\n', 'n = input()\nzorome = [i*100 + i*10 + i for i in range(1, 10)]\n\nfor i in zorome:\n if n <= i:\n print(i)\n exit()\n', 'n = int(input())\n\nfor i in range(1, 10):\n if n <= i*111:\n print(i*111)\n exit()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s675237748', 's750179367', 's298386249']
[2940.0, 3060.0, 2940.0]
[18.0, 20.0, 19.0]
[91, 127, 96]
p03243
u685662874
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\nprint(((N//111) + 1) * 111)', 'N=int(input())\nif N % 111 == 0:\n print(N)\nelse:\n print(((N//111) + 1) * 111)\n']
['Wrong Answer', 'Accepted']
['s344858314', 's900683347']
[2940.0, 2940.0]
[17.0, 18.0]
[42, 79]
p03243
u686036872
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\nx=-(-N//111)\nprint(100x+10x+x)', 'N=int(input())\nx=-(-N//111)', 'print(100*x+10*x+x)', 'N=int(input())\nx=-(-N//111)\nprint(100*x + 10*x + x)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s408717289', 's435093576', 's725364451', 's513482244']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 19.0]
[45, 27, 19, 51]
p03243
u690781906
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = input()\nx = N[0] * 3\nif int(N) < int(x):\n print(x)\nelse:\n print(str(int(N[0]) + 1) * 3)\n', 'N = input()\nx = N[0] * 3\nif int(N) <= int(x):\n print(x)\nelse:\n print(str(int(N[0]) + 1) * 3)']
['Wrong Answer', 'Accepted']
['s769355820', 's396886188']
[2940.0, 2940.0]
[18.0, 17.0]
[98, 98]
p03243
u691018832
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = 999\n\nfor i in range(1,10):\n if n <= 111*i:\n break\nprint(111*i)', 'n = int(input())\n\nfor i in range(1,9):\n if n <= 111*i:\n print(111*i)', 'n = int(input())\n\nfor i in range(1,10):\n if n <= 111*i:\n break\nprint(111*i)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s721217023', 's740072216', 's725596865']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[76, 78, 85]
p03243
u693933222
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\nif N <=111:\n print("111")\nelif N <=222:\n print("222")\nelif N <=333:\n print("333")\nelif N <= 444:\n print("444")\nelif N <=555:\n print("555")\nelif N <=666\n print("666")\nelif N <=777:\n print("777")\nelif N <=888:\n print("888")\nelse:\n print("999")', 'N = int(input())\nif N <=111:\n print("111")\nelif N <=222:\n print("222")\nelif N <=333:\n print("333")\nelif N <= 444:\n print("444")\nelif N <=555:\n print("555")\nelif N <=666:\n print("666")\nelif N <=777:\n print("777")\nelif N <=888:\n print("888")\nelse:\n print("999")']
['Runtime Error', 'Accepted']
['s056135000', 's137872833']
[2940.0, 3060.0]
[17.0, 17.0]
[285, 286]
p03243
u698416089
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())+100\no = int((n-(n%100))/100*111)\nif n < o:\n\tprint(o)\nelse:\n\tprint(o+111)', 'n = int(input())\no = int((n-(n%100))/100)\nif n<=o*111:\n print(o*111)\nelse:\n print(o*111+111)']
['Wrong Answer', 'Accepted']
['s277373263', 's963249879']
[2940.0, 2940.0]
[18.0, 17.0]
[89, 98]
p03243
u701077471
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\napple = []\n\nnumber = [111, 222, 333, 444, 555, 666, 777, 888, 999]\nfor i in number:\n if i - n > 0:\n apple.append(i)\n else:\n pass\n\nprint(min(apple))', 'n = int(input())\napple = []\n\nnumber = [111, 222, 333, 444, 555, 666, 777, 888, 999]\nfor i in number:\n if i - n >= 0:\n apple.append(i)\n\nprint(min(apple))']
['Runtime Error', 'Accepted']
['s208534664', 's917394041']
[2940.0, 2940.0]
[17.0, 17.0]
[184, 162]
p03243
u703890795
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['print(((int(input())-1)//111)*111)', 'print(((int(input())-1)//111)*111 + 111)']
['Wrong Answer', 'Accepted']
['s286604243', 's345078090']
[2940.0, 2940.0]
[17.0, 17.0]
[34, 40]
p03243
u706828591
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nprint(n + (111 - n % 111))', 'n = int(input())\n#n, t = map(int,input().split())\n#ls = list(map(int,input().split()))\n\n\n\nif n% 111 == 0:\n print(n)\n quit()\nprint(n + 111 - n % 111 )']
['Wrong Answer', 'Accepted']
['s721322269', 's114679196']
[2940.0, 2940.0]
[17.0, 17.0]
[43, 245]
p03243
u706929073
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\ncs = [1111, 999, 888, 777, 666, 555, 444, 333, 222, 111]\nf = False\nfor i, c in enumerate(cs):\n if c <= n:\n print(cs[i-1])\n f = True\n break\nif not f:\n print(cs[len(cs)-1])', 'n = int(input())\ncs = [1111, 999, 888, 777, 666, 555, 444, 333, 222, 111]\nf = False\nfor i, c in enumerate(cs):\n if (c+1) <= n:\n print(cs[i-1])\n f = True\n break\nif not f:\n print(cs[len(cs)-1])']
['Wrong Answer', 'Accepted']
['s193998218', 's483710903']
[3060.0, 3060.0]
[17.0, 19.0]
[214, 218]
p03243
u731028462
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = input()\nl = len(N)\nif(int(N[0]*l) > int(N)):\n print(N[0]*l)\nelse:\n print(str(int(N[0])+1)*l)', 'N = input()\nl = len(N)\nif(int(N[0]*l) >= int(N)):\n print(N[0]*l)\nelse:\n print(str(int(N[0])+1)*l)']
['Wrong Answer', 'Accepted']
['s383191261', 's512355426']
[2940.0, 2940.0]
[20.0, 17.0]
[102, 103]
p03243
u732870425
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nli = [111,222,333,444,555,666,777,888,999]\nnn = []\nfor i in range(len(li)):\n if li[i] - n >= 0:\n nn.append(li[i]-n)\n else:\n nn.append(1000)\n \nprint(li[index(min(nn))])', 'n=int(input())\na=n//100\nm=a*100+a*10+a\nif n<=m:\n print(m)\nelse:\n print(m+111)']
['Runtime Error', 'Accepted']
['s839035660', 's484033940']
[2940.0, 2940.0]
[17.0, 17.0]
[193, 79]
p03243
u737758066
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n int n;\n cin >> n;\n for (int i = n; i <= 999; i++) {\n string str = to_string(i);\n set<char> st;\n for (int i = 0; i < str.size(); i++) {\n st.insert(str[i]);\n }\n if (st.size() == 1) {\n cout << i << endl;\n break;\n }\n }\n return 0;\n}', 'n = int(input())\nfor i in range(n, 1000):\n if len(set(str(i))) == 1:\n print(i)\n exit()\n']
['Runtime Error', 'Accepted']
['s455821909', 's337281288']
[2940.0, 2940.0]
[17.0, 17.0]
[325, 104]
p03243
u740767776
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nfor i in range(1,n+1):\n low = i * 100 + i *10 + (i+1)\n high = (i+1) * 100 + (i+1) *10 + (i+1)\n if low < n and n <= high:\n print(high)\n else:\n print(low)\n ', 'n = int(input())\nfor i in range(0,11):\n low = i * 100 + i *10 + i\n high = (i+1) * 100 + (i+1) *10 + (i+1)\n if low < n and n <= high:\n print(high)\n break']
['Wrong Answer', 'Accepted']
['s204118593', 's837450589']
[3188.0, 2940.0]
[18.0, 17.0]
[184, 161]
p03243
u747837595
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['import sys\nimport numpy as np\na=[int(x)for x in list(sys.argv[1])]+[-1]\nprint(str(a[0]+0if(np.trim_zeros(np.diff(a))[0]<0)else 1)*3)\n', 'import sys\nimport numpy as np\na=[int(x)for x in list(sys.argv[1][0:3])]+[-1]\nprint(str(a[0]+0if(np.trim_zeros(np.diff(a))[0]<0)else 1)*3)\n', 'import sys\nimport numpy as np\na=[int(x)for x in list(sys.stdin.readline().rstrip())]+[0]\nprint(str(a[0]+(1if(np.trim_zeros(np.diff(a))[0]>0)else 0))*(len(a)-1))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s264465721', 's917994749', 's690553476']
[20528.0, 19636.0, 12472.0]
[281.0, 503.0, 156.0]
[133, 138, 161]
p03243
u748241164
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\nx = N-1 // 111\n\nprint((x+1)*111)', 'N = int(input())\nx = (N-1) // 111\n\nprint((x+1)*111)']
['Wrong Answer', 'Accepted']
['s083293706', 's246998585']
[2940.0, 2940.0]
[17.0, 17.0]
[49, 51]
p03243
u748377775
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['for i in range(9):\n if(N>L[i] and N<=L[i+1]):\n print(L[i+1])\n break\n elif(N==L[i]):\n print(L[i])\n break\n elif(N<111):\n print(111)\n break\n else:\n continue\n', 'N=int(input())\nL=[111,222,333,444,555,666,777,888,999]\n\nfor i in range(9):\n if(N>=L[i] and N<=L[i+1]):\n print(L[i+1])\n else:\n continue\n', 'N=int(input())\nL=[111,222,333,444,555,666,777,888,999]\n\nfor i in range(9):\n if(N>L[i] and N<=L[i+1]):\n print(L[i+1])\n break\n elif(N==L[i]):\n print(L[i])\n break\n elif(N<111):\n print(111)\n break\n else:\n continue\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s151690161', 's686598333', 's298994910']
[2940.0, 2940.0, 3060.0]
[18.0, 21.0, 17.0]
[215, 155, 271]
p03243
u748540356
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=input()\nY=[111,222,333,444,555,666,777,888,999]\nfor i in range(9):\n if N<=Y[i]:\n print(Y[i])\n break', 'N=int(input())\nY=[111,222,333,444,555,666,777,888,999]\nfor i in range(9):\n if N<=Y[i]:\n print(Y[i])\n break']
['Runtime Error', 'Accepted']
['s090896849', 's065243318']
[2940.0, 2940.0]
[18.0, 17.0]
[108, 113]
p03243
u757030836
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = input()\n\nx = False\n\nwhile x = False:\n for i in range(1,len(n)):\n if n[i-1] == n[i]:\n x =True\n else:\n x = False\n if x = True:\n print(n)\n break\n else:\n n = int(n) + 1', 'n=int(input())\nfor i in range(10):\n if 111*i<n<=111*(i+1):\n print(111*(i+1))\n']
['Runtime Error', 'Accepted']
['s895162445', 's379103313']
[2940.0, 2940.0]
[18.0, 17.0]
[196, 81]
p03243
u764956288
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['print((int(input())//111+1)*111)', 'print(((int(input())-1)//111+1)*111)']
['Wrong Answer', 'Accepted']
['s629472721', 's681495507']
[2940.0, 2940.0]
[18.0, 17.0]
[32, 36]
p03243
u771167374
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = input()\nl = [111, 222, 333, 444, 555, 666, 777, 888, 999]\nfor i in l:\n if n<=i:\n print(i)\n break', 'n = int(input())\nl = [111, 222, 333, 444, 555, 666, 777, 888, 999]\nfor i in l:\n if n<=i:\n print(i)\n break']
['Runtime Error', 'Accepted']
['s424809724', 's487735230']
[2940.0, 2940.0]
[18.0, 17.0]
[117, 122]
p03243
u772180307
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
[' n = int(input())\nq = int(n / 111)\nif n % 111 == 0:\n i = q\nelse:\n i = q + 1\nprint(i * 111)', 'n = int(input())\nq = int(n / 111)\nif n % 111 == 0:\n i = q\nelse:\n i = q + 1\nprint(i * 111)']
['Runtime Error', 'Accepted']
['s703062350', 's538201410']
[2940.0, 2940.0]
[17.0, 17.0]
[92, 91]
p03243
u774160580
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\ndig_3 = N % 100\nif N > dig_3 * 111:\n print((dig_3 + 1) * 111)\nelse:\n print(dig_3 * 111)\n', 'N = int(input())\ndig_3 = N // 100\nif N > dig_3 * 111:\n print((dig_3 + 1) * 111)\nelse:\n print(dig_3 * 111)\n']
['Wrong Answer', 'Accepted']
['s549437779', 's001549238']
[2940.0, 2940.0]
[17.0, 18.0]
[111, 112]
p03243
u777028980
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\nA=int(N/111)+1\nprint(A*111)', 'N=int(input())\nif(N%111):\n A=int(N/111)+1\n print(A*111)\nelse:\n print(N)']
['Wrong Answer', 'Accepted']
['s957687101', 's339948260']
[2940.0, 2940.0]
[18.0, 18.0]
[42, 74]
p03243
u778700306
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['\nn=int(input())\nfor x in range(n, 1000):\n if set(list(x)) == 1:\n print(x)\n break\n ', '\nn=int(input())\nfor x in range(n, 1000):\n if len(set(list(str(x)))) == 1:\n print(x)\n break\n']
['Runtime Error', 'Accepted']
['s378962342', 's614611446']
[2940.0, 2940.0]
[17.0, 17.0]
[106, 108]
p03243
u780475861
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['print((int(input() - 1) // 111 + 1) * 111)', 'print(((int(input()) - 1) // 111 + 1) * 111)']
['Runtime Error', 'Accepted']
['s545099467', 's056412990']
[2940.0, 2940.0]
[17.0, 17.0]
[42, 44]
p03243
u785066634
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\n\nif 100<=n<=111:\n print(111)\na=0\nfor a in range(8):\n if 1+111*a<=n<=111*(a+1):\n print(111*(a+1))\n', 'n=int(input())\n\nfor i in range(10):\n if i*100+i*10+i<n<=i*100+i*10+i+111:\n print(i*100+i*10+i+111)\n \n']
['Wrong Answer', 'Accepted']
['s149542767', 's962836881']
[2940.0, 2940.0]
[19.0, 17.0]
[157, 158]
p03243
u790812284
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\np = int(n/100)\nq = int((n-p*100)/10)\nr = n-p*100-q*10\n\nif p>q>r:\n print(p*111)\nelse:\n print((p+1)*111)', 'n = int(input())\nfor i in range(1,11):\n if i*111>=n:\n print(i*111)\n break\n']
['Wrong Answer', 'Accepted']
['s208534511', 's661424532']
[3060.0, 2940.0]
[19.0, 17.0]
[123, 91]
p03243
u790877102
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\n\nS = ((N//111)+1)*111\n\nprint(S)\n', 'N = int(input())\n\nS = (((N-1)//111)+1)*111\n\nprint(S)\n']
['Wrong Answer', 'Accepted']
['s154554158', 's089162517']
[2940.0, 2940.0]
[17.0, 17.0]
[49, 53]
p03243
u791664126
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\nc=n%10\nb=int(((n-c)%100)/10)\na=int(((n-b-c)%1000)/100)\nx=a*100+a*10+a\nif b < a:pass\nelif b==a and c<b:pass\nelse:x+=111\nprint(x)', 'n=int(input())\nc=n%10\nb=int(((n-c)%100)/10)\na=int(((n-b-c)%1000)/100)\nx=a*100+a*10+a\nif b < a:pass\nelif b==a and c<b:pass\nelif a==b and b==c:pass\nelse:x+=111\nprint(x)']
['Wrong Answer', 'Accepted']
['s410506286', 's902611325']
[2940.0, 3060.0]
[17.0, 17.0]
[142, 166]
p03243
u792217717
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\n\na = n // 100\nif n < int(str(a) * 3):\n print(str(a) * 3)\nelse:\n print(str(a + 1) * 3)\n', 'n = int(input())\n\na = n // 100\nif n <= int(str(a) * 3):\n print(str(a) * 3)\nelse:\n print(str(a + 1) * 3)\n']
['Wrong Answer', 'Accepted']
['s911086393', 's221036208']
[2940.0, 2940.0]
[17.0, 17.0]
[109, 110]
p03243
u804085889
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nnum = n // 111\nprint(111 * (num + 1))', 'import math\nprint(math.ceil(int(input())/111)*111)']
['Wrong Answer', 'Accepted']
['s537405392', 's441197729']
[2940.0, 2940.0]
[17.0, 18.0]
[54, 50]
p03243
u806855121
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\n\nprint(n + 111 - n % 111)', 'n = int(input())\n\nif n % 111 == 0:\n print(n)\nelse: \n print(n + 111 - n % 111)']
['Wrong Answer', 'Accepted']
['s024951510', 's095784217']
[2940.0, 2940.0]
[18.0, 17.0]
[42, 86]
p03243
u812576525
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N= int(input())\nA = [111, 222, 333, 444, 555, 666, 777, 888, 999]\n\nfor i in A:\n if N > i:\n continue\n elif N < i:\n print(i)\n break\n ', 'n=int(input())\nfor i in range(n,1000):\n if str(i)[0] == str(i)[1] == str(i)[2]:\n print(i)\n exit()']
['Wrong Answer', 'Accepted']
['s227738347', 's232661114']
[2940.0, 2940.0]
[17.0, 17.0]
[161, 114]
p03243
u816631826
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
["num = str(input())\na = []\nx=[]\nfor i in str(num):\n a.append(i)\nif a[1] < a[0] and a[2] < a[0]:\n x.append(a[0])\n x.append(a[0])\n x.append(a[0])\n print(''.join(str(i) for i in x))\nelse:\n z = int (a[0]) +1\n x.append(z)\n x.append(z)\n x.append(z)\n print(''.join(str(i) for i in x))\n", 'n=int(input())\ni=n//111\nif n%111!=0:\n i+=1\nprint(i*111)\n\n']
['Wrong Answer', 'Accepted']
['s005734113', 's084930223']
[3064.0, 2940.0]
[20.0, 18.0]
[307, 60]
p03243
u818283165
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nfor i in range(9):\n if 111*i <= n and n <= 111*(i+1):\n ans = 111*(i+1)\nprint(ans)', 'n = int(input())\nans = 111\nfor i in range(9):\n if 111*i < n and n <= 111*(i+1):\n ans = 111*(i+1)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s719727141', 's843321742']
[2940.0, 2940.0]
[17.0, 17.0]
[108, 117]
p03243
u819710930
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\nans=n//111*(n+1)\nprint(ans if ans>n else ans-111 )', 'n=int(input())\nans=n//111*111\nprint(ans if ans==n else ans+111 )']
['Wrong Answer', 'Accepted']
['s570576197', 's954867013']
[2940.0, 2940.0]
[17.0, 18.0]
[65, 64]
p03243
u821271186
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\ni=0\nfor i in range(8):\n if 111*i<N and N<111*(i+1):\n print(111*(i+1))\n break', 'N=int(input())\ni=0\nfor i in range(9):\n if 111*i<N and N<=111*(i+1):\n print(111*(i+1))\n break']
['Wrong Answer', 'Accepted']
['s465740797', 's492633160']
[2940.0, 2940.0]
[17.0, 17.0]
[108, 109]
p03243
u822044226
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\nA = N//100\n\nprint((A*111) if N < A*111 else (A+1)*111)', 'N = int(input())\nA = N//100\n\nprint((A*111) if N <= A*111 else (A+1)*111)']
['Wrong Answer', 'Accepted']
['s920989229', 's729796584']
[2940.0, 2940.0]
[17.0, 17.0]
[71, 72]
p03243
u827141374
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['A = input()\nAAA = int(A[0]*3)\nif AAA > int(A):\n print(AAA)\nelse:\n print(AAA + 111)\n ', 'A = input()\nAAA = int(A[0]*3)\nif AAA >= int(A):\n print(AAA)\nelse:\n print(AAA + 111)']
['Wrong Answer', 'Accepted']
['s615242357', 's058361094']
[2940.0, 3060.0]
[17.0, 19.0]
[87, 85]
p03243
u840988663
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\nzoro=[111,222,333,444,555,666,777,888,999]\nfor i in range(len(zoro)):\n if N<zoro[i]:\n print(zoro[i])\n break', 'N=int(input())\nzoro=[111,222,333,444,555,666,777,888,999]\nfor i in range(len(zoro)):\n if N<=zoro[i]:\n print(zoro[i])\n break']
['Wrong Answer', 'Accepted']
['s347279587', 's137761381']
[2940.0, 2940.0]
[17.0, 17.0]
[129, 130]
p03243
u842054747
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
["number = int(input())\n\nstr_number_list = list(str(number))\n\nint_number_list = []\n\nfor i in str_number_list:\n\tint_number_list.append(int(i))\n\nhundred = int_number_list[0]\nten = int_number_list[1]\none = int_number_list[2]\n\nif number == one * 111:\n\tprint(number + 111)\nelif hundred <= ten:\n\tprint('{0}{0}{0}'.format(*str_number_list[1]))\nelif hundred > ten:\n\tprint('{0}{0}{0}'.format(*str_number_list[0]))\nelse:\n\tprint('{0}{0}{0}'.format(*str_number_list[2]))\n", "number = int(input())\n\nstr_number_list = list(str(number))\n\nint_number_list = []\n\nfor i in str_number_list:\n\tint_number_list.append(int(i))\n\nhundred = int_number_list[0]\nten = int_number_list[1]\none = int_number_list[2]\n\nif number == one * 111:\n\tprint(number + 111)\nelif hundred <= ten:\n\tprint('{0}{0}{0}'.format(*str_number_list[1]))\nelse:\n\tprint('{0}{0}{0}'.format(*str_number_list[0]))\n", 'num = int(input())\nnumlist = [111, 222, 333, 444, 555, 666, 777, 888, 999]\nfor number in numlist:\n if number >= num:\n print(number)\n break']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s232522310', 's577172498', 's152543963']
[3064.0, 3060.0, 2940.0]
[17.0, 18.0, 17.0]
[457, 389, 155]
p03243
u850390157
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\nprint((N // 111) + 1 if N % 111 != 0 else N // 111)\n', 'N = int(input())\nprint(((N // 111) + 1) * 111 if N % 111 != 0 else (N // 111) * 111)\n']
['Wrong Answer', 'Accepted']
['s828593293', 's955851631']
[2940.0, 2940.0]
[17.0, 17.0]
[69, 85]
p03243
u853185302
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\nnum_list = [111*i for i in range(1,10)]\nnums = [num_list[i]-N for i in range(len(num_list)) if num_list[i]-N > 0]\nn = min(nums)\nprint(N+n) ', 'N = int(input())\nprint(((N-1)//111+1)*111)\n\n\n']
['Runtime Error', 'Accepted']
['s139333825', 's218963865']
[3060.0, 2940.0]
[19.0, 17.0]
[156, 45]
p03243
u854992222
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
["n = list(input())\na = int(''.join(n))\nb = []\nb.append(int(n[0]) * 111)\nb.append(int(n[1]) * 111)\nb.append(int(n[2]) * 111)\nb = sorted(b)\nif a % 111 == 0:\n print(a)\nfor i in range(3):\n if b[i] >= a:\n print(b[i])\n exit()", 'import math\nn = int(input())\nprint(math.ceil(n/111)*111)']
['Wrong Answer', 'Accepted']
['s307249552', 's345711473']
[3064.0, 2940.0]
[17.0, 19.0]
[238, 56]
p03243
u855985627
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N =0 int(input())\nfor i in range(1, 10):\n if((i-1)*111<x and x<=i*111):\n print(i*111)', 'N =0 int(input())\nfor i in range(1, 10):\n if((i-1)*111<x and x<=i*111)\n print(i*111)', 'N = int(input())\nfor i in range(1, 10):\n if((i-1)*111<N and N<=i*111):\n print(i*111)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s486278223', 's718051772', 's644209381']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[95, 90, 94]
p03243
u863370423
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['a=int(input())\nx=a+1000\nw=[0,0,0]\nw[0]=x%10\nx=x//10\nw[1]=x%10\nx=x//10\nw[2]=x%10\nprint(w)\nflag=0\nfor i in range(2):\n if w[i]==w[i+1]:\n pass\n else:\n flag+=1\n\nif flag==0:\n print(a)\nelse:\n w=sorted(w)\n\n e=1\n a=0\n for i in range(3):\n a+=w[2]*e\n e*=10\n print(a)\n\n\n\n\n\n\n\n\n', 'def notOk(x):\n s = x % 10\n x //= 10\n while x > 0:\n if(s != x % 10):\n return 1\n x //= 10\n return 0\n\nn = int(input())\nwhile(notOk(n)):\n n += 1\nprint(n)\n']
['Wrong Answer', 'Accepted']
['s979423880', 's643090829']
[3064.0, 2940.0]
[17.0, 18.0]
[314, 190]
p03243
u863841238
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
["n = int(input())\nn_list = []\n\nwhile n != 0:\n n_list.append(n%10)\n n //= 10\nn_list.reverse()\n\nif n_list[0] < n_list[1]:\n ans = n_list[1]\nelif max(n_list) > n_list[0]:\n ans = n_list[0]\nelse:\n ans = max(n_list)\n\nfor _ in range(len(n_list)):\n print(ans,end='')", "n = int(input())\nn_list = []\n\nwhile n != 0:\n n_list.append(n%10)\n n //= 10\n\nans = max(n_list)\n\nfor _ in range(len(n_list)):\n print(ans,end='')", "n = int(input())\nn_list = []\n\nwhile n != 0:\n n_list.append(n%10)\n n //= 10\n n_list.reverse()\n\nif max(n_list)-n_list[0] > 0:\n ans = n_list[0]\nelse:\n ans = max(n_list)\n\nfor _ in range(len(n_list)):\n print(ans,end='')", 'n = int(input())\n\ncompare = 111\nwhile n > compare:\n compare += 111\n\nprint(compare)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s175442733', 's439011260', 's632619875', 's396638730']
[3064.0, 3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[274, 151, 232, 85]
p03243
u864010555
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\n\nans=0\nwhile(True):\n ans+=111\n if(ans>=N):\n print(ans)\n break\n ', 'N=int(input())\n \nans=0\n\nwhile(True):\n ans+=111\n if(ans>=N):\n print(ans)\n break']
['Runtime Error', 'Accepted']
['s807108230', 's407167498']
[2940.0, 2940.0]
[17.0, 18.0]
[88, 86]
p03243
u866769581
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = input()\nif int(n) < int(n[0]*3): print(n[0]*3)\nelse: print(str(int(n[0])+1)*3)\n', 'n = input()\nif int(n) <= int(n[0]*3): print(n[0]*3)\nelse: print(str(int(n[0])+1)*3)\n']
['Wrong Answer', 'Accepted']
['s116432940', 's079399774']
[2940.0, 2940.0]
[17.0, 17.0]
[83, 84]
p03243
u872887731
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['a = int(input()))\nb = int(a /100)\nif a > (100b + 10b +b -1):\n print(100(b+1) + 10(b+1) +b +1)\nelse:\n print(100b + 10b + b)', 'a = int(input())\nb = int(a /100)\nif a > (100*b + 10*b +b -1):\n print(100*(b+1) + 10*(b+1) +b +1)\nelse:\n print(100*b + 10*b + b)', 'a = int(input())\nb = int(a /100)\nif a > (100*b + 10*b +b ):\n print(100*(b+1) + 10*(b+1) +b +1)\nelse:\n print(100*b + 10*b + b)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s162249563', 's313102575', 's113582377']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[128, 133, 131]
p03243
u875855656
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\nprint(1111 if n==999 else 111*(n//111) if n<111*(n//111) else 111*(n//111+1))', 'n=int(input())\nprint(111*(n//111) if n<=111*(n//111) else 111*(n//111+1))']
['Wrong Answer', 'Accepted']
['s046373766', 's579849092']
[2940.0, 2940.0]
[17.0, 17.0]
[92, 73]
p03243
u883203948
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['data = input()\n\nsc = 0\nans = []\nif (data[0] == data[1]) & (data[0] == data[2]):\n data = int(data)\n print(*data)\nelif int(data[0]) > int(data[1]):\n sc = int(data[0])\n ans = 100 * sc + 10 * sc + sc\n print(ans)\nelse:\n sc = int(data[0]) + 1\n ans = 100* sc + 10 * sc + sc\n print(ans)\n\n\n \n \n', 'data = input()\n\nsc = 0\nans = []\nif (data[0] == data[1]) & (data[0] == data[2]):\n data = int(data)\n print(data)\nelif int(data[0]) > int(data[1]):\n sc = int(data[0])\n ans = 100 * sc + 10 * sc + sc\n print(ans)\nelif int(data[0]) == int(data[1]):\n if int(data[1]) > int(data[2]):\n sc = int(data[0])\n ans = sc * 100 + sc * 10 + sc\n print(ans)\n else :\n sc = int(data[0]) + 1\n ans = 100* sc + 10 * sc + sc\n print(ans)\n\n\n \nelse:\n sc = int(data[0]) + 1\n ans = 100* sc + 10 * sc + sc\n print(ans)\n\n\n \n \n']
['Runtime Error', 'Accepted']
['s529627307', 's331463440']
[3060.0, 3064.0]
[17.0, 18.0]
[315, 576]
p03243
u883792993
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N=int(input())\na = N//100+N//100*10+N//100\nb = (N//100+1)*100+(N//100+1)*10+(N//100+1)\nprint(a*(N<=a)+b*(N>a))', 'N=int(input())\na = N//100*100+N//100*10+N//100\nb = (N//100+1)*100+(N//100+1)*10+(N//100+1)\nprint(a*(N<=a)+b*(N>a))']
['Wrong Answer', 'Accepted']
['s930625594', 's673515115']
[2940.0, 2940.0]
[18.0, 17.0]
[110, 114]
p03243
u887207211
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\n\nif(N%111 == 0):\n N += 1\nelse:\n print(((N // 111) + 1) * 111)\n', 'N = int(input())\nif N%111 == 0:\n print(N)\nelse:\n print(111*(N//111+1))']
['Wrong Answer', 'Accepted']
['s035272262', 's293477039']
[2940.0, 2940.0]
[18.0, 17.0]
[81, 72]
p03243
u887524368
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\ns = int(N / 111)\n\nx = (s + 1) * 111\nprint(x)', 'N = int(input())\ns = int((N - 1) / 111)\n\nx = (s + 1) * 111\nprint(x)']
['Wrong Answer', 'Accepted']
['s604849995', 's394058073']
[3060.0, 2940.0]
[21.0, 17.0]
[61, 67]
p03243
u898967808
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nt = n//100\nt*=111\nif t>n:\n print(t)\nelse:\n print(t+111)', 'n = int(input())\nt = n//100\nt*=111\nif t>=n:\n print(t)\nelse:\n print(t+111)']
['Wrong Answer', 'Accepted']
['s987739692', 's058170759']
[2940.0, 2940.0]
[17.0, 17.0]
[74, 75]
p03243
u911153222
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['from math import ceil\n\n\nn = int(input())\nprint(111 * ceil(n // 111)\n ', 'n = int(input())\nm = n // 100\n\nif m == 1:\n print(222)\nelif m == 2:\n print(333)\nelif m == 3:\n print(444)\nelif m == 4:\n print(555)\nelif m == 5:\n print(666)\nelif m == 6:\n print(777)\nelif m == 7:\n print(888)\nelif m == 8:\n print(999)\nelse:\n print(1111)\n ', 'import math\n\n\nn = int(input())\nprint(111 * math.ceil(n / 111)\n ', 'from math import ceil\n\n\nn = int(input())\nprint(111 * ceil(n / 111)\n ', 'import math\n\n\nn = int(input())\nprint(111 * math.ceil(n / 111))']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s082909682', 's092637952', 's543885701', 's918938679', 's902513201']
[2940.0, 3060.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[74, 258, 68, 73, 62]
p03243
u911438260
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\nif N % 111 == 0:\n print(N)\nfor i in range(10):\n if N // 111 == i:\n print(111 * (i + 1) )', 'N = int(input())\nif N % 111 == 0:\n print(N)\nfor i in range(10):\n if N // 111 = i:\n print(111 * (i + 1) )', 'N = int(input())\nif N % 111 == 0:\n print(N)\nfor i in range(10):\n if N % 111 != 0 and N // 111 == i:\n print(111 * (i + 1) )']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s235186794', 's556163757', 's803078449']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[110, 109, 127]
p03243
u919633157
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\na=[int(str(i)*3)-n for i in range(1,10)]\nprint(a)\nans=[j for j in a if j>=0]\nprint(n+min(ans))', 'n=int(input())\na=[int(str(i)*3)-n for i in range(1,10)]\nans=[j for j in a if j>=0]\nprint(n+min(ans))']
['Wrong Answer', 'Accepted']
['s838336902', 's564525021']
[3060.0, 3060.0]
[17.0, 17.0]
[109, 100]
p03243
u923712635
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['N = int(input())\na = int(N/111)\nprint(111*(a+1))\n', 'N = int(input())\na = int((N-1)/111)\nprint(111*(a+1))']
['Wrong Answer', 'Accepted']
['s844740522', 's175070760']
[2940.0, 2940.0]
[17.0, 17.0]
[49, 52]
p03243
u931462344
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\na = n // 100\nif n%10 > a:\n for _ in range(3):\n print(a,end="")\nelif n%10 == a:\n for _ in range(3):\n print(a,end="")\nelse:\n for _ in range(3):\n print(a+1,end="")', 'n = int(input())\na = n // 100\nif n%10 > a:\n for _ in range(3):\n print(a+1,end="")\nelif n%10 == a:\n for _ in range(3):\n print(a,end="")\nelse:\n for _ in range(3):\n print(a,end="")', 'n = int(input())\nx = 111\nfor i in range(2,10):\n if n <= x:\n print(x)\n exit()\n x = 111*i\nprint(x)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s125730943', 's995111075', 's406107807']
[3060.0, 3060.0, 2940.0]
[17.0, 17.0, 18.0]
[208, 208, 116]
p03243
u940279019
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nans = 0\nfor i in range(9):\n j = i+1\n a = 100*j + 10*j + j\n if n < a:\n ans = a\n break\n if n > a:\n k = j+1\n b = 100*k + 10*k + k\n if n < b:\n ans = b\n break\nprint(ans)', 'n = int(input())\nans = 0\nfor i in range(9):\n j = i+1\n a = 100*j + 10*j + j\n if n <= a:\n ans = a\n break\n if n > a:\n k = j+1\n b = 100*k + 10*k + k\n if n < b:\n ans = b\n break\nprint(ans)']
['Wrong Answer', 'Accepted']
['s862348565', 's995910867']
[3060.0, 3060.0]
[17.0, 17.0]
[210, 211]
p03243
u947617358
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\nwhile True:\n n+=1\n if len(set(str(n)))==1:\n print(n)\n break\n \n', 'n=int(input())\nif len(set(str(n)))==1:\n print(n)\nelse:\n\n while True:\n n+=1\n if len(set(str(n)))==1:\n print(n)\n break\n \n']
['Wrong Answer', 'Accepted']
['s062936631', 's142541874']
[2940.0, 2940.0]
[17.0, 17.0]
[100, 162]
p03243
u953379577
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\n\nt = 0\n \nwhile t*111 < n < (t+1)*111:\n t += 1\n \nprint(t*111)', 'n = int(input())\n\nt = 0\n \nwhile t*111 <= n and n >= (t+1)*111:\n t += 1\n \nprint((t+1)*111)', 'n = int(input())\n\nt = 0\n \nwhile t*111 < n and n > (t+1)*111:\n t += 1\n \nprint((t+1)*111)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s229110956', 's262005737', 's085491212']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[86, 99, 97]
p03243
u958612488
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n=int(input())\nfor count in range(10):\n if 100*count+10*count+count>n-1:\n input(100*count+10*count+count)\n break\n else:\n pass', 'n=int(input())\nfor count in range(10):\n if 100*count+10*count+count>n-1:\n print(100*count+10*count+count)\n break\n else:\n pass']
['Runtime Error', 'Accepted']
['s412256492', 's357522208']
[3060.0, 2940.0]
[20.0, 18.0]
[152, 152]
p03243
u961683878
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nfor i in range(111,999,111):\n if i< n < i+111:\n ans = i + 111\n break\nprint(int(ans))\n', 'n = int(input())\nfor i in range(111,999,111):\n if i<= n <= i+111:\n ans = i + 111\n break\n else:\n ans = 1111\nprint(int(ans))', 'n = int(input())\nfor i in range(111,999,111):\n if i<= n < i+111:\n ans = i + 111\n break\n else:\n ans = 1111\nprint(int(ans))', 'n = int(input())\nif (n % 111) == 0:\n\tans = (n // 111) * 111\nelse:\n\tans = (n // 111 +1) * 111\nprint(int(ans))']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s012082879', 's252823151', 's922376753', 's962842186']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 19.0, 18.0, 17.0]
[119, 147, 146, 108]
p03243
u961916328
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nwhile n % 111 == 0:\n n += 1\nprint(n)', 'n = int(input())\nwhile n % 111 != 0:\n n += 1\nprint(n)']
['Wrong Answer', 'Accepted']
['s589708449', 's751928755']
[2940.0, 2940.0]
[17.0, 17.0]
[54, 54]
p03243
u969848070
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = input()\nfor i in range(int(n), 1000):\n if i.count(n[0]) == 3:\n print(i)\n exit()', 'n = input()\nfor i in range(int(n), 1000):\n if str(i).count(str(i)[0]) == 3:\n print(i)\n exit()']
['Runtime Error', 'Accepted']
['s802371671', 's277322261']
[9164.0, 9072.0]
[23.0, 29.0]
[90, 100]
p03243
u973013625
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nwhile n % 111 != 0:\n x = n+1\n n += 1\nprint(x)', 'n = int(input())\nif n % 111 == 0:\n x = n\nwhile n % 111 != 0:\n x = n+1\n n += 1\n\nprint(x)']
['Runtime Error', 'Accepted']
['s890651330', 's462797423']
[2940.0, 2940.0]
[17.0, 19.0]
[68, 96]
p03243
u982594421
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['n = int(input())\nprint((n // 111 + 1) * 111)\n', 'n = int(input())\nif n % 111 == 0:\n print(n)\nelse:\n print((n // 111 + 1) * 111)\n']
['Wrong Answer', 'Accepted']
['s207600662', 's398268832']
[2940.0, 2940.0]
[17.0, 17.0]
[45, 81]
p03243
u996914289
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['s = input()\nif int(s[0])>int(s[1]) & int(s[0])>int(s[2]):\n print(int(s[0])*111)\nelse:\n print((int(s[0])+1)*111)\n', 'x=input()\nif int(x[0])>int(x[1]):\n if int(x[0])>int(x[2]):\n print(int(x[0])*111)\n else:\n print((int(x[0])+1)*111)\nelse:\n print((int(x[0])+1)*111)', 's = input()\nif int(s[0])>=int(s[1]) and int(s[0])>=int(s[2]):\n print(int(s[0])*111)\nelse:\n print((int(s[0])+1)*111)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s420498822', 's843813035', 's715646373']
[2940.0, 3060.0, 2940.0]
[18.0, 17.0, 17.0]
[118, 154, 122]
p03243
u996952235
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['for i in range(int(input()), 100):\n if(str(i)[0] == str(i)[1] and str(i)[1] == str(i)[2]):\n print(i)\n break', 'n = int(input())\n\nfor i in range(n,1000):\n if i % 111 == 0:\n print(i)', 'n = int(input())\n \nfor i in range(n,1000):\n if i % 111 == 0:\n print(i)\n break']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s294519458', 's466017612', 's724592144']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[114, 70, 79]
p03243
u999482355
2,000
1,048,576
Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest ABC where Kurohashi can make his debut?
['print((1+(int(input()-1)//111))*111)', 'print((1+((int(input())-1))//111)*111)']
['Runtime Error', 'Accepted']
['s786412618', 's566937930']
[2940.0, 2940.0]
[19.0, 19.0]
[36, 38]
p03244
u002459665
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['import collections\n\nn = int(input())\nvalues = [int(i) for i in input().split()]\n\nodd = [] \neven = [] # gusu\n\nfor n, i in enumerate(values):\n if (n + 1) % 2 == 0:\n even.append(i)\n else:\n odd.append(i)\n\nodd_counts = collections.Counter(odd)\neven_counts = collections.Counter(even)\n\nodd_replace_num = n - odd_counts.most_common()[0][1]\neven_replace_num = n - even_counts.most_common()[0][1]\n\nprint(odd_replace_num + even_replace_num)\n', 'import collections\n\nnum = int(input())\nvalues = [int(i) for i in input().split()]\n\nodd = [] \neven = [] # gusu\n\nfor n, i in enumerate(values):\n if (n + 1) % 2 == 0:\n even.append(i)\n else:\n odd.append(i)\n\nodd_counts = collections.Counter(odd)\neven_counts = collections.Counter(even)\n\n# print(odd_counts.most_common())\n# print(even_counts.most_common())\n\nodd_most_common = odd_counts.most_common()\neven_most_common = even_counts.most_common()\n\nhalf_num = int(num / 2)\n\nif odd_most_common[0][0] != even_most_common[0][0]:\n odd_replace_num = half_num - odd_most_common[0][1]\n even_replace_num = half_num - even_most_common[0][1]\n print(odd_replace_num + even_replace_num)\nelse:\n answers = []\n odd_replace_num = half_num - odd_most_common[0][1]\n if len(even_most_common) == 1:\n even_replace_num = half_num\n else:\n even_replace_num = half_num - even_most_common[1][1]\n answers.append(odd_replace_num + even_replace_num)\n\n if len(odd_most_common) == 1:\n odd_replace_num = half_num\n else:\n odd_replace_num = half_num - odd_most_common[1][1]\n even_replace_num = half_num - even_most_common[0][1]\n answers.append(odd_replace_num + even_replace_num)\n\n print(min(answers))\n']
['Wrong Answer', 'Accepted']
['s360030122', 's273181067']
[20576.0, 23776.0]
[116.0, 118.0]
[460, 1256]
p03244
u011062360
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['import itertools\n\nn = int(input())\nlist_A = list(map(int, input().split()))\nL, R = [], []\nA, B = [[-1, 0], [-1, 0]]\n\nfor i in range(n):\n if i % 2 == 0:\n L.append(list_A[i])\n else:\n R.append(list_A[i])\n\nL = itertools.groupby(L)\nfor key, group in L:\n A.append([key, len(list(group))])\n\nA.sort(key=lambda x:x[1], reverse=True)\n\nR = itertools.groupby(R)\nfor key, group in R:\n B.append([key, len(list(group))])\n\nB.sort(key=lambda x:x[1], reverse=True)\n\nif A[0][0] != B[0][0]:\n print(n - A[0][1] - B[0][1])\nelse:\n print(min(n - A[1][1] - B[0][1], n - A[0][1] - B[1][1]))', 'from collections import Counter\n\nn = int(input())\nlist_A = list(map(int, input().split()))\nL, R = [], []\n\nfor i in range(n):\n if i % 2 == 0:\n L.append(list_A[i])\n else:\n R.append(list_A[i])\n\nA = Counter(L)\nA = sorted(A.items(), key=lambda x:x[1], reverse=True)\nA.append((-1, 0))\n\nB = Counter(R)\nB = sorted(B.items(), key=lambda x:x[1], reverse=True)\nB.append((-1, 0))\n\nif A[0][0] != B[0][0]:\n print(n - A[0][1] - B[0][1])\nelse:\n print(min(n - A[1][1] - B[0][1], n - A[0][1] - B[1][1]))\n']
['Runtime Error', 'Accepted']
['s857548324', 's625201582']
[20860.0, 25980.0]
[97.0, 100.0]
[596, 512]
p03244
u017415492
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n=int(input())\nv=list(map(int,input().split()))\nans1=[0]*(10**5+1)\nans2=[0]*(10**5+1)\nfor i in v[0::2]:\n ans1[i]+=1\nfor i in v[1::2]:\n ans2[i]+=1\nm1=max(ans1)\nm2=max(ans2)\nflag=False\nfor i in range(10**5+1):\n if ans1[i]==m1 and ans2[i]==m2:\n flag=True\n ans1.sort()\n ans2.sort()\n m12=ans1[-2]\n m22=ans2[-2]\n break\nprint(m1,m12,m2,m22)\nif len(set(v))==1:\n print(n//2)\nelif flag==True:\n print(n-max(m12+m2,m1+m22))\nelse:\n print(n-m1-m2)', 'n=int(input())\nv=list(map(int,input().split()))\nans1=[0]*(10**5+1)\nans2=[0]*(10**5+1)\nfor i in v[0::2]:\n ans1[i]+=1\nfor i in v[1::2]:\n ans2[i]+=1\nm1=max(ans1)\nm2=max(ans2)\nflag=False\nfor i in range(10**5+2):\n if ans1[i]==m1 and ans2[i]==m2:\n falg=True\n ans1.sort()\n ans2.sort()\n m12=ans1[-2]\n m22=ans2[-2]\n break\nif len(set(v))==1:\n print(n//2)\nelif flag:\n print(n-max(m12+m1,m21+m2))\nelse:\n print(n-m1-m2)', 'n=int(input())\nv=list(map(int,input().split()))\nans1=[0]*(10**5+1)\nans2=[0]*(10**5+1)\nfor i in v[0::2]:\n ans1[i]+=1\nfor i in v[1::2]:\n ans2[i]+=1\nm1=max(ans1)\nm2=max(ans2)\nflag=False\nfor i in range(10**5+1):\n if ans1[i]==m1 and ans2[i]==m2:\n flag=True\n ans1.sort()\n ans2.sort()\n m12=ans1[-2]\n m22=ans2[-2]\n break\nif len(set(v))==1:\n print(n//2)\nelif flag==True:\n print(n-max(m12+m2,m1+m22))\nelse:\n print(n-m1-m2)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s617040487', 's896765506', 's224488832']
[14404.0, 14008.0, 17380.0]
[75.0, 77.0, 78.0]
[471, 444, 450]
p03244
u025501820
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\nn = int(input())\nv = list(map(int, input().split()))\nif len(set(v)) == 1:\n print(n // 2)\n exit()\nkisu = v[::2]\ngusu = v[1::2]\nkisu_color = list(Counter(kisu).items())[:2]\ngusu_color = list(Counter(gusu).items())[:2]\nprint(kisu_color)\nprint(gusu_color)\nif kisu_color[0][0] != gusu_color[0][0]:\n ans = n - kisu_color[0][1] - gusu_color[0][1]\nelse:\n ans = min(n - kisu_color[0][1] - gusu_color[1][1], n - kisu_color[1][1] - gusu_color[0][1])\nprint(ans)', 'from collections import Counter\nn = int(input())\nv = list(map(int, input().split()))\nif len(set(v)) == 1:\n print(n // 2)\n exit()\nkisu = v[::2]\ngusu = v[1::2]\nkisu_color = Counter(kisu).most_common()[:2]\ngusu_color = Counter(gusu).most_common()[:2]\nif kisu_color[0][0] != gusu_color[0][0]:\n ans = n - kisu_color[0][1] - gusu_color[0][1]\nelse:\n ans = min(n - kisu_color[0][1] - gusu_color[1][1], n - kisu_color[1][1] - gusu_color[0][1])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s893642022', 's155815365']
[17548.0, 17500.0]
[83.0, 89.0]
[493, 457]
p03244
u026075806
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
["_ = input()\nseq = list(map(int,input().split()))\n \nseq1 = seq[::2]\nseq2 = seq[1::2]\n \nif len(set(seq)) == 1:\n print(min(len(seq1),len(seq2)))\n exit()\n \ndef count_dictonary(seq):\n ret_dict={}\n for item in seq:\n if item not in ret_dict:\n ret_dict[item] = 1\n else:\n ret_dict[item]+=1\n return ret_dict\n '''\nseq_dict1 = count_dictonary(seq1)\nseq_dict2 = count_dictonary(seq2)\n \nmin_change=len(seq)\nfor i1 in seq_dict1:\n for i2 in seq_dict2:\n ch1 = len(seq1) - seq_dict1[i1]\n ch2 = len(seq2) - seq_dict2[i2]\n #print(i1,i2,ch1,ch2,ch1+ch2)\n change_ = ch1+ch2\n if(min_change > ch1+ch2):\n min_change = ch1+ch2\n \nprint(min_change)\n'''", '_ = input()\nseq = list(map(int,input().split()))\n \nseq1 = seq[::2]\nseq2 = seq[1::2]\n \nif len(set(seq)) == 1:\n print(min(len(seq1),len(seq2)))\n exit()\n \ndef count_dictonary(seq):\n ret_dict={}\n for item in seq:\n if item not in ret_dict:\n ret_dict[item] = 1\n else:\n ret_dict[item]+=1\n return ret_dict\n \nseq_dict1 = count_dictonary(seq1)\nseq_dict2 = count_dictonary(seq2)\n\nprint(0)', 'def count_char_occurrence(seq):\n # count how many times characters occur and return results as a dictionary\n ret = {}\n for char in seq:\n if char in ret:\n ret[char] += 1\n else:\n ret[char] = 1\n return ret\n\n\ndef accum_char_frequency(seq):\n """\n accumulate frequency of each number in a inputted sequence\n Example:\n in: [a,a,a,a,b,b,b,b,c]\n out: { 4 times: [a,b] , 1 times: [c] }\n """\n frequencies = count_char_occurrence(seq)\n\n ret = {}\n for char, count in frequencies.items():\n if count in ret:\n ret[count].append(char)\n else:\n ret[count] = [char]\n return ret\n\n\ndef main():\n _ = input()\n seq = list(map(int, input().split()))\n\n odd = seq[::2]\n even = seq[1::2]\n\n if len(set(seq)) == 1: # when all chars are unique, return the length of even numbered chars\n print(len(even))\n return\n\n no_freq_odd = accum_char_frequency(odd)\n freq_odd = sorted(no_freq_odd.items(), reverse=True)\n \n no_freq_even = accum_char_frequency(even)\n freq_even = sorted(no_freq_even.items(), reverse=True)\n\n if len(freq_odd[0][1]) == 1 and len(freq_even[0][1]) == 1 and freq_odd[0][1] == freq_even[0][1]:\n min_change_even = len(seq)\n if len(freq_even) != 1:\n min_change_even = (len(odd) - freq_odd[0][0]) + (len(even) - freq_even[1][0])\n\n min_change_odd = len(seq)\n if len(freq_odd) != 1:\n min_change_odd = (len(odd) - freq_odd[1][0]) + (len(even) - freq_even[0][0])\n\n print(min(min_change_even, min_change_odd))\n return\n else:\n min_change = (len(odd) - freq_odd[0][0]) + (len(even) - freq_even[0][0])\n print(min_change)\n return\n\nmain()']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s468456785', 's732694359', 's799356510']
[3188.0, 18780.0, 16228.0]
[18.0, 62.0, 74.0]
[738, 431, 1765]
p03244
u026788530
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n = int(input())\n\nv = [int(i) for i in input().split()]\n\nv1 = {}\n\nv2 = {}\n\nfor i in range(n//2):\n if v[2 *i +1] in v1.keys():\n v1[v[2 * i +1]] += 1\n else:\n v1[v[2 * i + 1]] = 1\n\n if v[2 * i] in v2.keys():\n v2[v[2 * i]] += 1\n else:\n v2[v[2 * i]] = 1\n\n\nv1 = sorted(v1.items(),key=lambda x: - x[0])\nv2 = sorted(v2.items(),key=lambda x: - x[0])\nv1.reverse()\nv2.reverse()\nv1.append((None,0))\nv2.append((None,0))\n@print(v1)\nif v1[0][0] == v2[0][0]:\n ans = max(v1[0][1]+v2[1][1] , v1[1][1] + v2[0][1])\nelse:\n ans = v1[0][1] + v2[0][1]\n\nprint(n - ans)', 'n = int(input())\n\nv = [int(i) for i in input().split()]\n\nv1 = {}\n\nv2 = {}\n\nfor i in range(n//2):\n if v[2 *i +1] in v1.keys():\n v1[v[2 * i +1]] += 1\n else:\n v1[v[2 * i - 1]] = 1\n\n if v[2 * i] in v2.keys():\n v2[v[2 * i]] += 1\n else:\n v2[v[2 * i]] = 1\n\n\nv1 = sorted(v1.items(),key=lambda x: - x[0])\nv2 = sorted(v2.items(),key=lambda x: - x[0])\nv1.reverse()\nv2.reverse()\nv1.append((None,0))\nv2.append((None,0))\nprint(v1)\nans = 0\nif v1[0][0] == v2[0][0]:\n ans = max(v1[0][1]+v2[1][1] , v1[1][1] + v2[0][1])\nelse:\n ans = v1[0][1] + v2[0][1]\n\nprint(n - ans)', 'n = int(input())\n\nv = [int(i) for i in input().split()]\n\nv1 = {}\n\nv2 = {}\n\nfor i in range(n//2):\n if v[2 *i +1] in v1.keys():\n v1[v[2 * i +1]] += 1\n else:\n v1[v[2 * i + 1]] = 1\n\n if v[2 * i] in v2.keys():\n v2[v[2 * i]] += 1\n else:\n v2[v[2 * i]] = 1\n\n\nv1 = sorted(v1.items(),key=lambda x: - x[0])\nv2 = sorted(v2.items(),key=lambda x: - x[0])\nv1.reverse()\nv2.reverse()\nv1.append((None,0))\nv2.append((None,0))\nprint(v1)\nif v1[0][0] == v2[0][0]:\n ans = max(v1[0][1]+v2[1][1] , v1[1][1] + v2[0][1])\nelse:\n ans = v1[0][1] + v2[0][1]\n\nprint(n - ans)', 'n = int(input())\n\nv = [int(i) for i in input().split()]\n\nv1 = {}\n\nv2 = {}\n\nfor i in range(n//2):\n if v[2 *i +1] in v1.keys():\n v1[v[2 * i +1]] += 1\n else:\n v1[v[2 * i - 1]] = 1\n\n if v[2 * i] in v2.keys():\n v2[v[2 * i]] += 1\n else:\n v2[v[2 * i]] = 1\n\n\nv1 = sorted(v1.items(),key=lambda x: - x[0])\nv2 = sorted(v2.items(),key=lambda x: - x[0])\nv1.reverse()\nv2.reverse()\nv1.append((None,0))\nv2.append((None,0))\n# print(v1)\nans = 0\nif v1[0][0] == v2[0][0]:\n ans = max(v1[0][1]+v2[1][1] , v1[1][1] + v2[0][1])\nelse:\n ans = v1[0][1] + v2[0][1]\n\nprint(n - ans)', 'n = int(input())\n\nv = [i for i in input().split()]\n\nv1 = {}\n\nv2 = {}\n\nfor i in range(n//2):\n if v[2 *i +1] in v1.keys():\n v1[v[2 * i +1]] += 1\n else:\n v1[v[2 * i + 1]] = 1\n\n if v[2 * i] in v2.keys():\n v2[v[2 * i]] += 1\n else:\n v2[v[2 * i]] = 1\n\n\nv1 = sorted(v1.items(),key=lambda x: x[1])\nv2 = sorted(v2.items(),key=lambda x: x[1])\nv1.reverse()\nv2.reverse()\nv1.append((None,0))\nv2.append((None,0))\n#print(v1)\nif v1[0][0] == v2[0][0]:\n ans = max(v1[0][1]+v2[1][1] , v1[1][1] + v2[0][1])\nelse:\n ans = v1[0][1] + v2[0][1]\n\nprint(n - ans)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s057008005', 's544067425', 's680518407', 's970236657', 's715222579']
[3064.0, 20568.0, 19284.0, 19284.0, 20120.0]
[17.0, 144.0, 141.0, 124.0, 108.0]
[590, 597, 589, 599, 583]
p03244
u033606236
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['import collections\n\nn = int(input())\nodd = []\neven = []\nfor i, j in enumerate(map(int, input().split())):\n if i % 2 == 0:\n even += [j]\n else:\n odd += [j]\nodd = sorted(collections.Counter(odd).items(), reverse=True, key=lambda x: x[1])\neven = sorted(collections.Counter(even).items(), reverse=True, key=lambda x: x[1])\n\nif len(odd) == 1 and len(even) == 1 and odd[0][0] == even[0][0]:\n print(n // 2)\nelif odd[0][0] == even[0][0]:\n if odd[0][1] == even[0][1]:\n for i in range(n//2):\n if odd[i][1] == even[i][1]:\n continue\n elif odd[i][1] > even[i][1]:\n print((n // 2 - odd[0][1]) + (n // 2 - even[1][1]))\n elif odd[i][1] < even[i][1]:\n print((n // 2 - odd[1][1]) + (n // 2 - even[0][1]))\n else:\n print((n // 2 - odd[0][1]) + (n // 2 - even[1][1]))\n elif odd[0][1] > even[0][1]:\n print((n // 2 - odd[0][1]) + (n // 2 - even[1][1]))\n elif odd[0][1] < even[0][1]\n print((n // 2 - odd[1][1]) + (n // 2 - even[0][1]))\nelse:\n print((n // 2 - odd[0][1]) + (n // 2 - even[0][1]))\n', 'import collections\n\n\nn = int(input())\nodd = []\neven = []\nfor i,j in enumerate(map(int,input().split())):\n if i % 2 == 0:\n even += [j]\n else:\n odd += [j]\nodd = sorted(collections.Counter(odd).items(),key=lambda x:(x[1]),reverse=True)\neven = sorted(collections.Counter(even).items(),key=lambda x:(x[1]),reverse=True)\n\nif len(odd) == 1 and len(even) == 1:\n if odd[0][0] == even[0][0]:\n print(n//2)\n else:\n print(0)\nelif len(odd) == 1 or len(even) == 1:\n if len(odd) == 1:\n print((n//2 - odd[0][1]) + (n//2 - even[1][1]))\n elif len(even) == 1:\n print((n//2 - odd[1][1]) + (n//2 - even[1][1]))\nelse:\n if odd[0][1] + even[1][1] > odd[1][1] + even[0][1]:\n print((n//2 - odd[0][1]) + (n//2 - even[1][1]))\n else:\n print((n//2 - odd[1][1]) + (n//2 - even[0][1]))', 'import collections\n\n\nn = int(input())\nodd = []\neven = []\nfor i,j in enumerate(map(int,input().split())):\n if i % 2 == 0:\n even += [j]\n else:\n odd += [j]\nodd = sorted(collections.Counter(odd).items(),key=lambda x:(x[1]),reverse=True)\neven = sorted(collections.Counter(even).items(),key=lambda x:(x[1]),reverse=True)\n\nif len(odd) == 1 and len(even) == 1:\n if odd[0][0] == even[0][0]:\n print(n//2)\n exit()\n else:\n print(0)\n exit()\n\nif odd[0][0] == even[0][0]:\n if len(odd) >= 2 and len(even) >= 2:\n if odd[0][1] + even[1][1] > odd[1][1] + even[0][1]:\n print((n//2 - odd[0][1]) + (n//2 - even[1][1]))\n else:\n print((n//2 - odd[1][1]) + (n//2 - even[0][1]))\n else:\n if len(odd) == 1:\n print((n//2 - odd[0][1]) + (n//2 - even[1][1]))\n else:\n print((n//2 - odd[1][1]) + (n//2 - even[0][1]))\nelse:\n print((n//2 - odd[0][1]) + (n//2 - even[0][1]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s088552295', 's869788586', 's880605744']
[3064.0, 20060.0, 20316.0]
[17.0, 130.0, 117.0]
[1122, 832, 973]
p03244
u038676814
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\n\nn = int(input())\nv = [int(i) for i in input().split()]\n\nki = v[::2]\ngu = v[1::2]\n\nki = Counter(ki)\ngu = Counter(gu)\n\nki = ki.most_common()\ngu = ki.most_common()\n\nif ki[0][0] == gu[0][0] :\n if(len(ki) == len(gu)) :\n print(n/2)\n else :\n if(ki[1][1] > gu[1][1]) :\n print(n-ki[1][1]-gu[0][1])\n else :\n print(n-ki[0][1]- gu[1][1])\n\nelse :\n print(n-ki[0][1]-gu[0][1])', 'from collections import Counter\n\nn = int(input())\nv = [int(i) for i in input().split()]\n\nki = v[::2]\ngu = v[1::2]\n\nki = Counter(ki)\ngu = Counter(gu)\n\nki = ki.most_common()\ngu = gu.most_common()\n\nif ki[0][0] == gu[0][0] :\n if len(ki) == 1 and len(gu) == 1 :\n print(int(n/2))\n else :\n if ki[1][1] > gu[1][1] :\n print(n-ki[1][1]-gu[0][1])\n else :\n print(n-ki[0][1]- gu[1][1])\n\nelse :\n print(n-ki[0][1]-gu[0][1])']
['Runtime Error', 'Accepted']
['s158895652', 's645763660']
[18784.0, 18776.0]
[77.0, 88.0]
[446, 460]
p03244
u039623862
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['import heapq\nimport collections\nn = int(input())\nv = list(map(int, input().split()))\n\ncnts = [collections.Counter(v[::2]), collections.Counter(v[1::2])]\n\nhs = [[], []]\nfor i in range(2):\n for k, c in cnts[i].items():\n heapq.heappush(hs[i], (-c, k))\nh0 = heapq.heappop(hs[0])\nh1 = heapq.heappop(hs[1])\nif h0[1] == h1[1]:\n if not hs[0] and not hs[1]:\n print(n//2)\n elif not hs[0]:\n print(n+h1[0])\n elif not hs[1]:\n print(n+h0[0])\n else:\n n0 = heapq.heappop(hs[0])\n n1 = heapq.heappop(hs[1])\n print(n - max(-h0[0]-n1[0], -n0[0]-h1[0]))\nelse:\n print(n-(h0[0]+h1[0]))\n', 'import heapq\nimport collections\nn = int(input())\nv = list(map(int, input().split()))\n\ncnts = [collections.Counter(v[::2]), collections.Counter(v[1::2])]\n\nif cnts[0] == cnts[1]:\n print(n//2)\n exit()\n\nhs = [[], []]\nfor i in range(2):\n for k, c in cnts[i].items():\n heapq.heappush(hs[i], (-c, k))\nh0 = heapq.heappop(hs[0])\nh1 = heapq.heappop(hs[1])\nif h0[1] == h1[1]:\n if cnts[0] == cnts[1]:\n print(n//2)\n exit()\n n0 = heapq.heappop(hs[0])\n n1 = heapq.heappop(hs[1])\n print(n - max(-h0[0]-n1[0], -n0[0]-h1[0]))\nelse:\n print(n-(h0[0]+h1[0]))\n', 'import heapq\nimport collections\nn = int(input())\nv = list(map(int, input().split()))\n\ncnts = [collections.Counter(v[::2]), collections.Counter(v[1::2])]\n\nhs = [[], []]\nfor i in range(2):\n for k, c in cnts[i].items():\n heapq.heappush(hs[i], (-c, k))\nh0 = heapq.heappop(hs[0])\nh1 = heapq.heappop(hs[1])\nif h0[1] == h1[1]:\n if not hs[0] and not hs[1]:\n print(n//2)\n elif not hs[0]:\n print(n+h1[0])\n elif not hs[1]:\n print(n+h0[0])\n else:\n n0 = heapq.heappop(hs[0])\n n1 = heapq.heappop(hs[1])\n print(n + min(h0[0]+n1[0], n0[0]+h1[0]))\nelse:\n print(n+(h0[0]+h1[0]))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s365923797', 's760702465', 's354105298']
[20788.0, 20608.0, 20792.0]
[116.0, 110.0, 111.0]
[630, 583, 628]
p03244
u046592970
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n = int(input())\nv = list(map(int,input().split()))\n\ne = Counter(v[::2])\no = Counter(v[1::2])\n\ne = sorted([(k,v) for k, v in e.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\no = sorted([(k,v) for k, v in o.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\n\nif e[0][0] != o[0][0]:\n print(n - e[0][1] - o[0][1])\nelse:\n print(n - max(e[0][1] + o[1][1], e[1][1] + o[0][1]))', 'from collections import Counter\nn = int(input())\nv = list(map(int,input().split()))\n\ne = Counter(v[::2])\no = Counter(v[1::2])\n\nev = sorted([(k,i) for k, i in e.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\nod = sorted([(k,i) for k, i in o.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\n\nif ev[0][0] != od[0][0]:\n print(n - ev[0][1] - od[0][1])\nelse:\n print(n - max(ev[0][1] + od[1][1], ev[1][1] + od[0][1]))\nprint(ev,od)', 'from collections import deque\nn = int(input())\nv = list(map(int,input().split()))\n\ne = Counter(v[::2])\no = Counter(v[1::2])\n\ne = sorted([(k,v) for k, v in e.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\no = sorted([(k,v) for k, v in o.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\n\nif e[0][0] != o[0][0]:\n print(n - e[0][1] - o[0][1])\nelse:\n print(n - max(e[0][1] + o[1][1], e[1][1] + o[0][1]))', 'from collections import Counter\nn = int(input())\nv = list(map(int,input().split()))\n\ne = Counter(v[::2])\no = Counter(v[1::2])\n\nev = sorted([(k,i) for k, i in e.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\nod = sorted([(k,i) for k, i in o.items()],key = lambda z:z[1],reverse = True) + [(0,0)]\n\nif ev[0][0] != od[0][0]:\n print(n - ev[0][1] - od[0][1])\nelse:\n print(n - max(ev[0][1] + od[1][1], ev[1][1] + od[0][1]))\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s043590764', 's407641149', 's672569422', 's452595693']
[14268.0, 23616.0, 14884.0, 21560.0]
[42.0, 134.0, 44.0, 108.0]
[388, 443, 418, 431]
p03244
u047197186
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\n\nn = int(input())\nvs = input().split()\neven = []\nodd = []\nif not even == odd:\n for i, v in enumerate(vs):\n \tif i % 2 == 0:\n \teven.append(int(v))\n else:\n \todd.append(int(v))\n counter_even = Counter(even)\n counter_odd = Counter(odd)\n\n res = len(even) - counter_even.most_common()[0][1] + len(odd) - counter_odd.most_common()[0][1] \nelse:\n res = len(even)\nprint(res)', 'from collections import Counter\n\nn = int(input())\nvs = input().split()\neven = []\nodd = []\nif not even == odd:\n for i, v in enumerate(vs):\n \tif i % 2 == 0:\n \teven.append(int(v))\n else:\n \todd.append(int(v))\n counter_even = Counter(even)\n counter_odd = Counter(odd)\n\n res = len(even) - counter_even.most_common()[0][1] + len(odd) - counter_odd.most_common()[0][1] \nelse:\n res = len(even)\nprint(res)', 'from collections import Counter\n\nn = int(input())\nvs = input().split()\neven = []\nodd = []\n\nif len(list(set(vs))) == 1:\n res = int(len(vs) / 2)\nelse:\n for i, v in enumerate(vs):\n if i % 2 == 0:\n even.append(int(v))\n else:\n odd.append(int(v))\n counter_even = Counter(even)\n counter_odd = Counter(odd)\n if counter_even.most_common()[0][0] != counter_odd.most_common()[0][0]:\n res = len(even) - counter_even.most_common()[0][1] + len(odd) - counter_odd.most_common()[0][1]\n else:\n res1 = len(even) - counter_even.most_common()[1][1] + len(odd) - counter_odd.most_common()[0][1]\n res2 = len(even) - counter_even.most_common()[0][1] + len(odd) - counter_odd.most_common()[1][1]\n res = min(res1, res2)\nprint(res)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s486391546', 's901621215', 's403260036']
[2940.0, 2940.0, 26092.0]
[17.0, 17.0, 157.0]
[410, 410, 742]
p03244
u047816928
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n = int(input())\nv = list(map(int, input().split()))\nw = [0]*(10**5+1)\nfor x in v: w[x]+=1\nprint(n-sum(sorted(w)[:2]))', 'N = int(input())\nV = list(map(int, input().split()))\n\nd1 = {0:0}\nd2 = {0:0}\nfor i, v in enumerate(V):\n d = d2 if i&1 else d1\n if v not in d: d[v]=0\n d[v]+=1\n \n\nd1 = sorted(list(d1.items()), key=lambda x:-x[1])\nd2 = sorted(list(d2.items()), key=lambda x:-x[1])\n\nif d1[0][0]!=d2[0][0]:\n print(N-d1[0][1]-d2[0][1])\nelse:\n print(min(N-d1[1][1]-d2[0][1], N-d1[0][1]-d2[1][1]))']
['Wrong Answer', 'Accepted']
['s847747355', 's666137726']
[14396.0, 18072.0]
[59.0, 119.0]
[118, 389]
p03244
u050698451
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\nn = int(input())\nv = list(map(int, input().split()))\n\na = []\nb = []\nfor i in range(n//2):\n a.append(v[2*i])\n b.append(v[2*i+1])\n\ndef change(list):\n counter = Counter(list)\n m_ap1, m_ap2 = counter.most_common()[0][0], counter.most_common()[1][0]\n l = len(list)\n cnt = 0\n for i in range(l):\n if list[i] != m_ap1:\n cnt1 += 1\n if list[i] != m_ap2:\n cnt2 += 1\n return cnt1, cnt2, m_ap1, m_ap2\nca1, ca2, ma1, ma2 = change(a)\ncb1, cb2, mb1, mb2 = change(b)\n\nif ca1+cb1:\n if ma1 != mb1:\n print(ca1+cb1)\n else:\n print(min(ca1+cb2,cb1+ca2))\nelse:\n print(n//2)\n', "from collections import Counter\nn = int(input())\nv = list(map(int, input().split()))\n\na = []\nb = []\nfor i in range(n//2):\n a.append(v[2*i])\n b.append(v[2*i+1])\n\ndef change(list):\n counter = Counter(list)\n m_ap1 = '0'\n m_ap2 = '0'\n if len(counter.most_common()) > 1:\n m_ap1, m_ap2 = counter.most_common()[0][0], counter.most_common()[1][0]\n else:\n m_ap1 = counter.most_common()[0][0]\n l = len(list)\n cnt1 = 0\n cnt2 = 0\n for i in range(l):\n if list[i] != m_ap1:\n cnt1 += 1\n if list[i] != m_ap2:\n cnt2 += 1\n return cnt1, cnt2, m_ap1, m_ap2\nca1, ca2, ma1, ma2 = change(a)\ncb1, cb2, mb1, mb2 = change(b)\n# print(change(a))\n# print(change(b))\nif ca1+cb1:\n if ma1 != mb1:\n print(ca1+cb1)\n else:\n print(min(ca1+cb2,cb1+ca2))\nelse:\n if ma1 != mb1:\n print(ca1+cb1)\n else:\n print(n//2)\n"]
['Runtime Error', 'Accepted']
['s192453545', 's988299706']
[15972.0, 17492.0]
[98.0, 152.0]
[665, 901]
p03244
u057109575
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\n\nn, *v = map(int, open(0).read().split())\nif v[::2] == v[1::2]:\n print(n // 2)\n else:\n print(n - Counter(v[::2]).most_common()[0][1] - Counter(v[1::2]).most_common()[0][1])\n', 'from collections import Counter\n\nn, *v = map(int, open(0).read().split())\nc1 = Counter(v[::2]).most_common()\nc2 = Counter(v[1::2]).most_common()\n\nc1.append([0, 0])\nc2.append([0, 0])\n\nif c1[0][0] != c2[0][0]:\n print(n - c1[0][1] - c2[0][1])\nelse:\n print(min(n - c1[0][1] - c2[1][1], n - c1[1][1] - c2[0][1]))\n']
['Runtime Error', 'Accepted']
['s016524442', 's221448828']
[2940.0, 20520.0]
[18.0, 85.0]
[222, 310]
p03244
u058750581
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\n\nn = int(input())\nv = list(map(int, input().strip().split(" ")))\nodd = []\neven = []\nfor i in range(len(v)):\n if(i % 2 == 0):\n even.append(v[i])\n else:\n odd.append(v[i])\n\n\nc_even = Counter(even).most_common(2)\nc_odd = Counter(odd).most_common(2)\n\nprint(c_even, c_odd)\n\nif(c_even[0][0] != c_odd[0][0]):\n print(n - c_even[0][1] - c_odd[0][1])\nelif(len(c_even) != 1 and len(c_odd) != 1):\n second = max[c_even[1][1], c_odd[1][1]]\n print(n - c_even[0][1] - second)\nelse:\n print(min([c_even[0][1], c_odd[0][1]]))', 'from collections import Counter\n \nn = int(input())\nv = list(map(int, input().split()))\nodd = v[::2]\neven = v[1::2]\n \nc_even = Counter(even).most_common(2)\nc_odd = Counter(odd).most_common(2)\n\nprint(c_even, c_odd)\n \nif(c_even[0][0] != c_odd[0][0]):\n print(n - c_even[0][1] - c_odd[0][1])\nelif(len(c_even) >= 2 and len(c_odd) >= 2):\n second = max[c_even[1][1], c_odd[1][1]]\n print(n - c_even[0][1] - second)\nelse:\n print(n//2)', 'from collections import Counter\n \nn = int(input())\nv = list(map(int, input().split()))\nodd = v[::2]\neven = v[1::2]\n \nc_even = Counter(even).most_common(2)\nc_odd = Counter(odd).most_common(2)\n\n \nif(c_even[0][0] != c_odd[0][0]):\n print(n - c_even[0][1] - c_odd[0][1])\nelse:\n if(len(c_even) == 1):\n print(n//2)\n else:\n second = max([c_even[1][1], c_odd[1][1]])\n print(n - c_even[0][1] - second)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s249589456', 's442571417', 's763977394']
[16100.0, 15972.0, 15972.0]
[95.0, 74.0, 74.0]
[569, 445, 430]
p03244
u059210959
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['#encoding utf-8\ndef main(n,v):\n # n = int(input())\n \n even_v = []\n odd_v = []\n\n for i in range(n):\n if i%2 == 0:\n odd_v.append(v[i])\n else:\n even_v.append(v[i])\n\n odd_dic = {}\n even_dic = {}\n for i in range(len(odd_v)):\n if odd_v[i] in odd_dic.keys():\n odd_dic[odd_v[i]] += 1\n else:\n odd_dic[odd_v[i]] = 1\n\n for i in range(len(even_v)):\n if even_v[i] in even_dic.keys():\n even_dic[even_v[i]] += 1\n else:\n even_dic[even_v[i]] = 1\n\n tem_dic = {}\n for k, v in sorted(even_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n even_dic = tem_dic\n tem_dic = {}\n for k, v in sorted(odd_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n odd_dic = tem_dic\n\n \n # even_dic = sorted(even_dic.items(),key=lambda x:x[1])\n\n odd_keys = list(odd_dic.keys())\n even_keys = list(even_dic.keys())\n\n for i in range(len(odd_keys)-1):\n if odd_dic[odd_keys[i]] == odd_dic[odd_keys[i+1]]:\n if odd_keys[i] > odd_keys[i+1]:\n tem = odd_keys[i]\n odd_keys[i] = odd_keys[i+1]\n odd_keys[i+1] = tem\n\n for i in range(len(even_keys)-1):\n if even_dic[even_keys[i]] == even_dic[even_keys[i+1]]:\n if even_keys[i] > even_keys[i+1]:\n tem = even_keys[i]\n even_keys[i] = even_keys[i+1]\n even_keys[i+1] = tem\n\n\n print(even_dic,odd_dic)\n print(even_keys,odd_keys)\n if (len(odd_keys) == 1 and len(even_keys) == 1) and odd_keys[0] == even_keys[0]:\n answer = n/2\n elif odd_keys[0] == even_keys[0]:\n if odd_dic[odd_keys[0]] == even_dic[even_keys[0]]:\n if len(odd_keys) == 1:\n answer = n-even_dic[even_keys[1]]\n elif len(even_keys) == 1:\n answer = n-odd_dic[odd_keys[1]]\n else:\n ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n answer = min(ans1, ans2)\n elif len(odd_keys) == 1:\n print("a")\n answer = n-odd_dic[odd_keys[0]]-even_dic[even_keys[1]]\n elif len(even_keys) == 1:\n answer = n-odd_dic[odd_keys[1]]-even_dic[even_keys[0]]\n else:\n ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n answer = min(ans1, ans2)\n else:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[0]])\n\n print(int(answer))\n # return(int(answer))\n\nif __name__ == "__main__":\n n = int(input())\n v = list(int(i) for i in input().split())\n main(n,v)\n', '#encoding utf-8\n\nn = int(input())\nv = list(int(i) for i in input().split())\n\neven_v = []\nodd_v = []\n\nfor i in range(n):\n if i%2 == 0:\n odd_v.append(v[i])\n else:\n even_v.append(v[i])\n\nodd_dic = {}\neven_dic = {}\nfor i in range(len(odd_v)):\n if odd_v[i] in odd_dic.keys():\n odd_dic[odd_v[i]] += 1\n else:\n odd_dic[odd_v[i]] = 1\n\nfor i in range(len(even_v)):\n if even_v[i] in even_dic.keys():\n even_dic[even_v[i]] += 1\n else:\n even_dic[even_v[i]] = 1\n\n\nfor k, v in sorted(even_dic.items(), key=lambda x: -x[1]):pass\nfor k, v in sorted(odd_dic.items(), key=lambda x: -x[1]):pass\n\n\n# even_dic = sorted(even_dic.items(),key=lambda x:x[1])\n\nodd_keys = list(odd_dic.keys())\neven_keys = list(even_dic.keys())\n\n\n\n\n\n\n\n#\n\n# if even_dic[even_keys[i]] == even_dic[even_keys[i+1]]:\n# if even_keys[i] > even_keys[i+1]:\n# tem = even_keys[i]\n# even_keys[i] = even_keys[i+1]\n# even_keys[i+1] = tem\n\n\nprint(even_dic,even_keys)\n\nif odd_keys[0] != even_keys[0]:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[0]])\nelse:\n if len(odd_keys) == 1 and len(even_keys) == 1:\n answer = len(odd_v)\n else:\n if odd_dic[odd_keys[1]] > even_dic[even_keys[1]]:\n answer = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n else:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n # ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n # ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n # answer = min(ans1, ans2)\nprint(int(answer))\n\n\n\n', '#encoding utf-8\ndef main(n,v):\n # n = int(input())\n \n even_v = []\n odd_v = []\n\n for i in range(n):\n if i%2 == 0:\n odd_v.append(v[i])\n else:\n even_v.append(v[i])\n\n odd_dic = {}\n even_dic = {}\n for i in range(len(odd_v)):\n if odd_v[i] in odd_dic.keys():\n odd_dic[odd_v[i]] += 1\n else:\n odd_dic[odd_v[i]] = 1\n\n for i in range(len(even_v)):\n if even_v[i] in even_dic.keys():\n even_dic[even_v[i]] += 1\n else:\n even_dic[even_v[i]] = 1\n\n tem_dic = {}\n for k, v in sorted(even_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n even_dic = tem_dic\n tem_dic = {}\n for k, v in sorted(odd_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n odd_dic = tem_dic\n\n \n # even_dic = sorted(even_dic.items(),key=lambda x:x[1])\n\n odd_keys = list(odd_dic.keys())\n even_keys = list(even_dic.keys())\n\n for i in range(len(odd_keys)-1):\n if odd_dic[odd_keys[i]] == odd_dic[odd_keys[i+1]]:\n if odd_keys[i] > odd_keys[i+1]:\n tem = odd_keys[i]\n odd_keys[i] = odd_keys[i+1]\n odd_keys[i+1] = tem\n\n for i in range(len(even_keys)-1):\n if even_dic[even_keys[i]] == even_dic[even_keys[i+1]]:\n if even_keys[i] > even_keys[i+1]:\n tem = even_keys[i]\n even_keys[i] = even_keys[i+1]\n even_keys[i+1] = tem\n\n\n print(even_dic,odd_dic)\n print(even_keys,odd_keys)\n if (len(odd_keys) == 1 and len(even_keys) == 1) and odd_keys[0] == even_keys[0]:\n answer = n/2\n elif odd_keys[0] == even_keys[0]:\n if odd_dic[odd_keys[0]] == even_dic[even_keys[0]]:\n if len(odd_keys) == 1:\n answer = n-even_dic[even_keys[1]]\n elif len(even_keys) == 1:\n answer = n-odd_dic[odd_keys[1]]\n else:\n ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n answer = min(ans1, ans2)\n elif len(odd_keys) == 1:\n answer = n-odd_dic[odd_keys[0]]-even_dic[even_keys[1]]\n elif len(even_keys) == 1:\n answer = n-odd_dic[odd_keys[1]]-even_dic[even_keys[0]]\n else:\n ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n answer = min(ans1, ans2)\n else:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[0]])\n\n print(int(answer))\n # return(int(answer))\n\nif __name__ == "__main__":\n n = int(input())\n v = list(int(i) for i in input().split())\n main(n,v)', '#encoding utf-8\ndef main(n,v):\n n = int(input())\n v = list(int(i) for i in input().split())\n even_v = []\n odd_v = []\n\n for i in range(n):\n if i%2 == 0:\n odd_v.append(v[i])\n else:\n even_v.append(v[i])\n\n odd_dic = {}\n even_dic = {}\n for i in range(len(odd_v)):\n if odd_v[i] in odd_dic.keys():\n odd_dic[odd_v[i]] += 1\n else:\n odd_dic[odd_v[i]] = 1\n\n for i in range(len(even_v)):\n if even_v[i] in even_dic.keys():\n even_dic[even_v[i]] += 1\n else:\n even_dic[even_v[i]] = 1\n\n tem_dic = {}\n for k, v in sorted(even_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n even_dic = tem_dic\n tem_dic = {}\n for k, v in sorted(odd_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n odd_dic = tem_dic\n\n \n # even_dic = sorted(even_dic.items(),key=lambda x:x[1])\n\n odd_keys = list(odd_dic.keys())\n even_keys = list(even_dic.keys())\n\n \n \n \n \n \n \n #\n \n # if even_dic[even_keys[i]] == even_dic[even_keys[i+1]]:\n # if even_keys[i] > even_keys[i+1]:\n # tem = even_keys[i]\n # even_keys[i] = even_keys[i+1]\n # even_keys[i+1] = tem\n\n\n # print(even_dic,odd_dic)\n # print(even_keys,odd_keys)\n\n if odd_keys[0] != even_keys[0]:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[0]])\n else:\n if len(odd_keys) == 1 and len(even_keys) == 1:\n answer = len(odd_v)\n elif len(odd_keys) == 1:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n elif len(even_keys) == 1:\n answer = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n else:\n \n # answer = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n # else:\n # answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n answer = min(ans1, ans2)\n print(int(answer))\n # return(int(answer))\n\nif __name__ == "__main__":\n main()', '#encoding utf-8\ndef main(n,v):\n # n = int(input())\n \n even_v = []\n odd_v = []\n\n for i in range(n):\n if i%2 == 0:\n odd_v.append(v[i])\n else:\n even_v.append(v[i])\n\n odd_dic = {}\n even_dic = {}\n for i in range(len(odd_v)):\n if odd_v[i] in odd_dic.keys():\n odd_dic[odd_v[i]] += 1\n else:\n odd_dic[odd_v[i]] = 1\n\n for i in range(len(even_v)):\n if even_v[i] in even_dic.keys():\n even_dic[even_v[i]] += 1\n else:\n even_dic[even_v[i]] = 1\n\n tem_dic = {}\n for k, v in sorted(even_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n even_dic = tem_dic\n tem_dic = {}\n for k, v in sorted(odd_dic.items(), key=lambda x: -x[1]):\n tem_dic[k] = v\n odd_dic = tem_dic\n\n \n # even_dic = sorted(even_dic.items(),key=lambda x:x[1])\n\n odd_keys = list(odd_dic.keys())\n even_keys = list(even_dic.keys())\n\n for i in range(len(odd_keys)-1):\n if odd_dic[odd_keys[i]] == odd_dic[odd_keys[i+1]]:\n if odd_keys[i] > odd_keys[i+1]:\n tem = odd_keys[i]\n odd_keys[i] = odd_keys[i+1]\n odd_keys[i+1] = tem\n\n for i in range(len(even_keys)-1):\n if even_dic[even_keys[i]] == even_dic[even_keys[i+1]]:\n if even_keys[i] > even_keys[i+1]:\n tem = even_keys[i]\n even_keys[i] = even_keys[i+1]\n even_keys[i+1] = tem\n\n\n print(even_dic,odd_dic)\n # print(even_keys,odd_keys)\n if (len(odd_keys) == 1 and len(even_keys) == 1) and odd_keys[0] == even_keys[0]:\n answer = n/2\n elif odd_keys[0] == even_keys[0]:\n ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n answer = min(ans1, ans2)\n else:\n answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[0]])\n\n\n\n\n\n\n\n \n # answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[0]])\n # else:\n # if len(odd_keys) == 1 and len(even_keys) == 1:\n # answer = len(odd_v)\n # elif len(odd_keys) == 1:\n # answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n # elif len(even_keys) == 1:\n # answer = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n # else:\n \n # # answer = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n # # else:\n # # answer = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n # ans1 = n-int(odd_dic[odd_keys[0]])-int(even_dic[even_keys[1]])\n # ans2 = n-int(odd_dic[odd_keys[1]])-int(even_dic[even_keys[0]])\n # answer = min(ans1, ans2)\n print(int(answer))\n # return(int(answer))\n\nif __name__ == "__main__":\n n = int(input())\n v = list(int(i) for i in input().split())\n main(n,v)', '#encoding utf-8\n\nn = int(input())\nv = list(int(i) for i in input().split())\n\n\nv_odd = []\nv_even = []\nfor i in range(n):\n if i%2 == 0:\n v_odd.append(v[i])\n else:\n v_even.append(v[i])\n\n#odd part\ncount={}\nfor i in range(len(v_odd)):\n if v_odd[i] in count.keys():\n count[v_odd[i]] += 1\n else:\n count[v_odd[i]] = 1\n\nif len(count) == 1:\n pass\n # num_odd = 0\nelse:\n for k, v in sorted(count.items(), key=lambda x: -x[1]):\n pass\n keys = list(count.keys())\n # num_odd = len(v_odd)-int(count[keys[0]])\n# print(num)\n\n#even part\neven_count={}\n\nfor i in range(len(v_even)):\n if v_even[i] in even_count.keys():\n even_count[v_even[i]] += 1\n else:\n even_count[v_even[i]] = 1\n\nif len(even_count) == 1:\n pass\n \nelse:\n for k, v in sorted(even_count.items(), key=lambda x: -x[1]):\n pass\n even_keys = list(even_count.keys())\n \n\nif even_keys[0] == keys[0]:\n if len(keys) == 1 and len(even_keys) == 1:\n answer = int(len(keys))\n elif len(keys) == 1:\n answer = len(v_even)-int(v_even[even_keys[1]])\n elif len(even_keys) == 1:\n answer = len(v_odd)-int(v_odd[keys[1]])\n else:\n if int(v_even[even_keys[0]]) >= int(v_odd[keys[0]]):\n answer = len(v_odd)-int(count[keys[1]])\n answer += len(v_even)-int(even_count[even_keys[0]])\n else:\n answer = len(v_odd)-int(count[keys[0]])\n answer += len(v_even)-int(even_count[even_keys[1]])\nprint(int(answer))\n', '\nn = int(input())\nv = [int(i) for i in input().split()]\n\nki = v[::2]\ngu = v[1::2]\n\nki = Counter(ki)\ngu = Counter(gu)\n\nki = ki.most_common()\ngu = gu.most_common()\n\nans = 0\n\nif ki[0][0] == gu[0][0]:\n if len(ki) == 1 and len(gu) == 1:\n ans = int(n / 2)\n else:\n if ki[1][1] > gu[1][1]:\n ans = n - ki[1][1] - gu[0][1]\n else:\n ans = n - ki[0][1] - gu[1][1]\nelse:\n ans = n - ki[0][1] - gu[0][1]\n\nprint(ans)', '\nn = int(input())\nv = [int(i) for i in input().split()]\n\nki = v[::2]\ngu = v[1::2]\n\nki = Counter(ki)\ngu = Counter(gu)\n\nki = ki.most_common()\ngu = gu.most_common()\n\nans = 0\n\nif ki[0][0] == gu[0][0]:\n if len(ki) == 1 and len(gu) == 1:\n ans = int(n / 2)\n else:\n if ki[1][1] > gu[1][1]:\n ans = n - ki[1][1] - gu[0][1]\n else:\n ans = n - ki[0][1] - gu[1][1]\nelse:\n ans = n - ki[0][1] - gu[0][1]\n\nprint("答え",ans)', '#encoding utf-8\nfrom collections import Counter\ndef main(n,v):\n odd = Counter(v[0::2]).most_common(2) + [(0,0)]\n even = Counter(v[1::2]).most_common(2) + [(0,0)]\n\n if odd[0][0] == even[0][0]:\n ans = min(n-odd[0][1]-even[1][1],\n n-odd[1][1]-even[0][1])\n else:\n ans = n-odd[0][1]-even[0][1]\n print(ans)\n\n\nif __name__ == "__main__":\n n = int(input())\n v = list(int(i) for i in input().split())\n main(n,v)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s048576501', 's169166580', 's351340092', 's355240402', 's460188490', 's514994000', 's824850899', 's932374620', 's007409970']
[23708.0, 20472.0, 23704.0, 3192.0, 23776.0, 19920.0, 14268.0, 14276.0, 15580.0]
[184.0, 148.0, 188.0, 18.0, 172.0, 144.0, 45.0, 46.0, 81.0]
[2891, 1963, 2867, 2628, 3113, 1567, 451, 460, 446]
p03244
u062459048
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n = int(input())\nV = list(map(int,input().split()))\n\nv1 = []\nv2 = []\nfor i in range(0,n,2):\n v1.append(i)\nfor i in range(1,n,2):\n v2.append(i)\n \nv1s = set(v1)\nv2s = set(v2)\n \nv1c = []\nv2c = []\nfor i in list(v1s):\n v1c.append(v1.count(i))\nfor i in list(v2s):\n v2c.append(v2.count(i))\n\nv1c.sort(reverse=True)\nv2c.sort(reverse=True)\n\nprint(sum(v1c[1:])+sum(v2c[1:]))', 'n = int(input())\nV = list(map(int,input().split()))\n\nfrom collections import Counter\n\nv1 = []\nv2 = []\nfor i in range(0,n,2):\n v1.append(i)\nfor i in range(1,n,2):\n v2.append(i)\n \nc1 = Counter(v1)\nc2 = Counter(v2)\n\nif list(c1.keys())[0] == list(c2.keys())[0]:\n a1 = sum(list(c1.values())[1:])+list(c2.values())[0]+sum(list(c2.values()[2:]))\n a2 = sum(list(c2.values())[1:])+list(c1.values())[0]+sum(list(c1.values()[2:]))\n \n ans = min(a1,a2)\n \nelse:\n ans = sum(list(c1.values())[1:])+sum(list(c2.values())[1:])\n\nprint(ans)', 'n = int(input())\nV = list(map(int,input().split()))\n\nfrom collections import Counter\n\nv1 = []\nv2 = []\nfor i in range(0,n-1,2):\n v1.append(V[i])\nfor i in range(1,n,2):\n v2.append(V[i])\n \nc1 = Counter(v1).most_common() + [(0,0)]\nc2 = Counter(v2).most_common() + [(0,0)]\n\nif c1[0][0] == c2[0][0]:\n a1 = n -c1[1][1]-c2[0][1]\n a2 = n -c1[0][1]-c2[1][1]\n ans = min(a1,a2)\n \nelse:\n ans = n-c1[0][1]-c2[0][1]\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s519630039', 's797178371', 's076502697']
[17888.0, 20620.0, 21084.0]
[2104.0, 71.0, 101.0]
[369, 538, 420]
p03244
u063052907
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['from collections import Counter\n\n\nn = int(input())\nlst_v = list(map(int, input().split()))\n\n\nif len(set(lst_v)) == 1:\n ans = n // 2\nelse:\n lst_odd = lst_v[::2]\n lst_even = lst_v[1::2]\n cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])\n cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])\n o1 = cnt_odd[0]\n e1 = cnt_even[0]\n o2 = cnt_odd[1] if cnt_odd[1] else (0, 0)\n e2 = cnt_even[1] if cnt_even[1] else (0, 0)\n\n if o1[0] == e1[0]:\n rem_number = max(o1[1] + e2[1], o2[1] + e1[1])\n else:\n rem_number = o1[1] + e1[1]\n sum_odd = sum(t[1] for t in cnt_odd)\n sum_even = sum(t[1] for t in cnt_even)\n ans = sum_odd + sum_even - rem_number\n\n\nprint(ans)\n', 'from collections import Counter\n\n\nn = int(input())\nlst_v = list(map(int, input().split()))\n\n\nif len(set(lst_v)) == 1:\n ans = n // 2\nelse:\n lst_odd = [lst_v[i] for i in range(n) if i%2==0]\n lst_even = [lst_v[i] for i in range(n) if i%2!=0]\n print(lst_odd)\n print(lst_even)\n\n\n cnt_odd = list(Counter(lst_odd).values())\n cnt_even = list(Counter(lst_even).values())\n print(cnt_odd)\n print(cnt_even)\n\n ans = sum(cnt_odd) - max(cnt_odd) + sum(cnt_even) - max(cnt_even)\n\n\nprint(ans)\n', 'from collections import Counter\n\n\nn = int(input())\nlst_v = list(map(int, input().split()))\n\n\nlst_o = lst_v[::2]\nlst_e = lst_v[1::2]\ncnt_o = Counter(lst_o).most_common() + [(0, 0)]\ncnt_e = Counter(lst_e).most_common() + [(0, 0)]\n\n\nif cnt_o[0][0] == cnt_e[0][0]:\n rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])\nelse:\n rem_number = cnt_o[0][1] + cnt_e[0][1]\nans = n - rem_number\n\n\nprint(ans)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s472964884', 's619509703', 's730254298']
[21084.0, 17372.0, 21212.0]
[100.0, 97.0, 87.0]
[729, 506, 419]
p03244
u066017048
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['import collections\n\nn = int(input())\nvs = [int(i) for i in input().split()]\nevens = []\nodds = []\nfor i,num in enumerate(vs):\n if i % 2 == 0:\n evens.append(num)\n elif i % 2 == 1:\n odds.append(num)\n\ndef plana():\n if (len(set(vs)) == 2) and (len(set(evens)) == 1) and (len(set(odds)) == 1):\n return 0\n elif (len(set(vs)) == 1):\n return len(evens)\n ec = collections.Counter(evens)\n oc = collections.Counter(odds)\n\n count = 0\n count += (len(evens) - ec.most_common()[0][1])\n count += (len(odds) - oc.most_common()[0][1])\n return count\n\n# if len(set(vs)) == 1:\n# print(int(len(vs)/2))\n# elif (len(set(evens)) == 1) and (len(set(odds)) == 1):\n# print(0)\n# else:\nprint(0)\n\n', 'import collections\n\nn = int(input())\nvs = [int(i) for i in input().split()]\nevens = []\nodds = []\nfor i,num in enumerate(vs):\n if i % 2 == 0:\n evens.append(num)\n elif i % 2 == 1:\n odds.append(num)\n\ndef plana():\n if (len(set(vs)) == 2) and (len(set(evens)) == 1) and (len(set(odds)) == 1):\n return 0\n elif (len(set(vs)) == 1):\n return len(evens)\n ec = collections.Counter(evens)\n oc = collections.Counter(odds)\n\n count = 0\n count += (len(evens) - ec.most_common()[0][1])\n count += (len(odds) - oc.most_common()[0][1])\n return count\n\n# if len(set(vs)) == 1:\n# print(int(len(vs)/2))\n# elif (len(set(evens)) == 1) and (len(set(odds)) == 1):\n# print(0)\n# else:\nprint(int(len(odds)))\n\n', 'import collections\n\nn = int(input())\nvs = [int(i) for i in input().split()]\nevens = []\nodds = []\nfor i,num in enumerate(vs):\n if i % 2 == 0:\n evens.append(num)\n elif i % 2 == 1:\n odds.append(num)\n\ndef plana():\n if (len(set(vs)) == 2) and (len(set(evens)) == 1) and (len(set(odds)) == 1):\n return 0\n elif (len(set(vs)) == 1):\n return len(evens)\n ec = collections.Counter(evens)\n oc = collections.Counter(odds)\n\n \n if ec.most_common()[0][0] == oc.most_common()[0][0]:\n if len(set(evens))==1:\n return len(odds)-oc.most_common()[1][1]\n elif len(set(odds))==1:\n return len(evens)-ec.most_common()[1][1]\n e1 = ec.most_common()[0][1]\n e2 = ec.most_common()[1][1]\n o1 = oc.most_common()[0][1]\n o2 = oc.most_common()[1][1]\n count1 = 0\n count2 = 0\n count1 += (len(evens) - e1)\n count1 += (len(odds) - o2)\n count2 += (len(odds) - o1)\n count2 += (len(evens) - e2)\n if (count1 >= count2):\n return count2\n else:\n return count1\n\n # if ec.most_common()[0][1] >= oc.most_common()[0][1]:\n # count = 0\n \n \n # return count\n # elif ec.most_common()[0][1] < oc.most_common()[0][1]:\n # count = 0\n \n \n # return count\n\n count = 0\n count += (len(evens) - ec.most_common()[0][1])\n count += (len(odds) - oc.most_common()[0][1])\n return count\n\nprint(int(plana()))\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s317221108', 's417996004', 's447913352']
[14788.0, 14916.0, 20572.0]
[75.0, 74.0, 160.0]
[731, 744, 1741]
p03244
u067267880
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n=int(input())\nvlis=[int(i) for i in input().split()]\n\n\n# a[:6:2] #[0, 2, 4]\n\n# a[7::2] #[7, 9]\nodd=vlis[0::2]\neven=vlis[1::2]\n\n\n\nimport collections\nodd_max=collections.Counter(odd).most_common(2)\neven_max=collections.Counter(even).most_common(2)\nprint(odd_max)\nprint(even_max)\n\n\nif odd_max[0][0]==even_max[0][0]:\n \n if len(odd_max)==1 and len(even_max)==1:\n print(int(len(vlis)/2))\n \n elif len(even_max)==1:\n print(len(vlis)-even_max[0][1]-odd_max[1][1])\n \n elif len(odd_max)==1:\n print(len(vlis)-odd_max[0][1]-even_max[1][1])\n else:\n \n if odd_max[0][1]+even_max[1][1]>=odd_max[1][1]+even_max[0][1]:\n print(len(vlis)-odd_max[0][1]-even_max[1][1])\n else:\n print(len(vlis)-odd_max[1][1]-even_max[0][1])\nelse:\n print(len(vlis)-odd_max[0][1]-even_max[0][1])', 'n=int(input())\nvlis=[int(i) for i in input().split()]\n\n\n# a[:6:2] #[0, 2, 4]\n\n# a[7::2] #[7, 9]\nodd=vlis[0::2]\neven=vlis[1::2]\n\n\n\nimport collections\nodd_max=collections.Counter(odd).most_common(2)\neven_max=collections.Counter(even).most_common(2)\n\n\nif odd_max[0][0]==even_max[0][0]:\n \n if len(odd_max)==1 and len(even_max)==1:\n print(int(len(vlis)/2))\n \n elif len(even_max)==1:\n print(len(vlis)-even_max[0][1]-odd_max[1][1])\n \n elif len(odd_max)==1:\n print(len(vlis)-odd_max[0][1]-even_max[1][1])\n else:\n\n if odd_max[0][1]+even_max[1][1]>=odd_max[1][1]+even_max[0][1]:\n print(len(vlis)-odd_max[0][1]-even_max[1][1])\n else:\n print(len(vlis)-odd_max[1][1]-even_max[0][1])\nelse:\n print(len(vlis)-odd_max[0][1]-even_max[0][1])']
['Wrong Answer', 'Accepted']
['s040616817', 's120579320']
[15844.0, 15964.0]
[80.0, 86.0]
[1247, 1208]
p03244
u070561949
2,000
1,048,576
A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following conditions are satisfied: * For each i = 1,2,..., n-2, a_i = a_{i+2}. * Exactly two different numbers appear in the sequence. You are given a sequence v_1,v_2,...,v_n whose length is even. We would like to make this sequence /\/\/\/ by replacing some of its elements. Find the minimum number of elements that needs to be replaced.
['n = input()\nv = list(map(int,input().split()))\n\ne = v[::2]\no = v[1::2]\n\nev = {}\nov = {}\nfor t in e :\n if t in ev :\n ev[t] = ev[t] + 1\n else :\n ev[t] = 1\n\nfor t in o :\n if t in ov:\n ov[t] = ov[t] + 1\n else :\n ov[t] = 1\n\nprint(ev)\nprint(ov)\n\nsorted(ev.items(),key=lambda x : x[1],reverse=True)\nsorted(ov.items(),key=lambda x : x[1],reverse=True)\n\neidx = 0\noidx = 0\net = list(ev.values())[eidx]\not = list(ov.values())[oidx]\n\nif et == ot :\n if ev[et] > ov[ot] :\n if len(ot) > 1:\n ot = list(ov.values())[oidx+1]\n else:\n if len(et) > 1:\n et = list(ov.values())[eidx+1]\n\nans = len(e) - et + len(o) - ot\nprint(ans)', 'n = int(input())\nv = list(map(int,input().split()))\n\ne = v[::2]\no = v[1::2]\n\nev = {}\nov = {}\nfor t in e :\n if t in ev :\n ev[t] = ev[t] + 1\n else :\n ev[t] = 1\n\nfor t in o :\n if t in ov:\n ov[t] = ov[t] + 1\n else :\n ov[t] = 1\n\nev = sorted(ev.items(),key=lambda x : x[1],reverse=True)\nov = sorted(ov.items(),key=lambda x : x[1],reverse=True)\n\n#li = []\n#for elm in list(ev.keys()) :\n\n#for elm in list(ov.keys()) :\n \n#li.sort(key=lambda x : x[1][1],reverse=True)\n#print(li)\n\nee = ev[0][0]\noo = ov[0][0]\n\nes0 = ev[0][1]\nos0 = ov[0][1]\nans = n - es0 - os0\n\nif ee == oo:\n tmp1 = n - es0\n tmp2 = n - os0\n\n if len(ev) > 1:\n es1 = ev[1][1]\n tmp1 = n - es1 - os0\n\n if len(ov) > 1:\n os1 = ov[1][1]\n tmp2 = n - es0 - os1\n\n if tmp1 > tmp2 :\n ans = tmp2 \n else :\n ans = tmp1\n\nprint(ans)\n\n\n']
['Runtime Error', 'Accepted']
['s740710401', 's480274807']
[19452.0, 18784.0]
[106.0, 90.0]
[688, 943]