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

Fixed submission:
from collections import deque
n,m = map(int, input().split())
if m == 0:
  print(1)
  exit()
g = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
v = [-1 for i in range(n)]
ans = []
for i in range(n):
  if v[i]!=-1:
    continue
  v[i]=0
  an=1
  d = deque([i])
  while len(d):
    x = d.popleft()
    for i in g[x]:
      if v[i] == -1:
        d.append(i)
        v[i]=1
        an+=1
  ans.append(an)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
if m == 0:
  print(1)
  exit()
g = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
v = [-1 for i in range(n)]
ans = [0]*(n+1)
def dfs(x,y):
  for i in g[x]:
    if v[i] == -1:
      v[i]=1
      ans[y]+=1
      dfs(i,y)
for i in range(n):
  if v[i]!=-1:
    continue
  v[i]=0
  dfs(i,i)
print(max(ans)+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
if m == 0:
  print(1)
  exit()
g = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
v = [-1 for i in range(n)]
ans = [0]*n
def dfs(x,y):
  for i in g[x]:
    if v[i] == -1:
      v[i]=1
      ans[y]+=1
      dfs(i,y)
for i in range(n):
  if v[i]!=-1:
    continue
  v[i]=0
  dfs(i,i)
print(max(ans)+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  if not b-1 in g[a-1]:
    g[a-1].append(b-1)
  if not a-1 in g[b-1]:
    g[b-1].append(a-1)
v = [-1 for i in range(n)]
ans = [0]*n
def dfs(x,y):
  for i in g[x]:
    if v[i] == -1:
      v[i]=v[x]+1
      ans[y]+=1
      dfs(i,y)
for i in range(n):
  if v[i]!=-1:
    continue
  v[i]=0
  dfs(i,i)
print(max(ans)+1)
Problem p02641 (python)

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

if n == 0:
  print(x)
  exit(0)
  
p = [int(x) for x in input().split()]

a = x
b = x

if x not in p:
  print(x)
  exit(0)

for i in range(1,101):
  a = a + 1
  b = b - 1
  if b not in p:
    print(b)
    exit(0)
  elif a not in p:
    print(a)
    exit(0)

Buggy submission (verdict: Runtime Error):
x,n= map(int, input().split())
if n == 0:
  print(x)
  exit(0)
p = [int(x) for x in input().split()]
pp = []
for i in range(1,101):
  if not i in p:
    pp.append(i)
a = []
for i in pp:
  a.append(abs(x-i))
b = min(a)
c = []
for i,j in enumerate(a):
  if b == j:
    c.append(pp[i])
print(min(c))
Problem p02657 (python)

Fixed submission:
A, B = input().split()

print(int(A)*int(B))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a*b)
Problem p02664 (python)

Fixed submission:
t = list(input())    
for i in range(len(t)):

  if t[i] == '?':
    if len(t) == 1:
      if t[i] == '?':
        t[i] = 'D'
      break
    if i == 0:
      if t[1] == 'P':
        t[i] = 'D'
      else:
        t[i] = 'P'
    if i == len(t)-1:
        t[i] = 'D'
    else:
      if t[i-1] == 'P':
        t[i] = 'D'
      else:
        if t[i+1] == 'P':
          t[i] = 'D'
        else:
          t[i] = 'P'
a = ''
for i in range(len(t)):
  a += t[i]
        
print(a)

Buggy submission (verdict: Runtime Error):
t = list(input())
for i in range(len(t)):
  if t[i] == '?':
    if i == 0:
      if t[1] == 'P':
        t[i] = 'D'
      else:
        t[i] = 'P'
    if i == len(t)-1:
        t[i] = 'D'
    else:
      if t[i-1] == 'P':
        t[i] = 'D'
      else:
        if t[i+1] == 'P':
          t[i] = 'D'
        else:
          t[i] = 'P'
a = ''
for i in range(len(t)):
  a += t[i]
        
print(a)
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split())) 
b = 0
if k<=n:
  for i in range(k):
    b = a[b]-1
  print(b+1)
  exit(0)
