akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] vo = new int[n / 2];
		int[] ve = new int[n / 2];

		for (int i = 0; i < n / 2; i++) {
			vo[i] = sc.nextInt();
			ve[i] = sc.nextInt();
		}

		Arrays.sort(vo);
		Arrays.sort(ve);
		int maxo = 1;
		int maxe = 1;
		int seco = 0;
		int sece = 0;
		int numo = 0;
		int nume = 0;

		int j = 0, k = 0;
		int ans = -1;

		while (j != n / 2 - 1) {
			int count = 1;
			while (vo[j] == vo[j + 1]) {
				count++;
				j++;
				if (j == n / 2 - 1) {
					break;
				}
			}
			if (j != n / 2 - 1) {
				j++;
			}
			if (seco <= count) {
				if (maxo <= count) {
					seco = maxo;
					maxo = count;
					numo = vo[j-1];
				} else {
					seco = count;
				}
			}

		}

		while (k != n / 2 - 1) {
			int count = 1;
			while (ve[k] == ve[k + 1]) {
				count++;
				k++;
				if (k == n / 2 - 1) {
					break;
				}
			}
			if (k != n / 2 - 1) {
				k++;
			}
			if (sece <= count) {
				if (maxe <= count) {
					sece = maxe;
					maxe = count;
					nume = ve[k-1];
				} else {
					sece = count;
				}
			}

		}

		if (maxo == n / 2 && maxe == n / 2) {
			if (vo[0] == ve[0]) {
				ans = n / 2;
			} else {
				ans = 0;
			}
		} else if (numo != nume) {
			ans = (n / 2 - maxo) + (n / 2 - maxe);
		} else {
			ans = Math.min((n / 2 - maxo) + (n / 2 - sece), (n / 2 - maxe) + (n / 2 - seco));
		}

//		System.out.println(maxo + "," + maxe + "," + seco + "," + sece + "," + numo + "," + nume);
//		System.out.println((n / 2 - maxo) + "," + (n / 2 - maxe) + "," + (n / 2 - seco) + "," + (n / 2 - sece));
		System.out.println(ans);

	}
}

Measured memory_bytes: 49820
#include<stdio.h>

int main(){

   double r;
   const double PI = 3.141592653589;
   double eq;
   double length;

   scanf("%lf", &r);
   eq = r * r * PI;
   length = 2 * r * PI;

   printf("%f %f\n", eq, length);

   return 0;   
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    int a,b,c; cin>>a>>b>>c;
    if(a<=c&&c<=b){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    string s;
    cin >> s;
    int n = s.size();
    int odd_white = 0;
    int odd_black = 0;
    int even_white = 0;
    int even_black = 0;
    REP(i,n){
        if( (i + 1 ) % 2 == 0){
            if(s[i] == '0'){
                even_black++;
            }
            else{
                even_white++;
            }
        }
        else{
            if(s[i] == '0'){
                odd_black++;
            }
            else{
                odd_white++;
            }
        }
    }

    cout << min(odd_black+even_white,odd_white+even_black) << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
 
#define LOCAL  1
#define UPLOAD 2
 
#define ll long long
const long long INF = 1LL << 60;
 
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
#define REP(i,M) for(int i=0;i<M;i++)
 
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;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
 
int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  ll H = input();
  ll N = input();
 
  ll sum = 0;
  for(int i=0;i<N;i++){
    sum += input();
  }

  output(sum >= H ? "Yes" : "No");


  
  return 0;
}

Measured memory_bytes: 256
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = input()
    ans ={}
    for i in s:
        if i in ans:
            ans[i] +=1
        else:
            ans[i] =1
    flg =0

    for i in ans.values():
        if i % 2 >0:
            flg =1
            break
    if flg == 0:
        print("Yes")
    else:
        print("No")




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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string s;
  cin >> s;
  if(s=="Sunny"){
    cout << "Cloudy" << endl;
  }else if(s=="Cloudy"){
    cout << "Rainy" << endl;
  }else{
    cout << "Sunny" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	s = ["" for i in 1:n]
	for i in 1:n
		s[i] = chomp(readline())
	end
	k = 0
	h = 0
	t = 0
	b = 0
	for i in 1:n
		l = length(s[i])
		for j in 2:l
			if s[i][j-1] == 'A' && s[i][j] == 'B'
				k += 1
			end
		end
		if s[i][1] == 'B' && s[i][l] == 'A'
			b += 1
		elseif s[i][1] == 'B'
			h += 1
		elseif s[i][l] == 'A'
			t += 1
		end
	end
	if n >= 2
		if b >= h && b >= t
			k += t+h+b-min(max(t,h,1),b)
		elseif b<= h && b <= t
			k += 2*b + min(t-b,h-b)
		else
			k += 2*min(t,h)+b-min(t,h)
		end
	end
	println(k)
end
main()


Measured memory_bytes: 114368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (int)(n); i>=0; --i)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    int R;
    cin >> R;
    cout << 2*M_PI*R << endl;
    return 0;
}

