akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)


int main(){
  int n; cin>>n;
  string ans="Yes";
  vector<vector<int>> v(n,vector<int>(3));
  rep(i,n){
    cin>>v[i][0]>>v[i][1]>>v[i][2];
  }
  int t,x,y;
  rep(i,n){
    if(i==0){
      t=v[0][0];x=v[0][1];y=v[0][2];
    }
    else{
      t=v[i][0]-v[i-1][0];
      x=max(v[i][1]-v[i-1][1],-v[i][1]+v[i-1][1]);
      y=max(v[i][2]-v[i-1][2],-v[i][2]+v[i-1][2]);
    }
    if((-t+x+y)%2!=0||t<x+y){ans="No";break;}
  }
  cout<<ans;
}

Measured memory_bytes: 5760
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

	int n;
	cin>>n;
	vi in(n);
	cin>>in;
	in.pb(0);
	int w=0,c=0;
	rep(i,n)if(in[n-i-1]>=in[n-i])c++,cmax(w,c);
	else c=1;

	cout<<w-1<<endl;

}


Measured memory_bytes: 1792
import scala.util.Random

object Main {
  def main(args:Array[String]) {
    val N = readLine().toInt
    var ans = 0d
    if(N % 2 == 1) ans = (N / 2 + 1).toDouble / N
    else ans = (N / 2).toDouble / N
    println(ans)
  }
}



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

int main() {
    int H, W;
    cin >> H >> W;

    //入力によってマインスイーパーの盤を作る
    //隅と辺の例外を避けたいので(H+2)*(W+2)の大きさの盤をつくる
    vector<vector<char>> mines(H+2, vector<char>(W+2));
    //1*1からH*Wまで入力でうめる(盤の一番外側のマスは初期値のまま)
    for (int i = 1; i < H+1; i++) {
        for (int j = 1; j < W+1; j++) {
            cin >> mines.at(i).at(j);
        }
    }


    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            if (mines.at(i).at(j) == '.') { //'.'かどうか確認する
                char mine_count = '0'; //特定の1マスについてmine_countという変数を設定する
                //(i,j)の周り8マスに'#'があるか探索
                for (int k = 0; k < 3; k++) {
                    for (int l = 0; l < 3; l++) {
                        if (mines.at(i+k-1).at(j+l-1) == '#')
                            mine_count++;
                    }
                }
                mines.at(i).at(j) = mine_count; //'#'の個数で置き換える
            }
            cout << mines.at(i).at(j);
            if (j == W)
                cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#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 repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define o_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
#define trav(it, v) for(auto &it : v)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 	return r;
}


void solve()
{
	int n;
	cin >> n;
	int s[n];
	rep(i, n) cin >> s[i];
	sort(s, s + n);
	int sum = accumulate(s, s + n, 0);
	if(sum % 10 == 0){
		rep(i, n) if(s[i] % 10 != 0) {
			sum -= s[i];
			break;
		}
	}
	if(sum % 10) cout << sum;
	else cout << 0;

}
int main()
{
    Red;
    // freopen("black.in", "r", stdin);
	// freopen("black.out", "w", stdout);
    int T = 1;
    // cin >> T;
    for(int i = 1; i <= T; ++i) {
    	// cout << "Case #" << i << ": ";
    	solve();
  	}
  	return 0;

}


Measured memory_bytes: 3624
#include <stdio.h>
int main(void)
{
	int a,b=0,c=0,e,d,f,i,j,team[10000]={0},k[100]={0};
	scanf("%d",&a);
	for(i=0;i<a-1;i++){
		for(j=i;j<a-1;j++){
			b++;
		}
	}
	for(i=0;i<b;i++){
		scanf("%d %d %d %d",&c,&d,&e,&f);
		if(e>f){
			team[c]=team[c]+3;
		}
		else if(f>e){
			team[d]=team[d]+3;
		}
		else{
			team[c]=team[c]+1;
			team[d]=team[d]+1;
		}
	}
	/*for(i=1;i<a+1;i++){
		printf("%d\n",team[i]);
	}
	printf("\n");
	*/
	d=1;
	f=0;
	for(i=1000;i>0;i--){
		for(j=1;j<a+1;j++){
			if(i == team[j]){
				k[j]=d;
				f++;
			}
		}
		if(f>=1){
			d=d+f;
			f=0;
		}
	}
	for(i=1;i<a+1;i++){
		printf("%d\n",k[i]);
	}
	return 0;
}

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

