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

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcdefghijklmnopqrstuvwxyz"])

    for c in s:
        d[c] = d[c] + 1

    count = 1
    for v in [v for v in d.values() if v > 0]:
        count = count * (v+1)
    

    return (count - 1) %(10**9+7)

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcddfghijklmnopqrstuvwxyz"])

    for c in s:
        d[c] = d[c] + 1

    count = 1
    for v in [v for v in d.values() if v > 0]:
        count = count * (v+1)
    

    return (count - 1) %(10**9+7)

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcddfghijklmnopqrstuvwxyz"])

    for c in s:
        d[c] = d[c] + 1

    count = 1
    for v in [v for v in d.values() if v > 0]:
        count = count * (v+1)
    

    return count - 1

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcddfghijklmnopqrstuvwxyz"])

    for c in s:
        d[c] = d[c] + 1

    count = 1
    for v in d.values():
        count = count * (v+1)
    

    return count - 1

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
Problem p03125 (python)

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

def solve(l1):

    l = [int(e) for e in l1.split(" ")]
    a = l[0]
    b = l[1]

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a


    return str(result)

def main():
    # 出力
    params = []
    for i in range(0, 1):
        params.append(input())   
    print(solve(*params))

if __name__ == '__main__':

    main()

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

def parse_input(lines_as_string = None):

    if lines_as_string is None:
        lines = [e for e in input()]
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    params = lines[0].split(" ")
    a = int(params[0])
    b = int(params[1])

    return (a, b)


def solve(a, b):

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a

    return result

def main():
    # 出力

    a, b = parse_input()
    print("%d" % solve(a, b))

if __name__ == '__main__':

    main()

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

def parse_input():
    line = [int(e) for e in input().split(" ")]
    a = line[0]
    b = line[1]

    returnr (a, b)


def solve(a, b):

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a

    return str(result)

def main():
    # 出力

    a, b = parse_input()
    print(solve(a, b))

if __name__ == '__main__':

    main()
Problem p03126 (python)

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

def solve(n, m, *lines):

    
    rows = []
    for line in lines:
        rows.append([int(e) for e in line.split(" ")])

    # print(n)
    # print(m)
    # print(rows)

    result = []
    for k in range(1, m + 1):
        tmp = []
        for i in range(0, n):
#            print(rows[i])
            r = rows[i]
#            print(r[1:r[0] + 1])
            if k in r[1:r[0]+1]:
               tmp.append(i+1)
        if len(tmp) == n:
            result.append(k)

    return str(len(result))

def main():
    # 出力
    params = []
    nm = input().split(" ")
    n = int(nm[0])
    m = int(nm[1])
    params.append(n)
    params.append(m)

    for i in range(0, n):
        params.append(input())   
    print(solve(*params))

if __name__ == '__main__':

    main()

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

def parse_input():

    # 出力
    nm = input().split(" ")
    n = int(nm[0])
    m = int(nm[1])

    rows = []
    for i in range(0, n):
        rows.append([int(e) for e in input().split(" ")])

    return (n, m, rows)

def solve(n, m, rows):

    result = []
    for k in range(1, m + 1):
        tmp = []
        for i in range(0, n):
#            print(rows[i])
            r = rows[i]
#            print(r[1:r[0] + 1])
            if k in r[1:r[0]+1]:
               tmp.append(i+1)
        if len(tmp) == n:
            result.append(k)

    return str(len(result))

def main():

    print(solve(parse_input()))

if __name__ == '__main__':

    main()

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

def parse_input():

    # 出力
    nm = input().split(" ")
    n = int(nm[0])
    m = int(nm[1])

    rows = []
    for i in range(0, n):
        rows.append([int(e) for e in line.split(" ")])

    return (n, m, rows)

def solve(n, m, rows):

    result = []
    for k in range(1, m + 1):
        tmp = []
        for i in range(0, n):
#            print(rows[i])
            r = rows[i]
#            print(r[1:r[0] + 1])
            if k in r[1:r[0]+1]:
               tmp.append(i+1)
        if len(tmp) == n:
            result.append(k)

    return str(len(result))

def main():

    print(solve(parse_input()))

if __name__ == '__main__':

    main()

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

