Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools
n,m,x=map(in,input().split())
l=[list(map(int,input().split())) for i in range(n)]
costl=[]
for p in itertools.product([0,1],n):
  al=[0]*m
  cost=0
  for i in range(n):
    if p[i]==1:
      cost+=l[i][0]
      for j in range(1,m):
        al[j-1]+=l[i][j]
  if all(mm>=x for mm in m):
    costl.append(cost)
print(min(cost))
      
        
      

Fixed submission:
import itertools
n,m,x=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
sum=[0]*m
for i in range(n):
  for j in range(1,m+1):
    sum[j-1]+=l[i][j]
for ss in sum:
  if ss<x:
    print(-1)
    exit()
list=[]
for p in itertools.product([1,0],repeat=n):
  cnt=[0]*m
  ans=0
  for i in range(n):
    if p[i]==1:
      ans+=l[i][0]
      for j in range(1,m+1):
        cnt[j-1]+=l[i][j]
  if all(cc>=x for cc in cnt):
    list.append(ans)
print(min(list))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
list=[l[0]]
num=0
while True:
  if l[list[num]-1] in list:
    break
  list.append(l[list[num]-1])
  num+=1
y=list.index(l[list[num]-1])
x=len(list)-y
ans=list[y:]
print(ans[(k-y)%x-1])
n,k=map(int,input().split())
l=list(map(int,input().split()))
list=[l[0]]
num=0
while True:
  if l[list[num]-1] in set(list):
    break
  list.append(l[list[num]-1])
  num+=1
y=list.index(l[list[num]-1])
x=len(list)-y
ans=list[y:]
print(ans[(k-y)%x-1])
提出情報 


Fixed submission:
import itertools
n,m,x=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
sum=[0]*m
for i in range(n):
  for j in range(1,m+1):
    sum[j-1]+=l[i][j]
for ss in sum:
  if ss<x:
    print(-1)
    exit()
list=[]
for p in itertools.product([1,0],repeat=n):
  cnt=[0]*m
  ans=0
  for i in range(n):
    if p[i]==1:
      ans+=l[i][0]
      for j in range(1,m+1):
        cnt[j-1]+=l[i][j]
  if all(cc>=x for cc in cnt):
    list.append(ans)
print(min(list))

Buggy python submission (verdict: Runtime Error):
import itertools
n,m,x=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
sum=[0]*m
for i in range(n):
  for j in range(1,m+2):
    sum[j]+=l[i][j]
for ss in sum:
  if ss<x:
    print(-1)
    exit()
list=[]
for p in itertools.product([1,0],n)
  cnt=[0]*m
  ans=0
  for i in range(n):
    if p[i]==1:
      ans+=l[i][0]
      list.append(ans)
      for j in range(1,m+1)
        cnt[j]+=l[i][j]
print(min(list))

Fixed submission:
import itertools
n,m,x=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
sum=[0]*m
for i in range(n):
  for j in range(1,m+1):
    sum[j-1]+=l[i][j]
for ss in sum:
  if ss<x:
    print(-1)
    exit()
list=[]
for p in itertools.product([1,0],repeat=n):
  cnt=[0]*m
  ans=0
  for i in range(n):
    if p[i]==1:
      ans+=l[i][0]
      for j in range(1,m+1):
        cnt[j-1]+=l[i][j]
  if all(cc>=x for cc in cnt):
    list.append(ans)
print(min(list))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  lists.append(list)
num=[0]*n
for list in lists:
  for __ in range(len(list)):
    num[list[__]-1]+=1
count=0
for nn in num:
  if nn==0:
    count+=1
print(count)

Fixed submission:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  list.append(list)
num=[0]*n
for list in lists:
  for __ in range(len(list)):
    num[list[__]-1]+=1
count=0
for nn in num:
  if nn==0:
    count+=1
print(count)

