Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

h, w = MAP()
a = [LIST() for _ in range(h)]
ans = []
for i in range(h):
    if i % 2 == 0:
        for j in range(w):
            if a[i][j] % 2 == 1:
                y = i
                x = j + 1
                if x >= w:
                    y += 1
                    x = 0
                a[y][x] += 1
                ans.append([str(i + 1), str(j + 1), str(y + 1), str(x + 1)])
    else:
        for j in reversed(range(w)):
            if a[i][j] % 2 == 1:
                y = i
                x = j - 1
                if x < 0:
                    y += 1
                    x = w - 1
                a[y][x] += 1
                ans.append([str(i + 1), str(j + 1), str(y + 1), str(x + 1)])
print(len(ans))
for i in range(len(ans)):
    print(' '.join(ans[i]))

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

h, w = MAP()
a = [LIST() for _ in range(h)]
ans = []
for i in range(h):
    if i % 2 == 0:
        for j in range(w):
            if a[i][j] % 2 == 1:
                y = i
                x = j + 1
                if x >= w:
                    y += 1
                    x = w - 1
                if y < h:
                    a[y][x] += 1
                    ans.append([str(i + 1), str(j + 1), str(y + 1), str(x + 1)])
    else:
        for j in reversed(range(w)):
            if a[i][j] % 2 == 1:
                y = i
                x = j - 1
                if x < 0:
                    y += 1
                    x = 0
                if y < h:
                    a[y][x] += 1
                    ans.append([str(i + 1), str(j + 1), str(y + 1), str(x + 1)])