int kakezan(int x) {
  int a;
  for (int i = 1; i <= 9; i++) {
    a = x * i;
    cout << x;
    cout << "x";
    cout << i;
    cout << "=";
    cout << a;
    cout << endl;
  }

  return 0;
}

int main(){
  for (int k = 1; k <= 9; k++) {
    kakezan(k);
  }

  return 0;
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
 using namespace std;
 
 // #define  int           long long
 #define pb                push_back
 #define ppb               pop_back
 #define pf                push_front
 #define ppf               pop_front
 #define all(x)            (x).begin(),(x).end()
 #define uniq(v)           (v).erase(unique(all(v)),(v).end())
 #define sz(x)             (int)((x).size())
 #define fr                first
 #define sc                second
 #define pint              pair<int,int>
 #define rep(i,a,b)        for(int i=a;i<b;i++)
 #define mem1(a)           memset(a,-1,sizeof(a))
 #define mem0(a)           memset(a,0,sizeof(a))
 #define ppc               __builtin_popcount
 #define ppcll             __builtin_popcountll
 #define vint			   vector<int>
 #define vpint			   vector<pair<int,int>>
 #define mp                make_pair


 void reader() 
 { 
 #ifndef ONLINE_JUDGE 
 freopen("input.txt","r",stdin);
 freopen("output.txt","w",stdout); 
 #endif
 }
 
 void fastIO() {ios_base::sync_with_stdio(false); cin.tie(NULL);}
 
 
 
 void solve1()
 {
 string s,t;
 cin>>s>>t;
 int m=s.length();
 int n=t.length();
 int dp[m+1][n+1];
 for(int i=0;i<=m;i++)
 	dp[i][0]=0;
 for(int i=0;i<=n;i++)
  dp[0][i]=0;
for(int i=1;i<=m-n+1;i++)
	for(int j=1;j<=n;j++)
	{
		if(s[i-1]==t[j-1])
			dp[i][j]=1+dp[i-1][j-1];
		else
			dp[i][j]=0;
	}
	int maxi=0;
	int indi,indj;

	for(int i=1;i<=m-n+1;i++)
	for(int j=1;j<=n;j++)
		if(maxi<dp[i][j])
		{
			indi=i;
			indj=j;
			maxi=dp[i][j];
		}

 cout<<n-maxi;
 cout<<"\n";
 }
 
 void solve2()
 {
 	string s,t;
 	cin>>s>>t;
 	int m=s.length();
 	int n=t.length();
 	int j=0,maxi=0,ctr=0;
 	for(int i=0;i<m-n+1;i++)
 	{
 		while(s[i]==t[j])
 		{
 			i++;
 			j++;
 			ctr++;
 		}
 		maxi=max(maxi,ctr);
 		j=0;
 		ctr=0;
 	}

 	cout<<n-maxi;
 }
 
 void solve()
 {
 	string s,t;
 	cin>>s>>t;
 	int m=s.length();
 	int n=t.length();
 	int ctr=0,maxi=0;
 	for(int i=0;i<m-n+1;i++)
 	{
 		int ctr=0;
 		for(int j=0;j<n;j++)
 		{
 			if(s[i+j]==t[j])
 				ctr++;
		}
 		maxi=max(maxi,ctr);
 	}
 	cout<<n-maxi;
 }

 signed main()
 {
 	reader(); fastIO();
 	long long t=1;
 	//cin>>t;
 	while(t--) solve();
 	return 0;
 }

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		String[] c = new String[h];
		for(int i = 0; i < h; i++) {
			c[i] = sc.next();
		}
		String ans;
		for(int i = 0; i < h; i++) {
			ans = c[i];
			System.out.println(ans);
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 25300
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
    cin >> s;
    string t = "";
    for(int i = s.size()-1; i >= 0; --i) {
        t += s[i];
        if(t=="maerd" || t=="remaerd" || t=="esare" || t=="resare") {
            t = "";
        }
    }
    if(t == "") cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

void solve(std::string S){
    string t = "2019/04/30";
    if (S <= t) cout << "Heisei" << '\n';
    else cout << "TBD" << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
#include <chrono>
#include <random>
#include <ctime>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 998244353;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	srand(time(0));
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, s;
	cin >> n >> s;
	vector<ll> a(n);
	for (int i = 0; i < n; i++)cin >> a[i];
	vector<ll> dp(s + 1);
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		int x = a[i];
		for (int j = s - x; j >= 0; j--) {
			dp[j + x] += dp[j];
			dp[j + x] %= MOD;
		}
		if (x <= s) {
			dp[x] += i + 1;
			dp[x] %= MOD;
		}
		ans += dp[s];
		ans %= MOD;
	}
	cout << ans;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int,int> pii; typedef priority_queue<int> qi;
#define fi first
#define se second
const int maxn = 100000;
int N,M,i,ans; pii job[maxn]; qi pq;
int main() {
    scanf("%d%d",&N,&M);
    for (i = 0;i < N;i++) scanf("%d%d",&job[i].fi,&job[i].se);
    sort(job,job+N);
    i = 0; for (int j = 0;j <= M;j++) {
        for (;i < N && job[i].fi == j;i++) pq.push(job[i].se);
        if (!pq.empty()) ans+=pq.top(),pq.pop();
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 1660
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            int w = sc.nextInt();
            int d = sc.nextInt();
            if(w==0 && d==0) break;

            int[] h1 = new int[w];
            int[] h2 = new int[d];
            for(int i=0; i<w; i++) h1[i] = sc.nextInt();
            for(int i=0; i<d; i++) h2[i] = sc.nextInt();

            int cnt = 0;
            for(int i=0; i<w; i++){
                boolean boo = false;
                for(int j=0; j<d; j++){
                    if(h2[j]==-1) continue;
                    if(h1[i]==h2[j]){
                        cnt += h1[i];
                        h1[i] = h2[j] = -1;
                        boo = true;
                        break;
                    } 
                }
                if(!boo){
                    for(int j=0; j<d; j++){
                        if(h2[j]==-1) continue;
                        if(h1[i]<h2[j]){
                            cnt += h1[i]; 
                            h1[i] = -1;
                            break;
                        }
                    }
                }
            }
            for(int i=0; i<d; i++){
                if(h2[i]!=-1) cnt += h2[i];
            }
            for(int i=0; i<w; i++){
                if(h1[i]!=-1) cnt += h1[i];
            }
            System.out.println(cnt);
        }
    }

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

Measured memory_bytes: 23268
import java.util.Scanner;

public class Main {

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

		while (true) {
			int n = scan.nextInt();
			if (n == 0)
				break;
			int[] s = new int[n];
			double m = 0;
			for (int i = 0; i < n; i++) {
				s[i] = scan.nextInt();
				m += s[i];
			}
			m /= n;
			double a = 0;
			for (int i = 0; i < n; i++) {
				a += Math.pow(s[i] - m, 2);
			}
			a = Math.sqrt(a / n);

			System.out.println(a);

		}

		scan.close();
		System.exit(0);
	}

}

Measured memory_bytes: 31244
#pragma GCC optimize ("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<cmath>
#include<cstdio>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<utility>
#include<valarray>
#include<vector>
#include<array>
#include<forward_list>
#include<random>
#include<ratio>
#include<tuple>
#include<unordered_map>
#include<unordered_set>
#include<cstring>

using namespace std;
using Int = long long; using uint = unsigned int; using uInt = unsigned long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; ++i)
#define rer(i,l,r) for(int i=l; i<=r; ++i)
#define gnr(i,l,r) for(int i=r; i>=l; --i)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
#define priend(a) {cout<<(a)<<'\n'; return 0;}
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char ch;

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

  cin>>n; Pi a[n],b[n];
  rep(i,n){cin>>a[i].fi; a[i].se=i;}
  rep(i,n){cin>>b[i].fi; b[i].se=i;}
  sort(a,a+n); sort(b,b+n);
  rep(i,n)if(a[i].fi>b[i].fi)priend("No")
  rep(i,n-1)if(a[i+1].fi<=b[i].fi)priend("Yes");
  int p[n];
  rep(i,n)p[a[i].se]=b[i].se;
  int x=p[0],l=1;
  while(x){
    x=p[x]; l++;
  }
  priend(l==n?"No":"Yes");
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pie 3.142857143
#define ll long long int
#define fr(i,a,n) for(ll i=a;i<n;i++)
#define vi vector<int>
#define vlli vector<ll>
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fv(i,a) for(auto i:a)
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define frv(i,c) for(auto i = c.begin(); i != c.end(); i++)
vector<ll> dp(1000004,INT_MAX);
int main() {
    ll n,t,m;cin>>n>>m;t=0;
    ll w[n+1],val[n+1];
    dp[0]=0;
    for(int i=0;i<n;i++){cin>>w[i]>>val[i];t+=val[i];}
    // cout<<t<<"\n";
    for(int i=0;i<n;i++)
    {
        for(int j=t;j>=1;j--)
        {
            if((j-val[i]>0 && dp[j-val[i]]) || j==val[i])
                dp[j]=min(dp[j],dp[j-val[i]]+w[i]);
        }
    }
    ll mx=0;
    for(ll i=1;i<=t;i++)if(dp[i]<=m)mx=max(mx,i);
    cout<<mx<<"\n";
    return 0;
}

