akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main{

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	int w, h, s;
	int[][] sum;
	int sumAll;
	
	int sum(int x1, int y1, int x2, int y2) {
		return sum[y2][x2] - sum[y2][x1-1] - sum[y1-1][x2] + sum[y1-1][x1-1];
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			h = sc.nextInt(); w = sc.nextInt(); s = sc.nextInt();
			
			if( (h|w|s) == 0 ) break;
			sum = new int[h+1][w+1];
			
			for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) 
				sum[i][j] = sc.nextInt() + sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1];
			
			sumAll = sum[h][w];
			
			mem = new P[w+1][h+1][w+1][h+1];
			P ans = solve(1, 1, w, h);
//			debug(ans.sub);
			System.out.println(ans.max + " " + ( s - ( sumAll - ans.sub) ) );
		}
	}
	
	P[][][][] mem;
	P solve(int x1, int y1, int x2, int y2) {
		if(mem[x1][y1][x2][y2] != null) return mem[x1][y1][x2][y2];
		if( sum(x1, y1, x2, y2) < sumAll - s ) return mem[x1][y1][x2][y2] = new P(-1, -1);
		
		int max = 1; int sub = sum(x1, y1, x2, y2);
		
		for(int x=x1;x<x2;x++) {
			P l = solve(x1, y1, x, y2), r = solve(x+1, y1, x2, y2);
			if(l.max <= 0 && r.max <= 0) continue;
			
			if(max < l.max + r.max) {
				max = l.max + r.max;
				sub = min(l.sub, r.sub);
			}
			else if ( max == l.max + r.max ) {
				sub = max(sub, min(l.sub, r.sub));
			}
		}
		
		for(int y=y1;y<y2;y++) {
			P u = solve(x1, y1, x2, y), d = solve(x1, y+1, x2, y2);
			if(u.max <= 0 && d.max <= 0) continue;
			
			if(max < u.max + d.max) {
				max = u.max + d.max;
				sub = min(u.sub, d.sub);
			}
			else if ( max == u.max + d.max ) {
				sub = max(sub, min(u.sub, d.sub));
			}
		}
//		debug(x1, y1, x2, y2, max, sub);
		return mem[x1][y1][x2][y2] = new P(max, sub);
	}
	
	class P {
		int max, sub;
		P(int max, int sub) {
			this.max = max;
			this.sub = sub;
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

Measured memory_bytes: 68928
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
  long long n, m, d;
  cin >> n >> m >> d;
  double result;
  if (d == 0) {
    result = (m-1.0)/n;
  } else {
    result = (2.0*(n-d)*(m-1.0))/(n*n);
  }
  cout <<  fixed << setprecision(20) << result << endl;
}

Measured memory_bytes: 256
{-# LANGUAGE MultiWayIf #-}

module Main where

import Data.Word (Word64)
import Debug.Trace (trace)

-- abc115D

main :: IO ()
main = do
  [n,x] <- words <$> getLine
  print $ f (read n) (read x)

f :: Int -> Word64 -> Word64
f n x
  | n == 0                   = 1
  | x <= 1                   = 0
  | size (n-1) + 1 >= x      = f (n-1) (x -1)
  | otherwise                = pati n - f n (size n - x)

size :: Int -> Word64
size 0 = 1
size n = 3 + 2 * size (n-1)

pati :: Int -> Word64
pati 0 = 1
pati n = 1 + 2 * pati (n-1)



Measured memory_bytes: 508
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int sum[200010];

pair<int, int> p[200010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, D, A;
    cin >> N >> D >> A;
    int ans = 0;
    
    vector<int> X(N), H(N);
    rep(i, N) {
        cin >> X[i] >> H[i];
        p[i] = {X[i], H[i]};
    }
    sort(p, p + N);
    sort(X.begin(), X.end());
    rep(i, N) {
        int cnt = max(0LL, (p[i].second + A - 1 - sum[i])) / A;
        ans += cnt;
        sum[i + 1] += cnt * A + sum[i];
        sum[distance(X.begin(), upper_bound(X.begin(), X.end(), X[i] + D * 2))] -= cnt * A;
        //cout << "*" << sum[i] << endl;
    }
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 8064
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main(){
  string s;
  int i,a[15];
  cin >> s;
  for(i=0;i<=s.size();i++){
    a[i]=0;
  }
  for(i=0;i<s.size();i++){
    if(s[i]=='A' || s[i]=='T' || s[i]=='G' || s[i]=='C'){
      a[i+1]=a[i]+1;
    }
    else{
      a[i+1]=0;
    }
  }
  int ans=0;
  for(i=0;i<=s.size();i++){
    if(a[i]>ans){
      ans=a[i];
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

int main()
{
	float r, g;
	
	cin >> r >> g;
	
	// g = (r + x) / 2
	// g = r/2 + x/2
	// 2g = r + x
	// x = 2g - r
	
	cout << 2 * g - r << endl;
	
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
from copy import *

def tpsort(es, ordered = False):
    n = len(es)
    indgr = [0] * n
    for e in es:
        for u in e:
            indgr[u] += 1
    if ordered:
        from heapq import heappop, heappush
        st = []
        for v in range(n):
            if indgr[v] == 0: heappush(st, v)
        ret = []
        while st:
            v = heappop(st)
            ret.append(v)
            for u in es[v]:
                indgr[u] -= 1
                if indgr[u] == 0: heappush(st, u)
    else:
        st = [v for v in range(n) if indgr[v] == 0]
        ret = []
        while st:
            v = st.pop()
            ret.append(v)
            for u in es[v]:
                indgr[u] -= 1
                if indgr[u] == 0: st.append(u)
    if len(ret) == n:
        return ret
    else:
        return False

N, M = map(int, input().split())
es = [[] for i in range(N)]
for i in range(M):
    x, y = map(lambda x: int(x)-1, input().split())
    es[x].append(y)
tplst = tpsort(es)
dp = [0] * N
for v in tplst:
    for u in es[v]:
        dp[u] = max(dp[u], dp[v]+1)
print(max(dp))


Measured memory_bytes: 62368
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int main(){
	int x;
	cin >> x;
	if(x>=1200)cout << "ARC" << endl;
	else cout << "ABC" << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
E=[list(map(int,input().split())) for i in range(N-1)]
C=list(map(int,input().split()))
C.sort(reverse=True)

print(sum(C[1:]))

ELIST = [[] for i in range(N+1)]
for a,b in E:
  ELIST[a].append(b)
  ELIST[b].append(a)


from collections import deque
QUE =deque([1])

i=0
ANS=[-1]*(N+1)
while QUE:
  x=QUE.pop()
  ANS[x]=C[i]
  i+=1
  for to in ELIST[x]:
    if ANS[to]==-1: 
      QUE.append(to)
      ANS[to]=0
      
print(*ANS[1:])

Measured memory_bytes: 7584
# 755
def func(s, n):
    a = list()
    if int(s) > n:
        return a
    if s.count('7') > 0 and s.count('5') > 0 and s.count('3') > 0:
        a.append(int(s))
    for char in '753':
        tmp = func(s+char, n)
        for k in tmp:
            a.append(k)
    return a


print(len(func('0', int(input()))))


Measured memory_bytes: 4304
INF = 10**10

def main():
    s = input()
    N = len(s)
    s = '#' + s
    dp = [[(-INF) for j in range(3)] for i in range(N+1)]

    if len(s) == 1:
        print(1)
        exit()

    dp[0][1] = 0
    dp[0][2] = 0
    dp[1][1] = 1

    for i in range(2, N+1):
        # 1文字→1文字
        if s[i-1] != s[i]:
            dp[i][1] = max(dp[i][1], dp[i-1][1] + 1)
        
        # 2文字→1文字
        dp[i][1] = max(dp[i][1], dp[i-1][2] + 1)

        # 1文字→2文字
        dp[i][2] = max(dp[i][2], dp[i-2][1] + 1)

        # 2文字→2文字
        if i >= 4 and s[i-3:i-1] != s[i-1:i+1]:
            dp[i][2] = max(dp[i][2], dp[i-2][2] + 1)

    print(max(dp[N][1], dp[N][2]))


if __name__ == "__main__":
    main()

Measured memory_bytes: 48740
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  ll res_h = H2 - H1;
  ll res_m = M2 - M1;
  if (res_m < 0) res_h--, res_m = M2 + 60 - M1;
  ll max_m = res_h * 60 + res_m;
  cout << max(max_m - K, 0LL) << endl;
  return 0;
}

Measured memory_bytes: 3496
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <time.h>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <list>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
const int maxn=300005;
int n,a[maxn];
int sum1[maxn],sum2[maxn];
int ans[maxn];
void upday(int val,int pos)
{
    if(val>sum1[pos])
    {
        sum2[pos]=sum1[pos];
        sum1[pos]=val;
    }
    else
    {
        if(val>sum2[pos])
        {
            sum2[pos]=val;
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<(1<<n);i++)
    {
        cin>>a[i];
        sum1[i]=a[i];
    }
    for(int i=0;i<n;i++)
    {
        int t=1<<i;
        for(int j=0;j<(1<<n);j++)
        {
            if(!(j&t))
            {
                int nowp=j|t;
                int old=sum1[j];
                upday(old,nowp);
                old=sum2[j];
                upday(old,nowp);
            }
        }
    }
    for(int i=0;i<(1<<n);i++)
    {
        if(i!=0)
        ans[i]=max(ans[i-1],sum1[i]+sum2[i]);
        else
        ans[i]=sum1[i]+sum2[i];
    }
    for(int i=1;i<(1<<n);i++)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 7424
#include<stdio.h>

int main(void) {
    char str[200];
    fgets(str, 200, stdin);

    int diff = 'a' - 'A';

    int i;
    while(str[i] != '\0') {
        if(str[i] >= 'a' && str[i] <= 'z') str[i] -= diff;
        printf("%c", str[i++]);
    }                                                                                             

    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#define fo(x,a,b) for(int x=a;x<=b;x++)
#define dfo(x,a,b) for( int x=a;a>=b;x--)
using namespace std;
int last[1000005],next[1000005],f[1000005],first,n,x,m;
int main ()
{
	scanf("%d%d",&n,&m);
	fo(i,0,n*2)
	{
		next[i]=-1;
		last[i]=-1;
	}
	fo(i,1,n)
	{
		f[i]=i;
		last[f[i]]=i-1;
		next[f[i]]=i+1;
	}
	first=1;
	fo(i,1,m)
	{
		scanf("%d",&x);
		if (x!=first)
		{
		next[f[last[x]]]=next[x];
		last[f[next[x]]]=last[x];
		next[x]=f[first];
		last[f[first]]=x;
		last[x]=0;
		first=x;
		}
	}
	int k=1;			
	for(int i=first;f[i]!=0;i=next[i])
	if (k++<=n) printf("%d\n",f[i]);else break;

	return 0;
}


Measured memory_bytes: 7120
#include <bits/stdc++.h>
using namespace std;
int main(){
     int n;
     cin>>n;
     long long a[n+1];
     for(int i=0;i<n;i++){
        cin>>a[i];
}
     sort(a,a+n);
     for(int i=0;i<n;i++){
          if(a[i]==a[i+1]){
               cout<<"NO";
          return 0;
        }
     }
     cout<<"YES";
     return 0;
}

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

#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,0,n)cin>>a[i];
    vector<int> dp(n,INF);
    rep(i,0,n){
        *lower_bound(dp.begin(),dp.end(),a[i])=a[i];
    }
    cout<<lower_bound(dp.begin(),dp.end(),INF)-dp.begin()<<endl;
    return 0;
}


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


void solve(long long N, std::vector<long long> A){
    map<long long, long long> paper;
    for(auto a : A){
        if(paper[a] == 0) paper[a] = 1;
        else paper[a] = 0;
    }
    long long ans = 0;
    for(auto itr = paper.begin(); itr != paper.end(); ++itr){
        if(itr->second == 1) ans++;
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 10312
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k;
  cin>>k;
 string s;
  cin>>s;
  string a=s.substr(0,k);
  if(s.size()<=k){
    cout<<s<<endl;
  }
  else{
    cout<<a<<"..."<<endl;
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  rep(i,s.size() ){
    repi(j,i+1,s.size() ){
      string t="";
      t+=s.substr(0,i+1);
      t+=s.substr(j);
      //cout<<t<<endl;
      if(t=="keyence"){cout<<"YES"<<endl;return 0;}
    }
  }
  cout<<"NO"<<endl;

  return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll LenDigit(ll a, ll b, ll digit) {
    //cerr << "CALLING: " << a << " " << b << " " << digit << endl;
    ll five = a / 5 - b / 5;
    ll three = a / 3 - b / 3;
    ll fifteen = a / 15 - b / 15;
    return (a - b - five - three + fifteen) * digit + 4 * (five + three);
}

ll Len(ll a, ll b) {
    //cerr << "Len: " << a << " " << b << endl;
    ll num = 1;
    ll ans = 0;
    for(ll i = 1; i <= 17; i++) {
        if(num > a || num * 10 < b) {
            num *= 10;
            continue;
        }
        ans += LenDigit(min(num * 10 - 1, a), max(num - 1, b), i);
        num *= 10;
    }
    return ans;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll in;
    //for(ll i = 1; i <= 1e17; i+= 1e15) cout << i << " " << Len(i, 0) << endl;
    cin >> in;
    ll ok = 0;
    ll ng = 1e17;
    while(ng - ok > 1) {
        ll mid = (ok + ng) / 2;
        if(Len(mid, 0) < in) ok = mid;
        else ng = mid;
    }
    //cerr << ok << endl;
    in -= Len(ok, 0) + 1;
    string now;
    for(ll i = ok + 1; i <= ok + 20; i++) {
        if(i % 15 == 0) now += "FizzBuzz";
        else if(i % 3 == 0) now += "Fizz";
        else if(i % 5 == 0) now += "Buzz";
        else now += to_string(i);
    }
    cout << now.substr(in, 20) << endl;
    return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s,t;
    cin >> s >> t;
    sort(all(s));
    sort(all(t),greater<>());
    fp(s < t);
    return 0;
}

Measured memory_bytes: 256
n=int(input())
#n,m=map(int,input().split())
#pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

sl=list(input())

org=["A","B","C"]
ans=0
for i in range(n-2):
    templ=sl[i:i+3]
    if templ==org :
        ans+=1
print(ans)


Measured memory_bytes: 2940
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, c, d;
    in >> a >> b >> c >> d;
    ll num = 0, count = 0;
    REP(i, 100){
        if(i==a){
            num += 1;
        }
        if(i==b){
            num -= 1;
        }
        if(i==c){
            num += 1;
        }
        if(i==d){
            num -= 1;
        }
        if(num == 2){
            count += 1;
        }
    }
    out << count << endl;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main() {
  map<string, vector<P>> m;
  int N; cin >> N;
  for (int i = 0; i < N; ++i) {
    string S; int p; cin >> S >> p;
    m[S].push_back({p, i + 1});
  }

  for (auto [name, v] : m) {
    sort(v.rbegin(), v.rend());
    for (auto [p, i] : v) {
      cout << i << endl;
    }
  }
}


Measured memory_bytes: 3576
fn read() -> usize {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse::<usize>().ok().unwrap()
}
fn read_vec() -> Vec<u32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| c.parse::<u32>().ok().unwrap())
        .collect::<Vec<u32>>()
}
fn main() {
    let n = read();
    let mut l = read_vec();
    l.sort();
    let mut ans = 0;
    for c in 0..n {
        ans += l[2 * c];
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
p=lambda x:print(f'{x//3600:02}:{x//60%60:02}:{x%60:02}')
for e in iter(input,'-1 -1 -1'):
 h,m,s=map(int,e.split())
 d=7200-h*3600-m*60-s
 p(d);p(d*3)


Measured memory_bytes: 5612
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

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

        final int NMAX = 8;
        boolean[][] graph = new boolean[NMAX][NMAX];
        for (int i = 0; i < M; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
        }
      
        boolean[] visited = new boolean[NMAX];
        for (int i = 0; i < N; i++) {
            visited[i] = false;
        }
        visited[0] = true;
        System.out.println(dfs(0, N, visited, graph));
    }

    private static int dfs(int v, int N, boolean[] visited, boolean[][] graph) {
        boolean allVisited = true;
        for (int i = 0; i < N; i++) {
            if (!visited[i]) {
                allVisited = false;
            }
        }
        if (allVisited) {
            return 1;
        }
        int ret = 0;
        for (int i = 0; i < N; i++) {
            if (!graph[v][i]) continue;
            if (visited[i]) continue;

            visited[i] = true;
            ret += dfs(i, N, visited, graph);
            visited[i] = false;
        }
        return ret;
    }
}

Measured memory_bytes: 23764
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

ans=0
for i in range(len(b)):
  first=min(a[i],b[i])
  a[i]=a[i]-first
  b[i]=b[i]-first
  ans=ans+first
  if b[i]==0:
    continue
  
  second=min(a[i+1],b[i])
  a[i+1]=a[i+1]-second
  b[i]=b[i]-second
  ans=ans+second
  
print(ans)


Measured memory_bytes: 18624
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
d = sum(b)
for i in range(len(a) - 1):
    if a[i + 1] == a[i] + 1:
        d += c[a[i] - 1]
print(d)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <assert.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	swap(a, b);
	int k = 100;
	vector<string> A(k, string(k,'.'));
	int res = 0;
	for (int i = 0; i < k; i += 2) {
		for (int j = 0; j <= k/2; j++) {
			A[i][j] = '#';
		}
	}
	for (int i = 0; i < k; i++) {
		for (int j = 0; j <= k/2; j+=2) {
			A[i][j] = '#';
		}
	}

	b--;
	int n = 0;
	for (int i = 0; i < k; i++) {
		for (int j = 0; j < k / 2; j++) {
			if (A[i][j] == '.') {
				n++;
			}
		}
	}
	for (int i = 0; i < k; i++) {
		if (b >= n)break;
		for (int j = 0; j <= k / 2; j++) {
			if (A[i][j] == '.') {
				n--;
				A[i][j] = '#';
			}
			if (b >= n)break;
		}
	}
	if (b != n) {
		assert(false);
	}
	a--;
	for (int i = 0; i < k; i += 2) {
		if (a <= 0)break;
		for (int j = (k / 2) + 2; j < k; j+=2) {
			if (A[i][j] == '.') {
				a--;
				A[i][j] = '#';
			}
			if (a <= 0)break;
		}
	}
	if (a != 0) {
		assert(false);
	}
	cout << k << " " << k << endl;
	for (int i = 0; i < k; i++) {
		cout << A[i] << endl;
	}
}

Measured memory_bytes: 256
use std::io::BufRead;

const P: u64 = 1_000_000_007;

fn main() {
    let stdin = std::io::stdin();
    let val = stdin.lock().gets().split(' ')
        .map(|x| x.parse().unwrap()).collect::<Vec<usize>>();
    let (n, x, y, z) = (val[0], val[1], val[2], val[3]);

    let size = 1 << (x + y + z);
    let entry = 1 << (x + y + z);
    assert!(entry != 0);
    let goal = ((entry >> x | entry) >> y | entry) >> z;
    let mut state = vec![0; size];
    state[0] = 1;
    let mut count = 0;
    for _ in 0..n {
        count = count * 10 % P;
        let mut next = vec![0; size];
        for d in 1..11 {
            for s in 0..size {
                let s2 = (s | entry) >> d;
                if (s2 & goal) == goal {
                    count += state[s];
                } else {
                    next[s2] += state[s];
                }
            }
        }
        state = next;
        for s in state.iter_mut() {
            *s %= P;
        }
    }
    println!("{}", count % P);
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }


Measured memory_bytes: 8464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+20;
int n,f[N];
vector<int> e[N];
void dfs(int u,int fa)
{
	f[u]=0;
	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i];
		if(v==fa) 
			continue;
		dfs(v,u);
		f[u]^=(f[v]+1);
	}
}
int main()
{
	while(cin>>n)
	{
		for(int i=1;i<=n;i++)
			e[i].clear();
		int u,v;
		for(int i=1;i<=n-1;i++)
		{
			scanf("%d%d",&u,&v);
			e[u].push_back(v);
			e[v].push_back(u);
		}
		dfs(1,0);
		if(f[1])
			puts("Alice");
		else
			puts("Bob");

	}
	return 0;
}

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


vector<int> v;
int main(){
	int n,a,MX=-1,MXN=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		v.push_back(a);
		if(MX<a){
			MX=a;
			MXN=i;
		}
	}
	
	sort(v.begin(),v.end());
	
	for(int i=0;i<n;i++){
		if(MXN==i) cout << v[n-2] << endl;
		else cout << v[n-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 2548
#include <iostream>                                                                                                                                                                           
#include <cmath>                                                                                                                                                                              
#include <algorithm>                                                                                                                                                                          
#include <vector>                                                                                                                                                                             
using namespace std;                                                                                                                                                                          
int main() {                                                                                                                                                                                  
    vector<int> v;                                                                                                                                                                            
    int tmp;                                                                                                                                                                                  
    cin >> tmp;                                                                                                                                                                               
    while (cin >> tmp) {                                                                                                                                                                      
        v.push_back(tmp);                                                                                                                                                                     
    }                                                                                                                                                                                         
    int max = *max_element(v.begin(), v.end());                                                                                                                                               
    int min = *min_element(v.begin(), v.end());                                                                                                                                               
    cout << abs(max - min) << endl;                                                                                                                                                           
}  

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

ll solve() {
    ll A, B;
    cin >> A >> B;
    for ( int i = 0; i < 10000; i++ ) {
        if (A != i * 8 / 100) continue;
        if (B != i * 10 / 100) continue;
        return i;
    }
    return -1;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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



	int N;
	int t[];
	int x[];
	int y[];
	public void run() {
		Scanner sc = new Scanner(System.in);

		N = sc.nextInt();
		t = new int[N+1];
		x = new int[N+1];
		y = new int[N+1];

		t[0]=0;
		x[0]=0;
		y[0]=0;
		for(int i=1; i<=N; i++) {
			t[i]=sc.nextInt();
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
		}

		boolean ans = true;
		for(int i=1; i<=N; i++) {
			int dt = t[i] - t[i-1];
			int dist = Math.abs(x[i] - x[i-1]) + Math.abs(y[i] - y[i-1]);
			if(dt<dist) ans = false;
			if(dt%2 != dist%2) ans = false;
			if(!ans) break;
		}
		if (ans) System.out.println("Yes");
		else System.out.println("No");
		sc.close();
	}
}


Measured memory_bytes: 95808
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, s, l, h float64
	fmt.Scan(&a, &b, &c)

	s = a * b * math.Sin(math.Pi*c/180) / 2
	l = a + b + math.Sqrt(math.Pow(a, 2)+math.Pow(b, 2)-2*a*b*math.Cos(math.Pi*c/180))
	h = s / a * 2

	fmt.Printf("%f\n", s)
	fmt.Printf("%f\n", l)
	fmt.Printf("%f\n", h)
}



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

int H, W, K;
vector<string> G;
vector<int> dx = { -1, 1 };
vector<int> dy = { -1, 1 };

void func(int cnt, int y, int x, vector<vector<int>> &A) {
  A.at(y).at(x) = cnt;
  for (int i = 0; i < 2; i++) {
    int nx = x + dx.at(i);
    if (nx < 0 || nx >= W) continue;
    if (G.at(y).at(nx) == '#') continue;
    if (A.at(y).at(nx) != -1) continue;
    func(cnt, y, nx, A);
  }
}

void func2(int y, int x, vector<vector<int>> &A) {
  if (A.at(y).at(x) == -1) return;
  for (int i = 0; i < 2; i++) {
    int ny = y + dy.at(i);
    if (ny < 0 || ny >= H) continue;
    if (A.at(ny).at(x) != -1) continue;
    A.at(ny).at(x) = A.at(y).at(x);
    func2(ny, x, A);
  }
}

int main() {
  cin >> H >> W >> K;
  G.resize(H);
  for (int i = 0; i < H; i++) cin >> G.at(i);
  vector<vector<int>> A(H, vector<int>(W, -1));
  int cnt = 1;
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      if (G.at(y).at(x) == '#') {
        func(cnt, y, x, A);
        cnt++;
      }
    }
  }
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      func2(y, x, A);
    }
  }
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      if (x != W-1) cout << A.at(y).at(x) << " ";
      else cout << A.at(y).at(x);
    }
    cout << endl;
  }
}

Measured memory_bytes: 1280
#include<iostream>
using namespace std;
void merge(int[], int, int, int);
void mergeSort(int[], int, int);
long long cnt = 0;

int main() {
	int n;
	int A[200001];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	mergeSort(A, 0, n);
	for (int i = 0; i < n; i++) {
		//cerr << A[i] << " ";
	}
	//cerr << endl;
	cout << cnt << endl;
	return 0;
}

void merge(int A[], int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	int L[n1 + 1], R[n2 + 1];
	for (int i = 0; i < n1; i++) {
		L[i] = A[left + i];
	}
	for (int i = 0; i < n2; i++) {
		R[i] = A[mid + i];
	}
	L[n1] = 2000000000;
	R[n2] = 2000000000;
	int l = 0;
	int r = 0;
	for (int k = left; k < right; k++) {
		if (L[l] <= R[r]) {
			A[k] = L[l];
			l++;
		}
		else {
			A[k] = R[r];
			int k0 = k - left;
			int lr = n1 + r;
			if (lr > k0) cnt += lr - k0;
			r++;

		}
 
	}
}

void mergeSort(int A[], int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);

	}
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

lint com[MAX];
lint n;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a) {
    long long b = MOD, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD; 
    if (u < 0) u += MOD;
    return u;
}