c = [0]
for i in range(n):
  b = a[b]-1
  c.append(b)
d = c[:-1].index(c[-1])
c = c[d:-1]
k = k-d
print(c[k%len(c)]+1)

Buggy submission (verdict: Runtime Error):
NK = list(map(int, input().split())) 
A = list(map(int, input().split())) 
e = 0
N = NK[0]
K = NK[1]
town= 1
list = []
for i in range(N+1):
  town = A[town-1]
  list.append(town)
  if i > 0 and town == list[0]:
    e += 1
    break
if e == 1:
  print(list[-1])
else:
  d = K % len(list[:-1])
  print(list1[d-1])

Buggy submission (verdict: Runtime Error):
NK = list(map(int, input().split())) 
A = list(map(int, input().split())) 

N = NK[0]
K = NK[1]

town = 0
for i in range(K-1):
  town = A[town]
  
print(str(town))
Problem p02714 (python)

Fixed submission:
N=int(input())
S=input()
r=S.count('R')
b=S.count('B')
g=S.count('G')
ans=r*b*g
for i in range(N):
    for s in range(N):
        j=i+s
        k=j+s
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
r = []
g = []
b = [0]*4000
for i,j in enumerate(s):
  if j == 'R':
    r.append(i)
  if j == 'G':
    g.append(i)
  if j == 'B':
    b[i] += 1
cnt = len(r)*len(g)*sum(b)
for i in r:
  for j in g:
    if b[2*j-i] == 1 :
      cnt -= 1
    if b[2*i-j] == 1 :
      cnt -= 1
    if (i+j)%2 == 0 and b[(i+j)//2] == 1:
      cnt -= 1
print(cnt)
Problem p02787 (python)

Fixed submission:
import numpy as np
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
np_ab = np.array(ab)
max_a = max(np_ab[:, 0])
dp = [0]*(h+max_a)
for i in range(1, h+max_a):
    dp[i] = min(dp[i-a] + b for a,b in ab)
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
h,n= map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)] 
m = 10**4
dp = [0]*(h+m+1)
for i in range(m+1,h+m+1):
  dp[i] = min(dp[i-a] + b for a,b in p)
print(dp[h+m+])

Buggy submission (verdict: Runtime Error):
h,n= map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)] 
i = 10**4
dp = [0]*(h+i)
for i in range(i,h+i+1):
  dp[i] = min(dp[i-a] + b for a,b in p)
print(dp[h])
Problem p03014 (python)

Fixed submission:
h,w = map(int, input().split())
g = []
for _ in range(h):
  g.append(input())
l = [[0 for i in range(w)] for j in range(h)]
r = [[0 for i in range(w)] for j in range(h)]
d = [[0 for i in range(w)] for j in range(h)]
u = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if g[i][j] == '#':
      l[i][j] = 0
      u[i][j] = 0
    else:
      if j == 0:
        l[i][j] = 1
      else:
        l[i][j] = l[i][j-1]+1
      if i == 0:
        u[i][j] = 1
      else:
        u[i][j] = u[i-1][j]+1
