akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }

        
         public static long gcd(long x, long y)
        {
            if (x < y) gcd(y, x);
            while (y != 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long lcm(long x, long y)
        {
            return x * y / gcd(x, y);
        } 

        public static long C(long n, long k)
        {
            long x = 1;
            for (long i = 1; i <= k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var s = ReadLine();
            var k = Read();
            var l = new List<long>();
            var b = "";
            long ans = 0;
            
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i].ToString() == b) l[l.Count - 1]++;
                else l.Add(1);
                b = s[i].ToString();
            }
            for (int i = 0; i < l.Count; i++)
            {
                ans += l[i] / 2;
            }
            ans *= k;
            if (l.Count!=1&&s[0] == s[s.Length - 1] && l[0] % 2 != 0 && l[l.Count - 1] % 2 != 0) ans += k - 1;
            if (l.Count == 1) ans = s.Length*k/2;
            WriteLine(ans);


            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 17480
list = [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]
n = int(input())
print(list[n-1])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, m; cin >> n >> m;
    vector<string> A(n), B(m);
    REP(i, n) cin >> A[i];
    REP(i, m) cin >> B[i];
    bool judge = false;

    for(int ly = 0;ly <= n; ly++){
        for(int lx = 0; lx <= n; lx++){
            if(ly + m - 1 >= n or lx + m - 1 >= n) continue;

            bool match = true;
            REP(y, m){
                REP(x, m){
                    if(A[ly + y][lx + x] != B[y][x]) match = false;
                }
            }
            if(match) judge = true;
        }
    }

    if(judge) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt
from fractions import gcd

def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas



# N = intinput()
# S = input()
A, B, K = mulinputs()
# datas = list(mulinputs())
# datas = lineinputs(input)

if A <= K:
    rest = K-A
    if B >= rest:
        print(0, (B - (K-A)))
    else:
        print(0, 0)
else:
    print(A-K, B)




Measured memory_bytes: 5532
#include<bits/stdc++.h>
const int M=2e6+100;//M=300000;//
typedef long long int ll;
using namespace std;
 
//ll n,m,i,j,x,y,z,t,k(0),cnt(0),ans(0),sum(0),mn(M),mx(-9e9);

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	double d,t,s;
	cin>>d>>t>>s;
	double temp=d/s;
	if(temp<=t)
	{
		cout<<"Yes";
	}else cout<<"No";
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int , int> pi;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	ll answer = 0;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=n; j++)
		{
			int g = __gcd(i, j);
			for(int k=1; k<=n; k++)
			{
				answer += __gcd(g, k);
			}
		}
	}
	cout<<answer<<endl; 
	return 0;
};


Measured memory_bytes: 3648
S=list(input())
ans=0
for i in range(2**(len(S)-1)):
    kari=[""]*(len(S)-1)
    for j in range(len(S)-1):
        if ((i>>j)&1):
            kari[j]="+"
    hako=[]
    kotae=0
    kasu=0
    gomi=0
    for j in range(len(kari)+len(S)):
        if j%2==0:
            hako.append(S[kasu])
            kasu+=1
        else:
            hako.append(kari[gomi])
            gomi+=1
    #print(hako)
    hako="".join(hako)
    #hako=hako.replace(",","")
    #print(hako)
    kotae=eval(hako)
    ans+=kotae
print(ans)

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  long long sm = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sm += a[i];
  }
  const int N = 1e5 + 5;
  vector<int> cnt(N);
  for (int x : a) {
    ++cnt[x];
  }
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    sm -= (long long) cnt[y] * y;
    cnt[y] += cnt[x];
    sm += (long long) cnt[y] * y;
    sm -= (long long) cnt[x] * x;
    cnt[x] = 0;
    cout << sm << '\n';
  }
  return 0;
}


Measured memory_bytes: 3940
// She is Pretty pretty!
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define s (1 << 18)

