akhauriyash/Code-Regression huggingface dataset:
// Author : SAGORIKA DAS
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
vector<int> adj[MAX];
int n, k, ans = 0, depth[MAX], d[MAX];

int dfs(int u){
	int ret = 0;
	for(int i=0;i<adj[u].size();i++){
		int v = adj[u][i];
		int sz = dfs(v);
		if(u != 1 && sz >= k-1) ans++;
		else{
			ret = max(ret, sz+1);
		}
	}
	return ret;
}

int main() {
    //fr;fw;
    cin >> n >> k;
    FOR(i,1,n){
    	int x;
    	cin >> x;
    	if(i == 1 && x != 1) ans++;
    	if(i != 1){
    		adj[x].pb(i);
    	}
    }
    dfs(1);
    cout << ans;
    return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

inline void POSIMPOS(bool b) {cout << (b?"POSSIBLE" : "IMPOSSIBLE") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,M;cin >> N >> M;
  vector<vector<int> > G(N+1);
  rep(i,M){
    int x,y;cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  bool sat = false;
  for( int &x : G[1] ){
    for(int &y: G[x] ) if(y == N) sat = true;
  }
  POSIMPOS(sat);
  return 0;
}


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

const int N = 1e5 + 5;


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int len = s.length();
    vector<int> ans(len, 0);
    int cntr = 0, cntl = 0, lbegin;
    char before = '*';
    for (int i = 0; i < len; i++){
        if(s[i] == 'R'&& before == 'L'){
            int total = cntr + cntl;
            if(total%2 == 0){
                ans[lbegin - 1] = total/2;
                ans[lbegin] = total/2;
            }else{
                if(cntr&1){
                    ans[lbegin - 1] = total/2 + 1;
                    ans[lbegin] = total/2;
                }else{
                    ans[lbegin - 1] = total/2;
                    ans[lbegin] = total/2 + 1;
                }
            }
            cntr = 0;
            cntl = 0;
        }
        if(s[i] == 'R') cntr ++;
        if(s[i] == 'L') {
            cntl ++;
            if(before == 'R') {
                lbegin = i;
            }
        }

        before = s[i];
        
        if(i == len -1){
            int total = cntr + cntl;
            if(total%2 == 0){
                ans[lbegin - 1] = total/2;
                ans[lbegin] = total/2;
            }else{
                if(cntr&1){
                    ans[lbegin - 1] = total/2 + 1;
                    ans[lbegin] = total/2;
                }else{
                    ans[lbegin - 1] = total/2;
                    ans[lbegin] = total/2 + 1;
                }
            }
        }
        
    }
    
    for (int i = 0; i < len; i++){
        cout << ans[i] << " \n"[i == len - 1];
    }
    
    
    return 0;
}


Measured memory_bytes: 1104
#include <stdio.h>
#include <stdio.h>

int main(void)
{
	char tc[101], hc[101];
	int tp, hp;
	tp = 0;
	hp = 0;
	int n;
	scanf("%d\n", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s %s", tc, hc);
		for (int j = 0; j < 100; j++) {
			if (tc[j] == '\0' && hc[j] == '\0') {
				tp += 1;
				hp += 1;
				break;
			} else if (tc[j] == '\0' && hc[j] != '\0') {
				hp += 3;
				break;
			} else if (tc[j] != '\0' && hc[j] == '\0') {
				tp += 3;
				break;
			} else if (tc[j] < hc[j]) {
				hp += 3;
				break;
			} else if (tc[j] > hc[j]) {
				tp += 3;
				break;
			}
		}
	}
	printf("%d %d\n", tp, hp);
}



Measured memory_bytes: 2076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int m=max(a,max(b,c));
  cout<<a+b+c-m<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <cstring>
#include <numeric>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int a[n], b[n];
    vector<pair<int, pair<int, int> > > c;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        c.push_back({a[i], {0, i}}); c.push_back({b[i], {1, i}});
    }
    sort(c.begin(), c.end());
    long long ans = min(accumulate(a, a+n, 0LL), accumulate(b, b+n, 0LL));
    bool chosen[2][n];
    memset(chosen, false, sizeof chosen);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        sum += c[i].first;
        chosen[c[i].second.first][c[i].second.second] = true;
    }
    if (sum >= ans) { cout << ans << endl; return 0; }
    for (int i = 0; i < n; i++)
        if (chosen[0][i] && chosen[1][i]) { cout << sum << endl; return 0; }

    for (int i = 0; i < n; i++) {
        if (chosen[0][i]) {
            int d = a[i] == c[n - 1].first ? b[i] - c[n - 2].first : b[i] - c[n - 1].first;
            ans = min(ans, sum + d);
        }
        if (chosen[1][i]) {
            int d = b[i] == c[n - 1].first ? a[i] - c[n - 2].first : a[i] - c[n - 1].first;
            ans = min(ans, sum + d);
        }
    }
    cout << ans << endl;
}


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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

