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

Fixed submission:
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

H, W, A, B = list(map(int, sys.stdin.readline().split()))
if H % A == 0 and W % B == 0:
    print('No')
    exit()

print('Yes')
MAX = 998244353
ans = np.full((H, W), MAX // (A * B - 1), dtype=int)
if A > 1 and B > 1:
    ans[np.meshgrid(np.arange(A - 1, H, A), np.arange(B - 1, W, B))] = -MAX-1
elif A == 1:
    ans[:, np.arange(B - 1, W, B)] = -MAX-1
else:
    ans[np.arange(A - 1, H, A), :] = -MAX-1
print('\n'.join(map(lambda r: ' '.join(r), ans.astype(str))))

Buggy submission (verdict: Runtime Error):
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

H, W, A, B = list(map(int, sys.stdin.readline().split()))
if H % A == 0 and W % B == 0:
    print('No')
    exit()

print('Yes')
MAX = 998244353
ans = np.full((H, W), MAX // (A * B - 1), dtype=int)
if A > 1 and B > 1:
    ans[np.arange(A - 1, H, A), np.arange(B - 1, W, B)] = -MAX
elif A == 1:
    ans[:, np.arange(B - 1, W, B)] = -MAX
else:
    ans[np.arange(A - 1, H, A), :] = -MAX
print('\n'.join(map(lambda r: ' '.join(r), ans.astype(str))))

Buggy submission (verdict: Runtime Error):
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

H, W, A, B = list(map(int, sys.stdin.readline().split()))
if H % A == 0 and W % B == 0:
    print('No')
    exit()

print('Yes')
ans = np.ones((H, W), dtype=int)
ans[np.arange(A - 1, H, A), np.arange(B - 1, W, B)] = - A * B
print('\n'.join(map(lambda r: ' '.join(r), ans.astype(str))))
Problem p03722 (python)

Fixed submission:
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
sys.setrecursionlimit(200000)

graph = [[] for _ in range(N + 1)]

for a, b, c in ABC:
    graph[b].append((a, c))
graph[1].append((0, 0))

vd = [(N, 0)]
# N までの最長距離
ans = [-INF] * (N + 1)
ans[N] = 0
for _ in range(N + 1):
    nexts = []
    for v, d in vd:
        for u, c in graph[v]:
            if ans[u] < d + c:
                ans[u] = d + c
                nexts.append((u, d + c))
    vd = nexts
if vd:
    print('inf')
else:
    print(ans[0])

Buggy submission (verdict: Runtime Error):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

graph = [[] for _ in range(N + 1)]

for a, b, c in ABC:
    graph[b].append((a, c))


@lru_cache(maxsize=None)
def solve(n):
    # 1 から n までの最長距離
    ret = -INF
    for prev, c in graph[n]:
        ret = max(ret, solve(prev) + c)
    if n == 1:
        return 0
    return ret


try:
    print(solve(N))
except:
    print('inf')
Problem p03760 (python)

Fixed submission:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

#
# A, B, C = list(map(int, sys.stdin.readline().split()))
# a = A
# ok = False
# for _ in range(1000):
#     ok |= a % B == C
#     a += A
# if ok:
#     print('YES')
# else:
#     print('NO')
#
#
# A, B = [int(sys.stdin.readline()) for _ in range(2)]
# if A>B:
#     print('GREATER')
# elif A<B:
#     print('LESS')
# else:
#     print('EQUAL')


O, E = [sys.stdin.readline().rstrip() for _ in range(2)]
ans = ''
for i in range(len(O)):
    ans += O[i]
    if i < len(E):
        ans += E[i]

print(ans)



#
# N, M = list(map(int, sys.stdin.readline().split()))
# A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))
# C, D = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(M)]))
#
# O, E = [sys.stdin.readline().rstrip() for _ in range(2)]
# ans = ''
# for i in range(len(O)):
#     ans += O[i]
#     ans += E[i]
#
# print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

#
# A, B, C = list(map(int, sys.stdin.readline().split()))
# a = A
# ok = False
# for _ in range(1000):
#     ok |= a % B == C
#     a += A
# if ok:
#     print('YES')
# else:
#     print('NO')
#
#
# A, B = [int(sys.stdin.readline()) for _ in range(2)]
# if A>B:
#     print('GREATER')
# elif A<B:
#     print('LESS')
# else:
#     print('EQUAL')


O, E = [sys.stdin.readline().rstrip() for _ in range(2)]
ans = ''
for i in range(len(O)):
    ans += O[i]
    ans += E[i]

print(ans)
Problem p03997 (python)

Fixed submission:
import functools

import os
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def Yesif(cond):
    print('Yes' if cond else 'No')


def YESIF(cond):
    print('YES' if cond else 'NO')


def yesif(cond):
    print('yes' if cond else 'no')


a, b, c = inpm(3)

print(int((a + b) / 2 * c))

Buggy submission (verdict: Runtime Error):
import functools

import os
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def Yesif(cond):
    print('Yes' if cond else 'No')


def YESIF(cond):
    print('YES' if cond else 'NO')


def yesif(cond):
    print('yes' if cond else 'no')

a, b, c  =inpm()

print((a+b) /2* c)
Problem p03145 (python)

Fixed submission:
inp = list(sorted([int(x) for x in input().split()]))
print((inp[0]*inp[1])//2)

Buggy submission (verdict: Runtime Error):
inp = list(sorted([int(x) for x in input().split]))
print(inp[0]*inp[1]/2)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
 
print(h * (a+b) // 2)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

print(h * (a+b) // 2)
Problem p02642 (python)

Fixed submission:
from collections import deque
import collections
import math
"""
#n = int(input())
#A = [int(i) for i in input().split()]
n = 10**5
A = [int(i)+1 for i in range(10**5,0,-1)]
A.sort()
ans = 0
ans_list = []
kaburi = {}
for i in A:
    Flag = True
    for j in ans_list:
        if i==j:
            kaburi[i]=True
            Flag = False
            break
        if i%j==0:
            Flag = False
            break
    if Flag:
        ans_list.append(i)
        ans += 1
print(ans-len(kaburi))
"""


n = int(input())
A = [int(i) for i in input().split()]
Max = max(A)
cnt_dict = collections.Counter(A)
#Dict[i]はi未満の約数がAに存在しなければTrue
Dict = {a:True for a in A}
for a in A:
    times = 2
    while a*times<=Max:
        Dict[a*times]=False
        times +=1
ans = 0
for a in A:
    if cnt_dict[a]==1 and Dict[a]:
        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
Max = max(A)
cnt_dict = collections.Counter(A)
#Dict[i]はi未満の約数がAに存在しなければTrue
Dict = {a:True for a in A}
for a in A:
    times = 2
    while a*times<=Max:
        Dict[a*times]=False
        times +=1
ans = 0
for a in A:
    if cnt_dict[a]==1 and Dict[a]:
        ans +=1
print(ans)
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
A = [int(i) for i in input().split()]

Visit = [False for i in range(n+1)]

loop_st,loop_end,loop_len = 0,0,0
st = 1
releki = []
loop_list = []
for i in range(10000000000000):
    if Visit[st] == True:
        loop_key = st
        loop_st = releki.index(loop_key)
        loop_end = len(releki)-loop_st
        loop_list = releki[loop_st:]
        loop_len = len(loop_list)
        break
    releki.append(st)
    Visit[st] = True
    st = A[st-1]
if k <loop_st:
    print(releki[k])
    exit()
k -= loop_st

print(loop_list[k%loop_len])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
A = [int(i) for i in input().split()]

Visit = [False for i in range(n+1)]

loop_st,loop_end,loop_len = 0,0,0
st = 1
releki = []
for i in range(10000000000000):
    
    if Visit[st] == True:
        loop_key = st
        loop_st = releki.index(loop_key)
        loop_end = len(releki)-loop_st
        loop_len = len(releki)-loop_st-1
        break
    releki.append(st)
    Visit[st] = True
    st = A[st-1]
k-= loop_st
print(releki[loop_len%k])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
A = [int(i) for i in input().split()]

Visit = [False for i in range(n+1)]

loop_st,loop_end,loop_len = 0,0,0
st = 1
releki = []
for i in range(1000000):
    
    if Visit[st] == True:
        loop_key = st
        loop_st = releki.index(loop_key)
        loop_end = len(releki)-loop_st
        loop_len = len(releki)-loop_st-1
        break
    releki.append(st)
    Visit[st] = True
    st = A[st-1]
k-= loop_st
print(releki[loop_len%k])
Problem p02761 (python)

Fixed submission:
import copy
def main():
    n,m = map(int,input().split())
    sc = []
    for i in range(m):
        s,c = map(int,input().split())
        sc.append([s,str(c)])
    if n==1:
        for i in range(10):
            flag = True
            tmp = str(i)
            tmp = list(tmp)
            tmp = ['0' for j in range(n-len(tmp))] + tmp
            for j in range(m):
                if tmp[sc[j][0]-1] !=sc[j][1]:
                    flag = False
            if flag:
                print(i)
                exit()
            
    else:        
        for i in range(10**(n-1),10**n):
            flag = True
            tmp = str(i)
            tmp = list(tmp)
            tmp = ['0' for j in range(n-len(tmp))] + tmp
            
            for j in range(m):
                if tmp[sc[j][0]-1] !=sc[j][1]:
                    flag = False
            if flag:
                print(i)
                exit()
    print('-1')
main()

Buggy submission (verdict: Runtime Error):
import copy
def main():
    n,m = map(int,input().split())
    ans = [0 for i in range(n)]
    for i in range(m):
        s,c = map(int,input().split())
        if ans[s-1] !=0:
            ans[s-1] = min(ans[s-1],c)
        else:
            ans[s-1] = c
    ans = ans[0]*100 + ans[1]*10 + ans[2]
    cnt = 1
    copy_ans = copy.deepcopy(ans)
    while copy_ans > 10:
        copy_ans /= 10
        cnt += 1
    if cnt==n:
        print(ans)
    else:
        print('-1')

main()
Problem p02768 (python)

Fixed submission:
n,a,b = map(int,input().split())
Mod = 10**9+7



def Mod_pow(x, n):
    x = x%Mod
    if n==0:
        return 1
    elif n%2==1:
        return (x*Mod_pow(x,n-1)%Mod)
    else:
        return (Mod_pow(x*x,n/2)%Mod)


def comb(n,r):
    x,y = 1,1
    for i in range(n-r+1,n+1):
        x = x*i%Mod

    for i in range(1,r+1):
        y = y*i%Mod

    #この問題の特徴，フェルマーの小定理よりyで除算することはy^(Mod-2)をかけることと同値
    y = Mod_pow(y,Mod-2)
    return x*y%Mod

ans = (Mod_pow(2,n)-1-comb(n,a)-comb(n,b))
while ans<0:
    ans += Mod

print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
import math
n,a,b = map(int,input().split())
Mod = 10**9+7



def Mod_pow(x, n):
    x = x%Mod
    if n==0:
        return 1
    elif n%2==1:
        return (x*Mod_pow(x,n-1)%Mod)
    else:
        return (Mod_pow(x*x,n/2)%Mod)


def comb(n,r):
    x,y = 1,1
    for i in range(n-r+1,n+1):
        x = x*i%Mod

    for i in range(1,r+1):
        y = y*i%Mod

    #この問題の特徴，フェルマーの小定理よりyで除算することはy^(Mod-2)をかけることと同値
    y = Mod_pow(y,Mod-2)
    return x*y%Mod

ans = (Mod_pow(2,n)-1-comb(n,a)-comb(n,b))
while ans<0:
    ans += Mod

print(ans)
Problem p02900 (python)

Fixed submission:
import fractions
import collections
import math
A,B = map(int,input().split())
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])

    
    return arr
Gcd = fractions.gcd(A,B)
ans = factorization(Gcd)
print(len(ans)+1)

Buggy submission (verdict: Runtime Error):
import fractions
A,B = map(int,input().split())

import math


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
Max = max(A,B)
def koyaku(a,b,arr):
    for i in range(2,Max+1):
        if a%i==0 and b%i==0:
            arr.append(i)
    return arr
Koyaku =[]
cnt = 0
Koyaku = koyaku(A,B,Koyaku)
data = get_sieve_of_eratosthenes(Max)
for i in Koyaku:
    if i in data:
        cnt+=1
print(cnt+1)
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x,y):
    return x*y // fractions.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split())
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split())
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split())
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-(a//c)-(a//d)+(a//lcm(c,d))

print(not_b-not_a_1)
Problem p03031 (python)

Fixed submission:
K = []
S = []
N,M = map(int,input().split())
for i in range(M):
    tmp = [int(i) for i in input().split()]
    K.append(tmp[0])
    tmp.pop(0)
    S.append(tmp)
P = [int(i) for i in input().split()]
List = []
for i in range(2**N):
    tmp = []
    for j in range(N):
        if ((i>>j) & 1):
            tmp.append('1')
        else:
            tmp.append('0')
    List.append(tmp)

for i in range(M):
    kouho = []
    for j in range(len(List)):
        cnt = 0
        for k in range(len(List[j])):
            if List[j][k] == '1':
                if k+1 in S[i]:
                    cnt += 1
        if cnt % 2 != P[i] and not List[j] in kouho:
            kouho.append(List[j])
    for x in kouho:
        List.remove(x)
print(len(List))

Buggy submission (verdict: Runtime Error):
S = []
N,M = map(int,input().split())
for i in range(M):
    tmp = [int(i) for i in input().split()]
    K.append(tmp[0])
    tmp.pop(0)
    S.append(tmp)
P = [int(i) for i in input().split()]
List = []
for i in range(2**N):
    tmp = []
    for j in range(N):
        if ((i>>j) & 1):
            tmp.append('1')
        else:
            tmp.append('0')
    List.append(tmp)

for i in range(M):
    kouho = []
    for j in range(len(List)):
        cnt = 0
        for k in range(len(List[j])):
            if List[j][k] == '1':
                """if  not (k+1) in S[i]:
                    if not List[j] in kouho:
                        kouho.append(List[j])
                    break"""
                if k+1 in S[i]:
                    cnt += 1
        if cnt % 2 != P[i] and not List[j] in kouho:
            kouho.append(List[j])
    for x in kouho:
        List.remove(x)
print(len(List))
Problem p03061 (python)

Fixed submission:
N = int(input())
List = [int(i) for i in input().split()]

def gcd(x,y):
    while y!=0:
        tmp = x
        x = y
        y = tmp%y
    return x

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=gcd(L[i-1],List[i])
    R[-i-1]=gcd(R[-i],List[-i+1])
for i in range(N):
    M.append(gcd(L[i],R[i+1]))
print(max(M))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
List = [int(i) for i in input().split()]

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=math.gcd(L[i-1],List[i])
    R[-i-1]=math.gcd(R[-i],List[-i+1])
for i in range(N):
    M.append(math.gcd(L[i],R[i+1]))
print(max(M))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
List = [int(i) for i in input().split()]

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=math.gcd(L[i-1],List[i])
    R[-i]=math.gcd(R[-i+1],List[-i])
for i in range(N):
    M.append(math.gcd(L[i],R[i+1]))
print(max(M))
Problem p03071 (python)

Fixed submission:
a,b = map(int,input().split())
ans = 0
for i in range(2):
    if a>b:
        ans+=a
        a-=1
    elif a<=b:
        ans+= b
        b-=1
print(ans)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <cmath>

using namespace std;

int main(){
 int a,b;
 cin >> a >> b;
 cout << max(a,b)+max(a,b)-1 << endl;

  
}
Problem p03085 (python)

Fixed submission:
Str = input()
if Str == 'A':
    print('T')
elif Str =='T':
    print('A')
elif Str =='C':
    print('G')
else:
    print('C')

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

Fixed submission:
import sys
N,M = map(int,input().split())
List =[]
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    List.append([tmp_a,tmp_b])
List.sort()
sum_a,sum_b = 0,0
for i in range(N):
    if M-sum_b > List[i][1]:
        sum_a += List[i][0]*List[i][1]
        sum_b += List[i][1]
    else:
        sum_a += List[i][0]*(M-sum_b)
        sum_b += M-sum_b
        print(sum_a)
        sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
A = []
B = []
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    A.append(tmp_a)
    B.append(tmp_b)
sum_A,sum_B = 0,0
for i in range(N):
    if (M-sum_B) >= B[A.index(min(A))]:
        sum_A += min(A)*B[A.index(min(A))]
        sum_B += B[A.index(min(A))]
        A.pop(A.index(min(A)))
        B.pop(A.index(min(A)))
    else:
        sum_A += min(A)*(M-sum_B)
        print(sum_A)
        sys.exit()
Problem p03106 (python)

Fixed submission:
import math
A,B,K = map(int,input().split())
ans = []
if A>B:
    Max = A
else:
    Max = B
for i in range(1,Max+1):
    if (A%i==0) & (B%i==0):
        ans.append(i)
print(ans[len(ans)-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K = map(int,input().split())
ans = []
if A>B:
    Max = A
else:
    Max = B
for i in range(1,Max):
    if (A%i==0) & (B%i==0):
        ans.append(i)
print(ans[len(ans)-K])
Problem p03110 (python)

Fixed submission:
N = int(input())
otoshidama = []
otoshidama_sum = 0
for i in range(N):
    otoshidama.append(input().split())
for i in range(N):
    otoshidama[i][0] = float(otoshidama[i][0])
    if otoshidama[i][1] == 'BTC':
        otoshidama[i][0] = otoshidama[i][0]*380000
    otoshidama_sum += otoshidama[i][0]
print(otoshidama_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
otoshidama = []
otoshidama_sum = 0
for i in range(N):
    otoshidama.append(input().split())
for i in range(N):
    otoshidama[i][0] = int(otoshidama[i][0])
    if otoshidama[i][1] == 'BTC':
        otoshidama[i][0] = otoshidama[i][0]*380000
    otoshidama_sum += otoshidama[i][0]
print(otoshidama_sum)
Problem p03239 (python)

Fixed submission:
import sys
N,T =map(int,input().split())
c=[]
t=[]
t_count=0
for i in range(N):
    c_n,t_n=map(int,input().split())
    if t_n>T:
        t_count+=1
    if t_n<=T:
        c.append(c_n)
        t.append(t_n)
        #if i>len(t):
            #break
        
    

if t_count==N:
    print("TLE")
    sys.exit()

print(min(c))

Buggy submission (verdict: Runtime Error):
import sys
N,T =map(int,input().split())
c=[]
t=[]
t_count=0
for i in range(N):
    c_n,t_n=map(int,input().split())
    if t_n<=T:
        c.append(c_n)
        t.append(t_n)
        if i>len(t):
            break
        if t[i]>=T:
            t_count += 1
    

if t_count==N:
    print("TLE")
    sys.exit()

print(min(c))