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

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(range(n))
k = 2
s = 0
for i in range(n):
  if (n/2-1) < (n-i-1):
    b[n-i-1] = a[n-i-1]
  else:
    while n > k*(n-i)-1:
      s += b[k*(n-i)-1]
      k += 1
    if s % 2 == a[n-i-1]:
      b[n-i-1] = 0
    else:
      b[n-i-1] = 1
  k = 2
  s = 0
ans = b.count(1)
print(ans)
for i in range(n):
  if b[i] == 1:
    print(i+1, end=" ")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(range(n))
k = 2
s = 0
for i in range(n):
  if (n/2-1) < (n-i-1):
    b[n-i-1] = a[n-i-1]
  else:
    for j in range(2,k+1):
      s += b[j*(n-i)-1]
    if s % 2 == a[n-i-1]:
      b[n-i-1] = 0
    else:
      b[n-i-1] = 1
    k += 1
ans = b.count(1)
print(ans)
for i in range(n):
  if b[i] == 1:
    print(i+1)
Problem p02996 (python)

Fixed submission:
n =  int(input())

x = []
for i in range(n):
  x.append(list(map(int, input().split())))
x.sort(key=lambda x:(x[1],x[0]))

s = 0
y = 0
for i in range(n):
  s += x[i][0]
  if s > x[i][1]:
    y = 1
    print("No")
    break
if y == 0:
  print("Yes")

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

import fractions
import math