const int N = 1e6 + 100;
const ll INF = 0x3f3f3f3f3f3f3f3f;
struct segtree {
    ll seg[s * 2];
    ll lazy[s * 2];
    void lazy_evaluate(int k) {
        if (k * 2 + 2 >= s * 2) return;
        lazy[k * 2 + 2] += lazy[k];
        lazy[k * 2 + 1] += lazy[k];
        seg[k * 2 + 2] += lazy[k];
        seg[k * 2 + 1] += lazy[k];
        lazy[k] = 0;
    }
    ll update(int beg, int end, int idx, int lb, int ub, ll num) {
        if (ub < beg || end < lb) {
            return seg[idx];
        }
        if (beg <= lb && ub <= end) {
            lazy[idx] += num;
            seg[idx] += num;
            return seg[idx];
        }
        if (lazy[idx]) {
            lazy_evaluate(idx);
        }
        return seg[idx] = max(
                   update(beg, end, idx * 2 + 1, lb, (lb + ub) / 2, num),
                   update(beg, end, idx * 2 + 2, (lb + ub) / 2 + 1, ub, num));
    }
    ll query(int beg, int end, int idx, int lb, int ub) {
        if (ub < beg || end < lb) {
            return -INF;
        }
        if (beg <= lb && ub <= end) {
            return seg[idx];
        }
        if (lazy[idx]) {
            lazy_evaluate(idx);
        }
        return max(query(beg, end, idx * 2 + 1, lb, (lb + ub) / 2),
                   query(beg, end, idx * 2 + 2, (lb + ub) / 2 + 1, ub));
    }
} tree;
int n, m;
vector<pair<int, pair<int, int> > > zz[N];
void solve() {
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < zz[i].size(); j++) {
            int zcj = zz[i][j].ff;
            int zb = zz[i][j].ss.ff;
            int ZB = zz[i][j].ss.ss;
            if (zcj == 1) {
                tree.update(0, i - 1, 0, 0, s - 1, 1ll * ZB);
            } else {
                tree.update(0, zb - 1, 0, 0, s - 1, -1ll * ZB);
            }
        }
        ll tmp = tree.query(0, i - 1, 0, 0, s - 1);
        tree.update(i, i, 0, 0, s - 1, tmp);
        ans = max(ans, tmp);
        //cout << "ans == " << ans << endl;
    }
    cout << ans << endl;
}
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int l, r, x;
        cin >> l >> r >> x;
        zz[l].pb({1, {r, x}});
        zz[r + 1].pb({-1, {l, x}});
    }
    solve();
    return 0;
}

Measured memory_bytes: 45056
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int a=h1*60+m1;
    int b=h2*60+m2;
    b-=k;
    cout<<b-a<<endl;
    
}


return 0;
}





Measured memory_bytes: 3652
C = [list(map(int, input().split())) for _ in range(3)]

D = [[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    for j in range(3):
        D[i][j] = C[i][j] - C[i][j-1]

if D[0] == D[1] == D[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9104
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
     int i,j,k,n,m;
     char s[20];
     scanf("%s",s);
     if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
          printf("Yes\n");
     else
          printf("No\n");
     return 0;
}


Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}



int main(){
	FIO
	
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)cin >> a[i];
	int q;
	cin >> q;
	while(q--){
		int b, m, e;
		cin >> b >> m >> e;
		rotate(a + b, a + m,  a + e);
	}
	cout << a[0];
	for(int i = 1; i < n; i++)cout << ' ' << a[i];
	cout << '\n';
	return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<pair<int, pair<int, int> > > viii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<vii> vvii;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) cin>>((a)[i])  
#define md 1000000007
#define MAXN 200005

int main()
{   
    ios::sync_with_stdio(false);

    long long int a, b, n, ans;
    cin >> a >> b >> n;
    if (n < b-1) {
    	ans = (a*n)/b - a*(n/b);
    }
    else {
    	ans = (a*(b-1))/b;
    }
    cout << ans << endl;
    return 0;
}




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

