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

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
  if A[i] not in dict1.keys():
    dict1[A[i]] = 0
  else:
    dict1[A[i]] += 1
value1 = []
for value in dict1.values():
  value1.append(value)
value2 = sorted(value1, reverse = True)
if len(value2) != 1:
  if value2[0] - value2[1] >= sum(value2[1:]):
    print(N - (value2[0] * 2))
  else:
    if(sum(value2[0:]) % 2 == 0):
      print(len(value2))
    else:
      print(len(value2) - 1)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
  if A[i] not in dict1.keys():
    dict1[A[i]] = 0
  else:
    dict1[A[i]] += 1
value1 = []
for value in dict1.values():
  value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
  print(N - (value2[0] * 2))
else:
  if(sum(value2[0:]) % 2 == 0):
    print(len(value2))
  else:
    if len(value2) != 1:
      print(len(value2) - 1)
    else:
      print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
  if A[i] not in dict1.keys():
    dict1[A[i]] = 0
  else:
    dict1[A[i]] += 1
value1 = []
for value in dict1.values():
  value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
  print(N - (value2[0] * 2))
else:
  if(sum(value2[0:]) % 2 == 0):
    print(len(value2))
  else:
    if len(value2) != 0:
      print(len(value2) - 1)
    else:
      print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
  if A[i] not in dict1.keys():
    dict1[A[i]] = 0
  else:
    dict1[A[i]] += 1
value1 = []
for value in dict1.values():
  value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
  print(N - (value2[0] * 2))
