Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02761
N, M = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(M)] for i in range(1,1000): t = str(i) if len(t) != N: continue flg = True for item in data: if t[item[0]-1] != str(item[1]): flg = False break if flg: print(i) exit() print(-1)
N, M = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(M)] for i in range(1000): t = str(i) if len(t) != N: continue flg = True for item in data: if t[item[0]-1] != str(item[1]): flg = False break if flg: print(i) exit() print(-1)
[ "call.arguments.change" ]
552,053
552,054
u325282913
python
p02761
N,M = map(int, input().split()) num = [] out = 0 for n in range(N): num.append(-1) for i in range(M): s,c = map(int, input().split()) if num[s-1] == -1: num[s-1] = c elif num[s-1] != c: print(-1) exit() for i in range(N): if num[i] == -1: num[i] = (1 if i == 0 else 0) if N>1 and num[0] == 0: print(-1) exit() for i in range(N): out += num[i]*(10**(N-i-1)) print(out)
N,M = map(int, input().split()) num = [] out = 0 for n in range(N): num.append(-1) for i in range(M): s,c = map(int, input().split()) if num[s-1] == -1: num[s-1] = c elif num[s-1] != c: print(-1) exit() for i in range(N): if num[i] == -1: num[i] = (1 if N>1 and i == 0 else 0) if N>1 and num[0] == 0: print(-1) exit() for i in range(N): out += num[i]*(10**(N-i-1)) print(out)
[]
552,059
552,060
u577725859
python
p02761
N, M = map(int, input().split()) X = [-1] * N#[-1,-1,-1.....] for i in range(M): s, c = map(str, input().split()) if s == 1 and N > 1 and c==0: print(-1) exit()#プログラム終了 1桁目が0で2桁以上あるため-1 if X[s-1] < 0:#もしリストにまだ数字が入っていなかったらCを代入 X[s-1] = c #もしすでにリストに数字が入っている場合は-1を出力する elif X[s-1] != c: print(-1) exit() #このfor文でリストが完成する if X[0] < 0 :#もし1桁目の数字が指定されていないなら X[0] = 1 if N>1 else 0#もし2桁以上ならならX[0]=1、違うならX[0]=0 print("".join([str(x) if x >= 0 else "0" for x in X])) #リストを文字列に変換する。もし指定されていない桁の数字があるなら0を代入する
N, M = map(int, input().split()) X = [-1] * N#[-1,-1,-1.....] for _ in range(M): s, c = map(int, input().split()) if s == 1 and N > 1 and c==0: print(-1) exit()#プログラム終了 1桁目が0で2桁以上あるため-1 #もしリストにまだ数字が入っていなかったらCを代入 if X[s-1] < 0: X[s-1] = c #もしすでにリストに数字が入っている場合は-1を出力する elif X[s-1] != c: print(-1) exit() #このfor文でリストが完成する if X[0] < 0 :#もし1桁目の数字が指定されていないなら X[0] = 1 if N>1 else 0#もし2桁以上ならならX[0]=1、違うならX[0]=0 print("".join([str(x) if x >= 0 else "0" for x in X])) #リストを文字列に変換する。もし指定されていない桁の数字があるなら0を代入する
[ "identifier.change", "assignment.value.change", "call.arguments.change" ]
552,061
552,062
u343977188
python
p02761
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from operator import mul from functools import reduce import pprint sys.setrecursionlimit(10 ** 9) INF = 10 ** 20 def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 1000000007 n, m = LI() ret = [''] * n for _ in range(m): s, c = LI() if ret[s - 1] and ret[s - 1] != str(c): print(-1) exit() elif s == 1 and not 0 and n != 1: print(-1) exit() else: ret[s - 1] = str(c) for i in range(n): if not ret[i]: ret[i] = '0' if i or n == 1 else '1' ans = ''.join(ret) print(ans)
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from operator import mul from functools import reduce import pprint sys.setrecursionlimit(10 ** 9) INF = 10 ** 20 def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 1000000007 n, m = LI() ret = [''] * n for _ in range(m): s, c = LI() if ret[s - 1] and ret[s - 1] != str(c): print(-1) exit() elif s == 1 and c == 0 and n != 1: print(-1) exit() else: ret[s - 1] = str(c) for i in range(n): if not ret[i]: ret[i] = '0' if i or n == 1 else '1' ans = ''.join(ret) print(ans)
[ "control_flow.branch.if.condition.change" ]
552,088
552,089
u499381410
python
p02761
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from operator import mul from functools import reduce import pprint sys.setrecursionlimit(10 ** 9) INF = 10 ** 20 def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 1000000007 n, m = LI() ret = [''] * n for _ in range(m): s, c = LI() if ret[s - 1] and ret[s - 1] != str(c): print(-1) exit() elif s == 1 and c == 0 and n != 1: print(-1) exit() else: ret[s - 1] = str(c) for i in range(n): if not ret[i]: ret[i] = '0' if i else '1' ans = ''.join(ret) print(ans)
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from operator import mul from functools import reduce import pprint sys.setrecursionlimit(10 ** 9) INF = 10 ** 20 def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 1000000007 n, m = LI() ret = [''] * n for _ in range(m): s, c = LI() if ret[s - 1] and ret[s - 1] != str(c): print(-1) exit() elif s == 1 and c == 0 and n != 1: print(-1) exit() else: ret[s - 1] = str(c) for i in range(n): if not ret[i]: ret[i] = '0' if i or n == 1 else '1' ans = ''.join(ret) print(ans)
[]
552,090
552,089
u499381410
python
p02761
n, m = map(int, input().split()) ans = ["0", "0", "0"] flag = True ansnum = "" for i in range(m) : num = [int(i) for i in input().split()] if ans[num[0]-1] == "0" : ans[num[0]-1] = num[1] elif ans[num[0]-1] == num[1] : continue else : flag = False if n == 2 : if ans[0] == 0 : flag = False elif ans[0] == "0" : ans[0] = 1 if n == 3 : if ans[0] == 0 : flag = False elif ans[0] == "0" : ans[0] = 1 if flag == True : for j in range(3) : ansnum = ansnum + str(ans[j]) print(ansnum) else : print(-1)
n, m = map(int, input().split()) ans = ["0", "0", "0"] flag = True ansnum = "" for i in range(m) : num = [int(i) for i in input().split()] if ans[num[0]-1] == "0" : ans[num[0]-1] = num[1] elif ans[num[0]-1] == num[1] : continue else : flag = False if n == 2 : if ans[0] == 0 : flag = False elif ans[0] == "0" : ans[0] = 1 if n == 3 : if ans[0] == 0 : flag = False elif ans[0] == "0" : ans[0] = 1 if flag == True : for j in range(n) : ansnum = ansnum + str(ans[j]) print(ansnum) else : print(-1)
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
552,096
552,097
u052221988
python
p02761
def solve(): n,m = [int(i) for i in input().split()] s = [-1 for _ in range(m)] c = [-1 for _ in range(m)] for i in range(m): s[i],c[i] = [int(j) for j in input().split()] res = [-1 for _ in range(n)] for i in range(m): if(s[i] == 1 and c[i] == 0 and n != 1): print(-1) return elif(res[s[i]-1] != -1 and res[s[i]-1] != c[i]): print(-1) return else: res[s[i]-1] = c[i] if(res[0] == 0 and n!=1): res[0] = 1 if(res[0] == 0 and n==1): print(0) return for i in range(n): if(res[i] == -1): res[i] = 0 res = [str(_a) for _a in res] res = "".join(res) print(res) if __name__ == "__main__": solve()
def solve(): n,m = [int(i) for i in input().split()] s = [-1 for _ in range(m)] c = [-1 for _ in range(m)] for i in range(m): s[i],c[i] = [int(j) for j in input().split()] res = [-1 for _ in range(n)] for i in range(m): if(s[i] == 1 and c[i] == 0 and n != 1): print(-1) return elif(res[s[i]-1] != -1 and res[s[i]-1] != c[i]): print(-1) return else: res[s[i]-1] = c[i] if(res[0] == -1 and n!=1): res[0] = 1 if(res[0] == 0 and n==1): print(0) return for i in range(n): if(res[i] == -1): res[i] = 0 res = [str(_a) for _a in res] res = "".join(res) print(res) if __name__ == "__main__": solve()
[ "control_flow.branch.if.condition.change", "expression.operation.unary.add" ]
552,106
552,107
u797572808
python
p02761
def solve(): n, m = [int(i) for i in input().split()] s = [-1 for _ in range(m)] c = [-1 for _ in range(m)] for i in range(m): s[i], c[i] = [int(j) for j in input().split()] a = [-1 for _ in range(n)] for _s, _c in zip(s, c): if a[_s - 1] == -1: a[_s - 1] = _c elif a[_s - 1] != _c: print(-1) return if a[0] == -1: a[0] = 1 for i in range(len(a)): if a[i] == -1: a[i] = 0 if a[0] == 0 and n != 1: print(-1) return char_a = [str(_a) for _a in a] str_a = "".join(char_a) print(str_a) if __name__ == "__main__": solve()
def solve(): n, m = [int(i) for i in input().split()] s = [-1 for _ in range(m)] c = [-1 for _ in range(m)] for i in range(m): s[i], c[i] = [int(j) for j in input().split()] a = [-1 for _ in range(n)] for _s, _c in zip(s, c): if a[_s - 1] == -1: a[_s - 1] = _c elif a[_s - 1] != _c: print(-1) return if a[0] == -1 and n != 1: a[0] = 1 for i in range(len(a)): if a[i] == -1: a[i] = 0 if a[0] == 0 and n != 1: print(-1) return char_a = [str(_a) for _a in a] str_a = "".join(char_a) print(str_a) if __name__ == "__main__": solve()
[ "control_flow.branch.if.condition.change" ]
552,114
552,115
u646818123
python
p02761
# -*- coding: utf-8 -*- """ Created on Wed Mar 4 01:52:13 2020 @author: Kanaru Sato """ N,M = list(map(int, input().split())) sc = [] [sc.append(list(map(int, input().split()))) for i in range(0, M)] found_flag = 0 for i in range(10**(N-1),10**N): #N桁の整数をリストアップ str_num = str(i) flag_i = 0 for j in range(0,M): if int(str_num[sc[j][0]-1]) == sc[j][1]: flag_i += 1 print(flag_i) if flag_i == M: found_flag = 1 int_num = i break if N == 1: str_num = "0" flag_i = 0 for j in range(0,M): if int(str_num[sc[j][0]-1]) == sc[j][1]: flag_i += 1 if flag_i == M: found_flag = 1 int_num = 0 if found_flag == 0: print("-1") elif found_flag == 1: print(int_num)
# -*- coding: utf-8 -*- """ Created on Wed Mar 4 01:52:13 2020 @author: Kanaru Sato """ N,M = list(map(int, input().split())) sc = [] [sc.append(list(map(int, input().split()))) for i in range(0, M)] found_flag = 0 for i in range(10**(N-1),10**N): #N桁の整数をリストアップ str_num = str(i) flag_i = 0 for j in range(0,M): if int(str_num[sc[j][0]-1]) == sc[j][1]: flag_i += 1 if flag_i == M: found_flag = 1 int_num = i break if N == 1: str_num = "0" flag_i = 0 for j in range(0,M): if int(str_num[sc[j][0]-1]) == sc[j][1]: flag_i += 1 if flag_i == M: found_flag = 1 int_num = 0 if found_flag == 0: print("-1") elif found_flag == 1: print(int_num)
[ "call.remove" ]
552,122
552,123
u674052742
python
p02761
n,m = map(int,input().split()) ans = [99]*n for i in range(m): s,c = map(int,input().split()) if ans[s-1] == 99 or ans[s-1] == c: ans[s-1] = c else: print(-1) exit() if ans[0] == 0 and n != 1: print(-1) exit() if ans[0] == 99: ans[0] = 1 for i in range(n): if ans[i] == 99: ans[i] = 0 print("".join([str(i) for i in ans]))
n,m = map(int,input().split()) ans = [99]*n for i in range(m): s,c = map(int,input().split()) if ans[s-1] == 99 or ans[s-1] == c: ans[s-1] = c else: print(-1) exit() if ans[0] == 0 and n != 1: print(-1) exit() if ans[0] == 99 and n != 1: ans[0] = 1 for i in range(n): if ans[i] == 99: ans[i] = 0 print("".join([str(i) for i in ans]))
[ "control_flow.branch.if.condition.change" ]
552,144
552,145
u738898077
python
p02761
N,M=map(int,input().split()) s_l=[] c_l=[] ans=0 order_l=[-1]*3 if M==0 and N>1: print(10**(N-1)) exit() if M==0 and N==1: print(0) exit() for _ in range(M): S,C=list(map(int,input().split())) s_l.append(S-1) c_l.append(C) for i in range(M): if order_l[s_l[i]] ==-1 or order_l[s_l[i]] ==c_l[i]: order_l[s_l[i]]=c_l[i] else: print(-1) exit() if order_l[0]==0: if M>1: print(-1) exit() else: print(0) exit() else: order_l[0]=max(1,order_l[0]) order_l[1]=max(0,order_l[1]) order_l[2]=max(0,order_l[2]) if N>1: ans=order_l[0]*10**(N-1)+order_l[1]*10**(N-2)+order_l[2]*(max(0,N-2)) else: ans=order_l[0] print(ans)
N,M=map(int,input().split()) s_l=[] c_l=[] ans=0 order_l=[-1]*3 if M==0 and N>1: print(10**(N-1)) exit() if M==0 and N==1: print(0) exit() for _ in range(M): S,C=list(map(int,input().split())) s_l.append(S-1) c_l.append(C) for i in range(M): if order_l[s_l[i]] ==-1 or order_l[s_l[i]] ==c_l[i]: order_l[s_l[i]]=c_l[i] else: print(-1) exit() if order_l[0]==0: if N>1: print(-1) exit() else: print(0) exit() else: order_l[0]=max(1,order_l[0]) order_l[1]=max(0,order_l[1]) order_l[2]=max(0,order_l[2]) if N>1: ans=order_l[0]*10**(N-1)+order_l[1]*10**(N-2)+order_l[2]*(max(0,N-2)) else: ans=order_l[0] print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
552,162
552,161
u733738237
python
p02761
from collections import defaultdict N, M = map(int, input().split()) constraint = defaultdict(set) for _ in range(M): s, c = map(int, input().split()) constraint[s].add(c) for k, v in constraint.items(): if len(v) > 1: print(-1) exit() for i in range(1, 1001): i = str(i) if len(i) != N: continue flag = True for k, v in constraint.items(): if i[k-1] != str(list(v)[0]): flag = False if flag: print(i) exit() print(-1)
from collections import defaultdict N, M = map(int, input().split()) constraint = defaultdict(set) for _ in range(M): s, c = map(int, input().split()) constraint[s].add(c) for k, v in constraint.items(): if len(v) > 1: print(-1) exit() for i in range(1001): i = str(i) if len(i) != N: continue flag = True for k, v in constraint.items(): if i[k-1] != str(list(v)[0]): flag = False if flag: print(i) exit() print(-1)
[ "call.arguments.change" ]
552,164
552,165
u708255304
python
p02761
from collections import defaultdict N, M = map(int, input().split()) constraint = defaultdict(set) for _ in range(M): s, c = map(int, input().split()) constraint[s].add(c) for k, v in constraint.items(): if len(v) > 1: print(-1) exit() for i in range(1, 1001): i = str(i) if len(i) < N: continue flag = True for k, v in constraint.items(): if i[k-1] != str(list(v)[0]): flag = False if flag: print(i) exit() print(-1)
from collections import defaultdict N, M = map(int, input().split()) constraint = defaultdict(set) for _ in range(M): s, c = map(int, input().split()) constraint[s].add(c) for k, v in constraint.items(): if len(v) > 1: print(-1) exit() for i in range(1001): i = str(i) if len(i) != N: continue flag = True for k, v in constraint.items(): if i[k-1] != str(list(v)[0]): flag = False if flag: print(i) exit() print(-1)
[ "call.arguments.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
552,166
552,165
u708255304
python
p02761
from collections import defaultdict N, M = map(int, input().split()) constraint = defaultdict(set) for _ in range(M): s, c = map(int, input().split()) constraint[s].add(c) for k, v in constraint.items(): if len(v) > 1: print(-1) exit() for i in range(1, 1000): i = str(i) if len(i) < N: continue flag = True for k, v in constraint.items(): if i[k-1] != str(list(v)[0]): flag = False if flag: print(i) exit() print(-1)
from collections import defaultdict N, M = map(int, input().split()) constraint = defaultdict(set) for _ in range(M): s, c = map(int, input().split()) constraint[s].add(c) for k, v in constraint.items(): if len(v) > 1: print(-1) exit() for i in range(1001): i = str(i) if len(i) != N: continue flag = True for k, v in constraint.items(): if i[k-1] != str(list(v)[0]): flag = False if flag: print(i) exit() print(-1)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
552,167
552,165
u708255304
python
p02761
N,M = [int(i) for i in input().rstrip().split()] n = 1 if N > 1 else 0 C = [list(range(n,10))] + [list(range(10)) for i in range(N-1)] for m in range(M): s,c = [int(i) for i in input().rstrip().split()] s -= 1 if c in C[s]: C[s] = [c] else: print(-1) exit() print(C) C = [str(min(c)) for c in C] print("".join(C))
N,M = [int(i) for i in input().rstrip().split()] n = 1 if N > 1 else 0 C = [list(range(n,10))] + [list(range(10)) for i in range(N-1)] for m in range(M): s,c = [int(i) for i in input().rstrip().split()] s -= 1 if c in C[s]: C[s] = [c] else: print(-1) exit() #print(C) C = [str(min(c)) for c in C] print("".join(C))
[ "call.remove" ]
552,174
552,175
u164029270
python
p02761
import sys input = sys.stdin.readline N, M = map(int, input().split()) t = [tuple(map(int, input().split())) for _ in range(M)] if M == 0: print(10 ** (N - 1)) exit(0) for x in range(10 ** N): f = 1 for i in range(M): s = str(x) y, c = t[i] if len(s) < y or (len(s) < N): f = 0 break if int(s[y - 1]) != c: f = 0 break if f: print(x) exit(0) print(-1)
import sys input = sys.stdin.readline N, M = map(int, input().split()) t = [tuple(map(int, input().split())) for _ in range(M)] if M == 0 and (N > 1): print(10 ** (N - 1)) exit(0) for x in range(10 ** N): f = 1 for i in range(M): s = str(x) y, c = t[i] if len(s) < y or (len(s) < N): f = 0 break if int(s[y - 1]) != c: f = 0 break if f: print(x) exit(0) print(-1)
[ "control_flow.branch.if.condition.change" ]
552,199
552,200
u141610915
python
p02761
N,M = map(int,input().split()) X = [0] * N R = [0] * N ans = True for i in range(M): s,c = map(int,input().split()) if R[s-1] == 0: X[s-1] = c R[s-1] = "T" elif R[s-1] == "T" and X[s-1] != c : ans = False break if ans: if X[0] == 0 and R[0] == 0: cnt = "1" else: cnt = str(X[0]) for i in range(1,N): cnt = cnt + str(X[i]) if len(cnt) == len(str(int(cnt))): print(cnt) else: print(-1) else: print(-1)
N,M = map(int,input().split()) X = [0] * N R = [0] * N ans = True for i in range(M): s,c = map(int,input().split()) if R[s-1] == 0: X[s-1] = c R[s-1] = "T" elif R[s-1] == "T" and X[s-1] != c : ans = False break if ans: if X[0] == 0 and R[0] == 0 and N != 1: cnt = "1" else: cnt = str(X[0]) for i in range(1,N): cnt = cnt + str(X[i]) if len(cnt) == len(str(int(cnt))): print(cnt) else: print(-1) else: print(-1)
[ "control_flow.branch.if.condition.change" ]
552,207
552,208
u355371431
python
p02761
nm = list(map(int, input().split())) n = nm[0] xf = 0 if n == 0: xf = 1 m = nm[1] nl = [None for i in range(n)] result = "" zf = 0 for i in range(m): temp = list(map(int, input().split())) keta = temp[0] c = temp[1] if keta == 1 and c == 0 and n != 1: zf = 1 elif nl[keta-1] == None: nl[keta-1] = c else: if nl[keta-1] != c: zf = 1 if zf == 1 or xf == 1: print("-1") else: for i in range(len(nl)): if nl[i] == None: if i==0: nl[i]=1 else: nl[i]=0 nl = list(map(str, nl)) length = 0 while length != len(nl): result = result + nl[length] length += 1 print(result)
nm = list(map(int, input().split())) n = nm[0] xf = 0 if n == 0: xf = 1 m = nm[1] nl = [None for i in range(n)] result = "" zf = 0 for i in range(m): temp = list(map(int, input().split())) keta = temp[0] c = temp[1] if keta == 1 and c == 0 and n != 1: zf = 1 elif nl[keta-1] == None: nl[keta-1] = c else: if nl[keta-1] != c: zf = 1 if zf == 1 or xf == 1: print("-1") else: for i in range(len(nl)): if nl[i] == None: if i==0 and n != 1: nl[i]=1 else: nl[i]=0 nl = list(map(str, nl)) length = 0 while length != len(nl): result = result + nl[length] length += 1 print(result)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,225
552,226
u682721153
python
p02761
N, M = map(int, input().split()) s = [] c = [] for _ in range(M): tmp1, tmp2 = map(int, input().split()) s.append(tmp1-1) c.append(tmp2) digit = [-1, -1, -1] for i in range(M): if digit[s[i]] < 0: digit[s[i]] = c[i] else: if not(digit[s[i]] == c[i]): print("-1") exit() if M==0: if N==1: print("0") exit() print(str(10**N-1)) exit() if ((N == 1) and (digit[0] == 0)): print("0") exit() if digit[0] == 0: print("-1") exit() if digit[0] < 0: digit[0] = 1 output = "" for i in range(N): if digit[i] < 0: output += "0" continue output += str(digit[i]) print(output)
N, M = map(int, input().split()) s = [] c = [] for _ in range(M): tmp1, tmp2 = map(int, input().split()) s.append(tmp1-1) c.append(tmp2) digit = [-1, -1, -1] for i in range(M): if digit[s[i]] < 0: digit[s[i]] = c[i] else: if not(digit[s[i]] == c[i]): print("-1") exit() if M==0: if N==1: print("0") exit() print(str(10**(N-1))) exit() if ((N == 1) and (digit[0] == 0)): print("0") exit() if digit[0] == 0: print("-1") exit() if digit[0] < 0: digit[0] = 1 output = "" for i in range(N): if digit[i] < 0: output += "0" continue output += str(digit[i]) print(output)
[ "call.arguments.change" ]
552,227
552,228
u707712609
python
p02761
N, M = map(int,input().split()) answer = [-1]*N ae = 0 for i in range(M): s,c = map(int,input().split()) if answer[-s] == -1: answer[-s] = c elif answer[-s] != -1 and answer[-s] != c: print(-1) ae = 1 break for i in range(N): if answer[i] == -1: if i == 0 and N > 1: answer[i] = 1 else: answer[i] = 0 if ae == 0 and answer[N-1] == 0 and N != 1: print(-1) ae = 1 elif ae == 0: for i in range(N): print(answer[-(i+1)],end='')
N, M = map(int,input().split()) answer = [-1]*N ae = 0 for i in range(M): s,c = map(int,input().split()) if answer[-s] == -1: answer[-s] = c elif answer[-s] != -1 and answer[-s] != c: print(-1) ae = 1 break for i in range(N): if answer[i] == -1: if i == N-1 and N > 1: answer[i] = 1 else: answer[i] = 0 if ae == 0 and answer[N-1] == 0 and N != 1: print(-1) ae = 1 elif ae == 0: for i in range(N): print(answer[-(i+1)],end='')
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
552,243
552,244
u078816252
python
p02761
N,M = map(int,input().split()) flag = True answer = [0]*N if len(answer) != 1: answer[0] = 1 change_list = [0]*N answer_num = 0 for i in range(M): num_list = list(map(int,input().split())) if change_list[num_list[0]-1] == 0: answer[num_list[0]-1] = num_list[1] change_list[num_list[0]-1] = 1 else: if answer[num_list[0]-1] == num_list[1]: continue else: flag = False if flag == False: print(-1) if (answer[0] == 0)&(len(answer) != 1): print(-1) else: for i in range(len(answer)): answer_num += 10**(len(answer) - (i+1))*answer[i] print(answer_num)
N,M = map(int,input().split()) flag = True answer = [0]*N if len(answer) != 1: answer[0] = 1 change_list = [0]*N answer_num = 0 for i in range(M): num_list = list(map(int,input().split())) if change_list[num_list[0]-1] == 0: answer[num_list[0]-1] = num_list[1] change_list[num_list[0]-1] = 1 else: if answer[num_list[0]-1] == num_list[1]: continue else: flag = False if flag == False: print(-1) elif (answer[0] == 0)&(len(answer) != 1): print(-1) else: for i in range(len(answer)): answer_num += 10**(len(answer) - (i+1))*answer[i] print(answer_num)
[ "control_flow.branch.if.replace.remove", "control_flow.branch.else_if.replace.add" ]
552,245
552,246
u549383771
python
p02761
n, m = map(int, input().split()) if m == 0: if n == 1: print(0) elif n ==2: print(10) else: print(100) else: sc = [list(map(int, input().split())) for i in range(m)] k = 0 ans = [-5] * n for i in range(m): if ans[sc[i][0] - 1] == -5: ans[sc[i][0] - 1] = sc[i][1] elif ans[sc[i][0] - 1] != sc[i][1]: k = 1 else: continue if k == 1: print(-1) elif ans[0] == 0: if n == 1: print(0) else: print(-1) else: for i in range(3): if ans[i] == -5: ans[i] = 0 if ans[0] == 0: ans[0] = 1 ans = [str(i) for i in ans] ans = "".join(ans) print(int(ans))
n, m = map(int, input().split()) if m == 0: if n == 1: print(0) elif n == 2: print(10) else: print(100) else: sc = [list(map(int, input().split())) for i in range(m)] k = 0 ans = [-5] * n for i in range(m): if ans[sc[i][0] - 1] == -5: ans[sc[i][0] - 1] = sc[i][1] elif ans[sc[i][0] - 1] != sc[i][1]: k = 1 if k == 1: print(-1) elif ans[0] == 0: if n == 1: print(0) else: print(-1) else: for i in range(n): if ans[i] == -5: ans[i] = 0 if ans[0] == 0: ans[0] = 1 ans = [str(i) for i in ans] ans = "".join(ans) print(int(ans))
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
552,303
552,304
u793666115
python
p02761
number = input().split(" ") N = int(number[0]) M = int(number[1]) ans = ["○"]*N a = 0 b = 0 for i in range(M): sc = input().split(" ") s = int(sc[0]) c = int(sc[1]) if ans[s-1] == "○": ans[s-1] = c elif ans[s-1] == c: pass else: a += 1 if s == 1: b += 1 else: pass for i in ans: if i == "○": x = ans.index("○") ans[x] = 0 if M > 0: if b == 0: ans[0] = 1 else: pass if N > 1: if ans[0] == 0: a += 1 else: pass if a > 0: print(-1) else: for i in ans: print(i,end="")
number = input().split(" ") N = int(number[0]) M = int(number[1]) ans = ["○"]*N a = 0 b = 0 for i in range(M): sc = input().split(" ") s = int(sc[0]) c = int(sc[1]) if ans[s-1] == "○": ans[s-1] = c elif ans[s-1] == c: pass else: a += 1 if s == 1: b += 1 else: pass for i in ans: if i == "○": x = ans.index("○") ans[x] = 0 if N > 1: if b == 0: ans[0] = 1 else: pass if N > 1: if ans[0] == 0: a += 1 else: pass if a > 0: print(-1) else: for i in ans: print(i,end="")
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
552,324
552,325
u558129042
python
p02761
number = input().split(" ") N = int(number[0]) M = int(number[1]) ans = ["○"]*N a = 0 b = 0 for i in range(M): sc = input().split(" ") s = int(sc[0]) c = int(sc[1]) if ans[s-1] == "○": ans[s-1] = c elif ans[s-1] == c: pass else: a += 1 if s == 1: b += 1 else: pass for i in ans: if i == "○": x = ans.index("○") ans[x] = 0 if b == 0: ans[0] = 1 else: pass if N > 1: if ans[0] == 0: a += 1 else: pass if a > 0: print(-1) else: for i in ans: print(i,end="")
number = input().split(" ") N = int(number[0]) M = int(number[1]) ans = ["○"]*N a = 0 b = 0 for i in range(M): sc = input().split(" ") s = int(sc[0]) c = int(sc[1]) if ans[s-1] == "○": ans[s-1] = c elif ans[s-1] == c: pass else: a += 1 if s == 1: b += 1 else: pass for i in ans: if i == "○": x = ans.index("○") ans[x] = 0 if N > 1: if b == 0: ans[0] = 1 else: pass if N > 1: if ans[0] == 0: a += 1 else: pass if a > 0: print(-1) else: for i in ans: print(i,end="")
[ "control_flow.branch.if.add" ]
552,326
552,325
u558129042
python
p02761
N, M = map(int, input().split()) SCS = [] for _ in range(0, M): s, c = map(int, input().split()) SCS.append((s, c)) def candidates(): SC = [-1, -1, -1] for (s, c) in SCS: if N > 1: if s == 1 and c == 0: return -1 if SC[s-1] == -1: SC[s-1] = c elif SC[s-1] != c: return -1 return SC sc = candidates() if sc == -1: print(-1) else: if N == 3: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] c = 0 if sc[2] != -1: c = sc[2] print(a * 100 + b * 10 + c) if N == 2: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] print(a * 10 + b) if N == 1: a = 1 if sc[0] != -1: a = sc[0] print(a)
N, M = map(int, input().split()) SCS = [] for _ in range(0, M): s, c = map(int, input().split()) SCS.append((s, c)) def candidates(): SC = [-1, -1, -1] for (s, c) in SCS: if N > 1: if s == 1 and c == 0: return -1 if SC[s-1] == -1: SC[s-1] = c elif SC[s-1] != c: return -1 return SC sc = candidates() if sc == -1: print(-1) else: if N == 3: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] c = 0 if sc[2] != -1: c = sc[2] print(a * 100 + b * 10 + c) if N == 2: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] print(a * 10 + b) if N == 1: a = 0 if sc[0] != -1: a = sc[0] print(a)
[ "literal.number.integer.change", "assignment.value.change" ]
552,329
552,330
u905421775
python
p02761
N, M = map(int, input().split()) SCS = [] for _ in range(0, M): s, c = map(int, input().split()) SCS.append((s, c)) def candidates(): SC = [-1, -1, -1] for (s, c) in SCS: if N > 1: if s == 1 and c == 0: return -1 if SC[s-1] == -1: SC[s-1] = c elif SC[s-1] != c: return -1 return SC sc = candidates() if sc == -1: print(-1) else: if M == 3: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] c = 0 if sc[2] != -1: c = sc[2] print(a * 100 + b * 10 + c) if M == 2: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] print(a * 10 + b) if M == 1: a = 1 if sc[0] != -1: a = sc[0] print(a)
N, M = map(int, input().split()) SCS = [] for _ in range(0, M): s, c = map(int, input().split()) SCS.append((s, c)) def candidates(): SC = [-1, -1, -1] for (s, c) in SCS: if N > 1: if s == 1 and c == 0: return -1 if SC[s-1] == -1: SC[s-1] = c elif SC[s-1] != c: return -1 return SC sc = candidates() if sc == -1: print(-1) else: if N == 3: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] c = 0 if sc[2] != -1: c = sc[2] print(a * 100 + b * 10 + c) if N == 2: a = 1 if sc[0] != -1: a = sc[0] b = 0 if sc[1] != -1: b = sc[1] print(a * 10 + b) if N == 1: a = 0 if sc[0] != -1: a = sc[0] print(a)
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.number.integer.change", "assignment.value.change" ]
552,331
552,330
u905421775
python
p02761
n, m = map(int, input().split()) cond = [] for _ in range(m): s, c = map(int, input().split()) cond.append((s, c)) inf = float('infinity') ans = inf for i in range(1, 10 ** n): string = str(i) if len(string) != n: continue for s, c in cond: if len(string) < s: break if string[s - 1] == str(c): continue else: break else: ans = min(ans, i) if ans == inf: print(-1) else: print(ans)
n, m = map(int, input().split()) cond = [] for _ in range(m): s, c = map(int, input().split()) cond.append((s, c)) inf = float('infinity') ans = inf for i in range(10 ** n): string = str(i) if len(string) != n: continue for s, c in cond: if len(string) < s: break if string[s - 1] == str(c): continue else: break else: ans = min(ans, i) if ans == inf: print(-1) else: print(ans)
[ "call.arguments.change" ]
552,375
552,376
u940139461
python
p02761
n, m = map(int, input().split()) cond = [] for _ in range(m): s, c = map(int, input().split()) cond.append((s, c)) inf = float('infinity') ans = inf for i in range(1, 10 ** n): string = str(i) if len(string) != n: continue print(i) for s, c in cond: if len(string) < s: break if string[s - 1] == str(c): continue else: break else: ans = min(ans, i) if ans == inf: print(-1) else: print(ans)
n, m = map(int, input().split()) cond = [] for _ in range(m): s, c = map(int, input().split()) cond.append((s, c)) inf = float('infinity') ans = inf for i in range(10 ** n): string = str(i) if len(string) != n: continue for s, c in cond: if len(string) < s: break if string[s - 1] == str(c): continue else: break else: ans = min(ans, i) if ans == inf: print(-1) else: print(ans)
[ "call.arguments.change", "call.remove" ]
552,377
552,376
u940139461
python
p02761
#!/usr/bin/python3 # -*- coding:utf-8 -*- def main(): n, m = map(int, input().strip().split()) scs = [10]*n for _ in range(m): s, c = map(int, input().strip().split()) s -= 1 if scs[s] != 10 and scs[s] != c: print(-1) return scs[s] = c if n >1 and scs[0] == 0: print(-1) return if n==1 and scs[0] == 0: print(0) return num = ['0'] * n for i in range(len(scs)): if scs[i] != 10: num[i] = str(scs[i]) if scs[i] == 10 and i == 0: num[i] = '1' print(int(''.join(num))) if __name__=='__main__': main()
#!/usr/bin/python3 # -*- coding:utf-8 -*- def main(): n, m = map(int, input().strip().split()) scs = [10]*n for _ in range(m): s, c = map(int, input().strip().split()) s -= 1 if scs[s] != 10 and scs[s] != c: print(-1) return scs[s] = c if n >1 and scs[0] == 0: print(-1) return if n==1 and scs[0] in [0, 10] : print(0) return num = ['0'] * n for i in range(len(scs)): if scs[i] != 10: num[i] = str(scs[i]) if scs[i] == 10 and i == 0: num[i] = '1' print(int(''.join(num))) if __name__=='__main__': main()
[ "control_flow.branch.if.condition.change" ]
552,419
552,420
u210440747
python
p02761
n,m=map(int,input().split()) seq=[list(map(int,input().split())) for _ in range(m)] count=0 while(True): flg=1 for i in range(m): # print() s,c=seq[i] keta=len(str(count)) if keta<n: flg=0 # print("ttttt") break k=str(count) s-=1 if int(k[s])!=c: flg=0 if flg==1: break count+=1 if count==1000: break if flg==1: if (count==0)and(n!=1): print(-1) else: print(count) else: print(-1)
n,m=map(int,input().split()) seq=[list(map(int,input().split())) for _ in range(m)] count=0 while(True): flg=1 for i in range(m): # print() s,c=seq[i] keta=len(str(count)) if keta<n: flg=0 # print("ttttt") break k=str(count) s-=1 if int(k[s])!=c: flg=0 if flg==1: break count+=1 if count==1000: break if flg==1: if (count==0)and(n!=1): print(10**(n-1)) else: print(count) else: print(-1)
[ "call.arguments.change" ]
552,433
552,434
u711245972
python
p02761
import sys N,m=map(int,input().split()) ans=dict() for _ in range(m): s,c=map(int,input().split()) if not s in ans.keys(): ans[s]=c else: if ans[s] != c: print(-1) sys.exit() if N==1: rg=range(1,10) elif N == 2: rg=range(10,100) elif N == 3: rg=range(100,1000) for n in rg: n=str(n) f=True for k in ans.keys(): f = f & (int(n[k-1]) == ans[k]) if f: print(n) sys.exit() else: print(-1)
import sys N,m=map(int,input().split()) ans=dict() for _ in range(m): s,c=map(int,input().split()) if not s in ans.keys(): ans[s]=c else: if ans[s] != c: print(-1) sys.exit() if N==1: rg=range(0,10) elif N == 2: rg=range(10,100) elif N == 3: rg=range(100,1000) for n in rg: n=str(n) f=True for k in ans.keys(): f = f & (int(n[k-1]) == ans[k]) if f: print(n) sys.exit() else: print(-1)
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
552,437
552,438
u349091349
python
p02761
N, M = map(int, input().split()) num = [None] * (N) ans = '' for _ in range(M): x, y = map(int, input().split()) if num[x-1] == None: num[x-1] = str(y) elif num[x-1] != str(y): ans = -1 break if ans == -1: print(ans) elif len(num) >= 2 and num[0] == '0': print(-1) elif len(num) >= 2 and num[0] == None: for i in range(N): if i == 0: ans += '1' else: if i == None: ans += '0' else: ans += i print(ans) else: for i in num: if i == None: ans += '0' else: ans += i print(ans)
N, M = map(int, input().split()) num = [None] * (N) ans = '' for _ in range(M): x, y = map(int, input().split()) if num[x-1] == None: num[x-1] = str(y) elif num[x-1] != str(y): ans = -1 break if ans == -1: print(ans) elif len(num) >= 2 and num[0] == '0': print(-1) elif len(num) >= 2 and num[0] == None: for i in range(N): if i == 0: ans += '1' else: if num[i] == None: ans += '0' else: ans += num[i] print(ans) else: for i in num: if i == None: ans += '0' else: ans += i print(ans)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,449
552,450
u734603233
python
p02761
import sys input = lambda: sys.stdin.readline().rstrip() def resolve(): N, M = map(int, input().split()) s = [0]*M c = [0]*M for i in range(M): s[i], c[i] = map(int, input().split()) ans_int = ['-1']*N has_ans = True for s, c in zip(s, c): if ans_int[s-1] == '-1': ans_int[s-1] = str(c) elif ans_int[s-1] == str(c): pass else: has_ans = False for i, a in enumerate(ans_int): if a == '-1': if i == '0': ans_int[i] = '1' else: ans_int[i] = '0' if N != 1 and ans_int[0] == '0': has_ans = False if has_ans: print(''.join(ans_int)) else: print('-1') if __name__ == '__main__': resolve()
import sys input = lambda: sys.stdin.readline().rstrip() def resolve(): N, M = map(int, input().split()) s = [0]*M c = [0]*M for i in range(M): s[i], c[i] = map(int, input().split()) ans_int = ['-1']*N has_ans = True for s, c in zip(s, c): if ans_int[s-1] == '-1': ans_int[s-1] = str(c) elif ans_int[s-1] == str(c): pass else: has_ans = False for i, a in enumerate(ans_int): if a == '-1': if i == 0 and N > 1: ans_int[i] = '1' else: ans_int[i] = '0' if N != 1 and ans_int[0] == '0': has_ans = False if has_ans: print(''.join(ans_int)) else: print('-1') if __name__ == '__main__': resolve()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,451
552,452
u648881683
python
p02761
n, m = map(int, input().split()) S = [] C = [] for i in range(m): s, c = map(int, input().split()) S.append(s) C.append(c) if n == 1: start_num = 1 end_num = 10 if n == 2: start_num = 10 end_num = 100 if n == 3: start_num = 100 end_num = 1000 for num in range(start_num, end_num): for i in range(m): if str(num)[S[i] - 1] != str(C[i]): break else: print(num) break else: print(-1)
n, m = map(int, input().split()) S = [] C = [] for i in range(m): s, c = map(int, input().split()) S.append(s) C.append(c) if n == 1: start_num = 0 end_num = 10 if n == 2: start_num = 10 end_num = 100 if n == 3: start_num = 100 end_num = 1000 for num in range(start_num, end_num): for i in range(m): if str(num)[S[i] - 1] != str(C[i]): break else: print(num) break else: print(-1)
[ "literal.number.integer.change", "assignment.value.change" ]
552,467
552,468
u332657092
python
p02761
N, M = map(int, input().split()) sc = [list(map(int, input().split())) for i in range(M)] for i in range(1, 1000): number_str = str(i) if len(number_str) == N: for j in range(M): if number_str[sc[j][0]-1] == str(sc[j][1]): pass else: break else: print(i) break else: print(-1)
N, M = map(int, input().split()) sc = [list(map(int, input().split())) for i in range(M)] for i in range(0, 1000): number_str = str(i) if len(number_str) == N: for j in range(M): if number_str[sc[j][0]-1] == str(sc[j][1]): pass else: break else: print(i) break else: print(-1)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
552,513
552,514
u891884439
python
p02761
N, M = map(int, input().split()) exists = True digits = [-1]*N for i in range(M): s, c = map(int, input().split()) if N > 1 and s == 1 and c == 0: exists = False break elif digits[s-1] == -1 or digits[s-1] == c: digits[s-1] = c else: exists = False break if exists: ans = 0 digits = list(reversed(digits)) for i in range(N): if digits[i] == -1: if i == N - 1: digits[i] = 1 else: digits[i] = 0 ans += (10 ** i)*digits[i] print(ans) else: print(-1)
N, M = map(int, input().split()) exists = True digits = [-1]*N for i in range(M): s, c = map(int, input().split()) if N > 1 and s == 1 and c == 0: exists = False break elif digits[s-1] == -1 or digits[s-1] == c: digits[s-1] = c else: exists = False break if exists: ans = 0 digits = list(reversed(digits)) for i in range(N): if digits[i] == -1: if i == N - 1 and N > 1: digits[i] = 1 else: digits[i] = 0 ans += (10 ** i)*digits[i] print(ans) else: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,515
552,516
u799215419
python
p02761
def main(): n, m = map(int, input().split()) nums = [10]*n result = None for _ in range(m): s, e = map(int, input().split()) if nums[s-1] == 10: nums[s - 1] = e else: if nums[s - 1] != e: result = '-1' break for i in range(n): if i == 0 and nums[i] == 10 and len(nums) > 0: nums[i] = 1 elif nums[i] == 10: nums[i] = 0 if result == '-1': print('-1') elif nums[0] == 0 and len(nums) > 0: print('-1') else: print(''.join(map(str, nums))) if __name__ == "__main__": main()
def main(): n, m = map(int, input().split()) nums = [10]*n result = None for _ in range(m): s, e = map(int, input().split()) if nums[s-1] == 10: nums[s - 1] = e else: if nums[s - 1] != e: result = '-1' break for i in range(n): if i == 0 and nums[i] == 10 and len(nums) > 1: nums[i] = 1 elif nums[i] == 10: nums[i] = 0 if result == '-1': print('-1') elif nums[0] == 0 and len(nums) > 1: print('-1') else: print(''.join(map(str, nums))) if __name__ == "__main__": main()
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
552,544
552,545
u171132311
python
p02761
N, M = list(map(int, input().split(' '))) r = [ None for i in range(N) ] illegal = False for i in range(M): s, c = list(map(int, input().split(' '))) if r[s-1] is not None and r[s-1] != c: illegal = True break r[s-1] = c v = -1 if not illegal: for i in range(N): if r[i] is None: if i == 0 and N != 1: r[i] = 1 else: r[i] = 0 v = sum(r[i] * 10**i for i in range(N)) if v < 10**(N-1) and not (N == 1 and v == 0): v = -1 print(v)
N, M = list(map(int, input().split(' '))) r = [ None for i in range(N) ] illegal = False for i in range(M): s, c = list(map(int, input().split(' '))) if r[s-1] is not None and r[s-1] != c: illegal = True break r[s-1] = c v = -1 if not illegal: for i in range(N): if r[i] is None: if i == 0 and N != 1: r[i] = 1 else: r[i] = 0 v = sum(r[i] * 10**(N-1-i) for i in range(N)) if v < 10**(N-1) and not (N == 1 and v == 0): v = -1 print(v)
[]
552,586
552,587
u253799217
python
p02761
N, M = map(int, input().split()) s = [] c = [] for _ in range(M): a, b = map(int, input().split()) s.append(a) c.append(b) N_list = [10,]*(N) f = True for i in range(M): if N_list[s[i]-1] == 10: N_list[s[i]-1] = c[i] if N_list[s[i]-1] != c[i]: f = False print('-1') break if f: if N == 1: if N_list[0] == 10 or N_list[0] == 0: print(0) else: print(N_list[0]) else: if N_list[0] == 10: N_list[0] = 1 elif N_list[0] == 0: print('-1') else: N_list = [N_list[i]%10 for i in range(N)] count = 0 for i, n in enumerate(list(range(N))[::-1]): count += N_list[i] * 10**n print(count)
N, M = map(int, input().split()) s = [] c = [] for _ in range(M): a, b = map(int, input().split()) s.append(a) c.append(b) N_list = [10,]*(N) f = True for i in range(M): if N_list[s[i]-1] == 10: N_list[s[i]-1] = c[i] if N_list[s[i]-1] != c[i]: f = False print('-1') break if f: if N == 1: if N_list[0] == 10 or N_list[0] == 0: print(0) else: print(N_list[0]) else: if N_list[0] == 10: N_list[0] = 1 if N_list[0] == 0: print('-1') else: N_list = [N_list[i]%10 for i in range(N)] count = 0 for i, n in enumerate(list(range(N))[::-1]): count += N_list[i] * 10**n print(count)
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
552,597
552,598
u595952233
python
p02761
N, M = map(int, input().split()) s = [] c = [] for _ in range(M): a, b = map(int, input().split()) s.append(a) c.append(b) N_list = [10,]*(N) f = True for i in range(M): if N_list[s[i]-1] == 10: N_list[s[i]-1] = c[i] if N_list[s[i]-1] != c[i]: f = False print('-1') break if f: if N == 1: if N_list[0] == 10 or N_list[0] == 0: print(0) else: print(N_list[0]) else: if N_list[0] == 10: N_list[0] == 1 elif N_list[0] == 0: print('-1') else: N_list = [N_list[i]%10 for i in range(N)] count = 0 for i, n in enumerate(list(range(N))[::-1]): count += N_list[i] * 10**n print(count)
N, M = map(int, input().split()) s = [] c = [] for _ in range(M): a, b = map(int, input().split()) s.append(a) c.append(b) N_list = [10,]*(N) f = True for i in range(M): if N_list[s[i]-1] == 10: N_list[s[i]-1] = c[i] if N_list[s[i]-1] != c[i]: f = False print('-1') break if f: if N == 1: if N_list[0] == 10 or N_list[0] == 0: print(0) else: print(N_list[0]) else: if N_list[0] == 10: N_list[0] = 1 if N_list[0] == 0: print('-1') else: N_list = [N_list[i]%10 for i in range(N)] count = 0 for i, n in enumerate(list(range(N))[::-1]): count += N_list[i] * 10**n print(count)
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo", "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
552,599
552,598
u595952233
python
p02761
N, M = map(int, input().split()) SCs = [list(map(int, input().split())) for i in range(M)] def main(): ze = [None] * N for s, c in SCs: if ze[s-1] is not None and ze[s-1] != c: print(-1) return ze[s-1] = c if ze[0] == 0: if N == 1: print(0) return else: print(-1) return if ze[0] is None: ze[0] = 1 ze = [0 if z is None else z for z in ze] print("".join([str(i) for i in ze])) main()
N, M = map(int, input().split()) SCs = [list(map(int, input().split())) for i in range(M)] def main(): ze = [None] * N for s, c in SCs: if ze[s-1] is not None and ze[s-1] != c: print(-1) return ze[s-1] = c if ze[0] == 0: if N == 1: print(0) return else: print(-1) return if ze[0] is None and N != 1: ze[0] = 1 ze = [0 if z is None else z for z in ze] print("".join([str(i) for i in ze])) main()
[ "control_flow.branch.if.condition.change" ]
552,604
552,605
u207082620
python
p02761
n,m= map(int,input().split()) check=[-1]*n for i in range(m): s,c=map(int,input().split()) s-=1 if(check[s]!=-1 and check[s]!=c): print(-1) exit() check[s]=c #print(check) if(check[0]==0): if(n==1): print(0) else: print(-1) exit() elif(check[0]==-1): check[0]=1 if(n==0): check[0]=0 for i in range(n): if(check[i]==-1): check[i]=0 print(check[i],end="")
n,m= map(int,input().split()) check=[-1]*n for i in range(m): s,c=map(int,input().split()) s-=1 if(check[s]!=-1 and check[s]!=c): print(-1) exit() check[s]=c #print(check) if(check[0]==0): if(n==1): print(0) else: print(-1) exit() elif(check[0]==-1): check[0]=1 if(n==1): check[0]=0 for i in range(n): if(check[i]==-1): check[i]=0 print(check[i],end="")
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
552,657
552,658
u983367697
python
p02761
n,m = map(int,input().split()) s = [] c = [] for i in range(m): val1,val2 = map(int,input().split()) s.append(val1) c.append(val2) if n == 1: start = 0 end = 10 elif n == 2: start = 10 end = 100 else: start = 100 end = 1000 ans = [] for i in range(start, end): num = str(i) flg = 0 for j in range(m): if num[s[j] - 1] == str(c[j]) and len(num) == n: flg = 1 else: flg = 0 break if flg == 1: ans.append(i) if ans: print(min(ans)) else: print(-1)
n,m = map(int,input().split()) s = [] c = [] for i in range(m): val1,val2 = map(int,input().split()) s.append(val1) c.append(val2) if n == 1: start = 0 end = 10 elif n == 2: start = 10 end = 100 else: start = 100 end = 1000 ans = [] for i in range(start, end): num = str(i) flg = 1 for j in range(m): if num[s[j] - 1] == str(c[j]) and len(num) == n: flg = 1 else: flg = 0 break if flg == 1: ans.append(i) if ans: print(min(ans)) else: print(-1)
[ "literal.number.integer.change", "assignment.value.change" ]
552,663
552,664
u476124554
python
p02761
n,m = map(int,input().split()) s = [] c = [] for i in range(m): val1,val2 = map(int,input().split()) s.append(val1) c.append(val2) for i in range(1000): if len(str(i)) == n: flg = True for j in range(m): if int(str(i)[j-1]) != c[j]: flg = False if flg: print(i) break if not flg: print(-1)
n,m = map(int,input().split()) s = [] c = [] for i in range(m): val1,val2 = map(int,input().split()) s.append(val1) c.append(val2) for i in range(1000): if len(str(i)) == n: flg = True for j in range(m): if int(str(i)[s[j] - 1]) != c[j]: flg = False if flg: print(i) break if not flg: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,665
552,666
u476124554
python
p02761
n,m=map(int,input().split()) L=[10]*n for i in range(m): s,c=map(int,input().split()) if L[s-1]==10 or L[s-1]==c: L[s-1]=c else: print(-1) exit() if n==1: if L[0]==10: print(0) exit() else: print(L[0]) exit() else: if L[0]==10: L[0]=1 elif L[0]==0: print(-1) exit() else: for i in range(1,n): if L[i]==10: L[i]=0 print(''.join(map(str,L)))
n,m=map(int,input().split()) L=[10]*n for i in range(m): s,c=map(int,input().split()) if L[s-1]==10 or L[s-1]==c: L[s-1]=c else: print(-1) exit() if n==1: if L[0]==10: print(0) exit() else: print(L[0]) exit() else: if L[0]==10: L[0]=1 elif L[0]==0: print(-1) exit() for i in range(1,n): if L[i]==10: L[i]=0 print(''.join(map(str,L)))
[]
552,675
552,674
u901582103
python
p02761
n,m=map(int,input().split()) L=[10]*3 for i in range(m): s,c=map(int,input().split()) if L[s-1]==10 or L[s-1]==c: L[s-1]=c else: print(-1) exit() if n==1: if L[0]==10: print(0) exit() else: print(L[0]) exit() else: if L[0]==10: L[0]=1 elif L[0]==0: print(-1) exit() else: for i in range(1,n): if L[i]==10: L[i]=0 print(''.join(map(str,L)))
n,m=map(int,input().split()) L=[10]*n for i in range(m): s,c=map(int,input().split()) if L[s-1]==10 or L[s-1]==c: L[s-1]=c else: print(-1) exit() if n==1: if L[0]==10: print(0) exit() else: print(L[0]) exit() else: if L[0]==10: L[0]=1 elif L[0]==0: print(-1) exit() for i in range(1,n): if L[i]==10: L[i]=0 print(''.join(map(str,L)))
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "expression.operation.binary.change" ]
552,676
552,674
u901582103
python
p02761
dig, cnt = map(int, input().split()) ans = [-1]*dig for i in range(cnt): place, num = map(int, input().split()) place -= 1 if ans[place] != -1: if ans[place] != num: print(-1) exit() elif place == 0 and num == 0 and dig > 1: print(-1) exit() else: ans[place] = num for i in range(dig): if ans[i] == -1: if dig == 1: ans[i] = 1 else: ans[i] = 0 print(ans[i], end="")
dig, cnt = map(int, input().split()) ans = [-1]*dig for i in range(cnt): place, num = map(int, input().split()) place -= 1 if ans[place] != -1: if ans[place] != num: print(-1) exit() elif place == 0 and num == 0 and dig > 1: print(-1) exit() else: ans[place] = num for i in range(dig): if ans[i] == -1: if dig > 1 and i == 0: ans[i] = 1 else: ans[i] = 0 print(ans[i], end="")
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,681
552,682
u050087249
python
p02761
n , m = map(int, input().split()) l_1 = [] #左から1桁目の数字のりすと l_2 = [] #左から2桁目の数字のりすと l_3 = [] #左から3桁目の数字のりすと nocounter = 0 if m == 0: if n == 1: print(0) elif n == 2: print(10) else: print(100) else: for i in range(m): a, b = map(int, input().split()) if a == 1: l_1.append(b) elif a == 2: l_2.append(b) else: l_3.append(b) if len(l_1) > 0: pv = l_1[0] for j in range(len(l_1)): if not pv == l_1[j]: nocounter += 1 if l_1[j] == 0 and n > 1: nocounter += 1 if len(l_2) > 0: pv = l_2[0] for j in range(len(l_2)): if not pv == l_2[j]: nocounter += 1 if len(l_3) > 0: pv = l_3[0] for j in range(len(l_3)): if not pv == l_3[j]: nocounter += 1 if nocounter > 0: print(-1) else: if n == 1: print(l_1[0]) elif n == 2 and len(l_2)*len(l_1) > 0: print(10*l_1[0] + l_2[0]) elif n == 2 and len(l_1) == 0: print(10 + l_2[0]) elif n == 2 and len(l_2) == 0: print(10*l_1[0]) elif len(l_1)*len(l_2)*len(l_3) > 0: print(100*l_1[0] + 10*l_2[0] + l_3[0]) elif len(l_1) == 0 and len(l_2) == 0: print(100 + l_3[0]) elif len(l_1) == 0 and len(l_3) == 0: print(100 + l_2[0]) elif len(l_1) == 0: print(100 + 10*l_2[0] + l_3[0]) elif len(l_2) == 0 and len(l_3) == 0: print(100*l_1[0]) elif len(l_2) == 0 : print(100*l_1[0] + l_3[0]) else: print(100*l_1[0] + 10*l_2[0])
n , m = map(int, input().split()) l_1 = [] #左から1桁目の数字のりすと l_2 = [] #左から2桁目の数字のりすと l_3 = [] #左から3桁目の数字のりすと nocounter = 0 if m == 0: if n == 1: print(0) elif n == 2: print(10) else: print(100) else: for i in range(m): a, b = map(int, input().split()) if a == 1: l_1.append(b) elif a == 2: l_2.append(b) else: l_3.append(b) if len(l_1) > 0: pv = l_1[0] for j in range(len(l_1)): if not pv == l_1[j]: nocounter += 1 if l_1[j] == 0 and n > 1: nocounter += 1 if len(l_2) > 0: pv = l_2[0] for j in range(len(l_2)): if not pv == l_2[j]: nocounter += 1 if len(l_3) > 0: pv = l_3[0] for j in range(len(l_3)): if not pv == l_3[j]: nocounter += 1 if nocounter > 0: print(-1) else: if n == 1: print(l_1[0]) elif n == 2 and len(l_2)*len(l_1) > 0: print(10*l_1[0] + l_2[0]) elif n == 2 and len(l_1) == 0: print(10 + l_2[0]) elif n == 2 and len(l_2) == 0: print(10*l_1[0]) elif len(l_1)*len(l_2)*len(l_3) > 0: print(100*l_1[0] + 10*l_2[0] + l_3[0]) elif len(l_1) == 0 and len(l_2) == 0: print(100 + l_3[0]) elif len(l_1) == 0 and len(l_3) == 0: print(100 + 10*l_2[0]) elif len(l_1) == 0: print(100 + 10*l_2[0] + l_3[0]) elif len(l_2) == 0 and len(l_3) == 0: print(100*l_1[0]) elif len(l_2) == 0 : print(100*l_1[0] + l_3[0]) else: print(100*l_1[0] + 10*l_2[0])
[ "expression.operation.binary.add" ]
552,685
552,686
u347452770
python
p02761
N,M = map(int, input().split()) S = [] C = [] for i in range(M): s,c = map(int, input().split()) S.append(s) C.append(c) for n in range(1000): if len(str(n))==N: count = 0 if n==0: l=[0] else: l = [] while n > 0: l.append(n%10) n //= 10 l.reverse() for i in range(M): if(l[S[i]-1] == C[i]): count += 1 if count == M: break else: n=-1 print(n)
N,M = map(int, input().split()) S = [] C = [] for i in range(M): s,c = map(int, input().split()) S.append(s) C.append(c) for n in range(1000): m=n if len(str(n))==N: count = 0 if n==0: l=[0] else: l = [] while m > 0: l.append(m%10) m //= 10 l.reverse() for i in range(M): if(l[S[i]-1] == C[i]): count += 1 if count == M: break else: n=-1 print(n)
[ "identifier.change", "control_flow.loop.condition.change", "call.arguments.change", "expression.operation.binary.change" ]
552,701
552,702
u607074939
python
p02761
import numpy as np def getLine(): return list(map(int, input().split())) n,m = getLine() r = np.full(n,-1,dtype=int) for i in range(m): a,b = getLine() if r[a - 1] == -1: r[a - 1] = b elif r[a - 1] != b: print(-1) break else: if (n == 1 and r[0] < 0): print(-1) else: if r[0] == 0 and n == 1: print('0') else: if n > 1 and r[0] == -1: r[0] = 1 r[r == -1] = 0 r = r.astype(str) print(''.join(r))
import numpy as np def getLine(): return list(map(int, input().split())) n,m = getLine() r = np.full(n,-1,dtype=int) for i in range(m): a,b = getLine() if r[a - 1] == -1: r[a - 1] = b elif r[a - 1] != b: print(-1) break else: if n > 1 and r[0] == 0: print(-1) else: if r[0] == 0 and n == 1: print('0') else: if n > 1 and r[0] == -1: r[0] = 1 r[r == -1] = 0 r = r.astype(str) print(''.join(r))
[ "control_flow.branch.if.condition.change", "expression.operator.compare.change" ]
552,752
552,753
u940765148
python
p02761
N, M = map(int, input().split()) flag = 0 x = [1000] * N for m in range(M): s, c = map(int, input().split()) if (x[s-1] != 1000) & (x[s-1] != c): #print("{} {}".format(s,c)) #flag = 1 #pass if (s == 1) & (c == 0) & (N != 1): pass else: x[s-1] = x[s-1] if x[s-1] < c else c else: x[s-1] = c #print(x) ans = 0 for n in range(N): if x[n] != 1000: ans += 10**(N-n-1) * x[n] elif n==0: ans += 10**(N-n-1) * 1 #print(ans) if (N == 1) & (M == 0) & (flag == 0): print(0) elif (N == 1) & (M > 0) & (flag == 0): print(ans) elif (ans >= 10**(N-1)) & (flag == 0): print(ans) else: print(-1)
N, M = map(int, input().split()) flag = 0 x = [1000] * N for m in range(M): s, c = map(int, input().split()) if (x[s-1] != 1000) & (x[s-1] != c): #print("{} {}".format(s,c)) flag = 1 pass if (s == 1) & (c == 0) & (N != 1): pass else: x[s-1] = x[s-1] if x[s-1] < c else c else: x[s-1] = c #print(x) ans = 0 for n in range(N): if x[n] != 1000: ans += 10**(N-n-1) * x[n] elif n==0: ans += 10**(N-n-1) * 1 #print(ans) if (N == 1) & (M == 0) & (flag == 0): print(0) elif (N == 1) & (M > 0) & (flag == 0): print(ans) elif (ans >= 10**(N-1)) & (flag == 0): print(ans) else: print(-1)
[ "control_flow.pass.add" ]
552,764
552,765
u702786238
python
p02761
n, m = map(int, input().split()) ans = [0] * n cklist = [0] * n result = True for x in range(m): s, c = map(int, input().split()) if n != 1 and s == 1 and c == 0: print(-1) result = False break elif cklist[s - 1] == 1 and ans[s - 1] != c: print(-1) result = False break else: ans[s - 1] = c cklist[s - 1] = 1 if(ans[0] == 0): ans[0] += 1 ans_str = [str(n) for n in ans] if(result == True): print(''.join(ans_str))
n, m = map(int, input().split()) ans = [0] * n cklist = [0] * n result = True for x in range(m): s, c = map(int, input().split()) if n != 1 and s == 1 and c == 0: print(-1) result = False break elif cklist[s - 1] == 1 and ans[s - 1] != c: print(-1) result = False break else: ans[s - 1] = c cklist[s - 1] = 1 if(cklist[0] == 0 and n != 1): ans[0] += 1 ans_str = [str(n) for n in ans] if(result == True): print(''.join(ans_str))
[ "identifier.change", "control_flow.branch.if.condition.change" ]
552,770
552,771
u556610039
python
p02761
import sys # S = input() # N, M = map(int, input().split()) # As = [int(input()) for _ in range(N)] # nums = list(map(int, input().split())) # nums_2d = [list(map(int, input().split())) for _ in range(N)] def main(): print(solve()) def solve(): N, M = map(int, input().split()) scs = [list(map(int, input().split())) for _ in range(M)] minimum = 10 ** (N-1) if minimum == 1: minimum = 0 maximum = 10 ** N - 1 ans = -1 for i in range(minimum, maximum+1): candidate = str(i) ok = True for s, c in scs: if candidate[s-1] != c: ok = False break if ok: ans = int(candidate) break return ans if __name__ == '__main__': main()
import sys # S = input() # N, M = map(int, input().split()) # As = [int(input()) for _ in range(N)] # nums = list(map(int, input().split())) # nums_2d = [list(map(int, input().split())) for _ in range(N)] def main(): print(solve()) def solve(): N, M = map(int, input().split()) scs = [list(map(int, input().split())) for _ in range(M)] minimum = 10 ** (N-1) if minimum == 1: minimum = 0 maximum = 10 ** N - 1 ans = -1 for i in range(minimum, maximum+1): candidate = str(i) ok = True for s, c in scs: if candidate[s-1] != str(c): ok = False break if ok: ans = int(candidate) break return ans if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "call.add" ]
552,800
552,801
u764956288
python
p02761
def main(): n, m = map(int, input().split()) s, c = []*m, []*m for i in range(m): a, b = map(int, input()) s.append(a), c.append(b) for i in range(0, 10 ** n): loop = True string = str(i) if len(string) != n: continue for j in range(m): if string[s[j] - 1] != str(c[j]): loop = False if loop: print(string) quit() print(-1) if __name__ == "__main__": main()
def main(): n, m = map(int, input().split()) s, c = []*m, []*m for i in range(m): a, b = map(int, input().split()) s.append(a), c.append(b) for i in range(0, 10 ** n): loop = True string = str(i) if len(string) != n: continue for j in range(m): if string[s[j] - 1] != str(c[j]): loop = False if loop: print(string) quit() print(-1) if __name__ == "__main__": main()
[ "call.add" ]
552,823
552,824
u934052933
python
p02761
N, M = map(int, input().split()) if N == 1: ans = ["*"] elif N == 2: ans = ["*","*"] else: #N==3 ans = ["*","*","*"] ng = False for i in range(M): s, c = input().split() s = int(s)-1 if ans[s] != '*' and ans[s] != c: ng = True break elif s==0 and c=="0" and N>1: ng = True break else: ans[s] = c if N == 1 and ans == "*": ans = "0" if N == 2: if ans[0] == "*": ans[0] = "1" if ans[1] == "*": ans[1] = "0" if N == 3: if ans[0] == "*": ans[0] = "1" if ans[1] == "*": ans[1] = "0" if ans[2] == "*": ans[2] = "0" if ng: print(-1) else: print("".join(ans))
N, M = map(int, input().split()) if N == 1: ans = ["*"] elif N == 2: ans = ["*","*"] else: #N==3 ans = ["*","*","*"] ng = False for i in range(M): s, c = input().split() s = int(s)-1 if ans[s] != '*' and ans[s] != c: ng = True break elif s==0 and c=="0" and N>1: ng = True break else: ans[s] = c if N == 1 and ans[0] == "*": ans[0] = "0" if N == 2: if ans[0] == "*": ans[0] = "1" if ans[1] == "*": ans[1] = "0" if N == 3: if ans[0] == "*": ans[0] = "1" if ans[1] == "*": ans[1] = "0" if ans[2] == "*": ans[2] = "0" if ng: print(-1) else: print("".join(ans))
[ "control_flow.branch.if.condition.change" ]
552,827
552,828
u779728630
python
p02761
n,m = map(int,input().split()) # maxn = 10**n a=[0 for i in range(m)] b=[0 for i in range(m)] for i in range(m): a[i],b[i] = map(int,input().split()) if n==1: minn =0 maxn = 0 else: minn = 10**(n-1) maxn = 10**n for i in range(maxn//10, maxn): tmp = str(i) ok = True for aa, bb in zip(a,b): if int(tmp[aa-1]) == bb: pass else: ok = False break if ok: print(i) break else: print(-1)
n,m = map(int,input().split()) # maxn = 10**n a=[0 for i in range(m)] b=[0 for i in range(m)] for i in range(m): a[i],b[i] = map(int,input().split()) if n==1: minn =0 maxn = 10 else: minn = 10**(n-1) maxn = 10**n for i in range(minn, maxn): tmp = str(i) ok = True for aa, bb in zip(a,b): if int(tmp[aa-1]) == bb: pass else: ok = False break if ok: print(i) break else: print(-1)
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.remove" ]
552,851
552,852
u521866787
python
p02761
# -*- coding: utf-8 -*- def main(): N,M = map(int,input().split()) SC = [list(map(int,input().split())) for i in range(M)] ans = [] anst = '' for _ in range(N): ans.append(-1) for j in range(M): if ans[SC[j][0]-1] == -1 or ans[SC[j][0]-1] == SC[j][1]: ans[SC[j][0]-1] = SC[j][1] else: print('-1') return for k in range(N): if ans[k] == -1: if k == 0: ans[k] = 1 else: ans[k] = 0 anst += str(ans[k]) if len(str(int(anst))) != N: print('-1') return print(int(anst)) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- def main(): N,M = map(int,input().split()) SC = [list(map(int,input().split())) for i in range(M)] ans = [] anst = '' for _ in range(N): ans.append(-1) for j in range(M): if ans[SC[j][0]-1] == -1 or ans[SC[j][0]-1] == SC[j][1]: ans[SC[j][0]-1] = SC[j][1] else: print('-1') return for k in range(N): if ans[k] == -1: if k == 0 and N>=2: ans[k] = 1 else: ans[k] = 0 anst += str(ans[k]) if len(str(int(anst))) != N: print('-1') return print(int(anst)) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,861
552,862
u981040490
python
p02761
n, m = map(int, input().split()) x = [list(map(int, input().split())) for i in range(m)] for i in range(10**(n-1) if n>1 else 0, 10**n): i = str(i) for s, c in x: if i[s-1] != str(c): break else: print(n) exit() print(-1)
n, m = map(int, input().split()) x = [list(map(int, input().split())) for i in range(m)] for i in range(10**(n-1) if n>1 else 0, 10**n): i = str(i) for s, c in x: if i[s-1] != str(c): break else: print(i) exit() print(-1)
[ "identifier.change", "call.arguments.change", "io.output.change" ]
552,865
552,866
u849029577
python
p02761
n, m = map(int, input().split()) x = [list(map(int, input().split())) for i in range(m)] count = 0 for i in range(1000): count = 0 i = str(702) if len(i) == n: for s, c in x: if i[s-1] == str(c): count += 1 else: break if count == m: print(i) exit() print(-1)
n, m = map(int, input().split()) x = [list(map(int, input().split())) for i in range(m)] count = 0 for i in range(1000): count = 0 i = str(i) if len(i) == n: for s, c in x: if i[s-1] == str(c): count += 1 else: break if count == m: print(i) exit() print(-1)
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
552,868
552,869
u849029577
python
p02761
n, m = map(int, input().split()) sc = [] for i in range(m): sc.append(list(map(int, input().split()))) i = 10**(n-1) if n==1: i = 0 while i<10**n: for j in range(m): if int(str(i)[sc[j][0]-1])==sc[j][1]: pass else: no = True if no == False: print(i) break else: i+=1 no = False else: print(-1)
n, m = map(int, input().split()) sc = [] for i in range(m): sc.append(list(map(int, input().split()))) i = 10**(n-1) if n==1: i = 0 no = False while i<10**n: for j in range(m): if int(str(i)[sc[j][0]-1])==sc[j][1]: pass else: no = True if no == False: print(i) break else: i+=1 no = False else: print(-1)
[ "assignment.add" ]
552,870
552,871
u933129390
python
p02761
n,m=map(int, input().split()) list1=[list(map(int,input().split())) for i in range(m)] ans=['x']*n non=0 for i in range(m): if ans[list1[i][0]-1]!='x': if int(ans[list1[i][0]-1])==list1[i][1]: continue else: non=-1 break else: ans[list1[i][0]-1]=str(list1[i][1]) if non==-1: print(-1) else: if ans[0]=='0' and n!=1: print(-1) else: if 'x' in ans: if ans[0]=='x': ans[0]='1' for i in range(n): if ans[i]=='x': ans[i]='0' K='' for i in range(n): K+=ans[i] print(int(K))
n,m=map(int, input().split()) list1=[list(map(int,input().split())) for i in range(m)] ans=['x']*n non=0 for i in range(m): if ans[list1[i][0]-1]!='x': if int(ans[list1[i][0]-1])==list1[i][1]: continue else: non=-1 break else: ans[list1[i][0]-1]=str(list1[i][1]) if non==-1: print(-1) else: if ans[0]=='0' and n!=1: print(-1) else: if 'x' in ans: if ans[0]=='x' and n!=1: ans[0]='1' for i in range(n): if ans[i]=='x': ans[i]='0' K='' for i in range(n): K+=ans[i] print(int(K))
[ "control_flow.branch.if.condition.change" ]
552,880
552,881
u755801379
python
p02761
N,M = map(int, input().split()) L = [] ans = [] for i in range(M): L.append(list(map(int, input().split()))) ans.append(False) for i in range(10**N): num = str(i) if len(num) == 3: for j,l in enumerate(L): if num[l[0]-1] == str(l[1]): ans[j] = True continue else: break if all(ans): print(i) break if not all(ans): print(-1)
N,M = map(int, input().split()) L = [] ans = [] for i in range(M): L.append(list(map(int, input().split()))) ans.append(False) for i in range(10**N): num = str(i) if len(num) == N: for j,l in enumerate(L): if num[l[0]-1] == str(l[1]): ans[j] = True continue else: break if all(ans): print(i) break if not all(ans): print(-1)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
552,882
552,883
u851319680
python
p02761
n, m = map(int, input().split()) s = [] c = [] for i in range(m): rets, retc = map(int, input().split()) s.append(rets) c.append(retc) ans = ["-1"] * n check = True for i in range(m): if ans[s[i] - 1] == str(c[i]) or ans[s[i] - 1] == "-1": ans[s[i] - 1] = str(c[i]) else: check = False if n != 1 and ans[0] == "0": check = False if ans.count("-1") == n: print(0) else: for i in range(n): if ans[i] == "-1": if i == 0: ans[i] = "1" else: ans[i] = "0" if check: print(''.join(ans)) else: print(-1)
n, m = map(int, input().split()) s = [] c = [] for i in range(m): rets, retc = map(int, input().split()) s.append(rets) c.append(retc) ans = ["-1"] * n check = True for i in range(m): if ans[s[i] - 1] == str(c[i]) or ans[s[i] - 1] == "-1": ans[s[i] - 1] = str(c[i]) else: check = False if n != 1 and ans[0] == "0": check = False if n == 1 and ans.count("-1") == n: print(0) else: for i in range(n): if ans[i] == "-1": if i == 0: ans[i] = "1" else: ans[i] = "0" if check: print(''.join(ans)) else: print(-1)
[ "control_flow.branch.if.condition.change" ]
552,887
552,888
u346424924
python
p02761
import itertools N, M = map(int, input().split()) s, c = [], [] for _ in range(M): ts,tc = map(int ,input().split()) s.append(ts) c.append(tc) ans = 10**10 for p in itertools.product(range(10), repeat=N): if p[0] == 0: continue cond = 0 for i in range(M): ind = s[i]-1 num = c[i] if p[ind] != num: cond = 1 break if cond: continue else: ans = min(ans, int(''.join(list(map(str, p))))) if ans == 10**10: print(-1) else: print(ans)
import itertools N, M = map(int, input().split()) s, c = [], [] for _ in range(M): ts,tc = map(int ,input().split()) s.append(ts) c.append(tc) ans = 10**10 for p in itertools.product(range(10), repeat=N): if N >= 2 and p[0] == 0: continue cond = 0 for i in range(M): ind = s[i]-1 num = c[i] if p[ind] != num: cond = 1 break if cond: continue else: ans = min(ans, int(''.join(list(map(str, p))))) if ans == 10**10: print(-1) else: print(ans)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,901
552,902
u314050667
python
p02761
N, M = list(map(int, input().split())) SC = [] for i in range(M): s, c = list(map(int, input().split())) SC.append([s-1, c]) poss = [] if N == 3: s = 100 e = 1000 elif N == 2: s = 10 e = 100 else: s = 1 e = 10 for i in range(s, e): poss.append(str(i)) for s, c in SC: poss2 = [] for n in poss: if n[s] == str(c): poss2.append(n) poss = poss2 # print(poss2) if poss: print(poss[0]) else: print(-1)
N, M = list(map(int, input().split())) SC = [] for i in range(M): s, c = list(map(int, input().split())) SC.append([s-1, c]) poss = [] if N == 3: s = 100 e = 1000 elif N == 2: s = 10 e = 100 else: s = 0 e = 10 for i in range(s, e): poss.append(str(i)) for s, c in SC: poss2 = [] for n in poss: if n[s] == str(c): poss2.append(n) poss = poss2 # print(poss2) if poss: print(poss[0]) else: print(-1)
[ "literal.number.integer.change", "assignment.value.change" ]
552,905
552,906
u002459665
python
p02761
N, M = map(int, input().split()) s = [list(map(int, list(input().split()))) for i in range(M)] ans = [-1] * N for i in s: if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]: print(-1) exit() ans[i[0] - 1] = i[1] if M == 0 and N != 1: ans[0] = 1 tmp = int(''.join((map(str, [int(str(a).replace('-1', '0')) for a in ans])))) if N >= 2 and tmp == 0 and ans[0] == -1: ans[0] = 1 ans = [int(str(a).replace('-1', '0')) for a in ans] res = ''.join((map(str, ans))) if int(res) >= 0 and len(str(int(res))) == N: print(int(res)) else: print(-1)
N, M = map(int, input().split()) s = [list(map(int, list(input().split()))) for i in range(M)] ans = [-1] * N for i in s: if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]: print(-1) exit() ans[i[0] - 1] = i[1] if M == 0 and N != 1: ans[0] = 1 tmp = int(''.join((map(str, [int(str(a).replace('-1', '0')) for a in ans])))) if N >= 2 and ans[0] == -1: ans[0] = 1 ans = [int(str(a).replace('-1', '0')) for a in ans] res = ''.join((map(str, ans))) if int(res) >= 0 and len(str(int(res))) == N: print(int(res)) else: print(-1)
[]
552,911
552,912
u177070195
python
p02761
N,M = map(int,input().split()) sc = [] for i in range(M): s,c = map(int,input().split()) c = str(c) sc.append([s-1,c]) for i in range(10**N+1): tmp = str(i) flag = False count = 0 if len(tmp) == N: for s,c in sc: if tmp[s] == c: count += 1 if count == N: flag = True if flag: print(tmp) exit() print(-1)
N,M = map(int,input().split()) sc = [] for i in range(M): s,c = map(int,input().split()) c = str(c) sc.append([s-1,c]) for i in range(10**N+1): tmp = str(i) flag = False count = 0 if len(tmp) == N: for s,c in sc: if tmp[s] == c: count += 1 if count == M: flag = True if flag: print(tmp) exit() print(-1)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
552,925
552,926
u497952650
python
p02761
import sys sys.setrecursionlimit(1000000000) import math from math import gcd def lcm(a, b): return a * b // gcd(a, b) from itertools import count, permutations from functools import lru_cache from collections import deque, defaultdict from pprint import pprint ii = lambda: int(input()) mis = lambda: map(int, input().split()) lmis = lambda: list(mis()) INF = float('inf') N1097 = 10**9 + 7 def meg(f, ok, ng): while abs(ok-ng)>1: mid = (ok+ng)//2 if f(mid): ok=mid else: ng=mid return ok def get_inv(n, modp): return pow(n, modp-2, modp) def factorials_list(n, modp): # 10**6 fs = [1] for i in range(1, n+1): fs.append(fs[-1] * i % modp) return fs def invs_list(n, fs, modp): # 10**6 invs = [get_inv(fs[-1], modp)] for i in range(n, 1-1, -1): invs.append(invs[-1] * i % modp) invs.reverse() return invs def comb(n, k, modp): num = 1 for i in range(n, n-k, -1): num = num * i % modp den = 1 for i in range(2, k+1): den = den * i % modp return num * get_inv(den, modp) % modp def comb_from_list(n, k, modp, fs, invs): return fs[n] * invs[n-k] * invs[k] % modp # def main(): N,M=mis() sc = [lmis() for _ in range(M)] for i in map(str, range(10**(N-1), 10**N)): if all(len(i) >= s and i[s-1] == str(c) for s, c in sc): print(i) return print(-1) main()
import sys sys.setrecursionlimit(1000000000) import math from math import gcd def lcm(a, b): return a * b // gcd(a, b) from itertools import count, permutations from functools import lru_cache from collections import deque, defaultdict from pprint import pprint ii = lambda: int(input()) mis = lambda: map(int, input().split()) lmis = lambda: list(mis()) INF = float('inf') N1097 = 10**9 + 7 def meg(f, ok, ng): while abs(ok-ng)>1: mid = (ok+ng)//2 if f(mid): ok=mid else: ng=mid return ok def get_inv(n, modp): return pow(n, modp-2, modp) def factorials_list(n, modp): # 10**6 fs = [1] for i in range(1, n+1): fs.append(fs[-1] * i % modp) return fs def invs_list(n, fs, modp): # 10**6 invs = [get_inv(fs[-1], modp)] for i in range(n, 1-1, -1): invs.append(invs[-1] * i % modp) invs.reverse() return invs def comb(n, k, modp): num = 1 for i in range(n, n-k, -1): num = num * i % modp den = 1 for i in range(2, k+1): den = den * i % modp return num * get_inv(den, modp) % modp def comb_from_list(n, k, modp, fs, invs): return fs[n] * invs[n-k] * invs[k] % modp # def main(): N,M=mis() sc = [lmis() for _ in range(M)] for i in map(str, range(10**(N-1) if N>1 else 0, 10**N)): if all(len(i) >= s and i[s-1] == str(c) for s, c in sc): print(i) return print(-1) main()
[ "control_flow.loop.range.bounds.lower.change" ]
552,929
552,930
u402629484
python
p02761
in1 = input('') n = int(in1.split(' ')[0]) m = int(in1.split(' ')[1]) l = [] for i in range(0,n): l.append(-1) hasError = False for i in range(0,m): in2 = input('') idx = int(in2.split(' ')[0])-1 li = int(in2.split(' ')[1]) if l[idx] != -1 and l[idx] != li: hasError = True else: l[idx] = li for i in range(0,n): if l[i] == -1: if i == 0: l[i] = 1 else: l[i] = 0 result = 0 for i in range(0,n): ix = 1 for j in range(0,(n-i-1)): ix*=10 result += int(l[i])*ix if result < 0: result = -1 if n == 1 and result == 0: result = 0 elif len(str(result)) != n: result = -1 if hasError == True: result = -1 print(result)
in1 = input('') n = int(in1.split(' ')[0]) m = int(in1.split(' ')[1]) l = [] for i in range(0,n): l.append(-1) hasError = False for i in range(0,m): in2 = input('') idx = int(in2.split(' ')[0])-1 li = int(in2.split(' ')[1]) if l[idx] != -1 and l[idx] != li: hasError = True else: l[idx] = li for i in range(0,n): if l[i] == -1: if i == 0 and n > 1: l[i] = 1 else: l[i] = 0 result = 0 for i in range(0,n): ix = 1 for j in range(0,(n-i-1)): ix*=10 result += int(l[i])*ix if result < 0: result = -1 if n == 1 and result == 0: result = 0 elif len(str(result)) != n: result = -1 if hasError == True: result = -1 print(result)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,933
552,934
u194228880
python
p02761
N,M = map(int, input().split()) A=[-1 for i in range(N)] ans=True for i in range(M): s, c = map(int, input().split()) if A[s-1]==-1: A[s-1]=c elif A[s-1]!=c: ans=False if A[0]==0: ans=False head=True for i in range(N): if A[i]==-1: if head: A[i]=1 head=False else: A[i]=0 elif A[i]==0: pass else: head=False if ans and not head: A=[str(a) for a in A] print("".join(A)) elif head and N==1: print(0) else: print(-1)
N,M = map(int, input().split()) A=[-1 for i in range(N)] ans=True for i in range(M): s, c = map(int, input().split()) if A[s-1]==-1: A[s-1]=c elif A[s-1]!=c: ans=False if A[0]==0: ans=False head=True for i in range(N): if A[i]==-1: if head and N!=1: A[i]=1 head=False else: A[i]=0 elif A[i]==0: pass else: head=False if ans and not head: A=[str(a) for a in A] print("".join(A)) elif head and N==1: print(0) else: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
552,939
552,940
u233159251
python
p02761
N,M = map(int, input().split()) A=[-1 for i in range(N)] ans=True for i in range(M): s, c = map(int, input().split()) if A[s-1]==-1: A[s-1]=c elif A[s-1]!=c: ans=False if A[0]==0: ans=False head=True for i in range(N): if A[i]==-1: if head: A[i]=1 head==False else: A[i]=0 elif A[i]==0: pass else: head=False if ans and not head: A=[str(a) for a in A] print("".join(A)) elif head and N==1: print(0) else: print(-1)
N,M = map(int, input().split()) A=[-1 for i in range(N)] ans=True for i in range(M): s, c = map(int, input().split()) if A[s-1]==-1: A[s-1]=c elif A[s-1]!=c: ans=False if A[0]==0: ans=False head=True for i in range(N): if A[i]==-1: if head and N!=1: A[i]=1 head=False else: A[i]=0 elif A[i]==0: pass else: head=False if ans and not head: A=[str(a) for a in A] print("".join(A)) elif head and N==1: print(0) else: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
552,941
552,940
u233159251
python
p02761
N, M = map(int, input().split()) num = [-1]*N err = False for _ in range(M): s, c = map(int, input().split()) if num[s-1] == -1: num[s-1] = c else: if num[s-1] != c: err = True if err or (N > 1 and num[0] == 0): print(-1) else: ans = 0 i = 0 n = 0 while i < N: if num[i] < 0: n = 1 if i == 0 else 0 else: n = num[i] ans = ans * 10 + n i += 1 print(ans)
N, M = map(int, input().split()) num = [-1]*N err = False for _ in range(M): s, c = map(int, input().split()) if num[s-1] == -1: num[s-1] = c else: if num[s-1] != c: err = True if err or (N > 1 and num[0] == 0): print(-1) else: ans = 0 i = 0 n = 0 while i < N: if num[i] < 0: n = 1 if i == 0 and N > 1 else 0 else: n = num[i] ans = ans * 10 + n i += 1 print(ans)
[]
552,942
552,943
u978178314
python
p02761
N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] i = 10**(N-1) while i < 10**N: n = [(i//10**j)%10 for j in reversed(list(range(N)))] f = True for s, c in SC: if n[s-1] != c: f = False if f: break i += 1 if i >= 10**N: print(-1) else: print(i)
N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] i = 10**(N-1) if N > 1 else 0 while i < 10**N: n = [(i//10**j)%10 for j in reversed(list(range(N)))] f = True for s, c in SC: if n[s-1] != c: f = False if f: break i += 1 if i >= 10**N: print(-1) else: print(i)
[]
552,944
552,945
u978178314
python
p02761
N, M = map(int, input().split()) cand = ['*'] * M mn = '' for m in range(M): s, c = map(int, input().split()) if s==1 and c==0 and N > 1: mn = '-1' if cand[s-1] == '*' or cand[s-1] == str(c): cand[s-1] = str(c) else: mn = '-1' if mn == '-1': print (mn) exit() for i in range(N): if cand[i]=='*': if i==0: mn+='1' else: mn+='0' else: mn+=cand[i] print (mn)
N, M = map(int, input().split()) cand = ['*'] * N mn = '' for m in range(M): s, c = map(int, input().split()) if s==1 and c==0 and N > 1: mn = '-1' if cand[s-1] == '*' or cand[s-1] == str(c): cand[s-1] = str(c) else: mn = '-1' if mn == '-1': print (mn) exit() for i in range(N): if cand[i]=='*': if i==0 and N > 1: mn+='1' else: mn+='0' else: mn+=cand[i] print (mn)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
553,009
553,010
u709304134
python
p02761
n,m = list(map(int,input().split())) s = [] c = [] for i in range(m): ss,cc = list(map(int,input().split())) s.append(ss -1 ) c.append(cc) ans = [-1] * n flag = True for i in range(m): if ans[s[i]] == -1 : ans[s[i]] = c[i] elif ans[s[i]] != c[i]: flag = False if n !=1 and ans[0] == 0: flag = False if flag : ans = [ str(a) if a != -1 else "0" for a in ans ] if n != 1 and ans[0] == "0": ans[0] = 1 print("".join(ans)) else: print(-1)
n,m = list(map(int,input().split())) s = [] c = [] for i in range(m): ss,cc = list(map(int,input().split())) s.append(ss -1 ) c.append(cc) ans = [-1] * n flag = True for i in range(m): if ans[s[i]] == -1 : ans[s[i]] = c[i] elif ans[s[i]] != c[i]: flag = False if n !=1 and ans[0] == 0: flag = False if flag : ans = [ str(a) if a != -1 else "0" for a in ans ] if n != 1 and ans[0] == "0": ans[0] = "1" print("".join(ans)) else: print(-1)
[]
553,024
553,025
u254050469
python
p02761
n,m = list(map(int,input().split())) s = [] c = [] for i in range(m): ss,cc = list(map(int,input().split())) s.append(ss -1 ) c.append(cc) ans = [-1] * n flag = True for i in range(m): if ans[s[i]] == -1 : ans[s[i]] = c[i] elif ans[s[i]] != c[i]: flag = False if n !=1 and ans[0] == 0: flag = False if flag : ans = [ str(a) if a != -1 else "0" for a in ans ] if n != 1 and ans[0] == 0: ans[0] = 1 print("".join(ans)) else: print(-1)
n,m = list(map(int,input().split())) s = [] c = [] for i in range(m): ss,cc = list(map(int,input().split())) s.append(ss -1 ) c.append(cc) ans = [-1] * n flag = True for i in range(m): if ans[s[i]] == -1 : ans[s[i]] = c[i] elif ans[s[i]] != c[i]: flag = False if n !=1 and ans[0] == 0: flag = False if flag : ans = [ str(a) if a != -1 else "0" for a in ans ] if n != 1 and ans[0] == "0": ans[0] = "1" print("".join(ans)) else: print(-1)
[ "control_flow.branch.if.condition.change" ]
553,026
553,025
u254050469
python
p02761
n,m = list(map(int,input().split())) s = [] c = [] for i in range(m): ss,cc = list(map(int,input().split())) s.append(ss -1 ) c.append(cc) ans = [-1] * n flag = True for i in range(m): if ans[s[i]] == -1 : ans[s[i]] = c[i] elif ans[s[i]] != c[i]: flag = False if n !=1 and ans[0] == 0: flag = False if flag : ans = [ str(a) if a != -1 else "0" for a in ans ] if n != 1 and ans[0] == 0: ans[0] == 1 print("".join(ans)) else: print(-1)
n,m = list(map(int,input().split())) s = [] c = [] for i in range(m): ss,cc = list(map(int,input().split())) s.append(ss -1 ) c.append(cc) ans = [-1] * n flag = True for i in range(m): if ans[s[i]] == -1 : ans[s[i]] = c[i] elif ans[s[i]] != c[i]: flag = False if n !=1 and ans[0] == 0: flag = False if flag : ans = [ str(a) if a != -1 else "0" for a in ans ] if n != 1 and ans[0] == "0": ans[0] = "1" print("".join(ans)) else: print(-1)
[ "control_flow.branch.if.condition.change", "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
553,027
553,025
u254050469
python
p02761
N,M = map(int,input().split()) A = [-1]*N for _ in range(M): s,c = map(int,input().split()) if A[s-1] !=-1 and A[s-1] != c: print(-1) exit() A[s - 1] = c if N>1 and A[0] == 0: print(-1) exit() ans = 0 if A[0] == -1: A[0] = 1 for a in A: if a == -1: a = 0 ans+=a ans*=10 print(ans//10)
N,M = map(int,input().split()) A = [-1]*N for _ in range(M): s,c = map(int,input().split()) if A[s-1] !=-1 and A[s-1] != c: print(-1) exit() A[s - 1] = c if N>1 and A[0] == 0: print(-1) exit() ans = 0 if N>1 and A[0] == -1: A[0] = 1 for a in A: if a == -1: a = 0 ans+=a ans*=10 print(ans//10)
[ "control_flow.branch.if.condition.change" ]
553,030
553,031
u561266238
python
p02761
N, M = map(int, input().split()) A = [0] * N B = [0] * N T = 1 ans = 0 for i in range(M): s_i , c_i = map(int, input().split()) if B[s_i - 1] == 0: A[s_i - 1] = c_i B[s_i - 1] = 1 else: if A[s_i - 1] != c_i: T = 0 if B[0] == 0: A[0] = 1 for i in range(N): y = A[N - i - 1] y = int(y) ans = ans + y * 10 ** i if T == 0: ans = -1 elif A[0] == 0 and N !=1 : ans = -1 print(ans)
N, M = map(int, input().split()) A = [0] * N B = [0] * N T = 1 ans = 0 for i in range(M): s_i , c_i = map(int, input().split()) if B[s_i - 1] == 0: A[s_i - 1] = c_i B[s_i - 1] = 1 else: if A[s_i - 1] != c_i: T = 0 if B[0] == 0 and N != 1: A[0] = 1 for i in range(N): y = A[N - i - 1] y = int(y) ans = ans + y * 10 ** i if T == 0: ans = -1 elif A[0] == 0 and N !=1 : ans = -1 print(ans)
[ "control_flow.branch.if.condition.change" ]
553,059
553,060
u042497514
python
p02761
N,M = map(int,input().split()) ans = [-1] * N chk = 0 for i in range(M): s,c = map(int,input().split()) if ans[s-1] < 0: ans[s-1] = c elif ans[s-1] == c: continue else: chk = -1 for i in range(N): if i == 0: if ans[i] == -1: if M == 0: ans[i] = 0 else: ans[i] = 1 elif ans[i] == 0: if N != 1: chk = -1 else: if ans[i] == -1: ans[i] = 0 if chk == -1: print(-1) else: for i in range(N): ans[i] = str(ans[i]) s = "".join(ans) print(s)
N,M = map(int,input().split()) ans = [-1] * N chk = 0 for i in range(M): s,c = map(int,input().split()) if ans[s-1] < 0: ans[s-1] = c elif ans[s-1] == c: continue else: chk = -1 for i in range(N): if i == 0: if ans[i] == -1: if N == 1 and M == 0: ans[i] = 0 else: ans[i] = 1 elif ans[i] == 0: if N != 1: chk = -1 else: if ans[i] == -1: ans[i] = 0 if chk == -1: print(-1) else: for i in range(N): ans[i] = str(ans[i]) s = "".join(ans) print(s)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
553,061
553,062
u513900925
python
p02761
N, M = [int(x) for x in input().split(" ")] digits = [-1] * N flag = False for i in range(M): s, c = [int(x) for x in input().split(" ")] if (digits[s-1] == -1 or digits[s-1] == c): digits[s-1] = c else: flag = True break if (flag): print(-1) elif (N != 1 and digits[0] == 0): print(-1) else: for i in range(N): if (digits[i] != -1): print(digits[i], end="") else: if (i != 0 or N == 1): print(0, end = "") else: print(1, end=" ") print()
N, M = [int(x) for x in input().split(" ")] digits = [-1] * N flag = False for i in range(M): s, c = [int(x) for x in input().split(" ")] if (digits[s-1] == -1 or digits[s-1] == c): digits[s-1] = c else: flag = True break if (flag): print(-1) elif (N != 1 and digits[0] == 0): print(-1) else: for i in range(N): if (digits[i] != -1): print(digits[i], end="") else: if (i != 0 or N == 1): print(0, end = "") else: print(1, end="") print()
[ "call.arguments.change", "io.output.change" ]
553,083
553,084
u628151901
python
p02761
N, M = map(int, input().split()) X = ["x"]*N flag = True for i in range(M): s, c = map(int, input().split()) if X[s-1] == "x": X[s-1] = c elif X[s-1] != c: flag = False break if N > 1 and X[0] == 0: flag = False if X[0] == "x": X[0] = 1 if flag: for i in X: if i == "x": print(0 ,end="") else: print(i ,end="") else: print(-1)
N, M = map(int, input().split()) X = ["x"]*N flag = True for i in range(M): s, c = map(int, input().split()) if X[s-1] == "x": X[s-1] = c elif X[s-1] != c: flag = False break if N > 1 and X[0] == 0: flag = False if N > 1 and X[0] == "x": X[0] = 1 if flag: for i in X: if i == "x": print(0 ,end="") else: print(i ,end="") else: print(-1)
[ "control_flow.branch.if.condition.change" ]
553,089
553,090
u455809703
python
p02761
N, M = map(int, input().split()) s = [] c = [] check = [-1 for _ in range(N)] muri = False for _ in range(M): tmp = list(map(int, input().split())) s.append(tmp[0]) c.append(tmp[1]) result = [0 for _ in range(N)] for idx, S in enumerate(s): if check[S-1] < 0: result[S-1] = str(c[idx]) check[S-1] = c[idx] if (S == 1) and c[idx] == 0: if N != 1: muri = True break else: if check[S-1] != c[idx]: muri = True break if result[0] == 0: result[0] = 1 a = '' reigai = True if N==1 and M==0: reigai = True for i in result: a += str(i) if muri: print(-1) else: if reigai: print(0) else: print(int(a))
N, M = map(int, input().split()) s = [] c = [] check = [-1 for _ in range(N)] muri = False for _ in range(M): tmp = list(map(int, input().split())) s.append(tmp[0]) c.append(tmp[1]) result = [0 for _ in range(N)] for idx, S in enumerate(s): if check[S-1] < 0: result[S-1] = str(c[idx]) check[S-1] = c[idx] if (S == 1) and c[idx] == 0: if N != 1: muri = True break else: if check[S-1] != c[idx]: muri = True break if result[0] == 0: result[0] = 1 a = '' reigai = False if N==1 and M==0: reigai = True for i in result: a += str(i) if muri: print(-1) else: if reigai: print(0) else: print(int(a))
[ "misc.opposites", "assignment.value.change" ]
553,095
553,096
u226082503
python
p02761
N,M=map(int,input().split()) sc=[list(map(int,input().split())) for _ in range(M)] answer=[] if N==1: for j in range(10): for i in range(M): if int(str(j)[sc[i][0]-1])==sc[i][1]: a+=1 else: break if a==M: answer.append(j) else: for j in range(10**(N-1),10**N): a=0 for i in range(M): if int(str(j)[sc[i][0]-1])==sc[i][1]: a+=1 else: break if a==M: answer.append(j) if len(answer)>=1: print(min(answer)) #print(answer) else: print(-1)
N,M=map(int,input().split()) sc=[list(map(int,input().split())) for _ in range(M)] answer=[] if N==1: for j in range(10): a=0 for i in range(M): if int(str(j)[sc[i][0]-1])==sc[i][1]: a+=1 else: break if a==M: answer.append(j) else: for j in range(10**(N-1),10**N): a=0 for i in range(M): if int(str(j)[sc[i][0]-1])==sc[i][1]: a+=1 else: break if a==M: answer.append(j) if len(answer)>=1: print(min(answer)) #print(answer) else: print(-1)
[ "assignment.add" ]
553,101
553,102
u547608423
python
p02761
#ABC157 C - Guess The Number N,M = map(int,input().split(' ')) ans = ['']*3 flag = True for i in range(M): s,c = map(int,input().split(' ')) if(ans[s-1] == '' or ans[s-1] == str(c)): ans[s-1] = str(c) else: flag = False if(ans[0] == '0' and N > 1): flag = False #print(flag) #print(ans) ansint = 0 if(flag == True): for i in range(3): if (ans[i] != ''): ansint += int(ans[i])*10**(N-i-1) elif (ans[i] == '' and i == 0): ansint += 10**(N-1) print(ansint) else: print(-1)
#ABC157 C - Guess The Number N,M = map(int,input().split(' ')) ans = ['']*3 flag = True for i in range(M): s,c = map(int,input().split(' ')) if(ans[s-1] == '' or ans[s-1] == str(c)): ans[s-1] = str(c) else: flag = False if(ans[0] == '0' and N > 1): flag = False #print(flag) #print(ans) ansint = 0 if(flag == True): for i in range(3): if (ans[i] != ''): ansint += int(ans[i])*10**(N-i-1) elif (ans[i] == '' and i == 0 and N > 1): ansint += 10**(N-1) print(ansint) else: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
553,133
553,134
u308919961
python
p02761
n, m = map(int, input().split()) sc = sorted([list(map(int, input().split())) for _ in range(m)]) ans = ["*"] * (n) for s, c in sc: if ans[s-1] != "*" and ans[s-1] != str(c): print(-1) exit() else: ans[s-1] = str(c) for i in range(n): if ans[i] == "*": if i == 0 and i != 0: ans[i] = "1" else: ans[i] = "0" ans = "".join(ans) if ans == str(int(ans)): print(int(ans)) else: print(-1)
n, m = map(int, input().split()) sc = sorted([list(map(int, input().split())) for _ in range(m)]) ans = ["*"] * (n) for s, c in sc: if ans[s-1] != "*" and ans[s-1] != str(c): print(-1) exit() else: ans[s-1] = str(c) for i in range(n): if ans[i] == "*": if i == 0 and i != n-1: ans[i] = "1" else: ans[i] = "0" ans = "".join(ans) if ans == str(int(ans)): print(int(ans)) else: print(-1)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
553,145
553,146
u832152513
python
p02761
#import re import sys input = sys.stdin.readline #import heapq #import bisect #from collections import deque #import math def main(): n, m = map(int, input().split()) ans = 0 if n == 3: A = [10] * 3 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if A[2] == 10: A[2] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1]) + str(A[2])) if n == 2: A = [10] * 2 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1])) if n == 1: A = 10 for i in range(m): s, c = map(int, input().split()) if A == 10: A = c elif A != c: ans = -1 break if A == 10: A[0] = 0 if ans == -1: print(-1) else: print(A) if __name__ == '__main__': main()
#import re import sys input = sys.stdin.readline #import heapq #import bisect #from collections import deque #import math def main(): n, m = map(int, input().split()) ans = 0 if n == 3: A = [10] * 3 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if A[2] == 10: A[2] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1]) + str(A[2])) if n == 2: A = [10] * 2 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1])) if n == 1: A = 10 for i in range(m): s, c = map(int, input().split()) if A == 10: A = c elif A != c: ans = -1 break if A == 10: A = 0 if ans == -1: print(-1) else: print(str(A)) if __name__ == '__main__': main()
[ "call.add", "call.arguments.change" ]
553,162
553,163
u639380385
python
p02761
#import re import sys input = sys.stdin.readline #import heapq #import bisect #from collections import deque #import math def main(): n, m = map(int, input().split()) ans = 0 if n == 3: A = [10] * 3 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if A[2] == 10: A[2] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1]) + str(A[2])) if n == 2: A = [10] * 2 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1])) if n == 1: A = 10 for i in range(m): s, c = map(int, input().split()) if A == 10: A = c elif A != c: ans = -1 break if A == 10: A[0] = 0 if ans == -1: print(-1) else: print(A) if __name__ == '__main__': main()
#import re import sys input = sys.stdin.readline #import heapq #import bisect #from collections import deque #import math def main(): n, m = map(int, input().split()) ans = 0 if n == 3: A = [10] * 3 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if A[2] == 10: A[2] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1]) + str(A[2])) if n == 2: A = [10] * 2 for i in range(m): s, c = map(int, input().split()) s -= 1 if A[s] == 10: A[s] = c elif A[s] != c: ans = -1 break if A[0] == 0: ans = -1 if A[0] == 10: A[0] = 1 if A[1] == 10: A[1] = 0 if ans == -1: print(-1) else: print(str(A[0]) + str(A[1])) if n == 1: A = 10 for i in range(m): s, c = map(int, input().split()) if A == 10: A = c elif A != c: ans = -1 break if A == 10: A = 0 if ans == -1: print(-1) else: print(str(A)) if __name__ == '__main__': main()
[ "call.add", "call.arguments.change" ]
553,164
553,163
u639380385
python
p02761
n, m = map(int, input().split()) box = [-1 for _ in range(n)] for i in range(m): s, c = map(int, input().split()) s -= 1 if box[s] != -1 and box[s] != c: print(-1) exit() box[s] = c ans = "" if n == 0: if box[0] == -1: print(0) else: print(box[0]) exit() for i in range(n): if box[i] == -1 and i == 0: ans += '1' elif box[i] == -1: ans += '0' else: if i == 0 and box[i] == 0: print(-1) exit() ans += str(box[i]) print(ans)
n, m = map(int, input().split()) box = [-1 for _ in range(n)] for i in range(m): s, c = map(int, input().split()) s -= 1 if box[s] != -1 and box[s] != c: print(-1) exit() box[s] = c ans = "" if n == 1: if box[0] == -1: print(0) else: print(box[0]) exit() for i in range(n): if box[i] == -1 and i == 0: ans += '1' elif box[i] == -1: ans += '0' else: if i == 0 and box[i] == 0: print(-1) exit() ans += str(box[i]) print(ans)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
553,170
553,171
u270681687
python
p02761
n,m = map(int,input().split()) ketasuu,content = [],[] for _ in range(m): s,c = map(int,input().split()) ketasuu.append(s-1) content.append(c) ans = 10000-1 for i in range(0,10000): tmp =list(str(i)) flag = [] for j in range(m): try: if tmp[ketasuu[j]] == str(content[j]): flag.append(True) else: flag.append(False) except: pass if all(flag) and len(tmp)==n: ans = min(i,ans) if ans == 10000: print(-1) else: print(ans)
n,m = map(int,input().split()) ketasuu,content = [],[] for _ in range(m): s,c = map(int,input().split()) ketasuu.append(s-1) content.append(c) ans = 10000-1 for i in range(0,10000): tmp =list(str(i)) flag = [] for j in range(m): try: if tmp[ketasuu[j]] == str(content[j]): flag.append(True) else: flag.append(False) except: pass if all(flag) and len(tmp)==n: ans = min(i,ans) if ans == 10000-1: print(-1) else: print(ans)
[ "control_flow.branch.if.condition.change" ]
553,172
553,173
u291628833
python
p02761
def main(): N,M=map(int, input().split()) a = [-1] * N for _ in range(M): s,c=map(int, input().split()) if a[s-1] == -1 or a[s-1] == c: a[s-1] = c else: print(-1) return if N > 1 and a[0] == 0: print(-1) return ans = '' for i in range(N): if a[i] != -1: ans += str(a[i]) elif i == 0: ans += '1' else: ans += '0' print(ans) if __name__ == '__main__': main()
def main(): N,M=map(int, input().split()) a = [-1] * N for _ in range(M): s,c=map(int, input().split()) if a[s-1] == -1 or a[s-1] == c: a[s-1] = c else: print(-1) return if N > 1 and a[0] == 0: print(-1) return ans = '' for i in range(N): if a[i] != -1: ans += str(a[i]) elif i == 0 and N > 1: ans += '1' else: ans += '0' print(ans) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
553,192
553,193
u790922244
python
p02761
def main(): n,m=map(int,input().split()) ls=[list(map(int,input().split())) for i in range(m)] ans=[-1]*n flag=True for i in ls: idx,value=i[0]-1,i[1] tgt=ans[idx] if tgt!=value and tgt!=-1: flag=False break else: ans[idx]=i[1] if flag: if ans[0]==0: if n==1: print(0) else: print(-1) else: for i in range(n): if ans[i]==-1: if m == 0: ans[i]=0 elif i == 0: ans[i]=1 else: ans[i]=0 print(int("".join(list(map(str,ans))))) else: print(-1) main()
def main(): n,m=map(int,input().split()) ls=[list(map(int,input().split())) for i in range(m)] ans=[-1]*n flag=True for i in ls: idx,value=i[0]-1,i[1] tgt=ans[idx] if tgt!=value and tgt!=-1: flag=False break else: ans[idx]=i[1] if flag: if ans[0]==0: if n==1: print(0) else: print(-1) else: for i in range(n): if ans[i]==-1: if n==1 and m==0: ans[i]=0 elif i == 0: ans[i]=1 else: ans[i]=0 print(int("".join(list(map(str,ans))))) else: print(-1) main()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
553,200
553,201
u256351611
python
p02761
import sys N, M = map(int, input().split()) s = [] c = [] for i in range(M): s1,c1=[int(i) for i in input().split()] s.append(s1) c.append(c1) X = 0 Y = 0 flag = 0 if N == 1: X = 9 Y = 0 elif N == 2: X = 99 Y = 10 else: X = 999 Y = 700 for j in range(Y, X+1): for k in range(M): if int(str(j)[s[k]-1]) != c[k]: flag += 1 if flag == 0: print(j) sys.exit() else: flag = 0 print(-1)
import sys N, M = map(int, input().split()) s = [] c = [] for i in range(M): s1,c1=[int(i) for i in input().split()] s.append(s1) c.append(c1) X = 0 Y = 0 flag = 0 if N == 1: X = 9 Y = 0 elif N == 2: X = 99 Y = 10 else: X = 999 Y = 100 for j in range(Y, X+1): for k in range(M): if int(str(j)[s[k]-1]) != c[k]: flag += 1 if flag == 0: print(j) sys.exit() else: flag = 0 print(-1)
[ "literal.number.integer.change", "assignment.value.change" ]
553,208
553,209
u853064660
python
p02761
N, M = map(int, input().split()) S = [] C = [] for _ in range(M): s, c = map(int, input().split()) S.append(s - 1) C.append(c) num = ['*'] * N for s, c in zip(S, C): if s == 0 and c == 0 and N != 1: print(-1) exit() if num[s] == '*': num[s] = str(c) elif num[s] != str(c): print(-1) exit() if num[0] == '*': num[0] = '1' print(''.join(num).replace('*', '0'))
N, M = map(int, input().split()) S = [] C = [] for _ in range(M): s, c = map(int, input().split()) S.append(s - 1) C.append(c) num = ['*'] * N for s, c in zip(S, C): if s == 0 and c == 0 and N != 1: print(-1) exit() if num[s] == '*': num[s] = str(c) elif num[s] != str(c): print(-1) exit() if num[0] == '*' and N != 1: num[0] = '1' print(''.join(num).replace('*', '0'))
[ "control_flow.branch.if.condition.change" ]
553,216
553,215
u736470924
python
p02761
import sys import math sys.setrecursionlimit(int(1e6)) N, M = map(int, input().split()) s = [0]*M c = [0]*M for i in range(M): s[i], c[i] = map(int, input().split()) digits = [-1]*N fault = False for i in range(M): d = s[i]-1 if digits[d] >= 0 and (digits[d] != c[i]): fault = True break digits[d] = c[i] if fault: print(-1) sys.exit() if (N>1) and (digits[0] == 0): print(-1) sys.exit() ans = 0 for i in range(N): b = 10 ** (N - i - 1) n = digits[i] if digits[i] >= 0 else 0 ans = ans + n * b min_ans = 10 ** (N - 1) if ans < min_ans: ans = ans + min_ans print(ans)
import sys import math sys.setrecursionlimit(int(1e6)) N, M = map(int, input().split()) s = [0]*M c = [0]*M for i in range(M): s[i], c[i] = map(int, input().split()) digits = [-1]*N fault = False for i in range(M): d = s[i]-1 if digits[d] >= 0 and (digits[d] != c[i]): fault = True break digits[d] = c[i] if fault: print(-1) sys.exit() if (N>1) and (digits[0] == 0): print(-1) sys.exit() ans = 0 for i in range(N): b = 10 ** (N - i - 1) n = digits[i] if digits[i] >= 0 else 0 ans = ans + n * b min_ans = 10 ** (N - 1) if N > 1 else 0 if ans < min_ans: ans = ans + min_ans print(ans)
[]
553,231
553,232
u216392490
python
p02761
n,m=map(int,input().split()) # a,b,c=map(int,input().split()) # s=input() # s,t=map(str,input().split()) ans=[-1]*n anss="" for i in range(m): s,c=map(int,input().split()) if ans[s-1] != -1 and ans[s-1] != c : print(-1) exit() if n!=1 and s==1 and c==0: print(-1) exit() ans[s-1]=c if m==0: if n==1: print(0) else: print(-1) exit() if ans[0]==-1: ans[0]="1" for x in ans: if x==-1: x=0 anss+=str(x) print(anss)
n,m=map(int,input().split()) # a,b,c=map(int,input().split()) # s=input() # s,t=map(str,input().split()) ans=[-1]*n anss="" for i in range(m): s,c=map(int,input().split()) if ans[s-1] != -1 and ans[s-1] != c : print(-1) exit() if n!=1 and s==1 and c==0: print(-1) exit() ans[s-1]=c if m==0: if n==1: print(0) else: print(10**(n-1)) exit() if ans[0]==-1: ans[0]="1" for x in ans: if x==-1: x=0 anss+=str(x) print(anss)
[ "call.arguments.change" ]
553,233
553,234
u469953228
python
p02761
n, m = map(int, input().split()) a, b, num = [0]*m, [0]*m, [0]*n num[0]=1 for i in range(m): a[i], b[i] = map(int, input().split()) num[a[i]-1]=b[i] for i in range(m): if num[a[i]-1]!=b[i]: print(-1) exit() ans='' for i in num: ans+=str(i) ans = int(ans) ans = str(ans) if len(ans)==n: print(ans) else: print(-1)
n, m = map(int, input().split()) a, b, num = [0]*m, [0]*m, [0]*n if n!=1: num[0]=1 for i in range(m): a[i], b[i] = map(int, input().split()) num[a[i]-1]=b[i] for i in range(m): if num[a[i]-1]!=b[i]: print(-1) exit() ans='' for i in num: ans+=str(i) ans = int(ans) ans = str(ans) if len(ans)==n: print(ans) else: print(-1)
[ "control_flow.branch.if.add" ]
553,237
553,238
u468206018
python
p02761
N, M = map(int, input().split()) ans = ['a'] * N for m in range(M): s, c = map(int, input().split()) if ans[s - 1] == 'a' or ans[s - 1] == str(c): ans[s - 1] = str(c) else: print(-1) exit() if ans[0] == 'a': ans[0] = '1' for i in range(N): if ans[i] == 'a': ans[i] = '0' ans = int(''.join(ans)) if len(str(ans)) == N: print(ans) else: print(-1)
N, M = map(int, input().split()) ans = ['a'] * N for m in range(M): s, c = map(int, input().split()) if ans[s - 1] == 'a' or ans[s - 1] == str(c): ans[s - 1] = str(c) else: print(-1) exit() if ans[0] == 'a' and N != 1: ans[0] = '1' for i in range(N): if ans[i] == 'a': ans[i] = '0' ans = int(''.join(ans)) if len(str(ans)) == N: print(ans) else: print(-1)
[ "control_flow.branch.if.condition.change" ]
553,239
553,240
u866124363
python
p02761
N, M = list(map(int, input().split())) pattern = [] for _ in range(N): pattern.append(None) nums = [] for _ in range(M): nums.append(list(map(int, input().split()))) cant_bool = False for keta, num in nums: if pattern[keta - 1] == None: pattern[keta - 1] = num else: if pattern[keta - 1] == num: continue else: cant_bool = True if cant_bool and not (len(nums) == 0): print(-1) else: if pattern[0] == 0 and len(pattern) > 1: print(pattern) print(-1) else: pattern = [(0 if (num == None) else num) for num in pattern] if pattern[0] == 0 and len(pattern) > 1: pattern[0] = 1 print(''.join(map(str, pattern)))
N, M = list(map(int, input().split())) pattern = [] for _ in range(N): pattern.append(None) nums = [] for _ in range(M): nums.append(list(map(int, input().split()))) cant_bool = False for keta, num in nums: if pattern[keta - 1] == None: pattern[keta - 1] = num else: if pattern[keta - 1] == num: continue else: cant_bool = True if cant_bool and not (len(nums) == 0): print(-1) else: if pattern[0] == 0 and len(pattern) > 1: print(-1) else: pattern = [(0 if (num == None) else num) for num in pattern] if pattern[0] == 0 and len(pattern) > 1: pattern[0] = 1 print(''.join(map(str, pattern)))
[ "call.remove" ]
553,241
553,242
u966695319
python
p02761
N,M = map(int,input().rstrip().split(" ")) ans = 0 n = [-1 for i in range(N)] for i in range(M): s,c = map(int,input().rstrip().split(" ")) s -= 1 if n[s] == -1 or n[s] == c: n[s] = c else: ans = -1 if N != 1 and n[0] == 0: ans = -1 if ans == -1: print(-1) elif N == 0 and M == 0: print(0) else: for i in range(N): if n[i] == -1: if i == 0: ans = ans + 10 ** (N -1) else: ans += 10 ** (N - i -1) * n[i] print(ans)
N,M = map(int,input().rstrip().split(" ")) ans = 0 n = [-1 for i in range(N)] for i in range(M): s,c = map(int,input().rstrip().split(" ")) s -= 1 if n[s] == -1 or n[s] == c: n[s] = c else: ans = -1 if N != 1 and n[0] == 0: ans = -1 if ans == -1: print(-1) elif N == 1 and M == 0: print(0) else: for i in range(N): if n[i] == -1: if i == 0: ans += 10 ** (N -1) else: ans += 10 ** (N - i -1) * n[i] print(ans)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change", "assignment.value.change", "expression.operation.binary.remove" ]
553,279
553,280
u017050982
python