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

Fixed submission:
K = int(input())
x = 7 % K #mod(K)
if K == 1 or K == 7:
  print(1)
  exit()
ans = 1
i = 0
while i < K:
  ans += 1
  x = (x * 10 + 7) % K
  
  
  if x == 0:
    print(ans)
    exit()
  i += 1
print('-1')

Buggy submission (verdict: Runtime Error):
K=int(input())
x=0
if k%2==0:
  print(-1)
  exit
for i in range(1000000):
  x=(10*x+7)%K
  if x==0:
    print(i+1)
    exit
if x!=0:
  print(-1)

Buggy submission (verdict: Runtime Error):
K=int(input())
x=0
if k%2==0:
  print(-1)
  exit
for i in range(1000000):
  x=(10*x+7)%K
  if x==0:
    print(i+1)
    break
if x!=0:
  print(-1)

Buggy submission (verdict: Runtime Error):
from math import gcdnbv
K=int(input())
if K%7==0:
  K=K//7
if gcd(10,K)!=1:
  print(-1)
  return
x=1%K
cnt=1
while x!=0:
  x=(10*x+1)%K
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
from math import gcd
K=int(input())
if K%7==0:
  K=K//7
if gcd(10,K)!=1:
  print(-1)
  retur
x=1%K
cnt=1
while x!=0:
  x=(10*x+1)%K
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
from math import gcd
K=int(input())
if K%7==0:
  K=K//7
if gcd(10,K)!=1:
  print(-1)
  return
x=1%K
cnt=1
while x!=0:
  x=(10*x+1)%K
  cnt+=1
print(cnt)
Problem p02622 (python)

Fixed submission:
from sys import stdin
s=stdin.readline()
t=stdin.readline()
count=0
for i in range(len(s)):
  if s[i]!=t[i]:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin
s=stdin.readline()
t=sdtin.readline()
count=0
for i in range(len(s)):
  if s[i]!=t[i]:
    count+=1
print(count)
Problem p02793 (python)

Fixed submission:
import sys
import fractions
input = sys.stdin.buffer.readline
def lcm(x,y):
  return((x*y)//fractions.gcd(x,y))
def main():
  N=int(input())
  arr=list(map(int,input().split()))
  MOD=1000000007 
  LCM=1
  for i in arr:
    LCM=lcm(LCM,i)
  ans=0
  for i in arr:
    ans += LCM//i
  print(ans%MOD)
if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.buffer.readline
def lcm(x,y):
  return((x*y)//math.gcd(x,y))
def main():
  N=int(input())
  arr=list(map(int,input().split()))
  MOD=1000000007 
  LCM=1
  for i in arr:
    LCM=lcm(LCM,i)
  ans=0
  for i in arr:
    ans += LCM//i
  print(ans%MOD)
if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
  return abs(a*b) // math.gcd(a, b)
import math
n=input()
s=input()
arr=s.split()
nLcm=1
for i in arr:
  now=int(i)
  nLcm=lcm(now,nLcm)
ans=0
MOD=1000000007
for i in arr:
  now=int(i)
  delta=(nLcm/now)%MOD
  ans+=delta
  ans%=MOD
print(int(ans))
Problem p02547 (python)

Fixed submission:
n=int(input())
ans=0
c=True
d=[]
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        d.append(i)
if len(d)<3:
    print("No")
else:
    j=0
    for i in range(1,len(d)-1):

        if d[i]-d[i-1]==1 and d[i+1]-d[i]==1:
            print("Yes")
            c=False
            break

    if c==True:
        print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
c=True
d=[]
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        d.append()
if len(d)<3:
    print("No")
else:
    j=0
    for i in range(1,len(d)-1):

        if d[i]-d[i-1]==1 and d[i+1]-d[i]==1:
            print("Yes")
            c=False
            break

    if c==False:
        print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
c=True
d=[]
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        d.append()
if len(d)<3:
    print("No")
else:
    j=0
    for i in range(1,len(d)):
      
        if d[i]-d[i-1]==1 and d[i+1]-d[i]==1:
            print("Yes")
            c=False
            break
 
    if c==False:
        print("No")
Problem p02688 (python)

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

d = [0]*k
a = [0]*k

for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int, input().split()))

