jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
import * as fs from 'fs';

//in
// 60 88 34
// 92 41 43
// 65 73 48
// 10
// 60
// 43
// 88
// 11
// 48
// 73
// 65
// 41
// 92
// 34
//out
// Yes
const main = (inp: string) => {
    let inpList: string[] = inp.split('\n');

    let a1: number[] = inpList[0].split(' ').map(Number);
    let a2: number[] = inpList[1].split(' ').map(Number);
    let a3: number[] = inpList[2].split(' ').map(Number);

    inpList.shift();
    inpList.shift();
    inpList.shift();

    const n: number = parseInt(inpList[0]);

    inpList.shift();

    for (let i: number = 0; i < n; i++) {
        if (a1[0] === parseInt(inpList[i])) {
            a1[0] = 0;
        }
        if (a1[1] === parseInt(inpList[i])) {
            a1[1] = 0;
        }
        if (a1[2] === parseInt(inpList[i])) {
            a1[2] = 0;
        }
        if (a2[0] === parseInt(inpList[i])) {
            a2[0] = 0;
        }
        if (a2[1] === parseInt(inpList[i])) {
            a2[1] = 0;
        }
        if (a2[2] === parseInt(inpList[i])) {
            a2[2] = 0;
        }
        if (a3[0] === parseInt(inpList[i])) {
            a3[0] = 0;
        }
        if (a3[1] === parseInt(inpList[i])) {
            a3[1] = 0;
        }
        if (a3[2] === parseInt(inpList[i])) {
            a3[2] = 0;
        }
    }

    if (a1[0]===0 && a1[1]===0 && a1[2]===0) {
        console.log('Yes');
        return;
    }
    if (a2[0]===0 && a2[1]===0 && a2[2]===0) {
        console.log('Yes');
        return;
    }
    if (a3[0]===0 && a3[1]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }

    if (a1[0]===0 && a2[0]===0 && a3[0]===0) {
        console.log('Yes');
        return;
    }
    if (a1[1]===0 && a2[1]===0 && a3[1]===0) {
        console.log('Yes');
        return;
    }
    if (a1[2]===0 && a2[2]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }

    if (a1[0]===0 && a2[1]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }
    if (a1[2]===0 && a2[1]===0 && a3[0]===0) {
        console.log('Yes');
        return;
    }
    console.log('No');


};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
function main(input) {
  const inputs =input.split('\n')
  const A = inputs.slice(0, 3).map(e => e.split(' ').map(Number))
  const [N] = inputs.slice(3, 4).map(Number)
  const B = inputs.slice(4).map(Number)

  let t = Array.from(A)
  for (let i = 0; i < B.length; i++) {
    t.forEach(e => {
      let ind = e.indexOf(B[i])
      if (ind !== -1) {
        e[ind] = 0
      }
    })
  }
  if (t[0][1] + t[0][0] + t[0][2] === 0 ||
    t[1][0] + t[1][1] + t[1][2] === 0 ||
    t[2][0] + t[2][1] + t[2][2] === 0 ||
    t[0][2] + t[1][2] + t[2][2] === 0 ||
    t[0][0] + t[1][1] + t[2][2] === 0 ||
    t[0][1] + t[1][1] + t[2][1] === 0 ||
    t[0][2] + t[1][1] + t[2][0] === 0 ||
    t[1][0] + t[1][1] + t[1][2] === 0
  ) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let obj:any ={}
  let obj2:any ={}
  for(let i=0;i<9;i++){
    obj[o.n()] = i;
  }
  // 0 1 2
  // 3 4 5
  // 6 7 8
  let n=o.n()
  for(let i=0;i<n;i++){
    let t = o.n()
    if(obj[t] !== undefined){
      
      obj2[obj[t]] = 1;
    }
  }
  o.o(obj2)
  if(obj2[0]&&obj2[1]&&obj2[2]
    || obj2[3]&&obj2[4]&&obj2[5]
    || obj2[6]&&obj2[7]&&obj2[8]
    || obj2[0]&&obj2[3]&&obj2[6]
    || obj2[1]&&obj2[4]&&obj2[7]
    || obj2[2]&&obj2[5]&&obj2[8]
    || obj2[0]&&obj2[4]&&obj2[8]
    || obj2[2]&&obj2[4]&&obj2[6]
    ){
      o.Yes()
    }else{
      o.No()
    }
}
m();
//  [python]
import sys


def resolve(in_):
    N = int(next(sys.stdin.buffer))
    P = map(int, next(sys.stdin.buffer).split())

    min_ = 200001
    ans = 0
    for p in P:
        if p <= min_:
            ans += 1
            min_ = p
    return ans


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()
//  [python]
def main():
    n = int(input())
    p = map(int, input().split())

    num = float('inf')
    r = 0
    for pe in p:
        if num >= pe:
            r += 1
            num = pe
    print(r)