Fixed submission:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  t=input()
  if d==1:
    list=[int(t)]
  else:
    list=list(map(int,t.split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Fixed submission:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=input()
  if d==1:
    list=[int(input())]
  else:
    list=list(map(int,input().split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Fixed submission:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=input()
  list=list(map(int,input().split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Fixed submission:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
h=list(map(int,inpt().split()))
ab=[[] for nn in range(n)]
for mm in range(m):
  a,b=map(int,input().split())
  ab[a-1]+=b-1
  ab[b-1]+=a-1
cnt=0
for i in range(n):
  hi=0
  for ll in ab[i]:
    hi=max(hi,h[ll])
  if hi==h[i]:
    cnt+=1
print(cnt)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]
list=[0]*n
for a,b in ab:
  list[a-1]=max(list[a-1],h[b-1])
  list[b-1]=max(list[b-1],h[a-1])
count=0
for i in range(n):
  if list[i]<h[i]:
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]
list=[0]*n
for a,b in ab:
  list[a-1]+=max(list[a-1],h[b-1])
  list[b-1]+=max(list[b-1],h[a-1])
ans=0
for i in range(n):
  if list[i]<h[i]:
    count+=1
print(count)
  

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]
list=[0]*n
for a,b in ab:
  list[a-1]=max(list[a-1],h[b-1])
  list[b-1]=max(list[b-1],h[a-1])
count=0
for i in range(n):
  if list[i]<h[i]:
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
h=list(map(int,input().split()))
lists=[list(map(int,input().split())) for _ in range(m)]
ans=[[]]*n
for list in lists:
  ans[list[0]-1].append(list[1])
  ans[list[1]-1].append(list[0])
new=[]
for x in range(n):
  new.append(list(set(ans[x])))
high=[[]]*n
for y in range(n):
  for z in range(len(new[y])):
    high[y].append(h[new[y][z]-1])
count=0
for x in range(n):
  if h[x]>max(high[x]):
    count+=1
print(count)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]
list=[0]*n
for a,b in ab:
  list[a-1]=max(list[a-1],h[b-1])
  list[b-1]=max(list[b-1],h[a-1])
count=0
for i in range(n):
  if list[i]<h[i]:
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
if n>=b-1:
  print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
  print(int(a*n/b)-a*int(n/b))

Fixed submission:
x=int(input())
n=1
money=100
while n>=1:
  money=int(money*1.01)
  if money>=x:
    break
  n+=1
print(n)
Buggy python submission (verdict: Runtime Error):
import math
n,m,q=map(int,input().split())
abcd=[list(map(int,inpt().split())) for _ in range(q)]
sumlist=[]
for A in math.combinations_with_replacement(range(1,m+1),n)
  sum=0
  for a,b,c,d in abcd:
    if A[b-1]-A[a-1]==c:
      sum+=d
    sumlist.append(sum)
print(max(sumlist))
      

Fixed submission:
import itertools
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split())) for _ in range(q)]
sumlist=[]
for A in itertools.combinations_with_replacement(range(1,m+1),n):
  sum=0
  for a,b,c,d in abcd:
    if A[b-1]-A[a-1]==c:
      sum+=d
    sumlist.append(sum)
