akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);


	int N;

	string s;

	cin >> N >> s;

	for (auto& c : s) {
		cout << char(((c - 'A' + N) % 26) + 'A');
	}



	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


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

#define ED return 0;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) long(pow(x,y))
const long long int mod = 1000000007;
unsigned long long int gcd(unsigned long long int a, unsigned long long int b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> vec (N);
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
        if(i != 0 && vec.at(i).at(0) != vec.at(i-1).at(vec.at(i-1).size()-1)){
            cout << "No" << endl;
            ED
        }
        for(int j = 0;j < i;j++){
            if(vec.at(i) == vec.at(j)){
                cout << "No" << endl;
                ED
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
キュー　queue<int> q;
   q.push(7);　//７が入る
   cout << q.front() << endl;  // 先頭の値を出力
   q.pop();  // 先頭の値を削除
   q.empty();
*/
//座標　corrdinateト深さヲ保持スルタメノ構造体
struct Coor{
  ll y;
  ll x;
  ll depth;
};
 ll N,M;  
 ll sy,sx,gy,gx;
 ll y,x,depth;//キューから取り出した座標
vector<string> vec;
queue<Coor> q;
vector<ll> y_vec={0,0,-1,+1};//technique
vector<ll> x_vec={-1,+1,0,0};

int BFS(){
  while(!q.empty()){
    Coor now=q.front();q.pop();//キューの先頭を取り出す
    y=now.y,x=now.x,depth=now.depth;
    
    //停止条件
    if(y==gy&&x==gx){return depth;}
    
    //上下左右４方向を探索、進むことができればキューに格納
    for(int i=0;i<4;i++){
      Coor next={y+y_vec[i],x+x_vec[i],depth+1};
      if(0<=next.y&&next.y<=N-1&&0<=next.x&&next.x<=M-1&&vec[next.y][next.x]=='.'){
        vec[next.y][next.x]='x';//同じ場所を探索しないようにする
        q.push(next);
      }
    }
  }
  return 0;
}
                   
  


int main(void){
cout<<fixed<<setprecision(14);
//cin.tie(0); ios::sync_with_stdio(false);

int N,K;
  cin>>N>>K;
  ll ans;
  ll cnt =K;
  if(K==2){ans=2;}
  if(K>2){
  for(int i=1;i<N;i++){
    cnt*=K-1;
  }
    ans=cnt;
  }
  
  cout<<ans<<endl;
  
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		long[] a = new long[n];
		long sum = 0;
		for(int i = 0;i < n;i++){
			a[i] = saori.saorihayami();
			sum += a[i];
		}
		long ans = Long.MAX_VALUE;
		long num = 0;
		for(int i = 0;i < n-1;i++){
			num += a[i];
			ans = Math.min(ans,Math.abs(Math.abs(num-sum)-num));
		}
		System.out.println(ans);
		

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 35756
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  // 標準入力高速化のおまじない
  // scanfとの同期を切る。以降紛らわしいのでscanf使用不可。
  ios::sync_with_stdio(false);
  // // cin前の自動flashをやめる
  cin.tie(nullptr);

  int N;
  cin >> N;
  vector<ll> vec(10e5+1,0);
  ll result = 0;
  for(int i=0; i<N; i++){
    int t;
    cin >> t;
    vec[t]++;
    result += t;
  }

  int Q;
  cin >> Q;
  for(int i=0; i<Q; i++){
    int replace_before,replace_after;
    cin >> replace_before >> replace_after;
    ll replace_count = vec[replace_before];
    result -= (replace_before * replace_count);
    result += (replace_after * replace_count);
    vec[replace_after] += replace_count;
    vec[replace_before] = 0;

    cout << result << endl;
  }

  return 0;
}


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

int n, m;
int p[200000];
int r[200000];
int Rank[200000];

int root(int x) {
    if (r[x] == x) {
        return x;
    } else {
        r[x] = root(r[x]);
        return r[x];
    }
}

void marge(int x, int y) {
    x = root(x);
    y = root(y);
    if (Rank[x] < Rank[y]) {
        r[x] = y;
    } else {
        r[y] = x;
        if (Rank[x] == Rank[y]) {
            Rank[x]++;
        }
    }
}

bool same(int x, int y) {
    return root(x) == root(y);
}

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
        r[i] = i;
        Rank[i] = 0;
    }
    while (m--) {
        int x, y;
        cin >> x >> y;
        marge(x, y);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (same(i, p[i])) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s == "RRR") cout << 3 << endl;
    else if(s == "SRR" || s == "RRS") cout << 2 << endl;
    else{
        int ans = 0;
        for(int i = 0; i < 3; i++){
            if(s[i] == 'R') ans = 1;
        }
        cout << ans << endl;
    }
    return 0;
}

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

using ll = long long;
const int maxn = (1 << 18) + 3;
int n;
ll a[maxn], l[maxn], r[maxn], ans[maxn];

void solve(int b, int pm) {
    for(int i = 0; i < (1 << b); ++i) {
        l[i] = a[i | pm];
    }
    for(int i = 0; i < (1 << b); ++i) {
        r[i] = a[i | pm | (1 << b)];
    }
    for(int i = 0; i < (1 << b); ++i) {
        for(int k = i, j; k; k -= j) {
            j = k & -k;
            l[i] = std::max({l[i], l[j], l[i ^ j]});
            r[i] = std::max({r[i], r[j], r[i ^ j]});
        }
        ans[i | (1 << b) | pm] = std::max(ans[i | (1 << b) | pm], l[i] + r[i]);
    }
    if(b <= 0)
        return;
    solve(b - 1, pm);
    solve(b - 1, pm | (1 << b));
}

int main() {
    scanf("%d", &n);
    for(int i = 0; i < (1 << n); ++i)
        scanf("%lld", a + i);
    solve(n - 1, 0);
    for(int i = 2; i < (1 << n); ++i)
        ans[i] = std::max(ans[i - 1], ans[i]);
    for(int i = 1; i < (1 << n); ++i)
        printf("%lld\n", ans[i]);
    return 0;
}

Measured memory_bytes: 9948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int lim = 1e5+5;
const int mod = 1e9+7;

vector<ll> pfac(ll n) {
	vector<ll> ans;
	for(ll i=2;i*i<=n;i++)
		if(n%i==0) {
			ans.push_back(i);
			while(n%i==0)
				n/=i;
		}
	if(n>1)
		ans.push_back(n);
	return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
   	ll a,b;
   	cin>>a>>b;
   	vector<ll> fa = pfac(a);
   	vector<ll> fb = pfac(b);
   	vector<ll> gc;
   	for(ll x:fa)
   		if(binary_search(fb.begin(),fb.end(),x))
   			gc.push_back(x);
   	cout<<gc.size()+1;
    return 0;
}

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

#define DECIMAL_POINT 9
#define UPPER_DECIMAL 0
#define UNDER_DECIMAL -1

#define element_num_max 19

long long int array[200001];

int main()
{

	int n = 0;
	long long int t;
	int d_p, d_c;
	long long int mul = 0;
	long long int answer = 0;
	char num_arrray[20];
	int ele_two_ind, ele_five_ind;

	long long int element_array[element_num_max][element_num_max];

	for (int i = 0; i<element_num_max; i++)
	{
		for (int j = 0; j<element_num_max; j++)
		{
			element_array[i][j] = 0;
		}
	}

	scanf("%d", &n);

	for (int i = 0; i<n; i++)
	{
		scanf("%s", num_arrray);

		d_p = DECIMAL_POINT;
		d_c = UPPER_DECIMAL;
		t = 0;

		for (int j = 0; j<strlen(num_arrray); j++)
		{
			int current_num = 0;

			if (num_arrray[j] == '.')
			{
				d_c = UNDER_DECIMAL;
				continue;
			}

			current_num = num_arrray[j] - '0';

			if (d_c == UPPER_DECIMAL)
			{
				t = t * 10 + current_num;
			}
			else {
				t = t * 10 + current_num;
				d_p += UNDER_DECIMAL;
			}

		}

		for (int k = 0; k<d_p; k++)
		{
			t *= 10;
		}

		array[i] = t;

		for (ele_two_ind = 0; (t % 2) == 0; ele_two_ind++)
		{
			t /= 2;
		}

		if (ele_two_ind >= element_num_max)
			ele_two_ind = (element_num_max - 1);

		for (ele_five_ind = 0; (t % 5) == 0; ele_five_ind++)
		{
			t /= 5;
		}

		if (ele_five_ind >= element_num_max)
			ele_five_ind = (element_num_max - 1);

		element_array[ele_two_ind][ele_five_ind] ++;

	}

	for (int i = 0; i<element_num_max; i++)
	{
		for (int j = 0; j<element_num_max; j++)
		{
			for (int i_s = (element_num_max - 1 - i); (i_s<element_num_max); i_s++)
			{
                int j_s = (element_num_max - 1 - j);

				if (i > i_s)
					i_s = i;

                if ((i == i_s)&&(j > j_s))
                {
                    j_s = j;
                }

				for (; (j_s<element_num_max); j_s++)
				{
					if ((i == i_s) && (j == j_s))
					{
						answer += element_array[i][j] * (element_array[i_s][j_s] - 1) / 2;
					}
					else {
						answer += element_array[i][j] * element_array[i_s][j_s];
					}
				}
			}
		}
	}

	printf("%lld", answer);

	return 0;
}

Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=1;i<=(n);++i)
int N,A[100005],B,ans=0;
signed main(){
  cin >> N;
  rep(i,N+1) cin >> A[i];
  rep(i,N){
    cin >> B;
    if(B-A[i]>=0){
      ans+=A[i];
      B-=A[i];
      if(B-A[i+1]>=0){
        ans+=A[i+1];
        A[i+1]=0;
      }
      else{
        ans+=B;
        A[i+1]-=B;
      }
    }
    else ans+=B;
  }
  cout << ans << endl;
return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define INF (int)1e8
#define EPS 1e-9

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;

  int sum = findSumOfDigits(N);
  if (sum == 1) sum = 10;

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
/*int p = 998244353;*/
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
signed main(){
	V<string> v = { "thu","fri","sat","sun","mon","tue","wed" };
	int x; cin >> x;
	cout << v[x % 7] << endl;
}


Measured memory_bytes: 3236
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    double ret = 0;
    double temp = 1.0/N;
    for(int i=1;i<=N;i++){
        int now = i;
        temp = 1.0/N;
        while( now < K ){
            now *= 2;
            temp /=2;
        }
        ret += temp;
    }
    cout << setprecision(9) << ret <<endl;
    return 0;
}

