akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int d = Integer.parseInt(sc.next());
		
		int []c = new int [26];
		int [][]s = new int [d][26];
		
		for(int i = 0 ; i < 26 ;i++) {
			c[i] = Integer.parseInt(sc.next());
		}
		
		for(int i = 0; i < d ;i++) {
			for(int j = 0 ; j < 26  ; j++) {
				s[i][j] = Integer.parseInt(sc.next());
			}
		}
		int []p = new int [d];
		
		for(int i = 0 ;i < d ;i++) {
			int max = 0;
			int id = 0;
			for(int j = 0 ; j < 26 ;j++) {
				if(max < s[i][j]) {
					max = s[i][j];
					id = j+1;
				}
			}
			p[i] = id;
		}
		
		for(int i = 0 ; i < d ; i++) {
			System.out.println(p[i]);
		}
	}

}


Measured memory_bytes: 42416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn =2e3+10;
const int inf = 0x3f3f3f3f;
ll n,x,y;
ll ans[maxn];
int dis[maxn];
queue<int> q;
void bfs() {
	while(!q.empty()) {
		int now=q.front();q.pop();
		ans[dis[now]]++;
		if(now==x) {
			if(dis[y]==-1) {
				dis[y]=dis[now]+1;
				q.push(y);
			}
		}
		if(now==y) {
			if(dis[x]==-1) {
				dis[x]=dis[now]+1;
				q.push(x);
			}
		}
		if(now-1>0) {
			if(dis[now-1]==-1) {
				dis[now-1]=dis[now]+1;
				q.push(now-1);
			}
		}
		if(now+1<=n) {
			if(dis[now+1]==-1) {
				dis[now+1]=dis[now]+1;
				q.push(now+1);
			}
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n>>x>>y;
	int num=min(x,n-y+1);
	rep(i,1,n) {
		memset(dis,-1,sizeof(dis));
		q.push(i);
		dis[i]=0;
		bfs();
	}	
	rep(i,1,n-1) {
		cout<<ans[i]/2<<'\n';
	}
	return 0;
}


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

int main()
{
	int A, B;
	cin >> A >> B;
	
	int D = A / B, R = A % B;
	double F = (double)A / B;
	
	cout << D << " " << R << " " << fixed << setprecision(6) << F << endl;

    return 0;
}



Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int n; cin >> n;
	string s; cin >> s;
	VI a(n); bool f=0;
	REP(i,n){
		a[i]=s[i]-'0';
		if(a[i]==2)
			f=1;
	}
	ll ans=0;
	if(f){
		REP(i,n){
			if(a[i]==2)
				ans+=(i==(i&n-1));
			ans%=2;
		}
		cout << ans << endl;
	}
	else{
		REP(i,n){
			if(a[i]==3)
				ans+=(i==(i&n-1));
			ans%=2;
		}
		cout << ans*2 << endl;
	}
	return 0;
}

Measured memory_bytes: 9220
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>

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

using namespace std;

int w, h;
int n;
int X1[1010], Y1[1010], X2[1010], Y2[1010];
bool fld[6000][6000];

void printv(vector<int> vi)
{
    rep(i,vi.size()) {
        cout << vi[i] << " ";
    }
    cout << endl;
}

int compress(int *x1, int *x2, int tw)
{
    vector<int> xs;

    for (int i=0; i<n; i++) {
        for (int d=-1; d<=1; d++) {
            int tx1 = x1[i] + d, tx2 = x2[i] + d;
            if (0 <= tx1 && tx1 < tw) xs.push_back(tx1);
            if (0 <= tx2 && tx2 < tw) xs.push_back(tx2);
        }
    }

    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());

    //printv(xs);

    for (int i=0; i<n; i++) {
        x1[i] = lower_bound(xs.begin(), xs.end(), x1[i]) - xs.begin();
        x2[i] = lower_bound(xs.begin(), xs.end(), x2[i]) - xs.begin();
    }

    return xs.size();
}

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

int main()
{
#ifdef LOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

while (true) {
    cin >> w >> h;
    if (w == 0 && h == 0) break;
    cin >> n;

    rep(i,n) {
        int x1, y1, x2, y2;
        cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
    }

    w = compress(X1, X2, w);
    h = compress(Y1, Y2, h);

    memset(fld, 0, sizeof(fld));
    rep(i,n) {
        for (int y=Y1[i]; y<Y2[i]; y++) {
            for (int x=X1[i]; x<X2[i]; x++) {
                fld[y][x] = true;
            }
        }
    }

    /*
    rep(i,h) {
        rep(j,w) {
            if (fld[i][j]) cout << "#";
            else cout << ".";
        }
        cout << endl;
    }
    */

    int ans = 0;
    rep(y,h) {
        rep(x,w) {
            if (fld[y][x]) continue;
            ans++;

            queue<pair<int, int> > que;
            que.push(make_pair(x, y));
            while (!que.empty()) {
                int sx = que.front().first, sy = que.front().second;
                que.pop();

                rep(i,4) {
                    int tx = sx + dx[i], ty = sy + dy[i];
                    if (tx < 0 || w <= tx || ty < 0 || h <= ty) continue;
                    if (fld[ty][tx]) continue;
                    que.push(make_pair(tx, ty));
                    fld[ty][tx] = true;
                }
            }
        }
    }

    cout << ans << endl;
}
}