k = 0

b = sum(a, [])
    
for i in range(n):
    if i+1 not in b:
        k = k + 1

print(k)

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

for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int, input().split()))

for i in range(n):
    if all((x != i for x in a)):
        print(i)

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

for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int, input().split()))

for i in range(n):
    if all((x == i for x in a)):
        print(i)
Problem p02699 (python)

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

if a > b :
    print('safe')
else:
    print('unsafe')

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

n = len(s)

k = 0

for i in range(n - 4):
    for j in range(i+4, n+1):
        if int(s[i:j]) % 2019 == 0:
            k = k+1
            
print(k)
Problem p02546 (python)

Fixed submission:
s=input()
if(s[-1:]=='s'):
  s1=s+"es"
  print(s1)
else:
  s2=s+"s"
  print(s2)

Buggy submission (verdict: Runtime Error):
s=input()
if(s[-1:]=='s'):
  print(s[-1].replace("s","es"))
else:
  s1=s+"s"
print(s1)

Buggy submission (verdict: Runtime Error):
s=input()
if(s[-1:]=='s'):
  print(s[-1:].replace("s","es"))
else:
  s1=s+"s"
print(s1)

Buggy submission (verdict: Runtime Error):
s=input()
if s[-1]="s":
  print(s[-1].replace("s","es"))
else:
  s1=s+"s"
print(s1)

Buggy submission (verdict: Runtime Error):
s=input()
if s[-1]=s:
  print(s[-1].replace("s","es"))
else:
  s1=s+"s"
print(s1)

Buggy submission (verdict: Runtime Error):
s=input()
if s[-1]=s:
  print(s[-1].replace("s","es"))
else:
  s1=s+"s"
  print(s1)
Problem p02552 (python)

Fixed submission:
x=int(input())
if x==0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x=int(input())
if x=0:
  print("1")
else:
  print("0")

Buggy submission (verdict: Runtime Error):
x=input()
if x=0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x=input()
if x=0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x=input()
if x=0:
  print("1")
else:
  print("0")
Problem p02594 (python)

Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x=input()
if x>=30:
  print("Yes")
else:
  print("No")
Problem p02595 (python)

Fixed submission:
import math
 
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if math.sqrt((x**2)+(y**2))<=d:
   count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if x**2+y**2<=d**2:
  count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
x = [0]*n
y = [0]*n
 
count=0
 
for i in range(n):
  x[i],y[i] = map(int, input().split())
  if x[i]**2+y[i]**2<=d**2:
  count=+1
print(count)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
x = [0]*n
y = [0]*n

count=0

for i in range(n):
  x[i],y[i] = map(int, input().split())
  if x**2+y**2<=d**2:
   count=+1
print(count)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if x[i]**2+y[i]**2<=d**2:
   count=+1
print(count)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
count=0
for i in range(n):
  x[i],y[i] = map(int, input().split())
  if x[i]**2+y[i]**2<=d**2:
   count=+1
print(count)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if x**2+y**2<=d**2:
   a.count=+1
print(a)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if x**2+y**2<=d**2:
  count=+1
print(count)
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[2]=s[3] and s[4]=s[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[2]=s[3] and s[4]=s[5]:
  print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]==s[4] and s[5]==s[6]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]==s[4] and s[5]==s[6]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if s[3]==s[4] and s[5]==s[6]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]=s[4] and s[5]=s[6]:
 print("Yes")
else if:
 print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]=s[4] and s[5]=s[6]:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]=s[4] and s[5]=s[6]
 print("Yes")
else
 print("No")
Problem p02725 (python)

Fixed submission:
k,n=map(int,input().split())
a=list(map(int,input().split()))
a.append(k+a[0])