print(max(sumlist))
Buggy python submission (verdict: Runtime Error):
a,b,n=map(int(input().split())
if b-1<=n:
  x=b-1
  print(int(a*x/b)-a*int(x/b))
else:
  x=n
  print(int(a*x/b)-a*int(x/b))

          
          

Fixed submission:
a,b,n=map(int,input().split())
if n>=b:
  print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
  print(int(a*n/b)-a*int(n/b))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
list=[]
for x in range(n+1):
  list.append(int(a*x/b)-a*int(x/b))
print(max(list))

Fixed submission:
a,b,n=map(int,input().split())
if n>=b:
  print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
  print(int(a*n/b)-a*int(n/b))
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0:
    n+=1
if c-b*(n+1)<=a-d*(n+1):
    print('Yes')
else:
    print('No')

Fixed submission:
s,w=map(int,input().split())
print('unsafe' if w>=s else 'safe')

Buggy python submission (verdict: Runtime Error):
s=int(input())
w=int(input())
print('unsafe' if w>=s else 'safe')

Fixed submission:
s,w=map(int,input().split())
print('unsafe' if w>=s else 'safe')
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0:
    n+=1
if c-bn<=0:
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0:
    n+=1
if c-b*n<=0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0
    n+=1
if c-b*(n+1)<=a-d*(n+1):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0:
    n+=1
if c-b*n<=0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
lists=[input() for x in range(n)]
print(len(set(lists))

Fixed submission:
n=int(input())
lists=[input() for x in range(n)]
print(len(set(lists)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
lists=[input() for x in range(n)]
listget=[]
for s in lists:
    for y in range(1,n+1):
        listget.append(s[y])
print(len(set(listget))
      
     

Fixed submission:
n=int(input())
lists=[input() for x in range(n)]
print(len(set(lists)))
Buggy python submission (verdict: Runtime Error):
n,m=map(int(input().split())
a=list(map(int,input().split()))
if n>=sum(a):
  print(n-sum(a))
else:
  print(-1)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n>=sum(a):
  print(n-sum(a))
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
print(ans sep='\n')

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
for an in ans:
  print(an)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lista=list(map(int,input().split()))
for x in range(1,n+1):
  print(lista.count(x))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
for an in ans:
  print(an)

Buggy python submission (verdict: Runtime Error):
N=input()
lista=list(map(int,input().split()))
  for _ in range(1,N+1):
  print(lista.count(_))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
for an in ans:
  print(an)

Buggy python submission (verdict: Runtime Error):
N=input()
lista=list(map(int,input().split()))
  for _ in range(1,N+1):
print(lista.count(_))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
for an in ans:
  print(an)

Buggy python submission (verdict: Runtime Error):
N=int(input())
lista=list(map(int,input().split()))
  for _ in range(1,N+1)
print(lista.count(_))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
for an in ans:
  print(an)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      list.append(math.gcd(math.gcd(a,b),c))
print(sum(list))

Fixed submission:
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    t=math.gcd(a,b)
    for c in range(1,k+1):
      list.append(math.gcd(t,c))
print(sum(list))

Buggy python submission (verdict: Runtime Error):
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      list.append(math.gcd(gcd(a,b),c))
print(sum(list))

Fixed submission:
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    t=math.gcd(a,b)
    for c in range(1,k+1):
      list.append(math.gcd(t,c))
print(sum(list))

Buggy python submission (verdict: Runtime Error):
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      list.append(math.gcd((a,b),c))
print(sum(list))

Fixed submission:
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    t=math.gcd(a,b)
    for c in range(1,k+1):
      list.append(math.gcd(t,c))
print(sum(list))

Buggy python submission (verdict: Runtime Error):
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      list.append(math.gcd(a,b,c))
print(sum(list))

Fixed submission:
import math
k=int(input())
list=[]
for a in range(1,k+1):
  for b in range(1,k+1):
    t=math.gcd(a,b)
    for c in range(1,k+1):
      list.append(math.gcd(t,c))
print(sum(list))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
for aa in a:
  if aa>=sum(a)/4m:
    count+=1
if count>=m:
  print('Yes')
else:
  print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=sum(a)
for aa in a:
  if aa>=sum/4/m:
    count+=1
if count>=m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,k=(map(int,input().split())
print(min(n%k,k-n%k))

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Runtime Error):
n,k=(map(int,input().split())
a=n%k
print(min(a,abs(a-k)))

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Runtime Error):
n,k=(map(int,input().split())
a=n%k
print(min(a,abs(n-k)))

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
while n>=0:
  if n-k<=0:
    print(min(abs(n-k),n))
    break
  n=n-k

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
while n>=0:
  if n-k<=0:
    print(max(abs(n-k),n)
    break
  n=n-k

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
while n>=0:
  n=abs(n-k)
  if n-k<=0:
    print(abs(n-k)
    break

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
while n>=0:
  n=ans(n-k)
  if n-k<=0:
    print(n)
    break

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
while n>=0:
  n=ans(n-k)
  if n-k<=0:
    print(n)

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
lista=list(map(int,input().split())) 
ans=[]
for i in range(n):
  ans.append(lista[i+1]-lista[i])
print(k-max(ans))

Fixed submission:
x=int(input())
goh=x//500
go=(x-goh*500)//5
print(1000*goh+go*5)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
if s[:(n-1)/2-1]==s[:(n-1)/2-1][::-1] and s==s[::-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
s=input()
n=len(s)
if s[:(n-1)//2]==s[:(n-1)//2][::-1] and s==s[::-1]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for qq in range(q):
  l=list(input().split())
  if l[0]=='1':
    s=s[::-1]
  else:
    if l[1]=='1':
      s=l[2]+s
    else:
      s+=l[2]
print(s)

Fixed submission:
s=input()
q=int(input())
cnt=0
front=[]
rear=[]
for qq in range(q):
  l=list(input().split())
  if l[0]=='1':
    cnt+=1
  else:
    if (cnt+int(l[1]))%2==1:
      front.append(l[2])
    else:
      rear.append(l[2])
front=''.join(front[::-1])
rear=''.join(rear)
s=front+s+rear
print(s if cnt%2==0 else s[::-1])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:
      print(-1)
      exit()
 
for t in range(1,m+1):
  if n>=2 and sc[t-1]==[1,0]:
    print(-1)
    exit()
 
ans=[0]*n
for t in range(1,m+1):
  if ans[t-1]==0:
    ans[t-1]+=sc[t-1][1]

print(*ans,sep='')

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:
      print(-1)
      exit()
 
for t in range(1,m+1):
  if n>=2 and sc[t-1]==[1,0]:
    print(-1)
    exit()
 
ans=[0]*n
for t in range(1,m+1):
  if ans[sc[t-1][0]-1]==0:
    ans[sc[t-1][0]-1]+=sc[t-1][1]
    
if ans[0]==0 and n>=2:
  ans[0]=1
print(*ans,sep='')

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:
      print(-1)
      exit()
 
for t in range(1,m+1):
  if sc[t-1][0]>=2 and sc[t-1][1]==0:
    print(-1)
    exit()
 
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]==sc[j-1][1]:
      sc.remove(sc[i-1])
 
ans=[]
sc.sort(key=lambda x:x[0])
for t in range(1,m+1):
  ans.append(sc[t-1][1])
print(*ans,sep='')

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:
      print(-1)
      exit()
 
for t in range(1,m+1):
  if n>=2 and sc[t-1]==[1,0]:
    print(-1)
    exit()
 
ans=[0]*n
for t in range(1,m+1):
  if ans[sc[t-1][0]-1]==0:
    ans[sc[t-1][0]-1]+=sc[t-1][1]
    
if ans[0]==0 and n>=2:
  ans[0]=1
print(*ans,sep='')

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for range(m)]
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:
      print(-1)
      exit()

for t in range(1,m+1):
  if sc[t][0]>=2 and sc[t][1]==0:
    print(-1)
    exit()

for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]==sc[j-1][1]:
      sc.remove(sc[i-1])

ans=[]
sc.sort(key=lambda x:x[0])
for t in range(1,m+1):
  ans.append(sc[t][1])
print(*ans,sep='')

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(1,m):
  for j in range(i+1,m+1):
    if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:
      print(-1)
      exit()
 
for t in range(1,m+1):
  if n>=2 and sc[t-1]==[1,0]:
    print(-1)
    exit()
 
ans=[0]*n
for t in range(1,m+1):
  if ans[sc[t-1][0]-1]==0:
    ans[sc[t-1][0]-1]+=sc[t-1][1]
    
if ans[0]==0 and n>=2:
  ans[0]=1
print(*ans,sep='')
Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.counter(s)
common=c.most_common()
value,cnt=zip(*common)
common.sort(key=lambda x:x[0])
m=max(cnt)
for cc in most_common:
  if cc[1]==max:
    print(cc[0])

Fixed submission:
import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.Counter(s)
common=c.most_common()
value,cnt=zip(*common)
common.sort(key=lambda x:x[0])
m=max(cnt)
for cc in common:
  if cc[1]==m:
    print(cc[0])

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[input() for x in range(n)]
l=list(set(s))
l.sort()
cnt=[0]*len(l)
for ss in s:
  cnt[l.index[ss]]+=1
m=max(cnt)
ans=[]
for cc in cnt:
  if cc==m:
    ans.append(cnt.index(cc))
for aa in ans:
  print(l[aa])

Fixed submission:
import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.Counter(s)
common=c.most_common()
value,cnt=zip(*common)
common.sort(key=lambda x:x[0])
m=max(cnt)
for cc in common:
  if cc[1]==m:
    print(cc[0])
Buggy python submission (verdict: Runtime Error):
list=list(input())
for s in list:
  s='x'
print(*list sep='')


Fixed submission:
print('x'*len(input()))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for _ in range(2,n+1):
  if a[_-1] in a[:_-1]:
    print('NO')
    exit()
print('YES')

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
if len(a)==len(set(a)):
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
del h[5]
print(sum(h))

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
del h[:k]
print(sum(h))
Buggy python submission (verdict: Runtime Error):
import itertools
n=int(input())
p=''.join(list(input().split()))
q=''.join(list(input().split()))
l=[]
for a in itertools.permutations(range(1,n+1),n):
  l.append(a)
ip=l.index(p)
iq=l.index(q)
print(abs(ip-iq))

Fixed submission:
import itertools
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
l=[]
for a in itertools.permutations(range(1,n+1),n):
  l.append(a)
ip=l.index(tuple(p))
iq=l.index(tuple(q))
print(abs(ip-iq))

Buggy python submission (verdict: Runtime Error):
import math
n=int(input()
p=list(input().split())
q=list(input().split())
cntp=0
cntq=0
for i in range(n-2):
  cntp+=(p[0]-1)*math.factorial(n-i-1)
  cntq+=(q[0]-1)*math.factorial(n-i-1)
print(abs(cntp-cntq))

Fixed submission:
import itertools
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
l=[]
for a in itertools.permutations(range(1,n+1),n):
  l.append(a)
ip=l.index(tuple(p))
iq=l.index(tuple(q))
print(abs(ip-iq))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a>=k:
  print(a-k,b)
elif a<k and b>=K:
  print(0,b-k)
else:
  print(0,0)

Fixed submission:
a,b,k=map(int,input().split())
if a>=k:
  print(a-k,b)
elif a<k and b-k+a>=0:
  print(0,b-k+a)
else:
  print(0,0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s,t=input().split()
u=''
for i in range(n):
  u.append(s[i])
  u.append(t[i])
print(u)

Fixed submission:
n=int(input())
s,t=input().split()
u=''
for i in range(n):
  u+=s[i]
  u+=t[i]
print(u)