if __name__ == '__main__':
    main()
//  [python]
def main():
    n = int(input())
    min_num = 10 ** 9
    ans = 0
    for p in map(int, input().split()):
        if p < min_num:
            ans += 1
            min_num = p
    print(ans)


if __name__ == '__main__':
    main()
//  [python]
n = int(input())
p = list(map(int, input().split()))

min = p[1]
count = 1

for i in range(1,n):
    if p[i] <= min:
        count += 1
        min = p[i]

print(count)
//  [python]
n = int(input())
p = list(map(int, input().split()))
ans = 1

for i in range(1,n):
    if min(p[0:i]) >= p[i]:
        ans += 1

print(ans)
//  [python]
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n = k()
p = l()

for i in range(1, len(p)):
  if p[i-1] >= p[i]:
    cnt += 1

print(cnt+1)
//  [java]
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    int array[] = new int[num];
    int array_max[] = new int[num];
    int max = 0;
    for(int i = 0;i < num;i++){
      array[i] = sc.nextInt();
      if(max < array[i]){
        max = array[i];
      }
      array_max[i] = max;
    }
    int count = 0;
    for(int i = 0;i < num;i++){
      if(array_max[i] >= array[i]){
        count++;
      }
    }
    System.out.println(count);
  }
}
//  [java]
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    int array[] = new int[num];
    for(int i = 0;i < num;i++){
      array[i] = sc.nextInt();
    }
    int count = 0;
    for(int i = 0;i < num;i++){
      boolean flag = true;
      for(int j = 0;j <= i;j++){
        if(array[j] <= array[i]){
          flag = false;
        }
      }
      if(flag){
        count++;
      }
    }
    System.out.println(count);
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] p = new int[n];
    int count = 0;
    for(int i=0; i<n; i++) {
      p[i] = Integer.parseInt(str[i]);
      for(int j=0; j<i; j++) {
        if(p[i]-p[j]>0) {
          count++;
          break;
        }
      }
    }
    System.out.println(n-count);
  }
}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();

	int mae = 1e9;
	int kotae = 0;
	rep(i, N) {
		int p = getint();

		if (mae > p) {
			kotae++;
			mae = p;
		}
	}
	printf("%d\n", kotae);


	Would you please return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#include <unistd.h>
using i64 = std::int64_t;
namespace io { constexpr int is = 1 << 17; char ib[is], *ip = ib + is, it; inline char getc() { if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; } return *ip++; } inline i64 scan() { i64 r = 0; if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0'; else while ((it = *ip++) & 16) r = r * 10 + it - '0'; return r; } constexpr int os = 1 << 17; char ob[os], *op = ob, ot; inline void putc(const char c) { *op++ = c; if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; } } /* x shoud be greater than or equal to zero */ inline void print(i64 x) { char d[20]; int i = 0; while (true) { d[i] = x % 10 + 48; x /= 10; ++i; if (x <= 0) break; } while (i--) { putc(d[i]); } } inline void flush() { write(STDOUT_FILENO, ob, op - ob); } }
signed main() {
  i64 n = io::scan();
  i64 c = 0;
  i64 m = n;
  for (int i = 0; i < n; i++) {
    i64 x = io::scan();
    if (x <= m) {
      c++;
      m = x;
    }
  }
  io::print(c);
  io::flush();
}
//  [cpp]
e
//  [cpp]
fdsfsdafsda
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const int MAXN = 201+5;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	ll n;
	cin >> n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin >> a[i];
	}
	ll ans = 1;
	ll mini = a[0];
	for(ll i=1; i<n; i++){
		if(mini>a[i]){
			ans++;
			a[i]=mini;
		}
	}
	cout << ans << "\n";
	return 0;
}

//^-^
//  [c]
// ABC 152-C
// 2020.1.19 bal4u

