akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","w",stdout);
    string str;
    cin >> str;
    if (str[0] == str[1] && str[1] == str[2] && str[2] == 'S')
    {
        cout << 0 << endl;
    } else if (str[1] == 'R') {
        if (str[0] == 'R' && str[2] == 'R')
        {
            cout << 3 << endl;
        } else  if (str[0] == 'R' || str[2] == 'R')
        {
            cout << 2 << endl;
        } else
        {
            cout << 1 << endl;
        }
    } else
    {
        cout << 1 << endl;
    }
    return 0;
}




Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define pf pop_front
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod=1e9+7;
const ll maxn=2e5+100;
ll n;
int main()
{
    while(cin>>n)
    {
        set<ll> s;
        rep(i,n)
        {
            ll tmp;
            cin>>tmp;
            s.insert(tmp);
        }
        if(s.size()==n) cout<<"YES\n";
        else cout<<"NO\n";
    }
}



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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) cin >> a[i];
  sort(a.begin(), a.end());

  vector<int> p1(n), p2(n);
  p1[0] = 1, p2[0] = -1;
  if (n % 2 == 0) p1[n - 1] = -1, p2[n - 1] = -1;
  else p1[n - 1] = 1, p2[n - 1] = -1;
  for (int i = 1; i < n - 1; i ++) {
    if (i % 2 == 0) p1[i] = 2, p2[i] = -2;
    else p1[i] = -2, p2[i] = 2;
  }
  sort(p1.begin(), p1.end());
  sort(p2.begin(), p2.end());


  LL sum1 = 0, sum2 = 0;
  for (int i = 0; i < n; i ++) {
    sum1 += a[i] * p1[i];
    sum2 += a[i] * p2[i];
  }

  cout << max(sum1, sum2) << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define N 100
#define INF 1e9 + 5
#define LINF 1e18 + 5

using namespace std;
using ll = long long;
string a, b;
int memo[3002][3002];
int solve(int y, int x)
{

    if (x == 0 || y == 0)
        return memo[y][x] = 0;
    int &best = memo[y][x];
    if (best != -1)
        return best;
    best = max(solve(y - 1, x), solve(y, x - 1));
    if (a[y] == b[x])
        best = max(best, solve(y - 1, x - 1) + 1);
    return best;
}
/*
 abyxb
a10000 
x11122
y11222
b12223
*/
int main()
{
    cin >> a >> b;
    a = "$" + a;
    b = "$" + b;
    //memo.resize(a.length() + 1, vector<int>(b.length() + 1, -1));
    memset(memo, -1, sizeof(memo));
    int maxlenth = solve(a.length() - 1, b.length() - 1);
    int x = b.length() - 1, y = a.length() - 1;
    string t = "";
    while (x > 0 && y > 0)
    {
        if (memo[y][x] == memo[y - 1][x])
            y--;
        else if (memo[y][x] == memo[y][x - 1])
            x--;
        else
        {
            t = a[y--] + t;
            x--;
        }
    }
    cout << t;
    return 0;
}

Measured memory_bytes: 35968
#include<iostream>
#include<set>

using namespace std;

int main() {
    int n;
    cin >> n;
    set<int> S;
    for(int i=0; i<n; i++) {
        int x;
        cin >> x;
        S.insert(x);
    }
    int q;
    int count = 0;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int now;
        cin >> now;
        for(auto target : S) {
            if (now == target) {
                count++;
                break;
            }
        }
    }
    cout << count << endl;
}



