akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K <= A){
    cout << K << endl;
  } else if (K <= A + B){
    cout << A << endl;
  } else {
    cout << A - (K - A - B) << endl;
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
const int MOD = 1000000007;
void out(){
    cout<<0<<endl;
    exit(0);
}
signed main(void){
    int n; cin>>n;
    if(n==1) {cout<<1<<endl; return 0;}
    vector <int> a(n); 
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector <int> cnt(100000); 
        for(int i=0;i<n;i++){
            cnt[a[i]]++;
    }
    if(n%2 == 1){
        if(cnt[0] != 1) out();
        for(int i=1;i<n;i+=2){
            if(cnt[i] != 0) out();
        }
      
        for(int i=2;i<=n-1;i+=2){
            if(cnt[i]!= 2) out();
        }
       
        int x = n/2;
        int ans = 1;
        rep(i, x){ ans *= 2; ans %= MOD;}
        cout<<ans<<endl;
    }else{
        if(cnt[0] != 0) out();
        for(int i=1;i<=n-1;i+=2){
            if(cnt[i] != 2) out();
        }
        for(int i=0;i<=n;i+=2){
            if(cnt[i]) out();
        }
    
    int ans = 1;
    int x = n/2;
    rep(i, x){ ans *= 2; ans %= MOD;}
    cout<<ans<<endl;
    }
}


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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> a(N);

    ll sum = 0;
    REP(i,N){
        cin >> a[i];
        sum ^= a[i];
    }

    REP(i,N){
        ll ans = sum ^ a[i];
        cout << ans << endl;
    }


    return 0;
}

Measured memory_bytes: 4732
import java.util.Scanner;
public class Main{
public static void main(String[]args){
Scanner scan=new Scanner(System.in);
int a[][]=new int[50][3];
String b[]=new String[50];
int j=0;
a[0][0]=0;a[0][1]=0;a[0][2]=0;
for(int i=0;a[i][0]!=-1||a[i][1]!=-1||a[i][2]!=-1;i++) {
	a[i+1][0]=scan.nextInt();
	a[i+1][1]=scan.nextInt();
	a[i+1][2]=scan.nextInt();
j++;
if(a[i+1][0]==-1||a[i+1][1]==-1) {b[i]="F";}
else if(a[i+1][0]+a[i+1][1]>=80) {b[i]="A";}
else if(a[i+1][0]+a[i+1][1]<80&&a[i+1][0]+a[i+1][1]>=65) {b[i]="B";}
else if(a[i+1][0]+a[i+1][1]<65&&a[i+1][0]+a[i+1][1]>=50) {b[i]="C";}
else if(a[i+1][0]+a[i+1][1]<50&&a[i+1][0]+a[i+1][1]>=30) {
if(a[i+1][2]>=50) {b[i]="C";}else {b[i]="D";}}
else {b[i]="F";}
}
for(int i=0;i!=j-1;i++) {
	System.out.println(b[i]);
}
}
}



Measured memory_bytes: 26392
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int N = sc.nextInt();
        long T = sc.nextInt();
        long[] t = new long[N];
        long sum = 0;
        for (int i = 0; i < N; ++i) {
            t[i] = sc.nextInt();
 
            if (i > 0) {
                sum += Math.min(t[i] - t[i - 1], T);
            }
        }
 
        _out.println(sum + T);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 65492
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = next()
    val aa = listOfInt()

    var min = Int.MAX_VALUE

    for (a in aa) {
        var cnt = 0
        var num = a
        while (num % 2 == 0) {
            cnt++
            num /= 2
        }
        if (cnt < min) min = cnt
        if (min == 0) break
    }

    println(min)
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int L = a + b, R = c + d;

  if (L > R) {
    cout << "Left" << endl;
  } 
  else if (L < R) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}


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

using namespace std;

int main(){
  string S;
  cin >> S;
  int cont = 0;
  int i = 0, j = (int) S.size() - 1;
  while(i <= j){
    cont += (S[i] != S[j]);
    i = i + 1;
    j = j - 1;
  }
  cout << cont;
  return 0;
}


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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int ans;
char s;


main() {
    rep(i,3) {
        cin >> s;
        if (s == '1') ans++;
    }
    ct(ans)
}






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

int main() {
	int N,count;
	
    cin>>N;
	count=1;
	vector<string> K(N);
	for(int i=0;i<N;i++){
		cin>>K.at(i);
	}
    
	sort(K.begin(),K.end());
	for(int i=0;i<N-1;i++){
		if(K.at(i)==K.at(i+1)){
			continue;
		}
        count++;
	}
	cout<<count<<endl;
    

}


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

int p;
char s[1024];
int v;