#include <stdio.h>

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int main()
{
	int N, P, mi, ans;
	
	mi = 0x5fffffff, ans = 0;
	N = in();
	while (N--) {
		P = in();
		if (mi > P) mi = P;
		if (mi >= P) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int N;
	int *P;
	int i;
	int min_till_i;
	int answer;
	char buf_N[16];
	char *buffer;
	char *ch;

	fgets(buf_N, sizeof(buf_N), stdin);
	ch = strtok(buf_N, " ");
	N = atoi(ch);

	P = (int *)calloc(N, sizeof(int));
	buffer = (char *)calloc(N * N + 1, sizeof(char));

	fgets(buffer, N * N + 1, stdin);
	ch = strtok(buffer, " ");
	P[0] = atoi(ch);
	for(i = 1; i < N; i += 1) {
		ch = strtok(NULL, " ");
		if(NULL == ch) {
			printf("sth wrong:%d\n", i);
			break;
		}
		P[i] = atoi(ch);
	}
	
	min_till_i = N;
	answer = 0;
	for(i = 0; i < N; i += 1) {
		if(min_till_i >= P[i]) {
			min_till_i = P[i];
		}
		if(P[i] <= min_till_i) {
			answer += 1;
		}
	}

	printf("%d\n", answer);

	free(P);
	free(buffer);
	return 0;
}
//  [c]
#include <stdio.h>

unsigned int n, v;
unsigned int cnt = 0;
unsigned int min = 1U << 30;

unsigned int read(void){
  char c;
  while(1){
    c = getchar();
    if(c >= '0') break;
  }
  unsigned int res = c - '0';
  while(1){
    c = getchar();
    if(c < '0') break;
    res = 10 * res + (c - '0');
  }
  return res;
}

int main(void){
  n = read();
  while(n--){
    v = read();
    if(v < min){
      min = v; cnt++;
    }
  }
  printf("%u\n", cnt);
  return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
    int n=0,count=0,flag=0;
    int P[200000]={};
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&P[i]);
    }
    for(int i=0;i<n;i++){
        flag=0;
        for(int j=0;j<=i;j++){
            if(P[i]>P[j]){
                flag=1;
                break;
            }
        }
        if(flag==0){
            count+=1;
        }
    }
    printf("%d",count);
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

const int inf = 1012345678;
int main(){
    int n;
    int p[200005];

    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%d", &p[i]);
    }

    int flag = 0;
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        flag = 0;
        for(int j = i; j >= 0; --j){
            if(p[i] <= p[j]){
                flag = 1;
            }else{
                flag = 0;
                break;
            }
        }
        if(flag){
            cnt++;
        }
    }

    printf("%d\n", cnt);

    return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int n,i,j;
    scanf("%d",&n);
    int p[n],c=0;
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        for(j=0;j<i;j++){
            if(p[i]>p[j]){
                c++;
              break;
            }
        }
    }
    printf("%d\n",n-c);
}
//  [javascript]
function Main(input) {
    input = input.split("\n");
    tmp = input[1].split(" ");
    all = Number(input[0]);
    var maxest = Number(tmp[0]);
    ans = 1;
    for(i = 2; i <= all; i++){
        the_Num = Number(tmp[i-1]);
        if(maxest >= the_Num){
            ans++;
        }
        if(maxest > the_Num) maxest = the_Num;

    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	var n = parseInt(input[0], 10);
    var str = input[1];
    var suu = str.split(" ");
    for(var i=0; i<n; i++){
      suu[i] = parseInt(suu[i], 10);
    }
    var count = 0;
    var min = 200001;
  	for(var i=0; i<n; i++){
      if(suu[i] < min){
        count++;
        min = suu[i];
      }
    }
  console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]

function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0].split(' ')[0]-0;
  const P=input[1].split(' ').map(e=>{
    return e-0;
  });
  var min=Infinity;
  var ret=0;
  P.forEach(e=>{
    if(min>=e){
      ret++;
      min=e;
    }
  });
  console.log(ret);
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function *main() {
  
  const N = parseInt((yield), 10);
  const P = (yield).split(" ").map(s => parseInt(s, 10));
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);
  
}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));
//  [javascript]
function *main() {
  
  const N = parseInt(yield, 10);
  const P = yield.trim().split(" ").map(s => parseInt(yield, 10));
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);
  
}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));
//  [javascript]
function *main() {
  
  const N = +(yield);
  const P = (yield).trim().split(" ").map(s => +s);
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);
  
}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n := scanInt(sc)
	p := scanIntSlice(sc, n)
	fmt.Println(resolve(n, p))
}

func resolve(n int, p []int) int {
	count := 0

	min := math.MaxInt64
	for i := 0; i < n; i++ {
		if p[i] < min {
			count++
			min = p[i]
		}
	}

	return count
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var maxInt = int(1e18)

func main() {
	n := readI()
	min := maxInt
	ans := 0
	for i := 0; i < n; i++ {
		p := readI()
		if min >= p {
			min = p
			ans++
		}
	}
	fmt.Println(ans)
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}
//  [go]
package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	P := make([]int, N)

	var count int = 0
	var flag int = 0
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
		flag = 0
		for j := 0; j < i; j++ {
			if P[i] > P[j] {
				flag = 1
				break
			}
		}
		if flag == 1 {
			flag = 0
		} else {
			count++
		}
	}

	fmt.Println(count)
}
//  [go]
package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	P := make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
	}

	var count int = 0
	var flag int = 0
	for i := 0; i < N; i++ {
		flag = 0
		for j := 0; j < i; j++ {
			if P[i] > P[j] {
				flag = 1
				break
			}
		}
		if flag == 1 {
			flag = 0
		} else {
			count++
		}
	}

	fmt.Println(count)
}
//  [go]
package main
 
import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}
 
func scanString() string {
	sc.Scan()
	return sc.Text()
}
 