print(len(ans))
for i in range(len(ans)):
    print(' '.join(ans[i]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in inpup().split()]
cnt=0
flag=False
for i in range(1,n):
    if a[i]==a[i-1]:
        if flag:
            flag=False
        else:
            cnt+=1
            flag=True
    else:
        flag=False
print(cnt)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
cnt=0
flag=False
for i in range(1,n):
    if a[i]==a[i-1]:
        if flag:
            flag=False
        else:
            cnt+=1
            flag=True
    else:
        flag=False
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
a=[int(i) for in input().split()]
if n==k:
    print(1)
else:
    k-=1
    print((n+k-1)//k)

Fixed submission:
n,k=map(int, input().split())
a=[int(i) for i in input().split()]
if n==k:
    print(1)
else:
    k-=1
    print((n+k-2)//k)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

b = 0
c = 0
cnt = 0
flag = False
while True:
    b = 0
    c = 0
    for i in range(n):
        if a[i] % 2 == 0 and c == 0:
            a[i] /= 2
            c += 1
        else:
            b += 1
    #print(a,b)
    if b != n:
        cnt += 1
    else:
        break

print(cnt)


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

'''
b = 0
c = 0
cnt = 0
flag = False
while True:
    b = 0
    c = 0
    for i in range(n):
        if a[i] % 2 == 0 and c == 0:
            a[i] /= 2
            c += 1
        else:
            b += 1
    #print(a,b)
    if b != n:
        cnt += 1
    else:
        break
'''
b = [0] * n
for i in range(n):
    while True:
        if a[i] % 2 == 0:
            a[i] /= 2
            b[i] += 1
        else:
            break

print(sum(b))
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
if len(s) < 26:
    for i in range(26):
        tmp = chr(i + ord('a'))
        if not tmp in s:
            print(s + tmp)
            exit()
else:
    for i in reversed(26):
        for j in range(ord(s[i]) + 1, ord('z') + 1):
            if not chr(j) in s[:i]:
                print(s[:i] + chr(j))
                exit()
    print(-1)
    exit()

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
if len(s) < 26:
    for i in range(26):
        tmp = chr(i + ord('a'))
        if not tmp in s:
            print(s + tmp)
            exit()
if len(set(s)) == 26:
    for i in reversed(range(len(s))):
        for j in range(ord(s[i]) + 1, ord('z') + 1):
            if not chr(j) in s[:i]:
                print(s[:i] + chr(j))
                exit()
    print(-1)
    exit()
ans = [i for i in s]
for i in reversed(range(len(s))):
    tmp = chr(ans[i] + 1)
    if not tmp in ans:
        ans[i] = tmp
    print(''.join(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
d,x = map(int,input().split())
a = []
for i in range(n):
    a.append(int(int(input())))

for i in range(n):
    num.append((d - 1) // a[i] + 1)
#print(num)

ans = x
for i in range(n):
    ans += num[i]
print(ans)

Fixed submission:
n = int(input())
d,x = map(int,input().split())
a = []
for i in range(n):
    a.append(int(int(input())))

num = []
for i in range(n):
    num.append(0)

for i in range(n):
    num[i] = (d - 1) // a[i] + 1
#print(num)

ans = x
for i in range(n):
    ans += num[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t =[input() for _ in range(m)]
sc=Counter(s)
tc=Counter(t)
u=list(set(s)&set(t))
ans=0
for i in u:
    ans=max(ans,max(0,sc[i]-st[i]))
v=list(set(s)-set(u))
for i in v:
    ans=max(ans,sc[i])
print(ans)

Fixed submission:
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t =[input() for _ in range(m)]
sc=Counter(s)
tc=Counter(t)
u=list(set(s)&set(t))
ans=0
for i in u:
    ans=max(ans,max(0,sc[i]-tc[i]))
v=list(set(s)-set(u))
for i in v:
    ans=max(ans,sc[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t =[input() for _ in range(m)]
sc=Counter(s)
tc=Counter(t)
u=list(set(s)&set(t))
ans=n
for i in u:
    ans-=sc[i]
    ans+=max(0,sc[i]-st[i])
print(ans)

Fixed submission:
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t =[input() for _ in range(m)]
sc=Counter(s)
tc=Counter(t)
u=list(set(s)&set(t))
ans=0
for i in u:
    ans=max(ans,max(0,sc[i]-tc[i]))
v=list(set(s)-set(u))
for i in v:
    ans=max(ans,sc[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
pret = 0
prex = 0
prey = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            print('No')
            sys.exit()
print('Yes')

Fixed submission:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
q = int(input())
primes = [2]
for i in range(q):
    l, r = map(int,input().split())
    maxprime = primes[len(primes) - 1]
    if r > maxprime:
        for j in range(maxprime+1 if maxprime == 2 else maxprime+2, r+1, 2):
            #print(j)
            flag = True
            for prime in primes:
                if j % prime == 0:
                    flag = False
                    break
            if flag:
                primes.append(j)
    ans = 0
    for j in range(l, r+1):
        if j in primes and (j + 1) // 2 in primes:
            ans += 1
    print(ans)

Fixed submission:
q = int(input())
primes = [True for _ in range(100000)]
c = [0 for _ in range(100000)]

for i in range(2, 100000):
    if primes[i]:
        for j in range(2*i, 100000, i):
            primes[j] = False

#print(primes[:20])

for i in range(3, 100000, 2):
    if primes[i] and primes[(i+1)//2]:
        c[i] += 1

for i in range(3, 100000):
    c[i] += c[i-1]
#print(c[:20])

for i in range(q):
    l, r = map(int,input().split())
    print(c[r] - c[l-1])
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
b = Counter(a)
c = sorted(list(set(a)), reverse=True)
ans = []
for i in c:
    if b[i] >= 2:
        ans.append(i)
    if b[i] >= 4:
        ans.append(i)
    if len(ans) >= 2:
        break
debug(ans)
if len(ans) >= 2:
    print(ans[0] * ans[1])
else:
    print(0)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
b = list(set(a))
b.sort(reverse=True)
l = len(b)
c = [0 for _ in range(l)]
prei = b[0]
j = 0
for i in a:
    if i != prei:
        j += 1
    c[j] += 1
    prei = i
x = []
for i in range(l):
    if c[i] >= 2:
        x.append(b[i])
if len(x) >= 2:
    ans = x[0] * x[1]
    for i in range(len(x)):
        if c[i] >= 4:
            ans  = max(ans, x[i] ** 2)
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc065/tasks/abc065_a

x,a,b = map(int,input().split()))

if b-a > x:
    print('dangerous')
elif b-a <= x and b-a > 0:
    print('safe')
else:
    print('delicious')

Fixed submission:
#https://atcoder.jp/contests/abc065/tasks/abc065_a

x,a,b = map(int,input().split())

if b-a > x:
    print('dangerous')
elif b-a <= x and b-a > 0:
    print('safe')
else:
    print('delicious')
Buggy python submission (verdict: Runtime Error):
import math
mod=10**9+7
factorial=[1 for _ in range(10**5+10)]
for i in range(1, 10**5+10):
    factorial[i]=i*factorial[i-1] % mod
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==0:
    print(2*factorial[n]*factorial[m])
else:
    print(factorial[n]*math.factorial[m])

Fixed submission:
import math
mod=10**9+7
factorial=[1 for _ in range(10**5+10)]
for i in range(1, 10**5+10):
    factorial[i]=i*factorial[i-1] % mod
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==0:
    print(2*factorial[n]*factorial[m]%mod)
else:
    print(factorial[n]*factorial[m]%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
mod=10**9+7
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==0:
    print(2*math.factorial(n)*math.factorial(m))
else:
    print(math.factorial(n)*math.factorial(m))

Fixed submission:
import math
mod=10**9+7
factorial=[1 for _ in range(10**5+10)]
for i in range(1, 10**5+10):
    factorial[i]=i*factorial[i-1] % mod
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==0:
    print(2*factorial[n]*factorial[m]%mod)
else:
    print(factorial[n]*factorial[m]%mod)
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
arr = []
plus = 0
for i in range(n):
    flag = True
    for j in range(1, 9):
        if a[i] < j * 400:
            if not j in arr:
                arr.append(j)
            flag = False
            break
    if flag:
        plus += 1
debug(len(set(arr)), plus, arr)
ansmx = min(len(set(arr)) + plus, 8)
ansmn = max(1, len(set(arr)))
print(ansmn, ansmx)

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
a = LIST()
a.sort()
arr = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
r = -1
for i in range(len(arr)):
    if a[0] < arr[i]:
        r = i
        break
ans = 1 if r != -1 else 0
ans2 = 0
for i in range(n):
    if a[i] >= arr[r]:
        r = -1
        for j in range(len(arr)):
            if a[i] < arr[j]:
                r = j
                break
        if r == -1:
            ans2 += 1
        else:
            ans += 1
print(ans if ans > 0 else 1, ans + ans2)
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

a, b, c = MAP()
d = a % b
if c % d == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        x, y = y, x % y
    return x

a,b,c = map(int,input().split())
if a == b:
    if c % a == 0:
        print('YES')
    else:
        print('NO')
else:
    if c % gcd(a, b) == 0:
        print('YES')
    else:
        print('NO')

Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

a, b, c = MAP()
d = a % b
if c % d == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        x, y = y, x % y
    return x

a,b,c = map(int,input().split())
if a == b:
    if c % a == 0:
        print('YES')
    else:
        print('NO')
else:
    if c % gcd(a, b) == 0:
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans += 1

print(ans)


Fixed submission:
k,s = map(int,input().split())
ans = 0
for x in range(k + 1):
    for y in range(k + 1):
        if 0 <= s - x - y <= k:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
s = str(input())
i = 0
while i < len(s):
    if i + 5 <= len(s) and s[i:i+5] == 'dream': #now dream or dreamer
        if i + 6 < len(s) and s[i+5] == 'e' and s[i+6] == 'r': #now dreamer or now dream and next is erase or eraser
            if s[i+7] == 'a': #next erase or eraser, now dream
                i += 5
            else: #now dreamer
                i += 7
        else: #now dream
            i += 5
    elif i + 5 <= len(s) and s[i:i+5] == 'erase':
        if i + 5 < len(s) and s[i+5] == 'r': #now eraser
            i += 6
        else: #now erase
            i += 5
    else:
        print('NO')
        sys.exit()
print('YES')


Fixed submission:
import sys
s = str(input())
i = 0
while i < len(s):
    if i + 5 <= len(s) and s[i:i+5] == 'dream': #now dream or dreamer
        if i + 6 < len(s) and s[i+5] == 'e' and s[i+6] == 'r': #now dreamer or now dream and next is erase or eraser
            if i + 7 < len(s) and s[i+7] == 'a': #next erase or eraser, now dream
                i += 5
            else: #now dreamer
                i += 7
        else: #now dream
            i += 5
    elif i + 5 <= len(s) and s[i:i+5] == 'erase':
        if i + 5 < len(s) and s[i+5] == 'r': #now eraser
            i += 6
        else: #now erase
            i += 5
    else:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Runtime Error):
import sys
s = str(input())
i = 0
while i < len(s):
    if i + 5 <= len(s) and s[i:i+5] == 'dream': #now dream or dreamer
        if i + 6 <= len(s) and s[i+5] == 'e' and s[i+6] == 'r': #now dreamer or now dream and next is erase or eraser
            if s[i+7] == 'a': #next erase or eraser, now dream
                i += 5
            else: #now dreamer
                i += 7
        else: #now dream
            i += 5
    elif i + 5 <= len(s) and s[i:i+5] == 'erase':
        if i + 5 <= len(s) and s[i+5] == 'r': #now eraser
            i += 6
        else: #now erase
            i += 5
    else:
        print('NO')
        sys.exit()
print('YES')


Fixed submission:
import sys
s = str(input())
i = 0
while i < len(s):
    if i + 5 <= len(s) and s[i:i+5] == 'dream': #now dream or dreamer
        if i + 6 < len(s) and s[i+5] == 'e' and s[i+6] == 'r': #now dreamer or now dream and next is erase or eraser
            if i + 7 < len(s) and s[i+7] == 'a': #next erase or eraser, now dream
                i += 5
            else: #now dreamer
                i += 7
        else: #now dream
            i += 5
    elif i + 5 <= len(s) and s[i:i+5] == 'erase':
        if i + 5 < len(s) and s[i+5] == 'r': #now eraser
            i += 6
        else: #now erase
            i += 5
    else:
        print('NO')
        sys.exit()
print('YES')