else:
  if(sum(value2[0:]) % 2 == 0):
    print(len(value2))
  else:
    print(len(value2) - 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
  if A[i] not in dict1.keys():
    dict1[A[i]] = 0
  else:
    dict1[A[i]] += 1
value1 = []
for value in dict1.values():
  value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
  print(N - (value2[0] * 2))
else:
  if(sum(value2[0:]) % 2 == 0):
    print(len(value2))
  else:
    print(len(value2 - 1))
Problem p02910 (python)

Fixed submission:
S = list(input())
flag = True
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == 'L':
            flag = False
    else:
        if S[i] == 'R':
            flag = False

if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = list(input())
flag = True
for i in range(0, int(len(S) / 2 + 1), 2):
    if S[i] == 'L':
        flag = False
    if S[i + 1] == 'R':
        flag = False

if flag:
    print('Yes')
else:
    print('No')
Problem p02909 (python)

Fixed submission:
# coding=utf-8

if __name__ == "__main__":
    S = input()

    if S == "Sunny":
        print("Cloudy")
    elif S == "Cloudy":
        print("Rainy")
    else:
        print("Sunny")

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

if __name__ == "__main__:
    S = input()

    if S == "Sunny":
        print("Cloudy")
    elif S == "Cloudy":
        print("rainy")
    else:
        print("Sunny")
Problem p03262 (python)

Fixed submission:
# coding=utf-8


def solve_gcd_from_list(number_list):
    if len(number_list) == 1:
        return number_list[0]

    if len(number_list) == 2:
        return solve_gcd(number_list[0], number_list[1])
    mid = len(number_list) // 2
    return solve_gcd(solve_gcd_from_list(number_list[:mid]), solve_gcd_from_list(number_list[mid:]))


def solve_gcd(number1, number2):
    if number1 == number2:
        return number1

    if number1 < number2:
        number1, number2 = number2, number1

    if number1 % number2 == 0:
        return number2

    return solve_gcd(number2, number1 % number2)


if __name__ == '__main__':
    N, X = map(int, input().split())
    cities = list(map(int, input().split()))

    cities.append(X)
    cities.sort()

    distance_list = []

    for i in range(N):
        distance_list.append(cities[i+1]-cities[i])

    if len(distance_list) == 1:
        D = distance_list[0]
    else:
        D = solve_gcd_from_list(distance_list)
    print(D)

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


def solve_gcd_from_list(number_list):
    if len(number_list) == 2:
        return solve_gcd(number_list[0], number_list[1])
    follow = solve_gcd(number_list[-2], number_list[-1])
    number_list2 = [follow]
    number_list2.extend(number_list[:-2])
    return solve_gcd_from_list(number_list2)


def solve_gcd(number1, number2):
    if number1 == number2:
        return number1

    if number1 < number2:
        number1, number2 = number2, number1

    if number1 % number2 == 0:
        return number2

    return solve_gcd(number2, number1 % number2)


if __name__ == '__main__':
    N, X = map(int, input().split())
    cities = list(map(int, input().split()))

    cities.append(X)
    cities.sort()

    distance_list = []

    for i in range(N):
        distance_list.append(cities[i+1]-cities[i])

    if len(distance_list) == 1:
        D = distance_list[0]
    else:
        D = solve_gcd_from_list(distance_list)
    print(D)
Problem p03309 (python)

Fixed submission:
# coding=utf-8

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    A_modify = [A[j] - j - 1 for j in range(N)]
    A_modify.sort()

    mid1 = A_modify[N//2]
    A_modify1 = [abs(elm - mid1) for elm in A_modify]
    print(sum(A_modify1))

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

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    A_modify = [A[j] - j - 1 for j in range(N)]
    A_modify.sort()

    if N % 2 == 0:
        mid1 = A_modify[N//2]
        mid2 = A_modify[mid1-1]
        A_modify1 = [abs(elm - mid1) for elm in A_modify]
        A_modify2 = [abs(elm - mid2) for elm in A_modify]
        print(min(sum(A_modify1), sum(A_modify2)))
    else:
        mid = N//2
        b = A_modify[mid]
        A_modify = [abs(elm - b) for elm in A_modify]
        print(sum(A_modify))
Problem p03697 (python)

Fixed submission:
def print_add():
	A, B = [int(i) for i in input().split()]

	if A+B > 9:
		print('error')
		return 
	print(A+B)
	return
	
print_add()

Buggy submission (verdict: Runtime Error):
def print_max():
	N = int(input())
	S = [int(input()) for i in range(N)]
	
	if sum(S)%10 != 0:
		print(sum(S))
		return
	S.sort()
	S_n = S[:]
	for i in range(len(S)):
		S_n.pop(i)
		if sum(S_n)%10 != 0:
			print(sum(S_n))
			return
		S_n = S[:]
	print(0)
	return
	
print_max()

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

if A+B > 9:
	print('error')
	return
print(A+B)

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

if A+B > 9:
	print('error')
	return
print(A+B)
Problem p02922 (python)

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

ans = 0
x = 1
while x < B:
  x = A * ans - ans + 1
  ans += 1
ans = ans-1
if ans < 0:
  ans = 0
print(ans)

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


gap = B - A


if gap == 1:
  print(1)
elif gap > 1:
  print(int(mathy.ceil(B / A)))
else:
  print(0)
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())
#s = [1 if i=='R' else 0 for i in S]

ans = [a+b,a-b,a*b]





print(str(max(ans)))

Buggy submission (verdict: Runtime Error):

a,b = list(map(input().split()))
#s = [1 if i=='R' else 0 for i in S]

ans = [a+b,a-b,a*b]





print(max(ans))
Problem p02982 (python)

Fixed submission:
import math

n,d = map(int,input().split())

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

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        nor = math.sqrt(sum([(x[i][k]-x[j][k])**2 for k in range(d)]))
        
        if nor.is_integer():
#            print(nor)
            ans+=1

print(ans)

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

n,d = map(int,input().split())

x=[]
for i in range(n):
    x.append(np.array(list(map(int,input().split()))))

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        if np.linalg.norm(x[i]-x[j]).is_integer():
#            print(np.linalg.norm(x[i]-x[j]))
            ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):

import numpy as np

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

x=[]
for i in range(n):
    x.append(np.array(list(map(int,input().split()))))

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        if np.linalg.norm(x[i]-x[j]) % 1 == 0:
#            print(np.linalg.norm(x[i]-x[j]))
            ans+=1

print(ans)

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

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

x=[]
for i in range(n):
    x.append(np.array(list(map(int,input().split()))))

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        if np.linalg.norm(x[i]-x[j]) % 1 == 0.0:
#            print(np.linalg.norm(x[i]-x[j]))
            ans+=1





print(ans)
Problem p02983 (python)

Fixed submission:
l,r = map(int,input().split())

if (l==2019)or(r==2019)or(r-l>=2019):
    ans=0
    
elif r-l==1:
    ans = (r*l)%2019
else:
    ans=2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            if (i*j)%2019 < ans:
                ans = (i*j)%2019
            if ans == 1:
                break
print(str(ans))

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())

