Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03695 (python)

Fixed submission:
def main():
    n = int(input())
    rate_count = [0] * 13
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds = sum(rate_count[8:])
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = res + reds
    print(r_min, r_max)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    rate_count = [0] * 9
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds =  rate_count[8]
    rate_count[8] = 0
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = min(8, res + reds)
    print(r_min, r_max)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    rate_count = [0] * 9
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds =  rate_count[8]
    rate_count[8] = 0
    rc2 = [1 for rce in rate_count if rce > 0]
    res = sum(rc2)
    r_min = max(res, 1)
    r_max = min(8, res + reds)
    print(r_min, r_max)

if __name__ == '__main__':
    main()
Problem p03699 (python)

Fixed submission:
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = sum(s)
    s = [i for i in s if i % 10 != 0]
    s.sort()
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        if (s_sum - es) % 10 != 0:
            print(s_sum - es)
            exit()
    else:
        print(0)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s.sort()
    s_sum = sum(s)
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        s_sum -= es
        if s_sum % 10 != 0:
            print(s_sum)
            exit()
	else:
      print(0)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = []
    def dfs(i, sum):
        if i == n:
            s_sum.append(sum)
        else:
            dfs(i + 1, sum + s[i])
            dfs(i + 1, sum)
    dfs(0, 0)
    s_sum_c = [s for s in s_sum if s % 10 != 0]
    print(max(s_sum_c))

if __name__ == '__main__':
    main()
Problem p03712 (python)

Fixed submission:
h, w = map(int,input().split())
a = [input() for _ in range(h)]

print('#' * (w+2))           
for i in range(h):
  print('#' + a[i] + '#')
print('#' * (w+2))

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split()
a = [row for row in range(h)]

print('#' * w)           
for i in range(h):
  print('#' + a[i] + '#')
print('#' * w)
Problem p03773 (python)

Fixed submission:
A, B = map(int, input().split())
r = (A + B) % 24
print(int(r))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
students[i] = [tuple(map(int, input.split())) for _ in range(n)]
points[i] = [tuple(map(int, input.split())) for _ in range(m)]

ans = []
for s in students:
  tmp = []
  for p in points:
    tmp.append(abs(s[0] - p[0]) + abs(s[1] - p[1]))
  ans.append(tmp.index(min(tmp)) + 1)
for i in range(n):
  print(ans[i])
Problem p03796 (python)

Fixed submission:
n = int(input())
r = 1
w = 10**9 + 7
for i in range(1, n+1):    
  r *= i
  r = (r % w)
  
  
  
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = 1
w = 10**9 + 7
for i in range(n):
  r = (r * i) % x
  
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = 1
w = 10**9 + 7
for i in range(n):
  r = r * i / x
  
print(r)
Problem p03838 (python)

Fixed submission:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    x, y = map(int, input().split())
    if x < y:
        if y == 0:
            print(-x)
        elif x == 0:
            print(y)
        elif 0 < x and 0 < y:
            print(y - x)
        elif x < 0 and 0 < y:
            print(abs(y - abs(x)) + 1)
        else:
            print(y - x)
    else:
        if y == 0:
            print(x + 1)
        elif x == 0:
            print(-y + 1)
        elif 0 < y and 0 < x:
            print(x - y + 2)
        elif y < 0 and 0 < x:
            print(abs(x - abs(y)) + 1)
        else:
            print((x - y) + 2)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    x, y = map(int, input().split())
    if x < y:
        if 0 < y and 0 < x:
            print(y - x)
        elif 0 < x and 0 < y:
            print(y - abs(x) + 1)
        elif y == 0:
            print(-x)
        elif x == 0:
            print(y)
        else:
            print(y - x)
    else:
        if 0 < y and 0 < x:
            print(x * 2 - (x - y) + 1)
        elif y < 0 and 0 < x:
            print(x - abs(y) + 1)
        elif y == 0:
            print(x + 1)
        elif x == 0:
            print(-y + 1)
        else:
            print((x - y) + 2)

if __name__ == '__mai
Problem p03854 (python)

Fixed submission:
s = input()

while True:
  if s == "":
    print('YES')
    break
  elif s[-7:] == 'dreamer':
    s = s[:-7]
  elif s[-6:] == 'eraser':
    s = s[:-6]
  elif s[-5:] == 'dream' or s[-5:] == 'erase':
    s = s[:-5]
  else:
    print('NO')
    break

Buggy submission (verdict: Runtime Error):
s = input()

while len(s) > 0:
  if s == "":
    print('YES')
    break
  s.replace('dreamer','')
  s.replace('eraser','')
  s.replace('dream','')
  s.replace('erase'v)
  
print('NO')
Problem p03861 (python)

Fixed submission:
a, b, x = map(int,input().split())

r = b // x - a // x
if a % x == 0:
  r += 1

print(int(r))

Buggy submission (verdict: Runtime Error):
a, b, x = map (int,input().split())

r = 0
if a % x == 0:
  a_t = a
