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

Fixed submission:
import math as m

def isltK(K,X):
    ccut=0
    for Ai in As:
        ccut += m.ceil(Ai/X)-1
    if ccut <=K:
        return True
    else:
        return False


N,K=map(int,input().split())
As=list(map(int,input().split()))

l=1
h=max(As)
while l < h:
    mid = (l+h)//2
    if isltK(K,mid):
        h=mid
    else:
        l=mid+1
print(l)

Buggy submission (verdict: Runtime Error):
import math as m

def isltK(K,X):
    ccut=0
    for Ai in As:
        ccut += m.ceil(Ai/X)-1
    if ccut <=K:
        return True
    else:
        return False


N,K=map(int,input().split())
As=list(map(int,input().split()))

l=0
h=max(As)
while l < h:
    mid = (l+h)//2
    if isltK(K,mid):
        h=mid
    else:
        l=mid+1
print(l)
Problem p02623 (python)

Fixed submission:
N,M,K=map(int,input().split())
As=list(map(int,input().split()))
Bs=list(map(int,input().split()))

a_sum=[0]
for i in range(N):
    a_sum.append(a_sum[-1]+As[i])

b_sum=[0]
for i in range(M):
    b_sum.append(b_sum[-1]+Bs[i])

j=M
ans=0
for i in range(N+1):
    if a_sum[i] > K:
        break

    while b_sum[j] > K - a_sum[i]:
        j-=1
    ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque as q
import bisect

N,M,K=map(int,input().split())
As=list(map(int,input().split()))
Bs=list(map(int,input().split()))

def f(nb,s,ia,ib):
    #print(nb,s,ia,ib)
    if s > K:
        return nb-1
    if ia==N and ib==M:
        return nb
    
    nb_max=0
    for nxt in ['a','b']:
        if nxt == 'a':
            if ia==N:
                continue
            nb_max=f(nb+1,s+As[ia],ia+1,ib)
        if nxt == 'b':
            if ib==M:
                continue
            nb_tmp=f(nb+1,s+Bs[ib],ia,ib+1)
            if nb_max < nb_tmp:
                nb_max = nb_tmp
    return nb_max



ans = f(0,0,0,0)
print(ans)
Problem p02679 (python)

Fixed submission:
from fractions import gcd

N=int(input())
d={}
#l=[]
MOD = 1000000007
nz=0
for _ in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        nz+=1
        #p=(0,0)
        continue
    elif a==0:
        p=(0,1)
    elif b==0:
        p=(1,0)
    else:
        c=gcd(a,b)
        a,b=a//c,b//c
        if b > 0:
            p=(a,b)
        else: # b < 0
            p=(-a,-b)
    
    #l.append(p)
    if p in d:
        d[p]+=1
    else:
        d[p] = 1

ans=1
#for p in l:
while len(d) > 0:
    p,np=d.popitem()
    if p==(1,0):
        q=(0,1)
    elif p==(0,1):
        q=(1,0)
    else:
        pa,pb=p
        if pa > 0:
            q=(-pb,pa)
        else: #pa < 0
            q=(pb,-pa)
    if q in d:
        nq=d.pop(q)
    else:
        nq=0
    
    ans *= ((2**np + 2**nq - 1) % MOD)
    ans %= MOD

ans -= 1
ans += nz
ans %= MOD
print(ans)

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