if (l==2019)or(r==2019)or(r-l>=2019):
    print('0')
    
elif r-l==1:
    ans = (r*l)%2019
else:
    ans=2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            if (i*j)%2019 < ans:
                ans = (i*j)%2019
            if ans == 1:
                break
            
print(str(ans))

Buggy submission (verdict: Runtime Error):

l,r = map(int,input().split())

if (l==2019)or(r==2019)or(r-l>=2019):
    print('0')
    
elif r-l==1:
    ans = (r*l)%2019
else:
    ans=2019
    for i in range(l,r-1):
        for j in range(i+1,r):
            if (i*j)%2019 < ans:
                ans = (i*j)%2019
            if ans == 1:
                break
            
print(str(ans))
Problem p02995 (python)

Fixed submission:
def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x, y = y, x % y
    return y
        
def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())
#A = list(map(int,input().split()))

c_b  = B//C
d_b  = B//D
cd_b = B//lcm(C,D)

c_a  = (A-1)//C
d_a  = (A-1)//D
cd_a = (A-1)//lcm(C,D)

ans = (B - c_b - d_b + cd_b) - (A - 1 - c_a - d_a + cd_a)



print(str(ans))

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())
#A = list(map(int,input().split()))

c_b  = B//C
d_b  = B//D
cd_b = B//lcm(C,D)

c_a  = (A-1)//C
d_a  = (A-1)//D
cd_a = (A-1)//lcm(C,D)

ans = (B - c_b - d_b + cd_b) - (A - 1 - c_a - d_a + cd_a)



print(str(ans))
Problem p03030 (python)

Fixed submission:
N = int(input())

data=[]
for i in range(N):
    S,P = input().split()
    li = [i+1,S,int(P)]
    data.append(li)
    
data.sort(reverse=True, key=lambda x: x[2])
data.sort(key=lambda x: x[1])
for i in range(N):
    print(str(data[i][0]))

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

data=[]
for i in range(N):
    S,P = input().split()
    li = [i,S,int(P)]
    data.append(li)
    
data.sort(key=lambda x: x[1])
data.sort(reverse=True, key=lambda x: x[2])
for i in range(N):
    data[i] = data[i]+[i]

data.sort(key=lambda x: x[0])
for i in range(N):
    print(str(data[i][3]))
Problem p03478 (python)

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

ans=0

for i in range(N):
    tmp=0
    number=str(i+1)
    for j in range(len(number)):
        tmp+=int(number[j])
    if A<=tmp<=B:
        ans+=(i+1)

print(str(ans))

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

ans=0

for i in range(N):
    tmp=0
    number=str(i+1)
    for j in range(len(number)):
        tmp+=number[j]
    if A<=tmp<=B:
        ans+=(i+1)

print(str(ans))
Problem p02953 (python)

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

a = "Yes"
m = 0

for i in range(n):
	if m - h[i] > 1:
		a ="No"
		break
	else:
		m = max(m,h[i])
print(a)

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