Measured memory_bytes: 3800
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

const long long MOD = 1000000007LL;
const long long INF = 1e18;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long mult_mod(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

// ree always check bounds
// int vs long long
// bitset cheese <3

long long freq[1003];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s; cin >> s;

    int tot = 0;
    string cur = "", prev = "";

    for(int i = 0; i < s.size(); ++i){

        cur += s[i];

        if(cur == prev) continue;

        ++tot;
        prev = cur;
        cur = "";

    }

    cout << tot;

    return 0;
}


Measured memory_bytes: 720
N,x = map(int,input().split())
A = list(map(int,input().split()))
eaten = 0
ans = 0
for i in range(N-1):
    if A[i]+A[i+1]<=x:continue
    else:
        eaten = A[i] + A[i+1] -x
        A[i+1] = max(0,A[i+1]-eaten)
        ans += eaten
print(ans)

Measured memory_bytes: 15564
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1e9+7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX/2e5

ll mpow(ll a, ll b){
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}

ll func(vp64 &v , ll n){
	ll ans = n;
	if((ll)v.size()==1){
		ans = max(ans,(n/v[0].se)*v[0].fi + n%v[0].se);
	}
	else if((ll)v.size()==2){
		forn(i,n+1){
				ll t1 = (i/v[0].se)*v[0].fi + i%v[0].se;
				t1 += ((n-i)/v[1].se)*v[1].fi + (n-i)%v[1].se;
				ans = max(ans,t1);
		}
	}
	else if((ll)v.size()==3){
		forn(i,n+1){
			forn(j,n+1){
				if(i+j>n) break;
				ll t1 = (i/v[0].se)*v[0].fi + i%v[0].se;
				t1 += (j/v[1].se)*v[1].fi + j%v[1].se;
				t1 += ((n-i-j)/v[2].se)*v[2].fi + (n-i-j)%v[2].se;
				ans = max(ans,t1);
			}
		}
	}
	return ans;
}

void solve(ll in){
	ll n;
	cin >> n;
	ll g1,s1,b1;
	ll g2,s2,b2;
	cin >> g1 >> s1 >> b1;
	cin >> g2 >> s2 >> b2;
	vp64 v1,v2;
	if(g1>g2) v1.pb(mp(g1,g2));
	else if(g2>g1) v2.pb(mp(g2,g1));
	if(s1>s2) v1.pb(mp(s1,s2));
	else if(s2>s1) v2.pb(mp(s2,s1));
	if(b1>b2) v1.pb(mp(b1,b2));
	else if(b2>b1) v2.pb(mp(b2,b1));
	n = func(v2,n);
	n = func(v1,n);
	cout << n << ln;
}


int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    // cin >> t;
    forn(i,t) {
    	solve(i+1);
    }
    return 0;
}

Measured memory_bytes: 256
while 1:
 h,m,s=map(int,input().split())
 if h<0:break
 d=7200-h*3600-m*60-s;t=d*3
 print(f'{d//3600:02}:{d//60%60:02}:{d%60:02}')
 print(f'{t//3600:02}:{t//60%60:02}:{t%60:02}')


Measured memory_bytes: 5616
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
ll a[maxn]; 

int gcd(int a,int b)
{
    return b>0?gcd(b,a%b):a;
}

int main() {
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(a>k) cout<<k<<endl;
	else if((a+b)>=k) cout<<a<<endl;
	else cout<<(a-(k-a-b))<<endl;
}


Measured memory_bytes: 3636
from bisect import bisect_left

N = int(input())

C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()

B_count = [0]*N
A_count = [0]*N

for i in range(N):
    B_count[i]=bisect_left(C,B[i])

for i in range(1,N):
    B_count[i]=B_count[i]+B_count[i-1]
B_count=[0]+B_count

for i in range(N):
    A_count[i]= B_count[bisect_left(B,A[i])]

print(sum(A_count))

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;

