akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	Info(int arg_x,int arg_y){

		x = arg_x;
		y = arg_y;
	}
	int x,y;
};

int N;
ll table[51];
vector<Info> ANS;

int main(){

	scanf("%d",&N);

	ll minimum = BIG_NUM,maximum = -BIG_NUM;

	for(int i = 0; i < N; i++){

		scanf("%lld",&table[i]);

		minimum = min(minimum,table[i]);
		maximum = max(maximum,table[i]);
	}

	//printf("min:%lld maxi:%lld\n",minimum,maximum);

	if(minimum == maximum){

		printf("0\n");
		return 0;
	}

	ll base_num;

	if(abs(minimum) <= abs(maximum)){

		base_num = maximum;
	}else{

		base_num = minimum;
	}

	int base_index;
	for(int i = 0; i < N; i++){

		if(table[i] == base_num){

			base_index = i;
			break;
		}
	}

	//printf("base_num:%d base_index:%d\n",base_num,base_index);

	int count = 0;

	if(base_num > 0){ //絶対値が最大である数が正の場合

		//負の値があれば、0以上にする
		for(int i = 0; i < N; i++){
			if(i == base_index || table[i] >= 0)continue;

			table[i] += base_num;
			count++;
			ANS.push_back(Info(base_index+1,i+1));
		}

		for(int i = 0; i < N-1; i++){
			if(table[i] <= table[i+1])continue;

			table[i+1] += table[base_index]; //0以上の数に現時点の最大値を足すので、必ずtable[i] <= table[i+1]になる
			count++;
			ANS.push_back(Info(base_index+1,i+2));
			base_num = table[i+1]; //最大値更新
			base_index = i+1;
		}

	}else{ //絶対値が最大である数が負の場合

		//正の値があれば、0以下にする
		for(int i = 0; i < N; i++){
			if(i == base_index || table[i] < 0)continue;

			table[i] += base_num;
			count++;
			ANS.push_back(Info(base_index+1,i+1));
		}

		for(int i = N-1; i >= 1; i--){
			if(table[i-1] <= table[i])continue;

			table[i-1] += table[base_index]; //0以下の数に現時点の最小値を足すので、必ずtable[i-1] <= table[i]になる
			count++;
			ANS.push_back(Info(base_index+1,i));
			base_num = table[i-1]; //最小値更新
			base_index = i-1;
		}
	}

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

	for(int i = 0; i < count; i++){

		printf("%d %d\n",ANS[i].x,ANS[i].y);
	}

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"io"
	"os"
)

func parse(r io.Reader) [2][]int {
	var N int
	fmt.Fscan(r, &N)
	var a [2][]int

	for i := 0; i < 2; i++ {
		a[i] = make([]int, N)
		for j := 0; j < N; j++ {
			fmt.Fscan(r, &a[i][j])
		}
	}

	return a
}

func calc(a [2][]int) int {
	N := len(a[0])
	max := 0
	for i := 0; i < N; i++ {
		sum := 0
		for j := 0; j < i+1; j++ {
			sum += a[0][j]
		}
		for j := i; j < N; j++ {
			sum += a[1][j]
		}
		if max < sum {
			max = sum
		}
	}
	return max
}