N=int(input())
d={}
#l=[]
MOD = 1000000007
nz=0
for _ in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        nz+=1
        #p=(0,0)
    elif a==0:
        p=(0,1)
    elif b==0:
        p=(1,0)
    else:
        c=gcd(a,b)
        if b > 0:
            p=(a//c,b//c)
        else: # b < 0
            p=(-a//c,-b//c)
    
    #l.append(p)
    if p in d:
        d[p]+=1
    else:
        d[p] = 1

ans=1
#for p in l:
while len(d) > 0:
    p,np=d.popitem()
    if p==(1,0):
        q=(0,1)
    elif p==(0,1):
        q=(1,0)
    else:
        pa,pb=p
        if pa > 0:
            q=(-pb,pa)
        else: #pa < 0
            q=(pb,-pa)
    if q in d:
        nq=d.pop(q)
    else:
        nq=0
    
    ans *= ((2**np + 2**nq - 1) % MOD)
    ans %= MOD

ans -= 1
ans += nz
ans %= MOD
print(ans)
Problem p03072 (python)

Fixed submission:
N=int(input())
dataH=[int(e) for e in input().split(' ')]
c=0
for i,H in enumerate(dataH):
  c=c+1 if max(dataH[:i+1])==H else c
print(c)

Buggy submission (verdict: Runtime Error):
N=int(input())
dataH=[int(e) for e in input().split(' ')]
Hmax=max(dataH)

dataH.reverse()
print(len(dataH)-dataH.index(max))
Problem p03107 (python)

Fixed submission:
istr=input()
c0=0
c1=0
for ch in istr:
    if ch == '0':
        c0+=1
    else:
        c1+=1
print(min(c0,c1)*2)

Buggy submission (verdict: Runtime Error):
istr=input()
for ch in istr:
  if ch == '0':
    c0+=1
  else:
    c1+=1
print(min(c0,c1)*2)

Buggy submission (verdict: Runtime Error):
def crmv(c,istr):
    if len(istr)<=1:
        return c
    if not('1' in istr):
        return c

    rv=0
    for i in range(len(istr)-1):
        if istr[i] != istr[i+1]:
            tstr=istr[:i]+istr[i+1+1:]
            r=crmv(c+2,tstr)
            if r>rv:
                rv=r
    return rv

istr=input()
print(crmv(0,istr))

Buggy submission (verdict: Runtime Error):
cmax=0
def crmv(c,istr):
    if len(istr)<=1:
        return c
    if not('1' in istr) or not('0' in istr):
        return c

    rv=0
    for i in range(len(istr)-1):
        if istr[i] != istr[i+1]:
            tstr=istr[:i]+istr[i+1+1:]
            r=crmv(c+2,tstr)
            if r>rv:
                rv=r
    return rv

istr=input()
print(crmv(0,istr))

Buggy submission (verdict: Runtime Error):
def crmv(c,istr):
    if len(istr)<=1:
        return c
    '''
    lidx=[]
    for i in range(len(istr)-1):
        if istr[i] != istr[i+1]:
            lidx.append(i)
    if len(lidx)==0:
        return c

    rv=0
    for i in lidx:
        tstr=istr[:i]+istr[i+1+1:]
        r=crmv(c+2,tstr)
        if r>rv:
            rv=r
    '''
    rv=-1
    for i in range(len(istr)-1):
        if istr[i] != istr[i+1]:
            tstr=istr[:i]+istr[i+1+1:]
            r=crmv(c+2,tstr)
            if r>rv:
                rv=r
    if rv == -1:
        return c
            

    return rv

istr=input()
print(crmv(0,istr))
Problem p02763 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
s = list(str(input()))
q = int(input())

s = [ord(c)-ord('a') for c in s]

#def segfunc(x,y):
    #return x | y

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]={init_val[i]}
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=seg[2*i+1] | seg[2*i+2]

def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = seg[k*2+1] | seg[k*2+2]

def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = res | seg[p]
        if q&1 == 1:
            res = res | seg[q]
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = res | seg[p]
    else:
        res = (res | seg[p]) | seg[q]
    return res

#####単位元######
ide_ele = set()

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num

init(s)
#print(seg)

for i in range(q):
    t, x, y = map(str, sys.stdin.readline().split())
    if t == '2':
        l = int(x)-1
        r = int(y)-1
        print(len(query(l, r+1)))
    else:
        i = int(x)-1
        c = {ord(y)-ord('a')}
        update(i, c)

Buggy submission (verdict: Runtime Error):
mport sys
input = sys.stdin.readline
 
n = int(input())
s = list(str(input()))
s = [{ord(c)-ord('a')} for c in s]
 
def segfunc(x, y):
    return x | y
 
def init(init_val):
    # set_val
    for i in range(n):
        seg[i+num-1] = init_val[i]
    # built
    for i in range(num-2, -1, -1):
        seg[i] = segfunc(seg[2*i+1], seg[2*i+2])
 
def update(k, x):
    k += num - 1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[2*k+1], seg[2*k+2])
 