int k;
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> k;
	if (k%7 == 0) k /=7;
	if (__gcd(10, k) != 1) return 0*puts("-1");
	int ans = 1;
	int r = 1 % k;
	while(r != 0) {
		r = (10*r + 1) % k;
		ans++;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
using namespace std;

class osa_k{
private:
    vector<int> prime_sieve;
    vector<int> set_prime;
    int N;
    void eratosthenes(){
        for(int i=2;i*i<N;i++) {
            if(prime_sieve[i]<i) continue;
            for(int j=i*i;j<N;j+=i){
                if(prime_sieve[j]==j) prime_sieve[j] = i;
            }
        }                
    }

    void setPrimeSet(){
        for(int i=2;i<N;i++){
            if(prime_sieve[i]==i){
                set_prime.emplace_back(i);
            }
        }        
    }
public:    
    osa_k(const int n){
        N=n;
        prime_sieve.resize(n);
        iota(prime_sieve.begin(),prime_sieve.end(),0);
        eratosthenes();
        setPrimeSet();
    }

    vector<int> get_factor(int i) {
        vector<int> res;
        while(i>1){
            res.emplace_back(prime_sieve[i]);
            i/=prime_sieve[i];
        }
        //素因数の重複なしが欲しいなら、以下のコメントアウトを解除
        sort(res.begin(),res.end());
        decltype(res)::iterator result = unique(res.begin(), res.end());
        res.erase(result, res.end());
        return res;
    }

};



int main(){
    int n;cin>>n;
    osa_k o(1000005);
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    set<int> s;
    int co=a[0];
    for(int i=0;i<n;i++){
        co=gcd(co,a[i]);
    }
    if(co!=1){
        cout<<"not coprime"<<endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        vector<int> tmp=o.get_factor(a[i]);
        for(int j=0;j<tmp.size();j++){
            if(s.find(tmp[j])!=s.end()){
                cout<<"setwise coprime"<<endl;
                return 0;
            }
            else{
                s.insert(tmp[j]);
            }
        }
    }
    cout<<"pairwise coprime"<<endl;    

    return 0;
}

Measured memory_bytes: 11376
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ar array<int,2>
#define inf 1000000000000000000 
int mod=1e9+7;
int min(int a,int b){return (a<b)?a:b;}
int max(int a,int b){return (a>b)?a:b;}
int fp(int a,int b){if(b==0) return 1;int x=fp(a,b/2);x=(x*x)%mod;if(b&1) x=(x*a)%mod;return x;}


const int N=2e5+5;
vector<array<int,2>> v;
struct node
{
  int t1,t2;
  node()
  {
    t1=-inf;
    t2=-inf;
  }
}; 
node merge(node a,node b)
{
  node c;
  c.t1=max(a.t1,b.t1);
  c.t2=max(a.t2,b.t2);
  return c;
}
 
vector<node> bit(4*N);

void build(int id,int l,int r)
{
  if(l==r)
  {
      return;
  }
  int mid=(l+r)/2;
  build(2*id,l,mid);
  build(2*id+1,mid+1,r);
  bit[id]=merge(bit[2*id],bit[2*id+1]);
}

 
int get(int id,int l,int r,int L,int R,int typ)
{
  if(R<l||r<L){
    return -inf;
  }
  if(L<=l&&r<=R)
  {
    if(typ==1)
    return bit[id].t1;
    return bit[id].t2;
  }
  int mid=(l+r)/2;
  return max(get(2*id,l,mid,L,R,typ),get(2*id+1,mid+1,r,L,R,typ));
}
 
void upd(int id,int l,int r,int L,int R,int x,int y)
{
  if(R<l||r<L)
    return;
  if(L<=l&&r<=R)
  {
    bit[id].t1=max(bit[id].t1,x);
    bit[id].t2=max(bit[id].t2,y);
    return;
  }
  int mid=(l+r)/2;
  upd(2*id,l,mid,L,R,x,y);
  upd(2*id+1,mid+1,r,L,R,x,y);
  bit[id]=merge(bit[2*id],bit[2*id+1]);
}
 
 
void solve()
{
 build(1,1,10);
 int n,x,y;
 cin>>n;
 v=vector<array<int,2>>(n+1);
 map<int,int> mp;
 for(int i=1;i<=n;i++)
 {  
  cin>>v[i][0]>>v[i][1];
  mp[v[i][1]];
 }
 int ct=0;
 for(auto &i:mp)
  i.second=++ct;
 sort(v.begin()+1,v.end());
 int ans=-inf;
 for(int i=1;i<=n;i++)
 {
    int x=v[i][0];
    int y=v[i][1];
    y=mp[y];
    int z1=get(1,1,n,1,y,1);
    int z2=get(1,1,n,y,n,2);
    ans=max({ans,z1+x+v[i][1],z2+x-v[i][1]});
    upd(1,1,n,y,y,-x-v[i][1],-x+v[i][1]);

//    cout<<x<<" "<<v[i][1]<<" "<<z1<<" "<<z2<<endl;
 }

 cout<<ans<<endl;

}


signed main() {
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
 srand(time(0));
 int t;
 t=1;
 for(int i=1;i<=t;i++)
 {
   solve();
 }


} 
/*

3
1 5
3 3
1 1

*/

Measured memory_bytes: 31436
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int product = a*b;
        if(product%2==0) {System.out.println("Even");}
        else System.out.println("Odd");
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;
    vector<int>a(n),ans(n,0);
    rep(i,1,n){
        cin>>a[i];
        ans[a[i] - 1]++;
    }
    rep(i,n)cout<<ans[i]<<endl;

    return 0;
}