Measured memory_bytes: 256
import math

n = int(input())
s = int(input())

b = -1

def keisan(k, w):
  l = []
  while k >= w:
    l.append(k % w)
    k = k // w
  else:
    l.append(k)
  return (sum(l))

if n == s:
  b = n + 1
  print(b)
  exit()
  
if n < s:
  b = -1
  print(b)
  exit()

n_r = math.floor(math.sqrt(n))

for i in range(2, n_r+1):
  if keisan(n, i) == s:
    b = i
    print(b)
    exit()

b_list = []    
    
for i in range(1, n_r+1):
  w = n - s
  syou = w // i
  amari = w % i
  if amari == 0:
    b_kouho = syou + 1
    b_list.append(b_kouho)
#    print(b_list)

b_kansei = []

for b in b_list:
  b_ = keisan(n, b)
  if b_ == s:
    b_kansei.append(b)
#    print("b_kanseiは" + str(b_kansei))

if b_kansei != []:
  print(min(b_kansei))
else:
  print(-1)

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N,K; cin >> N >> K;
  string s; cin >> s;

  vector<int> num;
  int now = 1;
  int cnt = 0;
  for ( int i = 0; i < s.length(); i++ ) {
    if ( s[i] == (char)('0' + now) ) cnt++;
    else {
      num.push_back(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }
  num.push_back(cnt);
  int Add = K * 2 + 1;
  int left = 0,right = 0,sum = 0;
  int ans = 0;
  for ( int i = 0; i < num.size(); i += 2 ) {
    int Nextleft = i;
    int Nextright = min(i + Add, (int)num.size() );
    while( Nextleft > left ) sum -= num[left++];
    while( Nextright > right ) sum += num[right++];
    ans = max(ans,sum);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int Maxn=1e5+10,MOD=1e9+7;
int N;
vector<int> G[Maxn];
int Dp[Maxn][2];
void Dfs(int X,int Par)
{
	Dp[X][0]=Dp[X][1]=1;
	for(int i=0;i<G[X].size();i++)
	{
		int To=G[X][i];
		if(To==Par)
		{
			continue;
		}
		Dfs(To,X);
		(Dp[X][0]*=(Dp[To][0]+Dp[To][1])%MOD)%=MOD;
		(Dp[X][1]*=Dp[To][0]%MOD)%=MOD;
	}
}
signed main()
{
	cin>>N;
	for(int i=1;i<=N-1;i++)
	{
		int X,Y;
		cin>>X>>Y;
		G[X].push_back(Y);
		G[Y].push_back(X);
	}
	Dfs(1,1);
	cout<<(Dp[1][0]+Dp[1][1])%MOD<<endl;
	return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 1e5+5;
const ll mod =   1e9+7;
ll n;ll ans=0;ll arr[N];
int main()
{  fast cin>>n;
for(ll i=1;i<=200;i++){
	for (ll j=1;j<=200;j++){
		for(ll k=1;k<=200;k++){
			ll z=1ll*(1ll*i*i+1ll*j*j+1ll*k*k+1ll*i*j+1ll*j*k+1ll*i*k);
			if(z<=n)
			arr[z]++;
		}
	}
}
for(int i=1;i<=n;i++){
	cout<<arr[i]<<endl;
}
}

Measured memory_bytes: 3644
use proconio::input;
use std::cmp::{max, min};

const MAX_L: usize = 100_000;
const BASE_SIZE: usize = 1 << 10;

fn main() {
    input! {
        n: usize,
        vw: [(u32, u32); n],
        q: usize,
        ul: [(usize, usize); q],
    }
    let dp = make_dp(&vw);
    for (u, l) in ul {
        println!("{}", calc(&dp, &vw, u - 1, l));
    }
}

fn make_dp(vw: &Vec<(u32, u32)>) -> Vec<Vec<u32>> {
    let mut dp = Vec::<Vec<u32>>::new();

    dp.push({
        let w = vw[0].1 as usize;
        (0..=MAX_L)
        .map(|i| if i < w { 0 } else { vw[0].0 })
        .collect()
    });

    let n = min(vw.len(), BASE_SIZE - 1);
    for c in 1..n {
        let p = (c - 1) / 2;
        dp.push({
            let w = vw[c].1 as usize;
            let v = vw[c].0;
            (0..=MAX_L)
            .map(|i| {
                max(dp[p][i], if i < w { 0 } else { dp[p][i - w] + v })
            })
            .collect()
        });
    }

    dp
}

fn calc(
    dp: &Vec<Vec<u32>>,
    vw: &Vec<(u32, u32)>,
    u: usize, 
    l: usize,
) -> u32 {
    if u < dp.len() {
        dp[u][l]
    } else {
        let p = (u - 1) / 2;
        let w = vw[u].1 as usize;
        let sum1 = calc(dp, vw, p, l);
        let sum2 = if l < w { 0 } else { calc(dp, vw, p, l - w) + vw[u].0 };
        max(sum1, sum2)
    }
}


Measured memory_bytes: 410912
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int X;
    cin >> X;
    double dived=(double)X/105;
    auto canbuy = (int)ceil(dived);
    int availableAdjust = canbuy*5;
    int allPCbuyCost = 105*canbuy;
    if ((allPCbuyCost-X)<=availableAdjust) {
        cout << 1 << endl;
        exit(0);
    }
    cout << 0 << endl;

    return 0;
}


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

int main() {
  double a, b, x, d;
  cin >> a >> b >> x;
  if (x >= 0.5 * a * a * b) {
    d = 180.0 / M_PI * atan((a * a * b - x) / (0.5 * a * a * a));
  } else {
    d = 90 - 180.0 / M_PI * atan(x / (0.5 * a * b * b));
  }
  cout << setprecision(15) << d << endl;
}


Measured memory_bytes: 256
import heapq

N,K = map(int,input().split())
V = list(map(int,input().split()))
ans = -float('inf')
for ai in range(K+1):
  for bi in range(K+1):
    if ai+bi > min(K,N): continue
    have_plus = []
    have_neg = []
    if ai != 0: [heapq.heappush(have_plus, v) if v >= 0 else heapq.heappush(have_neg, v) for v in V[:ai]]
    if bi != 0: [heapq.heappush(have_plus, v) if v >= 0 else heapq.heappush(have_neg, v) for v in V[N-bi:]]
    for i in range(K-ai-bi):
      if len(have_neg) != 0:
        heapq.heappop(have_neg)
    ans = max(ans,sum(have_plus)+sum(have_neg))
print(ans)

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

using namespace std;

int main (){

int arr [5];

for(int i=0; i<5; i++){
    cin >> arr[i];
}

for(int i=0; i<5; i++){
    if(arr[i] ==0){
        cout<<i+1;
        break;
    }
}
 
    return 0;
}

Measured memory_bytes: 3584
import math

while True:
    n = int(input())
    if n == 0: break
    s = [float(x) for x in input().split()]
    m = sum(s)/len(s)
    s = [(_s - m) ** 2 for _s in s]
    a = math.sqrt(sum(s)/len(s))
    print(a)


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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts

int main()
{
  int h,w,d;cin>>h>>w>>d;
  vector<vector<int>> a(h,vector<int>(w));
  vector<int> x(h*w+1,-1);
  vector<int> y(h*w+1,-1);
  int i,j;
  rep(i,h)rep(j,w)cin>>a[i][j];
  int q;cin>>q;
  vector<int> l(q);
  vector<int> r(q);
  rep(i,q)cin>>l[i]>>r[i];
  vector<int> cost(h*w+1,0);
  rep(i,h)rep(j,w)
  {
    x[a[i][j]]=i;
    y[a[i][j]]=j;
  }
  for(i=d+1;i<=h*w;i++)
  {
    cost[i]=cost[i-d]+abs(x[i]-x[i-d])+abs(y[i]-y[i-d]);
  }
  rep(i,q)cout<<cost[r[i]]-cost[l[i]]<<endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    string N;

    cin >> N;

    if(N[0]=='7' || N[1]=='7' || N[2]=='7'){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
N = int(input())

S = input()

retsu = "ZABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha2num = lambda c: ord(c) - ord('A') + 1
num2alpha = lambda c: chr(c + 64)

for index in range(len(S)):
    temp =retsu[((alpha2num(S[index]) + N) % 26)]
    print(temp, end="")

Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    ll a[n];
    ll res = 0;
    REP(i ,n){
        cin >> a[i];
        if((i % 2) == 0 and(a[i] % 2) == 1)res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s;
  cin >> s;

  bool cond1 = false, cond2 = false, cond3 = false;
  cond1 = s[0] == 'A';

  int n = s.size();
  string sub = s.substr(2, n - 1 - 2);
  int c_count = 0;
  rep(i, 0, sub.size()) {
    if (sub[i] == 'C')
      c_count++;
  }
  cond2 = c_count == 1;
  cond3 = s[1] >= 'a' && s[n - 1] >= 'a';

  if (cond1 && cond2 && cond3)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
}


Measured memory_bytes: 256
import itertools
N = int(input())
X = [input()[0] for _ in range(N)]
M = X.count("M")
A = X.count("A")
R = X.count("R")
C = X.count("C")
S = 0
H = X.count("H")
for s in itertools.combinations([M, A, R, C, H], 3):
  S += s[0]*s[1]*s[2]
print(S)

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

void debug_out() {
    cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
    FAST
    ll a,b,x;
    cin>>a>>b>>x;
    if(b>x)
    {
        cout<<a*x/b<<endl;
    }
    else
    {
        cout<<a*(b-1)/b<<endl;
    }

    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
//#define zerol
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout  << #x << " -> "; err(x); } while (0)
void err() { cout <<  endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

const int MAXN = 1e3+5;
const LL MOD = 1e9+7;

vector<int> p;
bool nop[MAXN];

void getp() {
    FOR (i, 2, MAXN) {
        if (!nop[i]) {
            p.push_back(i);
            for (int j=2*i; j<MAXN; j+=i)
                nop[j] = 1;
        }
    }
}

int cnt[MAXN];

int main() {
    getp();
    int n;
    cin >> n;
    FOR (i, 1, n+1) {
        int j = i;
        for (int pr:p) {
            while (j%pr == 0) {
                ++cnt[pr];
                j /= pr;
            }
            if (j == 1) break;
        }
    }
    LL ans = 1;
    FOR (i, 1, MAXN) {
        ans = ans * (cnt[i]+1) % MOD;
    }

    cout << ans << endl;


    return 0;
}


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

// clang-format off
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define endl '\n'
#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
    int N = input();
    
    vector< double > dp(N + 1);
    dp[0] = 1;
    
    range(i, 0, N) {
        double p = input< double >();
        
        vector< double > v(N + 1);
        range(i, 0, N) {
            v[i + 1] += dp[i] * p;
            v[i] += dp[i] * (1 - p);
        }
        
        dp = v;
    }
    
    double ans = 0;
    range(i, N / 2 + 1, N + 1) {
        ans += dp[i];
    }
    
    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

bool dp[1 << 12][5001];
int main() {
	while (1) {
		int n, m; cin >> n >> m;
		if (!n)break;
		vector<string>elems;
		for (int i = 0; i < n; ++i) {
			string st; cin >> st;
			elems.push_back(st);
		}
		UnionFind uf(n);
		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j < n; ++j) {
				if (elems[i] == elems[j])uf.unionSet(i, j);
			}
		}
		long long int waru = 1; 
		{
			set<int>used;
			for (int i = 0; i < n; ++i) {
				if (used.find(uf.root(i))==used.end()) {
					used.emplace(uf.root(i));
					int num=uf.size(i);
					while (num >= 2)waru *= num--;
				}
			}
		}
		

			string text;
		for (int i = 0; i < m; ++i) {
			string st; cin >> st;
			text += st;
		}
		vector<vector<int>>oks(n, vector<int>(text.size()));
		for (int e = 0; e < elems.size(); ++e) {
			for (int i = 0; i <= text.size()-elems[e].size(); ++i) {
				if (elems[e] == text.substr(i, elems[e].size())) {
					oks[e][i] = true;
				}
			}
		}
		memset(dp, false, sizeof(dp));
		for (int i = 0; i < 5001; ++i) {
			dp[0][i] = true;
		}
		set<int>ans;
		for (int j = 0; j < text.size(); ++j) {
			/*if (j % 100 == 0) {
				num++;
				for (int j = 0; j < 1 << 12; ++j) {
					
				}
				for (int j = 0; j < 1 << 12; ++j) {
					for (int i = 0; i < 100; ++i) {
						dp[0][i] = 1;
						dp[j][i] = dp[j][i + 100];
					}
					for (int i = 100; i < 501; ++i) {
						dp[0][i] = 1;
						dp[j][i] = 0;
					}
				}
			}*/
			for (int i = 0; i < 1 << n; ++i) {
				bitset<12>uses(i);
				for (int e = 0; e < n; ++e) {
					if (oks[e][j]&&!uses[e]&&dp[i][j]) {
						const int next = j + elems[e].size();
						if (next <= text.size()) {
							uses[e] = true;
							if (uses.count() == n)ans.emplace(next);
							dp[uses.to_ulong()][next] = true;
							uses[e] = false;
						}
					}
				}
			}
		}
		cout << ans.size() << endl;
		
	}
	return 0;
}

Measured memory_bytes: 23500
#include <bits/stdc++.h>
#define pb push_back

std::vector<int> adx;

int main(void)
{
	int a,b,k;
	std::cin>>a>>b>>k;
	int gc = std::__gcd(a, b);
	for(int i=1;i*i<=gc;i++)
	{
		if(!(gc % i))
		{	
			if(i * i == gc)
			adx.pb(i);
			else
			{
				adx.pb(i);
				adx.pb(gc/i);
			}
		}	
	}
	std::sort(adx.rbegin(), adx.rend());
	std::cout<<adx[k-1]<<"\n";
	return 0;	
}

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

using namespace std;

int main()
{
  int a,b,c,d;
  
  cin >> a >> b >> c >> d;
  
  vector<int> vec = {a,b,c,d};
  sort(vec.begin(), vec.end());
  
  if( vec.at(0) == 1 &&
      vec.at(1) == 4 &&
      vec.at(2) == 7 &&
      vec.at(3) == 9 )
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
    
  return 0;
  
}

Measured memory_bytes: 256
def bottom(line):
    N=[]
    line=str(line)
    #print(line)
    for i in list(line):
        N.append(int(i))
    #print(N)
    if len(N)==1:return line
    else:
        ans=""
        for j in range(len(N)):
            M=[]
            if j==len(N)-1:return bottom(ans)
            else:
                num=N[j]+N[j+1]
                #print(num)
                M=list(str(num))
                ans +=M[-1]
while 1:
    try:print(bottom(input()))
    except:break



Measured memory_bytes: 5592
//Keep working hard.
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);


int32_t main(){
	IOS;
	cout.precision(10);
    cout << fixed;
   	string s;
   	int cnt = 0;
   	cin >> s;
   	for(auto i : s){
   		if(i == '1')cnt++;	
    }          
    cout << cnt;

 	return 0;
 }

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


int main(){
  int a, b, ans = 0;
  string s;

  cin >> a >> b;

  for(int i=a; i<=b; ++i){
    s = to_string(i);

    for(int k=0; k<s.size()/2; ++k){
      if(s[k] != s[s.size()-1-k]) break;
      if(k == s.size()/2-1) ++ans;
    }
  }

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define INF 2000000000
using namespace std;
int c=0;
vector<int> merge(vector<int> A, vector<int> B){
  vector<int> res;
  int i=0,j=0;
  while(i<(int)A.size()||j<(int)B.size()){
    if(i<(int)A.size()&&j<(int)B.size()){
      if(A[i]<=B[j])res.push_back(A[i++]);
      else res.push_back(B[j++]);
    }
    else if(i<(int)A.size())res.push_back(A[i++]);
    else if(j<(int)B.size())res.push_back(B[j++]);
    c++;
  }
  return res;
}

vector<int> mergesort(vector<int> A){
  if(A.size()<2)return A;
  int mid=(A.size())/2;
  vector<int> left;
  vector<int> right;
  for(int i=0;i<(int)A.size();i++){
    if(i<mid)left.push_back(A[i]);
    else right.push_back(A[i]);
  }
  left=mergesort(left);
  right=mergesort(right);
  return merge(left,right);
}
 
 
int main(){
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  v=mergesort(v);
  for(int i=0;i<(int)v.size()-1;i++){
    cout<<v[i]<<" ";
  }
  cout<<v[n-1]<<endl<<c<<endl;
  return 0;
}


Measured memory_bytes: 13480
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	x := nextInt()

	for i := -1000; i < 1000; i++ {
		i5 := i * i * i * i * i
		for j := -1000; j < 1000; j++ {
			j5 := j * j * j * j * j
			if i5-j5 == x {
				fmt.Println(i, j)
				return
			}
		}
	}

	fmt.Println("DBG") //! DBG
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
 
#define N (int)1e5+5
#define f1 first
#define s2 second
#define INF 9999999
#define pb push_back
#define ll long long
#define ull unsigned long long;
#define all(a) a.begin(),a.end()
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);

vector<int>v[N];
int n,m,a,b,ans,dp[N];
bool visit[N];

void dfs(int x){
	visit[x]=1;
	for(auto i: v[x]){
		if(!visit[i])
			dfs(i);
		dp[x] = max(dp[x],1+dp[i]);
	}
}

int main(){
	//fri("in.txt");
	//fro("out.txt");
	cin >> n >> m;
	memset(dp,0,sizeof(dp));
	for(int i = 0; i < m; i++){
		cin >> a >> b;
		v[a].pb(b);
	}
	for(int i = 1; i<= n; i++){
		if(!visit[i])dfs(i);
		ans = max(ans,dp[i]);
	}
	cout << ans << endl;
	return 0;
}

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

void solve()
{
    int n,m,k,i,j,count=0,sum=0,maxi=0,mini=1e18,flag=0;
    
    
    string s;
    cin>>s;
    for(i=0;i<3;i++)
    {
        cout<<s[i];
    }
    
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--)
    {
        solve();
    }
}

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

#define INF 0x3f3f3f3f
#define MOD 1000000007
#define int long long
#define pii pair<int, int>

const int N = 1005;

string grid[N];
int dp[N][N];


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

    int n, m, i, j;
    cin >> n >> m;
    for(i = 0 ; i < n ; i++)
        cin >> grid[i];
    dp[0][0] = 1LL;
    for(i = 0 ; i < n ; i++) {
        for(j = 0 ; j < m ; j++) {
            if(i or j)
                dp[i][j] = 0LL;
            if(grid[i][j] == '#')
                continue;
            if(i)
                dp[i][j] += dp[i-1][j];
            if(j)
                dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
            if(dp[i][j] < 0)
                dp[i][j] += MOD;
        }
    }
    cout << dp[n-1][m-1] << endl;
    return 0;
}


Measured memory_bytes: 9216
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  int ans = 0;
  while(N != 0){
    N /= K;
    ans += 1;
    
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int n,d;
double x[100][100];
int main()
{
	cin>>n>>d;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=d;j++)cin>>x[i][j];
	}
	long long int ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(i==j)continue;
			double tmp=0;
			for(int k=1;k<=d;k++)
			{
				tmp+=abs(x[i][k]-x[j][k])*abs(x[i][k]-x[j][k]);
			}
			for(int k=1;k<=10000;k++)
			{
				if(k*k==tmp)
				{
					ans++;
					break;
				}
			}
		}
	}
	cout<<ans/2;
	return 0;
}

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