def query(p, q):
    if q <= p:
        return ide_ele
    p += num - 1
    q += num - 2
    res = ide_ele
    while q-p>1:
        if p%2 == 0:
            res = segfunc(res, seg[p])
        if q%2 == 1:
            res = segfunc(res, seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res, seg[p])
    else:
        res = segfunc(segfunc(res, seg[p]), seg[q])
    return res
 
# identity element
ide_ele = set()
 
# num: n以上の最小の2のべき乗
num = 2**(n-1).bit_length()
seg = [ide_ele]*2*num
 
init(s)
 
q = int(input())
for _ in range(q):
    t, x, y = map(str, input().split())
    if t == '1':
        i = int(x)-1
        c = {ord(y)-ord('a')}
        update(i, c)
    else:
        l = int(x)-1
        r = int(y)-1
        print(len(query(l, r+1)))
Problem p02925 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

def main():
    n = int(input())

    A = [0]*n
    for i in range(n):
        a = list(map(int, input().split()))
        a = [a_-1 for a_ in a]
        A[i] = a

    g = [[] for i in range(n*(n-1)//2)]
    id = [[[-1] for i in range(n)] for j in range(n)]

    temp = 0
    for i in range(n-1):
        for j in range(i+1, n):
            id[i][j] = temp
            id[j][i] = temp
            temp += 1

    for i in range(n):
        for j in range(n-2):
            g[id[i][A[i][j]]].append(id[i][A[i][j+1]])

    visit = [-1]*(n*(n-1)*2)
    clc = [-1]*(n*(n-1)*2)
    dp = [1]*(n*(n-1)*2)
    def dfs(v):
        if visit[v] != -1:
            if clc[v] == -1:
                return -1
            return dp[v]
        visit[v] = 0
        for u in g[v]:
            res = dfs(u)
            if res == -1:
                return -1
            dp[v] = max(dp[v], res+1)
        clc[v] = 0
        return dp[v]

    ans = 0
    for i in range(n*(n-1)//2):
        res = dfs(i)
        if res == -1:
            print(-1)
            exit()
        ans = max(ans, res)
    print(ans)

if __name__ == '__main__':
    main()

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

A = [0]*n
for i in range(n):
    a = list(map(int, input().split()))
    a = [a_-1 for a_ in a]
    A[i] = a

g = [[] for i in range(n*(n-1)//2)]
id = [[[-1] for i in range(n)] for j in range(n)]

temp = 0
for i in range(n-1):
    for j in range(i+1, n):
        id[i][j] = temp
        id[j][i] = temp
        temp += 1

for i in range(n):
    for j in range(n-2):
        g[id[i][A[i][j]]].append(id[i][A[i][j+1]])

visit = [-1]*(n*(n-1)*2)
clc = [-1]*(n*(n-1)*2)
dp = [1]*(n*(n-1)*2)
def dfs(v):
    if visit[v] != -1:
        if clc[v] == -1:
            return -1
        return dp[v]
    visit[v] = 0
    for u in g[v]:
        res = dfs(u)
        if res == -1:
            return -1
        dp[v] = max(dp[v], res+1)
    clc[v] = 0
    return dp[v]

ans = 0
for i in range(n*(n-1)//2):
    res = dfs(i)
    if res == -1:
        print(-1)
        exit()
    ans = max(ans, res)
print(ans)
Problem p02959 (python)

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

ans = 0

for i in reversed(range(n+1)):
  if i == n:
    temp = min(a[i], b[i-1])
    ans += temp
    b[i-1] -= temp
  elif i == 0:
    ans += min(a[i], b[i])
  else:
    temp1 = min(a[i], b[i])
    ans += temp1
    a[i] -= temp1
    temp2 = min(a[i], b[i-1])
    ans += temp2
    b[i-1] -= temp2
print(ans)

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

ans = 0
for i in reversed(range(1, n+1)):
    if A[i] <= B[i-1]:
        ans += A[i]
        B[i-1] -= A[i]
        if A[i-1] >= B[i-1]:
            ans += B[i-1]
            A[i-1] -= B[i-1]
        else:
            ans += A[i-1]
            A[i-1] = 0
    else:
        ans += B[i]
        B[i-1] = 0
print(ans)
Problem p02989 (python)

Fixed submission:
n = int(input())
ds = list(map(int, input().split()))
ds.sort()
#print(ds)

abc = ds[:n//2]
arc = ds[n//2:]
#print(abc)
#print(arc)

print(min(arc)-max(abc))

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

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

for i in range(m):
  u, v = map(int, input().split())
  u, v = u-1, v-1
  g[u].append(v)
# print(g)

s, t = map(int, input().split())
s, t = s-1, t-1

visited = [[-1]*3 for j in range(n)]

l = 0
queue = deque([[s, l]])
visited[s][l] = 0
while queue:
  x, l = queue.popleft()
  if [x, l] == [t, 0]:
    print(visited[x][l]//3)
    exit()
  for x_ in g[x]:
    new_x, new_l = x_, (l+1)%3
    if visited[new_x][new_l] == -1:
      visited[new_x][new_l] = visited[x][l]+1
      queue.append([new_x, new_l])
    
print(visited[t][0])
Problem p02990 (python)

Fixed submission:
import math
 
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

if n == k:
  for i in range(1, k+1):
    if i == 1:
      print(1)
    else:
      print(0)
else:
  for i in range(1,k+1):
    if i <= n-k+1:
      p1 = combinations_count(n-k+1, i)
      p2 = combinations_count(k-1, i-1)
      ans = p1*p2
      ans = ans%(10**9+7)
      print(ans)
    else:
      print(0)

Buggy submission (verdict: Runtime Error):
import math
 
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

if n == k:
  for i in range(1, k+1):
    if i == 1:
      print(1)
    else:
      print(0)
else:
  for i in range(1,k+1):
    p1 = combinations_count(n-k+1, i)
    p2 = combinations_count(k-1, i-1)
    ans = p1*p2
    ans = ans%(10**9+7)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
 
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
 
for i in range(1,k+1):
  ans = combinations_count(n-k+1, i)*combinations_count(k-1, i-1)
  ans = ans%(10**9+7)
  print(ans)

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(1,k+1):
  ans = combinations_count(n-k+1, i)*combinations_count(k-1, i-1)
  ans = ans%(10**9+7)
  print(ans)

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(1,k+1):
  ans = combinations_count(n-k+1, i)*combinations_count(k-1, i-1)
  ans = ans%(10**9+7)
  print(ans)

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(1,k+1):
  print((combinations_count(n-k+1, i)*combinations_count(k-1, i-1))%(10**9+7))
Problem p03724 (python)

Fixed submission:
import sys
#sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, m = map(int, input().split())
d = {}
for i in range(n):
    d[i] = 0

for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    d[a] += 1
    d[b] += 1

for v in d.values():
    if v%2 != 0:
        print('NO')
        exit()
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
import sys
#sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, m = map(int, input().split())
d = {}
for i in range(n):
    d[i] = 0

for i in range(n):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    d[a] += 1
    d[b] += 1

for v in d.values():
    if v%2 != 0:
        print('NO')
        exit()
else:
    print('YES')
Problem p03805 (python)

Fixed submission:
N, M = map(int, input().split())
L = [[] for i in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
    
import itertools
count = 0
for p in itertools.permutations(range(N)):
    if p[0] == 0:
#         print("p",p)
        flag = True
        for i in range(N-1):
#             print(p[i+1], L[p[i]])
            if not p[i+1] in L[p[i]]:
                flag = False
#             print(flag)
        if flag:
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
  a, b  = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

import itertools
ans = 0
for p in itertools.permutations(range(n)):
    if p[0] == 0:
        flag = True
        for i in range(n-1):
            if not p[i+1] in l[p[i]]:
                flag = False
        if flag:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
  a, b  = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

import itertools
ans = 0
for p in itertools.permutations(range(n)):
    if p[0] == 0:
        flag = 1
    else:
        flag = 0
        for i in range(n-1):
            if not p[i+1] in l[p[i]]:
                flag = 0
        if flag == 1:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
  a, b  = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

import itertools
ans = 0
for p in itertools.permutations(range(n)):
    if p[0] == 0:
        flag = 1
        for i in range(n-1):
            if not p[i+1] in l[p[i]]:
                flag = 0
        if flag == 1:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
  a, b  = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

import itertools
ans = 0
for p in itertools.permutations(range(n)):
    if p[0] == 0:
        flag = 1
        for i in range(n-1):
            if p[i+1] in l[p[i]]:
                pass
            else:
                flag = 0
    if flag == 1:
        ans += 1
print(ans)
Problem p02594 (python)

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

Buggy submission (verdict: Runtime Error):
if(int(input()) >= 30:
   print('Yes')
else:
   print('No')
Problem p04005 (python)

Fixed submission:
A,B,C = map(int,input().split())
if A%2==0 or B%2==0 or C%2==0:
  print(0)
else:
  print(A*B*C//max({A,B,C}))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll A,B,C;
    cin>>A>>B>>C;
    if(A%2==0||B%2==0||C%2==0) cout<<0<<endl;
    else {
        vector<ll> v;
        v.pb(A);
        v.pb(B);
        v.pb(C);
        sort(all(v));
        cout<<v[0]*v[1]<<endl;
    }
}
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
if k == 1 or (a // k == a / k):
  print('OK')
else:
  n = a // k
  m = b // k
  if m - n >= 1:
    print('OK')
  else:
    print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input())
if k == 1 or (a // k == a / k):
  print('OK')
else:
  n = a // k
  m = b // k
  if m - n >= 1:
    print('OK')
  else:
    print('NG')
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print(int(inpuut())*4)
Problem p02860 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if s(:int(n/2)) == s(int(n/2):):
  print("Yes")
else:
  print("No")
Problem p02711 (python)

Fixed submission:
n = input()
n_list = []
for i in n:
    n_list.append(i)

print("Yes") if n_list[0] == "7" or n_list[1] == "7" or n_list[2] == "7" else print("No")

Buggy submission (verdict: Runtime Error):
n = input()
c=0
for x in n:
    if x=="7":
        print("Yes")
        c+=1
        break
    else:
        pass
if c=3:
    print("No")
Problem p02723 (python)

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

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

Fixed submission:
import math

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

def calculation(number):
    factorial = math.factorial(number)
    combination = factorial/math.factorial(number-2)
    result = math.floor(combination/2)
    return result

if m == 1 or m == 0:
    if n == 1 or n == 0:
        print("0")
    else:
        print("{}".format(calculation(n)))
else:
    if n == 1 or n == 0:
        print("{}".format(calculation(m)))
    else:
        print("{}".format(calculation(n)+calculation(m)))

Buggy submission (verdict: Runtime Error):
import math

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

def calculation(number):
    factorial = math.factorial(number)
    combination = factorial/math.factorial(number-2)
    result = math.floor(combination/2)
    return result

if m == 1 or 0:
    if n == 1 or 0:
        print("0")
    else:
        print("{}".format(calculation(n)))
else:
    if n == 1 or 0:
        print("{}".format(calculation(m)))
    else:
        print("{}".format(calculation(n)+calculation(m)))
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
print(6-(a+b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
print(6-(a+b))
Problem p03127 (python)

Fixed submission:
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

m = min(A)

mod_min = 10**9

for a in A:
    if a % m == 0:
        continue
    mod_min = min(mod_min, a % m)

if mod_min == 10**9:
    print(m)
else:
    print(math.gcd(m, mod_min))

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


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

m = min(A)

mod_min = 10**9

for a in A:
    if a % m == 0:
        continue
    mod_min = min(mod_min, a % m)

if mod_min == 10**9:
    print(m)
else:
    print(max(mod_min % (m % mod_min), 1))

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


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

m = min(A)

mod_min = 10**9

for a in A:
    if a % m == 0:
        continue
    mod_min = min(mod_min, a % m)

if mod_min == 10**9:
    print(m)
else:
    print(mod_min % (m % mod_min))