Measured memory_bytes: 4792
import sys
N,M = map(int,input().split())
if not ( 1 <= N <= 10**12 and 1 <= M <= 10**12 ): sys.exit()

count_SCC=0
if M > 2*N : #Mがあまる
    M = M - 2*N
    count_SCC = N + M//4
elif M < 2*N : #Nがあまる
    count_SCC = M//2
print(count_SCC)

Measured memory_bytes: 9188
#include<iostream>
#include<map>

using namespace std;

typedef long long ll;

int N;
int A[200000 + 100];

ll cnt[200000 + 100];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> A[i], cnt[A[i]]++;

	ll total = 0;
	for (int i = 0; i <= N; i++) {
		total += cnt[i] * (cnt[i] - 1) / 2;
	}
	for (int k = 0; k < N; k++) {
		//0-idxでk番目のボールの除く
		ll ans = total;
		ans -= cnt[A[k]] * (cnt[A[k]] - 1) / 2;
		ans += (cnt[A[k]] - 1) * (cnt[A[k]] - 2) / 2;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K , S ;
  cin >> K >> S;
  int count = 0;
  for(int i = 0; i < K+1; i++){
    for(int j = 0; j< K+1; j++){
        if(-1 < S-i-j && S-i-j < K + 1) count++;
      }
    }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=1e5+10;
int n,m;
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>m;
	if(n==1||m==1){
		cout<<1<<endl;
		return 0;
	}
	cout<<(1ll*n*m+1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
char s[25][25],c[110],box[]={'^','>','v','<'};
int n,w,h;




void func(int y,int x,int now,int pre){
	s[y][x]=box[pre];
	if(now==n)
	return;
	s[y][x]='.';
	if(c[now]=='U'){
		if(x>=0&&x<w&&y-1>=0&&y-1<h&&s[y-1][x]=='.')
		y--;pre=0;
	}else if(c[now]=='R'){
		if(x+1>=0&&x+1<w&&y>=0&&y<h&&s[y][x+1]=='.')
		x++;pre=1;
	}else if(c[now]=='D'){
		if(x>=0&&x<w&&y+1>=0&&y+1<h&&s[y+1][x]=='.')
		y++;pre=2;
	}else if(c[now]=='L'){
		if(x-1>=0&&x-1<w&&y>=0&&y<h&&s[y][x-1]=='.')
		x--;pre=3;
	}else if(c[now]=='S'){
		if(box[pre]=='>'){
			for(int i=x;i<w;i++)
			if(s[y][i]=='*'){
				s[y][i]='.';
				break;
			}else if(s[y][i]=='#')
			break;
		}else if(box[pre]=='^'){
			for(int i=y;i>=0;i--)
			if(s[i][x]=='*'){
				s[i][x]='.';
				break;
			}else if(s[i][x]=='#')
			break;
		}else if(box[pre]=='<'){
			for(int i=x;i>=0;i--)
			if(s[y][i]=='*'){
				s[y][i]='.';
				break;
			}else if(s[y][i]=='#')
			break;
		}else
		if(box[pre]=='v'){
			for(int i=y;i<h;i++)
			if(s[i][x]=='*'){
				s[i][x]='.';
				break;
			}else if(s[i][x]=='#')
			break;
		}
	}
	func(y,x,now+1,pre);
}
int main(){
	int t;
	cin>>t;
	while(t--){
		cin>>h>>w;
		rep(i,h)
			cin>>s[i];
		cin>>n;
		cin>>c;
		rep(i,h)
		rep(j,w){
			if(s[i][j]=='>'){
				func(i,j,0,1);
				goto end;
			}
			if(s[i][j]=='^'){
				func(i,j,0,0);
				goto end;
			}
			if(s[i][j]=='<'){
				func(i,j,0,3);
				goto end;
			}
			if(s[i][j]=='v'){
				func(i,j,0,2);
				goto end;
			}
		}
		end:
		rep(i,h)
		cout<<s[i]<<endl;
		if(t>0)
			cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
n,m=map(int,input().split())
cost=[0]*m
keys=[0]*m
for i in range(m):
  a,b=map(int,input().split())
  cost[i]=a
  k=list(map(int,input().split()))
  for j in range(b):
    keys[i]|=(1<<(k[j]-1))

INF=10**9+1
dp=[INF]*(2**n)
dp[0]=0
for i in range(len(keys)):
  for j in range(len(dp)-1,-1,-1):
    if dp[j]!=INF:
      if dp[j|keys[i]]>dp[j]+cost[i]:
        dp[j|keys[i]]=dp[j]+cost[i]

if dp[-1]!=INF:
  print(dp[-1])
else:
  print(-1)

Measured memory_bytes: 3188
# coding: utf-8

N = int(input())
nums = [int(x) for x in input().split()]

if set([num% 2 for num in nums]) == {0}:
    print("Yes")
    exit(0)

a,b,c = 0,0,0
for elem in nums:
    if elem % 4 == 0 : a += 1  # 4の倍数
    else:
        b += 1  # 4の倍数じゃない

# あとづけ 
# 2の倍数かつnot４の倍数についても考える必要がある
c = 0
for elem in nums:
        if elem % 2 == 0 and elem % 4 != 0: c += 1

if N % 2 == 1:  # 奇数
    if b-c <= (N-c+1)/2 : print("Yes")
    else: print("No")
else:  # 偶数
    if b-c <= a : print("Yes")
    else: print("No")

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

signed main(){
    int N; cin >> N;
    bool ok = true;
    for(int i = 0; i < N; i++){
        int x; cin >> x;
        if(x % 2 == 0){
            if(x % 3 != 0 && x % 5 != 0) ok = false;
        }
    }
    if(ok) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}
    

Measured memory_bytes: 256
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:String,
    }
    let a=a.chars().collect_vec();
    println!("{}{}{}{}{} {}{}{}{}{}{}{} {}{}{}{}{}",a[0],a[1],a[2],a[3],a[4],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[14],a[15],a[16],a[17],a[18])
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mod 1000000007

int main()
{
  string s,t;
  cin>>s>>t;
  ll ans=0;

  for(ll i=0;i<s.length();i++)
  {
    if(s[i]!=t[i])
    	ans++;
  }
  cout<<ans;


  return 0;
}





Measured memory_bytes: 3852
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int h, w; cin >> h >> w;
  vector<string> s(h); rep(i, h) cin >> s[i];

  rep(i, w + 2) cout << "#";
  cout << endl;

  rep(i, h) {
    cout << "#" << s[i];
    cout << "#" << endl;
  }

  rep(i, w + 2) cout << "#";
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;
namespace Math{
      vector<int> fact;
      int M;

      int exp(int a, int b){
            if(b == 0)return 1;
            if(b % 2)return a * exp(a, b - 1) % M;
            int t = exp(a, b / 2);
            return t * t % M;
      }

      int comb(int n, int r){
            if(r == 0 || r == n)return 1;
            return fact[n] * exp(fact[r], M - 2) % M * exp(fact[n - r], M - 2) % M;
      }
      bool isprime(int x){
            for(int i = 2; i * i <= x; i++){
                  if(x % i == 0)return false;
            }
            return true;
      }
      vector<int> divisors(int x){
            vector<int> ret;
            for(int i = 1; i * i <= x; i++){
                  if(x % i == 0){
                        ret.pb(i);
                        if(i * i != x)ret.pb(x / i);
                  }
            }
            return ret;
      }
      vector<int> prime_fac(int x){
            vector<int> ret;
            for(int i = 1; i * i <= x; i++){
                  if(x % i == 0){
                        ret.pb(i);
                        while(x % i == 0) x /= i;
                  }
            }
            if(x > 1) ret.pb(x);
            return ret;
      }
      void Math_init(int m = modulo){
            fact = vector<int>(2000006, 1);
            M = m;
            for(int i = 1; i < fact.size(); i++) fact[i] = fact[i - 1] * i % M;
      }
};
using namespace Math;



int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      Math_init();
      
      int n, k;
      cin >> n >> k;
      int ans = 0;
      k = min(n - 1, k);
      for(int i = 0; i <= k; i++){
            int zero = i;
            int one = n - zero; 
            ans = (ans + comb(n, zero) * comb(zero + one - 1, zero)) % modulo;
      }
      cout << ans;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long x,y;
	cin>>x>>y;
	if((x+y)%2==0)
	{
		cout<<(x+y)/2<<endl;
	}
	else
	{
		cout<<"IMPOSSIBLE"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; string x; cin >> n >> x;
  reverse(ALL(x));
  int popcount = count(ALL(x), '1');
  vector<int> ans(n, 0);
  {
    // 0 -> 1
    int p = popcount + 1;
    vector<int> w(n, 1);
    FOR(i, 1, n) w[i] = (w[i - 1] * 2) % p;
    int sum = 0;
    REP(i, n) {
      if (x[i] == '1') (sum += w[i]) %= p;
    }
    REP(i, n) {
      if (x[i] == '0') {
        int tmp = (sum + w[i]) % p, cnt = 1;
        while (tmp > 0) {
          ++cnt;
          tmp %= __builtin_popcount(tmp);
        }
        ans[i] = cnt;
      }
    }
  }
  if (popcount > 1) {
    // 1 -> 0
    int p = popcount - 1;
    vector<int> w(n, 1);
    FOR(i, 1, n) w[i] = (w[i - 1] * 2) % p;
    int sum = 0;
    REP(i, n) {
      if (x[i] == '1') (sum += w[i]) %= p;
    }
    REP(i, n) {
      if (x[i] == '1') {
        int tmp = (sum - w[i] + p) % p, cnt = 1;
        while (tmp > 0) {
          ++cnt;
          tmp %= __builtin_popcount(tmp);
        }
        ans[i] = cnt;
      }
    }
  }
  reverse(ALL(ans));
  REP(i, n) cout << ans[i] << '\n';
  return 0;
}


Measured memory_bytes: 5168
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<ut,VI> PQ;
const int SIZE=2*1e5;
const LL INF=1<<30;
const LL p=7+1e9;
LL A[SIZE];
LL B[SIZE],C[SIZE];
int main(){
	LL N;
	cin >> N;
	REP(i,N){
		cin >> A[i];
		B[i]=log2(A[i]);
		C[i]=A[i]!=(1LL<<B[i]);
	}
	LL ans=0;
	while(true){
		bool exist=false;
		bool now=false;
		REP(i,N){
			if(!now && B[i]+C[i]>=1){
				if(C[i]>=1) C[i]--;
				else B[i]--;
				now=true;
				ans++;
				exist=true;
			}
			else if(now && B[i]){
				B[i]--;
			}
			else if(now && C[i]){
				C[i]--;
				now=false;
			}else{
				now=false;
			}
		}
		if(!exist) break;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;
signed main(){
    int n;
    cin>>n;
    vector<int> b(n, 0);
    for (int i = 0;i<n-1;++i){
        int k;
        cin>>k;
        ++b[k - 1];
    }
    for (int i = 0; i < n; ++i) cout << b[i] << endl;
}

Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
char grid[3005][3005];
ll dp[3005][3005];
int solve(){
  int n,m;
  cin>>n>>m;
  int i,j;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin>>grid[i][j];
    }
  }
  dp[0][0]=1;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      dp[i][j]=0;
      dp[0][0]=1;
      if(grid[i][j]=='#'){
        continue;
      }
      if(i>0){
        dp[i][j]=(dp[i][j]+(grid[i-1][j]=='.')*dp[i-1][j])%MOD;
      }
      if(j>0){
        dp[i][j]=(dp[i][j]+(grid[i][j-1]=='.')*dp[i][j-1])%MOD;
      }
    }
  }
  /*for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cout<<dp[i][j]<<" ";
    }
    cout<<"\n";
  }*/
  cout<<dp[n-1][m-1]<<"\n";
  return 0;
}
int main(){
fast
  int t=1;
  // cin>>t; 
  T(t){
    solve();
  }
  return 0;
}

Measured memory_bytes: 18348
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#define ll long long

using namespace std;


int main() {

	vector<int> v;
	for (int i = 0; i < 3; i++) {
		int p; cin >> p;
		v.push_back(p);
	}
	sort(v.begin(), v.end());

	cout << v[0] << " " << v[1] << " " << v[2] << endl;


}




Measured memory_bytes: 3164
/*
 * 二次元平面に，赤い点と青い点が N 個ずつあります。 i 個目の赤い点の座標は (ai,bi) で，i 個目の青い点の座標は (ci,di) です。
 * 
 * 赤い点と青い点は，赤い点の x 座標が青い点の x 座標より小さく， また赤い点の y 座標も青い点の y 座標より小さいとき，仲良しペアになれます。
 * 
 * あなたは最大で何個の仲良しペアを作ることができますか？ ただし，1 つの点が複数のペアに所属することはできません。
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int n = Integer.parseInt(sc.next());

            int[][] red = new int [n][2];
            int[][] blue = new int [n][2];
            
            for(int i=0; i<n; i++){
            	red[i][0] = Integer.parseInt(sc.next());
            	red[i][1] = Integer.parseInt(sc.next());
            }
            for(int i=0; i<n; i++){
            	blue[i][0] = Integer.parseInt(sc.next());
            	blue[i][1] = Integer.parseInt(sc.next());
            }
            Arrays.sort(red,  (a, b) -> Integer.compare(a[0], b[0]));
            Arrays.sort(blue, (a, b) -> Integer.compare(a[0], b[0]));
            //出力
            System.out.println(calc(red, blue, n));
            sc.close();
        }
        
        public static int calc(int[][] red, int[][] blue, int n){
        	int ret = 0, maxtemp = -1, index = 0, maxindex = 0, flag = 0;
        	
        	for(int i=0; i<n; i++){
        		index = 0;
        		flag = 0;
        		maxtemp = -1;
        		while(index < n && red[index][0] < blue[i][0]){
        			if(maxtemp <= red[index][1] && red[index][1] < blue[i][1]){
        				maxtemp = red[index][1];
        				maxindex = index;
        				flag = 1;
        			}
        			index++;
        		}
        		
        		if(flag == 1){
        			ret++;
        			red[maxindex][1] = 201;
        		}
        	}
        	
            return ret;
        }
    }
	

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

class Main{


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

    private void solve() throws Exception{
        FastScanner scanner = new FastScanner();
        int V = scanner.nextInt();
        int E = scanner.nextInt();

        int[][] cap = new int[V][V];

        for(int i = 0; i < E; ++i){
            int u = scanner.nextInt();
            int v = scanner.nextInt();
            int c = scanner.nextInt();
            cap[u][v] = c;
        }

        System.out.println(maxFlow(cap, 0, V - 1));
    }

    private int maxFlow(int[][] cap, int s, int t){
        int total = 0;
        int flow;
        while ((flow = findPath(cap, new boolean[cap.length], s, t, Integer.MAX_VALUE)) != 0){
            total += flow;
        }

        return total;
    }

    private int findPath(int[][] cap , boolean[] visited, int u, int t, int flow){
        if(u == t){
            return flow;
        }

        visited[u] = true;
        int V = cap.length;

        for(int v = 0; v < V; ++v){
            if(!visited[v] && cap[u][v] > 0){
                int df = findPath(cap, visited, v, t, Math.min(cap[u][v], flow));
                if(df > 0){
                    cap[u][v] -= df;
                    cap[v][u] += df;
                    return df;
                }
            }
        }

        return 0;
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 26676
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int max_n=1000001;
bool is_prime[max_n];
int prime[max_n];
int sieve(int n){
    int p=0;
    rep(i,n+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    FOR(i,2,n+1){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
        }
    }
    return p;
}
int main(){
    sieve(1000000);
    int a,d,n;
    while(cin>>a>>d>>n,a){
        int cnt=1;
        while(1){
            if(is_prime[a]){
                if(cnt==n){
                    cout<<a<<endl;
                    break;
                }
                ++cnt;
            }
            a+=d;
        }
    }
    return 0;
}


Measured memory_bytes: 4292
MODE = "stdio"
#require 'matrix'
#include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '5 100
  p1 150
  p2 80
  p3 200
  p4 350
  p5 20'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end

n, q = line[0].split.map(&:to_i)
process = []
(1..n).each do |num|
  p, t = line[num].split
  t = t.to_i
  process.push [p, t]
end
 
total = 0
while process.any?
  p, t = process.shift
  if t <= q
    total += t
    puts "#{p} #{total}"
  else
    t -= q
    total += q
    process.push [p, t]
  end
end

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

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

int N,M;
vector<PII> Pr[100005];
string ans[100005];

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

	cin >> N >> M;

	for (int i = 0;i < M;i++){
		int P, Y; cin >> P >> Y;
		Pr[P].push_back(PII(Y,i));
	}	

	for (int i = 1;i <= N;i++){
		sort(Pr[i].begin(), Pr[i].end());
		for (int j = 0;j < Pr[i].size();j++){
			char tmp[20];
			sprintf(tmp,"%06d%06d", i, j+1);
			ans[Pr[i][j].second] = tmp;	
		}
	}

	for (int i = 0;i < M;i++){
		cout << ans[i] << endl;
	}

	return 0;

}


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

int main(){
    long long X;
    cin >> X;

    long long money = 100;
    long long count = 0;

    while( money < X ){
        count++;
        money = (long long) (money*1.01);
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  int dist = min( min( H-y, y ), min( W-x, x ) );

  if( dist >= r ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define fi first
#define se second
#define pi pair<int, int>
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define per(i, a, n) for(int i = a; i >= n; i--)
#define REP(i, a, n) for(int i = a; i < n; i++)
#define Y "YES"
#define N "NO"
using namespace std;

const ll mod = 1e9 + 7;
ll n;

ll POW(ll a, ll b) {
	if (!b) return 1;
	ll res = POW(a, b/2);
	if (b % 2) return (((res * res) % mod) * a) % mod;
	return (res * res) % mod;
}

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

	cin >> n;
	cout << (POW(10, n) + POW(8, n) - 2 * POW(9, n) + 3 * mod) % mod;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

int main() {
    lint mod = 1e+9 + 7;
    int h, w;
    cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c;
            cin >> c;
            if (c == '#') {
                a[i][j] = 1;
            } else {
                a[i][j] = 0;
            }
        }
    }
    // dp[i][j]:(i-1,j-1)への行き方
    vector<vector<lint>> dp(h + 1, vector<lint>(w + 1, 0));
    dp[0][1] = 1;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (a[i - 1][j - 1] == 0) {
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] %= mod;
            }
        }
    }
    cout << dp[h][w] << endl;
}

Measured memory_bytes: 12032
#include<stdio.h>

int main (void){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }
    else if(a==b){
        printf("a == b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
return 0;
}

Measured memory_bytes: 580
/*#### bits/stdc++.h */
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<deque>
#include<queue>
#include<utility>
#include<algorithm>
using namespace std;
/*####*/

/*#### modular_arithmetic */
class modular_arithmetic{
public:
	int mod;

	modular_arithmetic(){
		mod = 998244353;
	}
	void set_mod(int _mod){mod = _mod;}
	int add(int x,int y){return (x+y)%mod;}
	int sub(int x,int y){return (x-y+mod)%mod;}
	int mul(int x,int y){return (int)((long long int)x*y%mod);}
	int pw(int x,int y){
		int r = 1;
		while(1){
			if(y&1)r=mul(r,x);
			if(y>>=1)x=mul(x,x);else
				break;
		}
		return r;
	}
};
/*####*/

modular_arithmetic ma;

map<string,int> Map, Map2;
int dp(string cur);
int dp2(string cur);

int dp(string cur){
	if(cur == "")return 1;
	if(Map.count(cur))return Map[cur];
	int&res = Map[cur];
	int L = cur.length();
	res = ma.mul(dp(cur.substr(0, L-1)) , cur[L-1] == '1' ? 2 : 1);
	for(int i=0; i<L-1; i++){
		res = ma.add(res, ma.mul(dp(cur.substr(0,i)), dp2(cur.substr(i, L-i))));
	}
	return res;
}
int dp2(string cur){
	if(cur.length() <= 1)return 0;
	if(Map2.count(cur))return Map2[cur];
	int&res = Map2[cur];
	res = 0;
	int L = cur.length();
	for(int d=1; d<L; d++)if(L%d==0){
		string w = "";
		for(int j=0; j<d; j++){
			bool all1 = true;
			for(int k=j; k<L; k+=d){
				if(cur[k] == '0'){
					all1 = false;
					break;
				}
			}
			w += (all1?'1':'0');
		}
		res = ma.add(res, dp(w));
	}
	return res;
}

int main(){
	string s;
	cin >> s;
	cout << dp(s) << endl;
	return 0;
}

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

int main() {
	char a[1000];
	scanf("%s",a);
	if(a[0]=='Y' && a[1]=='A' && a[2]=='K' && a[3]=='I')
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
n,*a=$<.map &:to_i
a.sort!
p [0,1].map{|x|
  b=(0...n).map{|i|i%2==x ? a[i/2] : a[n-i/2-1]}
  c=(0...n).map{|i|(b[i-1]-b[i]).abs}
  c.reduce(:+)-c.min
}.max

Measured memory_bytes: 9360
#include<stdio.h>
#define n_max 1000000
typedef struct{
  char name[10];
  int e_time;
}pro;
void enqueue(pro);
pro dequeue();
void exe();
int dif(pro);
int b_time;
int sum=0;
int head=0;
int tail=0;
pro pro1[n_max];


int main(){
  int i;
  int n;
  scanf("%d%d",&n,&b_time);
  tail=n;
  for(i=0;i<n;i++){
    scanf("%s%d",pro1[i].name,&pro1[i].e_time);
  }
  exe(pro1);
  return 0;
}
void enqueue(pro p){
  pro1[tail]=p;
  if(tail==n_max-1)tail=0;
  else tail++;
}
pro dequeue(){
  pro p;
  p=pro1[head];
  if(head==n_max-1)head=0;
  else head++;
  return p;
}
void exe(){
  int d_f;
  pro p2;
  while(head!=tail){
    p2=dequeue();
    d_f=dif(p2);
    sum+=d_f;
    p2.e_time-=d_f;
    if(p2.e_time>0)enqueue(p2);
    else printf("%s %d\n",p2.name,sum);
  }
}
int dif(pro p){
  return p.e_time>b_time?b_time:p.e_time;
}



Measured memory_bytes: 4676
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int N = read(), X = read();
    vector<int> V(N+1);
    for (int i = 0; i<N; i++) {
        V[i] = read();
    }
    V[N] = X;
    sort(V.begin(), V.end());
    int ans = V[1]-V[0];
    for (int i = 2; i<=N; i++) {
        ans = __gcd(ans, V[i]-V[i-1]);
    }
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    
    int a;
    string s;
    cin >> a >> s;
    cout << (a >= 3200 ? s : "red");

    


}



Measured memory_bytes: 256