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

Fixed submission:
S = input()
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        #string = string + s
        string += s
    else:
        s_list.append(string)
        string=""
s_list.append(string)
print(max(map(len, s_list)))

Buggy submission (verdict: Runtime Error):
S = input()
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        #string = string + s
        string += s
    else:
        s_list.append(string)
        string=""
print(max(map(len, s_list)))

Buggy submission (verdict: Runtime Error):
S = input()
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        string += s
    else:
        s_list.append(string)
        string=""
max(map(len, s_list))

Buggy submission (verdict: Runtime Error):
S = str(input())
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        string += s
    else:
        s_list.append(string)
        string=""
max(map(len, s_list))
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())
A_list = [list(map(int, input().split())) for i in range(N)]

x_set = set(A_list[0][1:])
for i in range(1, N):
  x_set = x_set & set(A_list[i][1:])
print(len(x_set))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A_list = [list(map(int, input().split())) for i in N]

x_set = set(A_list[0][1:])
for i in range(1, N):
  x_set = x_set | set(A_list[i][1:])
print(len(x_set))
Problem p04047 (python)

Fixed submission:
#-*- coding: utf-8 -*-
N = int(input())
L_list = list(map(int, input().split()))
L_list.sort()
print(sum(L_list[::2]))

Buggy submission (verdict: Runtime Error):
#-*- coding: utf-8 -*-
N = int(input())
L_list = [int(input()) for n in range(2N)]

L_list.sort()
print(sum(L_list[::2]))

Buggy submission (verdict: Runtime Error):
#-*- coding: utf-8 -*-
N = int(input())
L_list = [int(input()) for n in range(2N)]

L_list.sort()
print(sum(L_list[1::2]))
Problem p03085 (python)

Fixed submission:
s = str(input())
if s == 'A':
    print('T')
elif s=='T':
    print('A')
elif s=='G':
    print('C')
elif s=='C':
    print('G')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'A':
    print 'T'
elif s=='T':
    print 'A'
elif s=='G':
    print 'C'
elif s=='C':
    print 'G'
Problem p03101 (python)

Fixed submission:
w,h = map(int,input().split())
W,H = map(int,input().split())
print(str((W-w)*(H-h)))

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
input_b = map(int,input().split())
a_list=[input() for i in range(n)]
aa_list=map(int,a_list.split())
for i in range(n):
  answer = c
  count = 0
  lista_item = aa_list[i]
  for j in range(m):
    answer += input_b[m] * lista_item[m]
  if answer > 0
    count+=1
print count

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
input_b = map(int,input().split())
while True:
  try:
    list_a=list(map(int,input().split()))
    answer = c
    count = 0
    for i in range(len(list_a)):
    answer += input_b[i] * list_a[i]
    if answer > 0
      count+=1
    print count
  except:
    break;
Problem p03086 (python)

Fixed submission:
S = input()

subStringList = [S]
length = len(S)

counter = 0
before = 1

while (not(counter == before)):
    before = counter
    for s in subStringList[:]:
        for letter in s:
            if (not(letter in "ATGC")):
                subStringList += s.split(letter)
                subStringList.remove(s)
                counter = len(subStringList)
                break

print(len(max(subStringList,key=len)))

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

subStringList = []
length = len(S)

for i in range(length) :
    for j in range(1,length+1):
        if (i+j <= length) :
            subStringList.append(S[i:i+j])
        else:
            break


for s in subStringList[:]:
    for letter in s:
        if (not(letter in "ATGC")):
            subStringList.remove(s)
            break

print(len(max(subStringList, key=len)))

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

subStringList = []
length = len(S)

for i in range(length) :
    for j in range(1,length+1):
        if (i+j <= length) :
            subStringList.append(S[i:i+j])
        else:
            break


for s in subStringList[:]:
    for letter in s:
        if (not(letter in "ATGC")):
            subStringList.remove(s)
            break

print(len(max(subStringList)))
Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())
length = len(s)

substringList = []
for i in range(1,K+1) :
    for j in range(length-i+1) :
        substringList.append(s[j:j+i])


