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

Fixed submission:
def MAP(): return map(int,input().split())
import math

a,b = MAP()
print(math.ceil((b-a)/(a-1))+1)

Buggy submission (verdict: Runtime Error):
a,b = MAP()
ans=1
while a<b:
    a += a-1
    ans += 1
print(ans)
Problem p02936 (python)

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

def dfs(v,p):
    for i in tree[v]:
        if i==p:
            continue
        res[i]+=res[v]
        dfs(i,v)

n,q = map(int, input().split())
tree = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

res = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    res[p-1] += x

dfs(0,-1)
print(*res)

Buggy submission (verdict: Runtime Error):
def dfs(v,p):
    for i in tree[v]:
        if i==p:
            continue
        res[i]+=res[v]
        dfs(i,v)

n,q = map(int, input().split())
tree = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

res = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    res[p-1] += x

dfs(0,-1)
print(*res)

Buggy submission (verdict: Runtime Error):
def dfs(v,p):
    for i in tree[v]:
        if i==p:
            continue
        res[i]+=res[v]
        dfs(i,v)

n,q = map(int, input().split())
tree = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

res = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    res[p-1] += x

dfs(0,0)
print(*res)

Buggy submission (verdict: Runtime Error):
def dfs(tree,node,x,ans):
    ans[node-1]+=x
    if node in tree:
        for i in tree[node]:
            dfs(tree,i,x,ans)


n,q = map(int, input().split())
tree = {}
for i in range(n-1):
    a,b = map(int,input().split())
    if not(a in tree):
        tree[a] = [b]
    else:
        tree[a].append(b)

ans = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    dfs(tree,p,x,ans)

print(*ans)

Buggy submission (verdict: Runtime Error):
def dfs(tree,node,x,ans):
    ans[node-1]+=x
    if node in tree:
        for i in tree[node]:
            dfs(tree,i,x,ans)


n,q = map(int, input().split())
tree = {}
for i in range(n-1):
    a,b = map(int,input().split())
    if not(a in tree):
        tree[a] = [b]
    else:
        tree[a].append(b)

ans = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    dfs(tree,p,x,ans)

print(*ans)
Problem p02972 (python)

Fixed submission:
n = int(input())
*a, = map(int,input().split())
box = [0]*n
for i in range(n,0,-1):
    sum_box = 0
    for j in range(i,n+1,i):
        sum_box+=box[j-1]
    if sum_box%2!=a[i-1]:
        box[i-1]+=1

