problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02576
s914587849
Accepted
n, x, t = map(int, input().split()) if n % x != 0: print((n // x + 1) * t) else: print(n // x * t)
p04005
s674847070
Wrong Answer
a, b, c = map(int, input().split()) if a%2 == 0 or b%2 == 0 or c%2 == 0: print(0) else: print(min(a*b, b*c, b*c))
p03379
s958220022
Accepted
n = int(input()) x = list(map(int,input().split())) sx = sorted(x) a = sx[(n-1)//2] b = sx[n//2] for i in x: if i>a:print(a) else:print(b)
p02860
s898491181
Accepted
digits = int(input()) str = input() num = int(digits/2) str_forward = str[num:] str_backward = str[:num] if str_forward == str_backward: print("Yes") else: print("No")
p03433
s432224627
Wrong Answer
N = int(input()) A = int(input()) a = N % 500 for i in range(A): if i == a: print('Yes') exit() print('No')
p03494
s061964978
Accepted
input() A = list(map(int, input().split())) count = 0 while all(a % 2 == 0 for a in A ): A = [a / 2 for a in A ] count += 1 print(count)
p03804
s694844672
Wrong Answer
import numpy as np N,M = map(int,input().split()) A = np.array([list(input()) for _ in range(N)]) B = np.array([list(input()) for _ in range(M)]) bl = False for i in range(N-M+1): for j in range(N-M+1): if (A[i:i+M,j:j+M] == B).all(): bl = True answer = 'Yes' if bl else 'No' print(answer) print(A,B)
p03274
s013453787
Accepted
N, K = map(int, input().split()) x = list(map(int, input().split())) ans = 10 ** 10 for i in range(N-K+1): l = x[i] r = x[i+K-1] ans = min(ans, abs(l) + abs(r-l), abs(r) + abs(l-r)) print(ans)
p03251
s404363375
Accepted
N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) x.append(X) y.append(Y) x.sort() y.sort() if x[-1] < y[0]: print('No War') else: print('War')
p02988
s551521960
Accepted
n = int(input()) P = list(map(int, input().split())) ans = 0 for i in range(n-2): if P[i] < P[i+1] < P[i+2] or P[i] > P[i+1] > P[i+2]: ans += 1 print(ans)
p03211
s741279545
Accepted
S = input() answer = float('inf') for i in range(len(S) - 3 + 1): # print(S[i:i + 3]) if answer > abs(int(S[i:i + 3]) - 753): answer = abs(int(S[i:i + 3]) - 753) print(answer)
p02641
s606247606
Wrong Answer
x, n = map(int, input().split()) p = list(map(int, input().split())) counter = 1 find = 0 while True: ceil = counter / 2 if counter % 2 == 0 else (counter // 2 + 1) find = int(ceil * ((-1) ** counter)) if (x + find) not in p: find = x + find break counter += 1 print(x if n == 0 else find)
p02727
s113521963
Accepted
x, y, a, b, c = map(int, input().split()) red = [int(x) for x in input().split()] green = [int(x) for x in input().split()] red.sort(reverse=True) green.sort(reverse=True) candidates = [int(x) for x in input().split()] + red[:x] + green[:y] candidates.sort(reverse=True) print(sum(candidates[:x+y]))
p02675
s645794058
Wrong Answer
N = int(input()) % 10 if N == 3: print("bon") elif N == 0 or 1 or 6 or 8: print("pon") else: print("hon")
p02688
s816690299
Wrong Answer
[N, K] = list(map(int, input().split())) all_A =[] for i in range(1, N + 1): all_A.append(i) for j in range(K): d = int(input()) A = list(map(int, input().split())) after_A = set(all_A) ^ set(A) print(len(after_A))
p02725
s899647527
Accepted
k, n = (int(each) for each in input().split(' ')) a = [int(each) for each in input().split(' ')] distance = [] for i in range(len(a)-1): distance.append(a[i+1]-a[i]) distance.append(a[0] + (k-a[-1])) print(k - max(distance))
p02743
s879120596
Wrong Answer
import math a, b, c = map(int, input().split()) ra = math.sqrt(a / c) rb = math.sqrt(b / c) sahen = math.fsum([ra, rb]) if sahen < 1: print("Yes") elif sahen >= 0: print("No")
p02802
s998698751
Wrong Answer
N, M = map(int, input().split()) solve_problem = [] penalty = 0 for i in range(M): p, S = input().split() if S == 'AC' and p not in solve_problem: solve_problem.append(p) if S == 'WA' and p not in solve_problem: penalty += 1 print('{} {}'.format(len(solve_problem), penalty))
p02624
s888110614
Accepted
n = int(input()) ans = 0 for i in range(1,n+1): m = n//i ans += (m+1)*i*m//2 print(ans)
p02657
s318114732
Accepted
A, B = map(int, input().split()) print(A*B)
p03997
s308655789
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline() def resolve(): a = int(input().rstrip()) b = int(input().rstrip()) h = int(input().rstrip()) s = (a+b)*h / 2 print(int(s)) if __name__ == "__main__": resolve()
p03556
s930522137
Accepted
if __name__ == '__main__': n =int(input()) max = 1 for i in range(1,n): now = i*i if now > n: break max = now print(max)
p03745
s352773426
Accepted
N = int(input()) line = [int(x) for x in input().split(' ')] count = 1 prev = line[0] i = 0 while i < len(line): if prev == line[i]: i += 1 continue elif prev < line[i]: for j in range(i,len(line)): if line[j] < prev: count+=1 break prev = line[j] i = j elif prev > line[i]: for j in range(i,len(line)): if line[j] > prev: count += 1 break prev = line[j] i = j prev = line[i] i+=1 print(count)
p02765
s083839909
Wrong Answer
n, r = map(int, input().split()) if n < 10: a = 100 * (10 - n) b = r - a if b >=0: print(b) else: print(0) else: print(r)
p02646
s482954436
Accepted
ma = lambda :map(int,input().split()) ni = lambda:int(input()) import collections import math import itertools gcd = math.gcd a,v = ma() b,w = ma() t = ni() if w>=v: print("NO") exit() d = abs(a-b) if d + w*t <=v*t: print("YES") else: print("NO")
p03478
s735236873
Accepted
def main(): N, A, B = map(int, input().split()) ans = 0 for i in range(N+1): tw = str(i) tn = 0 for j in range(len(tw)): tn += int(tw[j]) if A <= tn <= B: ans += i print(ans) main()
p02817
s971831226
Wrong Answer
print("".join(input().split()))
p03385
s028722395
Accepted
s = list(input()) s.sort() if ''.join(s) == 'abc': print('Yes') else: print('No')
p02993
s052223701
Accepted
S = raw_input() print "Bad" if S[0]==S[1] or S[1]==S[2] or S[2]==S[3] else "Good"
p02848
s106509665
Accepted
N = int(input()) S = input() S = [i for i in S] for i in range(len(S)): for j in range(0, 26): if j+N<=25: if S[i]==chr(j+65): S[i]=chr(j+65+N) break else: if S[i]==chr(j+65): S[i]=chr(j+65+N-26) break print(''.join(S))
p03456
s840316590
Accepted
a,b = input().split() ab=(int(a+b))**(1/2) if ab ==int(ab): print('Yes') else: print('No')
p03456
s840425124
Accepted
a,b = input().split() import math S = int(a+b) if math.sqrt(S).is_integer() == True: print("Yes") else: print("No")
p02963
s899946742
Accepted
s = int(input()) x = (-s) % 10**9 y = (s + x) // 10**9 print(0,0,1,y,10**9,x)
p02897
s612889849
Accepted
N=int(input()) if N % 2 == 0: print((N/2)/N) else: print(((N+1)/2)/N)
p03475
s824719275
Wrong Answer
N = int(input()) C = [0]*(N-1) S = [0]*(N-1) F = [0]*(N-1) T = [0]*N for i in range(N-1): C[i], S[i], F[i] = map(int, input().split()) for j in range(N-1): T[j] = C[j] + S[j] for i in range(N-2): if T[j] >= S[i+1] or S[i+1] == 0: T[j] = T[j] + C[i+1] elif T[j] < S[i+1]: T[j] = S[i+1] T[N-1] = 0 for i in range(N): print(T[i])
p02694
s679526165
Wrong Answer
x = int(input()) m = 100 import math count = 0 while m >= x: m += math.floor(m / 100) count += 1 print(count)
p02622
s795967797
Accepted
S=input() T=input() ans=0 for i in range(0, len(S)): if S[i] != T[i]: ans += 1 print(ans)
p02811
s678492911
Accepted
k, x = [int(i) for i in input().split()] print('Yes' if 500*k>=x else 'No')
p02951
s524905498
Wrong Answer
A,B,C=map(int,input().split()) print(C-(A-B))
p02833
s381064015
Wrong Answer
N = int(input()) if N % 2 == 1: print(0) exit(0) n = 10 ans = 0 while True: if n >= N: break ans += N//n n *= 5 print(ans)
p02719
s659658635
Accepted
N, K = map(int, input().split()) N = N % K if N > abs(N - K): print(abs(N - K)) else: print(N)
p02818
s405281067
Wrong Answer
a, b, k = map(int, input().split()) if a >= k: a -= k else: b = max(0,k - a) a = 0 print(a, b)
p02935
s323885210
Accepted
def main(): n = int(input()) v = [int(val) for val in input().split()] v.sort() ans = (v[0] + v[1]) / 2 for i in range(2, n): ans = (ans + v[i]) / 2 print(ans) main()
p03126
s243026744
Wrong Answer
N,M = map(int, input().split()) an_li = list(map(int, input().split())) an_li.remove(an_li[0]) for i in range(N-1): li = list(map(int, input().split())) li.remove(li[0]) for t in an_li: if t in li: a = 1 else: an_li.remove(t) print(len(an_li))
p02836
s801603383
Wrong Answer
S=input() cnt=0 for i in range(len(S)//2-1): if S[i]!=S[-1*i]: cnt+=1 print(cnt)
p03250
s244562521
Accepted
a,b,c = map(int,input().split()) print(max(10*a+b+c, a+10*b+c, a+b+10*c))
p03076
s241834045
Accepted
menu = [int(input()) for _ in range(5)] wait = [] for i in menu: w = i n = max(len(str(i)),2) while w % 10 != 0: w += 1 wait.append([i,(w-i)%(10**(n-1))]) wait.sort(key=lambda x: x[1]) time = 0 for i in range(len(wait)): time += wait[i][0] if time % 10 != 0 and i != len(wait)-1: time += wait[i][1] print(time)
p02552
s889267051
Wrong Answer
a = input() if a == 1: print(0) else: print(1)
p02601
s742580598
Accepted
a,b,c = map(int,input().split()) k = int(input()) for _ in range(k): if b <= a: b *= 2 else: c *= 2 if a < b < c: print("Yes") else: print("No")
p03427
s911494197
Wrong Answer
n = list(input()) for k in range(0,10): head = int(''.join(n[:2]))-k tmp = str(head) tmp = list(tmp) if len(tmp) == 1: break elif int(tmp[1]) <= 8: continue else: break #print(tmp) if n[:2] == tmp: tmp.append(8) for i in range(len(n)-3): tmp.append(9) else: for i in range(len(n)-2): tmp.append(9) #print(tmp) ans = 0 for j in range(len(tmp)): ans += int(tmp[j]) print(ans)
p02838
s312743453
Accepted
mod = 10**9+7 N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(60): cnt = 0 for j in range(N): cnt += (A[j]>>i)&1 ans = (ans+(((N-cnt)*cnt)%mod)*2**i)%mod print(ans)
p02888
s854914279
Accepted
import bisect n = int(input()) l = list(map(int, input().split())) l.sort() ans = 0 for i in range(n-2): for j in range(i+1,n-1): a = bisect.bisect(l, l[i]+l[j]-1) ans += (a-j-1) print(ans)
p02958
s066496734
Accepted
n=int(input()) P=list(map(int,input().split())) A=sorted(P) count=0 for i in range(n): if P[i]!=A[i]: count+=1 print("YES" if count<=2 else "NO")
p04012
s210535269
Accepted
abc_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] if __name__ == '__main__': w = input() w = [s.split()[0] for s in w] check = 0 for i in abc_list: if w.count(i) % 2 != 0: check = 1 break if check == 0: print('Yes') else: print('No')
p02959
s182524375
Wrong Answer
N = int(input()) Monster = list(map(int, input().split())) Brave = list(map(int, input().split())) cnt = 0 amari = 0 for i in range(N): cnt += min(Monster[i], Brave[i]+amari) if (Brave[i]+amari > Monster[i]): amari = Brave[i]+amari - Monster[i] cnt += min(amari, Monster[N]) print(cnt)
p02923
s932686930
Wrong Answer
def lower(n, hli): hli.reverse() ans = 0 count = 0 for i in range(n-1): if hli[i] <= hli[i+1]: count += 1 else: ans = max(ans, count) count = 0 return ans def main(): n = int(input()) hli = list(map(int, input().split())) print(lower(n, hli)) if __name__ == '__main__': main()
p03105
s050373732
Wrong Answer
a,b,c=map(int,input().split()) print(max(b//a,c))
p03617
s078320404
Accepted
Q, H, S, D = map(int, input().split()) N = int(input()) smin = min(4 * Q, 2 * H, S) if D < 2 * smin: print((N // 2) * D + (N % 2) * smin) else: print(N * smin)
p04045
s024971416
Wrong Answer
l = list(map(int, input().split())) N = l[0] K = l[1] s = list(map(int, input().split())) number = [0,1,2,3,4,5,6,7,8,9] not_in = [] for i in range(10): if i not in s: not_in.append(i) result = "" for i in str(N): for j in not_in: if int(i) <= j: result += str(j) break print(result)
p03605
s485638370
Accepted
a = input() print("Yes" if '9' in a else "No")
p02647
s782734478
Accepted
def right(a,n): sw = [0]*(n+1) for x,y in enumerate(a): x_min = max(0,x-y) x_max = min(n,x+y+1) sw[x_min] += 1 sw[x_max] -= 1 s = 0 for i in range(n): s += sw[i] a[i] = s return a n,k = map(int,input().split()) a = list(map(int,input().split())) for i in range(min(k,50)): a = right(a,n) a = [str(n) for n in a] print(" ".join(a))
p02873
s477410890
Wrong Answer
S = list(input()) N = len(S) + 1 mn = 0 a = 0 ans = 0 for s in S: if s == '<': a += 1 elif s == '>': a -= 1 mn = min(mn,a) ans += a ans -= mn * N print(ans)
p02989
s585415775
Accepted
import sys def input(): return sys.stdin.readline().rstrip() def main(): N = int(input()) d = list(map(int,input().split())) d.sort() print(d[N//2]-d[N//2-1]) if __name__ == "__main__": main()
p03131
s860663422
Accepted
k,a,b = map(int,input().split()) # first cost = 0 # 2回でb-a枚ふやせる if b-a <= 2 or k < a-1: print(k+1) else: res = a k -= a-1 if k%2 == 1: res += 1 k -=1 res += (b-a)*(k//2) print(res)
p02779
s725900763
Wrong Answer
n=int(input()) li=list(map(int, input().split())) ans="Yes" for i in range(n): for j in range(i+1, n): if li[i]==li[j]: ans="No" break else: continue break print(ans)
p02755
s479081822
Accepted
A,B = map(int,input().split()) ans=-1 for i in range(1,1001): if i*0.08//1==A and i*0.1//1==B: ans=i break print(ans)
p02768
s183635339
Wrong Answer
mod = 7+10**9 def ncr(n,c,mod): x = 1 y = 1 for i in range(n-c+1,n+1): x = x*i%mod for j in range(1,c+1): y = y*j%mod return (x * pow(y, mod-2, mod)) % mod n, a, b = map(int, input().split()) al = pow(2, n, mod) -1 acr = ncr(n, a, mod) bcr = ncr(n, b, mod) print(al-(acr+bcr)%mod)
p02797
s773088680
Accepted
def main(): N, K, S = list(map(int, input().split())) salt = -1 if S >= 10**9 else 1 if K == 0: arr = [S+salt] *N else: arr = [] for i in range(0, K): arr += [S] while len(arr) < N: arr += [S+salt] print(' '.join(map(str,arr))) if __name__ == "__main__": main()
p02801
s906058338
Accepted
c = input() arr = list("a b c d e f g h i j k l m n o p q r s t u v w x y z".split()) for i in range(25): if c == arr[i]: print(arr[i+1])
p02882
s619222873
Accepted
import math a,b,x=map(int,input().split()) if x>=(a**2*b)/2: sita=math.degrees(math.atan((b/a-x/a**3)*2)) else: sita=math.degrees(math.atan(b**2*a/(2*x))) print(sita)
p03206
s484638548
Accepted
d = int(input()) if d == 25: print('Christmas') elif d == 24: print('Christmas Eve') elif d == 23: print('Christmas Eve Eve') else: print('Christmas Eve Eve Eve')
p03611
s544444377
Wrong Answer
from collections import Counter n = int(input()) c = Counter(map(int, input().split())) c = sorted(c.items()) ans = max(c[0][1], c[len(c)-1][1]) if len(c) <= 2: print(ans) exit() for i in range(1, len(c)-1): cnt = c[i][1] if c[i+1][0] - c[i][0] == 1: cnt += c[i+1][1] if c[i][0] - c[i-1][0] == 1: cnt += c[i-1][1] ans = max(cnt, ans) print(ans)
p02759
s295361701
Accepted
import math n=int(input()) print(math.ceil(n/2))
p03000
s461697017
Wrong Answer
n,x = map(int,input().split()) listl = [] listl += map(int,input().split()) # print(listl) cnt=0 d=0 # print(d) while cnt<len(listl): d = d+listl[cnt] if d > x: break # print(d) cnt+=1 print(cnt)
p02600
s643963266
Wrong Answer
X = int(input()) if (1800 <= X < 2000): print("1級") elif (1600 <= X < 1800): print("2級") elif (1400 <= X < 1600): print("3級") elif (1200 <= X < 1400): print("4級") elif (1000 <= X < 1200): print("5級") elif (800 <= X < 1000): print("6級") elif (600 <= X < 800): print("7級") elif (400 <= X < 600): print("8級")
p02678
s869938262
Accepted
from collections import deque N,M=map(int,input().split()) G=[[] for i in range(N)] for i in range(M): a,b=map(int,input().split()) G[a-1]+=[b-1] G[b-1]+=[a-1] que=deque([0]) visited=[-1 for i in range(N)] visited[0]=0 dokokara=[0 for i in range(N)] while len(que)>0: v=que.popleft() for i in G[v]: if visited[i]!=-1: continue else: visited[i]+=1 dokokara[i]=v que.append(i) print("Yes") for i in range(1,N): print(dokokara[i]+1)
p03286
s314418345
Accepted
import sys n = int(input()) if n == 0: print("0") sys.exit(0) sum = 0 ans = "" count = 0 d = 1 while n != sum: mod = (n - sum) % (d * 2) # print("count/d/mod %d/%d/%d" % (count, d, mod)) if mod != 0: ans = "1" + ans sum += d * (1 if count % 2 == 0 else -1) else: ans = "0" + ans count += 1 d *= 2 print(ans)
p03719
s066028386
Accepted
A, B, C = map(int, input().split()) if A <= C and B >= C: print('Yes') else: print('No')
p02909
s347755646
Wrong Answer
s = input() ans = False for i in s[::2]: if i == "L": ans = True for i in s[1::2]: if i == "R": ans = True if ans: print("No") else: print("YES")
p03693
s096813127
Accepted
a,b,c=map(int,input().split()) x = 100*a+10*b+c if x%4==0: print("YES") else: print("NO")
p03145
s091621899
Accepted
nums = list(map(int, input().split())) nums.sort() print(int((nums[0] * nums[1])/2))
p02881
s819895663
Accepted
import math N = int(input()) t1 = 1 for i in range(2, int(math.sqrt(N)) + 1): if N % i == 0: t1 = i t2 = N // t1 print(t1 + t2 - 2)
p02707
s412596486
Accepted
import collections n = int(input()) a = list(map(int, input().split())) c = collections.Counter(a) for k in range(1,n+1): print(c[k])
p02665
s894680537
Accepted
c=sum(a:=[*map(int,[*open(s:=0)][1].split())]) b=1 for a in a:s=-(b<a)or s+b;b=min(c:=c-a,(b-a)*2) print(s)
p02645
s000890931
Wrong Answer
name = input() print(name[0:2])
p02972
s957671511
Wrong Answer
n = int(input()) A = list(map(int,input().split())) cnt = [0]*(n+1) ans = [] for i in range(n,0,-1): a = A[i-1] s = 0 for j in range(n//i): idx = i*j s+=cnt[idx] if s%2==0: cnt[i] = a else: cnt[i] = 1-a if cnt[i] ==1: ans.append(i) m = sum(cnt) print(m) print(*ans)
p03338
s039371049
Wrong Answer
n = int(input()) s = list(input()) half = int(n/2) max1 = 0 for i in range(half): f = set(s[:half-i]) b = set(s[half-i:]) union = len(f&b) if max1 <= union: max1 = union else: break max2 = 0 for i in range(1,half+1): f = set(s[:half+i]) b = set(s[half+i:]) union = len(f&b) if max2 <= union: max2 = union else: break ans = max1 if max1>max2 else max2 print(ans)
p03323
s565790218
Wrong Answer
a, b = map(int, input().split()) if a >= 9 or b >= 9: print(":(") elif a <= 8 and b <= 8: print("Yay")
p03221
s784470329
Wrong Answer
N, M = map(int, input().split()) PY = [list(map(int, input().split())) for _ in range(M)] A = [[] for _ in range(N+1)] for i, py in enumerate(PY): A[py[0]].append([py[1], i]) City = [] for i in range(N+1): A[i] = sorted(A[i]) for j, a in enumerate(A[i]): pref = i city = j City.append([a[1], str(pref).zfill(6) + str(city).zfill(6)]) City = sorted(City) for city in City: print(city[1])
p02785
s102890558
Wrong Answer
import math n,k = map(int, input().split()) hlist = input().split() hlist.sort() sum = 0 for i in range(n-k): sum = sum + int(hlist[i]) print(sum)
p02717
s795828888
Accepted
x, y, z = map(int, input().split()) print(z, x, y)
p03210
s773799965
Accepted
x=int(input()) y=[7,5,3] print('YES' if x in y else 'NO')
p02759
s089516012
Wrong Answer
a = int(input()) if a%2 == a: print(a/2) else: print(a//2 + 1)
p02690
s643568387
Wrong Answer
X=int(input()) l=[] for y in range(1,X//2+2): if X%y==0: l.append(y) K=len(l) A=-1 for y in range(0,K): KKK=0 A=0 while KKK<X: A=A+1 KKK=A**5-(A-l[y])**5 if KKK==X: print(A,A-l[y]) break
p03041
s803719821
Wrong Answer
n,k=map(int,input().split()) s=input() ans=s[k-1]+s[k-1].lower()+s[k:] print(ans)
p02814
s904159746
Accepted
N, M = map(int, input().split(" ")) a = list(set(map(int, input().split(" ")))) g = a.copy() while not any(x%2 for x in g): g = [i //2 for i in g] if not all(x%2 for x in g): print(0); exit(0) def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) tot = 1 for x in a: tot = lcm(tot, x//2) print((M//tot+1)//2)
p03486
s183704494
Wrong Answer
S = str(input()) T = str(input()) S=sorted(S) T=sorted(T, reverse=True) if S < T: print(S) print(T) print("Yes") else: print("No")
p02772
s026056542
Accepted
# B - Papers, Please # https://atcoder.jp/contests/abc155/tasks/abc155_b n = int(input()) a = list(map(int, input().split())) even = 0 cnt = 0 for i in a: if i % 2 == 0: even += 1 if i % 3 == 0 or i % 5 == 0: cnt += 1 if even == cnt: print('APPROVED') else: print('DENIED')
p03852
s533941850
Wrong Answer
c = input() if c == 'a' or 'i' or 'u' or 'e' or 'o': print('vowel') else: print('consonant')
p03221
s374354597
Wrong Answer
from collections import deque import bisect x,y=map(int,input().split()) citylist=deque([deque() for x in range(x)]) inputlist=deque() arucity=deque() old=0 for a in range(y): s,t=map(int,input().split()) citylist[s-1].append(t) inputlist.append(s) inputlist.append(t) if old != s: arucity.append(s) old = s for a in arucity: citylist[a-1]=sorted(citylist[a-1]) for b in range(y): e=inputlist.popleft() print("{:06}{:06}".format(e,(bisect.bisect(citylist[e-1],inputlist.popleft())+1)))