func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
  var N, A, ANS int
  N = scanInt()
  l := make([]int, N)
  ANS = N
  for i := 0; i < N; i++ {
	  A = scanInt()
	  l[i] = A
  }
  for i := 0; i < N; i++ {
    for j := 0; j <= i; j++ {
		if l[i] > l[j] {
			ANS--
			break
		}
	}
  }
  fmt.Println(ANS)
}
//  [ruby]
require 'pp'

n  = gets.chomp!.to_i
p_n = gets.chomp!.split.map(&:to_i)

count = 0
min = p_n[0]
p_n.each do |a|
    if a <= min
        count += 1
        min = a
    end
end

puts count
//  [ruby]
n = gets.to_i

arr = gets.split(' ').map!(&:to_i)

min = arr[0]
count = 0

arr.each do |e|
  if min >= e
    count += 1
    min = e
  end
end

puts count
//  [ruby]
N,*ps=$<.read.split.map(&:to_i)

min = ps[0]
ret = 0

ps.each do |p|
  if p <= min
    ret += 1
    min = p
  end
end

p ret
//  [ruby]
n=gets.to_i
p=gets.split.map(&:to_i)

count=1
(n-1).times do |i|
    if p[i]>p[i+1] 
        count+=1
    end
end
puts count
//  [ruby]
n=gets.to_i
p=gets.split.map(&:to_i)

count=0
while p.length>0
    p.length.times do |i|
        if p[i]==p.min
            p=p[0, i]
            count+=1
            break
        end
    end
end
puts count
//  [ruby]
#全探索＝＝TLE（たぶん）
N = gets.to_i
num = gets.strip.split.map(&:to_i)
ary = Array.new(N,0)
ary[0] = num[0]
s = 1
for i in 1..N-1
  if ary[i-1] > num[i]
    ary[i] = num[i]
    s += 1
  end
end
puts s
//  [rust]
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    use std::cmp::min;

    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut pv = vec![0u32; n];
    for i in 0..n - 1 {
        pv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    pv[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut ans = 0;
    let mut mp = pv[0];
    for i in 0..pv.len() {
        if pv[i] <= mp {
            ans += 1;
        }
        mp = min(mp, pv[i]);
    }

    println!("{}", ans);
}
//  [rust]
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let p: Vec<usize> = parse_line().unwrap();
    let mut cnt = 0;

    for i in 0..n {
        let mut ans = true;
        for k in 0..=i {
            if p[k] < p[i] {
                ans = false;
                break;
            }
        }
        if ans {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, p: [usize; n]};

    let mut count = 1;
    let mut min = p[0];

    for i in 1..n - 1 {
        if min >= p[i] {
            count += 1;
            min = p[i];
        }
    }

    println!("{}", count)
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, p: [usize; n]};
    let p: Vec<usize> = p;

    let mut count = 1;
    let mut index = 0;

    for i in 1..n {
        if index == i - 1 {
            if p[index] >= p[i] {
                count += 1;
                index += 1;
            }
        } else {
            let m = &p[index..i - 1];
            if *m.iter().min().unwrap() >= p[i] {
                index = i;
                count += 1;
            }
        }
    }

    println!("{}", count)
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}


func main() {
    let n = readInt()
    let aryP = readInts()
    //_________________________ここまで入力
    
    /// 最小値
    var m = Int.max
    var ans = 0
    for i in 0..<n {
        if aryP[i] <= m {
            m = aryP[i]
            ans += 1
        }
    }
    print(ans)
}

main()
//  [swift]
let n=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var ans = 1
var m = arr[0]

for i in 1..<n {
  if (m > arr[i]) {
    ans += 1
  }
  m = min(arr[i], m)
}

print(ans)
//  [swift]
let n=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var ans = 1

for i in 1..<n {
  var j = 0
  var m = i
  var found = true
  
  for j in 0...m {
    if( arr[j] < arr[i] ) {
      found = false
      break
    }
  }
  
  if (found) {
    ans += 1
  }
}

print(ans)
//  [typescript]
import * as fs from 'fs'

//in
// 5
// 4 2 5 1 3
//out
// 3
const input: string[] = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
const n: number = parseInt(input[0]);
const p: number[] = input[1].split(' ').map(Number);
let result: number = 0;
let min :number = Infinity;
for (let i: number = 0; i < n; i++) {

    if (min > p[i]) {
        result++;
        min = p[i];
    }
}

