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

Fixed submission:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for _ in range(M)]

C = [list(map(int, input().split())) for _ in range(3)]
 
Dif_H = [[] for _ in range(3)]
Dif_V = [[] for _ in range(3)]
 
for i in range(3):
    Dif_H[i] = [C[i][0] - C[i][1], C[i][1] - C[i][2], C[i][2] - C[i][0]]
for i in range(3):
    Dif_V[i] = [C[0][i] - C[1][i], C[1][i] - C[2][i], C[2][i] - C[0][i]]
 
if Dif_H[0] == Dif_H[1] == Dif_H[2] and Dif_V[0] == Dif_V[1] == Dif_V[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for _ in range(M)]

H = 3
C = [list(map(int, input().split())) for _ in range(H)]

a1 = 0
b1 = C[0][0]
b2 = C[0][1]
b3 = C[0][2]

if !((C[1][0]-b1) == (C[1][1]-b2) and (C[1][1]-b2) == (C[1][2]-b2)):
    print("No")
    sys.exit()

if !((C[2][0]-b1) == (C[2][1]-b2) and (C[2][1]-b2) == (C[2][2]-b2)):
    print("No")
    sys.exit()

print("Yes")
Problem p03607 (python)

Fixed submission:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = [int(input()) for _ in range(N)]
C = collections.Counter(A)
data = list(C.values())

ans = 0

for i in range(len(data)):
    if data[i] % 2 == 1:
        ans+=1

print(ans)

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = [int(input()) for _ in range(N)]
C = collections.Counter(A)
data = C.values()

ans = 0

for i in range(len(data)):
    if data[i] % 2 == 1:
        ans+=1

print(ans)
Problem p03611 (python)

Fixed submission:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = list(map(int, input().split()))

## Logic

C = Counter(A)
X = 0
for i in range(10**5):
    X = max(X,C[i]+C[i+1]+C[i+2])
print(X)

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = list(map(int, input().split()))

## Logic

C = Counter(A)
X = 0
for i in range(10**5):
    X = max(X,sum(C[i-1],C[i],C[i+1]))
print(X)
Problem p03695 (python)

Fixed submission:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = list(map(int, input().split()))

## Logic

ans = [0,0,0,0,0,0,0,0]
tmp = 0