ans = "Yes"
for i in range(1,n):
	if lis[i] - lis[i-1] <= 1:
		pass
	else:
		ans = "No"
		break

print(ans)
Problem p02981 (python)

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

if n*a<b:
      print(n*a)
else:
      print(b)

Buggy submission (verdict: Runtime Error):
import sys
L, R = map(int,input().split())
a=[]

for i in range(L, R):
	for j in range(i+1,R+1):
		a.append((i*j)%2019)
		if 0 in a:
			print(0)
			sys.exit()
print(min(a))
Problem p02983 (python)

Fixed submission:
import sys
l,r = map(int,input().split())
a=[]

for i in range(l,r):
	for j in range(i+1,r+1):
		a.append((i*j)%2019)

		if (i*j)%2019 == 0:
			print(0)
			sys.exit()
print(min(a))

Buggy submission (verdict: Runtime Error):
import sys
L, R = map(int,input().split())
a=[]

for i in range(L, R):
	for j in range(i+1,R+1):
		x = (i*j)%2019
		if x == 0:
			print(0)
			sys.exit()
		else:
			a.append()

print(min(a))

Buggy submission (verdict: Runtime Error):
import sys
L, R = map(int,input().split())
a=[]

for i in range(L, R):
	for j in range(i+1,R-1):
		a.append((i*j)%2019)
		if 0 in a:
			print(0)
			sys.exit()
print(min(a))

Buggy submission (verdict: Runtime Error):
import itertools

l,r=map(int, input().split())
lis1 = list(range(l,r+1))
lis2=[]

for v in itertools.combinations(lis1, 2):
      lis2.append(v[0]*v[1]%2019)
    
print(min(lis2))

Buggy submission (verdict: Runtime Error):
import itertools

l,r=map(int, input().split())
lis1 = list(range(l,r+1))

lis2=[]

for v in itertools.combinations(lis1, 2):
      lis2.append(v[0]*v[1]%2019)
    
print(min(lis2))
Problem p02995 (python)

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