console.log(result);
//  [typescript]
{
  const main = (
    input: string
  ): void | string | number | string[] | number[] => {
    const r = _reader(input)
    const [N] = r.nn()
    const P = r.nn()

    let min = P[0]
    let sum = 1

    for (let i = 1; i < N; i++) {
      if (min > P[i]) {
        sum += 1
        min = P[i]
      }
    }

    return sum
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
  if (typeof _res === 'object') console.log(_res.join(' '))
}
//  [typescript]
function Main(input) {
    const lines = input.split("\n");
    const ps = lines[1].split(' ').map(v => +v);
    let count = 0;
  	let min = ps[0];
  
    for (let i = 0; i < ps.length; i++) {
      if (ps[i] <= min) {
        count++;
        min = ps[i];
      }
    }
    
    console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from 'fs'

//in
// 5
// 4 2 5 1 3
//out
// 3
const input: string[] = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
const n: number = parseInt(input[0]);
const p: number[] = input[1].split(' ').map(args => parseInt(args));
let result: number = 0;
for (let i: number = 0; i < n; i++) {
    for (let j: number = 0; j <= i; j++) {
        if (p[i] > p[j]) {
            break;
        }
        if (j === i) {
            result += 1;
        }
    }
}

console.log(result);
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(/[ \n]/);

const n = +input[0];

let count = 0;

input.slice(1, n + 1).map((i, index) => {
  const j: number[] = input.slice(1, index + 2).map(val => +val);
  if (+i <= Math.min(...j)) {
    count++;
  }
});

console.log(count);
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(/[ \n]/);

const n = +input[0];

let count = 0;

input.slice(0, n + 1).map((i, index) => {
  const j = input.slice(1, index + 1);
  j.sort();
  if (+i <= +j[0]) {
    count++;
  }
});

console.log(count);
//  [python]
n,m=map(int,input().split())
num=[-1]*n
for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0 and n!=1:print(-1);exit()
    if num[s-1]==-1:
        num[s-1]=c
    if num[s-1]!=-1:
        if num[s-1]!=c:print(-1);exit()
if n==1 and num[0]==-1:print(0)
else:
    ans=0
    for i in range(n):
        if num[i]!=-1:
            ans+=num[i]*10**(n-i-1)
        elif i==0:ans+=10**(n-1)
        else:continue
    print(ans)
//  [python]
n, m = map(int, input().split())

flag = False

used = []
d = [0]*n
for _ in range(m):
    s, c = map(int, input().split())
    if n > 1 and (s == 1 and c == 0):
        flag = True
    if (s in used) and d[s-1] != c:
        flag = True
    else:
        d[s-1] = c
        used.append(s)
    
if flag:
    print(-1)
else:
    if n != 1 and d[0] == 0: 
        d[0] = 1
    print(''.join(map(str, d)))
//  [python]
n, m = [int(i) for i in input().split()]
sc = list(set([tuple(map(int, input().split())) for _ in range(m)]))

s = list('x'*n)
for i in range(len(sc)):
    if s[sc[i][0]-1] != 'x':
        print("-1")
        exit()
    s[sc[i][0]-1] = str(sc[i][1])

if n > 1 and s[0] == 'x':
    s[0] = '1'

ans = int("".join(s).replace('x', '0'))
print(ans if len(str(ans)) == n else -1)
//  [python]
n, m = map(int, input().split())
num = [None] * n
a = [tuple(map(int, input().split())) for _ in range(m)]
for pos, val in a:
    if num[pos - 1] != None and num[pos - 1] != val:
        print(-1)
        exit()
    num[pos - 1] = val
if n == 1:
    print(0)
    exit()
canBeZero = False
for i in range(n):
    if num[i] == None:
        num[i] = 0 if canBeZero else 1
    if num[i]:
        canBeZero = True
ret = str(int(''.join(map(str, num))))
print(ret if len(ret) == n else -1)
//  [python]
n, m = map(int, input().split())
num = [None] * n
a = [tuple(map(int, input().split())) for _ in range(m)]
for pos, val in a:
    if num[pos - 1] != None and num[pos - 1] != val:
        print(-1)
        exit()
    num[pos - 1] = val
canBeZero = False
for i in range(n):
    if num[i] == None:
        num[i] = 0 if canBeZero else 1
    if num[i]:
        canBeZero = True
ret = str(int(''.join(map(str, num))))
print(ret if len(ret) == n else -1)
//  [python]
n, m= map(int, input().split())
ans = [10] * (n + 1)
#s-digit: ans = [dummy, 1st-d, 2nd-d, ...]
for i in range(m):
  s, c = map(int, input().split())
  if ans[s] == 10 and not (s==1 and c==0):
    ans[s] = c
  elif ans[s] == c:
    pass
  elif ans[s] != c or (s==1 and c==0):
    print(-1)
    exit()
for i in range(1, n+1):
  if ans[i] == 10:
    ans[i] = 0
    if i == 1:
      ans[i] += 1
print(''.join([str(x) for x in ans[1:]]))
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] s = new int[M+1];
		int[] c = new int[M+1];
		boolean f = true;

		for (int i = 1; i < M+1; i++) {
			s[i] = scan.nextInt();
			c[i] = scan.nextInt();
		}

		if (N == 1) {
			for (int i = 1; i < M; i++) {
				if (c[i] != c[i+1]) {
					f = false;
				}
			}

			if (f) System.out.println(c[1]);
			else System.out.println(-1);

		} else {
			int[] ans = new int[N+1];
			boolean[] vst = new boolean[N+1];
			ans[1] = 1;

			for (int i = 1; i < M+1; i++) {
				if (!vst[s[i]]) {
					vst[s[i]] = true;
					ans[s[i]] = c[i];
				} else if (c[i] != ans[s[i]]) {
						f = false;
						break;
				}
			}

			if (!f || ans[1] == 0) {
				System.out.println(-1);
			} else {
				for (int i = 1; i < N+1; i++) {
					System.out.print(ans[i]);
				}
			}

		}

	}

}
//  [cpp]
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int s[11],c[11];
vector<int> v;