x = int(int(b//c) - int(math.ceil(a/c)) + 1)
y = int(int(b//d) - int(math.ceil(a/d)) + 1)
e = int(int(c*d)//int(fractions.gcd(c,d)))
z = int(int(b//e) - int(math.ceil(a/e)) + 1)

print(int(b-a+1-x-y+z))
Problem p02999 (python)

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

if n < k:
  print(0)
else:
  print(10)

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

s = 0
j = 0
ans = 0
for i in range(n):
  while(s < k):
    if j == n:
      break
    else:
      s += a[j]
      j += 1
  if s < k:
    break
  ans += n-j+1
  s -= a[i]
print(ans)
Problem p03713 (python)

Fixed submission:
h,w = map(int, input().split())
ans = 1000000000
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
if h%3 == 0:
  ans = 0
if w%3 == 0:
  ans = 0
for i in range(1,h):
  ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
  ans = min(ans,ans_)
for i in range(1,w):
  ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
  ans = min(ans,ans_)
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
if h%3 == 0:
  ans = 0
if w%3 == 0:
  ans = 0
if h != 1:  
  for i in range(1,h):
    ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
    ans = min(ans,ans_)
if w != 1:  
  for i in range(1,w):
    ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
    ans = min(ans,ans_)
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
for i in range(1,h):
  ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
  ans = min(ans,ans_)
for i in range(1,w):
  ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
  ans = min(ans,ans_)
print(ans)
Problem p02795 (python)

Fixed submission:
H= int(input())
W= int(input())
N= int(input())

import math

u = N/max(H,W)

print(math.ceil(u))

Buggy submission (verdict: Runtime Error):
N, K, S = map(int, input().split())

l = [S] + [0]*(K-1) + [S%10**9]*(N-K) #長さKで要素が全てSの列（条件満たすK通り）と長さNーKの適当な列で長さN列を生成

print(*l) #*lは標準出力時にはいれつの[]を出力しないため
Problem p03251 (python)

Fixed submission:
N, M, X, Y = map(int, input().split())
 
x = list(map(int, input().split()))
y = list(map(int, input().split()))    

if (X < max(x)) and (max(x) < min(y)) and (min(y) <= Y):
    print("No War")
else:
    print("War")

Buggy submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
 
x = list(map(int, input().split()))
y = list(map(int, input().split()))    
 
for z in range(-100, 101):
    if (X < z) and (max(x) < z) and (z <= min(y) and (z <= Y):
        print("No War")
    else:
        print("War")
Problem p03264 (python)

Fixed submission:
K = int(input())

if K%2==0:
	print(round((K/2)*(K/2)))
else:
	print(round((K-1)*(K+1)/4))

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

if K%2==0:
	print((K/2)*(K/2))
else:
	print((k-1)*(k-1)/4)
Problem p02927 (python)

Fixed submission:
m,d=map(int,input().split())
count=0
for i in range(1,m+1):
    for j in range(1,d+1):
        if j>=10:
            d1=int(str(j)[-1])
            d2=int(str(j)[0])
            if d1>=2 and d2>=2 and d1*d2==i:
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
m,d=map(int,input().split())
count=0
for i in range(1,m+1):
	for j in range(1,d+1):
		if d>=10:
			d1=int(str(d)[-1])
    		d2=int(str(d)[0])
    		if d1>=2 and d2>=2 and d1*d2==m:
      			count+=1
print(count)

Buggy submission (verdict: Runtime Error):
m,d=map(int,input().split())
count=0
for i in range(1,m+1):
  for j in range(1,d+1):
    d1=int(str(d)[-1])
    d2>=2
    if d>=10 and d1>=2 and d2>=2 and d1*d2==m:
      count+=1
print(count)
Problem p03161 (python)

Fixed submission:
import sys
n,k=map(int,input().split())
l=list(map(int,input().split()))
dp=[sys.maxsize]*n
dp[0]=0
for i in range(n):
    for j in range(i+1,i+k+1):
        if j<n:
            dp[j]=min(dp[j], dp[i]+ abs(l[i]-l[j]))


print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
def input():
	sys.stdin.readline().strip()
n,k=map(int,input().split())
l=list(map(int,input().split()))
dp=[sys.maxsize]*n
dp[0]=0
for i in range(n):
    for j in range(i+1,i+k+1):
        if j<n:
            dp[j]=min(dp[j], dp[i]+ abs(l[i]-l[j]))


print(dp[-1])
Problem p02658 (python)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= A[i]
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)

Buggy submission (verdict: Runtime Error):
 = int(input())
A = [int(x) for x in input().split()]

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= A[i]
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= a
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)
Problem p03844 (python)

Fixed submission:
str = raw_input().split()
print int(str[0]) + int(str[2]) if str[1] == "+" else int(str[0]) - int(str[2])

Buggy submission (verdict: Runtime Error):
import numpy as np
import collections
N=int(raw_input())
A=map(int, raw_input().split())
count_A=collections.Counter(A).most_common(1)

cnt = 0
if N%2 == 0:
    if A.count(0) >= 1:
        print 0
        cnt = 1
    elif count_A [0][1] != 2:
        print 0
        cnt = 1
    if cnt == 0:
        print 2**(N/2)%(10**9+7)
else:
    if A.count(0) >= 2:
        print 0
        cnt = 1
    elif count_A[0][1] != 2:
        print 0
        cnt = 1
    if cnt == 0:
        print 2**(N/2)%(10**9+7)
Problem p02756 (python)

Fixed submission:
from collections import deque
s = deque(input().replace('\n', ''))
q = int(input())
flag = True
for i in range(q):
    query = list(map(str, input().split()))
    if query[0]=='1':
        if flag: flag = False
        else: flag = True
    else:
        
        if (not flag and query[1]=='1') or flag and query[1]=='2':
            s.append(query[2])
        else:
            s.appendleft(query[2])
s = ''.join(s)
print(s if flag else s[::-1])

Buggy submission (verdict: Runtime Error):
from collections import deque
s = deque(input().replace('\n', ''))
q = int(input())
flag = True
for i in range(q):
    query = list(map(str, input().split()))
    if query[0]=='1':
        if flag: flag = False
        else: flag = True
    else:
        
        if (not flag and query[1]=='1') or flag and query[1]=='2':
            s.append(query[2])
        else:
            s.appendleft(query[2])
if not flag:
    s = s[::-1]

print(''.join(s))
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
A = list(map(int, input().split()))
B = [(1+i)/2 for i in A]
ans = sum(B[:k])
t = ans
for i in range(n-k):
    t-=B[i]
    t+=B[i+k]
    if t>ans: ans=t
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = list(map(int, input().split()))
B = [0]*1001
B[1] = 1
for i in range(2, 1001):
    B[i] = B[i-1] + 0.5
ans = 0
for i in range(n-(n-k)):
    t = 0
    for j in range(k):
        t+=B[A[i+j]]
    ans = max(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
B = [0]*1001
for i in range(1, 1001):
    a = 0
    for j in range(1, i+1):
        a += j
    B[i] = a/i
ans = 0
for i in range(n-(n-m)):
    t = 0
    for j in range(m):
        t+=B[A[i+j]]
    ans = max(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
a, tmp = 0, 0
for i in range(n-2):
    if sum(p[i:i+k])>=tmp:
        tmp = sum(p[i:i+k])
        a = p[i:i+k]
ans = 0
b = [i for i in range(1001)]
for i in a:
    ans += sum(b[:i+1])/i
print(ans)
Problem p03000 (python)

Fixed submission:
n, x = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(n+1)
cnt = 1

for i in range(n):
  D[i+1] = D[i] + L[i]
  if D[i+1]<=x:
    cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = map(int,input().split())
L = list(map(int,input().split()))
d, cnt = 0, 1
for i in range(1,n+2):
  d = d + L[i-1]
  if d <= x:
    cnt+=1
  else:
    break
print(cnt)
Problem p03069 (python)

Fixed submission:
N = int(input())
S = list(input())
b = S.count("#")
w = S.count(".")
ans = min(b,w)
if b>=1 and w>=1:
  cost = N-w
  for i in range(N-1, -1, -1):
    if S[i]=='.':
      cost+=1
    else: 
      cost-=1
      ans = min(ans,cost)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
cnt = 0
if S.count('#')>S.count('.'):
  word = '#'
else:
  word = '.'
ans=""
for i in range(N):
  if i==0:
    ans+=S[i]
    pass
  if ans[-1]=='#' and S[i]=='.':
    cnt+=1
    ans+=word
  else:
    ans+=S[i]
  print(ans)
print(cnt)
Problem p03206 (python)

Fixed submission:
d = int(input())
c = 'Christmas'
e = 'Eve'
if d==25:
  print(c)
elif d==24:
  print(c, e)
elif d==23:
  print(c, e, e)
else:
  print(c, e, e, e)

Buggy submission (verdict: Runtime Error):
d = int(input())
c = 'Christmas'
e = 'Eve'
a = 25-d
if a>=1:
  b=' '
print(c+(b+e)*a)
Problem p03239 (python)

Fixed submission:
N, T = map(int,input().split())
cost=float('inf')
for i in range(N):
  c,t=map(int,input().split())
  if T>=t:
    cost = min(cost,c)
  if i==N-1 and cost==float('inf'):
    cost='TLE'
print(cost)

Buggy submission (verdict: Runtime Error):
N, T = map(int,input().split())
cost=float('inf')
for i in range(N):
  c,t=map(int,input().split())
  if T>=t:
    cost = min(cost,c)
  if cost==float('inf'):
    cost='TLE'
print(cost)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
for i in range(k):
    if s[i]!='1':
        break
print(s[i])

Buggy submission (verdict: Runtime Error):
s=list(input())
k=int(input())
if s[0]=='1':
  print(s[1])
  
else:
  print(s[0])
Problem p03293 (python)

Fixed submission:
s=list(input())
t=list(input())
flag=False
cnt=0
if sorted(s)==sorted(t):
  a=s.index(t[0])
  for i in range(len(s)):
    b=i+a
    if b>=len(s):
      b-=len(s)
    if s[b]==t[i]:
      cnt+=1

if cnt==len(s):
  flag=True
print('Yes' if flag else 'No')

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
flag=False
cnt=0
if sorted(s)==sorted(t):
  a=s.index(t[0])
  for i in range(len(s)):
    b=i+a
    print(b)
    if b>=len(s):
      b-=len(s)
    if s[b]==t[i]:
      cnt+=1

if cnt==len(S):
  flag=True
print('Yes' if flag else 'No')
Problem p03352 (python)

Fixed submission:
X = int(input())
num = [1]
for i in range(2,X):
  temp = i
  while temp*i<=X:
    temp=temp*i
    num.append(temp)
    
print(sorted(num)[-1])

Buggy submission (verdict: Runtime Error):
X = int(input())
num = []
for i in range(1,X):
  temp = i**2
  if temp<=X:
    num.append(temp)
    
print(num[-1])

Buggy submission (verdict: Runtime Error):
X = int(input())
num = []
for i in range(1,X+1):
  temp = i**2
  if temp<X:
    num.append(temp)
    
print(num[-1])
Problem p03565 (python)

Fixed submission:
s=input().replace('\n', '')
t=input().replace('\n', '')
begin, end = len(s) - len(t), len(s)
ans=''
while begin>=0:
    origin = s[begin:end]
    flag=1
    
    for i in range(len(t)):
        if origin[i]!=t[i] and origin[i]!='?':
            flag=0
            break
    if flag:
        ans = s[:begin]+t+s[end:]
        break
    begin-=1
    end-=1
print("UNRESTORABLE" if not len(ans) else ans.replace('?', 'a'))

Buggy submission (verdict: Runtime Error):
s=input().replace('\n', '')
t=input().replace('\n', '')
begin, end = len(s) - len(t), len(s)
ans=''
while begin>=0:
    origin = s[begin:end]
    flag=1
    for i in range(len(t)):
        if origin[i]!=t[i] and origin[i]!='?':
            flag=0
            break
    if flag:
        ans = s[:begin]+t+s[end:]
    begin-=1
    end-=1
print("UNRESTORABLE" if flag else ans.replace('?', 'a'))

Buggy submission (verdict: Runtime Error):
s=input().replace('\n', '')
t=input().replace('\n', '')
begin, end = len(s) - len(t), len(s)
ans=''
while begin>=0:
    origin = s[begin:end]
    print(origin)
    flag=1
    for i in range(len(t)):
        if origin[i]!=t[i] and origin[i]!='?':
            flag=0
            break
    if flag:
        ans = s[:begin]+t+s[end:]
    begin-=1
    end-=1
print("UNRESTORABLE" if flag else ans.replace('?', 'a'))
Problem p03612 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
flag = 0
cnt = 0
for i in range(n):
    if flag: flag=0
    elif p[i]==i+1:
        flag=1
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
pp = [1 if p[i-1] == i else 0 for i in range(1, n+1)]
for i in range(n):
    if pp[i]==1:
        p[i], p[i+1] = p[i+1], p[i]
        cnt+=1
print(cnt)
Problem p03624 (python)

Fixed submission:
s=sorted(list(set(input())))
flag=True
for i in range(26):
  a=i+97
  if s.count(chr(a))==0:
    flag=False
    break
print('None' if flag else chr(a))

Buggy submission (verdict: Runtime Error):
s=sorted(list(set(input())))
flag=True
for i in range(26):
  a=i+97
  if int(ord(s[i]))-a!=0:
    flag=False
    break
print('None' if flag else chr(a))
Problem p03699 (python)

Fixed submission:
N = int(input())
h = [int(input()) for _ in range(N)]
ans = sum(h)
if ans%10!=0:
    print(ans)
else:
    s = [i for i in h if i%10]
    print(ans - min(s) if len(s) else 0)

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(input()) for _ in range(N)]
ans = sum(h)
if ans%10!=0:
    print(ans)
else:
    s = [i for i in s if s%10]
    print(ans - min(s))
Problem p04045 (python)

Fixed submission:
N,K = map(int,input().split())
D = input().split()
for i in range(N, 10*N+1):
  for j in str(i):
    if j in D:
      break
  else:
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
N,K = map(str,input().split())
D = list(map(int,input().split()))
nums = [x for x in range(10)]
nots = [i for i in nums if i not in D]
ans = ""
for j in range(len(N)):
  for k in nots:
    if int(N[j])<=k:
      ans+=str(k)
      break
print(int(ans))
Problem p02843 (python)

Fixed submission:
x=int(input())
if x<=99:
    print(0)
    exit()
if x<=105:
    print(1)
    exit()
dp=[0]*(x+1)
for i in range(100):
    dp[i]=0
for i in range(100,106):
    dp[i]=1
for i in range(106,x+1):
    if dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
        dp[i]=1
print(dp[-1])

Buggy submission (verdict: Runtime Error):
x=int(input())
if x<=99:
    print(0)
    exit()
dp=[0]*(x+1)
for i in range(100):
    dp[i]=0
for i in range(100,106):
    dp[i]=1
for i in range(106,x+1):
    if dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
        dp[i]=1
print(dp[-1])
Problem p02995 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
import fractions as f
cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
gcd=f.gcd(c,d)
lcm=c*d//gcd
cd=b//lcm-(a-1)//lcm
print((b-a+1)-(cc+dd-cd))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
gcd=math.gcd(c,d)
lcm=c*d//gcd
cd=b//lcm-(a-1)//lcm
print((b-a+1)-(cc+dd-cd))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
gcd=math.gcd(c,d)
lcm=c*d//gcd
cd=b//lcm-a//lcm
print((b-a+1)-(cc+dd-cd))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
gcd=math.gcd(c,d)
lcm=c*d//gcd
cd=b//lcm-a//lcm
print((b-a+1)-(cc+dd-cd))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
gcd=math.gcd(c,d)
lcm=c*d//gcd
cd=b//lcm-a//lcm
print((b-a+1)-(cc+dd-cd))
Problem p03006 (python)

Fixed submission:
n=int(input())
if n==1:
    print(1)
    exit()
    
x=[0]*n
y=[0]*n

for i in range(n):
    x[i],y[i]=map(int,input().split())
dis=[]
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        dis.append((x[j]-x[i],y[j]-y[i]))
        
from collections import Counter
c=Counter(dis).most_common()[0]
print(n-c[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[0]*n
y=[0]*n

for i in range(n):
    x[i],y[i]=map(int,input().split())
dis=[]
for i in range(n-1):
    for j in range(i+1,n):
        dis.append((x[j]-x[i],y[j]-y[i]))
        
from collections import Counter
c=Counter(dis).most_common()[0]
print(n-c[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[[int(i) for i in input().split()] for i in range(n)]
x_dis=[0]*(n-1)
y_dis=[0]*(n-1)

for i in range(n-1):
    x_dis[i]=a[i+1][0]-a[i][0]
    y_dis[i]=a[i+1][1]-a[i][1]

import collections

cx=collections.Counter(x_dis).most_common()[0]
cy=collections.Counter(y_dis).most_common()[0]

print(n-min(cx[1],cy[1]))
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
b=[0]*(n+1)
y=0
for x,i in enumerate(s):
    if i=="A" and x!=n-1 and s[x+1]=="C":
        y+=1
    b[x+1]=y
for i in range(q):
    a0,a1=map(int,input().split())
    print(b[a1-1]-b[a0-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
a=input()
l=[[int(i) for i in input().split()]for i in range(q)]
ac=[]
for x,aa in enumerate(a):
    if aa=="A" and a[x+1]=="C":
        ac.append(x+1)
ac=set(ac)
for i in l:
    cnt=0
    for j in ac:
        if i[0]<=j<i[1]:
            cnt+=1
    print(cnt)
Problem p03106 (python)

Fixed submission:
a,b,c=map(int, input().split())
al=[]
bl=[]
for i in range(1,a+1):
    if a%i==0:
        al.append(i)
for i in range(1,b+1):
    if b%i==0:
        bl.append(i)
co=sorted(list(set(al)&set(bl)))
print(co[-c])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input().split())
al=[]
bl=[]
for i in range(1,a+1):
    if a%i==0:
        al.append(i)
for i in range(1,b+1):
    if b%i==0:
        bl.append(i))
co=sorted(list(set(al)&set(bl)))
print(co[-c])
Problem p03163 (python)

Fixed submission:
n,w=map(int,input().split())
a=[[int(i) for i in input().split()]for i in range(n)]
dp=[[0 for i in range(w+1)]for i in range(n+1)]
for i in range(n):
    for sum_w in range(1,w+1):
        if sum_w-a[i][0]>=0:
            dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w-a[i][0]]+a[i][1])
        else:
            dp[i+1][sum_w]=dp[i][sum_w]
print(dp[n][w])

Buggy submission (verdict: Runtime Error):
def knapsack(N,W,weight,value):
    #初期化
    inf=float("inf")
    dp=[[-inf for i in range(W+1)] for j in range(N+1)]
    for i in range(W+1): 
        dp[0][i]=0
    #DP
    for i in range(N):
        for w in range(W+1):
            if weight[i]<=w: #dp[i][w-weight[i]の状態にi番目の荷物が入る可能性がある
                dp[i+1][w]=max(dp[i][w-weight[i]]+value[i], dp[i][w])
            else: #入る可能性はない
                dp[i+1][w]=dp[i][w]
    return dp[N][W]

n,w=map(int,input().split())
weight=[0]*n
value=[0]*n
for i in range(n):
    weight[i],value[i]=map(int,input().split())

print(knapsack(n,w,a,b))
Problem p03262 (python)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.append(x)
a.sort(reverse=True)
b=[]
for i in range(n):
    b.append(a[i]-a[i+1])
import fractions as f
maxi=float('inf')
if len(b)==1:
    print(b[0])
    exit()
for i in range(n-1):
    tmp=f.gcd(b[i],b[i+1])
    maxi=min(maxi,tmp)
print(maxi)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.append(x)
a=sorted(a)
b=[0]*n
for i in range(n):
  b[i]=(a[i+1]-a[i])
import fractions
x1=(b[0]*b[1]) // fractions.gcd(b[0],b[1])
i=2
while i<=n-1:
  lcm=(x1*b[i])//fractions.gcd(x1,b[i])
  x1=lcm
  i+=1
print(x1)
Problem p03324 (python)

Fixed submission:
d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1 and n!=100:
    print(n*100)
elif d==1 and n==100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
elif d==2 and n==100:
    print(1010000)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if d==1:
    base=100
elif d==2:
    base=10000
tmp=base
if d==0:
    print(n)
    exit()
for i in range(n-1):
   tmp+=base
print(tmp)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1 :
    print(n*100)
elif d==1 and n=100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
elif d==2 and n==100:
    print(1010000)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if d==0 and n=!100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1 :
    print(n*100)
elif d==1 and n=!100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
else :
    print(1010000)
Problem p03331 (python)

Fixed submission:
a = int(input())
mi=[]
for i in range(1,a):
    x=0
    y=0
    j = a - i
    for ii in str(i):
        x+=int(ii)
    for jj in str(j):
        y+=int(jj)
    mi.append(x+y)
print(min(mi))

Buggy submission (verdict: Runtime Error):
a = int(input())
mi=[]
for i in range(1,a-1):
    x=0
    y=0
    j = a - i
    for ii in str(i):
        x+=int(ii)
    for jj in str(j):
        y+=int(jj)
    mi.append(x+y)
print(min(mi))

Buggy submission (verdict: Runtime Error):
a = int(input())
mi=[]
for i in range(1,a-1):
    x=0
    y=0
    j = a - i
    for ii in str(i):
        x+=int(ii)
    for jj in str(j):
        y+=int(jj)
    mi.append(x+y)
print(min(mi))