akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;

int main()
{
	int a,b,c,x,ans;
	while(~scanf("%d%d%d%d",&a,&b,&c,&x))
	{
		ans = 0;
		x /= 50;
		for(int i = 0;i <= a;i++)
		{
			for(int j = 0;j <= b;j++)
			{
				for(int k = 0;k <= c;k++)
				{
					if(k+2*j+10*i==x) ans++;
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <functional>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
  ll N,M;
  cin>>N>>M;
  vector<ll> A(M),B(M);
  for (int i = 0; i < M; i++) {
    cin>>A[i]>>B[i];
    A[i]--;
    B[i]--;
  }
  UnionFind uf(N);

  ll total = N*(N-1)/2;
  vector<ll> ans;

  for (int i = 0; i < M; i++) {
    ans.push_back(total);
    int x,y;
    x = A[M - 1 - i];
    y = B[M - 1 - i];
    if (uf.issame(x,y)) continue;
      total -= uf.size(x)*uf.size(y);
      uf.merge(x,y);
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < M; i++) cout<<ans[i]<<endl;
  return 0;
}

Measured memory_bytes: 4212
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from functools import lru_cache
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s

#main
n=int(input())
print(math.ceil(n/2))


Measured memory_bytes: 64748
#include <bits/stdc++.h>


using namespace std;

#define fi first
#define se second
#define re return
#define pb push_back

#define mp make_pair

#define F(i, a, b) for (int i = a; i < b; i++)
#define f(i, n) F(i, 0, n)


int run();



int main() {
#ifdef home
    freopen("i", "r", stdin);
    freopen("d", "w", stderr);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  run();
  return 0;
}

vector<int> gr[500];

int a[500], b[500], c[500], d[500];

int was[500];
int tk[500];

bool kuhn(int v) {
  if (was[v]) re false;
  was[v] = 1;
  for (auto to : gr[v]) {
    if (tk[to] == -1) {
      tk[to] = v;
      re 1;
    }
    if (kuhn(tk[to])) {
      tk[to] = v;
      re 1;
    }
  }
  re 0;
}

int run() {
  int n, m;
  cin >> n;
  m = n;
  f(i, n) {
    cin >> a[i] >> b[i];
  }
  f(i, m) {
    cin >> c[i] >> d[i];
  }
  f(i, n) {
    f(j, m) {
      if (a[i] < c[j] && b[i] < d[j]) {
        gr[i].pb(j);
      }
    }
  }
  f(i, m) {
    tk[i] = -1;
  }
  int ans = 0;
  f(i, n) {
    f(j, n) {
      was[j] = 0;
    }
    kuhn(i);
  }
  f(i, m) {
    if (tk[i] != -1) {
      ans++;
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
N = int(input())
MOD = 10**9+7

a = 8
b = 1
c = 1
d = 0

for _ in range(N-1):
    at = a * 8
    bt = b * 9 + a * 1
    ct = c * 9 + a * 1
    dt = b * 1 + c * 1 + d * 10
    a = at % MOD
    b = bt % MOD
    c = ct % MOD
    d = dt % MOD

print(d)

Measured memory_bytes: 9176
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}/*
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
set <ll> s;

void rec(ll i){
	if(i>4e9)return;
	s.insert(i);
	int l=i%10;
	if(l!=0)rec(i*10+l-1);
	rec(i*10+l);
	if(l!=9)rec(i*10+l+1);
}

int solve(){
   	rep(i,1,10)rec(i);
   	vector<ll> vec;
	for(auto &x:s){
   		vec.pb(x);
	}
	int n;
	cin>>n;
	cout<<vec[n-1]<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 6644
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,k;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++) cin>>a[i];
    for(i=0;i<n-2;i++)
    {
        for(j=i+1;j<n-1;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k] && (a[i]+a[j]>a[k] && a[j]+a[k]>a[i] && a[i]+a[k]>a[j])) ++p;
            }
        }
    }
    cout<<p<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double N;
  cin >> N;
  double a;
  int b;
  bool f = false;
  for (int i = 1; i < 10; i++) {
    a = N / i;
    b = N / i;
    if (a == b && a < 10 && a > 0) {
      cout << "Yes" <<endl;
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define Debug printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define debug(x) cerr<<#x<<'='<<x<<endl
namespace mine
{
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    char A[N],B[N];queue<int> q;
    void gg(){puts("-1");exit(0);}
    void main()
    {
        int n=qread();scanf("%s%s",A+1,B+1);if(strcmp(A+1,B+1)==0) {write(0);return;}
        int now=n,ans=0;
        fd(i,n,1) if(B[i-1]!=B[i])
        {
            chmin(now,i);while(now>0 and A[now]!=B[i]) now--;
            if(!now) gg();if(now==i)continue;
            while(sz(q) and q.front()-sz(q)>=i) q.pop();
            q.push(now);chmax(ans,sz(q));
        }write(ans+1);
    }
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 6272
#include <iostream>
using namespace std;

int main()
{
    int N;
    cin >> N;

    int ans;
    bool solve = false;
    for (int i=1; i<=9; i++) {
        for (int j=1; j<=9; j++) {
            ans = i * j;
            if (ans == N) {
                solve = true;
                break;
            }
        }
        if (solve == true) {
            break;
        }
    }

    if (solve == true) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std;

int main()
{
    int n[6];
    cin >> n[0];
    int max, min;
    max = n[0];
    min = n[0];
    for (int i = 1; i<5; i++){
        cin >> n[i];
        if (n[i] > max){max = n[i];}
        if (n[i] < min){min = n[i];}
    }
    
    

    //cout << max - min ;
    int range;
    cin >> range;
    if (range >= max-min){
        cout << "Yay!";
    }else{
        cout << ":(";
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

char field[13][13] = {0};

void dfs(int x, int y){
  field[x][y] = '0';

  int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
  for(int i = 0;i < 4;i++){
      int nx = x + dx[i], ny = y + dy[i]; 
      if(nx >= 0 && nx < 12 && ny >= 0 && ny < 12 && field[nx][ny] == '1') dfs(nx, ny);
  }
}

int main(){
  int count = 0;

  while(1){
    for(int i = 0;i < 12;i++){
      for(int j = 0;j < 12;j++){
        cin >> field[i][j];
      }
    }

    if(cin.eof()) break;

    for(int i = 0;i < 12;i++){
      for(int j = 0;j < 12;j++){
        if(field[i][j] == '1'){
          count++;
          dfs(i, j);
        }
      }
    }
    cout << count << endl;
    count = 0;
  }

  return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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;}

int main(){
    int n;cin>>n;
    vl a;
    vvl p(200005);
    rep(i,n){
        ll c;cin>>c;
        a.PB(c);
    }
    a.erase(unique(all(a)),a.end());
    n=a.size();
    rep(i,n){
        p[a[i]].PB(i);
    }
    ll dp[200005];
    mem(dp,0);
    dp[0]=1;
    rep(i,n){
        dp[i+1]+=dp[i];
        int color=a[i];
        int it=lower_bound(all(p[color]),i)-p[color].begin();
        if(it>0){
            int j=p[color][it-1];
            if(i-j>1){
                dp[i+1]+=dp[j+1];
            }
        }
        dp[i+1]%=MOD;
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 14320
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
 
#ifdef _WIN32
    #define gx getchar
    #define px putchar
    #define ps putchar(' ')
    #define pn putchar('\n')
    #define DEBUG 1
#else
    #define gx getchar_unlocked
    #define px putchar_unlocked
    #define ps putchar_unlocked(' ')
    #define pn putchar_unlocked('\n')
    #define DEBUG 0
#endif
 
#define rep(i,j,k) for(ll i=0;i<j;i+=k)
//input
void scan(int &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' ) sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * sign;
}
void lscan(ll &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' )
        sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * (ll)(sign);
}
int sscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
int wscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n' && c!=' ')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
 
//output
void print(int n)
{
    if(n<0)
    {
        n=-n;
        px('-');
    }
    int i=10;
    char o[10];
    do{o[--i] = (n%10) + '0'; n/=10;}while(n);
    do{px(o[i]);}while(++i<10);
}
void lprint(ll n)
{
    if(n<0LL)
    {
        n=-n;
        px('-');
    }
    int i=21;
    char o[21];
    do{o[--i] = (n%10LL) + '0'; n/=10LL;}while(n);
    do{px(o[i]);}while(++i<21);
}
void sprint(const char a[])
{
    const char *p=a;
    while(*p)px(*p++);
}
 
 
ll po(ll a, ll b, ll m)
{
	ll x=1,y=a;
	while(b > 0)
	{
		if(b%2 == 1)
		{
			x=(x*y);
			if(x>m) x%=m;
		}
		y = (y*y);
		if(y>m) y%=m;
		b /= 2;
	}
	return x;
}
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
	string s;
	cin>>s;
	if(s=="ABC")
		cout<<"ARC"<<endl;
	else
		cout<<"ABC"<<endl;
	return 0;
}

Measured memory_bytes: 3552
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

List.sort()
result = 'YES'

for i in range(N-1):
    if List[i] == List[i+1]:
        result = 'NO'
        break
        
print(result)

Measured memory_bytes: 25172
#include<stdio.h>
int main(void){

int a,b ;
	
scanf("%d %d" , &a , &b);

 if( a > b ){
 printf("a > b\n" );
 }
 
else if ( a < b ){
printf("a < b\n" );
}

	else if ( a == b ) {
printf("a == b\n");
} 

return 0;
}


Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, a, b) for(int i=a; i<b; i++)
#define per(i, a, b) for(int i=b-1; i>=a; i--)
#define ifor(n) for(int i=0;i<n;i++) 
#define jfor(n) for(int j=0;j<n;j++)
#define Ifor(n) for(int i=1;i<n;i++) 
#define Jfor(n) for(int j=1;j<n;j++)
const int inf=0x3f3f3f3f;
int a[200004];
int main(){
  int n;
  cin>>n;
  ifor(n)cin>>a[i];
  sort(a,a+n);
  int i=0;
  for(i;i<n;i++){
     if(a[i]==a[i+1])break;	
  }
  if(i!=n)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
}


Measured memory_bytes: 1152
#include<stdlib.h>
#include<string.h>

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll dp[2000000];
ll dp2[2000000];

int main(){
  ll N;
  ll A[2000000];
  ll ans=0;
  
  scanf("%lld", &N);

  for (int i = 0; i < N; i++)
  {
      scanf("%lld", A+i);
  }
  
  dp[0] = 0;
  dp2[0] = A[0];
  dp[1] = MAX(A[1], A[0]);

  for (int i = 2; i < N; i++)
  {
      if((i & 1) == 1){
          dp[i] = MAX(A[i] + dp[i-2], dp2[i-1]);
      }
      else
      {
          dp[i] = MAX(A[i] + dp[i-2], dp[i-1]);
          dp2[i] = dp2[i-2] + A[i];
      }
  }

    printf("%lld\n", dp[N-1]);

  return 0;
}


Measured memory_bytes: 6836
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	a, b := scanInt(), scanInt()

	c := euclidean(a,b)

	fmt.Println(a*b/c)

}

func euclidean(a,b int) int {
	r, x := a%b, b
	for r != 0 {
		x, r = r, x%r
	}
	return x
}


Measured memory_bytes: 640
#include <iostream>

#define rep(i,s,e) for (int i = s; i < e; ++i)
#define INF 1e9
using namespace std;

static const int max_size = 51;
int N, M;
int C[max_size][max_size];
bool visited[max_size];

void dfs(int n) {
	rep(i, 1, N + 1) {
		if (n == i) {
			continue;
		}
		visited[n] = true;
		if (C[n][i] == 1 && !visited[i]) {
			dfs(i);
		}
	}
}

int main()
{
	cin >> N >> M;

	rep(i, 0, M) {
		int x, y; cin >> x >> y;
		C[x][y] = 1;
		C[y][x] = 1;
	}

	int c = 0;
	rep(i, 1, N + 1) {
		rep(j, 1, N + 1) {
			if (i >= j) {
				continue;
			}

			if (C[i][j] == 1) {
				C[i][j] = 0;
				C[j][i] = 0;
				rep(k, 1, N + 1) visited[k] = false;

				dfs(i);

				bool v = true;
				rep(k, 1, N + 1) {
					v &= visited[k];
				}
				if (!v) c++;

				C[i][j] = 1;
				C[j][i] = 1;
			}
		}
	}

	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, T; cin >> N >> T;
    int ans = INF;
    rep (i, 0, N) {
        int c, t; cin >> c >> t;
        if (T >= t) ans = min(c, ans);
    }
    if (ans != INF) cout << ans << endl;
    else cout << "TLE" << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

result = 0
for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      if i * 500 + j * 100 + k * 50 == x:
        result += 1

print(result)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int a, b;
    cin >> a >> b;
    int sum = 1, ans = 0;
    while (1)
    {
        if (sum >= b)
            break;
        sum += a - 1;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> max(n);
  vector<int> min(n);
  for (int i = 0; i < n; i++) {
    cin >> min[i] >> max[i];
  }
  sort(max.begin(), max.end());
  sort(min.begin(), min.end());
  if (n % 2 == 1)
    cout << max[n / 2] - min[n / 2] + 1;
  else {
    cout << max[n / 2] + max[n / 2 - 1] - min[n / 2] - min[n / 2 - 1] + 1
         << endl;
  }
}


Measured memory_bytes: 4752
#include <iostream>
using namespace std;

int selectionSort(int A[], int N) {
    int sw = 0, minj;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) minj = j;
        }
        swap(A[i], A[minj]);
        if (i != minj) sw++;
    }
    for (int i = 0; i < N-1; i++) cout << A[i] << " ";
    cout << A[N-1] << endl;
    return sw;
}

int main() {
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++) cin >> A[i];

    int sw = selectionSort(A, N);
    cout << sw << endl;
}


Measured memory_bytes: 3088
#include<iostream>
using namespace std;
int main (){

  int r,c,d;


  while(1){
    
    cin >>r>>c;

    if( r == 0 && c == 0 )break;

    d=r*c;

    if( d%2 == 0 ){
      cout <<"yes"<<endl;
    }else{
      cout <<"no"<<endl;
    }

  }

  return 0;

}

Measured memory_bytes: 1148
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string str("END OF INPUT");
  int size;

  while(1){
    size = 0;
    string v;
    getline(cin,v);

    if(v == str){
      break;
    }

    for(char e : v){
      if(e == ' '){
        cout<<size;
        size = 0;
      } 
      else{
        size++;
      } 
    }
    cout<<size<<endl;
  }
  return 0;
}

Measured memory_bytes: 3140
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

s = ns()
lisy = [str(i).zfill(2) for i in range(0, 100)]
lism = [str(i).zfill(2) for i in range(1, 13)]

if str(s[:2]) in lisy and str(s[2:]) in lism:
    if str(s[:2]) in lism and str(s[2:]) in lisy:
        print('AMBIGUOUS')
        exit()
    else:
        print('YYMM')
        exit()
if str(s[:2]) in lism and str(s[2:]) in lisy:
    if str(s[:2]) in lisy and str(s[2:]) in lism:
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
print('NA')


Measured memory_bytes: 3444
MAX = 5100000

MOD = 1000000007


def read_input():
    x, y = map(int, input().split(" "))
    return x, y


class BinomialCoefficients(object):
    def __init__(self, MAX=MAX, MOD=MOD):
        self.MOD = MOD
        self.fac = [1 for _ in range(MAX)]
        self.finv = [1 for _ in range(MAX)]
        self.inv = [1 for _ in range(MAX)]
        for i in range(2, MAX):
            self.fac[i] = self.fac[i - 1] * i % MOD
            self.inv[i] = MOD - self.inv[MOD % i] * (MOD // i) % MOD
            self.finv[i] = self.finv[i - 1] * self.inv[i] % MOD

    def calc(self, n, k):
        if n < k:
            return 0
        if n == 0 or k < 0:
            return 0
        return self.fac[n] * (self.finv[k] * self.finv[n - k] % self.MOD) % self.MOD


def ans(X, Y):
    a_3 = 2 * X - Y
    b_3 = 2 * Y - X
    if a_3 % 3 != 0 and b_3 % 3 != 0:
        return 0
    if a_3 < 0 or b_3 < 0:
        return 0
    a = a_3 // 3
    b = b_3 // 3

    c = BinomialCoefficients()
    return c.calc(a + b, a)


if __name__ == "__main__":
    X, Y = read_input()
    print(ans(X, Y))


Measured memory_bytes: 266256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _2582
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
               double[]a=Console.ReadLine().Split().Select(double.Parse).ToArray();
               if(a[0]==a[1]&&a[0]==0){break;}
               double ans=double.MaxValue;
               
               for(int i=0;i<=(int)a[0];i++){
                   ans=Math.Min(Math.Abs(Math.Sqrt(i*i+(a[0]-i)*(a[0]-i))-a[1]),ans);
               }
               Console.WriteLine(ans);
            }
        }
    }
}

Measured memory_bytes: 9672
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  string s;
  cin>>s;
  int pa=0;
  for(int i=0;i<s.size();i++)
    if(s[i]=='p')
      pa++;
  cout<<(-pa+(s.size()/2))<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int N=2e6+5;
const int MD=1e9+7;
void add(int &x,int y) {
	x+=y;
	if(x>=MD) x-=MD;
	if(x<=0) x+=MD;
}
int f[N],inv[N];
int quick_pow(int x,int y) {
	int ans=1;
	while(y) {
		if(y&1) ans=1LL*ans*x%MD;
		y>>=1;
		x=1LL*x*x%MD;
	}
	return ans;
}
void init() {
	f[0]=1;
	for(int i=1;i<N;i++) f[i]=1LL*f[i-1]*i%MD;
	inv[N-1]=quick_pow(f[N-1],MD-2);
	for(int i=N-2;i>=0;i--) inv[i]=1LL*inv[i+1]*(i+1)%MD;
}
int cal(int x,int y) {
	return 1LL*f[x+y+2]*inv[x+1]%MD*inv[y+1]%MD;
}
int main() {
	init();
	int r1,c1,r2,c2;
	scanf("%d%d%d%d",&r1,&c1,&r2,&c2),r1--,c1--;
	int ans=0;
	add(ans,cal(r2,c2)),add(ans,cal(r1,c1));
	add(ans,-cal(r1,c2)),add(ans,-cal(r2,c1));
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 256
char ss[N];
int a[N];
vi g[N];

queue<pii> que;

int main(){
	int n; scanf("%d", &n);
	REP(i, n){
		scanf("%s", ss);
		REP(j, n){
			if(ss[j] == '1'){
				g[i].EB(j);
			}
		}
	}
	int ans = 0;
	REP(i, n){
		DEBUG("i = %d\n", i);
		fill(a, a+n, -1);

		que.emplace(i, 1);
		while(que.size()){
			pii p = que.front(); que.pop();
			int j = p.first, x = p.second;
			if(~a[j]) continue;
			a[j] = x;
			for(int &k : g[j]){
				que.emplace(k, x+1);
			}
		}

		REP(j, n){
			for(int &k : g[j]){
				if(abs(a[j] - a[k]) != 1){
					printf("-1\n");
					return 0;
				}
			}
		}
		REP(i, n) LAR(ans, a[i]);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>V(N);
  vector<int>C(N);
  for(int i=0;i<N;i++){
    cin>>V.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>C.at(i);
  }
  vector<int>S(N);
  for(int i=0;i<N;i++){
    S.at(i)=V.at(i)-C.at(i);
  }
  int sum=0;
  for(int i=0;i<N;i++){
    if(S.at(i)>0){
      sum=sum+S.at(i);
    }
    else{
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    //string days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
    string today;
    cin >> today;
    if(today == "SUN") cout << "7";
    else if(today == "MON") cout << "6";
    else if(today == "TUE") cout << "5";
    else if(today == "WED") cout << "4";
    else if(today == "THU") cout << "3";
    else if(today == "FRI") cout << "2";
    else if(today == "SAT") cout << "1";
    cout << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    sort(ALL(a));
    vector<ll> ruiseki(n+1, 0);
    REP(i, n) ruiseki[i+1] = ruiseki[i] + a[i];

    ll ans = 1;
    REP_REV(i, n-1) {
        if(ruiseki[i+1] * 2 >= a[i+1]) {
            ans++;
        } else {
            break;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 1e5+10;

int N, A[MAX];

ll solve() {
    int s = 0;
    ll ans = 0;
    REP (i, N) {
        if (A[i] > s) {
            int n = A[i] / (s+1);
            if (A[i] % (s+1) == 0) n--;
            ans += n;
            if (n > 0) A[i] = 1;
        }
        s = max(s, A[i]);
    }
    return ans;
}

int main() {
    cin >> N;
    REP (i, N) cin >> A[i];
    cout << solve() << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n,m,a[10000],cnt=0;
cin>>n>>m;
for(int i=1;i<=m;i++){
	cin>>a[i];
	cnt+=a[i];
}
if(n>=cnt)cout<<n-cnt;
else cout<<-1;
return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ft first
#define sd second
#define pb push_back
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
 
const int N = 2e5+9;
// long long a[N];
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        
    long long a, b, c; cin >> a >> b >> c;
    if(c-a-b >= 0 && 4*a*b < c*c + a*a + b*b + 2*(-a*c-b*c+a*b)) {
        cout << "Yes\n";
    } else cout << "No\n";





    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, sum = 0; cin >> n;
    vi a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    vector<pair<ll, ll>> ab(n, {0, 0});
    rep(i, n){
        ab[i].first = a[i]+b[i];
        ab[i].second = i;
    }
    sort(all(ab), greater<pair<ll, ll>>());
    rep(i, n){
        if(i%2 == 0) sum += a[ab[i].second];
        else sum -= b[ab[i].second];
    }
    cout << sum << endl;
}

Measured memory_bytes: 6328
#include <stdio.h>

int main( void ){
	int i, n, count, flag, tmp;
	
	scanf("%d", &n );
	
	int a[n];
	
	for( i = 0; i < n; i++ ){
		scanf("%d", &a[i] );
	}
	
	count = 0;
	flag = 1;
	while( flag == 1 ){
		flag = 0;
		for( i = n-1; i >= 1; i-- ){
			if( a[i] < a[i-1] ){
				tmp = a[i];
				a[i] = a[i-1];
				a[i-1] = tmp;
				count++;
				flag = 1;
			}
		}
	}
	
	for( i = 0; i < n; i++ ){
		if( i != n-1 ){
			printf("%d ", a[i] );
		}
		else{
			printf("%d\n", a[i] );
		}
	}
	printf("%d\n", count );
	
	return 0;
}


Measured memory_bytes: 2100
import itertools
h,w,k=map(int,input().split())
C=[]
for i in range(h):
    C.append(input())

itr=itertools.product([0,1],repeat=h+w)

ans=0
tar=0
for i in range(h):
    for q in range(w):
        if C[i][q]=="#":
            tar+=1
tar-=k

for t in itr:
    cnt=0
    for i in range(h):
        for q in range(w):
            if C[i][q]=="#" and (t[i]==1 or t[q+h] ==1):
                cnt+=1
    if cnt == tar:
        ans+=1

print(ans)
    


Measured memory_bytes: 9208
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="SUN")cout << 7 << endl;
  if(s=="MON")cout << 6 << endl;
  if(s=="TUE")cout << 5 << endl;
  if(s=="WED")cout << 4 << endl;
  if(s=="THU")cout << 3 << endl;
  if(s=="FRI")cout << 2 << endl;
  if(s=="SAT")cout << 1 << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.IntUnaryOperator;
import java.util.function.LongUnaryOperator;

public class Main {
    static In in = new In();
    static Out out = new Out();
    static long mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        long n = in.nextLong();
        long k = in.nextLong();
        out.println(Math.min(n % k, Math.abs(n % k - k)));
    }

    public static void main(String[]$) {
        new Main().solve();
        out.flush();
    }
}

class In {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}

class Out {
    private PrintWriter out = new PrintWriter(System.out);
    boolean autoFlush = false;

    void println(Object... a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (Object obj : a) {
            joiner.add(String.valueOf(obj));
        }
        out.println(joiner);
        if (autoFlush) {
            out.flush();
        }
    }

    void println(int[] a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i : a) {
            joiner.add(Integer.toString(i));
        }
        out.println(joiner);
        if (autoFlush) {
            out.flush();
        }
    }

    void println(long[] a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (long i : a) {
            joiner.add(Long.toString(i));
        }
        out.println(joiner);
        if (autoFlush) {
            out.flush();
        }
    }

    void flush() {
        out.flush();
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt" , "r" , stdin);
	// freopen("output.txt" , "w" , stdout);
	// #endif

	int n,m,f=0;
	cin>>n>>m;
	int a[n+1];
	for(int i=1;i<=n;i++)
		a[i]=-1;
	for(int i=1;i<=m;i++)
	{
		int d,v;
		cin>>d>>v;
		if(a[d]!=-1)
		{
			if(a[d]==v)
				continue;
			f=1;
			break;
		}
		else
		{
			a[d]=v;
		}
	}
	if(!f)
	{
		for(int i=1;i<=n;i++)
		{
			if(i==1&&a[1]==0&&n!=1)
			{
				f=1;
				break;
			}
			else if(i==1&&n==1&&a[1]==-1)
			{
					a[1]=0;
			}
			else if(i==1&&a[1]==-1)
				a[1]=1;
			else if(a[i]==-1)
				a[i]=0;
		}
	}
	if(f)
		cout<<-1<<endl;
	else
	{
		for(int i=1;i<=n;i++)
			cout<<a[i];
		cout<<endl;
	}

	
	
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (l[2]<= l[0] + l[1])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13396
/* Hello darkness my old friend, I've come to visit you again! */

#include<bits/stdc++.h>
#define lli long long int
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORB(i,b,a) for(i=b;i>=a;i--)
#define mod 1000000007
#define PI 2*acos(0.0)
#define gs getline(cin,s)
#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pb push_back
#define eb emplace_back
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 1000000005
#define INF 1000000000000000005
#define io ios_base::sync_with_stdio(0);
#define ff first
#define ss second
using namespace std;
int east[300005],west[300005];
int main()
{
    io;
    cin.tie(0);
    cout.tie(0);
    int n,i,j;
    string s;
    cin>>n>>s;
    FOR(i,0,n)
    {
        east[i+1]=east[i];
        west[i+1]=west[i];
        if(s[i]=='E')
            east[i+1]++;
        else
            west[i+1]++;
    }
    int ans=n+5;
    FOR(i,1,n+1)
    {
        int c=0;
        c=west[i-1]+east[n]-east[i];
        ans=min(ans,c);
    }
    cout<<ans;
    return 0;
}

/* This is the end, beautiful friend! */


Measured memory_bytes: 2964
<?php
for($n = trim(fgets(STDIN)); $n--;) {
    $ary = explode(" ", trim(fgets(STDIN)));
    sort($ary);
    list($x, $y, $z) = $ary;
    echo $x ** 2 + $y ** 2 - $z ** 2 ? "NO" : "YES", PHP_EOL;
}

Measured memory_bytes: 15120
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

int mn[1000005], a[1000005];

long long myPow(long long a, long long lv) {
	if (lv == 0) return 1LL;
	long long tmp = myPow(a, lv / 2);
	tmp = (tmp * tmp) % MOD;
	if (lv & 1) tmp = (tmp * a) % MOD;
	return tmp;
}

int main() {
	int n;
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	
	for (int i = 2; i <= 1000000; i++) {
		if (mn[i] != 0) continue;
		mn[i] = i;
		for (int j = i; j <= 1000000 / i; j++) {
			if (mn[j * i] == 0) mn[j * i] = i;
		}
	}
	
	map <int, int> cur;
	
	for (int i = 0; i < n; i++) {
		int tmp = a[i];
		map <int, int> now;
		
		while (tmp > 1) {
			int num = mn[tmp];
			tmp /= num;
			now[num]++;
		}
		
		if (i > 0) {
			for (auto v : now) {
				cur[v.first] += v.second - min(v.second, cur[v.first]);
			}
		}
		else cur = now;
	}
	
	long long res = 0;
	long long val = 1;
	
	for (auto v : cur) {
		val = (val * myPow(v.first, v.second)) % MOD;
	}
	
	for (int i = 0; i < n; i++) {
		res = (res + val * myPow(a[i], MOD - 2)) % MOD;
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

    int N; cin >> N;
    string S; cin >> S;
    char s = ' ';
    ll ans = 0;
    REP(i, N) {
        if (s==S[i]) {
            continue;
        } else {
            ++ans;
            s = S[i];
        }
    }
    cout << ans << '\n';

    return 0;
}



Measured memory_bytes: 512
#include <iostream>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> k;
cout << a[k - 1] << endl;

return 0;
}



Measured memory_bytes: 256
import statistics
N = int(input())
A = input().rstrip().split()

i = 0
kari =[]
for j in A:
    i +=1
    B = int(j)-i
    kari.append(B)
b= statistics.median(kari)

sum = 0
for i in kari:
    sum+=abs(i-b)
print(int(sum))

Measured memory_bytes: 29488
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
num = [*1..n]

ary = []

num.each do |i|
  ary.push(i,a[i-1])
end

new = ary.each_slice(2).to_a
man = new.sort{|a,b| a[1] <=> b[1]}

kotae = []
num.each do |i|
  kotae.push(man[i-1][0])
end

puts kotae.join(" ")

Measured memory_bytes: 23664
#include <bits/stdc++.h>
using namespace std;


int main() {
  int h, w;
  string line;
  const int BOMB = -1;
  const int FLAME = -2;
  cin >> h >> w;

  int sltn[h+2][w+2];

  for(int i = 0; i < h+2; i++) {
    for(int j = 0; j < w+2; j++) {
      sltn[i][j] = FLAME;
    }
  }
  for(int i = 1; i < h+1; i++) {
    cin >> line;

    for(int j = 0; j < w; j++) {
      if(line.at(j) == '#') {
	sltn[i][j+1] = BOMB;
      }
      else {
	sltn[i][j+1] = 0;
      }
    }
  }
    
  for(int i = 1; i < h+1; i++) {
    for(int j = 1; j < w+1; j++) {
      if(sltn[i][j] == BOMB) {
	for(int k = i-1; k < i+2; k++) {
	  for(int l = j-1; l < j+2; l++) {
	    if(k == i && l == j) {
	      continue;
	    }
	    if(sltn[k][l] >= 0) {
	      sltn[k][l]++;
	    }
	  }
	}
      }
    }
  }

  for(int i = 1; i < h+1; i++) {
    for(int j = 1; j < w+1; j++) {
      if(sltn[i][j] == BOMB) {
	cout << "#";
      }
      else {
	cout << sltn[i][j];
      }
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

template <typename T>
void ri(T& x);

int n, a;

int main() {
    #ifdef DEBUG
        freopen("in", "r", stdin);
        // freopen("out", "w", stdout);
    #endif

    ri(n); ri(a);
    
    cout << max(0, n-2*a) << endl;

    return 0;
}





template <typename T>
void ri(T& x) {
    char c;
    bool minus = false;
    while ((c=getchar())<'0' || '9'<c)
        if (c == '-') minus = true;
    x = c-'0';
    while ('0'<=(c=getchar()) && c<='9')
        x = 10*x - '0' + c;
    if (minus) x = -x;
}

Measured memory_bytes: 256