Measured memory_bytes: 11004
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, k;
    string s;
    cin >> n >> k >> s;

    int ans = 0;
    rep(i, n - 1) {
        if (s[i] == s[i+1]) ans++;
    }

    // 中身は変わらない。両端が増える。
    ans += k * 2;
    cout << min(n - 1, ans) << endl;


    return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	
	int ans[2] ={};
	rep(i, sz(s)){
		if(i%2==0 && s[i]=='0' || i%2==1 && s[i]=='1') ans[0]++;
		if(i%2==1 && s[i]=='0' || i%2==0 && s[i]=='1') ans[1]++;
	}
	cout << min(ans[0], ans[1]) <<endl;
	return 0;
}


Measured memory_bytes: 512
/*
	http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0007
	Debt Hell
*/

#include <stdio.h>
int main(void)
{
	int n,i,debt,temp;
	debt = 100000;
	scanf("%d", &n);

	for (i = 0; i < n; ++i)
	{
		debt = debt * 1.05;
		temp = debt % 1000;
		if (temp != 0)
		{
			debt = debt - temp + 1000;
		}
	}

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

Measured memory_bytes: 592
import java.io.IOException;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int f;
        int num = readInt(new StringBuilder());
        int[] arr = new int[num];
        Arrays.fill(arr, 0);
        for (int x = 1; x < 100; x++) {
            for (int y = 1; y < 100; y++) {
                for (int z = 1; z < 100; z++) {
                    f = x * x + y * y + z * z + x * y + y * z + z * x;
                    if (f > num) {
                        break;
                    }

                    arr[f - 1] = arr[f - 1] + 1;
                }
            }
        }

        for (int i = 0; i < num; i++) {
            System.out.println(arr[i]);
        }
    }

    private static int readInt(StringBuilder builder) {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }

        return Integer.parseInt(builder.toString());
    }

}