for i in reversed(range(h)):
  for j in reversed(range(w)):
    if g[i][j] == '#':
      r[i][j] = 0
      d[i][j] = 0
    else:
      if j == w-1:
        r[i][j] = 1
      else:
        r[i][j] = r[i][j+1]+1
      if i == h-1:
        d[i][j] = 1
      else:
        d[i][j] = d[i+1][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    ans = max(l[i][j]+r[i][j]+u[i][j]+d[i][j]-3,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
u = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if g[i][j] == '.':
      if j == 0:
        l[i][j] = 1
      else:
        l[i][j] = l[i][j-1]+1
      if i == 0:
        u[i][j] = 1
      else:
        u[i][j] = u[i-1][j]+1
for i in reversed(range(h)):
  for j in reversed(range(w)):
    if g[i][j] == '.':
      if j == w-1:
        r[i][j] = 1
      else:
        r[i][j] = r[i][j+1]+1
      if i == h-1:
        d[i][j] = 1
      else:
        d[i][j] = d[i+1][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    ans = max(l[i][j]+r[i][j]+u[i][j]+d[i][j]-3,ans)
print(ans)
Problem p03196 (python)

Fixed submission:
n,p = map(int, input().split())
a = round(p**(1/n))
for i in range(a,-1,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
n,p = map(int, input().split())
if n==1:
    print(p)
    exit()
elif p==1:
    print(1)
    exit()

a = int(p**(1/n)+1)
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
n,p = map(int, input().split())
a = int(p**(1/n))+1
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
n,p = map(int, input().split())
if n == 1:
  print(p)
  exit()
a = int(p**(1/n)+2)
for i in range(a)[::-1]:
  if p%(i**n)==0:
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
n,p = map(int, input().split())
if n == 1:
  print(p)
  exit(0)
a = int(p**(1/n)+1)
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit(0)
Problem p03246 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0]*(10**5+3)
c = [0]*(10**5+3)
for i in range(n):
  if i%2==0:
    b[a[i]]+=1
  else:
    c[a[i]]+=1
bm=max(b)
cm=max(c)
if b.index(max(b))==c.index(max(c)):
  b[b.index(max(b))]=0
  c[c.index(max(c))]=0
  bm2=max(b)
  cm2=max(c)
  print(min(n-bm-cm2,n-cm-bm2))
else:
  print(n-bm-cm)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = [0]*10**5+3
c = [0]*10**5+3
for i in range(n):
  if i%2==0:
    b[a[i]]+=1
  else:
    c[a[i]]+=1
bm=max(b)
cm=max(c)
if b.index(max(b))==c.index(max(c)):
  b[b.index(max(b))]=0
  c[c.index(max(c))]=0
  bm2=max(b)
  cm2=max(c)
  print(min(n-bm-cm2,n-cm-bm2))
else:
  print(n-bm-cm)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = [0]*10**5
c = [0]*10**5
for i in range(n):
  if i%2==0:
    b[a[i]]+=1
  else:
    c[a[i]]+=1
bm=max(b)
cm=max(c)
if b.index(max(b))==c.index(max(c)):
  b[b.index(max(b))]=0
  c[c.index(max(c))]=0
  bm2=max(b)
  cm2=max(c)
  print(min(n-bm-cm2,n-cm-bm2))
else:
  print(n-bm-cm)
Problem p03276 (python)

Fixed submission:
n,k = map(int, input().split())
if n==1:
  print(abs(int(input())))
  exit()
a = list(map(int, input().split()))
g = []
for i in range(n-k+1):
  b = a[i]
  c = a[i+k-1]
  if c<=0:
    g.append(-b)
  elif b>=0:
    g.append(c)
  else:
    g.append(c-b+min(abs(b),abs(c)))
print(min(g))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
if n==1:
  print(abs(int(input())))
  exit()
a = list(map(int, input().split()))
g = []
for i in range(n-k):
  b = a[i]
  c = a[i+k-1]
  if c<=0:
    g.append(-b)
  elif b>=0:
    g.append(c)
  else:
    g.append(c-b+min(abs(b),abs(c)))
print(min(g))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input().split()))
if n==1:
  print(*a)
  exit()
g = []
for i in range(n-k):
  b = a[i]
  c = a[i+k-1]
  if c<=0:
    g.append(-b)
  elif b>=0:
    g.append(c)
  else:
    g.append(c-b+min(abs(b),abs(c)))
print(min(g))
Problem p03633 (python)

Fixed submission:
n =int(input())
import fractions
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // fractions.gcd(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
n =int(input())
import fraction
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // fraction.gcd(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = list(int(input()) for _ in range(N))
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // math.gcd(ans, T[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n =int(input())
import math
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // math.gcd(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
n =int(input())
import math
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // math.gcd(ans, t)
print(ans)
Problem p02548 (python)

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

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

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(1,n):
    ans += (n-1) // i
print(ans)

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    t = (arr[0][1]+1)*(arr[1][1]+1)
    print(t) 

    return arr

factorization(int(input()))
Problem p02582 (python)

Fixed submission:
S = input()
list_s = list(S)
count = 0
x = []
for i in range(3):
    if list_s[i] == 'R':
        count +=1
    elif list_s[i] == 'S':
        x.append(count)
        count = 0
x.append(count)
print(max(x))

Buggy submission (verdict: Runtime Error):
#移動の最小値(高速化問題)
x,k,d = map(int,input().split())
x = abs(x)
if (x//d) >=k:
    ans = x - d*k
else:
    y = x-(x//d)*d
    if k- (x//d)%2 != 0:
        ans = y
    else:
        ans = y-d
print(abs(ans))

Buggy submission (verdict: Runtime Error):
S = input()
    list_s = list(S)
    count = 0
if 1<len(list_s)<4
for i in range(2):
    if list_s[i] == 'R':
        count +=1
    elif list_s[i] == 'S':
        count = 0
print(count)

Buggy submission (verdict: Runtime Error):
S = input()
if 1< S <4:
    list_s = list(S)
    count = 0
    for i in range(3):
        if list_s[i] == 'R':
            count +=1
        elif list_s[i] == 'S':
            count = 0
    print(count)

Buggy submission (verdict: Runtime Error):
S = input()
if S<4:
    list_s = list(S)
    count = 0
    for i in range(3):
        if list_s[i] == 'R':
            count +=1
        elif list_s[i] == 'S':
            count = 0
    print(count)
Problem p02584 (python)

Fixed submission:
#移動の最小値(高速化問題)
x,k,d = map(int,input().split())
x = abs(x)
if (x//d) > k:
    ans = x - d*k
elif (k-(x//d))%2 == 0:
    y = x-(x//d)*d
    ans = y
else:
    y = x-(x//d)*d
    ans = y-d
print(abs(ans))

Buggy submission (verdict: Runtime Error):
#移動の最小値(高速化問題)
x,k,d = map(int,input().split())
x = abs(x)
if (x//d) >=k:
    ans = x - d*k
y = x-(x//d)*d
elif k- (x//d)%2 != 0:
    ans = y
else:
    ans = y-d
print(abs(ans))
Problem p02612 (python)

Fixed submission:
N = int(input())

x = 0
while x < N:
    x = x + 1000

output = x - N
print(output)

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W,K = map(int,input().split())

a = [list(input()) for _ in range(H)] #listの中にlist()を標準入力する。H行分作成する。
#a = np.zeros((int(H),int(W)))
print(a)
count = 0
ans = 0
for i in range(2**W): #行の塗り方のパターン
    for j in range(2**H): #列の塗り方のパターン
        count = 0
        for s in range(H):
            for t in range(W):
                if(i >> s)&1 and (j>>t) & 1 and a[s][t] =="#":
                    count += 1
            if count == K:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())

i = 1
AC = 0
WA = 0
TLE = 0
RE = 0
list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",a)
print("WA x" , b)
print("TLE x" , c)
print("RE x" ,d)
Problem p02700 (python)

Fixed submission:

A,B,C,D=map(int,input().split())
while True:
    C -= B
    if C<=0:
        print('Yes')
        break
    A -= D
    if A<=0:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
while True:
    C -= B
    A -= D
    if A<=0:
        print('No')
        break
    elif C<=0:
        print('Yes')
        break
Problem p02582 (python)

Fixed submission:
s = input()

if "RRR" in s:
    print("3")
elif "RR" in s:
    print("2")
elif "R" in s:
    print("1")
else:
    print("0")

Buggy submission (verdict: Runtime Error):
day = input()
count = day.count("R")
if count == 2:
    if count1 = day.count("RR"):
	    print(2)
	else:
    	print(1)
if count == 1:
    print(1)
if count == 0:
    print(0)
Problem p02719 (python)

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

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
def replace(n,k):
    n = min(n,abs(n - k))
    if n <= abs(n - k):
        return n,k
    else:
        return replace(n, k)
if k == 1:
    print(0)
else:
    n1, k1 = replace(n,k)
    print(n1)
Problem p03086 (python)

Fixed submission:
s = input()
count = 0
tmp = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        tmp += 1
    else:    
        tmp = 0
    count = max(tmp,count)
print(count)

Buggy submission (verdict: Runtime Error):
count = 0
tmp = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        tmp += 1
    else:    
        tmp = 0
    count = max(tmp,count)
print(count)
Problem p02713 (python)

Fixed submission:
import math
import itertools
GCD_over_150=[4548003,4616104,4718640,4812789,4918561,5003286,5131848,5205481,5299011,5392008,5521384,5610705,5739009,5818390,5930196,6052893,6156139,6239472,6402720,6493681,6623853,6741078,6864016,6953457,7094451,7215016,7359936,7475145,7593865,7689630,7886244,7984165,8130747,8253888,8403448,8523897,8684853,8802826,8949612,9105537,9267595,9376656,9574704,9686065,9827097,9997134,10174780,10290813,10493367,10611772,10813692]
 
N=int(input())
if N<150:
	GCD=[]
	GCD1=[]
	for i in range (1,N+1):
		GCD.append(i)
	for i in itertools.product(GCD,repeat=3):
		GCD1.append(math.gcd(math.gcd(i[0],i[1]),i[2]))
	print(sum(GCD1))    
else:
    print(GCD_over_150[N-150])

Buggy submission (verdict: Runtime Error):
import math
import itertools
GCD_over_150=[4548003,4616104,4718640,4812789,4918561,5003286,5131848,5205481,5299011,5392008,5521384,5610705,5739009,5818390,5930196,6052893,6156139,6239472,6402720,6493681,6623853,6741078,6864016,6953457,7094451,7215016,7359936,7475145,7593865,7689630,7886244,7984165,8130747,8253888,8403448,8523897,8684853,8802826,8949612,9105537,9267595,9376656,9574704,9686065,9827097,9997134,10174780,10290813,10493367,10611772,10813692]

N=int(input())
if N<150:
    GCD=[]
    GCD1=[]
    for i in range (1,N+1):
	    GCD.append(i)
    for i in itertools.product(GCD,repeat=3):
		GCD1.append(math.gcd(math.gcd(i[0],i[1]),i[2]))
	print(sum(GCD1))    
else:
    print(GCD_over_150[N-150])

Buggy submission (verdict: Runtime Error):
import math
import itertools
from functools import reduce
N=int(input())
def A(i):
    def gcd(*numbers):
        return reduce(math.gcd, numbers)

    GCD=[]
    GCD1=[]
    for i in range (1,N+1):
        GCD.append(i)

    for i in itertools.product(GCD,repeat=3):
   
        GCD1.append(gcd(i[0],i[1],i[2]))
    
    return sum(GCD1) 
for i in range of (150,200)
print(A(N))

Buggy submission (verdict: Runtime Error):
import math
import itertools
from functools import reduce
N=int(input())
def A(i):
    def gcd(*numbers):
        return reduce(math.gcd, numbers)

    GCD=[]
    GCD1=[]
    for i in range (1,N+1):
        GCD.append(i)

    for i in itertools.product(GCD,repeat=3):
   
        GCD1.append(gcd(i[0],i[1],i[2]))
    
    return sum(GCD1) 
for i in range of (150,200)
print(A(N))
Problem p02741 (python)

Fixed submission:
i = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[i-1])

Buggy submission (verdict: Runtime Error):
input= []

try:
    while True:
        s = input()
        if s == '':
            break
        input.append(s)

except EOFError:
    pass

for s in input:

 list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

 print(list[int(s)-1])

Buggy submission (verdict: Runtime Error):
i = []

try:
    while True:
        s = input()
        if s == '':
            break
        i.append(s)

except EOFError:
    pass

for s in i:

 list= [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 print(list[s-1])
Problem p02761 (python)

Fixed submission:
import sys
n,m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(m)]
 
b=[pow(10,n-1)]
count=0
for i in range(0,m):
    
    if A[i][0]==1 and A[i][1]==0 and n>1:
        print(-1)
        sys.exit()
    else:
        b.append(A[i][1]*pow(10,n-A[i][0]))
        if n-A[i][0]==n-1:
            count+=1

#print(b,count)          
if count>0 or n==1:
    b.remove(pow(10,n-1))

if n>1:
    #print([i for i in b if i != 0])
    b=[i for i in b if i != 0]


#print(b)

b=list(set(b))
 
c=[]
for i in range(len(b)):
    c.append(len(str(b[i])))
    
c=list(set(c))

#print(b,c)
 
if len(b)==len(c) and len(str(sum(b)))==n:
    print(sum(b))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys
n,m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(m)]
 
b=[]
for i in range(0,m):
    
    if A[i][0]==1 and A[i][1]==0:
        print(-1)
        sys.exit()
    else:
        b.append(A[i][1]*pow(10,m-A[i][0]))

if n>1:
    b.remove(0)
    
b=list(set(b))
 
c=[]
for i in range(len(b)):
    c.append(len(str(b[i])))
    
c=list(set(c))


 
if len(b)==len(c) and len(str(sum(b)))==n:
    print(sum(b))
else:
    print(-1)
Problem p03238 (python)

Fixed submission:

n = int(input())
if n==1:
	print("Hello World")
else:
	a = int(input())
	b = int(input())
	print(a+b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
if N==1:
	print("Hello world")
else:
	print(A+B)
Problem p04043 (python)

Fixed submission:
s=list(input().split())
s.sort()
d=int(s[0])*100+int(s[1])*10+int(s[2])
d=d-557
if d==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
s.sort()
d=int(s[0])*100+int(s[1])*10+int(s[2])
d=d-557
if d==0:
    print("Yes")
else:
    print("No")
Problem p02641 (python)

Fixed submission:
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    p= p+[p[n-1]+2]
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)

Buggy submission (verdict: Runtime Error):
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()
p= p+[p[n-1]+2]
index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)

Buggy submission (verdict: Runtime Error):
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    for i in range(n):
        # print(index-i, index+i)
        if p[index-i] != x-i:
            print(x-i)
            break
        elif p[index+i] != x+i:
            print(x+i)
            break

Buggy submission (verdict: Runtime Error):
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    for i in range(n):
        print(index-i, index+i)
        if p[index-i] != x-i:
            print(x-i)
            break
        elif p[index+i] != x+i:
            print(x+i)
            break
Problem p02642 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))

maxA = max(A)
ans = 0
flag = [0]*(maxA+1)

# print(flag)
for a in A:
    for ax in range(a,maxA+1,a):
        flag[ax] +=1

# print(flag)
for a in set(A):
    if flag[a] == 1:
        ans += 1
print(ans)

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

a.sort()

def zansa(a0, alist):
    ans=[]
    for i in range(len(alist)):
        if alist[i] % a0 != 0:
            ans.append(alist[i])
    return ans

an = []
if a[0]==a[n-1] or n==0:
    pass
else:
    for j in range(n-1):
        # print(a[0])
        an.append(a[0])
        if len(a) >1:
            a = zansa(a[0],a[1:])
        else:
            break

print(len(an))