int main(void){
	int n,m,i,j,x;
	bool flag;
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> s[i] >> c[i];
		s[i] = n-s[i];
	}
	for(i=0; i<1000; ++i){
		x = i;
		flag = true;
		do{
			v.push_back(x%10);
			x /= 10;
		}while(x);
		if(v.l_ength()!=n){
			flag = false;
		}
		for(j=0; j<m; ++j){
			if(!flag){
				break;
			}
			if(v[s[j]]!=c[j]){
				flag = false;
				break;
			}
		}
		if(flag){
			cout << i << endl;
			return 0;
		}
		v.clear();
	}
	cout << "-1" << endl;
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}



int main(){
    int n,m;
    cin >> n >> m;
    int s[m];
    int c[m];
    int ans[n];
    rep(i,m){
        cin >> s[i] >> c[i];
    }
    //ans syokika
    rep(i,n){
        ans[i]=10;
    }

    if(m==0){
        if(n==1){
            cout << 0 << endl;
            return 0;
        }else if(n==2){
            cout << 10 << endl;
            return 0;
        }else{
            cout << 100 << endl;
            return 0;
        }
    }

    rep(i,m){
        if(ans[s[i]-1]==10){
            ans[s[i]-1]=c[i];
        }else if(ans[s[i]-1]!=c[i]){
            cout << "-1" << endl;
            return 0;
        }
    }

    bool u=true;

    rep(i,n){
        if(ans[i]==10 and n>1 and u and i==0){
            ans[i]=1;
            u=false;
        }else if(ans[i]==10){
            ans[i]=0;
        }
    }

    

    

    if(n==3 and ans[0]==0){
        cout << "-1" << endl;
        return 0;
    }
    if(n==2 and ans[0]==0){
        cout << "-1" << endl;
        return 0;
    }
    
    rep(i,n){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    int N, M;
    cin >> N >> M;
    vector<int> S(N, -1);
    for (int i = 0; i < M; i++) {
        int s, c;
        cin >> s >> c;
        s--;
        if (S[s] == -1) {
            S[s] = c;
        }
        else if (S[s] != c) {
            puts("-1");
            return 0;
        }
    }
    if (N != 1 && S[0] == 0) {
        puts("-1");
        return 0;
    }
    if (N == 1 && S[0] == -1)  {
        puts("0");
        return 0;
    }
    if (S[0] == -1) {
        S[0] = 1;
    }
    for (int i = 1; i < N; i++) {
        if (S[i] == -1) S[i] = 0;
    }
    for (int i = 0; i < N; i++) {
        cout << S[i];
    }
    cout << endl;
}
//  [cpp]
#include <bits/stdc++.h>

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> vpii(m);
    REP(i, m)
    {
        cin >> vpii[i].first >> vpii[i].second;
    }
    vector<int> a(n, -1);
    REP(i, m)
    {
        if (a[vpii[i].first - 1] != -1 && a[vpii[i].first - 1] != vpii[i].second) {
            cout << -1 << endl;
            return 0;
        }
        if (vpii[i].first == 1 && vpii[i].second == 0) {
            cout << -1 << endl;
            return 0;
        }
        a[vpii[i].first - 1] = vpii[i].second;
    }
    REP(i, n)
    if (a[i] == -1)
        a[i] = 0;
    if (n>=2&&a[0] == 0)
        a[0] = 1;
    REP(i, n)
    cout << a[i];
    cout << endl;
}
//  [cpp]
#include <bits/stdc++.h>

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> vpii(m);
    REP(i, m)
    {
        cin >> vpii[i].first >> vpii[i].second;
    }
    vector<int> a(n, -1);
    REP(i, m)
    {
        if (a[vpii[i].first - 1] != -1 && a[vpii[i].first - 1] != vpii[i].second) {
            cout << -1 << endl;
            return 0;
        }
        if (vpii[i].first == 1 && vpii[i].second == 0) {
            cout << -1 << endl;
            return 0;
        }
        a[vpii[i].first - 1] = vpii[i].second;
    }
    REP(i, n)
    if (a[i] == -1)
        a[i] = 0;
    if (a[0] == 0)
        a[0] = 1;
    REP(i, n)
    cout << a[i];
    cout << endl;
}
//  [cpp]
#include <iostream>
#include <bits/stdc++.h>

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;