def parse_input():

    # 出力
    params = []
    nm = input().split(" ")
    n = int(nm[0])
    m = int(nm[1])
    params.append(n)
    params.append(m)

    for i in range(0, n):
        params.append(input())   

    rows = []
    for line in lines:
        rows.append([int(e) for e in line.split(" ")])

    return (n, m, rows)

def solve(n, m, rows):

    result = []
    for k in range(1, m + 1):
        tmp = []
        for i in range(0, n):
#            print(rows[i])
            r = rows[i]
#            print(r[1:r[0] + 1])
            if k in r[1:r[0]+1]:
               tmp.append(i+1)
        if len(tmp) == n:
            result.append(k)

    return str(len(result))

def main():

    print(solve(parse_input()))

if __name__ == '__main__':

    main()
Problem p02573 (python)

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

par = list(range(N))
rank = [1]*N
size = [1]*N

def find(x):
  if par[x] == x:
    return x
  else:
    return find(par[x])
  
def unite(x,y):
  x = find(x)
  y = find(y)
  
  if x == y:
    return
  if rank[x]<rank[y]:
    par[x]=y
    size[y]+= size[x]
  else:
    par[y] = x
    size[x] += size[y]
    if rank[x]==rank[y]:
      rank[x]+=1
    
for i in range(M):
  a,b = [int(i)-1 for i in input().split()]
  unite(a,b)
  
print(max(size))

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

par = list(range(N))
rank = [1]*N
size = [1]*N

def find(x):
  if par[x] == x:
    return x
  else:
    return find(par[x])
  
def unite(x,y):
  x = find(x)
  y = find(y)
  
  if x == y:
    return
  if rank[x]<rank[y]:
    x,y = y,x
  else:
  par[y] = x
  size[x] += size[y]
  if rank[x]==rank[y]:
    rank[x]+=1
    
for i in range(M):
  a,b = [int(i)-1 for i in input().split()]
  unite(a,b)
  
print(max(size))

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

par = list(range(N))
rank = [1]*N
size = [1]*N

def find(x):
  if par[x] == x:
    return x
  else:
    return find(par[x])
  
def unite(x,y):
  x = find(x)
  y = find(y)
  
  if x == y:
    return
  if rank[x]<rank[y]:
    x,y = y,x
  par[y] = x
  size[x] += size[y]
  if rank[x]==rank[y]:
    rank[x]
    
for i in range(M):
  a,b = [int(i)-1 for i in input().split()]
  unite(a,b)
  
print(max(size))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)

def uf_find(x):
  if x == p[x]:
    return x
  else:
    p[x] = uf_find(p[x])
    return p[x]

def uf_unite(x,y):
  x = uf_find(x)
  y = uf_find(y)
  if x != y:
    if r[y]>r[x]:
      x,y = y,x
    if r[x]==r[y]:
      r[x]+= 1
    p[y] = x
    #print(r)


N, M = map(int, input().split())
p = list(range(N))
r = [0]*N

for i in range(M):
  A, B = [int(j)-1 for j in input().split()]
  uf_unite(A,B)
  print(p)
  
for i in range(N):
  p[i] = uf_find(i)

q = [0]*N
for i in range(N):
  q[i] = p.count(i)
  
print(max(q))

Buggy submission (verdict: Runtime Error):
def uf_find(x):
  z = x
  while z != p[z]:
    z = p[z]
  p[x] = z
  return z

def uf_unite(x,y):
  global rand
  x = uf_find(x)
  y = uf_find(y)
  if x != y:
    rand += 1
    if rand % 2 ==0:
      p[y] = x
    else:
      p[x] = y

N, M = map(int, input().split())
p = list(range(N))
rand = 0

for i in range(M):
  A, B = [int(j)-1 for j in input().split()]
  uf_unite(A,B)
  print(p)
  
for i in range(N):
  p[i] = uf_find(i)
print(p)

q = [0]*N
for i in range(N):
  q[i] = p.count(i)
  
print(max(q))
Problem p02576 (python)

Fixed submission:
line = [int(i) for i in input().rstrip().split()]
N = line[0]
X = line[1]
T = line[2]
 