l=0
for i in range(1,n+1):
  l=max(l,a[i]-a[i-1])
 
print(k-l)

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split()))
a.append(k+a[0])
 
for i in range(1,n):
  l=max(a[i]-a[i-1])
 
print(k-l)

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split()))
a.append(k+a[0])

for i in range(1,n):
  l=max(a[i]-a[i-1])

print(K-l)

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
A=list(map(int,input().split()))
A.append(K+A[0])

for i in range(n):
  l=max(A[i]-A[i-1])

print(K-l)
Problem p02951 (python)

Fixed submission:
a = []
a = input().split()

A = int(a[0])
B = int(a[1])
C = int(a[2])

if (A - B) >= C :
  ans = 0
if (A - B) < C :
  ans = C - (A - B)
  
print(ans)

Buggy submission (verdict: Runtime Error):
a = []
a = input().split()

A = int(a[0])
B = int(a[1])
C = int(a[2])

if A - B > C :
  ans = 0
if A - B < C :
  ans = C - (A - B)
  
print(ans)
Problem p02959 (python)

Fixed submission:
#!/usr/bin/env python

N = input()
N = int(N)

A = []
A = input().split()
A = [int(n) for n in A]
#A.append(0)

B = []
B = input().split()
B = [int(n) for n in B]
B.append(0)
#B.append(0)

#print('N=',n)
#print('A=',A)
#print('B=',B)

monster = 0

for i in range(N) :
	if A[i] < B[i] :
		monster = monster + A[i]
		B[i] = B[i] - A[i]
		if A[i+1] < B[i] :
			monster = monster + A[i+1]
			A[i+1] = 0
		elif A[i+1] >= B[i] :
			monster = monster + B[i]
			A[i+1] = A[i+1] - B[i]
	elif A[i] >= B[i] :
		monster = monster + B[i]

print(monster)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python


N = input()
N = int(N)

A = []
A = input().split()
A = [int(n) for n in A]

B = []
B = input().split()
B = [int(n) for n in B]
B.append(0)

#print('N=',N)
#print('A=',A)
#print('B=',B)

monster = 0

for i in range(N+1) :
	if A[i] < B[i] :
		monster = monster + A[i]
		delta = B[i] - A[i]
		B[i+1] = B[i+1] + delta
	if A[i] >= B[i] :
		monster = monster + B[i]

print(monster)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python


N = input()
N = int(N)

A = []
A = input().split()
A = [int(n) for n in A]

B = []
B = input().split()
B = [int(n) for n in B]
B.append(0)

#print('N=',N)
#print('A=',A)
#print('B=',B)

monster = 0

for i in range(N+1) :
	if A[i] < B[i] :
		monster = monster + A[i]
		B[i+1] = B[i] - A[i]
	if A[i] >= B[i] :
		monster = monster + B[i]

print(monster)
Problem p02546 (python)

Fixed submission:
input_n = input()
n = str(input_n)

listN = list(n)
#listN = n.split(' ')

if listN[len(listN) - 1] == "s":
    listN.append("e")
    listN.append("s")
else:
    listN.append("s")

for i in range(len(listN)):
    print(listN[i], end = "")

Buggy submission (verdict: Runtime Error):
input_n = input()
n = str(input_n)

listN = list(n)
#listN = n.split(' ')

if listN[len(listN) - 1] = "s":
    listN.append("e")
    listN.append("s")
else:
    listN.append("s")

for i in range(len(listN) - 1):
    print(listN[i], end = "")

Buggy submission (verdict: Runtime Error):
input_n = input()
n = str(input_n)

listN = list(n)
#listN = n.split(' ')

if listN[len(listN)] = "s":
    listN.append("e")
    listN.append("s")
else:
    listN.append("s")

for i in range(len(listN)):
    print(listN[i], end = "")
Problem p02989 (python)

Fixed submission:
N=int(input())
d=list(map(int,input().split()))