substringList = sorted(list(set(substringList)))
print(substringList[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
length = len(s)
if (length>=5):
    substringList = list(set([s[i] for i in range(length)]))
else :
    substringList = []
    for i in range(1,length+1) :
        for j in range(length-i+1) :
            substringList.append(s[j:j+i])

substringList = sorted(substringList)
print(substringList[K])
Problem p03423 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# グループ数の計算
g = N // 3
# 出力
print("{}".format(g))

Buggy submission (verdict: Runtime Error):
import itertools as it
# -*- coding: utf-8 -*-
# 個数の入力
N = int(input())
# 改行区切りの名前の入力
S = []
for i in range(N):
    S.append(input())
# データの加工
for i in range(N):
	S[i] = S[i][0]

# 文字列カウント
count = [S.count('M'), S.count('A'), S.count('R'), S.count('C'), S.count('H')]

# 数え上げ
answer = count[0]*count[1]*count[2]
answer = count[0]*count[1]*count[3] + answer
answer = count[0]*count[1]*count[4] + answer
answer = count[0]*count[2]*count[3] + answer
answer = count[0]*count[2]*count[4] + answer
answer = count[0]*count[3]*count[4] + answer
answer = count[1]*count[2]*count[3] + answer
answer = count[1]*count[2]*count[4] + answer
answer = count[1]*count[3]*count[4] + answer
answer = count[2]*count[3]*count[4] + answer

# 出力
print(answer)
Problem p03424 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 個数の入力
N = input()
# スペース区切りの色の入力
S = input().split()
# 出力
if "Y" in S:
	print('Four')
else:
	print('Three')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 個数の入力
N = input()
# スペース区切りの色の入力
S = raw_input().split()
# 出力
if "Y" in S:
	print('Four')
else:
	print('Three')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 個数の入力
N = input()
# スペース区切りの色の入力
S = raw_input().split()
# 出力
if 'Y' in S:
	print('Four')
else:
	print('Three')
Problem p03962 (python)

Fixed submission:
def main():
    a, b, c = map(int, input().split())

    ans = 0
    if a == b and b == c:
        ans = 1
    elif a == b or b == c or c == a:
        ans = 2
    else:
        ans = 3

    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    res = 0
    if N == 1:
        res = K
    else:
        res = K * (K - 1) * (N - 1)

    print(res)


if __name__ == "__main__":
    main()
Problem p03262 (python)

Fixed submission:

#coding: utf-8
import numpy as np
from functools import reduce

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

y = np.asarray(list(map(int,input().split())))
y -= x
y = map(abs,y)

print(reduce(gcd, y))

Buggy submission (verdict: Runtime Error):

#coding: utf-8
import numpy as np
import math
from functools import reduce

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

y = np.asarray(list(map(int,input().split())))
y -= x

print(reduce(math.gcd, y))

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import numpy as np
import fraction
from functools import reduce

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

y = np.asarray(list(map(int,input().split())))
y -= x

print(reduce(fraction.gcd, y))
Problem p03280 (python)

Fixed submission:
#coding: utf-8

a,b = map(int,raw_input().split())

print (a-1)*(b-1)

Buggy submission (verdict: Runtime Error):
#coding: utf-8

a = int(raw_input())
b = int(raw_input())

print (a-1)*(b-1)
Problem p03086 (python)

Fixed submission:
s=input()

le=0

i=0
while(i<len(s)):
    l=0
    while(i<len(s) and (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T')):
        l+=1
        i+=1

    if(l>le):
        le=l
    l=0
    i+=1
print(le)

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

le=0
i=0
while(i<len(s)):
    l=0
    while(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T'):
        l+=1
        i+=1

    if(l>le):
        le=l
    l=0
    i+=1
print(le)
Problem p03423 (python)

Fixed submission:
n = int(input())
print(int(n / 3))

Buggy submission (verdict: Runtime Error):
print(n / 3)
Problem p03636 (python)

Fixed submission:
import sys 

line = sys.stdin.read()
line = line.strip()
start = line[0]
end = line[-1]
print('%s%d%s'%(start, len(line) - 2, end))

Buggy submission (verdict: Runtime Error):
import sys 

line = sys.stdin
line = line.strip()
start = line[0]
end = line[-1]
print('%s%d%s'%(start, len(line) - 2, end))
Problem p03109 (python)

Fixed submission:
from sys import stdin
 
i = stdin.readline().strip()
d = tuple(map(int, i.split("/")))
print("Heisei" if d <= (2019,4,30) else "TBD")

Buggy submission (verdict: Runtime Error):
from sys import stdin
import datetime
 
i = stdin.readline().strip()
d = map(int, i.split("/"))
print("Heisei" if d <= (2019,4,30) else "TBD")

Buggy submission (verdict: Runtime Error):
from sys import stdin
import datetime

i = stdin.readline().strip()
d = datetime.date.fromisoformat("-".join(i.split("/")))
print("Heisei" if d < datetime.date.fromisoformat("2019-04-30") else "TBD")

Buggy submission (verdict: Runtime Error):
from sys import stdin

i = stdin.readline().strip()
d = datetime.date.fromisoformat("-".join(i.split("/")))
print("Heisei" if d < datetime.date.fromisoformat("2019-04-30") else "TBD")

Buggy submission (verdict: Runtime Error):
import pandas as pd
from sys import stdin

d = pd.to_datetime( stdin.readline().strip() )
print("TBD" if (d > pd.to_datetime("2019/4/30")) else "Heisei")

Buggy submission (verdict: Runtime Error):
INF = int(1e18)

def compute():
    from sys import stdin
    A, B, Q = list(map(int, stdin.readline().split()))
    s = sorted(int(stdin.readline().split()[0]) for _ in range(A))
    t = sorted(int(stdin.readline().split()[0]) for _ in range(B))

    from bisect import bisect_left
    for _ in range(Q):
        x = int(stdin.readline().split()[0])

        i1 = bisect_left(s, x)
        i1 = i1 if i1 < A else i1-1
        i2 = i1-1 if (i1>0) and s[i1]!=x else i1

        res = INF
        for y in set((s[i1], s[i2])):
            j1 = bisect_left(t, y)
            j1 = j1 if (j1 < B) else j1-1
            j2 = j1-1 if (j1 > 0) and t[j1]!=y else j1
            for z in set((t[j1],t[j2])):
                # print(x, y, z)
                res = min(res, abs(x-y) + abs(y-z), abs(x-z) + abs(z-y))

        print(res)


if __name__ == "__main__":
    compute()

Buggy submission (verdict: Runtime Error):
import pandas as pd
from sys import stdin

d = pd.to_datetime( stdin.readline().strip() )
print("TBD" if (d.gt(pd.to_datetime("2019/4/30"))) else "Heisei")
Problem p03160 (python)

Fixed submission:
N = int(input())
H = input().split(" ")
c = [10 ** 7 for i in range(N)]
c[0] = 0
c[1] = abs(int(H[0])-int(H[1]))
for i in range(N-2):
  c[i+2] = min(c[i]+abs(int(H[i])-int(H[i+2])),c[i+1]+abs(int(H[i+1])-int(H[i+2])))
print(c[len(c)-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
H = input().split(" ")
c = [10 ** 7 for i in range(N)]
c[0] = 0
c[1] = abs(int(H[0])-int(H[1]))
for i in range(N-2):
  c[i+2] = min(c[i]+abs(H[i]-H[i+2]),c[i+1]+abs(H[i+1]-H[i+2]))
print(c[len(c)-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
H = input().split(" ")
c = [10 ** 7 for i in range(N)]
c[0] = 0
c[1] = abs(int(h[0])-int(h[1]))
for i in range(N-2):
  c[i+2] = min(c[i]+abs(H[i]-H[i+2]),c[i+1]+abs(H[i+1]-H[i+2])
print(c[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
H = input().split(" ")
height = 0
dp = [[0 for i in range(10`**4)] for n in range(N)]
def rec(n,h,cost):
  if n == N:
    return cost
  elif dp[n][h] != 0:
    return dp[n][h]
  else:
    dp[n][h] = min(rec(n+1,H[h+1],cost + abs(h-H[h+1])),rec(n+2,H[h+2],cost + abs(h-H[h+2])))
	return dp[n][h]
print(rec(0,H[0],0))
Problem p03796 (python)

Fixed submission:
N = int(input())
pow = 1
num = 10**9+7
for i in range(1,N+1):
        pow = pow*i%num
print(pow%num)

Buggy submission (verdict: Runtime Error):
N = int(input())
pow = 1
for i in range(1,N+1):
        pow = pow*i10**9+7
print(pow)
Problem p04043 (python)

Fixed submission:
seven = 0
five = 0

A,B,C = map(int,input().split())
if A == 7:
    seven += 1
elif A == 5:
    five += 1
if B == 7:
    seven += 1
elif B == 5:
    five += 1
if C == 7:
    seven += 1
elif C == 5:
    five += 1
    
if seven == 1 or five == 2:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
seven = 0
five = 0

A,B,C = map(int,input().split())
if A == 7:
    seven += 1
elif A == 5:
    five += 1
if B == 7:
    seven += 1
elif B == 5:
    five += 1
if C == 7:
    seven += 1
elif C == 5:
    five += 1
    
if seven == 1 or five == 2:
    print("YES")
else:
    print("NO")
Problem p03361 (python)

Fixed submission:
import numpy as np
import itertools
 
H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)])

def f(H, W, S):
  for i, j in itertools.product(range(H), range(W)):
    if S[i, j] == '#':
      if np.sum(np.concatenate([S[i-1:i, j], S[i, j-1:j], S[i+1:i+2, j], S[i, j+1:j+2]]) == '#') == 0:
        return False
  return True

if f(H, W, S):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
 
H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)])

for i in range(H):
  for j in range(W):
    if S[i, j] == '#':
      if np.sum(np.concatenate(S[i-1:i, j], S[i, j-1:j], S[i+1:i, j], S[i, j+1:j]) == '#') == 0:
        print('No')
        break
else:
  print('Yes')
Problem p03494 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
count = 0
while True:
  A, mod = zip(*[divmod(a, 2) for a in A])
  if sum(mod) > 0:
    break
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
count = 0
while True:
  A, mod = zip([divmod(a, 2) for a in A])
  if sum(mod) > 0:
    break
  count += 1
print(count)

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

count = 0
while True:
  A, mod = zip([divmod(a, 2) for a in A])
  if sum(mod) > 0:
    break
  count += 1
print(count)

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

count = 0
while True:
  A, mod = zip([divmod(a, 2) for a in A])
  if sum(mod) > 0:
    break
  count++
print(count)
Problem p03574 (python)

Fixed submission:
import numpy as np
from collections import defaultdict
 
H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)])
 
for i in range(H):
  for j in range(W):
    if S[i, j] == '.':
      d = defaultdict(int)
      S[i, j] = np.sum(S[max(i-1, 0):i+2, max(j-1, 0):j+2] == '#')
for s in S:
  print(''.join(s))

Buggy submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)])

for i in range(H):
  for j in range(W):
    if S[i, j] == '.':
      S[i, j] = dict(zip(*np.unique(S[max(i-1, 0):i+2, max(j-1, 0):j+2], return_counts=True)))['#']
for s in S:
  print(''.join(s))
Problem p03632 (python)

Fixed submission:
import numpy as np

A, B, C, D = map(int, input().split())
x, y = zip(*sorted(zip([A, B, C, D], [1, -1, 1, -1])))
z = np.diff(x)[np.cumsum(y)[:-1] == 2]
print(z[0] if len(z) == 1 else 0)

Buggy submission (verdict: Runtime Error):
import numpy as np

A, B, C, D = map(int, input().split())
x = zip(*sorted(zip([A, B, C, D], [1, -1, 1, -1])))
if x[1][1] == 1:
  print(x[2][0] - x[1][0])
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import numpy as np

A, B, C, D = map(int, input().split())
x, y = zip(*sorted(zip([A, B, C, D], [1, -1, 1, -1])))
print(np.diff(x)[np.cumsum(y)[:-1] == 2][0])
Problem p03796 (python)

Fixed submission:
import functools

N = int(input())
print(functools.reduce(lambda x, y: x * y % 1000000007, range(1, N+1)))

Buggy submission (verdict: Runtime Error):
import functools

N = int(input())
print(functools.reduce(lambda x, y: x * y % 1000000007, range(2, N+1)))
Problem p03854 (python)

Fixed submission:
S = input()
if len(S) == 0:
  print('NO')
else:
  if len(S.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')) == 0:
    print('YES')
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S = input()
if (len(S) > 0) and (len(S.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')) == 0):
print('YES')
else:
print('NO')

Buggy submission (verdict: Runtime Error):
S = input()
if len(S) > 0 and len(S.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')) == 0:
print('YES')
else:
print('NO')
Problem p03673 (python)

Fixed submission:
n = int(input())
a = input().split(' ')
b = []
inds = [0] * n

for i in range(int(n/2)):
    inds[i] = n-2*i
    inds[n-1-i] = n-2*i-1
if n % 2 == 1:
    inds[int(n/2)] = n-2*int(n/2)

for i, ind in enumerate(inds):
    print(a[ind-1], end="")
    if i != n-1:
        print(' ', end="")
print('')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split(' ')
b = []
for i in xrange(n):
    b.append(a[i])
    b = b[::-1]
print(' '.join(b))
Problem p04033 (python)

Fixed submission:
a, b = map(int,input().split())
if a <= 0 <= b:
    print("Zero")
elif a > 0:
    print("Positive")
elif (b-a) % 2 == 0:
    print("Negative")
else:
    print("Positive")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
a=int(a)
b=int(b)
if a>0:
    print("positive")
elif a ==0 or b==0:
   print(0)
elif a  <0 and b>0:
    print(0)
elif (b-a)%2==0:
    print('negative')
else:
    print("positibe")
Problem p03089 (python)

Fixed submission:
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

# ***.py a b c形式の引数使用時
# import sys
#
# args = sys.argv
#
# num_len = int(args[1])
# a = []
# b = []
# N = 100
# # b = [1,2,1]
# for i in range(2, 2+num_len):
#     b.append(int(args[i]))
# print(b)

a = []
# print('input:')
num_len = int(input())
b = list(map(int, input().split()))
# print('--'*len(b))
# print('output:')
# print(b)
N = 100



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if b[i]-1 <= len(a):
        # print(i)
        a.insert(b[i]-1, b[i])
        # print(a)
        flag = True
    else:
        flag = False
        break


if flag:
    for i in a:
        print(i)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

import sys

args = sys.argv

num_len = int(args[1])
a = []
b = []
N = 100
# b = [1,2,1]
for i in range(2, 2+num_len):
    b.append(int(args[i]))
print(b)



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if a == b:
        # print(i)
        a.insert(b[i], b[i])
        print(a)
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

import sys

args = sys.argv

num_len = int(args[1])
a = []
b = []
N = 100
# b = [1,2,1]
for i in range(2, 2+num_len):
    b.append(int(args[i]))
print(b)



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if a == b:
        # print(i)
        a.insert(b[i], b[i])
        print(a)
    else:
        print(-1)
Problem p03268 (python)

Fixed submission:
n, k = map(int, input().split())
ans = (n // k) ** 3
if (k & 1) == 0:
    ans += ((n + k // 2) // k) ** 3
print(ans)

Buggy submission (verdict: Runtime Error):
l = int(input())
edge = []
for i in range(1, 19):
    edge.append((i, i + 1, 1 << (i - 1)))
    edge.append((i, i + 1, 0))
sm = 0
for i in range(19, 0, -1):
    v = 1 << (i - 1)
    while l >= v:
        edge.append((i, 20, sm))
        sm += v
        l -= v
print(20, len(edge))
for x, y, z in edge:
    print(x, y, z)
Problem p03319 (python)

Fixed submission:
n, k = map(int, input().split())
print((n - 2) // (k - 1) + 1)

Buggy submission (verdict: Runtime Error):
def Ask(x):
    return sum(int(c) for c in str(x))

def Check(x, y):
    return x * Ask(y) > y * Ask(x)

k = int(input())
no = st = 1
for i in range(k):
    print(no)
    if (Check(no + st, no + st * 10)): st *= 10
    no += st

Buggy submission (verdict: Runtime Error):
def Ask(x):
    ans = 0
    while (x):
        ans += x % 10
        x //= 10
    return ans

def Check(x, y):
    return x * Ask(y) > y * Ask(x)


k = int(input())
no = st = 1
while (k):
    k -= 1
    print(no)
    if (Check(no + st, no + st * 10)): st *= 10
    no += st
Problem p03651 (python)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

n, k = map(int, input().split())
a = list(map(int, input().split()))
g = a[0]
for x in a:
    g = gcd(g, x)
print(("IMPOSSIBLE", "POSSIBLE")[k <= max(a) and k % g == 0])

Buggy submission (verdict: Runtime Error):
from math import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = a[0]
for x in a:
    g = gcd(g, x)
print(("IMPOSSIBLE", "POSSIBLE")[int(k <= max(a) and k % g == 0)])

Buggy submission (verdict: Runtime Error):
from math import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = 0
for x in a:
    g = gcd(g, x)
print(("IMPOSSIBLE", "POSSIBLE")[k <= max(a) and k % g == 0])

Buggy submission (verdict: Runtime Error):
from math import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = 0
for x in a:
    g = gcd(g, x)
print(k <= max(a) and k % g == 0 and "POSSIBLE" or "IMPOSSIBLE")
Problem p03163 (python)

Fixed submission:
def nap(n, cap):
    val = [0] * (cap + 1)
    for _ in range(n):
        w, v = map(int, input().split())
        for wk in range(cap, w - 1, -1):
            nv = val[wk - w] + v
            if val[wk] < nv:
                val[wk] = nv
    return max(val)


n, cap = map(int, input().split())
print(nap(n, cap))

Buggy submission (verdict: Runtime Error):
import sys
 
input = sys.stdin.readline
 
def nap(n, cap):
    val = [0] * (cap + 1)
    for _ in range(n):
        w, v = map(int, input().split())
        for wk in range(cap, w - 1, -1):
            nv = val[wk - w] + v
            if val[wk] < nv:
                val[wk] = nv
    return max(val)
 
 
n, cap = map(int, input().split())
print(nap(n, cap)

Buggy submission (verdict: Runtime Error):
def nap(n, cap):
    val = [0] * (cap + 1)
    for _ in range(n):
        w, v = map(int, input().split())
        for wk in range(cap, w - 1, -1):
            nv = val[wk - w] + v
            if val[wk] < nv:
                val[wk] = nv
    return max(val)
 
 
n, cap = map(int, input().split())
print(nap(n, cap)