for i in range(0,N):
    if A[i] >= 3200:
        tmp += 1
    else:
        ans[A[i]//400] = 1

print(max(1,sum(ans)),sum(ans)+tmp)

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = list(map(int, input().split()))

## Logic

ans = [0,0,0,0,0,0,0,0]
tmp = 0

for i in A:
    if A[i] >= 3200:
        tmp += 1
    else:
        ans[A[i]//400] = 1

print(max(1,sum(ans)),min(8,sum(ans)+tmp))
Problem p03854 (python)

Fixed submission:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

S = input()

## Logic

S = S[::-1]

i = 0 
while i < len(S):
    if S[i:i+7]=="remaerd":
        i = i + 7
    elif S[i:i+6]=="resare":
        i = i + 6
    elif S[i:i+5]=="maerd":
        i = i + 5
    elif S[i:i+5]=="esare":
        i = i + 5
    else:
        print("NO")
        sys.exit()
print("YES")

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

S = input()

## Logic

S = S[::-1]
print(S)

i = 0 
while i < len(S):
    if [i:i+7]=="remaerd":
        i = i + 7
    elif [i:i+6]=="resare":
        i = i + 6
    elif [i:i+5]=="maerd":
        i = i + 5
    elif [i:i+5]=="esare":
        i = i + 5
    else:
        print("NO")
        sys.exit()
print("YES")
Problem p03971 (python)

Fixed submission:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N,A,B=map(int, input().split())
S = input()
tmp1 = 0
tmp2 = 0

for i in range(0,N):
    if tmp1 < A+B:
        if S[i] == "a":
            tmp1 += 1
            print("Yes")
        elif (S[i] == "b") & (tmp2 < B):
            tmp1 += 1
            tmp2 += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N,A,B=map(int, input().split())
S = input()
tmp1 = 0
tmp2 = 0

for i in range(0,N):
    if tmp1 < A+B:
        if S[i] == "a":
            tmp1 += 1
            print("Yes")
        elif S[i] == "b" & tmp2 < B:
            tmp1 += 1
            tmp2 += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")
Problem p02606 (python)

Fixed submission:
l,r,d = map(int,input().split())
cnt=0
for i in range(l,r+1):
    if i%d == 0:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
def dfs(lis,cnt,n):
    if sum(lis)>100:
        return cnt
 
    if(len(lis)==3):
        ans=lis[0]**2+lis[1]**2+lis[2]**2+lis[0]*lis[1]+lis[1]*lis[2]+lis[2]*lis[0]
        if(ans==n):
            cnt+=1
        return cnt
    
    for v in range(1,100):
        lis.append(v)
        cnt=dfs(lis,cnt,n)
        lis.pop()
    
    return cnt
 
 
n= int(input())
for i in range(1,n+1):
    cnt = 0
    print(dfs([],cnt,i))
Problem p02641 (python)

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

Q = [q for q in range(-1, 102) if q not in P]  # -1以上101以下整数のうちPに存在しないもの
ans = min(Q, key=lambda q: (abs(q - X), q))  # maspyさん解法
print(ans)

Buggy submission (verdict: Runtime Error):
x,n  = map(int,input().split())
if(n==0):
    print(x)
else:

    p = list(map(int,input().split()))
    l = list(range(1,101))

    rl =  set(l)-set(p)
    m = 100
    for i in  rl:
        if(abs(i-x) < m):
            m = abs(i-x)
            ans = i
    print(ans)

Buggy submission (verdict: Runtime Error):
x,n  = map(int,input().split())
if(n==0):
    print(x)
else:

    p = list(map(int,input().split()))
    l = list(range(1,101))

    rl =  set(l) - set(p)
    m = max(p)
    for i in  rl:
        if(abs(i-x) < m):
            m = abs(i-x)
            ans = i
    print(ans)

Buggy submission (verdict: Runtime Error):
x,n  = map(int,input().split())
if(n==0):
    print(x)
else:

    p = list(map(int,input().split()))

    l = list(range(min(p),max(p)+1))

    rl =  set(l) - set(p)
    m = max(p)
    for i in  rl:
        if(abs(i-x) < m):
            m = abs(i-x)
            ans = i
    print(ans)

Buggy submission (verdict: Runtime Error):
def resolve():
x,n  = map(int,input().split())
if(n==0):
    print(x)
    exit

p = list(map(int,input().split()))

l = list(range(min(p),max(p)+1))

rl =  set(l) - set(p)
m = max(p)
for i in  rl:
    if(abs(i-x) < m):
        m = abs(i-x)
        ans = i
print(ans)

Buggy submission (verdict: Runtime Error):
x,n  = map(int,input().split())
if(n==0):
    print(x)
    return

p = list(map(int,input().split()))

l = list(range(min(p),max(p)+1))

rl =  set(l) - set(p)
m = max(p)
for i in  rl:
    
    if(abs(i-x) < m):
        m = abs(i-x)
        ans = i

print(ans)
Problem p02700 (python)

Fixed submission:
a,b,c,d  = map(int,input().split())
for i in range(1,1000):
    if(i%2!=0):
        c -= b
    else:
        a -= d
    
    if(a<=0):
        print("No")
        break
    elif(c<=0):
        print("Yes")
        break

Buggy submission (verdict: Runtime Error):
a,b,c,d  = map(int,input().split())
for i in range(1,1000):
    if(i%2!=0):
        c -= b
    else:
        a -= d
    
    if(a<=0):
        print("No")
        return
    elif(c<=0):
        print("Yes")
        return
Problem p02713 (python)

Fixed submission:
import math

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        t = math.gcd(i,j)
        for k in range(1,n+1):
            cnt +=  math.gcd(k,t)

print(cnt)

Buggy submission (verdict: Runtime Error):

from functools import reduce

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

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

            cnt += gcd(i,j,k)

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):

            cnt += gcd(i,j,k)

print(cnt)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
from itertools import combinations

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        if(i==j):
            cnt += i
        else:
            cnt += gcd(i,i,j)*3

if(n>=3):
    my_list = list(range(1,n+1))
    x = combinations(my_list, 3)

    list_x = list(x)
    for i in list_x:
        cnt+= gcd(i[0],i[1],i[2])

print(cnt)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
from itertools import combinations

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        if(i==j):
            cnt += i
        else:
            cnt += gcd(i,i,j)*3

print(cnt)
if(n>=3):
    my_list = list(range(1,n+1))
    x = combinations(my_list, 3)


    list_x = list(x)
    for i in list_x:
        cnt+= gcd(i[0],i[1],i[2])

print(cnt)
Problem p02783 (python)

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

if(h<a):
  print("1")
elif(h%a != 0):
    print(h//a+1)
else:
    print(h//a)

Buggy submission (verdict: Runtime Error):
    h,a = map(int,input().split()) 
    print(h,a)

    if(h<a):
        print("1")
    elif(h%a != 0):
        print(h/a+1)
    else:
        print(h/a)
Problem p02888 (python)

Fixed submission:
from bisect import bisect_left

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

l.sort()
count = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    count+=bisect_left(l,l[j]+l[i])-j-1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

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

l.sort()
count = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    print(bisect_left(l,l[j]+l[i]),i,j,l)
    count+=bisect_left(l,l[j]+l[i])-j-1
print(count)
Problem p02910 (python)

Fixed submission:
s = list(input())
flg=0
for i in range(1,len(s)+1):
    if(i%2!=0):
        if s[i-1] not in ["R","U","D"]:
            flg=1
    elif(i%2==0):
        if s[i-1] not in ["L","U","D"]:
            flg=1
if(flg==1):
    print("No")
else: print("Yes")

Buggy submission (verdict: Runtime Error):
flg=0
for i in range(0,len(s)-1,2):
    if s[i] not in ["R","U","D"]:
        flg=1
    if s[i+1] not in ["L","U","D"]:
        flg=1
if(flg==1):
    print("No")
else: print("Yes")
Problem p02934 (python)

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

ar=sum([1/i for i in a])
print(1/ar)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


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

def lcm_list(numbers):
    return reduce(lcm_base, numbers)


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

s = lcm_list(a)
z = list(map(lambda x: s /x , a))
print(s/sum(z))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

s = lcm_list(a)
z = list(map(lambda x: s /x , a))
print(s/sum(z))
Problem p02995 (python)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

a,b,c,d = map(int,input().split())
li=[]
gc = lcm(c,d)
for i in [a-1,b]:
    bc = i//c
    bd = i//d
    cd = i//gc
    li.append(i-(bc+bd-cd))
print(int(li[1]-li[0]))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
li=[]
for i in [a-1,b]:
    bc = i//c
    bd = i//d
    gc = c*d / math.gcd(c,d)
    cd = i//gc
    li.append(i-(bc+bd-cd))
print(int(li[1]-li[0]))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
li=[]
for i in [a-1,b]:
    bc = i//c
    bd = i//d
    gcd = c*d / math.gcd(c,d)
    cd = i//gcd
    li.append(i-(bc+bd-cd))
print(int(li[1]-li[0]))
Problem p02584 (python)

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

x = abs(x)

ans = 0

t = x // d
s = x % d

if abs(x) > k * d:
    print(abs(x) - k * d)
elif t % 2 == k % 2:
    print(s)
else:
    print(d - s)

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


def is_even(num):
    if num % 2 == 0:
        return True
    else:
        return False


ans = 0

if 2 * x < d:
    ans = x
else:
    t = x // d
    if k > t - 2:
        if (k - t) / 2 == 0:
            t0 = abs(x - (t - 2) * d)
            t1 = abs(x - (t) * d)
            t2 = abs(x - (t + 2) * d)
            ans = min(t0, min(t1, t2))
        else:
            t0 = abs(x - (t - 1) * d)
            t2 = abs(x - (t + 1) * d)
            ans = min(t0, min(t1, t2))
    else:
      ans = abs(x- (k) * d)

print(ans)
Problem p02969 (python)

Fixed submission:
r = int(input())

print(3 * r * r)

Buggy submission (verdict: Runtime Error):
object Main extends App {
  val r = scala.io.StdIn.readInt
  println(r * r * 3)
}
Problem p03059 (python)

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

ans = (t // a) * b

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 100:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in range(100):
    t = gcd(random.sample(a, 50))
    if ans < t:
      ans = t

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 100:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in range(100):
    t = gcd(random.sample(a, 30))
    if ans < t:
      ans = t

print(ans)
Problem p03061 (python)

Fixed submission:
import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 1000:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in range(200):
    t = gcd(random.sample(a, 500))
    if ans < t:
      ans = t

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 100:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in 100:
    t = gcd(random.sample(a, 3))
    if ans < t:
      ans = t

print(ans)
Problem p02807 (python)

Fixed submission:
import collections as c
ip = lambda : map(int, input().split())
# ##############
N = int(input())
l = list(ip())
d = []
for i in range(N-1):
    d.append(l[i+1]-l[i])

ans = 0
mod = int(1e9+7)
c=0
l=1
for i in range(N-1):
    c = ((i+1)*c + l)%mod
    ans = ((i+1)*ans + c*d[i])%mod
    l = l*(i+1)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as c
ip = lambda : map(int, input().split())
# ##############
N = int(input())
l = list(ip())
d = []
for i in range(N-1):
    d.append(l[i+1]-l[i])

ans = 0;mod = 1e9+7;c=0;l=1
for i in range(N-1):
    c = (i+1)*c + l
    ans = ((i+1)*ans + c*d[i])%mod
    l = l*(i+1)%mod
print(int(ans%mod))

Buggy submission (verdict: Runtime Error):
import collections as c
ip = lambda : map(int, input().split())
# ##############
N = int(input())
l = list(ip())
d = []
for i in range(N-1):
    d.append(l[i+1]-l[i])

ans = 0;mod = 1e9+7;c=0;l=1
for i in range(N-1):
    c = (i+1)*c + l
    ans = (i+1)*ans + c*d[i]
    ans%=mod
    l *= i+1
print(int(ans%mod))

Buggy submission (verdict: Runtime Error):
import collections as c
ip = lambda : map(int, input().split())
# ##############
N = int(input())
l = list(ip())
d = []
for i in range(N-1):
    d.append(l[i+1]-l[i])

ans = 0;mod = 1e9+7;c=0;l=1
for i in range(N-1):
    # if i == 0:
    #     c = 1
    # else:
    #     c = (c*(i+1)/(i*l) + 1)*l
    # print(ans)
    # ans = (ans*(i+1)%mod + d[i]*c)%mod
    # l = (l*i+1)%mod
    c+=1/(i+1)
    ans += c*d[i]
    ans%=mod
    l *= i+1
print(int(ans*l%mod))
Problem p02903 (python)

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

s = "0"*A + "1"*(W-A)
for i in range(B):
    print(s)
s = "1"*A + "0"*(W-A)
for i in range(H-B):
    print(s)

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



if H==1:
    if B>0:
        ans = 'No'
    else:
        ans = "0"*A + "1"*(W-A)
elif W==1:
    if A>0:
        ans = 'No'
    else:
        for i in range(B):
            print(1)
        for i in range(H-B):
            print(0)
        exit()
else:
    s = "1"*A + "0"*(W-A)
    if W%A==0 and A!=0 and H%(W/A) == 0 and H/(W/A)==B:
        for i in range(H):
            print(s)
            s = s[A:] + s[:A]
        exit()
    else:ans = 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
H,W,A,B = map(int,input().split())
if H==1:
    if B>0:ans = 'No'
    else:ans = "0"*A + "1"*(W-A)
else:
    s = "1"*A + "0"*(W-A)
    if W%A==0 and H%(W/A) == 0 and H/(W/A)==B:

        for i in range(H):
            print(s)
            s = s[A:] + s[:A]
        exit()
    else:ans = 'No'
print(ans)
Problem p02993 (python)

Fixed submission:
import collections as c
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
S = input()
for i in range(3):
    if S[i] == S[i+1]:
        print('Bad')
        exit()
print('Good')

Buggy submission (verdict: Runtime Error):
import collections as c
# from fractions import gcd
from math import gcd
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
S = input()
for i in range(3):
    if S[i] == S[i+1]:
        print('Bad')
        exit()
print('Good')
Problem p02994 (python)

Fixed submission:
import collections as c
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
n,l = ip()
ans = 0
k=abs(l)
for i in range(l,l+n):
    ans+=i
    if abs(i) < abs(k):
        k = i
ans -= k
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as c
# from fractions import gcd
from math import gcd
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
n,l = ip()
ans = 0
k=abs(l)
for i in range(l,l+n):
    ans+=i
    if abs(i) < abs(k):
        k = i
ans -= k
print(ans)
Problem p03160 (python)

Fixed submission:
import sys
N = int(input())
lis = [int(i) for i in sys.stdin.readline().split()]
res = [0,abs(lis[1]-lis[0])]
for i in range(2,N):
    tmp = min(abs(lis[i]-lis[i-1]) + res[i-1],abs(lis[i] - lis[i-2]) + res[i-2])
    res.append(tmp)
print(res[-1])

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
lis = [int(i) for i in sys.stdin.readline().split()]
x_1,x_2 = 0,0
for i in range(2,N):
    tmp = min(abs(lis[i]-lis[i-1]) + x_1, abs(lis[i] - lis[i-2]) + x_2)
    x_1,x_2 = tmp,x_1
print(tmp)
Problem p03192 (python)

Fixed submission:
S = input()
n = 0
for i in S:
    if i == '2':
        n += 1
print(n)

Buggy submission (verdict: Runtime Error):
N, P = map(int, input().split())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

lim = int(p) + 1

dic = {}

def my(N,newP=P):
    for i in range(2,lim+1):
        while newP % i == 0:
            dic[i] = dic.get(i,0) + 1
            newP = newP // i
        if newP < i or i == lim+1:
            res = 1
            for j,k in dic.items():
                res *= j**(k//N)
            print(res)
            exit()
my(N)
print(1)