d.sort()
ans=d[N//2]-d[N//2-1]
print(ans)

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

d.sort()
ans=d[N//2+1]-d[N//2]
print(ans)

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

d.sort()
ans=d[N/2+1]-d[N/2]
print(ans)
Problem p03011 (python)

Fixed submission:
lis=list(map(int,input().split()))
print(sorted(lis)[0]+sorted(lis)[1])

Buggy submission (verdict: Runtime Error):
is=list(map(int,input().split()))
print(sorted(lis)[0]+sorted(lis)[1])
Problem p02925 (python)

Fixed submission:
from collections import deque
import time

start = time.time() # なにこれ

n = int(input())
target_num = n*(n-1)//2

all_set = set()
a = [deque(list(map(int, input().split()))) for i in range(n)]
ans = 0

while True:
  cur_set = set()
  flag = False
  for i in range(n):
    if len(a[i]):
      tup = (min(i+1, a[i][0]), max(i+1, a[i][0]))
    else:
      continue
    if tup not in cur_set:
      cur_set.add(tup)
    elif tup in cur_set:
      all_set.add(tup)
      t1, t2 = tup
      a[t1-1].popleft()
      a[t2-1].popleft()
      flag = True
  ans += 1
  if len(all_set)==target_num:
    break
  if time.time()-start>1.8:
    print(1000*999//2)
    exit()
  if not flag:
    print(-1)
    exit()

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque

def main():
  input = sys.stdin.readline
  n = int(input())
  target_num = n*(n-1)//2

  all_set = set()
  a = [None] * n
  for i in range(n):
    a[i] = deque(map(int, input()))
  ans = 0

  while True:
    cur_set = set()
    flag = False
    for i in range(n):
      if len(a[i]):
        tup = tuple(min(i+1, a[i][0]), max(i+1, a[i][0]))
      else:
        continue
      if tup not in cur_set:
        cur_set.add(tup)
      elif tup in cur_set:
        all_set.add(tup)
        t1, t2 = tup
        a[t1-1].popleft()
        a[t2-1].popleft()
        flag = True
    ans += 1
    if len(all_set)==target_num:
      break
    if not flag:
      print(-1)
      exit()

  print(ans)

if __name__ == '__main__':
  main()
Problem p02990 (python)

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

MAX = 2*10**5+1
MOD = 10**9+7
fact = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]
invfact = [0 for i in range(MAX)]

def comb_build(n):
  fact[0] = inv[0] = invfact[0] = 1
  fact[1] = inv[1] = invfact[1] = 1
  for i in range(2, n):
    fact[i] = fact[i-1]*i%MOD
    inv[i] = inv[MOD%i]*(MOD-MOD//i)%MOD
    invfact[i] = invfact[i-1]*inv[i]%MOD

def nCk(n, k):
  if n<k or n<0 or k<0:
    return 0
  return (((fact[n]*invfact[k])%MOD)*invfact[n-k])%MOD

comb_build(2010)

for i in range(1, k+1):
  if i>n-k+1:
    print(0)
  else:
    print((nCk(k-1, i-1)*nCk(n-(k-1), i))%MOD)

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

MAX = 2*10**5+1
MOD = 10**9+7
fact = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]
invfact = [0 for i in range(MAX)]

def comb_build(n):
  fact[0] = inv[0] = invfact[0] = 1
  fact[1] = inv[1] = invfact[1] = 1
  for i in range(2, n):
    fact[i] = fact[i-1]*i%MOD
    inv[i] = inv[MOD%i]*(MOD-MOD//i)%MOD
    invfact[i] = invfact[i-1]*inv[i]%MOD

def nCk(n, k):
  if n<k or n<0 or k<0:
    return 0
  return (((fact[n]*invfact[k])%MOD)*invfact[n-k])%MOD

comb_build(2010)

t = nCk(n, n-k)
for i in range(1, k+1):
  if i>n-k+1:
    print(0)
  else:
    print((nCk(k-1, i-1)*nCk(n-(k-1), i))%MOD)
print(s%MOD == t%MOD)
Problem p03041 (python)

Fixed submission:
n, k = list(map(int, input().split()))
s = input()
ans = s[:k-1]+s[k-1].lower()+s[k:]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5-1)

n = int(input())
if n==1:
  print(0)
  exit()
from collections import defaultdict
edge = defaultdict(list)
for i in range(n-1):
  u, v, w = list(map(int, input().split()))
  edge[u].append((v, w))
  edge[v].append((u, w))
graph = [-1 for i in range(n+1)]

def dfs(x, c):
  nexts = edge.get(x)
  if nexts is None:
    return
  if graph[x]!=-1:
    return
  else:
    graph[x] = c
  for y, w in nexts:
    if w%2:
      dfs(y, not c)
    else:
      dfs(y, c)

dfs(1, 0)
for i in range(1, n+1):
  print(int(graph[i]))
Problem p03075 (python)

Fixed submission:
a = []
for i in range(5):
  a.append(int(input()))
k = int(input())
if a[4]-a[0]<=k:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

d = [e1+e2 for e1 in a for e2 in b]
d.sort(reverse=True)
d = d[:k]

e = [e1+e2 for e1 in d for e2 in c]
e.sort(reverse=True)

for i in range(k):
  print(e[i])
Problem p03332 (python)

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

MOD = 998244353
MAX = n+2

fact, inverse = [0]*(MAX), [0]*(MAX)
fact[0], inverse[0] = 1, 1
for i in range(1, MAX):
  fact[i] = (fact[i-1]*i)%MOD
  inverse[i] = pow(fact[i], MOD-2, MOD)

def mod_comb(n, r):
  if n<r or n==0: return 0
  if r==0: return 1
  return (((fact[n]*inverse[r])%MOD)*inverse[n-r])%MOD

ans = 0
for i in range(n+1):
  if (k-A*i)%B == 0:
    b = (k-A*i)//B
    if 0<=b<=n:
      ans = (ans+mod_comb(n, i)*mod_comb(n, b))%MOD

if ans==0:
  print(1)
else:
  print(ans)

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

MOD = 998244353
MAX = 210000

fac = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]
ifac = [0 for i in range(MAX)]
fac[0] = 1; fac[1] = 1
inv[1] = 1
ifac[0] = 1; ifac[1] = 1

for i in range(2, MAX):
  fac[i] = fac[i-1]*i%MOD
  inv[i] = inv[MOD%i]*(MOD-MOD//i)%MOD
  ifac[i] = ifac[i-1]*inv[i]%MOD

def nCk(n, k):
  if n<k or n<0 or k<0: return 0
  return (((fac[n]*ifac[k])%MOD)*ifac[n-k])%MOD

ans = 0
for i in range(n+1):
  if (k-A*i)%B == 0:
    b = (k-A*i)//B
    if 0<=b<=n:
      ans = (ans+nCk(n, i)*nCk(n, b))%MOD

if ans==0:
  print(1)
else:
  print(ans)
Problem p03631 (python)

Fixed submission:
n = input()
if n[0]==n[2]:
  print("Yes")
else:
  print("No")

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

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

def lcm(a, b):
  g = gcd(a, b)
  return a*b//g

ans = 1
for i in range(n):
  ans = lcm(ans, t[i])
print(ans)
Problem p03307 (python)

Fixed submission:
num = int(input())
if num % 2 != 0:
    print(num*2)
else:
    print(num)

Buggy submission (verdict: Runtime Error):
size = int(input())
A = list(map(int,input().split()))
i = list(range(1,size+1))

remain_list = [A-i for(A,i) in zip(A,i)]
while(True):
    zero_count = len([i for i in remain_list if i ==0])
    minus_count = len([i for i in remain_list if i <0])
    plus_count = len([i for i in remain_list if i > 0])

    if zero_count == max(zero_count,minus_count,plus_count) or plus_count == minus_count:
        break

    if plus_count == max(zero_count,minus_count,plus_count):
        remain_list = [num - 1 for num in remain_list]

    if minus_count == max(zero_count,minus_count,plus_count):
        remain_list = [num + 1 for num in remain_list]


sum_list =[abs(num) for num in remain_list]

print(sum(sum_list))

Buggy submission (verdict: Runtime Error):
size = int(input())
A = list(map(int,input().split()))
i = list(range(1,size+1))

remain_list = [A-i for(A,i) in zip(A,i)]
while(True):
    zero_count = len([i for i in remain_list if i ==0])
    minus_count = len([i for i in remain_list if i <0])
    plus_count = len([i for i in remain_list if i > 0])

    if zero_count == max(zero_count,minus_count,plus_count) or plus_count == minus_count:
        break

    if plus_count == max(zero_count,minus_count,plus_count):
        remain_list = [num - 1 for num in remain_list]

    if minus_count == max(zero_count,minus_count,plus_count):
        remain_list = [num + 1 for num in remain_list]


sum_list =[abs(num) for num in remain_list]

print(sum(sum_list))
Problem p02570 (python)

Fixed submission:
A=input()
A=A.split()
D=int(A[0])
T=int(A[1])
S=int(A[2])

if S*T>=D:
  print("Yes")
else:
  print("No")

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

  
a=numpy.cumsum(A)
b=0
for j in range(N):
  b+=A[j]*(a[N-1]-a[j])
 
  
MOD=1000000007  
print(b%MOD)

Buggy submission (verdict: Runtime Error):
d=T*S
if d>D:
  print("Yes")
else:
  print("No")
Problem p02547 (python)

Fixed submission:
def judge():
    cnt = 0  # 今何連続でゾロ目が出ているか記録しておきます

    for _ in range(N):
        x, y = map(int, input().split())
        if x == y:
            # ゾロ目ストリークが1増えました
            cnt += 1
        else:
            # ゾロ目ストリークが切れました
            cnt = 0

        if cnt == 3:
            # 3連続になった瞬間、return True していいです
            return True

    # ダメでした
    return False

N = int(input())

if judge():
    # judge() で Trueが返ってくるとこっちに進みます
    print("Yes")
else:
    # Falseだとこっちです
    print("No")

Buggy submission (verdict: Runtime Error):
def judge():
    count = 0
    for _ in range(n):
        d1, d2 = map(int, input().split(""))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        if count == 3:
            return True

    return False

n = int(input())

if judge():
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
def judge():
    count = 0
    flag = True
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        
        if count == 3:
            flag = True
            break
        else:
            flag = False
            pass
    return flag

if judge():
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
def judge():
    count = 0
    flag = True
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        
        if count == 3:
            print("yes")
            flag = True
            break
        else:
            flag = False
            pass
    return flag

if judge():
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
n = int(input())
for _ in range(n):
    d1, d2 = map(int, input().split(" "))
    if d1 == d2:
        count += 1
    else:
        count = 0
    
    
    if count >= 3:
        print("yes")
        break
if count < 3:
    print("no")

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

for _ in range(n):
    d1, d2 = map(int, input().split(" "))
    if d1 == d2:
        count += 1
if count >= 3:
    print("yes")
else:
    print("no")
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))

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

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

print(lcm(A, B) )

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

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

print(lcm(A, B) )
Problem p02987 (python)

Fixed submission:
s = str(input())
cnt = 0
for moji in s:
    #print(moji)
    num = s.count(moji)
    #print(num)
    if num == 2:
        cnt+=1
    else:
        break
        
if cnt == 4:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
cnt = 0
for moji in s:
    #print(moji)
    num = s.count(moji)
    #print(num)
    if num == 2:
        cnt+=1
    else:
        break
        
if cnt == 4:
    print("Yes")
else:
    print("No")