#define INF ll_MAX

typedef long long ll;

using namespace std;

int main(void){
	int n,d;
	cin >> n >> d;
	vector< vector<double> > x(n,vector<double>(d,0));

	for(int i = 0;i < n;i++){
		for(int j = 0;j < d;j++){
			cin >> x[i][j];
		}
	}
	int ans = 0;
	for(int i = 0;i < n;i++){
		// cout << "i:" << i << endl;
		for(int j = i+1;j < n;j++){
			// cout << "j;" << j << endl;
			double sum = 0;
			for(int k = 0;k < d;k++){
				sum += pow(x[i][k] - x[j][k],2);
			}
			// cout << sum << endl;
			double sumsum = (int)(sqrt(sum));
			// cout << sumsum << endl;
			if(sumsum - sqrt(sum) == 0)ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 120
ll c[N];
pair<ll,ll> z;
int he[N],ne[N<<1],e[N<<1],cnt,x[N],y[N];
void add(int u,int v){ne[++cnt]=he[u];he[u]=cnt;e[cnt]=v;}
void update(){
	int u=0; ll ans=1;
	while (c[u]){
		ans*=c[u];
		u++;
	}
	z=min(z,{u,ans});
}
void dfs(int x,int fa,int dep){
	ll sz=0;
	for (int i=he[x];i;i=ne[i])
		if (e[i]!=fa){
			dfs(e[i],x,dep+1);
			sz++;
		}
	c[dep]=max(c[dep],sz);
}
int main(){
	int n;
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x[i],&y[i]);
		add(x[i],y[i]); add(y[i],x[i]);
	}
	z={n+1,1e9};
	for (int i=1;i<=n;i++){
		memset(c,0,sizeof(c));
		c[0]=1;
		dfs(i,0,1);
		update();
	}
	for (int i=1;i<n;i++){
		memset(c,0,sizeof(c));
		c[0]=2;
		dfs(x[i],y[i],1); dfs(y[i],x[i],1);
		update();
	}
	printf("%lld %lld\n",z.first,z.second);
	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
l1 = [1, 3, 5, 7, 8, 10, 12]
l2 = [4, 6, 9, 11]
l3 = [2]
x, y = map(int, input().split())

if((x in l1 and y in l1) or (x in l2 and y in l2) or (x in l3 and y in l3)):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 2940
#include<iostream>
#include<cstdlib>
#include<cstdio>

#define N 100001
#define NIL -1
using namespace std;

//array
int parent[N];
int leftc[N];
int rightc[N];

int degree[N];
int depth[N];
int root;


int main(){

  int n,i,j,id,child,bef;
  int flag=0;
   //initialize
  for(i=0;i<N;i++){
    parent[i]=NIL;
    leftc[i]=NIL;
    rightc[i]=NIL;
    degree[i]=0;
    depth[i]=0;
  }

  //load n
  scanf("%d",&n);

  //load data set parent, left child and 
  for(i=0;i<n;i++){
    scanf("%d %d",&id,&degree[i]);


    for(j=0;j<degree[i];j++){
      scanf("%d",&child);
  
      parent[child]=id;  
    
      if(j==0){
	leftc[id]=child;
      }
      else{
	rightc[bef]=child;
      }

      bef=child;
    }
  }

  //test
  // for(i=0;i<n;i++)printf("%d parent: %d leftchild: %d right child: %d\n",i,parent[i],leftc[i],rightc[i]);

  //find root
  for(i=0;i<n;i++){
    if(parent[i]==NIL){
      root=i;
      break;
    }
  }
  
  //calc depth

  for(i=0;i<n;i++){
    for(j=parent[i];j!=NIL;j=parent[j]){
      depth[i]++;
    }

  }
  

  
  
  //print
  for(i=0;i<n;i++){



    printf("node %d: parent = %d, depth = %d, ",i,parent[i],depth[i]);

    if(parent[i]==NIL)printf("root, ");
    else if(leftc[i]==NIL) printf("leaf, ");
    else printf("internal node, ");
   
    printf("[");
    for(j=leftc[i];j!=NIL;j=rightc[j]){
      printf("%d",j);
      if(rightc[j]!=NIL)printf(", ");
    }
    printf("]");

    printf("\n");
  }
  
  
  return 0;
}

//problem A is most difficult.

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

int main(){
 	int n ,a,b;
	cin >>n >> a >> b;
  	int count=0,k;
  	for(int i = 1; i<= n;i++) {
    	k=i/10000+(i%10000)/1000+(i%1000)/100 +(i%100)/10+i%10;
      
      	if(a<= k && k<=b){
        	count += i;
        }
    }
  	cout << count << endl;
	
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main(){
	int n, m;
	cin >> n >> m;

	vi a(m);
	rep(i, 0, m) cin >> a[i];
	a.pb(inf);

	vi dp(n+1);
	dp[0] = 1;
	rep(i, 0, n){
		if(i+1 <= n and *lower_bound(all(a), i+1) != i+1){
			(dp[i+1] += dp[i]) %= mod;
		}
		if(i+2 <= n and *lower_bound(all(a), i+2) != i+2){
			(dp[i+2] += dp[i]) %= mod;
		}
	}

	cout << dp[n] << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(snip_i, n) cin >> a.at(snip_i);
  sort(a.begin(), a.end());

  // rep(i, n){
  //   if(i != 0) cerr << " ";
  //   cerr << a.at(i);
  // }
  // cerr << endl;

  ll ans = 0, add = 0;
  if(n % 2 == 1){
    rep(i, n){
      if(i < n/2) ans -= a.at(i)*2;
      else if(i < n/2+2) ans += a.at(i);
      else ans += a.at(i) * 2;
    }
    rep(i, n){
      if(i < (n+1)/2){
        if((n+1)/2-3 < i){
          add -= a.at(i);
        }else add -= a.at(i)*2;
      }else add += a.at(i) * 2;
    }
  }else{
    rep(i, n){
      if(i < n/2){
        if(i != n/2-1) ans -= a.at(i)*2;
        else ans -= a.at(i);
      }else{
        if(i != n/2) ans += a.at(i)*2;
        else ans += a.at(i);
      }
    }
  }
  // cerr << ans << " " << add << endl;
  ans = max(ans, add);
  cout << ans << endl;
  // int bg, sm;
  // rep(i, n){
  //   if(i % 2 == 0){
  //     bg = a.at(n-i/2-1);
  //     if(i == 0) continue;
  //   }else{
  //     sm = a.at(i/2);
  //   }
  //   ans += bg - sm;
  // }
  // ll add = 0;
  // rep(i, n){
  //   if(i % 2 == 0){
  //     sm = a.at(i/2);
  //     if(i == 0) continue;
  //   }else{
  //     bg = a.at(n-i/2-1);
  //   }
  //   add += bg - sm;
  // }
  // cerr << ans << " " << add << endl;
  // ans = max(ans, add);
  // cout << ans << endl;
  return 0;
}

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

double coin(int n, int k){
    int cnt = 0;
    while(n<k){
        n *= 2;
        cnt++;
    }
    return cnt;
}

int main(){
    int n,k;
    cin >> n >> k;
    vector<double> a;
    for(int i = 1; i <= n; i++){
        a.push_back(coin(i,k));
    }
    double sum = 0;
    for(int i = 0; i < n; i++){
        sum += pow(0.5,a[i]);
    }
    sum /= n;
    cout << setprecision(10) << sum;
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  char *s = (char *) calloc (100000 + 1, sizeof (char));
  scanf ("%s", s);
  i32 *cnt = (i32 *) calloc (4, sizeof (i32));
  for (i32 i = 0; s[i] != '\0'; ++i) {
    cnt[2 * (i & 1) + s[i] - '0']++;
  }
  i32 x = cnt[0] + cnt[3];
  i32 y = cnt[1] + cnt[2];
  i32 ans = x < y ? x : y;
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run ();
  return 0;
}

Measured memory_bytes: 256