int main(int argc, char const *argv[])
{
    int H, W;
    cin >> H >> W;
    vector<vector<int>> a(H, vector<int>(W));

    for (int h = 0; h < H; h++)
    {
        for (int w = 0; w < W; w++)
        {
            char c;
            cin >> c;
            if (c == '#')
            {
                a[h][w] = 0;
            }
            else
            {
                a[h][w] = 1;
            }
        }
    }

    vector<int> vline(W, 0), hline(H, 0);

    for (int w = 0; w < W; w++)
    {
        for(int h = 0; h < H; h++){
            if(h == 0){
                vline[w] = a[0][w];
            } else {
                vline[w] *= a[h][w];
            }
        }
    }

    for (int h = 0; h < H; h++)
    {
        for(int w = 0; w < W; w++){
            if(w == 0){
                hline[h] = a[h][0];
            } else {
                hline[h] *= a[h][w];
            }
        }
    }
    
    for(int i = 0; i < H; i++){
        if(hline[i] == 0){
            for(int j = 0; j < W; j++){
                if(vline[j] == 0){
                    cout << ((a[i][j] == 0) ? '#' : '.' );
                }
            }
            cout << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3532
s = input()
for i in range(int(input())):
    cmd, a, b, *c = input().split()
    a = int(a)
    b = int(b) + 1
    if cmd == 'print':
        print(s[a:b])
    elif cmd == 'reverse':
        s = s[:a] + s[a:b][::-1] + s[b:]
    else:
        s = s[:a] + c[0] + s[b:]



Measured memory_bytes: 5616
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=5e5+10,ha=1e9+7;
struct line
{
	int k,b;
}L[N];
struct seg
{
	int l,r;
}s[N];
int cmp1(line A,line B){return A.k!=B.k?A.k<B.k:A.b<B.b;}
int cmp2(line A,line B){return A.b!=B.b?A.b<B.b:A.k<B.k;}
int cmp3(seg A,seg B){return A.l!=B.l?A.l<B.l:A.r<B.r;}

int n,dp[N],pre[N],suf[N],sum[N];

signed main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld%lld",&L[i].b,&L[i].k);
	sort(L+1,L+1+n,cmp1);for(int i=1;i<=n;i++)L[i].k=i;
	sort(L+1,L+1+n,cmp2);for(int i=1;i<=n;i++)L[i].b=i;
	suf[n+1]=1e18;
	for(int i=1;i<=n;i++)pre[i]=max(pre[i-1],L[i].k);
	for(int i=n;i>=1;i--)suf[i]=min(suf[i+1],L[i].k);
	sort(L+1,L+1+n,cmp1);
	for(int i=1;i<=n;i++)
	{
		s[i].l=suf[L[i].b];
		s[i].r=pre[L[i].b];
	}
	sort(s+1,s+1+n,cmp3);
	sum[0]=1;int now=1;
	for(int i=1;i<=n;i++)
	{
		//printf("%lld %lld\n",s[i].l,s[i].r);
		//dp[s[i].r]=(T.ask(s[i].r+1)-T.ask(s[i].l-1)+ha)%ha;
		//T.add(s[i].r,dp[s[i].r]);	
		sum[i]=sum[i-1];
		for(;now<=n&&s[now].r==i;now++)
		{
			int t=(sum[s[now].r]-(s[now].l>1?sum[s[now].l-2]:0)+ha)%ha;
			sum[i]=(sum[i]+t)%ha;
			dp[s[now].r]=(dp[s[now].r]+t)%ha;
		}
	}
	printf("%lld",dp[n]);
	return 0;
}


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

int main(){
    int n,l;
    cin >>n>>l;
    vector<string>r(n);
    for(int i=0;i<n;i++) cin>>r.at(i);
    sort(r.begin(),r.end());
    for(int i=0;i<n;i++) cout<<r.at(i);
    cout<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char c[] = str.toCharArray();
        int n = str.length();
        int p = 2019;
        
        // ans: 文字列で、連続部分列がmod 2019で0になるi, jのパターン数
        long ans = 0;
        
        // 式変形
        // ・連続部分列がmod 2019で0になるi, j
        // -> ex. XXXX18171YYYYで、18171 ≡ 0 (mod 2019)
        // -> 18171YYYY - YYYY ≡ 0 (mod m)
        // -> 181710000 ≡ 0 (mod m)
        // -> (s[j] - s[i]) * 10^4 ≡ 0 (mod m)
        // -> (合同式で割り算はmod pと互いに素なら可能)
        // -> (gcd(2019, 10) = 1)
        // -> s[j] - s[i] ≡ 0 (mod 2019)
        // -> s[j] ≡ s[i] (mod 2019) のパターン数
        
        // s: 累積和 (mod 2019)
        long[] s = new long[n+1];
        int ten = 1;
        for (int i = n - 1; i >= 0; i--) {
            // ex. c[i] * 10^x(mod m)
            // -> c[i] * (10^(x-1)(mod m) * 10^1 % m)
            // (10^(x-1)(mod m)は前のループで求めてる)
            
            long a = ((c[i] - '0') * ten) % p;
            s[i] = (s[i+1] + a) % p;
            ten = (ten * 10) % p;
        }
        
        // i, jのパターン数を数え上げる
        Map<Long, Integer> map = new HashMap<Long, Integer>();
        for (int i = 0; i <= n; i++) {
            long key = s[i];
            int cnt = map.getOrDefault(key, 0);
            
            ans += cnt;
            map.put(key, ++cnt);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 55712
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int ans = 0;
	rep(i,4){
		if(s[i] == '+') ans++;
		else ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<28)
#define MAX 90000

using namespace std;

string line;

void compute()
{
  int dp[2][11];
  rep(i,2)rep(j,11)dp[i][j] = 0;
  int N = line.size();
  int ans = 0;
  dp[1][line[0]-'0'] = 1;
  REP(i,1,N)
    {
      rep(j,11)dp[(i+1)&1][j] = 0;
      rep(j,11)dp[(i+1)&1][((j*10)%11+line[i]-'0')%11] += dp[i&1][j];
      if(line[i] != '0')dp[(i+1)&1][line[i]-'0']++;
      //rep(j,11)cout << dp[(i+1)&1][j] << " ";
      //cout << endl;
      ans += dp[(i+1)&1][0];
    }

  cout << ans << endl;
}

int main()
{
  while(cin >> line,line != "0")compute();
  return 0;
}

/*
string line;
int sum[4][MAX];

void compute()
{
  reverse(line.begin(),line.end());
  int N = line.size();
  rep(i,4)rep(j,N+5)sum[i][j] = 0;
  rep(i,N)sum[i&1][i] = line[i]-'0';
  REP(i,1,N)sum[!(i&1)+2][i] = line[i]-'0';
  rep(i,4)rep(j,N)sum[i][j] += (j-1>=0?sum[i][j-1]:0);

  //set<string> ans;
  int cnt = 0;
  rep(s,N)
    {
      REP(t,s+1,N)
	{
	  if(line[t] == '0')continue;
	  int base = (s%2?2:0);
	  int cost = (sum[base][t]-(s-1>=0?sum[base][s-1]:0)) - (sum[base+1][t]-(s-1>=0?sum[base+1][s-1]:0));
	  if(!cost || cost%11 == 0)cnt++;
	}
    }

  cout << cnt << endl;
  //for(set<string>::iterator it = ans.begin(); it != ans.end();it++)cout << *it << endl;
  //cout << ans.size() << endl;

}

int main()
{
  while(cin >> line,line != "0")compute();
  return 0;
}
*/

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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define dbg(x) TRACE(cerr << #x" = " << x << endl)
#define dbgall(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

//=========================

void run_test() {
	char c; cin >> c;
	if(isupper(c)) cout << "A" << endl;
	else cout << "a" << endl;
}

//=========================

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//int _t = 1, __t; cin >> __t; while(_t <= __t) { cout << "Case #" << _t++ << ": "; run_test(); }
	// int _t; cin >> _t; while(_t--) run_test();
	run_test();
	return 0;	
}



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	char a[n+1],b[n+1];
	cin>>a;
	cin>>b;
	char an[2*n+1];
	i=0; j=0; k=0;
	while(i<n||j<n){
		if(k%2==0){
			an[k]=a[i];
			k++; i++;
		}
		else{
			an[k]=b[j];
			k++; j++;
		}
	}
	an[2*n]='\0';
	cout<<an<<endl;
	return 0;
}

Measured memory_bytes: 256
//--- pD ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		long x = reader.nl();
		Map<Long, Long> map = new HashMap<>();
		map.put((long)0, (long)0);
		for (long i=1; ; i++) {
			long cur = (long)Math.pow(i, 5.0);
			long tofind = cur - x;
			if (map.containsKey(tofind)) {
				long b = map.get(tofind);
				out.println(i + " " + b);
				return;
			}
			map.put(cur, i);
			map.put(-cur, -i);
		}
		// return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 36956
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
        int one = Integer.parseInt(sc.next());
        int two = Integer.parseInt(sc.next());
        int three = Integer.parseInt(sc.next());
        int res = 0;
        res = one<two?one:two;
        if(res == one) {
            if(two < three) {
                res += two;
            } else {
                res += three;
            }
        } else {
            if(one < three) {
                res += one;
            } else {
                res += three;
            }
        }
        
        System.out.println(res);
    }
}


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

int my_max(int x, int y) {
 
  if (x > y) {
    return x;
  }else{
    return y;
  }
  }
  
int main() {
  int N, M;
  int ans=0;
  cin >> N;
  vector<string> vec_blue(N);
    for (int i=0;i<N;i++){
   cin >> vec_blue.at(i);
  }
  
  cin >> M;
  vector<string> vec_red(M);
   for (int i=0;i<M;i++){
   cin >> vec_red.at(i);
  }
  
  vector<int> vec_count(N,0);
   for(int i =0;i<N;i++){
     for (int j =0;j<N;j++){
    	 if (vec_blue.at(i) == vec_blue.at(j)){
           vec_count.at(i) += 1;
         }
 	 }
   }
   for(int i =0;i<N;i++){
     for (int j =0;j<M;j++){
    	 if (vec_blue.at(i) == vec_red.at(j)){
           vec_count.at(i) -= 1;
         }
 	 }
   }
 	for(int i= 0;i<N;i++){
      ans = my_max(vec_count.at(i),ans);
    }
         
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

struct data {
  int m1,d1,h,m;
  int time() const { return h*60+m; }
  bool operator < (data const& d) const {
    if(m1!=d.m1) return m1<d.m1;
    if(d1!=d.d1) return d1<d.d1;
    return h != d.h ? h < d.h : m < d.m;
  }
  
};

int main() {
  int N;
  while(cin >> N && N)
  {
    vector<data> v[1000];
    int m1, d1, h, m, u;
    char ch;
    rep(i, N) {
      scanf("%d/%d %d:%d %c %d",
            &m1, &d1, &h, &m, &ch, &u);
      v[u].push_back((data){m1,d1,h,m});
    }
    rep(i, 1000) {
      if(v[i].empty()) continue;
      sort(v[i].begin(), v[i].end());
    }
    
    int ans[1000] = {};
    REP(i, 1, 1000) {
      if(v[i].empty()) continue;
      rep(j, v[i].size()/2) {
        data const& vi0 = v[i][2*j], vi1 = v[i][2*j+1];
        rep(k, v[0].size()/2) {
          if(v[0][2*k].m1 != v[i][2*j].m1 || v[0][2*k].d1 != v[i][2*j].d1) continue;
          data const& v00 = v[0][2*k], v01 = v[0][2*k+1];
          ans[i] += max(0, min(v01.time(), vi1.time())
                        - max(v00.time(), vi0.time()));
        }
      }
    }
    int a = 0;
    rep(i, 1000) {
      a = max(a, ans[i]);
    }
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 1328
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(0, N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        ok = j + 1
        ng = N - 1
        if L[ng] < a + b:
            ans += ng - j
            continue
        if L[ok] >= a + b:
            continue
        while ok + 1 < ng:
            c = (ok + ng) // 2
            if L[c] < a + b:
                ok = c
            else:
                ng = c
        ans += ok - j
print(ans)

Measured memory_bytes: 44268
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int p[maxn],y[maxn];
vector<int>a[maxn];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&p[i],&y[i]);
        a[p[i]].push_back(y[i]);
    }
    for(int i=1;i<=n;i++)
    {
        if(a[i].size()>0)
            sort(a[i].begin(),a[i].end());
    }
    for(int i=0;i<m;i++)
    {
        int pos=lower_bound(a[p[i]].begin(),a[p[i]].end(),y[i])-a[p[i]].begin();
        printf("%06d%06d\n",p[i],pos+1);
    }
}


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

int main() {
    int n, m;
    cin >> n >> m;
    
    set<int> fav;
    rep(i, m) fav.insert(i);

    rep(i, n) {
        int k;
        cin >> k;
        set<int> next;
        rep(j, k) {
            int a;
            cin >> a;
            a--;
            if(fav.count(a)) next.insert(a);
        }
        fav = next;
    }

    cout << fav.size() << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

const int MOD = 1000000007;

int main() {
  ll h, n;
  scanf("%lld %lld", &h, &n);

  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    ll a;
    scanf("%lld", &a);

    sum += a;
  }

  if (sum >= h) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll Mod = 1000000007;

ll n;
ll a[200200];

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	rep(i, n) cin >> a[i];
	ll sum = 0, sum_pro = 0;
	rep(i, n){
		sum_pro = (sum_pro + sum * a[i]) % Mod;
		sum = (sum + a[i]) % Mod;
	}
	cout << sum_pro << endl;
	return 0;
}

Measured memory_bytes: 5156
#include<bits/stdc++.h>
using namespace std;
long long int dp[100][100001];
int main() {
	int n,c;
	cin>>n;
	cin>>c;
	int w[100];
	int v[100];
	for(int i=0;i<n;i++)
	{cin>>w[i]>>v[i];

	}
	dp[0][0]=0;
  dp[0][w[0]]=v[0];
 
 
  for (int i =1; i <n; ++i)
  {dp[i][0]=0;
  	for (int j = 1; j<=c ; ++j)
  { dp[i][j]=dp[i-1][j];
  	if(j >= w[i])
  		dp[i][j]=max( dp[i][j], v[i] + dp[i-1][j-w[i]]);
   

  }
  
}
  long long x=-1000000000000000000;
  for (int j =0; j<=c; ++j)
  {

  x=max(x,dp[n-1][j]);
 }

  cout<<x<<endl;
  return 0;

}

Measured memory_bytes: 80900
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if (a + b == 15) {
      System.out.println("+");
    } else if (a * b == 15) {
      System.out.println("*");
    } else {
      System.out.println("x");
    }
  }
}