pair<int, int> p[100005];

int main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i)
    {
        cin >> p[i].F >> p[i].S;
    }
    sort(p, p + n);
    ll ans = 0;
    for (int i = 0; i < n; ++i)
    {
        if (m >= p[i].S)
        {
            ans += p[i].F *1LL* p[i].S;
            m -= p[i].S;
        }
        else if (m > 0 and m < p[i].S)
        {
            ans += p[i].F *1LL* m;
            m = 0;
        }
        if (m == 0)
            break;
    }
    cout << ans << endl;
    return 0;
}

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

int main(void){

    int H,W;
    cin >> H >> W;
    
    string S[H][W];
    
    for(int i = 0; i < H;i++){
        for(int j = 0; j < W;j++){
            cin >> S[i][j];
        }
    }
    
    for(int i = 0; i < H;i++){
        for(int j = 0; j < W;j++){
            if(S[i][j] == "snuke"){
                cout << char('A' + j) << i + 1 << endl;
                return 0;
            }
        }
    }
    
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int length,i,a[100],j,t,P;
    while(scanf("%d",&length)!=EOF)
    {
        P=0;
        for(i=0; i<length; i++)
        {
            scanf("%d",&a[i]);
        }
        for(i=0; i<length; i++)
        {
            for(j=0; j<length-i-1; j++)
            {

                if(a[j]>a[j+1])
                {
                    t=a[j];
                    a[j]=a[j+1];
                    a[j+1]=t;
                    P++;
                }
            }
        }
        for(i=0; i<length-1; i++)
        {
            printf("%d ",a[i]);
        }
        printf("%d\n",a[length-1]);
        printf("%d\n",P);
        return 0;

    }
}