Measured memory_bytes: 38240
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
int main() {
	int N;
	cin >> N;
	int a = 0;
	int b = 0;
	for (int i = 1; i < 10; i++) {
		for (int j = 1; j < 10; j++) {
			b = i * j;
			if (N == b) {
				a = 1;
			}
			else{
			}
		}
	}
	if (a == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
/*
                ____________    ______________       __
               / _________  /\ /_____   _____/\     / /\
              / /\       / /  \\    /  /\    \ \   / /  \
             / /  \_____/ /   / \__/  /  \____\/  / /   /
            / /   /    / /   /    /  /   /       / /   /
           / /   /    / /   /    /  /   /       / /   /
          / /   /    / /   /    /  /   /       / /   /
         / /___/____/ /   /    /  /   /       / /___/________
        /____________/   /    /__/   /       /______________/\
        \            \  /     \  \  /        \              \ \
         \____________\/       \__\/          \______________\/
           ___       ___               ___    __________
          /  /\     /  /\             /  /\  /_______  /\
         /  /__\___/  /  \           /  /  \ \      /  /  \
        /____    ____/   /          /  /   /  \____/  /   /
        \   /   /\   \  /          /  /   /       /  /   /
         \_/   /  \___\/ ___      /  /   /       /  /   /
          /   /   /     /  /\    /  /   /       /  /   /
         /   /   /     /  /__\__/  /   /       /  /___/____
        /___/   /     /___________/   /       /___________/\
        \   \  /      \           \  /        \           \ \
         \___\/        \___________\/          \___________\/
       
          A FAN OF FIZZYDAVID
           
*/

#include<bits/stdc++.h>

#define HEAP priority_queue
#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,n) for(int i=(n)-1;i>=0;i--)
#define forn(i,l,r) for(int i=(l);i<=(r);i++)
#define nrof(i,r,l) for(int i=(r);i>=(l);i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-20
#define pi 3.1415926535897932384626433832795
#define orz int
#define yjz main
#define fizzydavid return
#define ak 0
#define la ;
#define debug puts("OK");
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int iinf=1e9+7;
const LL linf=1ll<<60;
const flt dinf=1e10;

template <typename T>
inline void scf(T &x)
{
	bool f=0; x=0; char c=getchar();
	while((c<'0' || c>'9') && c!='-') c=getchar();
	if(c=='-') { f=1; c=getchar(); }
	while(c>='0' && c<='9') { x=x*10+c-'0'; c=getchar(); }
	if(f) x=-x; return;
}

template <typename T1,typename T2>
void scf(T1 &x,T2 &y) { scf(x); return scf(y); }

template <typename T1,typename T2,typename T3>
void scf(T1 &x,T2 &y,T3 &z) { scf(x); scf(y); return scf(z); }

//---------------------------head----------------------------

int n;
string s,t;

orz yjz()
{
	cin>>n>>s>>t;
	for(int i=n;i>=0;i--)
	{
		if(s.substr(n-i)==t.substr(0,i)){ cout<<2*n-i<<endl; fizzydavid ak la }
	}
	fizzydavid ak la
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String result = "";
        
        switch(N%10) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                result = "hon";
                break;

            case 0:
            case 1:
            case 6:
            case 8:
                result = "pon";
                break;

            case 3:
                result = "bon";
                break;
                
        }

        System.out.println(result);
    }
}

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

using namespace std;

pair<int, int> PersonData[200];


bool solve(int n) {
	int total;

	total = 0;
	for (int i = 0; i < n; ++i) {
		total += PersonData[i].second;
		if (total > 150) {
			return false;
		}
	}
	return true;
}

bool cmp(const pair<int, int>& p1, const pair<int, int>& p2) {
	if (p1.first == p2.first) {
		return p1.second < p2.second;
	}
	return p1.first < p2.first;
}