Measured memory_bytes: 35468
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (;;) {
            int n = sc.nextInt();
            if(n==0)break;
            double u=2000001;
            int p=0;
            for(int i=0;i<n;i++) {
                int a=sc.nextInt(),b=sc.nextInt();
                double t=Math.abs(22-(double)sc.nextInt()*10000/b/b);
                if(u>t) {
                    u=t;
                    p=a;
                }
            }
            System.out.println(p);
        }
    }
}


Measured memory_bytes: 37172
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pl pair<ll,ll>
#define plp pair<ll,pl>
#define ppl pair<pl,ll>
#define pb push_back
#define pi acos(-1.0)
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define vl vector<ll>
#define mp make_pair
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define vll vector<vector<ll>>
#define all(a) a.begin(),a.end()
#define INF 1e9+5
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
using namespace std;
 
 //ll n,m;
ll MOD1=1000000007;
ll MOD2=998244353;
 
 
void yes() {cout<<"YES"<<endl;}
void no() {cout<<"NO"<<endl; }
/*
ll gcd(ll a,ll b);
ll lcm(ll a, ll b);
ll mod_exp(ll x,ll power,ll m);
ll ext_gcd(ll a,ll b,ll& x,ll& y);
void swap(ll& a,ll& b);
ll root(vector<ll>& arr,ll a);
void Union(vector<ll>& arr,ll a,ll b);
const ll N=32001;
vl fenwick(N,0);
void update(ll index,ll add);
ll sum(ll index);
ll find_kth_smalest(ll k);
ll find(ll k);
ll ETF(ll n);
*/
 
 
ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a, a);
}
 
ll lcm(ll a, ll b)
{
    return ( a*b/(gcd(a,b)));
}
 
//void sieve();
//vector<ll> factorise(1000+2,-1);
//vector<ll> prime(20005,1);
//vl fug;
//void p();
//void fact();
 
 
/*
void sieve()
{
    prime[0]=prime[1]=0;
    for(ll i=2;i<=sqrt(2005);i++)
    {
        if(prime[i]==1)
        {
            for(ll j=i*i;j<2005;j+=i)
                prime[j]=0;
        }
    }
}
*/


ll mincost(vl& height,ll i,vl& dp)
{
    if(i==height.size()-1)
        return 0;
    
    if(dp[i]!=-1) return dp[i];
    
    if(i+2<height.size())
        return dp[i]= min(abs(height[i+1]-height[i])+mincost(height, i+1,dp), abs(height[i+2]-height[i])+mincost(height, i+2,dp));
    else
        return dp[i]=abs(height[i+1]-height[i]) + mincost(height, i+1,dp);
   
        
}


