Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
n, y = 100, 0
while n < x:
    n = n % 1.01
    y = y + 1
print(y)

Fixed submission:
x = int(input())
deposit, year = 100, 0
while deposit < x:
    deposit = deposit * 101 // 100
    year += 1
print(year)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
n, y = 100, 0
while n < x:
    n = n % 1.01
    y = y + 1
print(n)
print(y)

Fixed submission:
x = int(input())
deposit, year = 100, 0
while deposit < x:
    deposit = deposit * 101 // 100
    year += 1
print(year)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd,numbers)

n =int(input())
c=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            c+=gcd(i,j,k)
print(c)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd,numbers)

n =int(input())
c=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            c+=gcd(i,j,k)
print(c)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split()))
# 偶数 ＋　奇数
print(n * (n - 1) // 2 + m * (m - 1) // 2  )

Fixed submission:
n, m = list(map(int, input().split()))
# 偶数 ＋　奇数
print(n * (n - 1) // 2 + m * (m - 1) // 2  )
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
S1 = S[0:(N-1)//2]
S2 = S[(N+3)//2-1:N+1]
print("Yes"  S1 == S1[::-1] and S2 == S2[::-1] else "No")

Fixed submission:
s = input()
if s[len(s) // 2 + 1:] == s[:len(s) // 2]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = input()
if s == 'AAA' and S == 'BBB':
    print('No')
else:
    print('Yes')

Fixed submission:
s = input()
if s == 'AAA'or s == 'BBB':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
from sympy import isprime
n = int(input())
if isprime(n) == True:
    print(n)
else:
    print(sympy.nextprime(n))

Fixed submission:
x = int(input())
while True:
    for i in range(2,x):
        if x%i == 0:
            break
    else:
        print(x)
        break
    x+= 1

Buggy python submission (verdict: Runtime Error):
x = int(input())
while True:
    for i in range(2,x):
        if x%i == 0
        break
    else:
        print(x)
        break
    x+=1

Fixed submission:
x = int(input())
while True:
    for i in range(2,x):
        if x%i == 0:
            break
    else:
        print(x)
        break
    x+= 1
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(len([i for i in range(4) if h[i]>=k]))

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(len([i for i in h if i>=k]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = input()
print(*np.argsort(list(map(int,input().split())))+1)

Fixed submission:
import numpy as np
n = input()
print(*np.argsort(list(map(int,input().split())))+1)
Buggy python submission (verdict: Runtime Error):
s = input()
weather = ['Sunny','Cludy','Rainy']
print(weather[(weather.index(s) + 1) % 3])

Fixed submission:
s = input()
weather = ['Sunny','Cloudy','Rainy']
print(weather[(weather.index(s) + 1) % 3])
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k-q]*n)
for i in range(q):
    a[int(input())-1]+=1
for i in a:
    if a[i]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k]*n)
a-=q
for i in range(q):
    a[int(input())-1]+=1
for i in range(n):
    if a[i]>0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k]*n)
for i in range(q):
    a-=1
    a[int(input())-1]+=1
for i in range(n):
    if a[i]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k]*n)
a-=q
for i in range(q):
    a[int(input())-1]+=1
for i in range(n):
    if a[i]>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
count=0
for x,y in combinations(X,2):
    r = np.sqrt(abs(x[0]-y[0])**2 + abs(x[1]-y[1])**2)
    if r.is_integer() == True:
        count += 1
print(count)

Fixed submission:
import numpy as np
from itertools import combinations
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
count=0
for x,y in combinations(X,2):
    r = np.sqrt(sum(abs(np.array(x)-np.array(y))**2))
    if r.is_integer() == True:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
if w/x > h/y:
    print(x*h/1, '1')
elif w/x == h/y:
    print(x*h/1, '0')
else:
    print(h*y/1, '1')

Fixed submission:
w, h, x, y = map(int, input().split())
if w==2*x and h ==2*y:
    print(w*h/2, 1)
else:
    print(w*h/2, 0)
Buggy python submission (verdict: Runtime Error):
s = input()
a = 1<= int(s[:2]) <=12
b = 1<= int(s[2:]) <=12
if a and b:
    print("AMBIGUOUS")
elif a:
    print('MMYY')
elif b:
    print('YYMM')
else:
    print('NA')

Fixed submission:
s = input()
a = 1<= int(s[:2]) <=12
b = 1<= int(s[2:]) <=12
if a and b:
    print("AMBIGUOUS")
elif a:
    print('MMYY')
elif b:
    print('YYMM')
else:
    print('NA')
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
x = []
for i in range(1,a):
    if a%i == 0 and b%i == 0:
        x.append(i)
print(x[-k])

Fixed submission:
a,b,k = map(int,input().split())
x = []
for i in range(1,a+1):
    if a%i == 0 and b%i == 0:
        x.append(i)
print(x[-k])
Buggy python submission (verdict: Runtime Error):
import statistics
n = int(input())
a = list(map(int,input().split()))
s = statistics.mean(a)
print(s)
c = float("inf")
d = i
for i in range(n):
    if c!= min(abs(s-a[i]),c):
        c = s-a[i]
        d = i
