akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    string s; vector<int> buff;
    cin >> s;
    int flag = 0;
    for(int i=0; i<s.length();){
        int j = i;
        while(j<s.length() && s[j]==s[i])
            j++;
        buff.push_back(flag+'0');
        flag = flag^1;
        i = j;
    }
    if(buff.size()==1){
        cout << ((int)s.length())-1;
        return 0;
    }
    if(buff.size()==2){
        if(k>0)
            cout << ((int)s.length())-1;
        else
            cout << ((int)s.length())-2;
        return 0;
    }
    int len = buff.size();
    int i=1;
    // if(buff[len-1])
    //     i=2;
    // else
    //     i = 1;
    while(i<buff.size() && k){
        buff[i] = buff[i]^1;
        i+=2;
        k--;
    }
    // if(k>0 && buff[len-1])
    //     buff[0] = buff[0]^1;
    int ctr = 0;
    for(int i=1; i<buff.size(); i++){
        if(buff[i]!=buff[i-1])
            ctr++;
    }
    cout << s.length()-ctr-1;
    return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <cstring>
using namespace std;

int n;
int a[10010];

int main()
{
	cin>>n;
	for(int i=0;i<n;++i) cin>>a[i];
	sort(a,a+n);
	cout<<a[n-1]-a[0]<<endl;
    return 0;
} 

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