int fomula(){
	char c=s[p++];
	switch(c){
		case 'T':
			return 1;
		case 'F':
			return 0;
		case 'a':case 'b':case 'c':case 'd':case 'e':case 'f':
		case 'g':case 'h':case 'i':case 'j':case 'k':
			return v>>c-'a'&1;
		case '-':
			return !fomula();
		case '(':
			int a,b;
			char op;
			a=fomula();
			op=s[p++];
			if(op=='-')p++;
			b=fomula();
			p++;
			if(op=='*')return a&&b;
			if(op=='+')return a||b;
			return !(a&&!b);
		default: cout<<-1<<endl;
	}
}
int main(){
	while(cin>>s&&s[0]!='#'){
		int ok=1,a,b;
		for(v=0;ok&&v<(1<<11);v++){
			p=0;
			a=fomula();
			p++;
			b=fomula();
			ok=(a==b);
		}
		cout<<(ok?"YES":"NO")<<endl;
	}
	return 0;	
}

Measured memory_bytes: 1164
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define EREP(i,n) for(int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#define BEG cout<<"D::";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#define BEG {}
#endif
const int MOD = 1000000007;
const ll INF = 50000000000000000;

	ll A,B,C,N,M,H;
  ll ans;

int main(){
	cin>>A>>B>>C;
  B-A==C-B?cout<<"YES":cout<<"NO";


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


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int n = sc.nextInt();
    ArrayList <Integer> li = new ArrayList <Integer>();
    ArrayList <Integer> lili = new ArrayList <Integer>();
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      li.add(a);
      lili.add(0);
    }
    for(int i=0;i<n-1;i++){
      lili.set(i,li.get(i+1)-li.get(i));
    }
    lili.set(n-1,k-li.get(n-1)+li.get(0));
    int b = lili.get(0);
    for(int i=1;i<n;i++){
      int a = Math.max(b,lili.get(i));
      b = a;
    }
    System.out.println(k-b);
  }
}

Measured memory_bytes: 94976
t_life, t_attack, a_life, a_attack = map(int, input().split())

while t_life >= 0 and a_life >= 0:
    a_life = a_life - t_attack
    if a_life <= 0:
        print('Yes')
        exit()

    t_life = t_life - a_attack
    if t_life <= 0:
        print('No')
        exit()


Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 // ここにプログラムを追記
 //0≤R,G≤4500整数　入力は以下の形式で標準入力から与えられる。 
 int r,g ; cin >> r >> g;
 //cout<<m<<r<<endl;
 /*高橋君はあるプログラミングコンテストが行われているサイトに参加しています。
ここでは, コンテストに出場した時にこの順位に応じて「パフォーマンス」というものがつき、それによってレーティング (整数とは限らない) が次のように変化します。

    現在のレーティングを aとする。次のコンテストで, パフォーマンス bを取ったとする。
そのとき, レーティングは aと bの平均まで変化する。

高橋君は, 現在のレーティングが Rで, 次のコンテストでレーティングをちょうど G にしたいと思っています。
そのとき, 高橋君が取るべきパフォーマンスを求めなさい。 */

//(R+X)/2=G <=> X=2G-R
 
 cout << 2*g-r <<endl;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

S = list(s())
A = [int(S[i]) for i in range(4)]
for bit in range(1<<3):
    B = [(bit>>i)&1 for i in range(3)]
    C = []
    ans = A[0]
    for j in range(3):
        if B[j] == 0:
            ans += A[j+1]
            C.append('+')
        else:
            ans -= A[j+1]
            C.append('-')
    if ans == 7:
        print(''.join(str(A[0])+C[0]+str(A[1])+C[1]+str(A[2])+C[2]+str(A[3])+'=7'))
        exit()

Measured memory_bytes: 9988
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#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 reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