Measured memory_bytes: 2080
#include<bits/stdc++.h>
#define ll long long
#define p 998244353
#define inv2 499122177
using namespace std;
int mu[1000010],ss[1000010],cnt;bool pri[1000010];
int a[200010],tong[1000010];
int h[1000010],f[1000010];
int n,m,k;
int inv[1000010];
void init(int N){
	mu[1]=1;
	for(int i=2;i<=N;i++){
		if(!pri[i])ss[++cnt]=i,mu[i]=-1;
		for(int j=1;i*ss[j]<=N&&j<=cnt;j++){
			pri[i*ss[j]]=1;
			if(i%ss[j]==0){
				mu[i*ss[j]]=0;
				break;
			}
			mu[i*ss[j]]=-mu[i];
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),tong[a[i]]++;
	inv[1]=1;
	for(int i=2;i<=1000000;i++)inv[i]=1ll*inv[p%i]*(p-p/i)%p;
	init(1000000);
	for(int i=1;i<=1000000;i++){
		for(int j=i;j<=1000000;j+=i)(h[i]+=1ll*tong[j]*j%p)%=p,
		(f[i]+=1ll*j*tong[j]%p*j%p)%=p;
	}
	for(int i=1;i<=1000000;i++)
	f[i]=1ll*((1ll*h[i]*h[i]%p-f[i])%p+p)%p*inv2%p;
	ll ans=0;
	for(int k=1;k<=1000000;k++)
	for(int T=k;T<=1000000;T+=k)
	(ans+=1ll*inv[k]*mu[T/k]%p*f[T]%p)%=p;cout<<ans;
	return 0;
}


Measured memory_bytes: 23424
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 998244353
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

int main() 
{ 
    fastio

    for(int i = 0; i<5; ++i) {
        int c;
        cin>>c;
        if(c == 0) {
            cout<<i+1<<endl;
            return 0;
        }
    }
} 

Measured memory_bytes: 3640
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//省略
using vi  = vector<int>;
using vii = vector<vector<int>>;
using vl  = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

ll ketawa(ll b, ll n){
    ll res;
    if(n==0) return 0;
    if(n<b) return n;
    res=ketawa(b,n/b)+n%b;
    return res;
}

int main(){
    string N;
    cin>>N;
    ll ketawa=0;
    REP(i,N.size()){
        ll num = N[i] - '0';
        ketawa+=num;
        ketawa%=9;
    }
    if(ketawa==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3724
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll n; cin >> n; ll cnt = 0;
  
  rep(i,n){
    ll x; cin >> x;
    while(x % 2 == 0){
      cnt++;
      x /= 2;
    }
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
//2015
#include<iostream>
using namespace std;
int main(void){
	int n,m,i,j,c;
	cin>>n;
	cin>>m;
int a[m+1]={0},b[n+1]={0};
	for(i=1;i<=m;i++){
		cin>>a[i];
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			cin>>c;
			if(c==a[i]){
				b[j]++;
			}
			else{
				b[a[i]]++;
			}
		}
	}
	for(j=1;j<=n;j++){
		cout<<b[j]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3096
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), t = fs.nextInt();
		int food[][] = new int[n][2];
		for(int i=0;i<n;i++) {
			int a = fs.nextInt(), b = fs.nextInt();
			food[i][0] = a; food[i][1] = b;
		}
		
		int dp[][] = new int[n+1][t];
		for(int i=0;i<n;i++) {
			int a = food[i][0], b = food[i][1];
			for(int j=0;j<t;j++) {
				if(j - a >= 0) {
					dp[i+1][j] = Math.max(dp[i][j], dp[i][j-a] + b);
				}
				else{
					dp[i+1][j] = dp[i][j];
				}
			}
		}
		int rdp[][] = new int[n+1][t];
		for(int i=0;i<n;i++) {
			int a = food[n-1-i][0], b = food[n-1-i][1];
			for(int j=0;j<t;j++) {
				if(j - a >= 0) {
					rdp[i+1][j] = Math.max(rdp[i][j], rdp[i][j-a] + b);
				}
				else{
					rdp[i+1][j] = rdp[i][j];
				}
			}
		}
		
		int ans = 0;
		for(int i=0;i<n;i++) {
			int res = 0;
			int sum = 0;
			for(int j=0;j<t;j++) {
				if(i==0) {
					res = rdp[n-1][t-1]; 
					break;
				}
				if(i==n-1) {
					res = dp[n-1][t-1];
					break;
				}
				sum = dp[i][j] + rdp[n-1-i][t-1-j];
				res = Math.max(res, sum);
			}
			ans = Math.max(ans, res + food[i][1]);
		}
		System.out.println(ans);
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

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

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

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

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

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 128792
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n,min_value=LLONG_MAX;
	cin>>n;
	for(int i=0;i<5;i++){
		ll temp;
		cin>>temp;
		min_value=min(min_value,temp);
	}
	// cout<<"min_value:"<<min_value<<" "<<n<<endl;
	ll res=5+ceil(((n-min_value)*1.0)/min_value);
	cout<<res;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
bool check(string a, string b) {
  for (int i = 0; i < a.length(); i++) {
    if (a[i] != '?' && a[i] != b[i])
      return 0;
  }
  return 1;
}
int main() {
  IOS;
  string s;
  cin >> s;
  int ans = 0;
  int l = 0, r = s.length() - 1;
  while (l < r) {
    if (s[l] != s[r] && s[r] != 'x' && s[l] != 'x') {
      cout << -1 << endl;
      return 0;
    } else if (s[l] != s[r] && s[l] == 'x') {
      ans++, l++;
    } else if (s[l] != s[r] && s[r] == 'x') {
      ans++, r--;
    } else
      l++, r--;
  }
  cout << ans << endl;
}


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

const ll INF = 1001001001;

int main(){
  ll n,x,y;
  cin >> n >> x >> y;
  x--;y--;
  vector<int> ans(n);
  for(int i=0;i<n;i++){
    queue<int> q;
    vector<int> dist(n,INF);
    auto push = [&](int v, int d ){
      if( dist.at(v) != INF ) return;
      dist.at(v) = d;
      q.push(v);
    };
    push(i,0);
    while( !q.empty() ){
      int v = q.front(); q.pop();
      int d = dist.at(v);
      if( v-1 >= 0 ) push(v-1,d+1);
      if( v+1 < n ) push(v+1,d+1);
      if( v == x ) push(y,d+1);
      if( v == y ) push(x,d+1);
    }
    rep(j,n) ans.at(dist.at(j))++;
  }
  for(int i=1;i<n;i++){
    cout << ans.at(i)/2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, M, Q = [int(_) for _ in input().split()]
abcd = [[int(_) for _ in input().split()] for i in range(Q)]

com = combinations_with_replacement(range(1, M+1), N)

ma = 0
scores = []
for i in com:
    score = 0
    for j in abcd:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            score += j[3]
    if score > ma:
        ma = score
print(ma)

Measured memory_bytes: 90936
/*

                   _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"

//nCr mod m
#define MOD 1000003
#define M 2000200
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}

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

	int q;
	cin>>q;
	init();
	while(q--){
		int x,d,n;
		cin>>x>>d>>n;
		if(d==0){cout<<powmod(x,n,MOD)<<endl;continue;}
		if(n>1000003){cout<<0<<endl;continue;}
		(x*=powmod(d,MOD-2,MOD))%=MOD;
		cout<<fact[x+n-1]*powmod(fact[x-1],MOD-2,MOD)%MOD*powmod(d,n,MOD)%MOD<<endl;
	}
}


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

using namespace std;

#define REP(i,m) for(ll i=0; i<m; i++)
#define FOR(i,n,m) for(ll i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define pb push_back
#define ll long long int
#define P pair<ll, ll>
 
int main(){
  string s;
  cin >> s;
  int n = s.size();
  int ans[100010] = {};
  int c = 1;
  vector<int> rl;
  FOR(i, 1, n){
    if(s[i] == s[i-1]) c++;
    else{
      rl.pb(c);
      c = 1;
    }
  }
  rl.pb(c);
  c = 0;
  REP(i, rl.size()/2){
    int r = c, l = c + rl[2*i] + rl[2*i+1];
    FOR(j, r, l){
      if(j%2 == (c+rl[2*i])%2) ans[c+rl[2*i]]++;
      else ans[c+rl[2*i]-1]++;
    }
    c = l;
  }
  REP(i, n){
    cout << ans[i];
    if(i == n-1) cout << endl;
    else cout << " ";
  }
	return 0;
}



Measured memory_bytes: 1528
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

const int mod=1000000007;
//const int mod=998244353;




int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d;
    cin>>n >>k;
    n++;
    vll f(n), r(n);
    iota(all(f),0);
    iota(all(r),0);
//    print(f);
//    print(r);
    for(int i=1; i<n; i++){
        f[i]+=f[i-1];
        f[i]%=mod;
    }
    for(int i=n-2; i>=0; i--){
        r[i]+=r[i+1];
        r[i]%=mod;
    }
    reverse(all(r));
//    print(f);
//    print(r);
    a=0;
    for(int i=k-1; i<n; i++){
        a+=r[i]-f[i]+1+mod;
        a%=mod;
    }
    cout<< a<<'\n';
    
    
    return 0;
}



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

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

void solve() {

	ll n;
	cin >> n;
	ll a[n];
	vl p(n+1,0);
	for(ll i = 0;i < n;i++){
		cin >> a[i];
		p[i] = a[i];
	}
	for(ll i = 1;i < n;i++){
		p[i]+=p[i-1];
		p[i]%=mod;
	}

	ll total = p[n-1];
	ll ans = 0;

	for(ll i = 0;i < n-1;i++){
		ans += (((total - p[i])%mod+mod)%mod)*a[i];
		ans%=mod;
	}
	cout << ans << endl;

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


Measured memory_bytes: 6348
#include<stdio.h>
int main(){
int a=1000000,b=-1000000,d,i;
long long c;
int x;
c=0;
scanf("%d\n",&d);
for(i=0;i<d;i++){
scanf("%d",&x);
if(a>x){
a=x;
}
if(b<x){
b=x;
}
c=c+x;
}
printf("%d %d %ld\n",a,b,c);
return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, double>;

struct StronglyConnectedComponents {
  int n;
  int time;
  vector<vector<int>> g;
  vector<int> num, low, group, prev;
  vector<vector<int>> scc;
  stack<int, deque<int>> S;
  vector<bool> inS;

  StronglyConnectedComponents(int n)
    : n(n), g(n), num(n, -1), low(n, -1), inS(n, false),
      group(n, 0), prev(n) {}

  void addEdge(int u, int v) {
    g[u].push_back(v);
  }
  void dfs(int u) {
    num[u] = low[u] = time++;
    S.push(u);
    inS[u] = true;
    for (auto&& v : g[u]) {
      if (num[v] == -1) {
        dfs(v);
        low[u] = min(low[u], low[v]);
      } else if (inS[v]) {
        low[u] = min(low[u], num[v]);
      }
    }
    if (low[u] == num[u]) {
      scc.push_back({});
      while (true) {
        int v = S.top(); S.pop();
        inS[v] = false;
        scc.back().push_back(v);
        group[v] = scc.size() - 1;
        if (u == v) break;
      }
      for (int i = 0, m = scc.back().size(); i < m; ++i) {
        prev[scc.back()[i]] = scc.back()[(i + 1) % m];
      }
    }
  }
  void build() {
    for (int i = 0; i < n; ++i) {
      if (num[i] == -1) dfs(i);
    }
  }
};

int main() {
  int N;
  while (cin >> N, N) {
    auto p = vector<double>(N);
    auto adj = vector<vector<int>>(N, vector<int>(N, 0));
    auto g = StronglyConnectedComponents(N);
    for (int i = 0; i < N; ++i) {
      int m;
      cin >> p[i] >> m;
      for (int j = 0; j < m; ++j) {
        int a; cin >> a; --a;
        g.addEdge(i, a);
        adj[a][i] = 1;
      }
    }
    g.build();
    auto v = vector<double>(g.scc.size(), 1.0);
    for (int i = 0; i < g.scc.size(); ++i) {
      for (auto&& x : g.scc[i]) v[i] *= p[x];
      // for (auto&& x : g.scc[i]) cout << setw(3) << right << x; cout << endl;
    }
    // for (int i = 0; i < N; ++i) {
    //   cout << i << ' ' << g.group[i] << endl;
    // }
    for (int i = 0; i < N; ++i) {
      int cnt = 0;
      for (int j = 0; j < N; ++j) {
        if (g.group[i] != g.group[j] && adj[i][j]) ++cnt;
      }
      if (cnt) v[g.group[i]] = 0;
    }
    double ans = accumulate(begin(v), end(v), 1.0, [](double acc, double i) { return acc * (1.0 - i); });
    cout << fixed << setprecision(6) << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3400
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(s==u){
    cout << a-1<<' '<<b << endl;
  }
  else{
    cout << a <<' '<< b-1 << endl;
  }
  
 
  return 0;

}

Measured memory_bytes: 3616
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(input())
a = readints()
tmp = [False]*(10**6+100)
a_so = sorted(a)
# print(a_so)
cnt = 0
for i in range(len(a_so)):
    if tmp[a_so[i]]:
        continue
    if (i+1 >= len(a_so)) or (a_so[i] != a_so[i+1]):
        cnt += 1
    for j in range(1, len(tmp)):
        if a_so[i]*j >= len(tmp):
            break
        tmp[a_so[i]*j] = True
print(cnt)


Measured memory_bytes: 111644
n = int(input())
li = list(map(int,input().split()))
ans = 1
overflg = False

for i in li:
    if i == 0:
        print(0)
        exit()
    if (ans > 1000000000000000000):
        overflg = True
    else:
        ans *= i

if (ans > 1000000000000000000):
        overflg = True

if overflg:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 21596
#include <iostream>

using namespace std;

int main() {

	int x, y;
	int buf;

	for (int i = 0; i < 3000; i++) {
		cin >> x >> y;
		if (x == 0 && y == 0) {
			break;
		}
		if (x > y) {
			buf = x;
			x = y;
			y = buf;
		}
		
		cout << x << ' ' << y << endl;
		
	}
	return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
    int P,Q,R;
    cin >> P>>Q>>R;
   
    cout << P+Q+R-max(max(P, Q), R) << endl;

}


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



const int N = 3005, MOD = 1e9 + 7;
const long long INF = 9e18;



int n, a[N];
long long dp[N][N][2];

long long rec(int l, int r, bool turn){
    if(l > r){
        return 0;
    }
    if(dp[l][r][turn] != -INF){
        return dp[l][r][turn];
    }
    dp[l][r][turn] = max(a[l] - rec(l + 1, r, turn ^ 1), a[r] - rec(l, r - 1, turn ^ 1));
    return dp[l][r][turn];
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            dp[i][j][0] = dp[i][j][1] = -INF;
        }
    }
    cout << rec(1, n, 0);
}


Measured memory_bytes: 141312
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author GYSHGX868
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskC solver = new TaskC();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      long x = in.nextLong();
      long answer = x / 11 * 2;
      long mod = x % 11;
      long step = x / 11;
      if (mod > 0) {
        if (mod <= 6 - step % 2) {
          answer++;
        } else {
          answer += 2;
        }
      }
      out.printLine(answer);
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      boolean isSpaceChar(int ch);

    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(long i) {
      writer.println(i);
    }

  }
}



Measured memory_bytes: 24788
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, min, maxd;
	cin >> n;
	vector<int> rt(n);
	for (int i = 0; i < n; ++i) {
		cin >> rt.at(i);
	}
    min = rt.at(0);
	maxd = rt.at(1) - rt.at(0);
	for (int i = 1; i < n; ++i) {
		if (rt.at(i) - min > maxd) {
			maxd = rt.at(i) - min;
		}
		if (rt.at(i) < min) {
			min = rt.at(i);
		}
	}
	cout << maxd << endl;
}


Measured memory_bytes: 3588
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, L, Q;
int X[101010];
int bk[17][101010];

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%d", X + i);
	scanf("%d%d", &L, &Q);

	int pre = 0;
	for (int i = 0; i < N; ++i) {
		while (X[i] - X[pre] > L) ++pre;
		bk[0][i] = pre;
	}

	for (int i = 1; i < 17; ++i) {
		for (int j = 0; j <= N; ++j) {
			bk[i][j] = bk[i - 1][bk[i - 1][j]];
		}
	}

	for (; Q--;) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a; --b;
		if (a == b) {
			puts("0");
			continue;
		}
		if (a > b) swap(a, b);

		int ret = 0;
		for (int i = 16; i >= 0; --i) {
			if (bk[i][b] > a) {
				ret += 1 << i;
				b = bk[i][b];
			}
		}

		printf("%d\n", ret + 1);
	}
	return 0;
}


Measured memory_bytes: 7936
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <queue>
using namespace std;
int A[4];
int main()
{
   while(scanf("%d %d %d",&A[0],&A[1],&A[2])!=EOF)
   {
       int temp;
       sort(A,A+3);
       if((A[1]-A[0])%2==0)
       {
            temp=(A[1]-A[0])/2;
           temp=temp+A[2]-A[1];
       }
       else
       {
            temp=(A[1]+1-A[0])/2;
           temp=temp+A[2]-A[1]+1;
       }
       printf("%d\n",temp);
   }

}


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

using namespace std;

int N;
int arr[204][204];
int chk[204];
int q[204], far[204], f, r, did[204], dis[204];

int main(){
    scanf("%d", &N);
    for(int i = 1; i <= N; ++i){
        for(int j = 1; j <= N; ++j){
            scanf("%1d", arr[i] + j);
        }
    }
    int ans = -1;
    for(int i = 1; i <= N; ++i){
        memset(q, 0, sizeof(q));
        memset(far, 0, sizeof(far));
        memset(did, 0, sizeof(did));
        memset(dis, 0, sizeof(dis));
        f = r = 0;
        q[r] = i, far[r++] = 1; did[i] = 1; dis[i] = 1;
        int ff = 1;
        while(f < r){
            if(f && far[f] > far[f - 1]){
                memset(chk, 0, sizeof(chk));
            }
            if(chk[q[f]]){
                ff = 0;
                break;
            }
            for(int j = 1; j <= N; ++j){
                if(!arr[q[f]][j] || (did[j] && dis[j] < far[f])){
                    continue;
                }
                if(did[j]){
                    chk[j] = 1; continue;
                }
                chk[j] = 1;
                q[r] = j, far[r++] = far[f] + 1; dis[j] = far[f] + 1; did[j] = 1;
            }
            ++f;
        }
        if(ff){
            ans = max(ans, far[f - 1]);
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
using namespace std;

int D[30][30];
int grid[500][500];
int score[3][30];

int main() {
  int n, c_;
  cin >> n >> c_;
  vector<vector<int>> score(3, vector<int>(c_, 0));
  for (int i = 0; i < c_; ++i) { 
    for (int j = 0; j < c_; ++j) { 
      int d; cin >> d;
      D[i][j] = d;
    }
  }
  for (int i = 0; i < n; ++i) { 
    for (int j = 0; j < n; ++j) { 
      int c; cin >> c; --c;
      grid[i][j] = c;
    }
  }

  // 各色について、(i+j)%3ごとにその色に変える際の違和感を計算
  for (int i = 0; i < n; ++i) { 
    for (int j = 0; j < n; ++j) { 
      int r = (i+j)%3;
      int c = grid[i][j];
      for (int k = 0; k < c_; ++k) {
        score[r][k] += D[c][k];
      }
    }
  }
  int ans = 1001001001;
  for (int i = 0; i < c_; ++i) { 
    for (int j = 0; j < c_; ++j) { 
      if (j == i) continue;
      for (int k = 0; k < c_; ++k) { 
        if (k == j || k == i) continue;
        ans = min(ans, score[0][i]+score[1][j]+score[2][k]);
      }
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    map<string,int>s;
    REP(i,n){
        string tmp;
        cin >> tmp;
        s[tmp]++;
    }
    int m;
    cin >> m;
    int answer=0;
    map<string,int>t;
    REP(i,m){
        string tmp;
        cin >> tmp;
        t[tmp]++;
    }
    for(auto itr = s.begin(); itr != s.end(); ++itr) {
        answer = max(answer,s[itr->first]-t[itr->first]);
    }
    cout << answer << endl;
    return 0;
}

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

int main() {

	int x;
	
	for (int i = 1; i < 10001; i++) {
	    cin >> x;
	    if (0 == x) break;
	    cout << "Case " << i << ": " << x << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3096
a,b,c = map(int,input().split(" "))
if c < b:
    temp = c
    c = b
    b = temp
if b < a:
    temp = b
    b = a
    a = temp
if c < b:
    temp = c
    c = b
    b = temp
print("{} {} {}".format(a,b,c))
    


Measured memory_bytes: 5596
#include <cctype>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define LL long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;

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

int main(){
	string s;
	cin >> s;
	
	if(s.size() % 2 == 1){
		s.pop_back();
	}else{
		s.pop_back();
		s.pop_back();
	}

	while(s.size() > 0){
		string left, right;
		REP(i, s.size()){
			if(i < s.size() / 2){
				left.pb(s[i]);
			}else{
				right.pb(s[i]);
			}
		}
		if(left == right){
			break;
		}
		s.pop_back();
		s.pop_back();
	}

	cout << s.size() << endl;
}


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

int main(){
	ll N, D, A;
	cin >> N >> D >> A;
	vector<pair<ll,ll>> XH(N);
	for(auto &xh : XH) cin >> xh.first >> xh.second;
	sort(XH.begin(), XH.end());
	ll ans = 0;
	vector<ll> imos(N+1, 0);
	for(int i=0;i<N;i++) {
		if(i > 0) imos[i] += imos[i-1];
		if(XH[i].second - imos[i] > 0) {
			ll num = ((XH[i].second - imos[i]) + A -1) / A;
			ans += num;
			ll minus = num * A;
			imos[i+1] += minus;
			auto itr = upper_bound(XH.begin(), XH.end(), make_pair(XH[i].first + 2*D,LLONG_MAX));
			imos[itr - XH.begin()] -= minus;
			/*
			int j = i+1;
			while(XH[j].first <= XH[i].first + 2*D && j < N) {
				XH[j].second = max(XH[j].second - minus, 0LL);
				j++;
			}
			*/
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
object Main {
  def main(args: Array[String]): Unit = {
    val base = io.StdIn.readLine()

    if (base == "A") {
      println("T")
    }
    else if(base == "T") {
      println("A")
    }
    else if(base == "C") {
      println("G")
    }
    else {
      println("C")
    }
  }
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> vec(2*N);
    for(int n=0; n<2*N; n++) {
        cin >> vec[n];
    }
    sort(vec.begin(), vec.end());
    int ans=0;
    for(int n=0; n<2*N; n++) {
        ans += vec[n];
        n++;
    }
    cout << ans << endl;


    return 0;
    
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines
MOD = 10 ** 9 + 7
INF = 1 << 60

# ---------------------------------------------------
# ---------------------------------------------------
# ---------------------------------------------------

def resolve():
    N = int(inp())
    A = list(map(int, inp().split()))
    print(*A)

    for i in range(1, N):
        v = A[i]
        j = i-1
        while j>=0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A)


if __name__ == '__main__':
    resolve()



Measured memory_bytes: 5984
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main(void) {
  int i,j;
  int N;
  scanf("%d", &N);

  int *A;

  A = calloc(N+1,sizeof(int));

  for (i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }

  int *ans;

  ans = calloc(N+1, sizeof(int));

  for (i = 1; i <= N ; i++) {
    ans[A[i]] = i;
  }

  free(A);

  for (i = 1; i <= N; i++) {
    printf("%d ", ans[i]);
  }

  free(ans);

  return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 1000000007
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	ll n; cin >> n; n--;
	string s; cin >> s;
	map<char, ll> mp;

	ll ng=0;
	rep(i, s.size()) {
		mp[s[i]]++;
	}
	for (ll i = 1; i <= n / 2; i++) {
		for(ll j = 0; j <= n - 2 * i; j++) {
			if (s[j] != s[j + i] && s[j + i] != s[j + 2 * i] && s[j] != s[j + 2 * i]) {
				ng++;
			}
		}
	}
	cout << mp['R'] * mp['G'] * mp['B'] - ng << endl;
	return 0;
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll>   pairl;
typedef vector<ll>     vl;
typedef vector<ll>     vll;
typedef vector<vector<ll> > vvl;
const   int            infi = numeric_limits<int>::max();
const   ll             infl = numeric_limits<ll>::max();
const   double         eps = 0;
const   int            ms  = 0;



int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int r;
    cin >> r;
    cout << r*r << endl;
    return 0;
}

Measured memory_bytes: 256
/*
oruegg19 - Arundhati Bhattacharya
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<unsigned ll>
#define mp make_pair
#define F first
#define S second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const unsigned ll l=1000000007;
const int MAX_=2000;
int T;

void solve(int t)
{
  int n,m;
  cin >> n >> m;
  vll w(n), v(n);

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

  ll dp[n+1][m+1];

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

  for(int i=0; i<=m; i++)
  {
    dp[0][i] = 0;
  }

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

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

  cout << dp[n][m] << endl;
}



int main()
{
  IOS
  int t,testCases;
  testCases=1;

  while(testCases--)
  {
    t=1;
    // cin >> t; //comment this in case of singular test case
    T = t;
    while(t--)
    {
      // cout << "HERE" << endl;
      solve(t);
    }
  }
  return 0;

}



Measured memory_bytes: 79232