void init(){
    for(lint i = 0; i < MAX; i++){
        if(i == 0){
            com[i] = 1; continue;
        }
        com[i] = (com[i-1]*(n - i + 1)) % MOD;
        com[i] = (com[i]*modinv(i)) % MOD;
    }
}

int main(){
    lint a, b; cin >> n >> a >> b;
    init();
    lint ans;

    ans = modpow(2, n);
    ans--;
    ans += MOD - com[a]; ans %= MOD;
    ans += MOD - com[b]; ans %= MOD;
    
    out(ans);
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
   var N = int.Parse(Console.ReadLine());
   var s = new List<string>();
   for(var i =0;i<N;i++){
     s.Add(Console.ReadLine());
   }
   var m = s.Distinct().ToList();
    Console.WriteLine(m.Count);
    
  }
}

Measured memory_bytes: 42892
#include<stdio.h>
#include<math.h>
struct Point {
  double x;
  double y;
};
int main(void) {
  int i, q;
  double dt1, dt2, t;
  struct Point base, hypo, p[4];
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    int j;
    for (j = 0; j < 4; j++) scanf("%lf %lf", &p[j].x, &p[j].y);
    base.x = p[1].x - p[0].x;
    base.y = p[1].y - p[0].y;
    hypo.x = p[2].x - p[0].x;
    hypo.y = p[2].y - p[0].y;
    dt1 = fabs(base.x * hypo.y - base.y * hypo.x);
    hypo.x = p[3].x - p[0].x;
    hypo.y = p[3].y - p[0].y;
    dt2 = fabs(base.x * hypo.y - base.y * hypo.x);
    t = dt1 / (dt1 + dt2);
    hypo.x = p[2].x + t * (p[3].x - p[2].x);
    hypo.y = p[2].y + t * (p[3].y - p[2].y);
    printf("%.11f %.11f\n", hypo.x, hypo.y);
  }
}