int main() {
	string S;
	cin >> S;
	int Z = S.size();
	rep(i, Z) {
		cout << 'x';
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;int main(){int a,b;cin>>a>>b;if(a>0)cout<<"Positive"<<endl;else if(b>=0)cout<<"Zero"<<endl;else if((a&1)^(b&1))cout<<"Positive"<<endl;/*^Òì»ò*/ else cout<<"Negative"<<endl;;return 0;}

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

int main(){
	int n;
  char s[110];
  cin >> n;
  for(int i=0; i<n; i++) {
    s[i] = '0';
    cin >> s[i];
  }
  char a = '0';
  cin >> a;
    for(int i=0; i<n; i++) {
      if(s[i] == '0') break;
      cout << s[i];
    }
  if(a != '0') cout << "...";
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define FILE freopen("input.txt", "r", stdin)

using namespace std;

const int MAXN = 600001;
const int mod = 1000000007;

typedef long long ll;

ll fac[MAXN], inv[MAXN];

ll modPower(ll x, ll y){
	ll res = 1;
	while(y){
		if(y&1)res = (res * x)%mod;
		x = (x*x)%mod;
		y >>= 1;
	}
	return res;
}

void pre(){
	fac[0] = 1;
	for(int i = 1; i < MAXN; ++i){
		fac[i] = fac[i-1] * i %mod;
	}
	inv[MAXN-1] = modPower(fac[MAXN-1], mod-2);

	for(int i = MAXN-2; i >= 0; --i){
		inv[i] = (inv[i+1]*(i+1))%mod;
	}
}

ll C(ll n, ll r){
	if(r > n)return 0;
	return (fac[n] * inv[r] % mod) * inv[n-r] %mod;
}

typedef long long ll;

int main(){ 
	pre();
	int h, w, n;
	cin>>h>>w>>n;

	pair<int,int> p[n+1];
	for(int i = 0; i < n; ++i)cin>>p[i].first>>p[i].second;
	sort(p, p+n);
	p[n].first = h, p[n].second = w;

	ll dp[n+1]; // no. of ways to come to this node without visiting any previous blocked node

	for(int i = 0; i <= n; ++i){
		dp[i] = C(p[i].first+p[i].second-2, p[i].first-1);

		for(int j = 0; j < i; ++j){
			if(p[j].second > p[i].second)continue;
			dp[i] = (dp[i] + mod - (dp[j] * 
						C(p[i].first-p[j].first+p[i].second-p[j].second, 
							p[i].first-p[j].first)) %mod) %mod;
		}
	}

	cout<< dp[n] << endl;


}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const long long maxn=2e5+5;
const long long inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<ll> uid(l, r); return uid(rng); }

ll power(ll x, ll y){  
	ll p=mode, res=1;
    x = x % p;
    while (y > 0) {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}


void solve(){
	
	ll n;
	cin>>n;
	vector<ll> a(n), b(n);
	for (int i=0;i<n;i++){
		cin>>a[i];
		cin>>b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if (n%2){
		ll ans=(b[n/2]-a[n/2])+1;
		cout<<ans<<endl;
	}
	else{
		ll a1=(b[n/2]+b[(n/2)-1]);
		ll a2=(a[n/2]+a[(n/2)-1]);
		ll ans=(a1-a2)+1;
		
		cout<<ans<<endl;
	}
	
	return;
}

 
int main(){ 
    
    #ifndef ONLINE_JUDGE
	//	freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
 	
	//T{ solve(); }
	solve();
	
	
	
	return 0;
	
}

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

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

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

bool check(int k, string s, const vector<char>& t, const vector<char>& d) {
  int N = s.length();
  int Q = t.size();
  int pos = k;
  REP(i,Q) {
    if(t[i] == s[pos]) {
      if(d[i] == 'L') --pos;
      if(d[i] == 'R') ++pos;
    }
    if(pos < 0) return true;
    if(pos >= N) return false;
  }
  return false;
}

int solve(string s, const vector<char>& t, const vector<char>& d) {
  if(!check(0, s, t, d)) return 0;

  int N = s.length();
  int lb = 0, ub = N;
  while(ub - lb > 1) {
    int mid = (ub + lb) / 2;
    if(check(mid, s, t, d)) lb = mid;
    else ub = mid;
  }
  return ub;
}

int main(){
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  REP(i, Q) cin >> t[i] >> d[i];

  int ans1 = solve(s, t, d);
  reverse(ALL(s));
  REP(i,Q) d[i] = (d[i] == 'L') ? 'R' : 'L';
  int ans2 = solve(s, t, d);

  cout << N - ans1 - ans2 << endl;
  return 0;
}



Measured memory_bytes: 1228
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <set>
#include <cmath>
#include <algorithm>
#include <locale>

#define int long long
#define pb(n) push_back(n)
#define For(n,i) for(int (i)=0;(i)<(n);(i)++)
//#define ForJ(n) for(int j=0;j<n;j++)
//#define ForK(n) for(int k=0;k<n;k++)
#define Pr(n) cout<<n<<endl;
#define INS(v,n) for(int i=0;i<n;i++){cin >>v.at(i);}//vector 代入
#define ELM 100001 //問題によっては1000000001に変更
using namespace std;

signed  main(){
    int n;
    vector<int> a;
    cin >> n;
    for (int i=0; i<n; i++) {
        int x;
        cin >>x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    cout<<a[n-1]-a[0]<<endl;
    return 0;
}



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

typedef long long ll;
const ll mod = 1000000007;

int main() {
    ll N;
    ll ans = 1;
    cin >> N;
    string S;
    cin >> S;
    map<char, int>m;
    for (int i = 0; i < N; i++) {
        m[S[i]]++;
    }
    for (auto x : m) {
        ans *= (1+x.second);
        ans %= mod;
    }
    cout << ((ans - 1)+mod) % mod << endl;
}


Measured memory_bytes: 512
/// 8:31 PM 21/06/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 1000000007
#define INF 1e15
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> v(n);
    ll x = 0;
    for (auto &y:v) {
        cin >> y;
        x ^= y;
    }
    for (ll i = 0; i < n; i++) {
        cout << (x ^ v[i]) << ' ';
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++){
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    if (i == N - 1) {
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  
  
  
  for(int i=0; i<s.size(); i++){
    if(1<=i && s.at(i) == 'B'){
      s.erase(i-1, 2);
      i -= 2;
    }
    if(i==0 && s.at(i) == 'B'){
      s.erase(i,1);
      i--;
    }
  }
  
  
  
  cout << s << endl;
}


Measured memory_bytes: 256
count = {'AC':0,'WA':0,'TLE':0,'RE':0}
N = int(input())
S = [input() for _ in range(N)]
for s in S:
    count[s] += 1
print(f'AC x {count["AC"]}')
print(f'WA x {count["WA"]}')
print(f'TLE x {count["TLE"]}')
print(f'RE x {count["RE"]}')

Measured memory_bytes: 16364
import copy 

def gcd(a,b):
    if b > a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

N = int(input())
T = list(map(int,input().split()))
T.sort()
LIS = [0]*N
LIS[0] += T[0]
for i in range(N-1):
    LIS[i+1] += gcd(LIS[i],T[i+1])
GCD = 0
GCD += LIS[N-1]
if N == 2:
    ANS = max(T[0],T[1])
else:
    #第１項がtarget
    S = copy.copy(T)
    S.pop(0)
    LS = [0]*(N-1)
    LS[0] += S[0]
    for i in range(N-2):
        LS[i+1] += gcd(LS[i],S[i+1])
    ANSA = LS[N-2]

    #その他の場合
    LJ = []
    for i in range(N-1):
        if LIS[i] != LIS[i+1]:
            LJ.append(i+1)
    if LJ == []:
        ANS =max(ANSA,LIS[0])
    else:
        LK = []
        for j in range(len(LJ)):
            U = copy.copy(T)
            U.pop(LJ[j])
            LS = [0]*(N-1)
            LS[0] += U[0]
            for i in range(N-2):
                LS[i+1] += gcd(LS[i],U[i+1])
            LK.append(LS[N-2])
        ANSB = max(LK)
        ANS = max(ANSA,ANSB)
print(ANS)

Measured memory_bytes: 18036
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	unsigned long long Lucas[87]={};
	Lucas[0]=2;
	Lucas[1]=1;
	for(int i=2; i<=86; i++){
		Lucas[i]=Lucas[i-1]+Lucas[i-2];
	}
	
	int N;
	cin >> N;
	cout << Lucas[N] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main()
{
  char s[200001];
  int i,n,a,b;
  scanf("%s",s);
  n=strlen(s);
  for(i=0;i<n;i++)
    if(s[i]=='A'){
      a=i;
      break;
    }
  for(i=0;i<n;i++)
    if(s[i]=='Z'){
      b=i;
    }
  printf("%d",b-a+1);
  return 0;
}


Measured memory_bytes: 1924
import java.util.Scanner;

public class Main {
	public static final int number=753;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();

		int max=Integer.MAX_VALUE;
		for(int a = 0; a<=S.length()-3;a++) {
			int k = Integer.parseInt(S.substring(a, a+3));
			max=Math.min(max, Math.abs(k-number));
		}
		System.out.println(max);
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<deque>
#include<sstream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<bitset>
#include<time.h>
#include<cstdlib>
#include<cassert>
#define ll long long
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<endl;
using namespace std;

int x,y,z;
                   
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin); 
    freopen("out","w",stdout);
#endif
  cin>>x>>y>>z;
  int ans=x/(y+z);
  if(x%(y+z)<z)ans--;
  cout<<ans<<endl;
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

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

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for(int tsumugi = 0; tsumugi < h; tsumugi++){
        cin >> a[tsumugi];
    }

    vector<int> row;
    for(int karen = 0; karen < h; karen++){
        bool flag = false;
        for(auto x:a[karen]){
            // cout << x << endl;
            if(x == '#'){
                flag = true;
                break;
            }
        }
        if(flag == false){
            row.insert(row.begin(), karen);
        }
    }
    for(auto x:row){
        a.erase(a.begin() + x);
    }
    h = a.size();

    vector<int> column;
    for(int karen = 0; karen < w; karen++){
        bool flag = false;
        for(int hajime = 0; hajime < h; hajime++){
            char tmp = a[hajime][karen];
            if(tmp == '#'){
                flag = true;
                break;
            }
        }
        if(flag == false){
            column.insert(column.begin(), karen);
        }
    }
    for(auto x:column){
        for(int mirai = 0; mirai < h; mirai++){
            a[mirai].erase(a[mirai].begin() + x);
        }
    }

    for(auto x:a){
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N =100005;
vector<ll>parent(N),urank(N),vec;

vector<pair<ll,ll>> v;
ll find(ll x)
{
  if(parent[x]!=x)
  {
    parent[x] = find(parent[x]);
  }
  return parent[x];
}
void merge(ll x,ll y)
{
  ll xroot = find(x);
  ll yroot = find(y);
  if(urank[xroot]<=urank[yroot])
  {
    parent[xroot] = yroot;
    urank[yroot]  +=urank[xroot];
  }
  else 
  {
    parent[yroot] = xroot;
    urank[xroot] += urank[yroot];
  }
}
signed main()
{
   
  ll n,m,x,y;
  cin>>n>>m;
  for(ll i=0;i<m;i++)
  {
    cin>>x>>y;
    v.push_back({x,y});
  }
  for(ll i=1;i<=n;i++)
  {
    parent[i] = i;
    urank[i] = 1;
  }
  ll ans  = (n*(n-1))/2;
  vec.push_back(ans);
  for(ll i =0;i<m-1;i++)
  {
    auto it = v.back();
    //  cout<<find(v.back().first)<<" "<<find(v.back().second)<<" ";
    if(find(v.back().first)!=find(v.back().second)){
    ans  -= (urank[find(v.back().first)]*urank[find(v.back().second)]);
    merge(find(v.back().first),find(v.back().second));
    }
     vec.push_back(ans);
    v.pop_back();
  }
  for (int i = vec.size()-1; i >=0 ; --i)
  {
    cout<<vec[i]<<"\n";
  }
  return 0;
}


Measured memory_bytes: 6256
N = int(input())
A = list(map(int, input().split()))

judge = 'reset'
cnt = 1

# judgeがresetに替わった際にcnt++
for i in range(N-1):
    if A[i] < A[i+1]:
        if judge == 'reset':
            judge = 'high'
        elif judge == 'low':
            judge = 'reset'
            cnt += 1
    elif A[i] > A[i+1]:
        if judge == 'reset':
            judge = 'low'
        elif judge == 'high':
            judge = 'reset'
            cnt += 1

print(cnt)

Measured memory_bytes: 14252
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int x;
    cin >> x;
    long long a, b;
    for(a = 0; a < 130; a++){
        long long a5 = a*a*a*a*a;
        if(a5 < x){
            for(b = 0; b > -130; b--){
                long long b5 = b*b*b*b*b;
                if(a5 > x + b5) break;
                else if(a5 == x + b5){
                    cout << a << " " << b;
                    return 0;
                }
            }
        }
        else if(a5 > x){
            for(b = 0; b < 130; b++){
                long long b5 = b*b*b*b*b;
                if(a5 < x + b5) break;
                else if(a5 == x + b5){
                    cout << a << " " << b;
                    return 0;
                }
            }
        }
        else{
            b = 0;
            cout << a << " " << b;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
string L;
main(){
    cin >> L;
    ll dp[100010][2];
    rep(i,0,L.size()+1)dp[i][0] = dp[i][1] = 0;
    dp[0][1] = 1;
    rep(i,0,L.size()){
        if(L[i] == '0'){
            dp[i+1][0] = dp[i][0] * 3;
            dp[i+1][1] = dp[i][1];
        }else{
            dp[i+1][0] = dp[i][0] * 3 + dp[i][1];
            dp[i+1][1] = dp[i][1] * 2;
        }
        dp[i+1][0] %= MOD;
        dp[i+1][1] %= MOD;
    }
    cout << (dp[L.size()][0] + dp[L.size()][1]) % MOD << endl;
    /*
    rep(i,0,L.size()+1){
        cout << dp[i][0] << " \n"[i==L.size()];
    }
    rep(i,0,L.size()+1){
        cout << dp[i][1] << " \n"[i==L.size()];
    }
    */

}

Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 1
#define all(x) x.begin(), x.end()


int main(){
  
  int n;
  while(scanf("%d",&n),n){
    vector<int> v;
    rep(i,n){
      int t; scanf("%d",&t);
      v.push_back(t);
    }
    sort(all(v));
    long long ans = 0;
    long long time = 0;
    rep(i,n){
      ans += time;
      time += (long long)v[i];
    }
    printf("%lld\n",ans);
  }
  return 0;
}

Measured memory_bytes: 0
fn get_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}

fn reads<T>() -> Vec<T>
    where
        T: std::str::FromStr,
        <T as std::str::FromStr>::Err: std::fmt::Debug {
    get_line().split(' ').map(|x| x.parse().unwrap()).collect()
}

fn main() {
    let nm = reads();
    let mut xs = vec![vec![]; nm[0]];

    for _ in 0..nm[1] {
        let ab: Vec<usize> = reads();

        let a = ab[0] - 1;
        let b = ab[1] - 1;

        xs[a].push(b);
        xs[b].push(a);
    }

    let mut res = false;
    let mut ss = vec![];

    for &x in &xs[0] {
        if x == nm[0] - 1 {
            res = true;
            break;
        }
        else {
            ss.push(x);
        }
    }

    if !res {
        'outer:
        for s in ss {
            for &x in &xs[s] {
                if x == nm[0] - 1 {
                    res = true;
                    break 'outer;
                }
            }
        }
    }


    println!("{}POSSIBLE",
        if res {
            ""
        }
        else {
            "IM"
        }
    );
}


Measured memory_bytes: 20732
#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) for (int i = 0; i < (b); i++)
#define ranger(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define repr(i, b) for (int i = (b)-1; i >= 0; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	rep(i, v.size()) { os << v[i] << (i == v.size() - 1 ? "" : " "); }
	return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S>& p) {
	os << '(' << p.first << ',' << p.second << ')';
	return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (T& x : v) { is >> x; }
	return is;
}

double dp[305][305][305];
int m[4];

int n;

double dfs(int x, int y, int z) {
	if (dp[x][y][z] != -1) return dp[x][y][z];
	dp[x][y][z] = 0;

	// cout << x << ' ' << y << ' ' << z << endl;
	int sum = x + y + z;
	double t = 1.0 * n / sum;

	if (x > 0) dp[x][y][z] += (dfs(x - 1, y, z) + t) * x / sum;
	if (y > 0) dp[x][y][z] += (dfs(x + 1, y - 1, z) + t) * y / sum;
	if (z > 0) dp[x][y][z] += (dfs(x, y + 1, z - 1) + t) * z / sum;
	return dp[x][y][z];
}

signed main() {
	cin >> n;

	rep(i, n) {
		int a;
		cin >> a;
		m[a]++;
	}
	// repr(i, 3) m[i] += m[i + 1];

	rep(i, 305) rep(j, 305) rep(k, 305) dp[i][j][k] = -1;
	dp[0][0][0] = 0;

	cout << fixed << setprecision(10) << dfs(m[1], m[2], m[3]) << endl;
}


Measured memory_bytes: 221952
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int minx = 10000;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        int cnt = 0;
        while (a % 2 == 0) {
            a /= 2;
            cnt++;
        }
        minx = min(minx, cnt);
    }
    cout << minx << endl;
    return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
    int n; cin >> n;
    map<int,int> mp;
    for(int i = 0; i < n; i++){int a; cin >> a; mp[a]++;}
    int m; cin >> m;
    for(int i = 0; i < m; i++) {
        int t; cin >> t;
        if(!mp[t]) {
            cout << "NO" << endl;
            return 0;
        }
        mp[t]--;
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 9600
s = input()
n = len(s)
mid = (n + 1) // 2
ans = 'Yes'
if s != s[::-1]:
    ans = 'No'
#print(1, ans)

#print(s[:(n - 1) // 2])
#print(''.join(list(reversed(s[:(n - 1) // 2]))))
if s[:(n - 1) // 2:] != ''.join(list(reversed(s[:(n - 1) // 2]))):
    ans = 'No'
#print(2, ans)

#print(s[(n + 2) // 2::])
#print(''.join(list(reversed(s[(n + 2) // 2::]))))
if s[(n + 2) // 2:n:] != ''.join(list(reversed(s[(n + 2) // 2::]))):
    ans = 'No'
#print(3, ans)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++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;}

vector<pair<ll, int>> factorize(ll n) {
    vector<pair<ll, int>> res;
    for(ll i=2; i*i<=n; i++) {
        if (n % i) continue;
        res.emplace_back(i, 0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

ll gcd(ll a, ll b){
  return b ? gcd(b, a%b) : a;
}

int main(){
    ll a, b; cin >> a>>b;
    ll g = gcd(a, b);
    vector<pair<ll, int>> res = factorize(g);
    cout << res.size()+1 <<endl;
}

Measured memory_bytes: 256
#ifdef __GNUC__ 
#include <bits/stdc++.h>
#endif
#include <boost/multiprecision/cpp_int.hpp>
#define ALL(v) std::begin(v),std::end(v)
using namespace std;
namespace mp = boost::multiprecision;
using u6 = std::uint64_t;
using si = std::size_t;
#ifdef __GNUC__ 
#include <bits/stdc++.h>
#endif
using namespace std;
uint64_t gcd(uint64_t l, uint64_t r) {
	if (r == 0)return l;
	return gcd(r, l%r);
}
template <uint64_t maxval>
struct Prime {
	uint64_t primevals[maxval / 8];
	uint64_t primecount;
	constexpr Prime() {
		primecount = 0;
		for (uint64_t i = 2; i < maxval; ++i) {
			for (uint64_t j = 0; j < primecount; ) {
				if (i%primevals[j] == 0) {
					++i; j = 0;
				}
				else {
					++j;
				}
			}
			primevals[primecount] = i;
			++primecount;
		}
	}
	vector<u6> nonfactor;
	u6 commonfactor;
	u6 primeout(vector<u6> &  a) {
		si size = a.size();
		u6 divcount = 0; bool exitflag = true;
		
		nonfactor.resize(a.size(), 1);
		commonfactor = 1;
		vector<si> indexbuf, indexbuf2;
		si nondivindex = 0;
		indexbuf.reserve(a.size()); indexbuf2.reserve(a.size());
		auto fn = [&](si index,u6 p,u6 p2) {
			if (a[index] > p2)exitflag = false;
			//auto tmp = __gcd(a[index],p);
			if (a[index]%p==0) {
				a[index] /= p; ++divcount;
				indexbuf.push_back(index);
			}
			else {
				nondivindex = index;
			}
		};
		for (uint64_t i = 0; i < primecount; ) {
			exitflag = true; divcount = 0;u6 p2=primevals[i]*primevals[i];
			nondivindex=0;
			for (si index=0; index!=a.size(); ++index) {
				fn(index, primevals[i],p2);
			}
			while (divcount != 0) {
				if (divcount == size - 1) {
					nonfactor[nondivindex] *= primevals[i];
				}
				else if (divcount == size) {
					commonfactor *= primevals[i];
				}
				indexbuf2.swap(indexbuf);
				indexbuf.clear(); divcount = 0;
				for (auto index : indexbuf2)fn(index, primevals[i],p2);
			}
			++i;
			if (exitflag) {
				break;
			}
		}
		unordered_map<u6,u6> m;
		for(auto x:a){if(x!=1){++m[x];}}
		for(auto ite=m.begin();ite!=m.end();++ite){
			if(ite->second==size){commonfactor *= ite->first;}
			else if(ite->second==size-1){
				for(si i=0;i<size;++i){if((a[i]!=1) && (a[i]!=ite->first)){nonfactor[i] *=ite->first;  }}
			}
		}
		
		auto elemi = max_element(ALL(nonfactor));
		return *elemi*commonfactor;
	}
};
Prime<31625> prime;
 
int main() {
	//istringstream in("3\n7 6 8");
  	auto & in  =cin;
	u6 l;
	in >> l;
	vector<u6> a(l);
	for (si i = 0; i < l; ++i)in >> a[i];
	cout << prime.primeout(a) << endl;
}


Measured memory_bytes: 3456
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	
	if i=='N':
		k=data[0]
		m=data[4]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[2]=data[5]
		data[3]=k
		data[5]=m
print(data[0])

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

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    ll k;
    cin >> n >> k;
    vector<ll> cnt(100000,0);

    ll sum = 0;
    rep(i,n) {
        int a,b;
        cin >> a >> b;
        --a;
        cnt[a] += b;
    }
    rep(i,100000) {
        if(k > cnt[i]) {
            k -= cnt[i];
        }
        else {
            cout << (i+1) << endl;
            return 0;
        }
    }
}

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

using namespace std;

typedef long long ll;
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; }


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

    int P, Q, R;

    cin >> P >> Q >> R;
    cout << min(min(P+Q, Q+R), P + R) << endl;


    return 0;
}



Measured memory_bytes: 256
N = int(input())  # ここで標準入力
A = list(map(int, input().split()))
out = 0
flag = True

while flag:
    for i in range(N):
        if A[i]%2 != 0:
            flag = False
        A[i] = A[i]/2
    if flag:
        out = out + 1

print(out)


Measured memory_bytes: 38512
import bisect

N = int(input())
Llist = list(map(int, input().split()))
Llist.sort()

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        if Llist[i] == Llist[j]:
            continue

        res = Llist[j+1:]
        while Llist[j] in res:
            res.pop(0)
        l = Llist[i] + Llist[j]
        cnt += bisect.bisect_left(res, l)

print(cnt)

Measured memory_bytes: 9156
#include <stdio.h>

int     main(void)
{
    int S;
    int h;
    int m;

    S = 0;
    h = 0;
    m = 0;
    scanf("%d",&S);
    if (0 <= S < 86400)
    {
        while (S >= 3600)
        {
            S = S - 3600;
            h++;
        }
        while (S >= 60)
        {
            S = S - 60;
            m++;
        }
        printf("%d:%d:%d\n",h,m,S);
    }
    return (0);
}


Measured memory_bytes: 2120
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

N = int(input())
q = []
c = [0] * N
l = [0] * N
A = [[] for i in range(N)]
W = [[] for i in range(N)]

for i in range(N-1):
	u, v, w = map(int,input().split())
	u -= 1
	v -= 1
	
	A[u].append(v)
	A[v].append(u)
	W[u].append(w)
	W[v].append(w)

q.append(0)
while len(q):
	i = q.pop(0)
	c[i] = 1
	k = 0
	for j in A[i]:
		if c[j] == 0:
			q.append(j)
			l[j] = l[i] + W[i][k]
		k += 1

for i in l:
	print('{}'.format(i%2))
	

Measured memory_bytes: 42728
#include<bits/stdc++.h>
using namespace std;
//using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main(){
  vector<int>s = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout<< s[k-1] <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

ll N=55555*5;
vector<bool> isp(N+1, true);

void sieve() {
  isp[0] = false;
  isp[1] = false;
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
  }
}
int main() {
    sieve();
    ll M;
    cin >>M;
    vector<ll>p;
    rep(i,55556){
        if(isp[i]){
            if(i%5==1)
                p.pb(i);
            
        }
    }
    rep(i,M){
        cout<<p[i]<<" ";
    }

    cout  << endl;


    return 0;
    

}

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

int main() {
	int a,b,start=10000,finish=-10000;
	cin>>a;
	for(int i=0;i<a;i++) {
		cin>>b;
		start=min(start,b);
		finish=max(finish,b);
	}
	cout<<finish-start<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,k;
  cin >> n >> k;
  P a[n];
  rep(i,n) cin >> a[i].F >> a[i].S;
  ll l=0,r=MAXL;
  while(l+1<r) {
    ll m=(l+r)/2,cnt=0;
    rep(i,n) {
      if(m<a[i].F) continue;
      ll d=m-a[i].F;
      cnt+=d/a[i].S+1;
    }
    if(cnt<0) r=m;
    else if(cnt<k) l=m;
    else r=m;
  }
  pr(r);
}

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


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

using namespace std;

typedef long long ll;

const ll maxL = 14;

ll dp[maxL+1][3][maxL*9+1][18601] = {0};

ll toLL(string str) {
	stringstream ss; ss << str;
	ll res; ss >> res;
	return res;
}
int main() {
	string strN; cin >> strN;
	ll N = toLL(strN);
	ll L = strN.size();
	set<ll> s[maxL+1];
	s[0].insert(1);
	for (ll i = 0; i < L; ++i) {
		for (set<ll>::iterator it = s[i].begin(); it != s[i].end(); ++it) {
			for (ll j = 1; j <= 10; ++j) {
				s[i+1].insert(*it * j);
			}
		}
	}
	ll ids = s[L].size();
	vector<ll> prods;
	for (set<ll>::iterator it = s[L].begin(); it != s[L].end(); ++it) {
		prods.push_back(*it);
	}
	map<ll, ll> tbl;
	for (ll i = 0; i < ids; ++i) {
		tbl[prods[i]] = i;
	}

	ll G[18601][10]; fill(G[0], G[18601], -1);
	for (ll i = 0; i < ids; ++i) {
		for (ll j = 0; j < 10; ++j) {
			ll v = prods[i]*(j+1);
			if (tbl.count(v) > 0) {
				G[i][j] = tbl[v];
			}
		}
	}

	dp[0][1][0][0] = 1;
	for (ll i = 0; i < L; ++i) {
		for (ll j = 0; j < 3; ++j) {
			for (ll ds = 0; ds <= L*9; ++ds) {
				for (ll k = 0; k < ids; ++k) {
					if (dp[i][j][ds][k]) {
						if (j == 1) {
							ll dl = strN[i]-'0';
							for (ll d = 0; d < 10; ++d) {
								ll nj = d > dl ? 2 : d == dl ? 1 : 0;
								dp[i+1][nj][ds+d][G[k][d]] += dp[i][j][ds][k];
							}
						}
						else {
							for (ll d = 0; d < 10; ++d) {
								dp[i+1][j][ds+d][G[k][d]] += dp[i][j][ds][k];
							}
						}
					}
				}
			}
		}
	}

	ll KK = 1; for (ll i = 0; i < L; ++i) KK *= (strN[i]-'0')+1;
	ll K = tbl[KK];
	ll DS = 0; for (ll i = 0; i < L; ++i) DS += strN[i]-'0';

	ll ans = 0;
	for (ll j = 0; j < 3; ++j) {
		for (ll ds = 0; ds <= DS; ++ds) {
			for (ll k = 0; k < ids; ++k) {
				if (ds < DS || (ds == DS && k < K) || (ds == DS && k == K && j != 2)) {
					ans += dp[L][j][ds][k];
				}
			}
		}
	}
	cout << ans-1 << endl;
}

Measured memory_bytes: 37924
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

char buf[10];

int main(void) {
  cin >> buf;
  sort(buf, buf + 4);
  if(buf[0] == buf[1] && buf[2] == buf[3] && buf[1] != buf[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 384
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
h=[int(i) for i in input().split()]
ans=0
cnt=0
for i in range(n-1):
    #print(h[i],h[i+1],cnt)
    if h[i]>=h[i+1]:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)
print(ans)

Measured memory_bytes: 14172
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main()
{    
    string s;
    
    cin >> s;
    
    int n = s.size();
    
    vector<int> a(n + 1), b(n + 1);
    
    for (int i = 0; i < n; i++) {
        if (s[i] == '<') {
            a[i + 1] = a[i] + 1;   
        } else {
            a[i + 1] = 0;
        }            
    }
    
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '>') {
            b[i] = b[i + 1] + 1;   
        } else {
            b[i] = 0;
        } 
    }
    
    long long ans = 0;
    
    for (int i = 0; i < n + 1; i++) {
        ans += max(a[i], b[i]);   
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 4856