print(d)

Fixed submission:
import statistics
n = int(input())
a = list(map(int,input().split()))
s = statistics.mean(a)
c = float("inf")
for i in range(n):
    if c!=min(abs(s-a[i]),c):
        c = abs(s-a[i])
        d = i
print(d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if len(n)==2:
    print(n)
else:
    print(n[::-1])

Fixed submission:
n = input()
if len(n)==2:
    print(n)
else:
    print(n[::-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
if len(n)==2:
    print(n)
else:
    print(n[::-1])

Fixed submission:
n = input()
if len(n)==2:
    print(n)
else:
    print(n[::-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
w = [input() for i in range(n)]
if n == len(set(w)) and w[i-1][-1] == w[i][0] for i in range(1,n):
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
w = [input() for i in range(n)]
x = False
if n == len(set(w)):
    if all([w[i-1][-1] == w[i][0] for i in range(1,n)]):
        x = True
print('Yes' if x else 'No')
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
print((n[0]-1)*(n[1]-1))

Fixed submission:
a, b = map(int, input().split())
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n%7 == 0:
    if n%4==0:
        print('Yes')
        break
    else:
        print('No')
else:
    print('No')

Fixed submission:
n = int(input())
x = 100//7+2
for i in range(x):
    for j in range(x):
        if 4*i+7*j == n:
            print("Yes")
            break
    else:
        continue
    break
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().split()))
print(ma(s) - min(s))

Fixed submission:
input()
s = sorted(map(int, input().split()))
print(s[len(s) - 1] - s[0])
Buggy python submission (verdict: Runtime Error):
n = list(input())
s = sum([int(n[i]) for i in range(len(n))])
if n%s==0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
a = list(str(n))
s = sum([int(a[i]) for i in range(len(a))])
if n%s==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
print((-1)**k*(a-b))

Fixed submission:
a,b,c,k=map(int,input().split())
print((-1)**k*(a-b))

Buggy python submission (verdict: Runtime Error):
print((-1)**k*(a-b))

Fixed submission:
a,b,c,k=map(int,input().split())
print((-1)**k*(a-b))
Buggy python submission (verdict: Runtime Error):
x = int(input())
for i in range(x+1):
    for n in range(2,x+1):
        if i**n <= x:
            count = i**2
print(count)

Fixed submission:
x = int(input())
count = 1
for i in range(1,x+1):
    for n in range(2,10):
        if i**n <= x:
            count = max(i**n,count)
print(count)
Buggy python submission (verdict: Runtime Error):
d= a*x+b*y
e= 2*c*x+b*max(0,y-x) #yが多い
f= 2*c*y+a*max(0,x-y) #xが多い
print(min(d,e,f))

Fixed submission:
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
    print(a*x+b*y)
else:
    print(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)))
Buggy python submission (verdict: Runtime Error):
a, b, c, c = [int(input()) for i in range(4)]
print(min(a,b) + min(c,d))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b) + min(c,d))
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = sorted(map(int,input().split()))
x.reverse()
a = 0
b = 0
for i in range(n):
    if i%2==0:
        a+=x[i]
    else:
        b+=x[i]
print(a-b)

Fixed submission:
n = int(input())
x = set(input().split())
if len(x)==3:
    print('Three')
else:
    print('Four')

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = sorted(map(int,input().split()))
x.reverse()
a = 0
b = 0
for i in range(n):
    if i%2==0:
        a+=x[i]
    else:
        b+=x[i]
print(a-b)

Fixed submission:
n = int(input())
x = set(input().split())
if len(x)==3:
    print('Three')
else:
    print('Four')

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(reversed(sorted(map(int,input().split()))))
a = 0
b = 0
for i in range(n):
    if i%2==0:
        a+=x[i]
    else:
        b+=x[i]
print(a-b)

Fixed submission:
n = int(input())
x = set(input().split())
if len(x)==3:
    print('Three')
else:
    print('Four')
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i != a:
        if int(s[i])>=10:
            print("No")
            break
            
    else:
        if s[i] !='-':
            print('No')
            break
else:
    print('Yes')

Fixed submission:
a,b = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i == a:
        if s[i] !='-':
            print('No')
            break
    else:
        if s[i]=='-':
            print("No")
            break
            
        else:
            if int(s[i])<0 or 9<int(s[i]):
                print("No")
                break
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = 2
b = 1
for i in range(n-1):
    c=b+a
    a,b=b,c
print(c)

Fixed submission:
n = int(input())
a = 2
b = 1
for i in range(n-1):
    c=b+a
    a,b=b,c
if n == 0:
    print(a)
elif n == 1:
    print(b)
else:
    print(c)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if abs(x - a) > abs(x - b):
    print('B')
else:
    print('A')

Fixed submission:
x,a,b = map(int, input().split())
if abs(x - a) > abs(x - b):
    print('B')
else:
    print('A')

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if abs(x - a) > abs(x - b):
    print('B')
else:
    print('A')

Fixed submission:
x,a,b = map(int, input().split())
if abs(x - a) > abs(x - b):
    print('B')