print(sum(box))
if sum(box):
    ans = []
    for i, x in enumerate(box):
        if x:
            ans.append(i+1)
    print(*ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
*a, = map(int,input().split())
box = [0]*n
for i in range(n,0,-1):
    sum = 0
    for j in range(i,n+1,i):
        sum+=box[j-1]
    if sum%2!=a[i-1]:
        box[i-1]+=1

print(sum(box))
if sum(box):
    ans = []
    for i, x in enumerate(box):
        if x:
            ans.append(i)
    print(*ans)
Problem p02995 (python)

Fixed submission:
A,B,C,D = map(int,input().split())

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

def num(N,c,d):
    lcm = (c*d)//gcd(c,d)
    return N - (N//c) - (N//d) +  N//lcm

print(num(B,C,D)-num(A-1,C,D))

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

import math

def num(N,c,d):
    lcm = (c*d)//math.gcd(c,d)
    return N - (N//c) - (N//d) +  N//lcm

print(num(B,C,D)-num(A-1,C,D))
Problem p03000 (python)

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

d = [0]
count = 0
for i in range(n):
    d.append(d[i]+l[i])
for i in range(n+1):
    if d[i] <= x:
        count += 1
        
print(count)

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

point = 0
count = 0
while point <= x:
    point = point + l[count]
    count += 1

print(count)
Problem p03032 (python)

Fixed submission:
def MAP(): return map(int,input().split())

n,k = MAP()
*v, = MAP()

operation = min(n,k) #取り出すMAX回数
ans=0

for i in range(1,operation+1):
    for j in range(i+1):
        A = j   #左側から取り出す回数
        B = i-j    #右側から取り出す回数
        t = v[:A]
        if B>0:
            t+=v[-B:]
        t.sort()

        l = min(k-i,i-1)
        for ll in range(l):
            if t[ll] >= 0:
                l = ll
                break
        s = sum(t[l:])
        ans = max(ans,s)

print(ans)

Buggy submission (verdict: Runtime Error):
def A(lst,hand):
    if len(lst) == 0:
        return
    else:
        return lst.pop(0)

def B(lst,hand):
    if len(lst) == 0:
        return
    else:
        return lst.pop(len(lst)-1)

def C(lst,hand):
    if len(hand) == 0:
        return
    else:
        lst.insert(0 , hand.pop( hand.index(min(hand)) ))

def D(lst,hand):
    if len(hand) == 0:
        return
    else:
        lst.append(hand.pop( hand.index(min(hand))) )

import random

if __name__ == "__main__":
    N,K = map(int, input().split())
    V = input().split()
    V = [int(i) for i in V]
    hand = []

    for l in range(10000):
        V_copy = [i for i in V]
        hand_copy = []
        for i in range(K):
            rand = random.randint(1,4)
            if rand == 1:
                hand_copy.append(A(V_copy,hand_copy))
            elif rand == 2:
                hand_copy.append(B(V_copy,hand_copy))
            elif rand == 3:
                C(V_copy,hand_copy)
            else:
                D(V_copy,hand_copy)
        hand.append(hand_copy)

    x = []
    for i in range(10000):
        x.append(sum(hand[i]))
    print(max(x))

Buggy submission (verdict: Runtime Error):
def A(lst,hand):
    if len(lst) == 0:
        return
    else:
        return lst.pop(0)

def B(lst,hand):
    if len(lst) == 0:
        return
    else:
        return lst.pop(len(lst)-1)

def C(lst,hand):
    if len(hand) == 0:
        return
    else:
        lst.insert(0 , hand.pop( hand.index(min(hand)) ))

def D(lst,hand):
    if len(hand) == 0:
        return
    else:
        lst.append(hand.pop( hand.index(min(hand))) )

import random

if __name__ == "__main__":
    N,K = map(int, input().split())
    V = input().split()
    V = [int(i) for i in V]
    hand = []

    for l in range(1000):
        V_copy = [i for i in V]
        hand_copy = []
        for i in range(K):
            rand = random.randint(1,4)
            if rand == 1:
                hand_copy.append(A(V_copy,hand_copy))
            elif rand == 2:
                hand_copy.append(B(V_copy,hand_copy))
            elif rand == 3:
                C(V_copy,hand_copy)
            else:
                D(V_copy,hand_copy)
        hand.append(hand_copy)

    x = []
    for i in range(1000):
        x.append(sum(hand[i]))
    print(max(x))
Problem p03061 (python)

Fixed submission:
def MAP(): return map(int,input().split())
def gcd(a, b):
    while b:
        a %= b
        a, b = b, a
    return a

n = int(input())
*a, = MAP()

x=[0 for _ in range(n)]
y=[0 for _ in range(n)]
for i in range(1,n):
    x[i]=gcd(x[i-1],a[i-1])
for i in range(n-1)[::-1]:
    y[i]=gcd(y[i+1],a[i+1])
Z=[gcd(x[i],y[i]) for i in range(n)]
print(max(Z))

Buggy submission (verdict: Runtime Error):
def MAP(): return map(int,input().split())
import math

n = int(input())
*a, = MAP()

mx = max(a)
a = sorted(a,key=lambda x:math.gcd(mx,x))
print(math.gcd(a[1],mx))

Buggy submission (verdict: Runtime Error):
def MAP(): return map(int,input().split())
import math

n = int(input())
*a, = MAP()

mx = max(a)
a = sorted(a,key=lambda x:math.gcd(mx,x))
print(math.gcd(a[1],mx))
Problem p03074 (python)

Fixed submission:
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n,k = MAP()
s = input()
k*=2

lst = [0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        lst.append(i+1)

r = len(lst)
lst += [n]
ans=[]
for i in range(r):
    if s[lst[i]]=="0":
        ans.append(lst[min(i+k,r)] - lst[i])
    else:
        ans.append(lst[min(i+k+1,r)] - lst[i])

print(max(ans))

Buggy submission (verdict: Runtime Error):
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n,k = MAP()
s = input()
k*=2

lst = [0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        lst.append(i+1)

r = len(lst)
lst += [n]*10
ans=[]
for i in range(r):
    if s[lst[i]]=="0":
        ans.append(lst[i+k] - lst[i])
    else:
        ans.append(lst[i+k+1] - lst[i])

print(max(ans))

Buggy submission (verdict: Runtime Error):
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n,k = MAP()
s = input()
k*=2

lst = [0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        lst.append(i+1)

r = len(lst)
lst += [n]*10
ans=[]
for i in range(r):
    if s[lst[i]]=="0":
        ans.append(lst[i+k] - lst[max(i-1,0)])
    else:
        ans.append(lst[i+k+1] - lst[i])

print(max(ans))
Problem p03161 (python)

Fixed submission:
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n,k = MAP()
h = MAP()

dp = [MOD]*n
dp[0]=0

for i in range(n-1):
    for j in range(i+1,min(i+k+1,n)):
        dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]))
print(dp[n-1])

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

dp = [10**9]*n
dp[0] = 0

for i in range(n):
    for j in range(1,k+1):
        if i+j>=n:
            break
        dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
    print(dp)
Problem p03240 (python)

Fixed submission:
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()

x = []
y = []
h = []
for i in range(n):
    xx,yy,hh = MAP()
    x.append(xx)
    y.append(yy)
    h.append(hh)

kk = h.index(max(h))
k = 0

for i in range(101):
    for j in range(101):
        ass = h[kk] + abs(x[kk]-i) + abs(y[kk]-j)
        for r in range(n):
            if h[r]==0:
                if ass-abs(x[r]-i)-abs(y[r]-j)>0:
                    ass = -1
                    break
            else:
                if ass != abs(x[r]-i)+abs(y[r]-j)+h[r]:
                    ass = -1
                    break
        if ass!=-1:
            print(i,j,ass)
            break

Buggy submission (verdict: Runtime Error):
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()

ans = []
x,y,h = MAP()
for i in range(101):
    for j in range(101):
        ans.append((i,j,h+abs(i-x)+abs(j-y)))

for i in range(n-1):
    tmp = []
    x,y,h = MAP()
    for j in range(101):
        for k in range(101):
            if (j,k,h+abs(j-x)+abs(k-y)) in ans:
                tmp.append((j,k,h+abs(j-x)+abs(k-y)))
    ans = tmp

print(*ans[0])

Buggy submission (verdict: Runtime Error):
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()

ans = []
x,y,h = MAP()
for i in range(101):
    for j in range(101):
        ans.append((i,j,h+abs(i-x)+abs(j-y)))

for i in range(n-1):
    tmp = []
    x,y,h = MAP()
    for j in range(101):
        for k in range(101):
            if (j,k,h+abs(j-x)+abs(k-y)) in ans:
                tmp.append((j,k,h+abs(j-x)+abs(k-y)))
    ans = tmp

print(*ans[0])
Problem p02705 (python)

Fixed submission:
import math

R = (int)(input())
print(2*math.pi*R)

Buggy submission (verdict: Runtime Error):
import math
R = int(intput())

print(2*math.pi*R)
Problem p02791 (python)

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

count = 1
if N == 1:
  print(count)
else:
  min = P[0]
  if P[1] <= P[0]:
    count+=1
    min = P[1]

  for i in range(2,N):
    if P[i] <= min:
      count+=1
      min = P[i]
  print(count)

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

count = 1
if P[1] <= P[0]:
  count+=1
for i in range(2,N):
  if P[i] <= min(P[:i-1]):
    count+=1
print(count)
Problem p02887 (python)

Fixed submission:
N = int(input())
S = input()

i, j = 0, 1
count = 0
if N == 1:
  print(1)
else:
  while j < N:
    if j < N-1:
      if S[i] == S[j]:
        j += 1
      elif S[i] != S[j]:
        count += 1
        i = j
        j += 1
    elif j == N-1:
      if S[i] == S[j]:
        count += 1
      elif S[i] != S[j]:
        count += 2
      break
  print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

i, j = 0, 1
count = 0
while 1:
  while S[i] == S[j]:
    j += 1
    if j == N:	break
  if j == N:
    count += 1
    break
  elif S[i] != S[j] and j == N-1:
    count += 2
    break
  else:
    count += 1
    i = j
    j += 1
    if j == N:
      count += 1
      break
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

i, j = 0, 1
count = 0
while 1:
  while S[i] == S[j]:
    j += 1
    if j == N:	break
  if j == N:
    count += 1
    break
  elif S[i] != S[j] and j == N-1:
    count += 2
    break
  else:
    count += 1
    i = j
    j += 1
    if j == N:
      break
print(count)
Problem p03000 (python)

Fixed submission:
import numpy as np
N,X = map(int, input().split())
L = list(map(int, input().split()))

dist = np.zeros(N+1, dtype=int)
for i in range(N):
  dist[i+1] = dist[i] + L[i]

i = 0
count = 0
while dist[i] <= X:
  count += 1
  i += 1
  if i == N +1:
    break
print(count)
"""
dist = 0
count = 1
for i in range(N):
  if dist + L[i] <= X:
    count += 1
    dist += L[i]
print(count)
"""

Buggy submission (verdict: Runtime Error):
import numpy as np
N,X = map(int, input().split())
L = list(map(int, input().split()))

dist = np.zeros(N+1, dtype=int)
for i in range(N):
  dist[i+1] = dist[i] + L[i]

i = 0
count = 0
while dist[i] <= X:
  count += 1
  i += 1
print(count)
"""
dist = 0
count = 1
for i in range(N):
  if dist + L[i] <= X:
    count += 1
    dist += L[i]
print(count)
"""
Problem p03289 (python)

Fixed submission:
S = input()

flag = 1
c_count = 0
if S[0] == 'A':
  for i in range(1,len(S)):
    if 2 <= i <= len(S)-2:
      if S[i] == 'C':
        c_count += 1
    else:
      if S[i].islower() == False:
        flag = 0
else:
  flag = 0
if c_count == 1 and flag == 1:
  print('AC')
else:
  print('WA')

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

flag = 1
if S[0] == 'A':
  c_count = 0
  for i in range(1,len(S)):
    if 2 <= i <= len(S)-2:
      if S[i] == 'C':
        c_count += 1
    else:
      if S[i].islower() == False:
        flag = 0
else:
  flag = 0
if c_count == 1 and flag == 1:
  print('AC')
else:
  print('WA')
Problem p03294 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

# ユークリッドの互除法により最大公約数を求める
ans = 0
val1, val2 = a[0], a[1]
while 1:
  if val1 % val2 == 0:
    ans = a[0]*a[1]//val2
    break
  else:
    tmp = val2
    val2 = val1 % val2
    val1 = tmp

for i in range(2, N):
  val1, val2 = ans, a[i]
  while 1:
    if val1 % val2 == 0:
      ans *= a[i]//val2
      break
    else:
      tmp = val2
      val2 = val1 % val2
      val1 = tmp

f_ans = 0
for i in range(N):
  f_ans += (ans-1)%a[i]
print(int(f_ans))

Buggy submission (verdict: Runtime Error):

コンテスト時間: 2018-07-21(土) 21:00 ~ 2018-07-21(土) 22:40 (100分)AtCoderホームへ戻る
 トップ
 問題
 質問
 提出
 提出結果
 順位表
 バーチャル順位表
 コードテスト
 解説
コードテスト
言語

ソースコード
)
1
N = int(input())
2
a = list(map(int, input().split()))
3
a.sort(reverse=True)
4
​
5
# ユークリッドの互除法により最大公約数を求める
6
ans = 0
7
val1, val2 = a[0], a[1]
8
while 1:
9
  if val1 % val2 == 0:
10
    ans = a[0]*a[1]/val2
11
    break
12
  else:
13
    tmp = val2
14
    val2 = val1 % val2
15
    val1 = tmp
16
​
17
for i in range(2, N):
18
  val1, val2 = ans, a[i]
19
  while 1:
20
    if val1 % val2 == 0:
21
      ans = ans*a[i]/val2
22
      break
23
    else:
24
      tmp = val2
25
      val2 = val1 % val2
26
      val1 = tmp
27
​
28
f_ans = 0
29
for i in range(N):
30
  f_ans += (ans-1)%a[i]
31
print(int(f_ans))
32
  
33
      
34
  
※ 512 KiB まで
※ ソースコードは「Main.拡張子」で保存されます

  
標準入力
7
994 518 941 851 647 2 581
※ 512 KiB まで

終了コード	0
実行時間	17 ms
メモリ	2964 KB
標準出力
4527

標準エラー出力
FacebookTwitterHatena共有
ルール 用語集
利用規約 プライバシーポリシー 個人情報保護方針 企業情報 よくある質問 お問い合わせ 資料請求
Copyright Since 2012 ©AtCoder Inc. All rights reserved.
Problem p04043 (python)

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

if (A == 5 and B == 5 and C == 7) or (A == 5 and B == 7 and C == 5) or (A == 7 and B == 5 and C == 5):
  print('YES')
else:
  print('NO')

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

total = 0
tmp1, tmp2 = 1, 1		# 初期化
tmp3, tmp4 = 1, 1		# 初期化
for i in range(B,W,1):
  conv1, conv2 = 0, 0	# 初期化
  if i == B:
    for j in range(i):
      tmp1 *= i+(H-A-1)-j
    tmp1 %= (10**9+7)
    for j in range(i, 0, -1):
      tmp2 *= j
    tmp2 %= (10**9+7)
  else:
    tmp1 *= i+(H-A-1)
    tmp1 %= (10**9+7)
    tmp2 *= i
    tmp2 %= (10**9+7)
  conv1 = tmp1/tmp2
  
  if i == B:
    for j in range(W-1-i):
      tmp3 *= (A-1)+(W-1-i)-j
    tmp3 %= (10**9+7)
    for j in range(W-1-i, 0, -1):
      tmp4 *= j
    tmp4 %= (10**9+7)
  else:
    tmp3 *= W-1-i+1
    tmp3 %= (10**9+7)
    tmp4 *= (A-1)+(W-1-i)+1
    tmp4 %= (10**9+7)
  conv2 = tmp3/tmp4
  total += conv1*conv2
print(int(total))
Problem p03424 (python)

Fixed submission:
N = int(input())
v = []
S = input().split()

for s in S:
    if not s in v:
        v.append(s);

if len(v) == 3:
    print("Three")
else:
    print("Four")

Buggy submission (verdict: Runtime Error):
N = int(input())
v = []
for i in range(N):
    s = input()
    if !(s in v):
        v.append(s);

if len(v) == 3:
    print("Three")
else:
    print("Four")
Problem p03474 (python)

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

if S[A] == '-' and S[0:A].isdigit() and S[A+1:A+B+1].isdigit():
  print("Yes")
else:
  print("No")

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

if S[A] == '-' and isdigit(S[0:A]) and isdigit(S[A+1:A+B+1]):
  print("Yes")
else:
  print("No")

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

if S[A] == '-' or isdigit(S[0:A]) or isdigit(S[A+1:A+B+1]):
  print("No")
else:
  print("Yes")
Problem p03556 (python)

Fixed submission:
import math
N = int(input())
ans = 0
for i in range(1, int(math.sqrt(N))+1):
  if(i == int(math.sqrt(i))*int(math.sqrt(i))):
    ans = i
    
print(i*i)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
int ans = 0;
for i in range(1, math.sqrt(N+1)):
  if(i == int(math.sqrt(i))*int(math.sqrt(i))):
    ans = i
    
print(i)
Problem p03624 (python)

Fixed submission:
S=input()
s="abcdefghijklnmopqrstuvwxyz"
s = list(s)
  
for si in S:
  if si in s:
  	s.remove(si)
    
if s == []:
  print("None")
else:
  print(s[0])

Buggy submission (verdict: Runtime Error):
S=input()
s="abcdefghijklnmopqrstuvwxyz"
s = list(s)
  
for si in S:
  if si in s:
  	s.remove(si)
    
if s == "":
  print("None")
else:
  print(s[0])

Buggy submission (verdict: Runtime Error):
S=input()
s="abcdefghijklmnopqrstucwxyz"

for si in s:
  if si in S
  	S.remove(si)
    
if S == "":
  print("None")
else:
  S.sort()
  print(S[0])
Problem p03632 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
ans = 0
for i in range(0, 101):
  if A <= i and i < B and C <= i and i < D:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
ans = 0
for i in range(1, 101)
if A <= i and i <= B amd C <= i and i <= D:
  ans += 1
print(ans)
Problem p03730 (python)

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

for i in range(0,B):
  if (A*(i+1)) % B == C:
    print("YES")
    exit()

print("NO")

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

a = A % B

if C % a == 0 or a % C == 0:
  print("YES")
else:
  print("NO")
Problem p03777 (python)

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

if a == "H":
    if b == "H":
        print("H")
    else:
        print("D")
else:
    if b == "H":
        print("D")
    else:
        print("H")

Buggy submission (verdict: Runtime Error):
a,b = input().split()

if a == "H"
    if b == "H":
        print("H")
    else:
        print("D")
else:
    if b == "H":
        print("D")
    else:
        print("H")

Buggy submission (verdict: Runtime Error):
a,b = input().split()

if a == 'H'
    if b == 'H':
        print('H')
    else:
        print('D')
else:
    if b == 'H':
        print('D')
    else:
        print('H')
Problem p03796 (python)

Fixed submission:
N = int(input())
ans = 1
for i in range(1, N+1):
  ans *= i
  ans %= 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 1
for i in range(1, N+1):
  (ans *= i) %= 1000000007
print(ans)
Problem p03861 (python)

Fixed submission:
def w(p, c):
  return p // c

A,B,X = map(int, input().split())
print(w(B,X)-w(A-1, X))

Buggy submission (verdict: Runtime Error):
def w(p, c):
  return p // c

A,B,X = map(int, input().split())
print(w(B)-w(A-1))
Problem p03963 (python)

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

ans = K
for i in range(N-1):
  ans *= (K-1)
  
print(ans)

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

ans = K
for i in range(N-1):
  K *= (k-1)
  
print(ans)
Problem p02553 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, imput().split())
print(max(a*c,a*d,b*d,b*c))
Problem p02576 (python)

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

ans = ((n // x) + int(bool(n%x)))*t
print(ans)

Buggy submission (verdict: Runtime Error):
n, x, t = map(int, input())

ans = ((n // x)+int(bool(n%x)))*t

print(ans)
Problem p02576 (python)

Fixed submission:
n,x,t=map(int,input().split())
m=t
a=x
while(x<n):
  x+=a
  t+=m
print(t)

Buggy submission (verdict: Runtime Error):
n,x,t=map(int,input().split())
u=x
v=t
while(x<n):
  x+=u
  a+=v
print(t)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int, input(),split)
print(a*b)
Problem p02705 (python)

Fixed submission:
import math
a =input()
print(float(a)*2*math.pi)

Buggy submission (verdict: Runtime Error):
a=input()
print(a*2*3.1415)

Buggy submission (verdict: Runtime Error):
import math
a =input()
print(froat(a)*2*math.py)
Problem p02717 (python)

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

tmp = array[0]
array[0] = array[1]
array[1] = tmp

tmp = array[0]
array[0] = array[2]
array[2] = tmp


print("%d %d %d" %(array[0], array[1], array[2]))

Buggy submission (verdict: Runtime Error):
array = list(map(int, input().split()))
if (array[0] > array[1]):
  tmp = array[0]
  arrat[0] = array[1]
  array[1] = tmp

if (array[1] > array[2]):
  tmp = array[1]
  arrat[1] = array[2]
  array[2] = tmp

if (array[0] > array[2]):
  tmp = array[0]
  arrat[0] = array[2]
  array[2] = tmp

print("%d %d %d" %(array[0], array[1], array[2]))