func main() {
	fmt.Println(calc(parse(os.Stdin)))
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>x[2500];
vector<int>dist[2500];
string S;int h,w;
int main(){
    while(true){
        cin>>h>>w;int gx,gy,cnt=0;if(h==0)break;
        for(int i=0;i<2500;i++){x[i].clear();dist[i].clear();}
        for(int i=0;i<w;i++){
            for(int j=0;j<h;j++){
                cin>>S;
                if(S=="S"){
                    x[0].push_back(make_pair(i,j));
                    dist[0].push_back(0);
                }
                else if(S=="G"){gx=i;gy=j;}
                else if(S!="."){
                    int v=stoi(S);x[v].push_back(make_pair(i,j));
                    cnt=max(cnt,v);dist[v].push_back(1<<30);
                }
            }
        }
        cnt++;x[cnt].push_back(make_pair(gx,gy));dist[cnt].push_back(1<<30);
        for(int i=1;i<=cnt;i++){
            for(int j=0;j<dist[i-1].size();j++){
            	for(int k=0;k<dist[i].size();k++){
                    int D=abs(x[i-1][j].first-x[i][k].first);
                    D+=abs(x[i-1][j].second-x[i][k].second);
                    dist[i][k]=min(dist[i][k],dist[i-1][j]+D);
                }
            }
        }
        cout<<dist[cnt][0]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
const int MAX=100005;

int dp[MAX];
int main(){
    int N;
    cin >> N;
    int i;
    int h[N];
    for(i=0;i<N;i++)cin >> h[i];
    for(i=0;i<N;i++){
        if(i==0)dp[i+1]=abs(h[i+1]-h[i])+dp[i];
        else{if(dp[i+1]>abs(h[i+1]-h[i])+dp[i])dp[i+1]=abs(h[i+1]-h[i])+dp[i];}
        dp[i+2]=abs(h[i+2]-h[i])+dp[i];
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
N,K,Q = map(int,input().split())
A = [K-Q for _ in range(N+1)]
for _ in range(Q):
    i = int(input())
    A[i] += 1
for i in range(1,N+1):
    if A[i]>0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 7848
fun main() {
    val s = readLine()!!
    var ans = 0
    var g = 0
    var p = 0
    for (c in s) {
        if (c == 'g') {
            if (p < g) {
                ans++
                p++
            } else {
                g++
            }
        } else {
            if (p < g) {
                p++
            } else {
                ans--
                g++
            }
        }
    }
    println(ans)
}


Measured memory_bytes: 37044
fun main(args: Array<String>) {
    val s = readLine()!!

    val result = when {
        s == "keyence" -> true
        s.startsWith("keyence") -> true
        s.endsWith("keyence") -> true
        s.startsWith("k") && s.endsWith("eyence") -> true
        s.startsWith("ke") && s.endsWith("yence") -> true
        s.startsWith("key") && s.endsWith("ence") -> true
        s.startsWith("keye") && s.endsWith("nce") -> true
        s.startsWith("keyen") && s.endsWith("ce") -> true
        s.startsWith("keyenc") && s.endsWith("e") -> true
        else -> false
    }

    if (result) {
        println("YES")
    } else {
        println("NO")
    }
}

Measured memory_bytes: 33736
use proconio::{fastout, input};

#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        x: usize
    }
    let num = x / 100;
    let res = if 100 * num <= x && x <= 105 * num {
        true
    } else {
        false
    };
    println!("{}", if res { 1 } else { 0 });
}


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

int main() {
  int N, K, x, D = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x <= K - x + 1) {
      D += 2 * x;
    }
    else {
      D += 2 * (K - x);
    }
  }
  cout << D << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 100005
int n,m,rt,g,cnt,tot,nm,I,tp,x[N*10][2],y[N*10][2],id[N*10],he[N*10],ne[N*10],to[N*10],dfn[N*10],low[N*10],sc[N*10],in[N*10],st[N*10];vector<int>s[N*2];
struct nod{int x,d;friend int operator<(nod a,nod b){if(a.x!=b.x) return a.x<b.x;return a.d<b.d;}}t[N*10];
void add(int x,int y){to[cnt]=y;ne[cnt]=he[x];he[x]=cnt++;}
int Pd(int x){return upper_bound(t+1,t+m+2,(nod){x,1000000000})-t;}
int Pu(int x){return lower_bound(t+1,t+m+2,(nod){x,0})-t-1;}
void bud(int x,int l,int r)
{
	id[x]=++tot;if(l==r){for(int i=0;i<s[l].size();i++) add(id[x],s[l][i]>n?s[l][i]-n:s[l][i]+n);return;}
	int mid=(l+r)>>1;bud(x*2,l,mid);bud(x*2+1,mid+1,r);add(id[x],id[x*2]);add(id[x],id[x*2+1]);
}
void upd(int x,int l,int r,int b,int e,int v)
{
	if(b>e) return;if(b<=l&&r<=e){add(v,id[x]);return;}int mid=(l+r)>>1;
	if(b<=mid) upd(x*2,l,mid,b,e,v);if(e>mid) upd(x*2+1,mid+1,r,b,e,v);
}
void dfs(int x)
{
    dfn[x]=low[x]=++I;in[x]=1;st[++tp]=x;
    for(int i=he[x],y;~i;i=ne[i]) if(!dfn[y=to[i]]) dfs(y),low[x]=min(low[x],low[y]);else if(in[y]) low[x]=min(low[x],dfn[y]);
    if(low[x]==dfn[x]){++nm;while(tp){sc[st[tp]]=nm;in[st[tp]]=0;if(st[tp--]==x) break;}}
}
int chk(int d)
{
	memset(id,0,sizeof(id));tot=2*n;memset(he,-1,sizeof(he));cnt=0;I=tp=nm=0;
	memset(dfn,0,sizeof(dfn));memset(low,0,sizeof(low));memset(sc,0,sizeof(sc));memset(in,0,sizeof(in));
	bud(1,1,m);
	for(int i=1;i<=n;i++) for(int j=0;j<2;j++)
	{
		upd(1,1,m,Pd(y[i][j]-d),x[i][j]-1,i+j*n),upd(1,1,m,x[i][j]+1,Pu(y[i][j]+d),i+j*n);
	}
	for(int i=1;i<=tot;i++) if(!dfn[i]) dfs(i);
	for(int i=1;i<=n;i++) if(sc[i]==sc[i+n]) return 0;return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&x[i][0],&x[i][1]),t[++m]=(nod){x[i][0],i},t[++m]=(nod){x[i][1],i+n};
	memcpy(y,x,sizeof(x));sort(t+1,t+m+1);t[m+1]=(nod){2147483647,2147483647};
	for(int i=1;i<=n;i++) for(int j=0;j<2;j++) x[i][j]=lower_bound(t+1,t+m+1,(nod){x[i][j],i+j*n})-t,s[x[i][j]].push_back(i+j*n);
	for(int l=0,r=1000000000,mid=(l+r)>>1;l<=r;mid=(l+r)>>1) if(chk(mid)) l=mid+1,g=mid;else r=mid-1;
	printf("%d\n",g);
}

Measured memory_bytes: 49752
fun main(args: Array<String>) {
    val (a, b) = readInputLine().split(" ")
    
    if ((a == "H" && b == "H") || (a == "D" && b == "D")) {
        println("H")
    } else {
        println("D")
    }
}

fun readInputLine(): String {
    return readLine()!!
}


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

int main(void)
{
  int a, c1, c2, c3;
  while(scanf("%d %d %d", &c1, &c2, &c3) != EOF) {
    a = 0;
    
    for(int i = 1 ; i <= 10 ; i++) {
      if( (c1 + c2 + i) <= 20 && c1 != i && c2 != i && c3 != i) a++;
    }
    if(a >= 4) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

Measured memory_bytes: 0
#include<stdio.h>
int main()
{
    int N,A,i;
    scanf("%d",&N);
    scanf("%d",&A);
    i = N%500;
    if(i == 0)
    {
        printf("Yes\n");
    }
    else if(i <= A)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int m=1e9+7;
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    fastio
    char c;
    int i=0,flag=1;
    while(cin>>c){
        ++i;
        if((i&1 && c=='L') || ((i&1)==0 && c=='R')){
            //cout<<i;
            flag=0;
            break;
        }
    }
    if(flag) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 205;

int n;
char s[MAXN][MAXN];
int comp[MAXN];
int ans = -1;

int main() { 

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

  for (int i = 0; i < n; i++) {
    vector<int> cur = {i};
    vector<int> next;
    bool ok = true;
    memset(comp, -1, sizeof(comp));
    comp[i] = 0;
    int curComp = 0;
    while (sz(cur)) {
      // for (int v : cur) {
      //   cerr << v << " ";
      // }
      // cerr << endl;
      set<int> pot;
      for (int v : cur) {
        for (int j = 0; j < n; j++) {
          if (s[v][j] == '0' || (curComp > 0 && comp[j] == curComp - 1)) {
            continue;
          }
          if (comp[j] != -1) {
            ok = false;
            break;
          }
          pot.insert(j);
        }
      }
      bool wentPrev = false;
      for (int v : pot) {
        bool toPrev = curComp > 0;
        for (int j = 0; j < n; j++) {
          if (s[v][j] == '0') {
            continue;
          }
          if (comp[j] == -1 || comp[j] != curComp) {
            toPrev = false;
          }
        }
        // cerr << v << " " << toPrev << endl;
        if (!toPrev) {
          next.push_back(v);
          comp[v] = curComp + 1;
        } else {
          wentPrev = true;
          comp[v] = curComp - 1;
        }
      }
      cur = next;
      for (int j = 0; j < sz(cur); j++) {
        for (int k = j + 1; k < sz(cur); k++) {
          if (s[cur[j]][cur[k]] == '1') {
            ok = false;
            break;
          }
        }
      }
      if (!ok) {
        break;
      }
      next.clear();
      curComp++;
      if (sz(cur) == 0 && wentPrev) {
        curComp++;
      }
    }
    // cerr << endl;
    for (int j = 0; j < n; j++) {
      if (comp[j] == -1) {
        ok = false;
      }
      // cerr << comp[j] << " ";
      for (int k = 0; k < n; k++) {
        if (s[j][k] == '1' && abs(comp[j] - comp[k]) != 1) {
          ok = false;
        }
      }
    }
    // cerr << endl;
    if (ok) {
      ans = max(ans, curComp);
      // cerr << "CC " << i << " " << curComp << endl;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
using namespace std;
char a[8][8];
int w=0;
	int h=0;
int se(int p, int q,int r){
	if (p==w-1&&q==h-1){
		return 0;
	}
	else{
		if (a[p + 1][q] == '#'){
			return se(p + 1, q, r + 1);
		}
		else if (a[p][q + 1] == '#'){
			return se(p, q + 1, r + 1);
		}
		else return 1;
	}
}
int main(void){

	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++)a[i][j] = 0;
	}
	int n=0;
	
	int x = 0;
	int c = 0;
	scanf("%d %d", &w,&h);
	for (int i = 0; i < w; i++){
      scanf("%s", a[i]);
	}
	for (int i = 0; i < w; i++){
		for (int j = 0; j < h; j++){
			if (a[i][j] == '#') c++;
		}
	}
	if (c == w + h - 1){
		x = se(0, 0, 0);
	}
	else x = 1;
	if (x == 0)printf("Possible\n");
	else printf("Impossible\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <queue>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
void SomeSums() {
	int N, A, B;
	cin >> N >> A >> B;
	int res = 0;
	for (size_t i = 0; i <= N; i++)
	{
		int sum = 0;
		int ti = i;
		while (ti > 0)
		{
			sum += ti % 10;
			ti /= 10;
		}
		if (A <= sum && sum <= B) res += i;
	}
	cout << res << endl;
}
int main() {
	SomeSums();
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    if (s[0] == 'o') { cnt++; }
    if (s[1] == 'o') { cnt++; }
    if (s[2] == 'o') { cnt++; }
    cout << 700 + cnt * 100 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//!============================================!//
//!    8888ba.88ba             oo              !//
//!    88  '8b  '8b                            !//
//!    88   88   88  .d8888b.  dP  88d888b.    !//
//!    88   88   88  88'  '88  88  88'  '88    !//
//!    88   88   88  88.  .88  88  88    88    !//
//!    dP   dP   dP  '88888P8  dP  dP    dP    !//
//!============================================!//
int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<std::vector<int>> g(N);
    int E = 0;
    for (int i = 0; i < N - 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (i & (1 << j)) {
                g[j].push_back(i + 8);
                E++;
            }
        }
    }
    std::cout << E << std::endl;
    for (int i = 0; i < std::min(N, 8); i++) {
        for (const int to : g[i]) {
            std::cout << i + 1 << " " << to + 1 << std::endl;
        }
    }
    for (int k = 0; k < K; k++) {
        auto ask = [](const int p) {
            std::cout << p << std::endl;
            std::string ans;
            std::cin >> ans;
            return ans;
        };
        std::vector<bool> n(8, false);
        bool ok = false;
        for (int i = 0; i < 8; i++) {
            const auto ans = ask(i + 1);
            if (ans == "Yes") {
                ok = true;
                break;
            }
            if (ans == "Near") { n[i] = true; }
        }
        if (not ok) {
            int pos = 0;
            for (int i = 0, d = 1; i < 8; i++, d *= 2) { pos += d * n[i]; }
            const auto ans = ask(pos + 9);
            assert(ans == "Yes");
        }
    }
    return 0;
}



Measured memory_bytes: 3308
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 1000


int main() {
	long long n;
	long long m[15][10][10];
	long long dp[12][4096][10];
	long long lo[7];
	long long hi[7];
	long long p2[15];
	long long x, y, z, s, ans;
	p2[0] = 1;
	f(i, 14)p2[i + 1] = p2[i] * 2;
	while(true) {
		ans = 0;
		scanf("%lld", &n);
		if (n == 0)return 0;
		f(i, n)scanf("%lld %lld", &lo[i], &hi[i]);
		f(i, 15) {
			f(ii, 10) {
				f(jj, 10)m[i][ii][jj] = 0;
			}
		}
		f(i, (2 * n) - 1) {
			f(ii, 10) {
				f(jj, 10) {
					if (i % 2 == 0) {
						if (ii == 0)m[i][ii][jj] = 0;
						else {
							x = 10 * ii + jj;
							y = i / 2;
							if ((lo[y] <= x) && (x <= hi[y]))m[i][ii][jj] = p2[i + 1];
							else m[i][ii][jj] = 0;
						}
					}
					else {
						m[i][ii][jj] = 0;
						if (jj != 0) {
						x = jj;
						y = (i + 1) / 2;
						if ((lo[y] <= x) && (x <= hi[y]))m[i][ii][jj] += p2[i + 2];
						x = 10 * jj;
						if ((lo[y] <= (x + 9)) && (x <= hi[y]))m[i][ii][jj] += p2[i + 1];
						}
					}
				}
			}
		}
		f(i, 12) {
			f(j, 4096) {
				f(ii, 10)dp[i][j][ii] = 0;
			}
		}
		for (long long i = 1; i <= 9; i++) {
			z = 0;
			x = i;
			if ((lo[0] <= x) && (x <= hi[0]))z += 2;
			x = 10 * i;
			if ((lo[0] <= (x + 9)) && (x <= hi[0]))z += 1;
			if (z > 0)dp[0][z][i] = 1;
		}
		f(i, 2 * n) {
			f(j, p2[(2 * n)]) {
				f(ii, 10) {
					if (dp[i][j][ii] > 0) {
						f(jj, 10) {
							x = j;
							y = 0;
							f(iii, 2 * n) {
								if (x % 2 == 1) {
									if (iii == ((2 * n) - 1)){
                                     if(jj==0) ans += dp[i][j][ii];
                                    }
									else {
										y = (y | m[iii][ii][jj]);
									}
								}
								x /= 2;
							}
							if (y > 0)dp[i + 1][y][jj] += dp[i][j][ii];
						}
					}
				}
			}
		}
		printf("%lld\n", ans);
	}


	return 0;
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int main()
{
    KAKA
    string s,t;
    cin>>s>>t;
    if(t.length() == (s.length() + 1))
    {
        bool flag = true;
        pragi(0,s.length())
        {
          if(t[i] != s[i])
          {
              flag = false;
              break;
          }
        }
        if(flag) cout<<"Yes"<<"\n";
        else cout<<"No"<<"\n";
    }
    else cout<<"No"<<"\n";
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

ll mod_pow(ll x, ll n) {
	ll ret = 1;
	while (n > 0) {
		if (n % 2)ret = ret * x%mod;
		x = x * x%mod; n >>= 1;
	}
	return ret;
}
struct perm {
private:
	int sz;
	vector<ll> p, invp;
public:
	perm(int n) {
		sz = n + 1;
		p.resize(sz), invp.resize(sz);
		p[0] = 1;
		rep1(i, sz - 1) {
			p[i] = p[i - 1] * i%mod;
		}
		invp[sz - 1] = 1;
		ll cop = mod - 2, x = p[sz - 1];
		while (cop) {
			if (cop % 2)invp[sz - 1] = invp[sz - 1] * x%mod;
			cop >>= 1; x = x * x % mod;
		}
		per(i, sz - 1) {
			invp[i] = invp[i + 1] * (i + 1) % mod;
		}
	}
	ll comb(ll x, ll y) {
		if (x < y || y < 0)return 0;
		ll ret = p[x];
		(ret *= invp[y]) %= mod;
		(ret *= invp[x - y]) %= mod;
		return ret;
	}
	ll combP(ll x, ll y) {
		if (x < y || y < 0)return 0;
		return p[x] * invp[x - y] % mod;
	}
};
perm pm(1 << 20);

void solve() {
	ll x, y; cin >> x >> y;
	ll s = x + y;
	if (s % 3) {
		cout << 0 << endl; return;
	}
	s /= 3;
	int dif = abs(x - y);
	dif += s;
	if (dif % 2) {
		cout << 0 << endl; return;
	}
	dif /= 2;
	cout << pm.comb(s, dif) << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	solve();
	stop
	return 0;
}

Measured memory_bytes: 16640
#include <stdio.h>

int main(void)
  
{
  int a[] = {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 d;
  
  scanf("%d",&d);
  
  int K;
  
  K = d - 1;
  
  printf("%d\n",a[K]);
  
  return 0;

}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int n, k;
int p[100005], q[100005];
int P[100005], Q[100005];
int QpqP[100005], PqpQ[100005];
int beki1[100005], beki2[100005];
int ans[100005];

int tmp[100005], tmp2[100005];
void print(int p[])
{
	for(int i = 1; i <= n; i++) cout << p[i] << " "; cout << endl;
}
void inv(int p[], int dest[])
{
	for(int i = 1; i <= n; i++) dest[p[i]] = i;
}
void mul(int p[], int q[], int dest[])
{
	for(int i = 1; i <= n; i++) tmp[i] = q[p[i]];
	for(int i = 1; i <= n; i++) dest[i] = tmp[i];
}
void ident(int p[])
{
	for(int i = 1; i <= n; i++) p[i] = i;
}
void power(int p[], int k, int dest[])
{
	for(int i = 1; i <= n; i++) tmp2[i] = p[i];
	ident(dest);
	for(;k;k/=2){
		if(k%2) mul(dest, tmp2, dest);
		mul(tmp2, tmp2, tmp2);
	}
}


int main(void)
{
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> p[i];
	for(int i = 1; i <= n; i++) cin >> q[i];
	inv(p, P), inv(q, Q);
	
	if(k == 1){
		print(p);
		return 0;
	}
	if(k == 2){
		print(q);
		return 0;
	}
	k -= 3;
	
	ident(QpqP);
	mul(QpqP, Q, QpqP);
	mul(QpqP, p, QpqP);
	mul(QpqP, q, QpqP);
	mul(QpqP, P, QpqP);
	
	ident(PqpQ);
	mul(PqpQ, P, PqpQ);
	mul(PqpQ, q, PqpQ);
	mul(PqpQ, p, PqpQ);
	mul(PqpQ, Q, PqpQ);
	
	power(QpqP, k/6, QpqP);
	power(PqpQ, k/6, PqpQ);
	
	ident(ans);
	mul(ans, QpqP, ans);
	
	if(k%6 == 1) mul(ans, Q, ans);
	if(k%6 == 2){
		mul(ans, Q, ans);
		mul(ans, p, ans);
		mul(ans, Q, ans);
	}
	if(k%6 == 3){
		mul(ans, Q, ans);
		mul(ans, p, ans);
		mul(ans, p, ans);
		mul(ans, Q, ans);
	}
	if(k%6 == 4){
		mul(ans, Q, ans);
		mul(ans, p, ans);
		mul(ans, q, ans);
		mul(ans, p, ans);
		mul(ans, Q, ans);
	}
	if(k%6 == 5){
		mul(ans, Q, ans);
		mul(ans, p, ans);
		mul(ans, q, ans);
		mul(ans, P, ans);
		mul(ans, q, ans);
		mul(ans, p, ans);
		mul(ans, Q, ans);
	}
	
	mul(ans, PqpQ, ans);
	mul(ans, P, ans);
	mul(ans, q, ans);
	print(ans);
	
	return 0;
}

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

int main()
{
  int64_t N, a, b, turn = 0, tak = 0, aok = 0;
  cin >> N;
  vector<bool> Used(N, false);
  priority_queue<tuple<int64_t, int64_t, int64_t>> A, B;
  for (int i = 0; i < N; i++)
  {
    cin >> a >> b;
    A.push(make_tuple(a + b, a, i));
    B.push(make_tuple(a + b, b, i));
  }
  int64_t x, y, idx;
  while (turn < N)
  {
    if (turn % 2 == 0)
    {
      while (Used.at(get<2>(A.top())))
        A.pop();
      tie(x, y, idx) = A.top();
      A.pop();
      Used.at(idx) = true;
      tak += y;
    }
    else
    {
      while (Used.at(get<2>(B.top())))
        B.pop();
      tie(x, y, idx) = B.top();
      B.pop();
      Used.at(idx) = true;
      aok += y;
    }
    turn++;
  }
  cout << tak - aok << endl;
}


Measured memory_bytes: 6312
import java.util.Scanner;

public class Main {
	static final int replace = 1094496948;
	static final int reverse = 1099846370;
	static final int print = 106934957;
	void run(){
		Scanner s = new Scanner(System.in);
		String txt = s.next();
		int num = s.nextInt();
		for(int i = 0;i < num; i++){
			String pro = s.next();
			int sIndex = s.nextInt();
			int eIndex = s.nextInt();
			switch(pro.hashCode()){
				case replace:
					String rTxt = s.next();
					txt = replace(txt,sIndex,eIndex,rTxt);
					break;
				case reverse:
					txt = reverse(txt,sIndex,eIndex);
					break;
				case print:
					print(txt,sIndex,eIndex);
					break;

			}
		}
	}

	String replace(String txt,int sIndex,int eIndex,String rTxt){
		StringBuilder tmp = new StringBuilder(txt);
		tmp = tmp.replace(sIndex, eIndex+1, rTxt);
		return tmp.toString();
	}

	String reverse(String txt,int sIndex,int eIndex){
		StringBuilder tmp = new StringBuilder(txt.substring(sIndex,eIndex + 1));
		tmp = tmp.reverse();
		tmp = new StringBuilder(txt).replace(sIndex,eIndex + 1,tmp.toString());
		txt = tmp.toString();
		return txt;
	}

	void print(String txt,int sIndex,int eIndex){
		System.out.println(txt.substring(sIndex,eIndex + 1));
	}
	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 29424
import Control.Applicative
import Control.Monad
import Data.ByteString.Lazy.Char8 (ByteString)
import qualified Data.ByteString.Lazy.Char8 as B

main :: IO ()
main = solve <$> f >>= mapM_ B.putStrLn
  where
    f = B.lines <$> B.getContents

solve :: [ByteString] -> [ByteString]
solve = filter f
  where
    f bs = all isNeighbor $ B.zip bs (B.tail bs)

isNeighbor :: (Char, Char) -> Bool
isNeighbor ('A', 'B') = True
isNeighbor ('A', 'D') = True
isNeighbor ('B', 'A') = True
isNeighbor ('B', 'E') = True
isNeighbor ('B', 'C') = True
isNeighbor ('C', 'B') = True
isNeighbor ('C', 'F') = True
isNeighbor ('D', 'A') = True
isNeighbor ('D', 'E') = True
isNeighbor ('D', 'G') = True
isNeighbor ('E', 'B') = True
isNeighbor ('E', 'D') = True
isNeighbor ('E', 'F') = True
isNeighbor ('E', 'H') = True
isNeighbor ('F', 'C') = True
isNeighbor ('F', 'E') = True
isNeighbor ('F', 'I') = True
isNeighbor ('G', 'D') = True
isNeighbor ('G', 'H') = True
isNeighbor ('H', 'G') = True
isNeighbor ('H', 'E') = True
isNeighbor ('H', 'I') = True
isNeighbor ('I', 'F') = True
isNeighbor ('I', 'H') = True
isNeighbor _ = False



Measured memory_bytes: 4012
#include<stdio.h>

int main(){
  int i,n,m,p,c[100005]={0},r;
  char s[8];
  scanf("%d%d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d%s",&p,s);
    if(c[p]>0){continue;}
    if(s[0]=='A'){
      c[p]*=-1;
      c[p]++;
    }
    else{
      c[p]--;
    }
  }
  r=0;p=0;
  for(i=1;i<=n;i++){
    if(c[i]>0){
      p++;
      r+=c[i];
    }
  }
  printf("%d %d\n",p,r-p);
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
 
using namespace std;
 
int main(){
 int N,i,j,k;
 long long a[5];
 cin >> N;
 string s;
 for (i=0;i<5;i++) {
  a[i]=0;
 }
 for (i=0;i<N;i++) {
  cin >> s;
  if (s.substr(0,1)=="M") {
   a[0]+=1;
  } else if (s.substr(0,1)=="A") {
   a[1]+=1;
  } else if (s.substr(0,1)=="R") {
   a[2]+=1;
  } else if (s.substr(0,1)=="C") {
   a[3]+=1;
  } else if (s.substr(0,1)=="H") {
   a[4]+=1;
  }
 }
 
 long long n=0;
 for (i=0;i<3;i++) {
  for (j=i+1;j<4;j++) {
   for (k=j+1;k<5;k++) {
    n+=a[i]*a[j]*a[k];
   }
  }
 }
 cout << n;
 return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int r, d, x;

int main()
{
	cin >> r >> d >> x;
	for ( int i = 1; i <= 10; i ++ ){
		x = x * r - d;
		cout << x << endl;
	}
}


Measured memory_bytes: 256
/*
 * Author: madlogic
 * It's better to do something than nothing
*/
#include <bits/stdc++.h>
using namespace std;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define int long long
const int INF = 1000000000;
const int MOD = 1000000007;
const double PI = 2*acos(0.0);
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int x,y;
	cin>>x>>y;
	int res = 0;
	while(x<=y)
		++res,x*=2;
	cout<<res<<endl;
	return 0;	
}

Measured memory_bytes: 256
n = int(input())
w = list(map(int, input().split()))

minimum = float('inf')
for i in range(1, n):
  m = sum(w[:i]) - sum(w[i:])
  if m == 0:
    print(m)
    exit()
  if m < 0:
    m = m * -1
  if m < minimum:
    minimum = m
print(minimum)

Measured memory_bytes: 3060
H, W = map(int, input().split())
grid = [list(input()) for i in range(H)]

grid2 = [[0]*W for i in range(H)]
grid3 = [[0]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        if grid[i][j] == "#":
            grid2[i][j] = 0
        else:
            if j > 0:
                grid2[i][j] = grid2[i][j-1]+1
            else:
                grid2[i][j] = 1
    for j in reversed(range(W)):
        if grid2[i][j] != 0 and j != W-1:
            grid2[i][j] = max(grid2[i][j], grid2[i][j+1])

for j in range(W):
    for i in range(H):
        if grid[i][j] == "#":
            grid3[i][j] = 0
        else:
            if i > 0:
                grid3[i][j] = grid3[i-1][j]+1
            else:
                grid3[i][j] = 1
    for i in reversed(range(H)):
        if grid3[i][j] != 0 and i != H-1:
            grid3[i][j] = max(grid3[i][j], grid3[i+1][j])
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, grid2[i][j] + grid3[i][j] - 1)

print(ans)



Measured memory_bytes: 247432
#include <iostream>
#include <string>
#include <vector>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

int main()
{
  int r,g,b;
  cin >> r >> g >> b;

  int n = r * 100 + g * 10 + b;
  string ans = (n % 4 == 0) ? "YES" : "NO";
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int N = 3005;
const int mod = 998244353;
inline int add(int u, int v) {
  return u + v >= mod ? u + v - mod : u + v;
}
inline int sub(int u, int v) {
  return u >= v ? u - v : u - v + mod;
}
inline int mul(ll u, int v) {
  return u * v % mod;
}

int ways[N][N];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int a, b, c, d; cin >> a >> b >> c >> d;

  ways[a][b] = 1;
  for (int x = a + 1; x <= c; x++) {
    ways[x][b] = mul(ways[x - 1][b], b);
  }
  for (int y = b + 1; y <= d; y++) {
    ways[a][y] = mul(ways[a][y - 1], a);
  }

  for (int x = a + 1; x <= c; x++) {
    for (int y = b + 1; y <= d; y++) {
      ways[x][y] = add(
        mul(ways[x - 1][y], y),
        mul(ways[x][y - 1], x));
      ways[x][y] = sub(
        ways[x][y],
        mul(ways[x - 1][y - 1], mul(x - 1, y - 1)));
    }
  }

  cout << ways[c][d] << '\n';
  return 0;
}


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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

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

  int ans = t.size();
  rep(i, s.size() - t.size() + 1) {
    int now = 0;
    rep(j, t.size()) {
      if (s[i + j] != t[j]) ++now;
    }
    ans = min(ans, now);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

ll choose2(ll n){
    return n * (n - 1) / 2;
}

int main(){
    ll N;
    cin >> N;
    VL A(N);
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) A[i]--;

    VL cnt(N);
    rep(i, 0, N) cnt[A[i]]++;

    ll total = 0;
    rep(i, 0, N) total += choose2(cnt[i]);

    rep(k, 0, N){
        ll ans = total;
        ans -= choose2(cnt[A[k]]);
        ans += choose2(cnt[A[k]]- 1);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 5760
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

struct data{
  int id;
  int a;
  data(int i,int as):id(i),a(as){}
  bool operator>(const data& another)const{
    return a>another.a;
  }
  bool operator<(const data& another)const{
    return a<another.a;
  }
};

int main(void){
  cout << std::fixed << std::setprecision(16);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  std::vector<data> student;
  for(int i=1;i<=n;i++){
    int a;
    cin>>a;
    student.push_back(data(i,a));
  }
  std::sort(student.begin(), student.end());
  for(int i=0;i<n-1;i++){
    cout<<student[i].id<<" ";
  }
  cout<<student.back().id<<endl;




  return 0;
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct { template <typename T> operator T() { T x; cin >> x; return x; } } IN;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N=IN,K=IN;
    vector<int> A(N),B(N);
    REP(i,N) A[i]=IN,B[i]=IN;

    int ans=0;
    REP(i,N) {
        if((K|A[i])<=K) ans+=B[i];
    }
    REPR(i,31) {
        if(!((K>>i)&1)) continue;
        int L=K^(1<<i);
        REP(j,i) if(!((L>>j)&1)) L^=1<<j;
        int tmp=0;
        REP(j,N) {
            if((L|A[j])<=L) tmp+=B[j];
        }
        chmax(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B; cin >> A >> B;
    int ans = 0;
    int cnt = 1;
    while(cnt < B)
    {
        cnt--;
        ans++;
        cnt += A;
        if(cnt >= B) break;
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
ll a[100010], b[100010], c[100010];

int main()
{
    ll n;
    scanf("%lld", &n);
    for(ll i = 0; i < n; i++)
        scanf("%lld", &a[i]);
    for(ll i = 0; i < n; i++)
        scanf("%lld", &b[i]);
    for(ll i = 0; i < n; i++)
        scanf("%lld", &c[i]);
    sort(a, a+n);
    sort(c, c+n);
    a[n] = c[n] = INT_MAX;
    long long sum = 0;
    for(ll i = 0; i < n; i++)
    {
        ll d = lower_bound(a, a + n, b[i]) - a;
        ll e = upper_bound(c, c + n, b[i]) - c;
        sum += (n - e) * d;
        //printf("-----%d %d\n", n - e, d - 1);
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 2560
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<ll(n); i++)

int main(){
    int N, R;
    cin >> N >> R;
    int ans;
    if(N >= 10){ans = R;}
    else{ans = R + (100 * (10 - N));}
    cout << ans << endl;
    return 0;
}


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

//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}

int main() {
  ll x;
  cin >> x;

  for(ll i = x; i < x*x; i++) {
    if(primeNumber(i)) {
      cout << i;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int n,a[10000],i,count=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<n-1;i++)
    {
        if(((a[i]-a[i-1])*(a[i]-a[i+1])<0)) {
            count++;
        }
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int n;
	cin>>n;
	int a=power(10,n)%mod;
	int b=power(9,n)%mod;
	int c=power(8,n)%mod;
	int ans=(((a-b-b+c)%mod)+mod)%mod;
	cout<<ans;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



Measured memory_bytes: 3628
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"

int main(int argc, char const *argv[]) {

  std::string S, T;
  std::cin >> S >> T;

  // std::cout << S << "\n" << T << '\n';
  // std::cout << S.size() << '\n';

  int s_size = S.size();

  int char_count=0;
  int used_flag[s_size];
  for (size_t i = 0; i < s_size; i++) {
    used_flag[i] = 0;
  }

  int escape = 0;

  if (S.size() != T.size()) {
    escape = 1;
  }

  while (char_count < s_size) {

    int use_num = 0;

    for (size_t i = 0; i < s_size; i++) {
      if (used_flag[i] == 0) {
        use_num = i;
        used_flag[i] = 1;
        char_count++;
        break;
      }
    }

    for (size_t i = 0; i < s_size; i++) {
      if(used_flag[i] == 0){
        if (S[i] == S[use_num] || T[i] == T[use_num]) {
          if (S[i] == S[use_num] && T[i] == T[use_num]) {
            used_flag[i] = 1;
            char_count++;
          }else{
            // std::cout << "No" << '\n';
            escape = 1;
            // break;
            char_count = s_size;
          }
        }
      }
    }

    // if (escape == 1) {
    //   break;
    // }


  }

  if (escape == 1) {
    std::cout << "No" << '\n';
  }else{
    std::cout << "Yes" << '\n';
  }


  return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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 (a > b) { a = b; return true; } return false; }

struct UnionFind{
    vector<int> par; // par[i]:iの親の番号
    vector<int> s; // s[i]:iの属する木のノード数
    int n_group; // 木の数
    
    UnionFind(int N) : par(N) {
        for(int i=0; i<N; i++) par[i] = i;
        s.assign(N, 1);
        n_group = N;
    }
    
    int root(int x){ // xが属する木の根
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y){ // xとyの木を併合
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par[rx] = ry;
        s[ry] += s[rx];
        s[rx] = 0;
        n_group--;
    }
    
    bool same(int x, int y){ // xとyが同じ木に属するかどうか
        return root(x) == root(y);
    }

    int size(int x){ // xが属する木のノード数
        return s[root(x)];
    }
};

int main(void){
    int n,q; cin >> n >> q;
    UnionFind uf(n);
    REP(i,q){
        int c,x,y; cin >> c >> x >> y;
        if(c == 0){
            uf.unite(x,y);
        }
        else{
            if(uf.same(x,y)) cout << 1 << en;
            else cout << 0 << en;
        }
    }
    return 0;
}


Measured memory_bytes: 3212
using System;
using System.Collections.Generic;
using System.Linq;
class c{
  public static void Main(){
    long n = long.Parse(Console.ReadLine());
    String ans = "";
    while(n > 0){
      long a = n%26;
      if(a == 0) a = 26;
      ans = (char)('a'+a-1) + ans;
      n /= 26;
      if(a == 26) n--;
      //Console.WriteLine(n);
    }
    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 17640
N = int(input())
X = []
for _ in range(N):
    x, y = map(int, input().split())
    s = 1 if x < 0 else 0
    r = y/(x+10**-100)
    X.append((s, r, x, y))

X = sorted(X) * 2
ma = 0
for i in range(N):
    sx, sy = 0, 0
    for j in range(i, i + N):
        sx += X[j][2]
        sy += X[j][3]
        d = sx ** 2 + sy ** 2
        ma = max(ma, d)

print(ma**0.5)

Measured memory_bytes: 3188
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math

l = []
for _ in range(4):
  l.append(int(input()))

a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )

sum, cnt = [0] * 2  
for i in range(a_c + 1):
  sum = x - 500 * i
  if sum == 0:
    cnt += 1
  if sum <= 0:
    break
  for j in range(b_c + 1):
    sum = x - 500 * i - 100 * j
    if sum == 0:
      cnt += 1
    if sum <= 0:
      break
    for k in range(c_c + 1):
      sum = x - 500 * i - 100 * j - 50 * k
      if sum == 0:
        cnt += 1
      if sum <= 0:
        break
print(cnt)

Measured memory_bytes: 3064