Measured memory_bytes: 2104
#include <iostream>
#include <math.h>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

int main() {
	ll N, M; cin >> N >> M;
	ll ans = 0;

	ans = (N < M / 2) ? N : M / 2;

	ll c = (M - 2 * ans);
	ans += (c > 0) ? c / 4 : 0;

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

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  int N;
  cin >> N;
  vector<int> D(N);
  REP(i, N) { cin >> D[i]; }
  sort(ALL(D));
  D.erase(unique(ALL(D)), D.end());
  cout << D.size() << endl;
}

signed main() {
  solve();

  return 0;
}

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

int main(void){
    int a,b; cin>>a >> b;
    string s; cin >> s;
    bool flag = true;
    if(s[a]!='-') flag = false;
    for(int i=0;i<a;i++){
        if(s[i]<'0' || '9'<s[i]) flag = false; 
    }
    for(int i=a+1;i<a+b;i++){
        if(s[i]<'0' || '9'<s[i]) flag = false; 
    }
    if(flag == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,ans=0;
    double c,d,area=0,c1=0,d1=0;
    cin>>a>>b>>c>>d;
    area=0.5*a*b;
    c1=a/2.0;
    d1=b/2.0;
    if(c1==c && d1==d)
    {
        ans=1;
    }
    else
    {
        ans=0;
    }
    printf("%lf %d\n",area,ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
#define print(n) cout << n << endl
using namespace std;
using ll = long long;
 
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    int N, M;
    cin >> N >> M;

    vector<int> A(M);
    rep(i,N) {
        int k; cin >> k;
        rep(j,k) {
            int a; cin >> a;
            A[a - 1]++;
        }
    }

    print(count(A.begin(), A.end(), N));

    return 0;
}


Measured memory_bytes: 256
use std::collections::HashSet;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn chars(s: &str) -> HashSet<char> {
    let mut chars = HashSet::new();
    for c in s.chars() {
        chars.insert(c);
    }
    chars
}

fn same_chars(right_chars: HashSet<char>, left_chars: HashSet<char>) -> Vec<char> {
    let chars: Vec<char> = right_chars.iter().filter(|c| {
        right_chars.get(c).is_some() && left_chars.get(c).is_some()
    }).map(|c| *c).collect();
    chars
}

fn main() {
    let n: i8     = read();
    let s: String = read();
    let char_types_counts: Vec<i8> = (1 .. n).map(|separate_index| {
        let (right, left) = s.split_at(separate_index as usize);
        let same_chars    = same_chars( chars(right), chars(left) );
        same_chars.len() as i8
    }).collect();
    println!("{}", char_types_counts.iter().max().unwrap_or(&0));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI=2147483647;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int h,n; cin >>h >>n;
  const int h_max = 10000;
  vector<int> a(n),b(n);
  rep(i, n) cin >>a.at(i) >>b.at(i);
  vector<vector<int>> dp(n+1, vector<int>(2*h_max+1, MOD));
  // dp[i][j]...i番目までの魔法でHPをjだけ減らすのに必要な魔力の最小値
  dp[0][0] = 0;
  for (int i=0; i<n; i++){
    for (int j=0; j<=2*h_max; j++){
      chmin(dp[i+1][j], dp[i][j]);
      if (j+a.at(i) <= 2*h_max) chmin(dp[i+1][j+a.at(i)], dp[i+1][j] + b.at(i));
    }
  }
  int res = MOD;
  for (int i=h; i<=2*h_max; i++){
    chmin(res, dp[n][i]);
  }
  cout <<res <<endl;
}


Measured memory_bytes: 78592
n = int(input())
H = [int(i) for i in input().split()]

INF = 10 ** 18
DP = [INF] * n
DP[0] = 0

for i in range(n-1):
    DP[i+1] = min(DP[i+1], DP[i] + abs(H[i+1] - H[i]))
    if i + 2 < n:
        DP[i+2] = min(DP[i+2], DP[i] + abs(H[i+2] - H[i]))

print(DP[n-1])

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


int main()
{
    int n,m;
    string a,b,c;
    cin>>a>>b;
  cin>>n>>m;
  cin>>c;

  if(c==a)
  cout<<n-1<<" "<<m;
  else if(c==b)
  cout<<n<<" "<<m-1;
  else
  cout<<n<<" "<<m;
    



     return 0;

}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N = int(readline())
S = readline().rstrip()
T = readline().rstrip()

for i in range(N, -1, -1):
#  print("i",i)
#  print(S[-i:],T[:i])
  if S[-i:] == T[:i]:
    print(N * 2 - i)
    break
else:
  print(N * 2)

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

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

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

    ll ans = abs(X - x[0]);
    for(int i = 0; i < n; i++){
        ll a = abs(X - x[i]);
        ans = gcd(ans, a);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>

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


void TorT()
{
  int n, a, b;

  cin >> n >> a >> b;
  if (n * a > b) cout << b << endl;
  else           cout << n * a << endl;
}


void cross9_9()
{
  int a, b;

  cin >> a >> b;
  if (a > 0 && a < 10 && b > 0 && b < 10) cout << a * b << endl;
  else cout << -1 << endl;
}


void calculate_circle()
{
  int r;

  cin >> r;
  cout << r * r << endl;
}


void SvsM()
{
  int hp, a;
  int atk_cnt, rest;

  cin >> hp >> a;
  atk_cnt = hp / a;
  if (hp % a) atk_cnt++;
  cout << atk_cnt << endl;
}


void Poor3()
{
  int a, b, c;

  cin >> a >> b >> c;
  if (a == b && b != c) cout << "Yes" << endl;
  else if (b == c && c != a) cout << "Yes" << endl;
  else if (c == a && a != b) cout << "Yes" << endl;
  else cout << "No" << endl;
}


void Algae()
{
  int r, d, x;
  
  cin >> r >> d >> x;
  for (int i = 0; i < 10; i++)
  {
    x = r * x - d;
    cout << x << endl;
  }
}


int main()
{
  //TorT();
  //cross9_9();
  //calculate_circle();
  //SvsM();
  //Poor3();
  Algae();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 5;
const int maxc = 26;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-8;
inline int read(){
    int f = 1,x = 0; char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-')f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x * 10 + ch - 48;ch = getchar();}
    return f * x;
}
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll qw(ll x,ll y){ll ans = 1;while(y){if(y&1) ans *= x;x *= x;y >>= 1;}return ans;}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool is_prime(ll x){if(x <= 1) return 0;for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;	}
int a,b;
void solve(){
	int sum = 1,ans = 0;
	while(sum < b){
		sum -= 1;
		sum += a;
		ans++;
	}
	cout << ans << endl;
} 
int main()
{
//	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> a >> b;
	solve();
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n;
    double a;
    cin >> n;
    double sum = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> a;
        sum = sum + 1 / a;
    }
    cout << 1 / sum;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
#define int long long
using namespace std;

const int N = 605, mod = 1e9 + 7;
int n, K, f[N][N], g[N], to[N], pre[N], ans;

int C2(int x) {
    return 1ll * x * (x - 1) / 2 % mod;
}

int num(int l, int r) {
    return pre[r] - pre[l - 1];
}

int solve(int l, int r) {
    rep(i, l, r)
        if (to[i] && (to[i] < l || to[i] > r)) return 0;
    f[l][r] = g[num(l, r) >> 1];
    rep(k, l + 1, r - 1) {
        f[l][r] = (f[l][r] - f[l][k] * g[num(k + 1, r) >> 1] % mod + mod) % mod;
    } return f[l][r];
}

signed main() {
    cin >> n >> K;
    rep(i, 1, K) {
        int x, y; scanf("%lld%lld", &x, &y);
        to[x] = y, to[y] = x;
    }
    rep(i, 1, n << 1) pre[i] = pre[i - 1] + (!to[i]);
    g[0] = 1;
    rep(i, 1, n) g[i] = g[i - 1] * (2 * i - 1) % mod;  // g[i] = g[i - 1] * C(2 * i, 2) / i，除掉旋转同构的
    rep(l, 1, n << 1)
        rep(r, l + 1, n << 1)
            if (num(l, r) % 2 == 0 && (r - l + 1) % 2 == 0)
                (ans += solve(l, r) * g[(num(1, l - 1) + num(r + 1, 2 * n)) >> 1] % mod) %= mod;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 6280
# 15

n = int(input())
s = list(input())

l = []
for i in range(1, n):
    a = s[0:i]
    b = s[i:]
    x = []
    for j in range(len(a)):
        if a[j] in b:
            x.append(a[j])
    else:
        l.append(len(set(x)))

print(max(l))


Measured memory_bytes: 3060
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define MKP make_pair

const int N=2e5+5;
ll ans;
int n,fa[N],pre[N],val[N],num[N];
int find(int x) {return fa[x]==x?fa[x]:fa[x]=find(fa[x]);}

template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}

struct Node {
	ll sum[2];int id;
	Node operator + (const Node&b) const {return (Node){sum[0]+b.sum[0],sum[1]+b.sum[1],id};}
	bool operator == (const Node&b) const {return sum[0]==b.sum[0]&&sum[1]==b.sum[1]&&id==b.id;}
	bool operator < (const Node&b) const {
		if(sum[0]*b.sum[1]==sum[1]*b.sum[0])
			return (sum[0]==b.sum[0])?((sum[1]==b.sum[1])?id<b.id:sum[1]<b.sum[1]):sum[0]<b.sum[0];
		return sum[0]*b.sum[1]<sum[1]*b.sum[0];
	}
}P[N];
struct Queue {
    priority_queue <Node> q1,q2;
    inline void add(Node t) {q1.push(t);}
    inline void del(Node t) {q2.push(t);}
    Node top() {
        while(!q1.empty()&&!q2.empty()&&q1.top()==q2.top()) q1.pop(),q2.pop();
        return q1.top();
    }
}Q;

int main() {
	IN(n);
	for(int i=2;i<=n;++i) IN(pre[i]);
	for(int i=1;i<=n;++i) IN(val[i]),fa[i]=i;
	for(int i=1;i<=n;++i) P[i].sum[0]=!val[i],P[i].sum[1]=val[i],P[i].id=i;
	for(int i=2;i<=n;++i) Q.add(P[i]);
	for(int i=2;i<=n;++i) {
		Node now=Q.top();Q.del(now);
		int u=now.id,f=find(pre[u]);
		if(f!=1) Q.del(P[f]);
		ans+=P[f].sum[1]*P[u].sum[0],P[f]=P[f]+P[u],fa[u]=f;
		if(f!=1) Q.add(P[f]);
	}
	printf("%lld\n",ans);
	return 0;
}

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


ll gcd(ll a, ll b) {
    while (b) {
        ll tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

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


int main() {
    int A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
}


Measured memory_bytes: 256