int main() {
	int n, weight, startTime, endTime;

	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> weight >> startTime >> endTime;
			PersonData[2 * i] = make_pair(startTime, weight);
			PersonData[2 * i + 1] = make_pair(endTime, -weight);
		}
		sort(PersonData, PersonData + 2 * n, cmp);

		if (solve(2*n)) {
			cout << "OK" << endl;
		}
		else {
			cout << "NG" << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;

const int MAX = 2000020;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int x,y;
    cin >> x >> y;

    bool flag = true;
    if ((x+y)%3!=0) flag = false;
    int wa = (x+y)/3;
    int sa = abs(x-y);
    int a = (wa+sa)/2;
    int b = (wa-sa)/2;
    if (a<0 || b<0) flag = false;
    // 前処理
    COMinit();

    if (flag)
    {
        cout << COM(wa, b) << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    // 計算例
}







Measured memory_bytes: 47104
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		String s=stdIn.next();
		int z=0;
		int zero=0,one=0;
		while(z<s.length()){
			if(s.substring(z, z+1).equals("1"))
				one++;
			else
				zero++;
			z++;
		}
		if(one>=zero)
			System.out.println(zero*2);
		else
			System.out.println(one*2);
	}

}

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

const int maxn = (int) 2e5 + 20;

#define LL long long

void work()
{
    int n, k;
    cin >>n >>k;
    if(k == 1) cout <<0 <<endl;
    else cout <<n - k <<endl;
}

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
#endif // yukihana0416
    work();
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto ad = readln.split.to!(int[]);
    auto A = ad[0];
    auto B = ad[1];
    auto C = ad[2];
    auto D = ad[3];
    for (;;) {
        C -= B;
        if (C <= 0) {
            writeln("Yes");
            return;
        }
        A -= D;
        if (A <= 0) {
            writeln("No");
            return;
        }
    }
}

Measured memory_bytes: 2752
n,m,c=map(int,input().split())
b_l=list(map(int,input().split()))

cnt=0
for i in range(n):
            a_l_i = list(map(int,input().split()))
            c_l = 0
            for j in range(m):
                        c_l += a_l_i[j] * b_l[j]
            last_ = c_l + c

            if last_>0:
                        cnt+=1
print(cnt)                        
                        




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

int main(){
int n;
  cin >> n;
string s;
  cin >> s;
vector<int> e(n);  
vector<int> w(n);
for(int i=0;i<n;i++){
if(s[i]=='E')e[i]=1;
if(s[i]=='W')w[i]=1;  
}
int ans=1000000;
vector<int> sume(n+1,0);  
vector<int> sumw(n+1,0); 
for(int i=0;i<n;i++)sume[i+1]=sume[i]+e[i];
for(int i=0;i<n;i++)sumw[i+1]=sumw[i]+w[i]; 
for(int i=0;i<n;i++){
int k=sumw[i]+sume[n]-sume[i+1];
ans=min(k,ans);
}  
cout << ans << endl;  
}


Measured memory_bytes: 8236
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int A, B;
    cin >> A >> B;

    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6) {
        cout << B / 2 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

const int maxn = 105;
const int maxs = 1e5+5;

int A[maxn];
int dp[maxs];
int N,K;

int win(int k){
    //cout << k << endl;
    int &ans = dp[k];
    if(ans != -1) return ans;
    int w = 0;
    _for(i,0,N){
        int a = A[i];
        //cout << a << endl;
        if(k - a >= 0){
            w |= (!win(k - a));
        }
    }
    ans = w;
    return ans;
}

int main()
{
    MEM(dp,-1);
    cin >> N >> K;
    _for(i,0,N){
        cin >> A[i];
    }

    dp[0] = 0;

    if(win(K)){
        cout << "First" << endl;
    }else cout << "Second" << endl;


    //_for(i,0,10) cout << dp[i] << endl;

    return 0;
}


Measured memory_bytes: 5376
def run(N):
  '''
  a^x*b^y*c^yの約数の数が75となるのは(x,y,z)が以下の場合
  (74,0,0), (2,4,4), (24,2,0), (14,4,0)
  N!の素因数分解を行い、各素数のうち上記の取得方法の数を数える
  '''
  # N!を素因数分解
  primes = {1: 1}
  for i in range(2, N+1):
    tmp = i
    for j in range(2, N+1):
      while tmp%j == 0:
        if j in primes.keys():
          primes[j] += 1
        else:
          primes[j] = 1
        tmp /= j
  cnt = 0

  # (74,0,0)
  for i in primes.values():
    if i >= 74:
      cnt += 1

  # (2,4,4)
  cnt4 = 0
  cnt2 = 0
  for i in primes.values():
    if i >= 4:
      cnt4 += 1
    if i >= 2:
      cnt2 += 1
  if cnt4 >= 2:
    cnt += (cnt4*(cnt4-1)//2)*(cnt2-2)

  # (24,2,0)
  cnt24 = 0
  cnt2 = 0
  for i in primes.values():
    if i >= 24:
      cnt24 += 1
    if i >= 2:
      cnt2 += 1
  if cnt24 >= 1:
    cnt += cnt24*(cnt2-1)

  # (14,4,0)
  cnt14 = 0
  cnt4 = 0
  for i in primes.values():
    if i >= 14:
      cnt14 += 1
    if i >= 4:
      cnt4 += 1
  if cnt14 >= 1:
    cnt += cnt14*(cnt4-1)
  return cnt


def main():
    N = int(input())
    print(run(N))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
while True:
	eq=input().split()
	if eq[1]=="?":
		break
	elif eq[1]=="+":
		print(str(int(eq[0])+int(eq[2])))
	elif eq[1]=="-":
		print(str(int(eq[0])-int(eq[2])))
	elif eq[1]=="*":
		print(str(int(eq[0])*int(eq[2])))
	elif eq[1]=="/":
		print(str(int(int(eq[0])/int(eq[2]))))



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

struct Node{
  int key;
  Node *p, *l, *r;
};

int n;

Node *NIL, *root;

void preorder(Node *u){
  if(u == NIL) return;
  cout << ' ' << u->key;
  preorder(u->l);
  preorder(u->r);
}

void inorder(Node *u){
  if(u == NIL) return;
  inorder(u->l);
  cout << ' ' << u->key;
  inorder(u->r);
}

/*void Postorder(int u){
  if(u == -1) return;
  Postorder(T[u].l);
  Postorder(T[u].r);
  cout << ' ' << u;
}
*/

void insert(int k){
  Node *y = NIL;
  Node *x = root;

  Node *z;

  z = new Node[1];

  z->key = k;
  z->p = NIL;
  z->r = NIL;
  z->l = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->l;
    else x = x->r;
  }

  z->p = y;

  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key) y->l = z;
  else y->r = z;
}