Measured memory_bytes: 23124
#include <stdio.h>
#define MAX_N 31
#define MAX_X 1000001

int isPrime[MAX_X];

void judge() {
    int i, j;
    for (i = 0; i < MAX_X; i++) {
        isPrime[i] = 1;
    }

    isPrime[0] = isPrime[1] = 0;
    for (i = 2; i * i <= MAX_X - 1; i++) {
        for (j = i + i; j <= MAX_X - 1; j += i) {
            isPrime[j] = 0;
        }
    }
}

int main(void) {
    int n, x, v[MAX_N], dp[MAX_X], i, j, max;
    judge();
    while (1) {
        scanf("%d %d", &n, &x);
        if (n == 0 && x == 0) return 0;
        for (i = 0; i < n; i++) {
            scanf("%d", v + i);
        }
    
        for (i = 0; i <= x; i++) {
            dp[i] = 0;
        }

        for (i = 0; i < n; i++) {
            dp[v[i]] = 1;
        }

        for (i = 0; i < n; i++) {
            for (j = 0; j <= x; j++) {
                if (dp[j] && j + v[i] <= x) {
                    dp[j + v[i]] = 1;
                }
            }
        }
        
        max = 0;
        for (i = 0; i <= x; i++) {
            if (dp[i] && isPrime[i]) {
                max = i;
            }
        }

        if (max > 0) printf("%d\n", max);
        else printf("NA\n");
    }
}

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