int main(){
   int n, m; cin>>n >>m;
   vector<int> ans(n);
   ans[0] = 1;
   vector<bool> already(n);
   rep(i, n) already[i] = false;
   rep(i, m){
       int s, c; cin>>s >>c;
       s--;
        if(s == 0 && c == 0){
                cout<< -1 <<endl;
                return 0;
        }
       if(already[s] && ans[s] != c) {
           cout<< -1 <<endl;
           return 0;
        }else{
           
           already[s] = true;
           ans[s] = c;
       }
   }
   rep(i, n) cout<<ans[i];
   cout<<""<<endl;
}
//  [c]
#include<stdio.h>

int main(){
	int N, M;
	int s[5], c[5];
	int flag = 1;
	scanf("%d %d", &N, &M);
	for(int i = 0; i < M; ++i){
		scanf("%d %d", &s[i], &c[i]);
	}
	
	for(int i = 0; i < M; ++i){
			if(s[i] == 1 && c[i] == 0 && N != 1){
				printf("-1");
				goto F;
			}
		}
		for(int i = 0; i < M - 1; ++i){
			for(int j = i + i; j < M; ++j){
				if(s[i] == s[j] && c[i] != c[j]){
					flag = 0;
					break;
				}
			}
			if(flag == 0){
				break;
			}
		}
		if(flag == 0){
			printf("-1");
			goto F;
		}
		
		for(int i = 0; i < M; ++i){
				for(int j = i + 1; j < M; ++j){
					if(s[i] > s[j]){
						int t = s[i];
						s[i] = s[j];
						s[j] = t;
						t = c[i];
						c[i] = c[j];
						c[j] = t;
					}
				}
			}
	
	if(N == 3){                                 
		if(M == 0)printf("100");
		else if(M == 1){
			if(s[0] == 1) printf("%d00", c[0]);
			else if(s[0] == 2) printf("1%d0", c[0]);
			else printf("10%d", c[0]);
		}
		else{
			int flag_s1_1 = 0;
			for(int i = 0; i < M; ++i){
				if(s[0] == 1){
					if(s[0] == s[M - 1]){
						printf("%d00", c[0]);
						break;
					}
					if(i == 0) printf("%d", c[i]);
					if(i > 0 && s[i] - s[i - 1] == 1) printf("%d", c[i]);
					if(i > 0 && s[i] - s[i - 1] == 2){
						printf("0");
						if(i == M - 1 && s[i] == 3) printf("%d", c[i]); 
					}
					if(i == M - 1 && s[i] != 3) printf("0");
				}
				if(s[0] != 1){
					if(flag_s1_1 == 0){
						printf("1");
						if(s[0] == 3)printf("0");
						flag_s1_1 = 1;
					}
					if(i == 0) printf("%d", c[i]);
					if(i > 0 && s[i] - s[i - 1] == 1) printf("%d", c[i]);
					if(i == M - 1 && s[i] != 3) printf("0");
				}
			}
		}
		
	}
	if(N == 2){
		if(M == 0) printf("10");
		else if(M == 1){
			if(s[0] == 1) printf("%d0", c[0]);
			else if(s[0] == 2) printf("1%d", c[0]);
		}
		else{
			for(int i = 0; i < M; ++i){
				if(s[0] == 1){
					if(s[0] == s[M - 1]){
						printf("%d0", c[0]);
						break;
					}
					if(i == 0) printf("%d", c[i]);
					if(i > 0 && s[i] - s[i - 1] == 1)printf("%d", c[i]);
				}
				if(s[0] != 1){
					printf("1%d", c[M - 1]);
					break;
				}
			}
		}
	}
	if(N == 1){
		if(M == 0) printf("0");
		else if(c[0] == 0){
		    printf("0");
		}else{
			printf("%d", c[0]);
		}
	}
	F:return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

struct tmp_t {
    int S;
    int C;
};

int N;
int M;
struct tmp_t T[10];

int cmpfunc( const void *a, const void *b )
{
    return( ((struct tmp_t *)a)->S, ((struct tmp_t *)b)->S );
}

long long powten( int n )
{
    int i;
    long long ret = 1;

    for( i=0; i<n; i++ ) ret *= 10;

    return( ret );
}

/***************************************
    main
***************************************/
int main( int argc, char *argv[] )
{
    int i;
    long long ret = 0;
    int digit[10];

    if( scanf( "%d%d", &N, &M ) != 2 ) {
        puts( "Input error." );
        exit( 0 );
    }

    for( i=0; i<M; i++ ) {
        if( scanf( "%d%d", &T[i].S, &T[i].C ) != 2 ) {
            puts( "Input error." );
            exit( 0 );
        }
    }

    qsort( T, M, sizeof(struct tmp_t), cmpfunc );

    for( i=0; i<M-1; i++ ) {
        if( T[i].S == T[i+1].S && T[i].C != T[i+1].C ) {
            puts( "-1" );
            exit( 0 );
        }
    }

    if( T[0].S == 1 && T[0].C == 0 && N != 1 ) {
        puts( "-1" );
        exit( 0 );
    }

    for( i=1; i<=N; i++ ) digit[i] = 0;
    for( i=0; i<M; i++ ) digit[T[i].S] = T[i].C;
    for( i=1; i<=N; i++ ) ret += powten(N-i) * digit[i];
    if( N > 1 && ret < powten(N-1) ) ret += powten(N-1);
//for(i=0; i<=N; i++ ) printf( "digit[%d] => %d\n", i, digit[i] );

    printf( "%lld\n", ret );
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int powx(long long int x,long long int y){
  int j;
  int a;
  a=1;
  for(j=1;j<y+1-x;j++){
   a=a*10;
  }
  return(a);
}


int main(){

 long long int N,M;
  scanf("%lld %lld",&N,&M);

/*
  char A[];
  scanf("%s",A);
  */

  
  long long int s[M+1],c[M+1],che[N+1];
  long long int i;
  for(i=1;i<=M;i++){
   scanf("%lld %lld",&s[i],&c[i]);
   }
  
  long long int A;
  A=0;
  for(i=1;i<=N;i++){
    che[i]=-1;
   }

  for(i=1;i<=M;i++){

    if(che[s[i]]==-1){
      che[s[i]]=c[i];
      A += c[i]*powx(s[i],N);
    }
    else if( che[s[i]] != c[i]){
      printf("-1");
      return(0);
    }
    else{}


   }  
  if(N == 1 && A == 0){
    printf("0");
  }

  else if( che[1]==0){
    printf("-1");
  }
  else{
    if(che[1]==-1){
    printf("%lld",A+powx(1,N) );
    }
    else{
    printf("%lld",A );
    }
  }





 return(0);
 }
//  [c]
#include<stdio.h>

int main(void)
{
    int n=0,m=0,min=0,max=0;
    int s[10]={},c[10]={},test[3]={};

    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++) scanf("%d %d",&s[i],&c[i]);

    if(n==1){ min=0;max=9;}
    if(n==2){ min=10;max=99;}
    if(n==3){ min=100;max=999;}
    for(int i=min;i<=max;i++){
        if(n==1) test[0]=i;
        else if(n==2){ test[0]=i/10;test[1]=i%10;}
        else if(n==3){ test[0]=i/100;test[1]=(i%100)/10;test[2]=i%10;}
        for(int j=0;j<m;j++){
            if(test[s[j]-1]!=c[j]) break;
            if(j==(m-1)){
                printf("%d",i);
                return 0;
            }
        }
    }
    printf("-1");
    return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
    int n=0,m=0,min=0,max=0;
    int s[10]={},c[10]={},test[3]={};

    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++) scanf("%d %d",&s[i],&c[i]);

    if(n==1){ min=0;max=9;}
    if(n==2){ min=10;max=99;}
    if(n==3){ min=100;max=999;}
    for(int i=min;i<=max;i++){
        if(n==1) test[0]=i%10;
        if(n==2){ test[0]=(i/10);test[1]=i%10;}
        if(n==3){ test[0]=i/100;test[1]=(i%100)/10;test[2]=i%10;}
        for(int j=0;j<m;j++){
            if(test[s[j]-1]!=c[j]) break;
            if(j==(m-1)){
                printf("%d",i);
                return 0;
            }
        }
    }
    printf("-1");
    return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
    int n=0,m=0,flag=1;
    int s[5]={},c[5]={},num[5]={10,10,10,10,10},numflag[5]={};
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&s[i],&c[i]);
    }
    if(n==1){
        for(int i=0;i<m;i++){
            if(s[i]==1 && numflag[0]==0){
                num[0]=c[i];
                numflag[0]=1;
            }
            if((s[i]==1 && num[0]!=c[i]) || s[i]!=1){
                flag=0;
                break;
            }
        }
    } else {
        for(int i=0;i<m;i++){
            if(s[i]==1){
                if(numflag[0]==0 && c[i]!=0){
                    num[0]=c[i];
                    numflag[0]=1;
                } else {
                    if(num[0]!=c[i]){
                        flag=0;
                        break;
                    }
                }
            } else {
                if(numflag[s[i]-1]==0){
                    num[s[i]-1]=c[i];
                    numflag[s[i]-1]=1;
                } else {
                    if(num[s[i]-1]!=c[i]){
                        flag=0;
                        break;
                    }
                }
            }
        }
    }

    if(flag==1 && numflag[0]==1){
        for(int i=0;i<n;i++){
            if(numflag[i]==1) printf("%d",num[i]);
            else printf("0");
        }
    } else {
        printf("-1");
    }
    return 0;
}