else:
    print('A')
Buggy python submission (verdict: Runtime Error):
s = sorted(set(input()))
for i in range(26):
    if s[i] != chr(97+i):
        print(chr(97+i))
        break
else:
    print('None')

Fixed submission:
s = sorted(set(input()))
a = len(set(s))
s.append(0)
for i in range(26):
    if s[i] != chr(97+i):
        print(chr(97+i))
        break
else:
    print('None')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a%3 = 0 or b%3 == 0 or (a+b)%3 == 0:
    print('Possible')
else:
    print('Impossible')

Fixed submission:
a, b = map(int, input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
    print('Possible')
else:
    print('Impossible')
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
x =[0]*n
for i in range(m):
    a,b = map(int,input().split())
    x[a-1]+=1
    x[b-1]+=1
for i in range(n):
    print(x[i]

Fixed submission:
n,m = map(int,input().split())
x =[0]*n
for i in range(m):
    a,b = map(int,input().split())
    x[a-1]+=1
    x[b-1]+=1
for i in range(n):
    print(x[i])

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
x =[0]*n
for i in range(m):
    a,b = map(int,input().split())
    x[a-1]+=1
    x[b-1]+=1
for i in range(n):
    print(x[i]

Fixed submission:
n,m = map(int,input().split())
x =[0]*n
for i in range(m):
    a,b = map(int,input().split())
    x[a-1]+=1
    x[b-1]+=1
for i in range(n):
    print(x[i])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b==c and a%2==0:
    print(-1)
d=0
else:
    while a%2==0 and b%2==0 and c%2==0:
        a,b,c=(b+c),(a+c),(a+b)
        d+=1
print(d)

Fixed submission:
a,b,c=map(int,input().split())
d=0
if a==b==c and a%2==0:
    print(-1)
else:
    while a%2==0 and b%2==0 and c%2==0:
        a,b,c=(b+c)//2,(a+c)//2,(a+b)//2
        d+=1
    print(d)
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i]+b[i])
if f:
    x.pop()
print("".join(x))

Fixed submission:
a = list(input())
b = list(input())
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i])
    x.append(b[i])
if f:
    x.pop()
print("".join(x))

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i]+b[i])
if f:
    x.pop()
print("".join(x))

Fixed submission:
a = list(input())
b = list(input())
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i])
    x.append(b[i])
if f:
    x.pop()
print("".join(x))

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i]+b[i])
if f:
    x.pop()
print("".join(x))

Fixed submission:
a = list(input())
b = list(input())
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i])
    x.append(b[i])
if f:
    x.pop()
print("".join(x))
Buggy python submission (verdict: Runtime Error):
IN = iter(Input.split('\n')).__next__
def input():
    return IN()


h,w = map(int,input().split())
for i in range(h):
    x = input()
    print(x)
    print(x)

Fixed submission:
h,w = map(int,input().split())
for i in range(h):
    x = input()
    print(x)
    print(x)
Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(a):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d.y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Fixed submission:
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d,y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d.y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Fixed submission:
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d,y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d.y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Fixed submission:
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d,y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d.y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))

Fixed submission:
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        b = max(b,x)
    elif a == 2:
        c = min(c,x)
    elif a == 3:
        d = max(d,y)
    else:
        e = min(e,y)
print(max(c-b,0)*max(e-d,0))
Buggy python submission (verdict: Runtime Error):
n,x,y=map(int,input().split())
s= input()
c=0
d=x+y
f= False
for i in range(n):
    if s[i]=="A":
        if c<d:
            f=True
    elif s[i]=="B":
        if c<d and c<=b:
            f=True
    if f:
        print("YES")
            c+=1
    else:
        print("NO")
    f=False

Fixed submission:
n,x,y=map(int,input().split())
s= input()
c=0
d=x+y
e = 0
f= False
for i in range(n):
    if s[i]=="a":
        if c<d:
            f=True
    elif s[i]=="b":
        if c<d and e<y:
            f=True
            e+=1
    if f:
        print("Yes")
        c+=1
    else:
        print("No")
    f=False
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
c= (b-a+1)*(a+b)//2
if c>0:
    print("Positive")
elif c=0:
    print("Zero")
else:
    print("Negative")

Fixed submission:
a,b = map(int,input().split())
if a*b<=0:
    print("Zero")
elif b<0 and(b-a)%2==0:
    print("Negative")
else:
    print("Positive")
Buggy python submission (verdict: Time Limit Exceeded):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def all_group_size(self):
        return [len(self.members(r)) for r in self.roots()]
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
n,m = map(int,input().split())
tree = UnionFind(n)
for _ in range(m):
    i,j = map(int, input().split())
    tree.union(i-1,j-1)

print(max(tree.all_group_size()))

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def all_group_size(self):
        return [len(self.members(r)) for r in self.roots()]
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
n,m = map(int,input().split())
tree = UnionFind(n)
ans = 1
for _ in range(m):
    i,j = map(int, input().split())
    tree.union(i-1,j-1)
    ans = max(ans,tree.size(i-1))
print(ans)