void solve()
{
    ll n; cin>>n; vl height(n); rep(i,0,n-1) cin>>height[i];
    
    vl dp(n+1,-1);
    
    cout<<mincost(height, 0,dp)<<endl;
    
   
    
    
    
    
    
    
    
 
    
}
 
int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll tests=1;
    //cin>>tests;
    while (tests--) {
        solve();
    }
    return 0;
}
 
 

Measured memory_bytes: 8736
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    string s;
    int m , h;

    while(cin >> s){
        if (s=="-")break;
        cin >> m;
        for (int i=0;i<m;i++){
            cin >> h;
            // shuffle
            s = s.substr(h, s.length()-h) + s.substr(0, h);
        }
        cout << s << endl;

    };
}


Measured memory_bytes: 3196
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n;
  double ans=0,x;
  string y;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> x >> y;
    if(y=="JPY") {
      ans+=x;
    }
    else {
      ans+=x*380000.0;
    }
  }
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,i;
  char a[999];
  for(;scanf("%d",&n);)
    {
      if(n==-1)exit(0);
      for(i=0;n>3;i++)
	{
	  a[i]='0'+(n%4);
	  n/=4;	  
	}
      putchar('0'+n);
      for(;i--;)
	{
	  putchar(a[i]);
	
	}
      puts("");
    }
}

Measured memory_bytes: 0
import java.util.Scanner;

class Main {

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

		long sum = 0;
		for (int i = 0; i < N; i++) {
			sum += i + 1;
		}

		System.out.println(sum);
	}
}


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

#define rep(i,a,b)     for(int i=a;i<(b);i++)
#define lop(n)         for(int i=0;i<n;i++)
#define revlop(n)      for(int i=n-1;i>=0;i--)
#define trav(a,x)      for(auto &a :x)
#define all(x)         begin(x),end(x)
#define mod            1000000007
#define inf            1e18
#define ps(x,y)        fixed<<setprecision(y)<<x
#define w(x)           int x; cin>>x;

#define pb             push_back
#define mp             make_pair
#define lb             lower_bound
#define ub             upper_bound
#define bs             binary_search
#define F              first
#define S              second