void find(int k){
  Node *x = root;
  while(x != NIL){
    if(k == x->key) break;
    else if(k > x->key) x = x->r;
    else x = x->l;
  }

  if(x == NIL) cout << "no" << endl;
  else cout << "yes" << endl;
}

Node *getMinimum(Node *x){
  while(x->l != NIL){
    x = x->l;
  }
  return x;
}

Node *getsuccessor(Node *x){
  if(x->r != NIL) return getMinimum(x->r);

  Node *y = x->p;
  while(y != NIL && x == y->r){
    x = y;
    y = y->p;
  }
  return y;
}


void deletex(int k){
  Node *z = root;
  while(z->key != k){
    if(k > z->key) z = z->r;
    else z = z->l;
  }
  Node *y;

  if(z->l == NIL || z->r == NIL) y = z;
  else y = getsuccessor(z);

  Node *x;

  if(y->l != NIL) x = y->l;
  else x = y->r;

  if(x != NIL) x->p = y->p;

  if(y->p == NIL) root = x;
  else if(y == y->p->l) y->p->l = x;
  else y->p->r = x;

  if(y != z) z->key = y->key;
}





int main(){


  int x;

  string s;

  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> s;
    if(s ==  "insert"){
      cin >> x;
      insert(x);
    }

    else if(s == "find"){
      cin >> x;
      find(x);
    }

    else if(s == "delete"){
      cin >> x;
      deletex(x);
    }

    else{
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
  }


/*  for(int k = 0; k < n; k++){

    cin >> x;

    for(int i = 0; i < 2; i++){
      cin >> y;
      T[y].parent = x;
      if(i == 0){
      T[x].l = y;
      }
      else{
        T[x].r = y;
      }
    }
  }

/*
  cout << "Inorder" << endl;
  Inorder(r);
  cout << endl;


  cout << "Preorder" << endl;
  Preparse(r);
  cout << endl;


  cout << "Postorder" << endl;
  Postorder(r);
  cout << endl;
*/

  return 0;
}



Measured memory_bytes: 21920
#include<iostream>
#include<utility>

using namespace std;

int selectionSort(int *A, int n) {
	int count=0;
	for(int i=0; i<n; i++) {
		int minj = i;
		for(int j=i+1; j<n; j++) {
			if(A[j] < A[minj]) minj=j;
		}
		if(i!=minj) {
			swap(A[i], A[minj]);
			count++;
		}
	}
	return count;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, A[100];
	cin>>n;
	for(int i=0; i<n; i++) cin>>A[i];
	int count = selectionSort(A, n);
	cout<<A[0];
	for(int i=1; i<n; i++) cout<<' '<<A[i];
	cout<<'\n'<<count<<'\n';
	return 0;
}



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