Measured memory_bytes: 3120
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	int N; cin >> N;
	
	ll data[N][2];
	F0R(i, N) {
		F0R(j, 2) cin >> data[i][j];
	}
	
	ll ans = 0;
	
	F0R(xP, 2) {
		F0R(yP, 2) {
			ll xC = xP; if (xC == 0) xC = -1;
			ll yC = yP; if (yP == 0) yC = -1;
			
			vpl oldPoints;
			oldPoints.pb({0, 0});
			
			F0R(i, N) {
				vpl newPoints;
				F0R(j, sz(oldPoints)) {
					newPoints.pb(oldPoints[j]);
					newPoints.pb(mp(oldPoints[j].f+data[i][0]*xC, oldPoints[j].s+data[i][1]*yC));
				}
				sort(all(newPoints));
				reverse(all(newPoints));
				oldPoints.clear();
				
				F0R(x, sz(newPoints)) {
					int k = sz(oldPoints)-1;
					if (sz(oldPoints) == 0 || oldPoints[k].f < newPoints[x].f || oldPoints[k].s < newPoints[x].s) {
						oldPoints.pb(newPoints[x]);
					}
				}
				
				/*for (auto it = newPoints.begin(); it != newPoints.end(); it++) {
					pl cur = *it;
					if (it == newPoints.begin()) continue;
					it--;
					pl lst = *(it);
					it++;
					
					if (lst.f >= cur.f && lst.s >= cur.s) newPoints.erase(cur);
					it = newPoints.upper_bound(cur);
					it--;
				}
				
				oldPoints.clear();
				for (auto it = newPoints.begin(); it != newPoints.end(); it++) oldPoints.pb(*it);*/
			}
			
			F0R(i, sz(oldPoints)) {
				//cout << oldPoints[i].f << " " << oldPoints[i].s << endl;
				ans = max(ans, oldPoints[i].f*oldPoints[i].f+oldPoints[i].s*oldPoints[i].s);
			}
		}
	}
	
	
	cout << setprecision(30) << sqrtl((ld) ans) << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 9976
import math
def fact(n):
    mod = int(1e9)+7
    return math.factorial(n)%mod

N,M = map(int,input().split())

if abs(N-M) >= 2:
    print(0)
    exit()

mod = int(1e9)+7

if N == M:
    print(2*fact(N)*fact(M)%mod)
else:
    print(fact(N)*fact(M)%mod)

Measured memory_bytes: 4096
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#include <string>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PL;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  ll N, C;
  cin >> N >> C;
  ll x[MAX], v[MAX];
  ll s[MAX]={}, t[MAX]={};
  
  x[0]=0; v[0]=0;
  x[N+1]=C; v[N+1]=0;
  for(i=1; i<=N; i++) cin >> x[i] >> v[i];
  for(i=1; i<=N+1; i++) s[i]=s[i-1]+v[i];
  for(i=N; i>=0; i--) t[i]=t[i+1]+v[i];
  
  ll p[MAX], pp[MAX];
  ll m=-INF, mm=-INF;
  ll d=0, dd=0;
  for(i=0; i<=N; i++) {
    if(m<s[i]-x[i]) {m=s[i]-x[i]; d=i;}
    if(mm<s[i]-x[i]*2) {mm=s[i]-x[i]*2; dd=i;}
    p[i]=d; pp[i]=dd;
  }
  
  ll ans=0;
  for(i=1; i<=N+1; i++) {
    ll sco, po;
    sco=0;
    po=p[i-1];
    sco+=s[po]-x[po]+t[i]-(C-x[i])*2; //OA+OB*2
    chmax(ans, sco);
    
    sco=0;
    po=pp[i-1];
    sco+=s[po]-x[po]*2+t[i]-(C-x[i]); //OA*2+OB
    chmax(ans, sco);
  }
  
  pt(ans);
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    ld tt;
    cin>>tt;
    ld go = tt/(ld)3;
    ld ans = go * go * go;
    cout<<setprecision(10)<<fixed<<ans;
    return 0;
}

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

int main() {
  int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
  if(e-a>k){
    cout<<":("<<endl;
  }
  else{
    cout<<"Yay!"<<endl;
  }
}

  

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long
using namespace std;
int main() 
{ 
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    ll dp[n];
    for(int i=0;i<n;i++)
    {
        dp[i]=1e12;
    }
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+k;j++)
        {
            if(j<n)
            {
                dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
            }
        }
    }
    /*for(int i=0;i<n;i++)
    {
        cout<<dp[i]<<" ";
    }*/
    cout<<dp[n-1];
} 


Measured memory_bytes: 4744
def main():
    n, m = map(int,input().split())
    hlis = list(map(int, input().split()))
    hdic = {}
    rdic = {}
    for i in range(1, len(hlis)+1):
        hdic[i] = hlis[i-1]
    for j in range(m):
        a, b = map(int, input().split())
        if a in rdic:
            if rdic[a] < hdic[b]:
                rdic[a] = hdic[b]
        else:
            rdic[a] = hdic[b]
        if b in rdic:
            if rdic[b] < hdic[a]:
                rdic[b] = hdic[a]
        else:
            rdic[b] = hdic[a]
    ans = 0
    #print(hdic, rdic)
    for key in hdic:
        if key in rdic:
            if hdic[key] > rdic[key]:
                ans += 1
                #print(key)
        else:
            ans += 1
            #print(key)
    print(ans)



    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 100440
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string s,t;
  cin >> s>>t;
  sort(s.begin(), s.end());sort(t.begin(), t.end(),greater<char>());
  if(s<t)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll gcd(ll a, ll b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}