typedef long long                ll;
typedef vector<int>              vi;
typedef pair<int, int>           pii;
typedef vector<pair<int, int>>   vpii;
typedef vector<pair<ll, ll>>     vpll;
ll a[200005];
ll pre[200005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ll n;
  cin >> n;

  rep(i, 0, n)
  {
    cin >> a[i];
  }
  sort(all(a), greater<int>());
  rep(i, 0, n)
  {
    if (!i)
      pre[i] = a[i];
    else
      pre[i] = (a[i] + pre[i - 1]) % mod;
  }
  ll ans = 0;
  rep(i, 1, n)
  {
    ans = (ans % mod + (pre[i - 1] * a[i]) % mod) % mod;
  }
  cout << ans;
  return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


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

ll dp[100010][3];
int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin >> n;
    VVI point(n,VI(3,0));
    rep(i,n){
        rep(j,3){
            cin >> point[i][j];
        }
    }

    rep(i,n){
        rep(j,3){
            dp[i+1][j] = max(dp[i][(j+1)%3], dp[i][(j+2)%3]) + point[i][j];
        }
    }
    ll ans = 0;
    rep(i,3) ans = max(ans,dp[n][i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
N = int(input())
A = input().split()
answer = 1
flag = 0
x = 10**18

if '0' in A:
  print(0)
  flag = 1
  


if flag == 0:
  for i in range(N):
    answer *= int(A[i])
    if answer > x:
      print(-1)
      flag = 1
      break

if flag == 0:    
  print(answer)

Measured memory_bytes: 19532
/*input
3 4
1 2 3
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll add(ll a,ll b)
{
    return (a%mod+b%mod)%mod;
}

ll sub(ll a,ll b)
{
    return (a%mod-b%mod+mod)%mod;
}


int main() 
{
    off;
    ll n,k,share,sum,up;
    cin>>n>>k;
    ll dp[n+1][k+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(ll child=1;child<=n;child++)
    {
        cin>>up;
        sum=0;
        for(ll used=0;used<=k;used++)
        {
            sum=add(sum,dp[child-1][used]);
            if(used-up-1>=0)
                sum=sub(sum,dp[child-1][used-up-1]);
            dp[child][used]=sum;
        }
    }
    cout<<dp[n][k]%mod;
    return 0;
}

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

int main(){
  
  string S;
  cin >> S;
  
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int N, A, B;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else{ cin >> A >> B;
	cout << A + B << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define black_tree tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define pair_black_tree tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update>
#define gp __gnu_pbds
#define INF 1000000000
#define MOD 1000000007
#define MAX 1000001
#define endl '\n'
#define ll long long
#define ld long double
#define lli long long int
#define ull unsigned long long
#define ulli unsigned long long int
#define pb push_back
#define pf push_front
#define ook order_of_key
#define fbo find_by_order
#define np next_permutation
#define mp make_pair
#define eb emplace_back
#define mae max_element
#define mie min_element
#define lb lower_bound 
#define ub upper_bound
#define bs binary_search
#define ff first
#define ss second
using namespace std;
using namespace gp;
vector<ll>a,b;
ll n,x,y;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    while(n--){
    	cin>>x>>y;
    	a.pb(x+y);
    	b.pb(x-y);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	cout<<max(a[a.size()-1]-a[0],b[b.size()-1]-b[0]);
}

Measured memory_bytes: 6684
#include <stdio.h>
#include <ctype.h>

int main(){
  char ch;
  int counter[26] = {};
  for( int i = 0; i < 26; i++ ) counter[i] = 0;

  while( scanf( "%c", &ch ) != EOF ){
    ch = tolower(ch);
    if ( isalpha(ch) ) counter[ch-'a']++;
  }

  for ( int i = 0; i < 26; i++ ) {
    printf( "%c : %d\n", i+'a', counter[i] );
  }

  return 0;
}

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

using namespace std;

int main(){
  int n,c=0,k;
  cin>>n;
  int a[100005]={0};
  for(int i=0;i<n;i++){
    cin>>k;
    a[k]++;
  }
  for(int i=2;i<=100000;i++){
    int m=0;
    m=a[i-2]+a[i-1]+a[i];
    c=max(c,m);
  }
  cout<<c<<endl;
}


Measured memory_bytes: 640
S = input() + 'Z'
K = int(input())

n = 0
x = S[0]
T = []

for s in S:
    if s == x:
        n += 1
    else:
        x = s
        if n != 0:
            T.append(n)
            n = 1

if len(T) == 1:
    ans = (T[0]*K) // 2
elif  K==1 or S[0]!=S[-2]:
    ans = K * sum([t//2 for t in T])
else:
    ans = K * sum([t//2 for t in T[1:-1]]) + T[0]//2 + T[-1]//2 + (K-1)*((T[0]+T[-1])//2)
    
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder_b_085
{
    class _01
    {
        static void Main()
        {
            String ymd_before = Console.ReadLine();
            String ymd_after = ymd_before.Replace("2017", "2018");
            Console.WriteLine(ymd_after);
        }
    }
}


Measured memory_bytes: 13140
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
diff = 1000
for i, h in enumerate(H):
    if diff > abs(A - (T-h*0.006)):
        ans = i+1
    diff = min(diff, abs(A - (T-h*0.006)))
print(ans)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    if(str.substring(2,3).equals(str.substring(3,4))
       && str.substring(4,5).equals(str.substring(5,6)))
       System.out.println("Yes");
       else
       System.out.println("No");
  }
}

Measured memory_bytes: 21332
import java.io.*;

public class Main {
    public static void main(String[] args) {
        try {
            BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
            String input;
            input = r.readLine();
            System.out.println(swap(input));
        } catch (Exception e) {}
    }

    public static String swap(String s) {
        String tmp_s;
        tmp_s = s.replaceAll("apple", "xxxxxxxxxxx");
        tmp_s = tmp_s.replaceAll("peach", "apple");
        tmp_s = tmp_s.replaceAll("xxxxxxxxxxx", "peach");
        return tmp_s;
    }
}

Measured memory_bytes: 9132
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 500020;
const double pi = acos(-1); const double EPS = 1e-8;
const ll INF = 1e12;


int calc(string s) {
	int ans = 0;
	ans += 36000 * (s[0] - '0');
	ans += 3600 * (s[1] - '0');
	ans += 600 * (s[3] - '0');
	ans += 60 * (s[4] - '0');
	ans += 10 * (s[6] - '0');
	ans += (s[7] - '0');
	//pe(s); cout << ":" << ans << endl;
	return ans;
}
void solve() {
	int N; cin >> N;
	if (N == 0)exit(0);
	vector<P>v;
	REP(i, N) {
		string S, T; cin >> S >> T;
		//pe(S); print(T);
		int l = calc(S), r = calc(T);
		v.push_back({ l,r });
	}
	VSORT(v);
	priority_queue<int,vector<int>,greater<int>>que;
	int ans = 0;
	REP(i, N) {
		int r = v[i].second, l = v[i].first;
		while (!que.empty()) {
			if (que.top() <= l)que.pop();
			else break;
		}
		chmax(ans, que.size() + 1);
		que.push(r);
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)

	while(true)
	solve();
}




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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll n, m, k; cin >> n >> m >> k;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<ll> b(m);
    vector<ll> b_sum(m + 1, 0);
    for (ll i = 0; i < m; ++i) {
        cin >> b[i];
        b_sum[i + 1] = b_sum[i] + b[i];
    }

    ll ans = 0;
    ll sum = 0;
    for (ll i = -1; i < n; ++i) {
        if (i >= 0) {
            sum += a[i];
        }
        ll cnt = i + 1;

        ll t = k - sum;
        if (t < 0) break;

        auto itr = upper_bound(b_sum.begin(), b_sum.end(), t);
        cnt += (itr - b_sum.begin()) - 1;
        ans = max(ans, cnt);
    }

    cout << ans << endl;
}

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

int main(int argc, char const *argv[]) {
	int a, b; cin >> a >> b;
	if (a >= 13) printf("%d\n", b);
	else if (a >= 6) printf("%d\n", b / 2);
	else printf("0\n");
	return 0;
}


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

int a, b, d;

struct info{
    int x;
    int y;
    info(int x, int y):x(x),y(y){}
    info(){}
    bool operator<(const info& t) const{
        if(x + y == t.x + t.y) return (a * x + b * y < a * t.x + b * t.y);
        else return x + y < t.x + t.y;
    }

    bool operator>(const info& t) const{
        if(x + y == t.x + t.y) return (a * x + b * y > a * t.x + b * t.y);
        else return x + y > t.x + t.y;
    }
};


int main(){

    while(1){
        cin >> a >> b >> d;
        if(!a) break;

        
        info ans(1000000, 10000000);
        
        for(int x = 100000; x >= 0; x--){
            
            if((a * x + d) % b == 0){
                
                int y = (a * x + d) / b;
                if(x >= 0 && y >= 0) ans = min(ans, info(x, y));
            }

            if((a * x - d) % b == 0){
                int y = (a * x - d) / b;
                if(x >= 0 && y >= 0) ans = min(ans, info(x, y));
                
            }

            if((d - a * x) % b == 0){
                int y = (d - a * x) / b;
                if(x >= 0 && y >= 0) ans = min(ans, info(x, y));
                
            }

        }

        cout << ans.x << " " << ans.y << endl;
    }

    return 0;
}


Measured memory_bytes: 3048
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	S := ReadString()
	if S[2] == S[3] && S[4] == S[5] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1836
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using i_i = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const ll mod = 1000000007LL;


int main() {
	int s;
	cin >> s;
	vector<int> cur(s + 1,0);

	int count = 0;

	cur[0] = 1;

	rep(i, s) {
		vector<int> next = cur;

		for (int j = i + 3; j <= s; j++) {
			next[j] = (next[j] + cur[i]) % mod;
		}
		cur = next;
	} 

	cout << cur[s] << endl;



	return 0;
}


Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define w while
#define loop(i,l,r) for(int i=l;i<r;i++)
#define ci cin>>
#define co cout<<
#define ll long long
using namespace std;
struct graph{
  int v;
  list<int> *l;
  graph(int a){
    v=a;
    l= new list<int>[a+1];
  }
  void add(int a,int b){
    l[a].push_back(b);
  }
};
int main()
{  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     int n,m;
     cin>>n>>m;
     graph g=graph(n);
     vector<int>ind(n+1,0),dp(n+1,0);
    loop(i,0,m){
      int a,b;
      cin>>a>>b;
      g.add(a,b);
      ind[b]++;
    }

    int ch=1;
    ll int best=0;
    queue<int>q;
       loop(i,1,n+1){
         if(ind[i]==0){
           q.push(i);
         }
       }
    while(ch){ch=0;
             while(!q.empty()){
               int i = q.front();
               q.pop();
            for(auto k : g.l[i]){
              ind[k]--;
              if(ind[k]==0)
               q.push(k);

               dp[k]=max(dp[k],dp[i]+1);
              if(best<dp[k])
              best=dp[k];
              }
             ch=1;}
           }
       cout<<best;
}


Measured memory_bytes: 5888
#include <iostream>
#define ll long long
#define ld long double
#define pi 3.14159
using namespace std;

int main(){
    ll n;
    cin >> n;
    ll ar[n+1], li[n+1] = {0};
    for(ll i = 2;i<=n;i++){
        cin >> ar[i];
        li[ar[i]]++;
    }
    for(ll i = 1;i<=n;i++){
        cout << li[i] << "\n";
    }
}


Measured memory_bytes: 6720
#include <cstdio> 
#include <algorithm>
using namespace std;
int main()
{
    int a[200000]={0},b[200000]={0};
    int n,k,i,j,count;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    j=0;
    count=0;
	for(i=0;i<n;i++)
	{
		if(a[i]==a[i+1])
		{
		    count++;
		}
		if(a[i]!=a[i+1])
        {
			b[j++]=count+1;
			count=0;
	    }
	}
	sort(b,b+j);
    count=0;
    for(i=0;i<j-k;i++)
        count+=b[i];
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 1664
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    println(problem144b(n))
}

fun problem144b(n: Int): String {
    for (i in 1..9) {
        for (j in 1..9) {
            if (i * j == n) return "Yes"
        }
    }
    return "No"
}

Measured memory_bytes: 31512
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	while(1)
	{
		int n,s;
		int ans=0;
		cin >> n >> s;
		if(n==0&&s==0)break;
		int comb=(1<<n)-1;
		while(comb<(1<<10))
		{
			int sum=0;
			for(int i=0;i<10;i++)
			{
				if((comb>>i)&1)sum+=i;
			}
			if(sum==s)ans++;
			int x=comb&-comb,y=comb+x;
			comb=((comb&~y)/x>>1)|y;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main(){
    int A, B;
    cin >> A >> B;
    if(A == B) cout << 2 * A << endl;
    else cout << 2 * max(A, B) -1 << endl;
}


Measured memory_bytes: 3596
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())-1])

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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N,C;
    cin >> N >> C;
    vector<vector<int>> A(N,vector<int> (3));
    rep(i,N) {
        int s,t,c;
        cin >> s >> t >> c;
        A[i][0] = s;
        A[i][1] = t;
        A[i][2] = c;  
    }
    sort(A.begin(),A.end());
    vector<pair<int,int>> B;

    int now = 0;

    rep(i,N) {
        int s,t,c;
        s = A[i][0];
        t = A[i][1];
        c = A[i][2];

        now = s;
        bool tu = true;
        rep(i,B.size()) {
            if (c==B[i].second) {
                if (now>=B[i].first) {
                    B[i].first = t;
                    tu = false;
                }
            }
            else {
                if (now>B[i].first) {
                    B[i].first = t;
                    B[i].second = c;
                    tu = false;
                }
            }

            if (!tu) break;
        }
        if (tu) {
            B.push_back(make_pair(t,c));
        }
    }

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

}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

inline vector<int> get_d(int n) {return vector<int>(n, INF);}
inline vector<ll> get_d(ll n) {return vector<ll>(n, LINF);}
template<typename T> vector<T> dijkstra(int s, vector<vector<pair<int, T>>>& g) {
    T n = sz(g);
    priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> q;
    vector<T> d = get_d(n);
    d[s] = 0;
    q.emplace(0, s);

    while (!q.empty()) {
        pair<T, int> p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (auto x : g[v]) {
            if (d[x.first] > d[v] + x.second) {
                d[x.first] = d[v] + x.second;
                q.emplace(d[x.first], x.first);
            }
        }
    }
    return d;
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<pair<int, ll>>> g(n, vector<pair<int, ll>>());
    int l, r;
    ll c;
    REP(i, m) {
        cin >> l >> r >> c;
        l--; r--;
        g[l].emplace_back(r, c);
    }
    REP(i, n - 1) g[i + 1].emplace_back(i, 0);
    vector<ll> d = dijkstra(0, g);
    cout << (d[n - 1] == LINF ? -1 : d[n - 1]) << EOL;
}


Measured memory_bytes: 9336
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

long long  mod = 1000000007;

int main(){
    vector<int> v(3);
    cin >>v[0] >> v[1] >> v[2];
    int ans = inf;
    for(int i=0;i<=60;i++){
        int tmp = 0;
        for(int j=0;j<3;j++){
            if(i==v[j]){
                continue;
            }else if(i>v[j]){
                if((i-v[j])%2==0){
                    tmp += (i-v[j])/2;
                }else{
                    tmp += (i-v[j])/2;
                    tmp+=2;
                }
            }else{
                tmp += v[j]-i;
            }
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256