else:
  if ((a // x) + 1) * x > b:
    print(0)
  else:
    a_t = ((a // x) + 1) * x
a_b = b - a_t
r = (a_b // x) + 1
print(int(r))
Problem p03943 (python)

Fixed submission:
A, B, C = map(int,input().split())
 
if A+B==C or A+C==B or B+C==A:
  r = 'Yes'
else:
  r = 'No'
print(r)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

if A+B==C or A+C==B or B+C==A:
  r = True
else:
  r = False
print(r)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(A+B==C or A+C==B or B+C==A)
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
paint_dot = {}
for _ in range(N):
  t1, t2, t3 = map(int,input().split())
  paint_dot[(t1, t2)] = t3

mat = [[1]*W for i in range(H)]

for key in paint_dot:
  x = paint_dot[key]
  if x == 1:
    for row in mat:
      for i in range(key[0]):
        row[i] = 0    
  elif x == 2:    
    for row in mat:
      for i in range(key[0], W):
        row[i] = 0
  elif x == 3:
    for i in range(key[1]):
      for j in range(W):
      	mat[i][j] = 0
  else:
    for i in range(key[1], H):
      for j in range(W):
      	mat[i][j] = 0

#print(mat)
print(sum(map(sum,mat)))

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
paint_dot = {}
for _ in range(N):
  t1, t2, t3 = map(int,input().split())
  paint_dot[(t1, t2)] = t3

pattern_H = [1]*H
pattern_W = [1]*W

for key in paint_dot:
  if paint_dot[key] == 1:
    for i in range(key[0]):
      pattern_W[i] = 0
  elif paint_dot[key] == 2:
    for i in range(key[0],W):
      pattern_W[i] = 0
  elif paint_dot[key] == 3:
    for i in range(key[1]):
      pattern_H[i] = 0
  else:
    for i in range(key[1],W):
      pattern_H[i] = 0

print(sum(pattern_W) * sum(pattern_H))
Problem p03998 (python)

Fixed submission:
aa = input()
bb = input()
cc = input()
def kansu(char,a,b,c):    
    if char == 'a':
        if not a:
            return 'A'
        else:
            char = a[0:1]
            a = a[1:]
            r = kansu(char,a,b,c)
    elif char == 'b':
        if not b:
            return 'B'
        else:
            char = b[0:1]
            b = b[1:]
            r = kansu(char,a,b,c)
    else:
        if not c:
            return 'C'
        else:
            char = c[0:1]
            c =c[1:]
            r = kansu(char,a,b,c)
    return r
            
charc = aa[0:1]
aa = aa[1:]
result = kansu(charc,aa,bb,cc)
print(result)

Buggy submission (verdict: Runtime Error):
ss = {i:list(input()) for i in "abc"}
x = ss[a].pop(0)
while True:
  if not ss[x]:
    print(x.upper())
    break
  else:
    x = ss[x][0]
Problem p04012 (python)

Fixed submission:
w = input()
checked_char = []
r = 'Yes'
for i in range(len(w)):
  if w[i] not in checked_char:
    if (w.count(w[i])) % 2 == 1:
      r = 'No'
    checked_char.append(w[i])
    
print(r)

Buggy submission (verdict: Runtime Error):
from collections import Counter
c1 = Counter(input())
for c num in c1:
  if c1[c] % 2 != 0:
    print('No')
    break
else:
  print('Yes')
Problem p04029 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
  r = (N + 1) * N / 2
else:
  r = N * (N - 1) / 2 + N

print(int(r))

Buggy submission (verdict: Runtime Error):
import statistics
n = int(input())
a = [int(i) for i in input().split()]

m = ((sum(a)/n)*2 + 1) //2
# m = statistics.mean(a)
# m = int(m) + 1 if m % 1 > 0.5 else int(m)
r = 0
for i in a:
  r += (i - m)**2
  
print(r)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 0:
  print((N + 1) * N / 2)
else:
  print((N) * (N - 1) / 2) + N
Problem p04030 (python)

Fixed submission:
s = input()

while(s.count('B')):
    if s.count('0B'):
        s = s.replace('0B','')
    elif s.count('1B'):
        s = s.replace('1B','')
    else:
        s = s.replace('B','')   
        
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
s = s.replace("B0", "")
s = s.replace("B1", "")
s = s.replace("B", "")
print(r)
Problem p02548 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n):
  ans+=int((n-1)/i)
print(ans)

Buggy submission (verdict: Runtime Error):
n=it(input())
ans=0
for i in range(1,n):
  ans+=int((n-1)/i)
print(ans)
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n,m=map(int,input().split())

par=[i for i in range(n)]

def find(x):
  if x==par[x]:
    return x
  else:
    par[x]=find(par[x])
    return par[x]

def union(x,y):
  x=find(x)
  y=find(y)
  if x!=y:
    par[x]=y
 
f=lambda x:int(x)-1
for i in range(m):
  x,y=map(f,input().split())
  union(x,y)
  
for j in range(n):
  find(j)
from collections import Counter
c=Counter(par)
cv=c.values()
print(max(cv))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

par=[i for i in range(n)]

def find(x):
  if x==par[x]:
    return x
  else:
    par[x]=find(par[x])
    return par[x]

def union(x,y):
  x=find(x)
  y=find(y)
  if x!=y:
    par[x]=y
 
f=lambda x:int(x)-1
for i in range(m):
  x,y=map(f,input().split())
  union(x,y)
  
for j in range(n):
  find(j)
from collections import Counter
c=Counter(par)
cv=c.values()
print(max(cv))
Problem p02621 (python)

Fixed submission:
a=int(input())
print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
a=int(input())
print(a+a＊＊2+a＊＊3)
Problem p02628 (python)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
q=p[:k]
print(sum(q))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int(input().split()))
p.sort()
q=p[:k]
print(sum(q))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(intinput().split()))
p.sort()
q=p[:k]
print(sum(q))
Problem p02630 (python)

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
q=int(input())
numl=collections.Counter(a)
s=sum(a)
for qq in range(q):
  x,y=map(int,input().split())
  s+=numl[x]*(y-x)
  print(s)
  numl[y]+=numl[x]
  numl[x]=0

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
numl=[0 for i in range(10**5+1)]
s=sum(a)
for aa in a:
  numl[aa-1]+=1
 
for qq in range(q):
  x,y=map(int,input().split())
  s+=numl[x-1]*(y-x)
  print(s)
  numl[y-1]+=numl[x-1]
  numl[x-1]=0
  print(numl)
Problem p02675 (python)

Fixed submission:
n=input()
l=len(n)
a=[2,4,5,7,9]
b=[0,1,6,8]
k=int(n[l-1])
if k in a:
  print('hon')
elif k in b:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
n=input()
l=len(n)
nn=int(n)
a=[2,4,5,7,9]
b=[0,1,6,8]
k=nn[l-1]
if k in a:
  print('hon')
elif k in b:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
n=input()
l=len(n)
a=[2,4,5,7,9]
b=[0,1,6,8]
if n[l-1] in a:
  print('hon')
else n[l-1] in b:
  print('pon')
else:
  print('bon')
Problem p02683 (python)

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 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))