if N%X == 0:
	print((N//X)*T)
else:
    print((N//X+1)*T)

Buggy submission (verdict: Runtime Error):
line = [int(i) for i in input().rstrip().split()]
N = line[0]
X = line[1]
T = line[2]

print((N//X+1)*T)line = [int(i) for i in input().rstrip().split()]
N = line[0]
X = line[1]
T = line[2]

if N%X == 0:
	print((N//X)*T)
else:
    print((N//X+1)*T)
Problem p02706 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int,input().split()))
a = sum(A)
 
if N >= a:
  print(int(N-a))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int,input(),split()))
a = sum(A)

if N >= a:
  print(int(N-a))
if N < a:
  print(-1)
Problem p02583 (python)

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

count = 0

for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j] and l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k]:
                count += 1
                
print(count)

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


count = 0

for i in l:
    for j in l:
        for k in l:
            if l[i]+l[j]>l[k] & l[j]+l[k]>l[i] & l[k]+l[i]>l[j] & l[i!=j!=k:
                    count += 1

print(count)
Problem p02717 (python)

Fixed submission:
x, y, z = map(int, input().split())

a = z
b = x
c = y

print(a, b, c)

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

a = z

z = y
y = x
x = a

print(x y z)
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
e = []

for i in range(n):
    e.append(p[i] + 1)

sum_e = [0]

for i in range(1,n+1):
    sum_e.append(sum_e[i-1]+e[i-1])

ans = []

for i in range(n-k+1):
    ans.append(sum_e[i+k]-sum_e[i])

print(max(ans)/2)

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

for i in range(0,n-n%k):
    sum = 0
    for j in range(i,i+k):
        sum += p[j]
    if sum > max:
        e = []
        for j in range(i, i+k):
            e.append(p[j])

for i in range(k):
    x = 0
    for j in range(e[i]+1):
        x += j
    x /= e[i]
    ans += x    

print(ans)
Problem p02646 (python)

Fixed submission:
A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
D=abs(A-B)
S=V-W
if (S<=0):
    print("NO")
elif (D / S <= T):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
check=0
if (V>W) & (abs(A-B) / (V-W) <= T) & (abs(A-B) % (V-W) == 0):
    check=1
else:
    for i in range(T):
        if B>A:
            B=B+W
            A=A+V
        elif B<A:
            B=B-W
            A=A-V
        if A==B:
            check=1
            break
if check==1:
    print("YES")
else:
    print("NO")
Problem p02687 (python)

Fixed submission:
S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
S=input()split()
if S=="ABC":
    print("ARC")
else:
    print("ABC")
Problem p02783 (python)

Fixed submission:
import math
H,A=map(int, input().split())
print(math.ceil(H / A))

Buggy submission (verdict: Runtime Error):
H,N=map(int, input().split())
v = list(input().split())
v = [int(x) for x in v]
if H <= sum(v):
    print("Yes")
else:
    print("No")
Problem p02811 (python)

Fixed submission:
K,X = map(int, input().split())
v = 500 * K
if v >= X:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
K,X = map(int, input().split())
v = 500 * K
if s >= X:
    print("Yes")
else:
    print("No")
Problem p02818 (python)

Fixed submission:
a,b,k = map(int, input().split())
a1 = max(a - k, 0)
if a1 >= 1:
    a2 = b
else:
    a2 = a + b - k
if a2 < 0:
    a2 = 0
print(a1, a2)

Buggy submission (verdict: Runtime Error):
a1 = max(a - k, 0)
if a1 >= 1:
    a2 = b
else:
    a2 = a + b - k
if a2 < 0:
    a2 = 0
print(a1, a2)
Problem p02756 (python)

Fixed submission:
s = input()
q = int(input())

rev = 0
front = ""
back = ""
all_rev = 0

for i in range(q):
    t = input().split()

    # T_1 = 1の時
    if len(t) == 1:
        rev += 1
        all_rev += 1

    # T_1 = 2の時
    else:
        if rev%2 == 1:
            if t[1] == '1':
                back = back + t[2]
            else:
                front = t[2] + front
        else:
            if t[1] == '1':
                front = t[2] + front
            else:
                back = back + t[2]

# 反転するとき
if all_rev%2 == 1:
    s = s[::-1]
    front,back = back[::-1],front[::-1]

print(front + s + back)

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

s = deque(input())
q = int(input())
rev = 0 # revが0のとき先頭、1のとき後尾

for _ in range(q):
    t = input().split()

    if len(t) == 1:
        rev ^= 1
    else:
        if rev == 1:
            if t[1] == '1':
                s.append(t[2])
            else:
                s.appendleft(t[2])
        else:
            if t[1] == '1':
                s.appendleft(t[2])
            else:
                s.append(t[2])

if rev == 1:
    s.reverse()

for i in range(len(word)):
    print(s[i],end='')

print()
Problem p02910 (python)

Fixed submission:
import sys

a = input()
l = True

for i in range(len(a)):
    if i % 2 == 1:
        if a[i] == 'R':
            l = False

    if i % 2 == 0:
        if a[i] == 'L':
            l = False

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

Buggy submission (verdict: Runtime Error):
import sys

number = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
answer = 0

for i in range(number):
    answer += b[a[i]-1]
    
    if i != 0:
        if a[i-1] == a[i]-1:
            answer += c[a[i-1]-1]

print(answer)

Buggy submission (verdict: Runtime Error):
import sys

number = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
answer = 0

for i in range(number):
    answer += b[a[i]-1]
    
    if i != 0:
        if a[i-1] == a[i]-1:
            answer += c[a[i-1]-1]

print(answer)
Problem p02607 (python)

Fixed submission:
def solve():
    n = int(input())
    a = list(map(int,input().split()))
    cnt = 0
    for i in range(n):
        if i%2==0 and a[i]%2==1:
            cnt+=1
    print(cnt)
if __name__=='__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    a = list(map(int,input().split()))
    cnt = 0
    for i in range(n):
        if i%2==0 and a[i]%2==1:
            cnt+=1
    print(cnt)
if __name__=='__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    a = list(map(int,input().split()))
    cnt = 0
    for i in range(n):
        if i%2==0 and a%2==1:
            cnt+=1
    print(cnt)
if __name__=='__main__':
    solve()
Problem p02639 (python)

Fixed submission:
def solve():
    l = list(map(int,input().split()))
    for i in range(5):
        if(l[i]==0):
            print(i+1)
if __name__=='__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    l = list(map(int,input().split()))
    for i in range(5):
        if(l[i]==0){
            print(i+1)
        }
if __name__=='__main__':
    solve()
Problem p02814 (python)

Fixed submission:
def culuc(a):
    cnt = 0
    while a%2==0:
        a//=2
        cnt+=1
    return cnt
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)
n,m = map(int,input().split())
a = list(map(int,input().split()))
cnt = culuc(a[0])
for i in a:
    if culuc(i)!=cnt:
        print(0)
        exit()
res = a[0]//2
for i in a:
    res = lcm(res,i//2)
    if res>m:
        print(0)
        exit()
print((m//res+1)//2)

Buggy submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())
l = list(map(int,input().split()))
lm = 1
lm_harf = 1
for i in l:
    lm = lm*i//math.gcd(lm,i)
    lm_harf = lm_harf*(i//2)//math.gcd(lm_harf,(i//2))
print(m//lm_harf-m//lm)

Buggy submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())
l = list(map(int,input().split()))
lcm = 1
lcm_harf = 1
for i in l:
    lcm = lcm*i//math.gcd(lcm,i)
    lcm_harf = lcm_harf*i//2//math.gcd(lcm_harf,i//2)
print(m//lcm_harf-m//lcm)
Problem p02824 (python)

Fixed submission:
from collections import Counter
n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
tmp = a[p-1]
ans = p
l = 0
r = n
if v <= p:
    for i in range(p, n):
        if a[i]+m >= tmp:
            ans += 1
    print(ans)
    exit()
while l<r-1:
    mid = (l+r)//2
    if mid<=p:
        l = mid
        continue
    if a[mid]+m<tmp:
        r = mid
    else:
        thresh = a[mid]+m 
        amari = (v-p)*m
        for i in range(p-1,n):
            if i==mid:
                continue
            amari-=min(m,thresh-a[i])
        if amari<=0:
            l = mid
        else:
            r=mid
print(l+1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
tmp = a[p-1]
ans = p
l = 0
r = n+1
if v <= p:
    for i in range(p, n):
        if a[i]+m >= tmp:
            ans += 1
    print(ans)
    exit()
while l<r:
    mid = (l+r)//2
    a[n]
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(max(a+b,a-b,a*b))
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
print(0) if x<a else print(10)

Buggy submission (verdict: Runtime Error):
x,a = map(int,input().split())
print(min(10,(x//a)*10))
Problem p03059 (python)

Fixed submission:
a,b,t = map(int,input().split())
ans = t//a
print(ans*b)

Buggy submission (verdict: Runtime Error):
a,b,t = map(int(input().split()))
ans = t//a
print(ans*b)
Problem p03195 (python)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(n)]
fl = True
for i in l:
    fl&=(i%2==0)
if fl:
    print('second')
else:
    print('first')

Buggy submission (verdict: Runtime Error):
n = int (input())
l = [int(input()) for i in range(n)]
fl = true
for i in l:
    fl&=(i%2==0)
if fl:
    print('second')
else:
    print('first')

Buggy submission (verdict: Runtime Error):
n = int (input())
l = [int(input()) for i in range(n)]
fl = true
for i in n:
    fl&=(i%2==0)
if fl:
    print('second')
else:
    print('first')
Problem p03281 (python)

Fixed submission:
def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if i%2==0:
            continue
        d = 0
        for j in range(1,i+1):
            if i%j==0:
                d+=1
        if d==8:
            ans+=1
    print(ans)
if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
str=input()
n=int(str)
c=0
ans=0
for num in range(1,n):
    for number in range(1,num):
        if num%number==0:
            c+=1
    if c==8:
        d+=1
print(d)
Problem p03282 (python)

Fixed submission:
s = input()
t =int(input())
for i in range(t):
  if s[i]!='1':
    print(s[i])
    exit()
print('1')

Buggy submission (verdict: Runtime Error):
s = input()
t  =input()
print(s.replace('1','')[0])

Buggy submission (verdict: Runtime Error):
#include<stdio.h>
int main(void)
{
    char s[101]; 
    unsigned long k;
    scanf("%s",&s);
    scanf("%u,&k);
    int len=0;
    int i;
    char ans[2]="1";
    while(s[len++])
    int c=len<k?k:len;
    for(i=0;i<c;i++)
    {
        if(s[i]!='1')
            {ans[0]=s[i];  break;}
    }
    printf("%s",ans);
return 0;
}

Buggy submission (verdict: Runtime Error):
s=input()
k=input()
a=int(s[0])

for num in range(0,max(len(s),k)):
    if int(s[num])==1:
        print(1)
    else:
        print(s[num])
Problem p03288 (python)

Fixed submission:
a=input()
if int(a)<1200:
    print("ABC")
elif int(a)<2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
a=int(input())
if a<1200:
	print('ABC')
elif 1200<a<2800:
	print('ARC')
else
	print('AGC')

Buggy submission (verdict: Runtime Error):
a=input()
if a<1200:
  print('ABC')
elif 1200<a<2800:
  print('ARC')
else
  print('AGC')
Problem p03434 (python)

Fixed submission:
input()
a = list(map(int,input().split()))
a.sort()
a = a[::-1]
print(sum(a[::2])-sum(a[1::2]))

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int,input().split()))
a.sorted()
print(sum(a[::2])-sum(a[1::2]))
Problem p03481 (python)

Fixed submission:
def solve():
    a,y = map(int,input().split())
    ans = 1
    while(a<=y):
        a*=2
        ans+=1
    print(ans-1)
if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    a,y = map(int,input().split())
    ans = 1
    while(a<=y){
        a*=2
        ans+=1
    }
    print(ans)
if __name__ == "__main__":
    solve()
Problem p03598 (python)

Fixed submission:
n=int(input())
k=int(input())
a=list(map(int,input().split()))
ans = 0
for i in a:
    ans+=min(i*2,abs(k-i)*2)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
a=list(map(int,input().split()))
ans = 0
for i in a:
    ans+=min(a*2,abs(k-a)*2)
print(ans)
Problem p03633 (python)

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


n = int(input())
ans = 1
l = [int(input()) for i in range(n)]

for i in l:
    ans = ans*i//gcd(ans,i)
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)


n = int(input())
ans = 1
l = [int(input()) for i in range(n)]

for i in l:
    ans = ans*i/gcd(ans,i)
print(int(ans))