ll gcds(vector<ll> a) {
  ll ret = a[0];
  for (int i = 1; i < a.size(); i++) {
    ret = gcd(ret, a[i]);
  }
  return ret;
}

void solve() {
  int n, X; cin >> n >> X;
  vector<ll> x(n);
  rep(i, n) {
    ll xi; cin >> xi;
    x[i] = abs(xi - X);
  }
  outl(gcds(x));
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 1792
#define P(x) cout << #x " = " << x << endl
#define PP(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define PPP(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl

#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<string>

using namespace std;

int n, q;
string s;
string t;
string d;

int main()
{
    string s;
    cin >> n >> q;
    cin >> s;
    char tmp;
    for (int i = 0; i < q; ++i) {
        cin >> tmp;
        t += tmp;
        cin >> tmp;
        d += tmp;
    }
    int left = 0;
    int right = n;

    for (int i = 0; i < q; ++i) {
        char ti = t[q - i - 1];
        char di = d[q - i - 1];
        if (di == 'R') {
            if (s[right - 1] == ti) right--;
            if (left != 0 && s[left - 1] == ti) left--;
        } else {
            if (right != n && s[right] == ti) right++;
            if (s[left] == ti) left++;
        }
        if (right == left) break;
    }
    cout << right - left << endl;
}

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

int main(){
    int mat[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> mat[i][j];
        }
    }
    for(int i=0; i<2; i++){
        for(int j=i+1; j<3; j++){
            if((mat[0][j]-mat[0][i]) != (mat[1][j]-mat[1][i])){
                cout << "No" << endl;
                return 0;
            }
            if((mat[0][j]-mat[0][i]) != (mat[2][j]-mat[2][i])){
                cout << "No" << endl;
                return 0;
            }
            if((mat[1][j]-mat[1][i]) != (mat[2][j]-mat[2][i])){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n, m, m_last, l, l_last, i, j, k;
	long arr[100][100], arr2[100][100], sum = 0;
	
	scanf("%d %d %d\n", &n, &m, &l);
	m_last = m-1;
	l_last = l-1;
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			if(j == m_last){
				scanf("%ld\n", &arr[i][j]);
				break;
			}
			scanf("%ld", &arr[i][j]);
		}
	}
	for(j = 0; j < m; j++){
		for(k = 0; k < l; k++){
			if(k == l_last){
				scanf("%ld\n", &arr2[j][k]);
				break;
			}
			scanf("%ld", &arr2[j][k]);
		}
	}
	for(i = 0; i < n; i++){
		for(k = 0; k < l; k++){
			for(j = 0; j < m; j++){
				sum += arr[i][j]*arr2[j][k];
			}
			if(k == l_last){
				printf("%ld\n", sum);
			}else{
				printf("%ld ", sum);
			}
			sum = 0;
		}
	}

	return 0;
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 100000+5;

int n, k;
vi primos;
int mu[N];
int ways[N];
bool composite[N];

void init(){
	mu[1] = 1;
	for(int i=2; i<N; i++){
		if(!composite[i]){
			primos.emplace_back(i);
			mu[i] = -1;
		}
		for(int p : primos){
			if(i * p >= N) break;
			composite[i * p] = true;
			mu[i * p] = -mu[i];
			if(i % p == 0){
				mu[i * p] = 0;
				break;
			}
		}
	}
	for(int i=1; i<=k; i++){
		ways[i] = pow_mod((k / i), n);
	}
}

int main(){
	ri2(n,k);
	init();
	int ans = 0;
	for(int g = 1; g <= k; g++){
		int act = 0;
		for(int i = g; i <= k; i += g){
			act = add(act, mul(ways[i], mu[i / g]));
		}
		ans = add(ans, mul(g, act));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4668
#include<stdio.h>
#define MAX 100000

int parent(int);
int left(int);
int right(int);


int main(){
int H,i,A[MAX+1];

scanf("%d", &H);

 for ( i = 1; i <= H; i++ ){
   scanf("%d",&A[i]);
 }

 for ( i = 1; i <= H; i++ ){
   printf("node %d: key = %d, ",i,A[i]);
   if (parent(i)>=1){
     printf("parent key = %d, ",A[parent(i)]);
   } 
   if (left(i)<=H){
     printf("left key = %d, ",A[left(i)]);
   }
   if (right(i)<=H){
     printf("right key = %d, ",A[right(i)]);
   }
   printf("\n");
 }
  

 return 0;
}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,n) for(ll i=0;i<n;i++)
#define nforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define all(v) v.begin(),v.end()
#define MOD 1000000007
#define d1(x) cerr <<"> "<<#x<<" = "<<x<<'\n'
#define d2(x, y) cerr <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<'\n'
#define d3(x, y, z) cerr <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<' '<<#z<<" = "<<z<<'\n'
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
	// cin>>t;
	while(t--){
		int n,k,s;
		cin>>n>>k>>s;
		if(s==int(1e9)){
			if(n==k){
				forn(i,n) cout<<s<<" ";
			}
			else{
				forn(i,n-k) cout<<"1 ";
				forn(i,k) cout<<s<<" ";
			}
		}
		else{
			forn(i,k) cout<<s<<" ";
			forn(i,n-k) cout<<s+1<<" ";
		}
		cout<<endl;
	}
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

int mmnmm(int num)
{
    int bit = 0;
    int nnum = num;
    while (num) {
        ++bit;
        num /= 2;
    }
    return (1LL << bit) - nnum;
}

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

    Int(n);
    map<int, int> funami;
    vector<int> data(n);
    for (int i = 0; i < n; ++i) {
        cin >> data[i];
        ++funami[data[i]];
    }
    sort(all(data)); reverse(all(data));

    int ans = 0;
    rep(i, n) {
        if (funami[data[i]]) {
            --funami[data[i]];
            int targ = mmnmm(data[i]);
            if (funami[targ]) {
                --funami[targ];
                ++ans;
            }
        }
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 26880
#include<bits/stdc++.h>
using namespace std;
string s;
int l;
int main()
{
	cin>>s;
	l=s.size();
	for(register int i=0; i<l; i++)
		if(s[i]=='C')
			for(register int j=i+1; j<l; j++)
			
				if(s[j]=='F')
				{
					printf("Yes");
					return 0;
				}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;



vvi a;
vvi tejun;

int main() {
    int h, w;
    cin >> h >> w;
    a.assign(h, vi(w));
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
            a[i][j] &= 1;
        }
    }
    int i=0, j=0;
    int i_ =0, j_=-1;
    bool check = false;
    while(1) {
        if(!i && i_ == 1) {
            i_--;
            ++j;
        } else if(!i && !i_) {
            i++;
            j_++;
            if(h == 1) {
                i--;
                j++;
            }
        } else if(i == h-1 && i_ == h-2) {
            i_++;
            ++j;
        } else if(i == h-1 && i_ == i) {
            i--;
            ++j_;
        } else {
            i = 2*i-i_;
            i_ = (i+i_)/2;
        }
        
        if(j == w) break;
        if(check) {
            if(a[i_][j_]) check = false;
            else {
                tejun.push_back({i_, j_, i, j});
            }
        } else {
            if(a[i_][j_]) {
                check = true;
                tejun.push_back({i_, j_, i, j});
            }
        }
    }

    cout << (int)tejun.size() << endl;
    rep(i, tejun.size()) {
        rep(j, 3) {
            cout << ++tejun[i][j] << ' ';
        }
        cout << ++tejun[i][3] << '\n';
    } 
}

Measured memory_bytes: 10032
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};

int main() {
    ll n,q; cin >> n >> q;
    string s; cin >> s;
    vector<char> c(q);
    vl move(q);
    rep(i,q){
        char a,b; cin >> a >> b;
        c[i] = a;
        move[i] = b=='L' ? -1 : 1;
    }
    ll ok = -1;
    ll ng = n;
    while(ng-ok>1){
        ll mid = (ok + ng) / 2;
        ll cur = mid;
        rep(i,q){
            if(s[cur]==c[i]){
                if(move[i]==1) cur++;
                else cur--;
            }
            if(cur == n || cur == -1) break;
        }
        if(cur==-1){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    ll ans = ok + 1;
    ok = n;
    ng = -1;
    while(ok-ng>1){
        ll mid = (ok + ng) / 2;
        ll cur = mid;
        rep(i,q){
            if(s[cur]==c[i]){
                if(move[i]==1) cur++;
                else cur--;
            }
            if(cur == n || cur == -1) break;
        }
        if(cur==n){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    ans += n-ok;
    cout << n-ans << endl;
}


Measured memory_bytes: 2436
N, T = map(int, input().split())
c_t_list = [list(map(int, input().split())) for _ in range(N)]
c_t_list.sort(key=lambda x: x[0])

min_cost = float("inf")
for c_t in c_t_list:
    if c_t[1] <= T:
        min_cost = min(min_cost, c_t[0])
if min_cost == float("inf"):
    print("TLE")
else:
    print(min_cost)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    string a,b;
    getline(cin,a);
    getline(cin,b);
    sort(b.begin(),b.end(),greater<char>());
    sort(a.begin(),a.end());
    if(a<b) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	string s;
	cin >> s;

	for (int i = 0; i < s.length(); i++)
		printf("x");



	//std::printf("%d", r);

	return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
#include<stdlib.h>

int main(){
int H,N,i,sum=0;
  scanf("%d %d",&H,&N);
  int *A=(int*)malloc(sizeof(int)*N);
  for(i=0;i<N;i++){
  	scanf("%d",&A[i]);
    sum+=A[i];
  }
  if(sum>=H)printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int line[4];
    for (int i = 0; i < 4; ++i) {
        cin >> line[i];
    }
    for (int i = 1; i < 4; ++i) {
        swap(line[0], line[i]);
        if (line[0] == line[1] && line[2] == line[3]) {
            cout << "yes" << endl;
            return 0;
        }
    }
    cout << "no" << endl;
    return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};

int grid[501][501];
int h, w;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> h >> w;
    vector<PPoint> ans;
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            cin >> grid[i][j];
        }
    }
    
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w - 1; j++)
        {
            if(grid[i][j] % 2 == 0) continue;
            grid[i][j] -= 1;
            grid[i][j+1] += 1;
            ans.push_back(PPoint{Point{i, j}, Point{i, j+1}});
        }
    }
    
    for(int i = 1; i <= h - 1; i++)
    {
        if(grid[i][w] % 2 == 0) continue;
        grid[i][w] -= 1;
        grid[i+1][w] += 1;
        ans.push_back(PPoint{Point{i, w}, Point{i+1, w}});
    }
    cout << ans.size() << endl;
    for(auto pp : ans)
    {
        cout << pp.x.x << " " << pp.x.y << " " << pp.y.x << " " << pp.y.y << endl;
    }
   
    
    return 0;
}


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

struct Node {
  int key;
  Node *prev, *next;
};

Node *nil;

void init() {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void insert(int key) {
  Node *node = (Node *)malloc(sizeof(Node));
  node->key = key;
  node->next = nil->next;
  node->prev = nil;

  nil->next->prev = node;
  nil->next = node;  
}

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void deleteNode(Node *t) {
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst() {
  deleteNode(nil->next);
}

void deleteLast() {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void printList() {
  Node *cur = nil->next;
  while(true) {
    if(cur->next == nil) {
      printf("%d", cur->key);
      break;
    } else {
      printf("%d ", cur->key);
    }
    cur = cur->next;
  }
  printf("\n");
}

int main() {
  int n;
  char command[20];
  int key;

  scanf("%d", &n);
  init();

  for(int i = 0; i < n; i++) {
    scanf("%s%d", command, &key);
    if(strcmp(command, "insert") == 0) insert(key);
    else if(strcmp(command, "delete") == 0) deleteKey(key);
    else if(command[6] == 'F') deleteFirst();
    else deleteLast();
  }
  printList();
  return 0;
}


Measured memory_bytes: 34428
def solve():
  n,m = (int(i) for i in input().split())
  query = [[] for _ in range(n)]
  ans = ["0"]*m
  for si in range(m):
    p,y = (int(i) for i in input().split())
    query[p-1].append((y,si))
  for i in range(n):
    query[i] = sorted(query[i])
    tp = len(query[i])
    si = "0"*(6-len(str(i+1)))+str(i+1)
    if query[i]:
      for year in range(tp):
        gomi,number = query[i][year] 
        d = "0"*(6-len(str(year+1)))+str(year+1)
        ans[number] = si+d
  for i in range(m):
    print(ans[i])

solve()

Measured memory_bytes: 36008
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
void BinarySearch(unsigned long long p[], unsigned long long key, unsigned long long*,unsigned long long);
int main() {
	unsigned long long n, S[100000] = { 0 }, T[50000] = { 0 }, q, i, cnt = 0;
	unsigned long long *p=S, *key=T;
	scanf("%lld", &n);
	for (i = 0; i < n; i++) scanf("%lld", p + i);
	
	scanf("%lld", &q);
	for (i = 0; i < q; i++) scanf("%lld", key + i);
	
	for (i = 0; i < q; i++) BinarySearch(p, *(key + i), &cnt,n);
	printf("%lld\n", cnt);
	return 0;
}

void BinarySearch(unsigned long long p[], unsigned long long key, unsigned long long *cnt, unsigned long long n){
	unsigned long long l,r,m;
	for (l = 0, r = n; l < r;) {
		m = (l + r) / 2;
		if (*(p + m) == key) { *(cnt) += 1; break; }
		else if (key < *(p + m)) r = m;
		else if (key > *(p + m)) l = m + 1;
	}
}

Measured memory_bytes: 1780
package main

import (
	"fmt"
)

func main() {
	var R, G, B, N int
	fmt.Scan(&R, &G, &B, &N)
	ans := 0
	//start := time.Now()
	for r := 0; r*R <= N; r++ {
		rr := r * R
		for g := 0; g*G <= N-rr; g++ {
			gg := g * G
			b := (N - rr - gg) / B
			if b >= 0 && (N-rr-gg)%B == 0 {
				ans++
			}
		}
	}
	//elapsed := time.Now().Sub(start)
	//fmt.Println(ans, elapsed)
	fmt.Println(ans)
}


Measured memory_bytes: 512
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
ll a,b,c,d,e,f,g;
int main()
{
	cin>>a>>b>>c>>d>>e>>f>>g;
	cout<<a+b+d+e+(a==0&&d%2==1&&e%2==1||d==0&&e%2==1&&a%2==1||e==0&&a%2==1&&d%2==1?-2:(d%2==e%2&&e%2==a%2?0:-1))<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int g = sc.nextInt();
        int b = sc.nextInt();
        int n = 100*r+10*g+b;
        String ans = "NO";
        if(n%4==0) ans = "YES";
        System.out.println(ans);
    }
}
 

Measured memory_bytes: 23508
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;

//ここから
void solve(){
  int n,m;
  cin>>n>>m;
    bool ng=false;
  vector<int>v(m+10);
  bool cc=true;
  if(n>1)cc=false;
  rep(i,m){
    int s,c;
    cin>>s>>c;
    if(s!=1||c!=0)cc=false;
    if(v[s-1]!=0&&v[s-1]!=c)ng=true;
    if(s==1&&c==0)ng=true;
    if(s>n)ng=true;
    v[s-1]=c;
  }
  string ans="";
  rep(i,n){
    if(i==0){
      if(cc){
        cout<<0;
        return;
      }
      if(v[0]==0)ans+="1";
      else ans+=to_string(v[0]);
    }
    else{
      if(v[i]!=0)ans+=to_string(v[i]);
      else ans+="0";
    }
  }
  if(!ng)cout<<ans;
  else cout<<-1;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 256
N = int(input())
c = [i for i in input()]

ret = 0
i, j = 0, N - 1
while i < j :
  while i < N and c[i] != 'W' :
    i += 1
  while 0 <= j and c[j] != 'R' :
    j -= 1
  if i < j :
    ret += 1
    c[i], c[j] = c[j], c[i]
    
print(ret)

Measured memory_bytes: 87156
#include <stdio.h>
#include <string.h>

int main(){
   char X[2],Y[2];
  scanf("%s %s",X,Y);
  if(strcmp(X,Y)==0){
    printf("=");
  }
  if(strcmp(X,Y)<0){
    printf("<");
  }
  if (strcmp(X,Y)>0) {
    printf(">");
  }
  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define int lint
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
signed main(){
    int a, b, c;
    cin >> a >> b >> c;
    int maxi = max({a, b, c});
    int mini = min({a, b, c});
    int mid = a + b + c - maxi - mini;
    cout << (mini * mid) / 2 << endl;
    return 0;
}

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

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (b < a) { a = b; return true; } return false; }

const int inf = 1<<29;

int N, M;
vector<vector<int>> d(105, vector<int>(105, inf));

void floyd(){
   for(int k=0; k<N; k++){
       for(int i=0; i<N; i++){
           if(d[i][k] == inf) continue;
           for(int j=0; j<N; j++){
               if(d[k][j] == inf) continue;

               chmin(d[i][j], d[i][k]+d[k][j]);
           }
       }
   }
}

int main(){
    cin >> N >> M;
    vector<int> a(M), b(M), c(M);

    for(int i=0; i<N; i++) d[i][i] = 0;
    for(int i=0; i<M; i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--;

        d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
    }

    floyd();

    int ans = 0;
    for(int i=0; i<M; i++){
        bool flg = false;
        for(int p=0; p<N; p++){
            if(d[p][a[i]]+c[i] == d[p][b[i]]) flg = true;
        }
        if(!flg) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n=input()
l=map(int,raw_input().split())
f=0
t=0
o=0
for i in l:
    if i%4==1 or i%4==3:
        o+=1
    elif i%4==2:
        t+=1
    else:
        f+=1
if t==0:
    if f>=n/2:
        ans="Yes"
    else:
        ans="No"
else:
    if o<=f:
        ans="Yes"
    else:
        ans="No"
print ans


Measured memory_bytes: 11320
N = int(input())
A = list(map(int, input().split()))

ans = ""
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break
    else:
        ans = "APPROVED"
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int x;
  cin >> x;
  for(int a = 1; a < 1000; a++){
    ll a5 = 1;
    rep(i,5) a5 *= a;
    for(int b = -1000; b < 1000; b++){
      ll b5 = 1;
      rep(i,5) b5 *= b;
      if(a5-b5 == x){
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

#define ff first
#define ss second
#define pb push_back
#define sz size()
#define mp make_pair
#ifndef ONLINE_JUDGE 
#include "/home/asif/Codes/Library/debug.h"
#endif
/*--------------------------------------------------------------------*/

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;

int main() {

  int k; cin >> k;
  string s;
  cin >> s;
  for(int i = 0; i < min(int(s.sz), k); i++) cout << s[i];
  if(s.sz > k)cout <<"...";
  cout << endl;

  return 0;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args){
        int N;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int cont = 0;
        for (int i=1; i<=N; i+=2){
            cont++;
        }
        System.out.printf("%.9f\n", cont*1.0/N);
    }
}


Measured memory_bytes: 23124
def row_sum(list):
    sum = 0
    for i in range(len(list)):
        sum += list[i]
    return sum

def column_sum(list, stop):
    sum = []
    for i in range(stop):
        temp_sum = 0
        for j in range(len(list)):
            temp_sum += list[j][i]
        sum.append(temp_sum)
    return(sum)

def answer(list, stop):
    list.append(column_sum(list, stop))
    for i in list:
        i.append(row_sum(i))
    return list

def print_list_list(list):
    for i in list:
        print(i[0],end="")
        for j in range(1, len(i)):
            print(" ", end="")
            print(i[j],end="")
        print()

r, c = map(int,input().split())
a = []
for i in range(r):
    a.append(list(map(int,input().split())))

ans = answer(a, c)
print_list_list(ans)


Measured memory_bytes: 6728
s = str(input())
n = len(s)
a = 0
b = 0
apple = ("10" * n)[:n]
orange = ("01" * n)[:n]
for i in range(n):
    if apple[i] != s[i]:
        a += 1
    if orange[i] != s[i]:
        b += 1
print(min(a, b))

Measured memory_bytes: 9324
a,b = map(int,input().split())
if a % 4 == 0 and b % 4 == 0:
    print(b)
    exit()

c = []
if a % 4 != 0:
    c += list(range(a,a+(4-(a%4))))
c += list(range(b-(b%4),b+1))

e = 0
for i in c:
    d = bin(e ^ i)
    e = int(d,2)
print(e)


Measured memory_bytes: 3060
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let a = get!([usize]);

    let mut mx = 0;
    let mut mxn = 0;
    let mut mn = n;
    let mut mnn = 0;
    for &e in &a {
        if mx < e {
            mx = e;
            mxn = 1;
        } else if mx == e {
            mxn += 1;
        }
        if mn > e {
            mn = e;
            mnn = 1;
        } else if mn == e {
            mnn += 1;
        }
    }
    if mx-mn > 1 {
        println!("No");
    } else if mx == mn {
        if n-1 == mx || n >= 2*mx {
            println!("Yes");
        } else {
            println!("No");
        }
    } else {
        if mnn >= mx {
            println!("No");
        } else {
            let res = mx-mnn;
            if mxn >= 2*res {
                println!("Yes");
            } else {
                println!("No");
            }
        }
    }
}


Measured memory_bytes: 10620