def diff(i, j, k):
	return i - (i//j) - (i//k) + (i//lcm(j,k))

a,b,c,d = map(int, input().split())

print( diff(b, c, d) - diff(a-1, c, d) )

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

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

def slove(x, y, z):
	return ans = (x//y) + (x//z) - (x//lcm(y,z))
print(slove(b,c,d) - slove(a-1,c,d))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def diff(i, j, k):
	return (j // k) - ( i // k)

a,b,c,d = map(int, input().split())

zedd = diff(a, b+1, c) + diff(a, b+1, d) - diff(a, b+1, lcm(c,d))
ans = (b-a+1) -zedd

print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
lis = list(range(a,b+1))
ans = 0

for i in lis:
	if i % c == 0:
		ans += 1
	elif i % d == 0:
		ans += 1
	else:
		pass
print(len(lis) - ans)
Problem p03035 (python)

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

if a>=13:
    print(b)
elif 6<=a<=12:
    print(b//2)
elif a<=5:
    print("0")

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

p=[]
q=[]

for i in range(m):
    l,r=map(int,input().split())
    p.append(l)
    q.append(r)

p1=max(p)
q1=min(q)

if p1>=q1:
    print(q1-p1+1)
else:
    print(0)
Problem p03037 (python)

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

p=[]
q=[]

for i in range(m):
    l,r=map(int,input().split())
    p.append(l)
    q.append(r)

p1=max(p)
q1=min(q)

if q1>=p1:
    print(q1-p1+1)
else:
    print(0)

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

ans = "Yes"
m = 0
for i in range(n):
	if m - lis[i] > 1:
		ans = "No"
		break
	else:
		m = max(m,lis[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,(input().spit()))
L = []
R = []

for i in range(m):
	l,r = map(int(input().spit()))
	L.append(l)
	R.append(r)

ans = min(R) - max(L) + 1

if ans >0:
	print(ans)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
n,m = map(int(input().spit()))
L = []
R = []

for i in range(m):
	l,r = map(int(input().spit()))
	L.append(l)
	R.append(r)

ans = min(R) - max(L) + 1

if ans >0:
	print(ans)
else:
	print(0)
Problem p03061 (python)

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

from fractions import gcd
L = [0]*(N+1)
R = [0]*(N+1)
ans = 0
for i in range(N):
    L[i] = gcd(L[i-1],A[i])
for i in reversed(range(N)):
    R[i] = gcd(R[i+1],A[i])
for i in range(N):
    if gcd(L[i-1],R[i+1]) > ans:
        ans = gcd(L[i-1],R[i+1])
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
import math
n=int(input())
a=[int(i) for i in input().split()]

L=[0]*(n+1)
R=[0]*(n+1)
ans=0
for i in range(n):
    L[i]=math.gcd(L[i-1],a[i])
for i in reversed(range(n)):
    R[i]=math.gcd(R[i-1],a[i])
for i in range(n):
    if math.gcd(L[i-1],R[i+1]) > ans:
        ans=math.gcd(L[i-1],R[i-1])

print(ans)
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Buggy submission (verdict: Runtime Error):
n,q =map(int,input().split())
s = input()
resu = [0]
ans = 0
for i in range(n):
	if s[i] == "A" and s[i+1] == "C":
		ans +=1
		resu.append(ans)
	else:
		resu.append(ans)
for i in range(q):
	l,r = map(int,input().split())
	print(resu[r-1]-resu[l-1])

Buggy submission (verdict: Runtime Error):
n,q =map(int,input().split())
s = input()
resu = [0]
ans = 0
for i in range(n):
	if s[i] == "A" and s[i+1] == "C":
		ans +=1
		resu.append(ans)
	else:
		resu.append(ans)
for i in range(q):
	l,r = map(int,input().split())
	print(resu[r-1],resu[l-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
x = []
ans = 0
for i in range(n-1):
	if s[i] == "A" and s[i+1] == "C":
		ans += 1
		x.append(ans)
	else:
		x.append(ans)

for j in range(q):
	l, r = map(int,input().split())
	print(x[r-1]-x[l-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
x = []

ans = 0
for i in range(n):
	if s[i] == "A" and s[i+1] == "C":
		ans += 1
		x.append(ans)
	else:
		x.append(ans)

for j in range(q):
	l, r = map(int,input().split())
	print(x[r-1]-x[l-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
x = []

ans = 0
for i in range(n):
	if s[i] == "A" and s[i+1] == "C":
		ans += 1
		x.append(ans)
	else:
		x.append(ans)
x.append(ans)

for j in range(q):
	l, r = map(int,input().split())
	print(x[r-1]-x[l-1])

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

L=[0]*(n+1)
R=[0]*(n+1)
ans=0
for i in range(n):
    L[i]=math.gcd(L[i-1],a[i])
for i in reversed(range(n)):
    R[i]=math.gcd(R[i-1],a[i])
for i in range(n):
    if math.gcd(L[i-1],R[i+1]) > ans:
        ans=math.gcd(L[i-1],R[i-1])

print(ans)
Problem p03262 (python)

Fixed submission:
from fractions import gcd

n, x = map(int, input().split())
x_lis = [abs(int(i)-x) for i in input().split()]

ans = x_lis[0]
for i in range(n):
	ans = gcd(ans, x_lis[i])
	if ans == 1:
		break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
import sys

N, X = map(int,input().split())
lis = list(map(int,input().split()))
diff = []

if N==1:
	print(lis[0]-X)
	sys.exit
for i in range(N):
	diff.append(abs(X-lis[i]))

for j in range(N-1):
	x = gcd(diff[i],diff[i+1])
print(x)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n, x = map(int, input().split())
x_lis = [abs(int(i)-x) for i in input().split()]

ans = x_lis[0]
for i in range(n):
	ans = gcd(ans, x[i])
	if ans == 1:
		break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n, x = map(int, input().split())
x_lis = [abs(int(i)-x) for i in input().split()]

ans = x[0]
for i in range(n):
	ans = gcd(ans, x[i])
	if ans == 1:
		break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

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

ans = x[0]
for i in range(n):
	ans = gcd(ans, x[i])
	if ans == 1:
		break
print(ans)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
a=1
for i in range(min(len(s),k)):
	if s[i] == '1':
		pass
	else:
		a = s[i]
		break
print(a)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
a=1
for i in range(min(len(s),k)):
	if s[i] == '1':
		pass
	else:
		a = a[i]
		break
print(a)
Problem p03556 (python)

Fixed submission:
# -*- coding utf-8 -*-
n=int(input())
x=1

while (x+1)**2<=n:
    x+=1
print(x**2)

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=1

for i in range(n):
    x=min(x*2,x+k)

print(x)
Problem p03565 (python)

Fixed submission:
s=input()
t=input()

if len(s) < len(t):
  print("UNRESTORABLE")
  exit()

c=len(s)-len(t)

flg=False
while True:
  if c<0:
    break
  
  flg2=True
  for i in range(len(t)):
    if s[c+i]!=t[i] and s[c+i]!="?":
      flg2=False
  if flg2:
    flg=True
    break
  c-=1
#print(c)



if flg:
  print((s[:c]+t+s[c+len(t):]).replace("?","a"))
else:
  print("UNRESTORABLE")

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

if len(s) < len(t):
  print("UNRESTORABLE")
  exit()

c=len(s)-len(t)

flg=False
while True:
  if c<0:
    break
  
  flg2=True
  for i in range(len(t)):
    if s[c+i]!=t[i] and s[c+i]!="?":
      flg2=False
  if flg2:
    flg=True
    break
 c-=1
#print(c)



if flg:
  print((s[:c]+t+s[c+len(t):]).replace("?","a"))
else:
  print("UNRESTORABLE")
Problem p03575 (python)

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

x=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    if b not in x[a-1]:
        x[a-1].append(b)
        if a not in x[b-1]:
            x[b-1].append(a)

ans=0

while True:
    idx,flg=0,0
    for i in x:
        if len(i)==1:
            flg=1
            x[i[0]-1].remove(idx+1)
            x[idx]=[]
            ans+=1
        idx+=1
    if flg==0:
        break
print(ans)

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

x=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    if b not in x[a-i]:
        x[a-1].append(b)
        if a not in x[b-i]:
            x[b-1].append(a)

ans=0

while True:
    idx,flg=0,0
    for i in x:
        if len(i)==1:
            flg=1
            x[i[0]-1].remove(idx+1)
            x[idx]=[]
            ans+=1
        idx+=1
    if flg==0:
        break
print(ans)
Problem p03607 (python)

Fixed submission:
n=int(input())
s=set()
for i in range(n):
    a=int(input())
    if a in s:
        s.remove(a)
    else:
        s.add(a)
print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=set()

for i in range(n):
    a=int(input())
    if a in s:
        s.remove(a)
    else:
        s.append(a)

print(len(s))
Problem p03633 (python)

Fixed submission:
import fractions

n=int(input())
x=[]
for i in range(n):
    t=int(input())
    x.append(t)


ans=x[0]
for j in range(1,len(x)):
    ans=ans*x[j]// fractions.gcd(ans,x[j])

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[]
for i in range(n):
    t=int(input())
    x.append(t)


ans=x[0]
for j in range(1,len(x)):
    ans=ans*x[j]//fractions.gcd(ans,x[j])

print(ans)
Problem p03636 (python)

Fixed submission:
# -*- coding utf-8 -*-
s=list(str(input()))
x=(len(s)-2)

print(s[0],end="") 
print(x,end="")
print(s[-1])

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

x=s[0],len(s)-2,s[-1]
print(x.gsub(" ",""))