int main(int argc, char const *argv[]) {
  int a,b,c;
  std::cin >> a>>b>>c;

  if (a!=b && a!=c && b!=c){
    cout << "3" << endl;
  }
  else if (a==b && b==c) {
    /* code */cout << "1" << endl;
  }  
  else{
    cout << "2" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
while 1:
	a, op, b = map(str, raw_input().split())
	a = int(a)
	b = int(b)
	if op == '?':
		break
	elif op == '+':
		print (a + b)
	elif op == '-':
		print (a - b)
	elif op == '*':
		print (a * b)
	elif op == '/':
		print (a / b)

Measured memory_bytes: 4204
#include <iostream>
#include <vector>
 
int main(){
	int a,b;
   
	while(std::cin >> a >> b){
		if(a == 0 && b == 0){ 
			break;
		}
		//問題文の形に合うように領域を確保する
		std::vector<std::vector<int>> map(a + 1);
		for(int i = 0 ; i <= a; ++i){
			map[i].resize(b + 1, 0);
		}
    
		int n;
		std::cin >> n;
		//工事中の場所は-1で表現する
		for(int i = 0; i < n; ++i){
			int x, y;
			std::cin >> x >> y;
			map[x][y] = -1;
		}
		//スタート地点を1にする
		map[1][1]= 1;      
 
		for(int x = 1; x <= a; ++x){
			for(int y = 1; y <= b; ++y){
				if(x == 1 && y == 1){
					continue;
				}
				if(map[x][y] == -1){
					map[x][y] = 0;
					continue;
				}
				map[x][y] = map[x - 1][y] + map[x][y - 1];
			}
		}
	
		std::cout << map[a][b] << std::endl;
	}
	
  return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;


int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int n,keymi=0,keyma=0, t, a[200050],mi=999999999999,ma=-1,micou=0,macou=0,sa=0,sacou=0,res=0;
	cin >> n >> t;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = n; i >=1; i--) {
		
		if (ma < a[i]) {
			ma = a[i];
			mi = a[i];
			res += min(keyma, keymi);
			keyma = 0;
			keymi = 0;
		}
		if (mi > a[i]) {
			mi = a[i];
		}
		if (sa < ma - a[i]) {
			res = 0;
			sa = ma - a[i];
		}
		if (ma == a[i]) {
			keyma++;
		}
		if (sa == ma-a[i]) {
			keymi++;
		}
		
	}
	cout << res+min(keyma,keymi) << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 2000000009
int n,b,a=1;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>b;
	while(n--){
		if (a<b) a*=2;
		else a+=b;
	}
	cout<<a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int main(){
    int N;
    cin >> N;
    int a[N-1], b[N-1];
    vector<int> edge[N+1];
    rep(i, N-1){
        cin >> a[i] >> b[i];
        edge[a[i]].push_back(b[i]);
        edge[b[i]].push_back(a[i]);
    }
    int K = 0;
    rep2(i, 1, N+1){
        if(edge[i].size() > K) K = edge[i].size();
    }
    map<P, int> mp;
    rep2(i, 1, N+1){
        int cnt = 1;
        set<int> s;
        int n = edge[i].size();
        rep(j, n){
            if(mp.count(P(i, edge[i][j]))) s.insert(mp[P(i, edge[i][j])]);
        }
        rep(j, n){
            if(!mp.count(P(i, edge[i][j]))){
                while(s.count(cnt)) cnt++;
                mp[P(i, edge[i][j])] = cnt;
                mp[P(edge[i][j], i)] = cnt;
                cnt++;
            }
        }
    }
    cout << K << endl;
    rep(i, N-1) cout << mp[P(a[i], b[i])] << endl;
}

Measured memory_bytes: 19328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

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

ll lcm(ll a, ll b){
    return a*b/gcd(a,b);
}

//aとbの最大公約数を返し、ax+by=gcd(a,b)を満たすようにx,yを変更する
ll extgcd(ll a, ll b, ll &x, ll &y){
    ll d = a;
    if(b == 0) x = 1, y = 0;
    else{
        d = extgcd(b, a%b, y, x);
        y -= (a/b)*x;
    }
    return d;
}

int main(){
    int T;
    cin >> T;
    rep(i, T){
        ll A, B, C, D;
        cin >> A >> B >> C >> D;
        if(A < B || B > D) {cout << "No" << endl; continue;}
        ll G = gcd(B, D);
        A %= B;
        if(A+((B-1-A)/G)*G > C) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

bool check(const char *ps, int len)
{
	int i, j;
	for (i= 0, j = len - 1; i <= j; i++, j--) {
		if (ps[i] != ps[j]) {
			return false;
		}
	}
	return true;
}

int main(void) {
	int A, B;
	cin >> A >> B;

	int cnt = 0;
	char sz[16];
	int len;
	for (int n = A; n <= B; n++) {
		sprintf(sz, "%d", n);
		len = strlen(sz);
		if (check(sz, len)) {
			++cnt;
		}	
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader in = new FastReader(System.in);
        StringBuilder sb = new StringBuilder();
        DecimalFormat df=new DecimalFormat("0.000000");
        double r=in.nextInt();
        double ans=2*r*Math.PI;
        System.out.println(df.format(ans));
    }
}
class FastReader {

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastReader(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }
    String nextLine() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c !=10 && c!=13; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }
    char nextChar() throws IOException{
        int c;
        for (c = scan(); c <= 32; c = scan());
        return (char)c;
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}


Measured memory_bytes: 35288
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    inf = 10 ** 10
    n = II()
    xy = [LI() for _ in range(n)]
    xy = [[x, y] if x < y else [y, x] for x, y in xy]
    xy.sort()
    yy=[y for x,y in xy]
    xmin=xy[0][0]
    xmax=xy[-1][0]
    ymax = max(yy)
    ymin = min(yy)
    ans=(xmax-xmin)*(ymax-ymin)
    d=ymax-xmin
    ymin = inf
    for i in range(n - 1):
        y = xy[i][1]
        if y < ymin: ymin = y
        xmin = min(xy[i + 1][0], ymin)
        xmax = max(xmax, y)
        ans = min(ans, (xmax - xmin) * d)
    print(ans)

main()


Measured memory_bytes: 66240
#include <iostream>
#include<algorithm>
#include<set>
#include<iterator>
#include<map>
#include<unordered_map>
#include<vector>
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define pb push_back
#define F first
#define S second

int32_t main() {
   
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    
    int ct = 0;
    for(int i=0;i<=a;++i)
        for(int j=0;j<=b;++j)
            for(int k=0;k<=c;++k)
                if(500*i+100*j+50*k==x)
                    ct++;
    
    cout<<ct;
    
	return 0;
}


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

int main() {
  int N, A;
  cin >> N;
  if (N % 1000 == 0) {
    cout << "0" << endl;
  }
  else {
    A = N % 1000;
    cout << 1000 - A << endl;
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define fi first
#define se second
#define MK make_pair
#define PB push_back
using namespace std;

typedef long long LL;
typedef pair<int ,int> PII;

inline int f(int i,int j){return __builtin_popcount(i|j)&1;}
int main(){
	#ifdef che
	freopen("input.txt","rt",stdin);
	freopen("output.txt","wt",stdout);
	#endif
	int n,m;scanf("%d%d", &n ,&m);
	for (int i=1;i<1<<n;++i, puts(""))
		for (int j=1; j<1<<m; ++j)putchar('0'+(f(i,j)^f(i-1,j)^f(i,j-1)^f(i-1,j-1)));
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N;
    cin >> N;
    //vector<int> R(N);
    int temp;

    int maxv = -1000000000;
    int minv = -1000000000;
    for(int i=0;i<N;++i){
        cin >> temp;
        if(i==0){
            minv = temp;
        } else{
            maxv = max(maxv, temp - minv);
            minv = min(minv, temp);
        }
    }
    cout << maxv << endl;

}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;

int main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> p(A), q(B), r(C);

    rep(i, A) cin >> p[i];
    rep(i, B) cin >> q[i];
    rep(i, C) cin >> r[i];

    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    sort(r.rbegin(), r.rend());

    rep(i, X) r.push_back(p[i]);
    rep(i, Y) r.push_back(q[i]);

    sort(r.rbegin(), r.rend());

    ll ans = 0;
    rep(i, X + Y) ans += r[i];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2552
#include<stdio.h>

int cnt = 0;

void insertionSort(int [],int, int);
void shellSort(int [],int);

int main()
{
  int n,i,A[1000000];

  scanf("%d",&n);

  for(i = 0;i < n;i++)
    scanf("%d",&A[i]);

  shellSort(A,n);

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

  for(i = 0;i < n;i++)
    printf("%d\n",A[i]);

  return 0;
}

void insertionSort(int A[],int n,int g)
{
  int i,j,v;

  for(i = g;i <= n - 1;i++)
    {
      v = A[i];
      j = i - g;
      while(j >= 0 && A[j] > v)
	{
	  A[j + g] = A[j];
	  j = j - g;
	  cnt++;
	}
      A[j + g] = v;
    }
}

void shellSort(int A[],int n)
{
  int i = 0,m = 0,G[n];
  
  cnt = 0;
  G[0] = 0;
  
  while(1)
    {
      if(n < 3 * G[m] + 1) break;
      G[m + 1] = 3 * G[m] + 1;
      m++;
    }

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

  for(i = m;i >= 1;i--)
    printf("%d ",G[i]);
  printf("\n");

  for(i = m;i > 0;i--)
    insertionSort(A,n,G[i]);
}
  
  



Measured memory_bytes: 5652
#include <iostream>
#include <algorithm>
int main() {
	int N, d[101], l = 0, ans = 0;
	std::cin >> N;
	for (int i = 0; i < N; i++)
		std::cin >> d[i];

	std::sort(d, d + N);

	for (int i = 0; i < N; i++)
		if (l != d[i]) {
			ans++;
			l = d[i];
		}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
using Pi = pair<int, int>;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;


int main() {
  int h, w; cin >> h >> w;

  set<Pi> S, T;
  rep(i, w) S.emplace(i, 0);
  rep(i, w) T.emplace(0, i);

  rep(k, h) {
    int a, b; cin >> a >> b;
    --a;

    auto l = S.lower_bound({a, -1});
    auto r = S.lower_bound({b, -1});

    int x = w;
    while (l != r) {
      auto [i, j] = *l;
      chmin(x, j-i+b);
      l = S.erase(l);
      T.erase({j, i});
    }

    if (x < w && b < w) S.emplace(b, x);
    if (x < w && b < w) T.emplace(x, b);

    int ans = -1;
    if (!T.empty()) ans = k+1 + T.begin()->first;
    cout << ans << '\n';
  }
}


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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	int ans = 0;
	for (int i = 0; i < n-1; i++) {
		if (a[i] == a[i+1]) {
			a[i+1] = i + 1000;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

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

int main(){
    ll A, B;
    cin >> A >> B;
    cout << A*B/gcd(A,B) << endl;
}

Measured memory_bytes: 256
def root(x):
    path_to_root = []
    while P[x] != x:
        path_to_root.append(x)
        x = P[x]
    for node in path_to_root:
        P[node] = x
    return x
def is_same_set(x,y):
    return root(x) == root(y)
def unite(x,y):
    P[root(x)] = root(y)
    
    

n= int(input())
a=[]
P=[i for i in range(n)]

for i in range(n):
    temp= list(map(int,input().split()))
    for j in range(i,n):
        if temp[j] != -1:
            a.append([temp[j], i, j])
a.sort()
ans=0
for i in a:
    if not(is_same_set(P[i[1]],P[i[2]])):
        unite(i[1],i[2])
        ans+= i[0]
print(ans)


Measured memory_bytes: 5992
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int c[55][26];
int a[26];

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

	memset(c, 0, sizeof(c));

	for (int i = 0;i < n;i++) {
		string s;
		cin >> s;

		for (int j = 0;j < s.size();j++) {
			c[i][s[j] - 'a']++;
		}
	}

	for (int j = 0;j < 26;j++) {
		a[j] = INF;
		for (int i = 0;i < n;i++) {
			a[j] = std::min(a[j], c[i][j]);
		}
	}

	for (int i = 0;i < 26;i++) {
		for (int j = 0;j < a[i];j++) cout << (char)(i + 'a');
	}
	cout << endl;

	return 0;
}



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

using namespace std;

using LL = long long;
using II = pair<int, int>;

int main()
{
  int N;
  int A, B;
  cin >> N;
  cin >> A >> B;

  int turn = 0;
  while(A != B-1) {
    if(turn == 0) {
      A++;
    } else {
      B--;
    }
    turn++; turn%=2;
  }

  if(turn == 0) {
    cout << "Borys" << endl;
  } else {
    cout << "Alice" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    ll x;
    cin >> n;
    cin >> x;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    // sort(a.begin(),a.end());
    rep(i,n){
        a[i] = abs(a[i] - x);
    }
    ll ans = a[0];
    rep(i,n){
        ans = __gcd(ans,a[i]);
    }
    cout  << ans << endl;

    return 0;
}

Measured memory_bytes: 4004
#include <bits/stdc++.h>
#define f first
#define s second
#define N 1001
#define INF (1e9)
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersect(L s1, L s2){
  return ( ccw(s1.f,s1.s,s2.f) * ccw(s1.f,s1.s,s2.s) <= 0 &&
           ccw(s2.f,s2.s,s1.f) * ccw(s2.f,s2.s,s1.s) <= 0 );
}

typedef pair<double,int> Pi;
double dijkstra(vector<P>A,vector<P>B){
  vector<double>D(N,INF);
  priority_queue<Pi,vector<Pi>,greater<Pi> >Q;
  Q.push(Pi(0,0));
  D[0]=0;
  while(!Q.empty()){
    Pi t=Q.top();Q.pop();
    int pos=t.s;
    double cost=t.f;
    if(D[pos]<cost)continue;
    if(pos==1)return cost+abs(A[0]-A[1]);    

    for(int i=0;i<B.size();i++){
      double ncost=cost+abs(B[pos]-B[i]);
      if(isIntersect(L(A[0],A[1]),L(B[pos],B[i]))||D[i]<=ncost)continue;
      D[i]=ncost;
      Q.push(Pi(ncost,i));
    }
  }
  return INF;
}

int main(){
  int n,m;
  cin>>n>>m;
  vector<P> A(n),B(m); 
  for(int i=0,x,y;i<n;i++)cin>>x>>y,A[i]=P(x,y);
  for(int i=0,x,y;i<m;i++)cin>>x>>y,B[i]=P(x,y);
  double ans=min(dijkstra(A,B),dijkstra(B,A));
  printf("%.10f\n",ans<INF? ans:-1);
  return 0;
}

Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
    int r,d,x;
    cin>>r>>d>>x;

    rep(i,10){
        x = x*r-d;
        cout<<x<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define Whitebeard ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
set<ll>st;
int main()
{
    Whitebeard;
char a;
cin>>a;
cout<<char(a+1);
    return 0;
}


Measured memory_bytes: 256
import collections
n = int(input())
s = []
ans = 0
for i in range(n):
    s_str = list(input())
    s_str.sort()
    u="".join(s_str)
    s+=[u]
c = collections.Counter(s)
for i in c.values():
    if i > 1:
        p=0
        for o in range(i):
            p += o
        ans+=p
print(ans)


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

const int maxn=2e5+5;
const int mod=1e9+7;
#define ll long long

int a[maxn],sum[maxn];

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

    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i],sum[i]=((ll)a[i]+sum[i-1])%mod;
    int ans=0;
    for(int i=2;i<=n;i++)
    {
        int res=((ll)a[i]*sum[i-1])%mod;
        ans=(ans+res)%mod;
    }
    cout<<ans;
    return 0;
}

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


using namespace std;

const int INF = 1e9;

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
  
    
    int N; cin >> N;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i)
        cin >> a[i];
    int ans = 0;
    sort(a.begin(), a.end());
    for (int i = 0; i < N-2; ++i) {
        for (int j = i+1; j < N-1; ++j) {
            for (int k = j+1; k < N; ++k) {
                if ((a[i] + a[j] > a[k]) && (a[i] != a[k]) && (a[i] != a[j]) && (a[j] != a[k])) {
                    ans++;
                }
            }
        }
    }cout << ans << '\n';

    return 0;
}



Measured memory_bytes: 3652
def complain(comp,c,k,last_hold,i):
    # print(k)
    if(k > 26):
        # print("___")
        return comp
    comp += c[k-1]*((i+1) - last_hold[k-1]) 
    k += 1
    # print(comp,"comp")
    return complain(comp,c,k,last_hold,i)

D = int(input())
c = list(map(int,input().split()))
s = ["_"]*(D)
# print(c)
for i in range(D):
    s[i] = list(map(int,input().split()))
last_hold = [0]*26
score = [0]*(D+1)

for i in range(D):
    score[i+1] += score[i]
    t = int(input())
    last_hold[t-1] = i+1
    comp = 0
    k = 1
    score[i+1] += s[i][t-1]    
    # print(s[i][t-1],"s")
    comp = complain(comp,c,k,last_hold,i)    
    score[i+1] -= comp
    # print(comp,"comp")
    # print(score[i+1],"score")

for i in range(D):
    print(score[i+1])

# Σ(Ci * (d - last(d,i)))
# (1~26)

# 18398
# 35037
# 51140
# 65837
# 79325

Measured memory_bytes: 9372
H,W=map(int,input().split())
S=[list(map(int, input().split())) for i in range(10)]
l=[None]*10
for i in range(10):
    l[i]=S[i][1]
for i in range(7):
    for j in range(10):
        for k in range(10):
            if l[j]>l[k]+S[j][k]:
                l[j]=l[k]+S[j][k]
l.append(0)
a=0
for i in range(H):
    L=list(map(int,input().split()))
    for j in L:
        a+=l[j]
print(a)

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

    for(int i = 0; i < N+1; i++)
    {
        for(int j = 0; j < N+1-i; j++)
        {
            if( i*10000 + j*5000 + (N-i-j)*1000 == Y )
            {
                cout << i << " " << j << " " << N-i-j << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false; cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli d, g;
vector<lli> p, c;
pair<lli, lli> s[1<<10];
int main() {
  cin >> d >> g;
  p = vector<lli>(d);
  c = vector<lli>(d);
  for (lli i=0; i<d; ++i) {
    cin >> p[i] >> c[i];
    c[i] += 100 * (i+1) * p[i];
  }
  s[1] = { c[0], p[0] };
  lli m = 1;
  for (lli b=2; b < (1<<d); ++b) {
    if (b >= (1<<(m+1))) ++m;
    auto& pp = s[b & ~(1 << m)];
    s[b].first = pp.first + c[m];
    s[b].second = pp.second + p[m];
  }
  lli ans = 1e9;
  for (lli b=0; b < (1<<d); ++b) {
    if (s[b].first >= g) ans = min(ans, s[b].second);
    else {
      for (lli i=0; i < d; ++i) {
	lli r = g - s[b].first;
	if (!((1 << i) & b)) {
	  lli n = r % (100 * (i+1)) == 0 
	    ? r / (100 * (i+1)) 
	    : r / (100 * (i+1)) + 1;
	  if (n <= p[i]) {
	    ans = min(ans, s[b].second + n);
	  }
	}
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int a,b;cin>>a>>b;
  if(b==1)cout << 0 << endl;
  else cout << (a-b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, x, t;
	cin >> n >> x >> t;
	int res = (n + x - 1) / x;
	cout << res * t;
}

Measured memory_bytes: 3648