int main()
{
	double x[4], y[4];
	while(true)
	{
		for(int i = 0; i < 4; i++)
		{
			if(!(cin >> x[i] >> y[i])) return 0;
		}
		
		double a = (x[1] - x[0]) * (y[3] - y[0]) - (y[1] - y[0]) * (x[3] - x[0]);
		double b = (x[2] - x[1]) * (y[3] - y[1]) - (y[2] - y[1]) * (x[3] - x[1]);
		double c = (x[0] - x[2]) * (y[3] - y[2]) - (y[0] - y[2]) * (x[3] - x[2]);
		
		if((a >= 0 && b >= 0 && c >= 0) || (a <= 0 && b <= 0 && c <= 0))
		{
			cout << "YES" << endl;
		}
		else 
		{
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
  ll n,a,b,c[10000];
  ll x=0,y=0,z=0;
  cin>>n>>a>>b;
  for(ll i=0;i<n;i++){
	cin>>c[i];
  }
  for(ll i=0;i<n;i++){
	if(a>=c[i]){
      x++;
    }else if(a<c[i] && b>=c[i]){
      y++;
    }else if(b<c[i]){
      z++;
    }
  }
  cout<<min(x,min(y,z))<<"\n";
  return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n; ll k;
	cin >> n >> k;
	V a(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	if (k <= 10000000) {
		int ans = 0;
		rep(i, k) {
			ans = a[ans];
		}
		cout << ans + 1 << endl;
		return 0;
	}
	int now = 0;
	V count(n, 0);
	int cnt = 0;
	int pos;
	while (1) { // 頂点を二回訪れるには何回操作するか？
		count[now]++;
		if (count[now] == 2) {
			pos = now;
			break;
		}
		now = a[now];
		cnt++;
	}
	int cnt2 = 0;
	now = 0;
	while (1) { // posを一回訪れるためには何回操作するか？
		if (now == pos) break;
		now = a[now];
		cnt2++;
	}
	k -= cnt2;
	int roop = cnt - cnt2;
	k %= roop;
	int ans = pos;
	rep(i, k) {
		ans = a[ans];
	}
	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 4844
x = int(input())
'''
t =  1, 2, 3, 4, 5, 6,...
d+ = 1, 3, 6,10,15,21,...
x = 11のとき、
t = 5,d+ = 15より、t = 4で一回休みすればいい
-> 行き過ぎたら一回休み
'''
i = 0
d = 0
while True:
    i += 1
    d += i
    if x <= d:
        ans = i
        break
print(ans)

Measured memory_bytes: 9060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  ll N;
  cin>>N;
  cout<<(1000000-N)%1000<<endl;
}


Measured memory_bytes: 3644
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<bits/stdc++.h>
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#pragma GCC optimization ("O3")
using namespace std;
const long long int N = 6999999;
#define all(x) begin(x),end(x)
#define ll long long int
const ll mod = 1000000007;
int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll a,b,c,d;
  cin >> a >> b >> c >>d;
  ll g = (c*d)/__gcd(c,d);
  ll m = b/c-(a-1)/c;
  ll n = b/d-(a-1)/d;
  ll k = b/g-(a-1)/g;
  ll an = m+n-k;
  ll ans = b-a+1-an;
  cout << ans; 
  return 0;
}


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

using namespace std;

int N,X,cnt=0;
int L[110]={0},D[110]={0};

int main()
{
	cin>>N>>X;
	D[0]=0;
	for(int i=1;i<=N;i++)
	{
		cin>>L[i];
		if(i>=2)
			D[i]=D[i-1]+L[i-1];
	}
	D[N+1]=D[N]+L[N];
	for(int i=1;i<=N+1;i++)
		if(D[i]<=X)
			cnt++;
	cout<<cnt<<endl;
	return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double N; cin >> N;
    for(int i = 1; i <= 3500; i++){
        for(int j = 1; j <= 3500; j++){
            double h = (double)i;
            double n = (double)j;
            double w = (N*h*n)/(4*h*n - N*n - N*h);
            if(w <= 0) continue;
            int tmp = (int)w;
            double W = (double)tmp;
            if(w == W){
                cout << i << " " << j << " " << tmp << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int k,n,i=0;
  string s;
  cin >> s >> k;
  n=s.size();
  while (k>0 && i<n){
    if (s[i]=='a' || k<'z'+1-s[i]){
      i++;
      continue;
    }
    k-='z'-s[i]+1;
    s[i]='a';
    i++;
  }
  if (k>0) s[n-1]+=k%26;
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int c=1e5;
const ll mod=1e9+7;
/*bool p[1000];
void sieve(){
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
    for(int j=i*i;j<=100;j+=i){
        p[j]=1;
    }
}
}*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,s;

    cin>>n>>s;
    ll w[n+5],v[n+5];
    for(int i=1;i<=n;i++){
        cin>>w[i]>>v[i];
        //p[i]={w,v};
    }
ll dp[n+5][s+5]={},ans=0;

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


Measured memory_bytes: 82304
n,m = map(int, input().split())

s = 0
for i in range(1,m+1):
    s |= 1 << i


for i in range(n):
    a = map(int, input().split())
    a = list(a)
    t = 0
    for j in range(1, len(a)):
        t |= 1 << a[j]
    s &= t


ans = 0
for i in range(1,m+1):
    if (s & (1<<i)) != 0:
        ans += 1

print(ans)


Measured memory_bytes: 9004
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    char[]n = N.toCharArray();
    
    if(n[0]==n[2]){
    System.out.println("Yes");  
    }else{
    System.out.println("No");    
    }
}
}

Measured memory_bytes: 35572
import java.util.Scanner;
public class Main{
	public static void main (String args[]) {
		Scanner scan=new Scanner(System.in);
		String str=scan.next();
		if(str.equals("ABC")) {
			System.out.println("ARC");
		}
		else {
			System.out.println("ABC");
		}
	}
	
}

Measured memory_bytes: 35696
import math
L = sorted(list(map(int,input().split(' '))))
A,B,C = L[0],L[1],L[2]
X = C - A
Y = C - B

if X % 2 == 0 and Y % 2 == 0:
  print(int(X/2 + Y/2))
elif X % 2 == 1 and Y % 2 == 1:
  print(int(abs(X-Y)/2 + min(X,Y)))
else:
  print(int(math.ceil(X/2)+math.ceil(Y/2) + 1))

Measured memory_bytes: 3064
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int H, W;
char s[55][55];
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0}; 


int main(void) {
    scanf("%d %d", &H, &W);
    REP(i, 0, H) {
    	scanf("%s", &s[i]);
    }

    REP(i, 0, H) {
    	REP(j, 0, W) {
    		if ( s[i][j] == '#') {
    			bool flag = false;
    			REP(r, 0, 4) {
    				int x = j + dx[r];
    				int y = i + dy[r];
    			if ( x < 0 || x >= W || y < 0 || y >= H ) continue;

    			if (s[y][x] == '#') flag = true;

    			}

    			if (!flag) {
    				No;
    				return 0;
    			}
    		}

    	}
    }
    
    Yes;

	return 0;
}


Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;
  vi v(n);

  rep(i,n) cin >> v[i];
  vsort(v);

  int sum = 0;
  rep(i,n-1)
    sum += v[i];
  
  if(v[n-1] < sum)  cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a,b,c;
	int c1,c2;

	c1=c2=0;

	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(a*a+b*b==c*c)
			c1++;
		else if(a==b &&a+b>c)
			c2++;
	}

	printf("%d\n%d\n",c1,c2);
	return 0;
}

Measured memory_bytes: 596
fn read_spc<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    fighting_over_candies();
}

fn fighting_over_candies () {
    let mut abc: Vec<i64> = read_spc();
    abc.sort();
    if abc[0] + abc[1] == abc[2] {
        println!("Yes");
    } else {
        println!("No");
    }
}

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

signed main() {
  int n, k;
  char s[11];
  scanf("%d %d %s", &n, &k, s);
  size_t len = strlen(s);
  s[len++] = ' ';
  int i = 0;
  for (; i < k; i++) {
    write(STDOUT_FILENO, s, len);
  }
  for (; i < n; i++) {
    write(STDOUT_FILENO, "7 ", 2);
  }
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;


void pre(){



}


void solve(){

    ll a;
    long double b;
    cin >> a >> b;
    ll ans = a*b;
    cout << ans ;

}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3748
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final long a = scanner.nextLong();
        final long b = scanner.nextLong();
        final long c = scanner.nextLong();
        final long k = scanner.nextLong();

        if (k <= a) {
            System.out.println(k);
        } else if (k <= a + b) {
            System.out.println(a);
        } else {
            System.out.println(a + (-1) * (k - a - b));
        }
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }
    }
}


Measured memory_bytes: 32676
#include <iostream>

using namespace std;

long m, n;
long denom = 1000000007;

long solve(long m, long n) {
    long res;
    if (n == 0) return 1;

    if (n % 2 == 0) {
        return solve(m * m % denom, n / 2);
    } else {
        return solve( m * m %denom, n/2) * m % denom;
    }

}

int main() {
    cin >> m >> n;
    cout << solve(m, n) << endl;


    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int main() {
    while(true){
        string s;
        cin >> s;
        if(s == "-") break;
        int m;
        cin >> m;
        rep(i, m){
            int h;
            cin >> h;
            string s1;
            s = s.substr(h, s.size() - h) + s.substr(0, h);
        }
        cout << s << endl;
    }

}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> a;
  if(a%2==1) co(0);
  else{
    b=2;
    rep(i,0,40){
      b*=5;
      c+=a/b;
    }
    co(c);
  }
  
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y; cin>>x>>y;
    cout<<x+y/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x,ans = 0;
    cin >> n;
    bool b = false;
    for(int i = 1; i < n; i++){
        cin >> x;
        if(b){
            b = false;
            continue;
        }
        if(i == x){
            b = true;
            ans++;
        }
    }
    cin >> x;
    if(n == x && b == false){
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

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

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, inp, max, cnt = 1;
	cin >> n >> max;
	REP(i, n-1){
		cin >> inp;
		if(max <= inp){
			cnt++;
			max = inp;
		}
	}

	cout << cnt << endl;

}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

pair<char,char> f(int n) {
  string s = to_string(n);
  char h = s[0];
  char t = s[s.length() - 1];
  return pair<char,char>(h, t);
}

pair<char,char> inv(pair<char,char> p) {
  return pair<char,char>(p.second, p.first);
}

int main(int argc, char const* argv[])
{
  int n;
  cin>>n;
  map<pair<char,char>, int> m;
  rep1(i,n+1) {
    m[f(i)]++;
  }

  // for(auto e: m) {
  //   printf("(%c,%c): %d\n", e.first.first, e.first.second, e.second);
  // }

  int ans = 0;
  rep1(i,n+1) {
    ans += m[inv(f(i))];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

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

  for (auto y = 2000; y !=2010; ++y) {
    x = r*x-D;
    cout << x << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<58;
const double eps = 1e-13;

int r[509],l[509];
PII x[509];//
int ans[250009];
vector<int> lv,rv;
vector<int> pos[509];

int main(){
	DRI(n);
	REP(i,n){
		RI(x[i].F);x[i].F--;
		ans[x[i].F]=i+1;
		x[i].S=i;
	}
	sort(x,x+n);
	/*REP(i,n){
		l[i]=x[i].S;
		if(i)l[i]+=l[i-1];
		if(l[i]>x[i].F-i){
			puts("No");return 0;
		}
	}
	for(int i=n-1;i>=0;i--){
		r[i]=n-1-x[i].S;
		if(i<n-1)r[i]+=r[i+1];
		if(r[i]>n*n-1-x[i].F-(n-1-i)){
			puts("No");return 0;
		}
	}*/
	REP(i,n){
		REP(j,x[i].S)lv.PB(x[i].S+1);
	}
	for(int i=n-1;i>=0;i--){
		REP(j,n-1-x[i].S)rv.PB(x[i].S+1);
	}
	int li=0,ri=0;
	REP(i,n*n){
		if(ans[i]==0&&li<SZ(lv))ans[i]=lv[li++];
	}
	for(int i=n*n-1;i>=0;i--){
		if(ans[i]==0&&ri<SZ(rv))ans[i]=rv[ri++];
	}
	REP(i,n*n){
		if(ans[i]-1<0){
			puts("No");return 0;
		}
		pos[ans[i]-1].PB(i);
	}
	REP(i,n){
		if(SZ(pos[x[i].S])<n||pos[x[i].S][x[i].S]!=x[i].F){
			puts("No");return 0;
		}
	}
	puts("Yes");
	REP(i,n*n){
		printf("%d ",ans[i]);
	}
}


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

#define pb push_back
#define ll long long
using namespace std;

int v[1000005];

int main() {
   for(int i = 1; i <= 1000000; i++) {
     if(i%3==0) v[i] = 1;
     else if(i%5==0) v[i] = 1;
   }
   int n; cin >> n;
   ll sum = 0;
   for(int i = 1; i <= n; i++) {
    if(!v[i]) sum += i;
   }
   cout << sum << endl;
}


Measured memory_bytes: 7540
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
    long long l, r;
    cin >> l >> r;

    if(r - l > 3000){
        printf("0\n");

        return 0;
    }

    long long min0 = 1e9;

    for(long long i = l; i < r; i++){
        for(long long j = i+1; j <= r; j++){
            min0  = min(min0, (i*j)%2019);
        }
    }

    printf("%lld\n", min0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test int t;cin>>t;while(t--)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define MOD 1000000007
#define ll long long
#define pb push_back
#define ii pair<int,int>
#define llll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<ii>
#define vllll vector<llll>
#define ff first
#define ss second
#define INF 1000000000
#define HINF 1000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define deb(x) cout<<#x<<'='<<x<<endl
const double pi = 3.14159265358979323846;

ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}


void solve()
{

	ll i=0,j=0,k=0,m,n,p,sum=0,cnt=0;
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
}
int main() {
    fast
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w+", stdout);
    //test
    {
        
        solve();
		
		      
    }
    return 0;
}
  

Measured memory_bytes: 3612
#include <iostream>
#include <string>
using namespace std ; 
int main() {
	int x = 0;
	int max = -10;
	string s;
	int n;
	cin >> n;
	cin >> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'I')
		{
			x++;
			if (x > max)
			{
				max = x;
			}
		}
		else 
		{
			if (x > max)
			{
				max = x;
			}
			x--;
		}
	}
	cout << max << endl;
}

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

void prime_factorize(int n, int* a){
  int div = 2;
  int sq = (int)sqrt(n);
  int count = 0;
  while(div <= sq){
    if(n % div == 0){
      n /= div;
      sq = (int)sqrt(n);
      count++;
    }else{
      a[div] = std::max(a[div], count);
      if(div == 2) div = 3;
      else div += 2;
      count = 0;
    }
  }

  if(div == n){
    a[div] = std::max(a[div], count + 1);
  }else{
    a[div] = std::max(a[div], count);
    a[n] = std::max(a[n], 1);
  }
}

int main(){
  int n, m;
  std::cin >> n;
  int a[n];
  for(int i = 0; i < n; i++){
    std::cin >> a[i];
  }

  const int MAX_NUM = 1000;
  int p[MAX_NUM + 1];
  for(int i = 0; i < MAX_NUM + 1; i++) p[i] = 0;
  for(int i = 0; i < n; i++){
    prime_factorize(a[i], p);
  }

  int lmc = 1;
  for(int i = 1; i <= MAX_NUM; i++){
    for(int k = 0; k < p[i]; k++){
      lmc *= i;
    }
  }
  std::cout << lmc << std::endl;
  
  return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;

#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)

#define STRESS 0
using lint = long long;

void solve(istream& cin, ostream& cout) {
    int n;
    cin >> n;
    map<int, int> cnt;
    vector<int> h2;
    vector<int> h4;
    rep(i, 0, n) {
        int x;
        cin >> x;
        cnt[x]++;
        if (cnt[x] == 2) {
            h2.push_back(x);
        }
        if (cnt[x] == 4) {
            h4.push_back(x);
        }
    }
    sort(h2.rbegin(), h2.rend());
    sort(h4.rbegin(), h4.rend());
    lint ans = 0;
    if (h2.size() > 1) {
        ans = max(ans, 1LL * h2[0] * h2[1]);
    }
    if (!h4.empty()) {
        ans = max(ans, 1LL * h4[0] * h4[0]);
    }
    cout << ans;
}

int main() {
#if !defined(JLOCAL) || !STRESS
#ifdef JLOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve(cin, cout);
#else
    srand();
    for (int ti = 0; ti < 100; ti++) {
        stress::gen();
        stress::stupid();
        ifstream in("input.txt");
        ofstream out("output.txt");
        solve(in, out);
        out.flush();
        stress::check();
    }
    cout << "ok" << endl;
#endif
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=min((a), (b))

const int MOD=1000000007;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a[114514], b[114514], c[114514];
	cin>>n;
	REP(i, n) cin>>a[i];
	REP(i, n) cin>>b[i];
	REP(i, n) cin>>c[i];
	sort(a, a+n);
	sort(c, c+n);
	int x, y;
	ll ans=0;
	REP(i, n){
		x=lower_bound(a, a+n, b[i])-&a[0];
		y=&c[n-1]-upper_bound(c, c+n, b[i])+1;
		if(x>0 && y>0) ans+=ll(x)*ll(y);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1408
import sys
input = sys.stdin.readline

################
class UnionFind():
    """
    parents : 親要素(findしない場合は根ではないことの注意)，根の場合は"-(要素数）"
    find(x):要素xの属するグループの根を返す
    size(x):要素xの属するグループの要素数を返す
    same(x,y):x,yが同じグループに属しているか返す
    members(x):要素xが属するグループに属する要素をリストで返す
    roots(x):全ての根の要素を返す
    group_counte():グループの数を返す
    all_group_members():{根要素：[そのグループに含まれる要素のリスト]}の辞書を返す
    """
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    
################

N,M=map(int,input().split())
A=[0]*M
B=[0]*M
ans=[0]*M
for i in range(M):
    a,b=map(int,input().split())
    A[i]=a-1
    B[i]=b-1
    
def cmb(n):
    return n*(n-1)//2
    
uf = UnionFind(N)
ans[-1]=(N*(N-1))//2
for i in range(M-1,0,-1):
    if uf.find(A[i]) !=uf.find(B[i]):
        ga=uf.size(A[i])
        gb=uf.size(B[i])
        ans[i-1]=ans[i]-cmb(ga+gb)+cmb(ga)+cmb(gb)
        uf.union(A[i],B[i])
        if ans[i-1]==0:
            break
    else:
        ans[i-1]=ans[i]
    
for i in range(M):
    print(ans[i])

Measured memory_bytes: 94812
import scala.io.Source.stdin
 
object Main extends App {
  stdin.getLines.map(_.toDouble).foreach { x =>
    println {
      x match  {
        case i if i <= 48D => "light fly"
        case i if i <= 51D => "fly"
        case i if i <= 54D => "bantam"
        case i if i <= 57D => "feather"
        case i if i <= 60D => "light"
        case i if i <= 64D => "light welter"
        case i if i <= 69D => "welter"
        case i if i <= 75D => "light middle"
        case i if i <= 81D => "middle"
        case i if i <= 91D => "light heavy"
        case _ => "heavy"
      }
    }
  }
}

Measured memory_bytes: 43924
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int[][] table = new int[8][];
            table[1] = new int[] { 0, 0, 300, 500, 600, 700, 1350, 1650 };
            table[2] = new int[] { 0, 6, 0, 350, 450, 600, 1150, 1500 };
            table[3] = new int[] { 0, 13, 7, 0, 250, 400, 1000, 1350 };
            table[4] = new int[] { 0, 18, 12, 5, 0, 250, 850, 1300 };
            table[5] = new int[] { 0, 23, 17, 10, 5, 0, 600, 1150 };
            table[6] = new int[] { 0, 43, 37, 30, 25, 20, 0, 500 };
            table[7] = new int[] { 0, 58, 52, 45, 40, 35, 15, 0 };

            while (true)
            {
                int s = int.Parse(Console.ReadLine());

                if (s == 0) break;

                bool flg = false;

                string[] input = Console.ReadLine().Split(' ');
                int h = int.Parse(input[0]);
                int m = int.Parse(input[1]);
                flg = CheckTime(h, m);

                int t = int.Parse(Console.ReadLine());

                if (!flg)
                {
                    input = Console.ReadLine().Split(' ');
                    h = int.Parse(input[0]);
                    m = int.Parse(input[1]);
                    flg = CheckTime(h, m);
                }
                else Console.ReadLine();

                int min = Math.Min(s, t);
                int max = Math.Max(s, t);

                int p = table[min][max];

                if (flg && table[max][min] <= 40)
                {
                    p /= 2;

                    int q = p % 50;
                    if (q > 0) p = p - q + 50;
                }
                sb.AppendLine(p.ToString());
            }
            Console.Write(sb);
        }

        static bool CheckTime(int h, int m)
        {
            switch (h)
            {
                case 17:
                    return m >= 30;
                case 18:
                    return true;
                case 19:
                    return m <= 30;
                default:
                    return false;
            }
        }
    }
}

Measured memory_bytes: 9148
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0: break
    for j in range(h):
        for i in range(w):
            if i == 0 or j == 0 or i == w-1 or j == h-1:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()




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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

vi g[110];
vi f, d;
int t = 1;

void dfs(int v, int p=-1){
    d[v] = t++;
    for(auto u : g[v]){
        if(u == p || d[u] != 0) continue;
        dfs(u, v);
    }
    f[v] = t++;
};

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n; cin >> n;
    rep(i,n){
        int u,k; cin >> u >> k;
        rep(j,k){
            int v; cin >> v;
            g[u].push_back(v);
        }
    }

    f = vi(n+1), d = vi(n+1);
    REP(i,1,n+1){
        if(d[i] == 0) dfs(i);
    }
    REP(i,1,n+1){
        printf("%d %d %d\n", i, d[i], f[i]);
    }
    return 0;
}


Measured memory_bytes: 3292
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    // Your code here!
    double r;
    double pi = 3.141592653589;
    
    cin >> r;
    
    printf("%f %f\n",r*r*pi, 2*r*pi);
    return 0;
}



Measured memory_bytes: 3268
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

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

	int cnt[2] = {0};
	for(auto it=s.begin(); it!=s.end(); it++)
		if(*it == 'g')
			cnt[0]++;
		else
			cnt[1]++;

	int ret = s.size() / 2 - cnt[1];

	cout << ret << endl;

	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s=sc.next().toCharArray(),t=sc.next().toCharArray();
		Arrays.sort(s);
		Arrays.sort(t);
		String sd = new String(s);
		String td = new String(t);
		td = new StringBuilder(td).reverse().toString();
		System.out.println(sd.compareTo(td)<0?"Yes":"No");
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 1000000000000000000;
const ll mininf = -9223372036854775807;
const ll nax = 0;
ll ans=1, a, n;
bool nol;

int main(){
	IOS
	cin >> n;
	ll arr[n+5];
	for(int i=0;i<n;i++){
		cin >> arr[i];
		if(arr[i]==0){
			cout << 0 << '\n'; return 0;
		}
	}
	for(int i=0;i<n;i++){
		if(arr[i]<=inf/ans){
			ans*=arr[i];
		}
		else{
			cout << -1 << '\n'; return 0;
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 4380
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int A=nextInt();
		int B=nextInt();

		String ans = "Zero";
		if(A<= 0){
			if(B>=0){
				ans = "Zero";
			}else{
				int n = Math.abs(B-A)+1;
				if(n%2==0){
					ans = "Positive";
				}else{
					ans = "Negative";
				}
			}
		}else {
			ans = "Positive";
		}
		System.out.println(ans);

	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21076
#include <iostream>
using namespace std;
 
int main() {
  int a, b, c, d;
	cin >> a >> b >> c >> d;
  if (a + b > c + d){
	cout << "Left" << endl;
  }
  else if (a + b < c + d){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
using namespace std;
int main(){
	int a,b;
	string op;
	while(1){
	cin>>a>>op>>b;
	if(op=="+"){
		cout<<a+b<<endl;
	}
	else if(op=="-"){
			cout<<a-b<<endl;
		}
	else if(op=="*"){
			cout<<a*b<<endl;
		}
	else if(op=="/"){
			cout<<a/b<<endl;
		}
	if(op=="?"){
		break;
	}
	}
	return 0;
	}

Measured memory_bytes: 1204
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long int
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 998244353
#define ll_MAX 19223372036859
#define endl "\n"
inline ll absdiff(ll a,ll b){ return (a>b)?a-b:b-a;}
ll fast_expo(ll x,ll p){if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  else return gcd(b%a,a); }

int main()
{
    fast
    ll q;q = 1;
    // cin>>q;
    for (ll t = 0; t < q; ++t)
    {
        ll n;cin>>n;
        if(n%2==1) {
            cout<<0;
            return 0;
        }
        n/=2;
        ll ans=0;
        while(n>0){
            ans+=n/5;
            n=n/5;
        }
        cout<<ans;
    }   
    return 0;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MO = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define rt return
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    CIN(N);CIN(K);
    if(N%2 == 1)N++;
    YES(N/2 >= K);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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







// a^n mod を計算する
long long modpow(long long a, long long n, long long MOD) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}

long long kaijo(long long x, long long y) {
	ll res = 1;
	for (int i = x; i > x - y; i--)res = res * i % mod;
	return res;
}

ll n, a, b, ans;
ll acom, bcom;


int main() {

	cin >> n >> a >> b;

	acom = kaijo(n, a) * modpow(kaijo(a, a), mod - 2, mod) % mod;
	bcom = kaijo(n, b) * modpow(kaijo(b, b), mod - 2, mod) % mod;

	ans = modpow(2, n, mod) - 1;

	cout << ((ans + mod) - ((acom + bcom) % mod)) % mod << endl;

	return 0;
}


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

ll m = 1000000007;

ll bigmod(ll n, ll p) {
	if (p == 0) return 1;
	ll half = bigmod(n, p / 2);
	ll res = (half * half) % m;
	if (p % 2 == 0) return res;
	return (n * res) % m;
}

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

	ll n;
	cin >> n;

	ll ans = (bigmod(10, n) - 2LL * bigmod(9, n) + bigmod(8, n)) % m;
	if (ans < 0) ans += m;

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

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ll long long

using namespace std;

// input
ll n,k;


struct MyPair{
    int a;
    int b;

    MyPair(int c,int d){
        a = c;
        b = d;
    }

    bool operator<(const MyPair& another) const {
        return a < another.a;
    }

};

vector<MyPair> vec;

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

    cin >> n >> k;

    int a,b;

    while(cin >> a && cin >> b){
        vec.push_back(MyPair(a,b));
    }

    sort(vec.begin(),vec.end());

    for(auto el:vec){
        if(k - el.b > 0){
            k -= el.b;
        }
        else{
            cout << el.a << "\n";
            break;
        }
    }
    
}

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

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

  for (int i = 0; i < (1<<3); i++) {
    bitset<3> b(i);
    int tmp = s[0] - '0';
    if (b[0]) {
      tmp += s[1] - '0';
    }
    else {
      tmp -= s[1] - '0';
    }
    if (b[1]) {
      tmp += s[2] - '0';
    }
    else {
      tmp -= s[2] - '0';
    }
    if (b[2]) {
      tmp += s[3] - '0';
    }
    else {
      tmp -= s[3] - '0';
    }
    if (tmp == 7) {
      cout << s[0];
      if (b[0]) cout << '+' << s[1];
      else cout << '-' << s[1];
      if (b[1]) cout << '+' << s[2];
      else cout << '-' << s[2];
      if (b[2]) cout << '+' << s[3];
      else cout << '-' << s[3];
      cout << "=7" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
//h10-3 つらら(Atcoder)
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace boost_multiprecision = boost::multiprecision;
#define LL long long
#define CINT boost_multiprecision::cpp_int
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int N,L;
int a[100005];

LL dp[100005];
LL solve(int t){
    if(dp[t] != -1){

    }
    else if(a[t-1] < a[t] && a[t] > a[t+1]){
        dp[t] = L - a[t];
    }
    else if(a[t-1] < a[t]){
        dp[t] = solve(t+1) + L - a[t];;
    }
    else if(a[t] > a[t+1]){
        dp[t] = solve(t-1) + L - a[t];
    }
    else{
        dp[t] = max( solve(t-1) , solve(t+1) ) + L - a[t];
    }
    return dp[t];
}

int main(){
    cin >> N >> L;
    a[0] = 0;
    dp[0] = 0;
    for(int i=0; i<N; i++){
        cin >> a[i+1];
        dp[i+1] = -1;
    }
    a[N+1] = 0;
    dp[N+1] = 0;
    
    LL ans = 0;
    for(int i=0; i<N; i++){
        ans = max(ans,solve(i+1));
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 5252