#define ll long long
#define mk make_pair
#define pb push_back
#define ff first
#define sc second
#define all(x) x.begin(), x.end();

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

using namespace std;


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

   int a,b,c;cin>>a>>b>>c;
   if(a+b >= c){
      cout << "Yes";
   }else{
      cout << "No";
   }
   return 0;
}


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

int main()
{
	int n;

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

	int ans = 0;
	for( int i = 0; i < n - 2; i++ ) {
		if( p[i] < p[i + 1] && p[i + 1] < p[i + 2] || p[i] > p[i + 1] && p[i + 1] > p[i + 2] ) {
			ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

double calc(int x,int s,int n,int t,int p,int m,const vi& flg)
{
	int cnt=0;
	rep(i,m){
		bool ok=true;
		rep(j,s+1) if(!flg[(x+j)%(7*24*60)]){
			ok=false;
			break;
		}
		if(ok) cnt+=n;
		x=(x+t)%(7*24*60);
	}
	return 1-pow(1-1./p,cnt);
}

int main()
{
	map<string,int> wtoi;
	{
		string ws[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
		rep(i,7) wtoi[ws[i]]=i;
	}
	
	string w,z;
	for(int s,n,t,p,m;cin>>s>>n>>t>>w>>z>>p>>m,w!="None";){
		vi flg(7*24*60);
		if(w=="All"){
			if(z=="All")
				rep(i,7) rep(j,24*60)
					flg[i*24*60+j]=1;
			if(z=="Day")
				rep(i,7) rep(j,12*60)
					flg[(i*24+6)*60+j]=1;
			if(z=="Night")
				rep(i,7) rep(j,6*60)
					flg[i*24*60+j]=flg[(i*24+18)*60+j]=1;
		}
		else{
			int i=wtoi[w];
			if(z=="All")
				rep(j,24*60)
					flg[i*24*60+j]=1;
			if(z=="Day")
				rep(j,12*60)
					flg[(i*24+6)*60+j]=1;
			if(z=="Night")
				rep(j,6*60)
					flg[i*24*60+j]=flg[(i*24+18)*60+j]=1;
		}
		
		double res=0;
		rep(i,7*24*60)
			res=max(res,calc(i,s,n,t,p,m,flg));
		printf("%.10f\n",res);
	}
}

Measured memory_bytes: 1328
n=int(input())
xyu=[list(input().split()) for _ in range(n)]
xyu=[[int(x),int(y),u] for x,y,u in xyu]
ddr={'U':0,'R':1,'D':2,'L':3}
plus={'U':{},'R':{},'D':{},'L':{}}
minus={'U':{},'R':{},'D':{},'L':{}}
drdi={'U':{},'R':{},'D':{},'L':{}}

for i in range(n):
  x,y,u=xyu[i]
  if u=='U':
    if x in drdi[u]:
      drdi[u][x].add(i)
    else:
      drdi[u][x]={i}
  if u=='D':
    if x in drdi[u]:
      drdi[u][x].add(i)
    else:
      drdi[u][x]={i}
  if u=='R':
    if y in drdi[u]:
      drdi[u][y].add(i)
    else:
      drdi[u][y]={i}
  if u=='L':
    if y in drdi[u]:
      drdi[u][y].add(i)
    else:
      drdi[u][y]={i}
  if y-x in plus[u]:
    plus[u][y-x].add(i)
  else:
    plus[u][y-x]={i}
  if y+x in minus[u]:
    minus[u][y+x].add(i)
  else:
    minus[u][y+x]={i}
inf=float('inf')
ans=inf
ukeys=set(drdi['U'].keys())
dkeys=set(drdi['D'].keys())
from bisect import bisect_left
for x in ukeys.intersection(dkeys):
  U=[xyu[i][1] for i in drdi['U'][x]]
  D=[xyu[i][1] for i in drdi['D'][x]]
  if min(U)>=max(D):continue
  D=sorted(D)
  for ui in U:
    tmp=bisect_left(D,ui)
    if tmp==len(D):continue
    ans=min(ans,10*(D[tmp]-ui)//2)

rkeys=set(drdi['R'].keys())
lkeys=set(drdi['L'].keys())
for x in rkeys.intersection(lkeys):
  R=[xyu[i][0] for i in drdi['R'][x]]
  L=[xyu[i][0] for i in drdi['L'][x]]
  if min(R)>=max(L):continue
  L=sorted(L)
  for ri in R:
    tmp=bisect_left(L,ri)
    if tmp==len(L):continue
    ans=min(ans,10*(L[tmp]-ri)//2)

ukeys=set(plus['U'].keys())
lkeys=set(plus['L'].keys())
for x in ukeys.intersection(lkeys):
  U=[xyu[i][1] for i in plus['U'][x]]
  L=[xyu[i][1] for i in plus['L'][x]]
  if min(U)>=max(L):continue
  L=sorted(L)
  for ui in U:
    tmp=bisect_left(L,ui)
    if tmp==len(L):continue
    ans=min(ans,10*(L[tmp]-ui))

ukeys=set(plus['R'].keys())
lkeys=set(plus['D'].keys())
for x in ukeys.intersection(lkeys):
  U=[xyu[i][0] for i in plus['R'][x]]
  L=[xyu[i][0] for i in plus['D'][x]]
  if min(U)>=max(L):continue
  L=sorted(L)
  for ui in U:
    tmp=bisect_left(L,ui)
    if tmp==len(L):continue
    ans=min(ans,10*(L[tmp]-ui))

ukeys=set(minus['U'].keys())
lkeys=set(minus['R'].keys())
for x in ukeys.intersection(lkeys):
  U=[xyu[i][1] for i in minus['U'][x]]
  L=[xyu[i][1] for i in minus['R'][x]]
  if min(U)>=max(L):continue
  L=sorted(L)
  for ui in U:
    tmp=bisect_left(L,ui)
    if tmp==len(L):continue
    ans=min(ans,10*(L[tmp]-ui))

ukeys=set(minus['D'].keys())
lkeys=set(minus['L'].keys())
for x in ukeys.intersection(lkeys):
  U=[xyu[i][0] for i in minus['D'][x]]
  L=[xyu[i][0] for i in minus['L'][x]]
  if min(U)>=max(L):continue
  L=sorted(L)
  for ui in U:
    tmp=bisect_left(L,ui)
    if tmp==len(L):continue
    ans=min(ans,10*(L[tmp]-ui))
if ans==inf:
  print('SAFE')
else:
  print(ans)


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

static const int N=100;

int main(){
  int n, p[N+1], M[N+1][N+1];
  cin >> n;
  for(int i=1; i<=n; i++)
  {
    cin >> p[i-1] >> p[i];
  }

  for(int i=1; i<=n; i++)
    M[i][i]=0;

  for(int l=2; l<=n; l++)
  {
    for(int i=1; i<=n-l+1; i++)
    {
      int j=i+l-1;
      M[i][j]=(1 << 21);

      for(int k=i; k<=j-1; k++)
      {
        M[i][j]=min(M[i][j], M[i][k]+M[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }

  cout << M[1][n] << endl;

  return 0;
}



Measured memory_bytes: 3152
n = int(input())

E = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    e = E.get(a, None)
    if e is None:
        e = []
    e.append(b)
    E[a] = e
    e = E.get(b, None)
    if e is None:
        e = []
    e.append(a)
    E[b] = e

xs = [0] * (n+1)
#xs[1] = 1 #black by Fennec, first to play
#xs[n] = -1 #white by Snuke, second to play

from collections import deque
q = deque()
q.append((1, 1))
q.append((n, -1))

while q:
    i, color = q.popleft()
    if xs[i] == 0:
        xs[i] = color
        e = E.get(i, None)
        if e:
            for j in e:
                q.append((j, color))
    else:
        continue

if sum(xs) > 0:
    print("Fennec")
else:
    print("Snuke")



Measured memory_bytes: 35732
v,e=map(int,input().split())
s=sorted([list(map(int,input().split()))for i in range(e)],key=lambda x:x[2])
d=[i for i in range(v)]
def f(x):
    if x==d[x]:
        return x
    d[x]=f(d[x])
    return f(d[x])
a=0
for i,j,h in s:
    i,j=f(i),f(j)
    if i!=j:
        d[i]=j
        a+=h
print(a)


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }


int main(void){
  int r,d,x;cin >> r >> d >> x;
  rep(i,10){
    x=r*x-d;
    cout << x << endl;
  }
  

  return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))
k = int(input())
s = sum(arr)
d = {}
for i in arr:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
for _ in range(k):
    v = 0
    a,b = map(int, input().split())
    if a not in d:
        print(s)
        continue
    s += (b-a) * d[a]
    if b in d:
        d[b] += d[a]
    else:
        d[b] = d[a]
    print(s)
    del d[a]

Measured memory_bytes: 20644
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s,t,u;
    cin >>s>>t>>u;
    
    cout << s[0] << t[1] << u[2] << endl;
    
    return 0;
}



Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n,ans=0; cin>>n; 
    if (n>=1800) ans=1;
    else if (n>=1800) ans=1;
    else if (n>=1600) ans=2;
    else if (n>=1400) ans=3;
    else if (n>=1200) ans=4;
    else if (n>=1000) ans=5;
    else if (n>=800) ans=6;
    else if (n>=600) ans=7;
    else if (n>=400) ans=8;
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int ans = INT_MAX;
    for (int i = 0; i+2 < s.size(); ++i) {
        int v = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
        ans = min(ans, abs(v - 753));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}


//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:u32 = read();
    let s:Vec<char> = read::<String>().chars().collect();

    let cnt = s.iter().filter(|&x| *x == 'R').count();

    println!("{}", if s.len()-cnt < cnt {"Yes"} else {"No"});
    
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (long i = (s); i < (long)(n); i++)

int main() {
    char a,b;
    cin>>a>>b;

    if(a=='H'&&b=='H'||a=='D'&&b=='D'){
        cout<<'H'<<endl;
    }
    else{
        cout<<'D'<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

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


Measured memory_bytes: 1820
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n;
    while(cin>>n,n){
        vector<int> V(n);
        for(auto &v:V) cin>>v;
        sort(V.begin(), V.end());
        int ans=1000001;
        for(int i=0;i<n-1;i++){
            ans=min(ans,V[i+1]-V[i]);
        }
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

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

  ll i = 1;
  ll sum = 1;
  while(sum<N){
    i++;
    sum+=i;
  }

  FOR(j,1,i+1){
    if(j!=sum-N){
      cout << j << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// YAML
// 2012/10/29
public class Main{
	Scanner sc=new Scanner(System.in);

	String query;
	ArrayList<String> ss;

	void run(){
		query=sc.nextLine();
		ss=new ArrayList<String>();
		for(; sc.hasNextLine();){
			ss.add(sc.nextLine());
		}
		solve();
	}

	void solve(){
		Node root=new Node("", "", -1, null);
		Node node=root;
		for(String line : ss){
			int depth=line.length();
			line=line.replaceAll("^ *", "");
			depth-=line.length();
			for(; depth<=node.depth; node=node.parent);
			if(line.charAt(line.length()-1)==':'){
				Node child=new Node(line.substring(0, line.length()-1), null,
						depth, node);
				node.children.put(child.key, child);
				node=child;
			}else{
				String key=line.split(": ")[0];
				String value=line.split(": ")[1];
				Node child=new Node(key, value, depth, node);
				node.children.put(child.key, child);
			}
		}

		String ans;
		node=root;
		for(String s : query.substring(1).split("\\.")){
			if(node.children.containsKey(s)){
				node=node.children.get(s);
			}else{
				node=null;
				break;
			}
		}
		if(node==null){
			ans="no such property";
		}else if(node.children.size()>0){
			ans="object";
		}else{
			ans="string \""+node.value+"\"";
		}
		println(ans);
	}

	class Node{
		String key, value;
		int depth;
		Node parent;
		HashMap<String, Node> children;

		Node(String key, String value, int depth, Node parent){
			this.key=key;
			this.value=value;
			this.depth=depth;
			this.parent=parent;
			children=new HashMap<String, Node>();
		}
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef complex<int> cli;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr> PQ;
const int SIZE=5+1e5;
LL p[SIZE],q[SIZE];
Vpr nums;
int main(){
	LL H,W;
	cin.tie(0);
	cin >> W >> H;
	REP(i,W) cin >> p[i];
	REP(i,H) cin >> q[i];
	REP(i,W) nums.PB(pr(p[i],0));
	REP(i,H) nums.PB(pr(q[i],1));
	sort(ALL(nums));
	LL ans=0,ws=W+1,hs=H+1;
	REP(i,H+W){
		if(nums[i].second){
			ans+=nums[i].first*ws;
			hs--;
		}
		else{
			ans+=nums[i].first*hs;
			ws--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3956