Buggy 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])
提出情報

Buggy 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))
Problem p02694 (python)

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 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))
Problem p02696 (python)

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 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))
Problem p02700 (python)

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 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')

Buggy 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')
Problem p02706 (python)

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 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)
Problem p02713 (python)

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 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))

Buggy 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))

Buggy 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))
Problem p02718 (python)

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 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')
Problem p02719 (python)

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

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

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

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

Buggy 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

Buggy 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

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

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

Fixed submission:
x=int(input())
goh=x//500
go=(x-goh*500)//5
print(1000*goh+go*5)

Buggy 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))
Problem p02730 (python)

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 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')
Problem p02761 (python)

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 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='')

Buggy 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='')

Buggy 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='')
Problem p02778 (python)

Fixed submission:
print('x'*len(input()))

Buggy submission (verdict: Runtime Error):
list=list(input())
for s in list:
  s='x'
print(*list sep='')
Problem p02813 (python)

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 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))

Buggy 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))
Problem p02818 (python)

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 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)
Problem p02830 (python)

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

Buggy 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)
Problem p02837 (python)

Fixed submission:
import itertools
n=int(input())
la=[]
for _ in range(n):
  d=int(input())
  for dd in range(d):
    x,y=map(int,input().split())
    la.append([_,x-1,y])
ans=0
for i in itertools.product([0,1],repeat=n):
  s=sum(list(i))
  for l in la:
    if i[l[0]]==1 and i[l[1]]!=l[2]:
      break
  else:
    ans=max(ans,s)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
n=int(input())
l=[]
for i in range(n):
  d=int(input())
  x,y=map(int,input().split())
  l.append([i,x-1,y])
out=0
for p in itertools.product([0,1],repeat=n):
  for ll in l:
    if p[ll[0]]==1 and p[ll[1]]!=ll[2]:
      out+=1
      break
print(n-out)

Buggy submission (verdict: Runtime Error):
import itertools
n=int(input())
la=[]
for _ in range(n):
  d=int(input())
  for dd in d:
    x,y=map(int,input().split())
    la.append([_,x-1,y])
ans=0
for i in itertools.product([0,1],repeat=n):
  s=sum(list(i))
  for l in la:
    if i[l[0]]==1 and i[l[1]]!=l[2]:
      break
  else:
    ans=max(ans,s)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
la=[]
for i in range(n):
  d=int(input())
  a=[list(map(int,input().split())) for dd in range(d)]
  la.append(a)
cnt=n
for r in range(n-1):
  for p in range(r+1,n):
    for aa in la[r]
      for bb in la[p]:
        if aa[0]==bb[0] and aa[1]!=bb[1]:
          cnt-=1
print(cnt)