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

#define     bip(a)         __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front ///for list
#define     mp             make_pair
#define     is             insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));

int main()
{
	/*int n,q,l,r,ac=0;
	string str;
	cin>>n>>q>>str;
	int pre[n+5];
	mem(pre,0);
	for(int i=0;i<n;){
		if(str[i]=='A'&&str[i+1]=='C'){
			ac++;
			pre[i+2]=ac;
			pre[i+1]=ac-1;
			i+=2;
		}
		else{
			pre[i+1]=ac;
			i++;
		}
	}*/
	/*for(int i=1;i<=n;i++)cout<<pre[i]<<" ";
	cout<<endl;*/
	/*while(q--){
		cin>>l>>r;
		cout<<pre[r]-pre[l]<<endl;
	}*/
	/*char ch;
	cin>>ch;
	if(ch=='A')cout<<"T\n";
	if(ch=='T')cout<<"A\n";
	if(ch=='G')cout<<"C\n";
	if(ch=='C')cout<<"G\n";*/
	/*string str;
	cin>>str;
	if(count(str.begin(),str.end(),'7')>0)cout<<"Yes\n";
	else cout<<"No\n";*/
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
}


Measured memory_bytes: 3640
fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val d = longList()
    val m = readLine()?.toInt() ?: return
    val t = longList()

    val map = hashMapOf<Long, Int>()
    d.forEach { i ->
        map[i] = map[i]?.let {
            it + 1
        } ?: 1
    }
    t.forEach { i ->
        map[i]?.let {
            if (it == 0) {
                println("NO")
                return
            }
            map[i] = it - 1
        } ?: run {
            println("NO")
            return
        }
    }
    println("YES")
}


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

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

  string S;
  cin>>S;

  vector<int> s(200010);
  int i=1;
  int index=1;
  for(int i=0;i<S.size();++i){
    int count=1;
    while(i<S.size()-1 && S.at(i)==S.at(i+1)){
      ++i;
      ++count;
    }
    s.at(index)=count;
    ++index;
  }
  


  vector<int> sum(200010);
  s.at(0)==0;
  for(int i=1;i<200010;++i){
    sum.at(i)=sum.at(i-1)+s.at(i);
  }
  

  int ans=0;

  if(S.at(0)=='1'){
    for(int i=1;i+2*K<200010;i+=2){
      ans=max(ans,sum.at(i+2*K)-sum.at(i-1));
    }
  }  
  else{
    for(int i=0;i+2*K<200010;i+=2){
      if(i==0){ans=sum.at(2*K);}
      else{
      ans=max(ans,sum.at(i+2*K)-sum.at(i-1));
      }
    }
  }


  cout<<ans<<endl;

}

Measured memory_bytes: 2048
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-result"

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef long long unsigned int ull;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define REPD(i, n) for (int i = 0, i##_len = (n); i < i##_len; i--)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1000000007;

void Main()
{
    int a, b, c, x;
    cin >> a >> b >> c >> x;

    int cnt = 0;
    for(int ia = 0; ia <= a; ia++){
        int ta = ia * 500;
        for(int ib = 0; ib <= b; ib++){
            int tb = ib * 100;
            for(int ic = 0; ic <= c; ic++){
                int tc = ic * 50;
                int total = ta + tb + tc;

                if(total == x)
                    cnt ++;
                
                if(total >= x)
                    break;
            }
            if(ta + tb >= x)
                break;
        }
        if(ta >= x)
            break;
    }

    cout << cnt << endl;
}

int main()
{
    std::ios::sync_with_stdio(false); // printf/scanf を使わない
    std::cin.tie(0);
    std::cout << std::fixed << std::setprecision(15); // 浮動小数点数を小数点表記

    Main();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char o;long long x,n,a,b,c;int main(){b=c=-1e18;cin>>n>>a;for(int i=1;i<n;++i){cin>>o>>x;if(o^'-')a+=x,c+=x,b=max(b-x,c);else c=b+x,a=b=max(a-x,c);}cout<<a;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	vector<int> a(n), cnt(n + 1);
	int ans = 0;
	rep(i, n) {
		cin >> a[i];
		if (a[i] > n) ans++;
		else cnt[a[i]]++;
	}
	rep(i, n + 1) {
		if (cnt[i] < i) ans += cnt[i];
		else ans += cnt[i] - i;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }
void rcmb(ll *x,ll s,ll r,function<void(ll *)>f){if(r==0){f(x);}else{if(s<0)return;rcmb(x,s-1,r,f);x[r-1]=s;rcmb(x,s-1,r-1,f);}}
void cmb(ll n,ll k,function<void(ll *)>f){ll x[k];rcmb(x,n-1,k,f);}
void prm(ll n,function<void(ll *)>f){ll x[n];for(ll i=0;i<n;i++)x[i]=i;do{f(x);}while(next_permutation(x,x+n));}
void prm(ll n,ll k,function<void(ll *)>f){cmb(n,k,[&](ll *c){prm(k,[&](ll *p){ll x[k];for(ll i=0;i<k;i++){x[i]=c[p[i]];}f(x);});});}
// prm(4, 2, [](ll *x){ cout << x[0] << "," << x[1] << "\n"; });


void solve(string S){
	string s1 = S.substr(0, 2);
	string s2 = S.substr(2, 2);
	ll n1 = stoi(s1);
	ll n2 = stoi(s2);
	string res;
	if (1<=n1 && n1<=12) {
		if (1<=n2 && n2<=12) res = "AMBIGUOUS";
		else res = "MMYY";
	} else {
		if (1<=n2 && n2<=12) res = "YYMM";
		else res = "NA";
	}
	cout << res << "\n";
}

int main(){
	string S;
	cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)
#define MAX 1000000000

int n,k;
int w[100000];

int check(int p){
    int v=1,sum=0;
    F(i,0,n){
        sum+=w[i];
        if(sum>p){
            sum=w[i];
            ++v;
        }
    }
    return v;
}

int main()
{
    cin >> n >> k;
    int max=0;
    F(i,0,n){
        cin >> w[i];
        if(max<w[i]) max=w[i];
    }

    int left=max,right=MAX;
    while(left<right){
        int mid=(left+right)/2;
        int v=check(mid);
        if(k<v) left=mid+1;
        else right=mid;
    }

    cout << right << endl;

    return 0;
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  int a,b;
  cin >> a >> b;
  int dif = b-a;
  int hight = (1+dif)*dif/2;
  cout << hight-b << endl;
  
}      
       



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
queue <int> q;
vector <int> edges[100005];
bool visited[100005];
int n,m;
int ans = 0;
void bfs ( int x ) {
	int ret = 0;
	visited[x] = 1;
	q.push( x );
	while(! q.empty ()){
		int nx = q.front();
		q.pop();
		for(int i = 0;i < edges[nx].size();i++){
			int y = edges[nx][i];
			if(!visited[y]){
				visited[y] = 1;
				q.push(y);
			}
		}
	}
}
int main(){
	cin>>n>>m;
	while(m--){
		int a , b;
		cin>>a>>b;
		a--,b--;
		edges[a].push_back(b),edges[b].push_back(a);
	}
	for(int i = 0;i < n;i++)
		if(!visited[i]){
			ans++;
			bfs(i);
		}
	cout<<ans-1; 
	return 0;
}

Measured memory_bytes: 8916
#!/usr/bin/env python3
n = int(input())
s = input()
INF = 10**9
white_cnt = s.count('.')
black_cnt = 0
ans = INF
for c in s:
    ans = min(ans, black_cnt + white_cnt)
    if c == '#':
        black_cnt += 1
    else:
        white_cnt -= 1
else:
    ans = min(ans, black_cnt + white_cnt)

print(ans)


Measured memory_bytes: 3500
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
#include <deque>
using namespace std;
int n, m=0, i, j, k, t;
int a[100010]={0};
int b[100010]={0};
int main(){
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>t;
		if(t==i) a[i]=1;
	}
	for(i=1;i<=n;i++){
		if(a[i]&&b[i-1]==0){
		b[i]=1;
		m++;
		}
	}
	cout<<m;
	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 日 12/ 2 21:57:23 2018

# Usage
#
"""


if __name__ == '__main__':
    i = int(input())
    if [3,5,7].count(i) >= 1:
        print('YES')
    else:
        print('NO')


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

int main() {
  string s;
  int k;
  cin >> k >> s;
  int n = s.size();
  if(n <= k){
    cout << s << endl;
    return 0;
  }else{
    int i = 0;
    while(i<=k-1){
      cout << s.at(i);
      if(i==k-1){
        cout << "..." << endl;
        return 0;
      }
      i++;
    }
  }
}

Measured memory_bytes: 3588
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
using namespace std;


int main(){
    int N, T, A;
    int H[1010];
    cin >> N >> T >> A;
    for (int i=0; i < N; i++){
        cin >> H[i];
    }
    float desired_height = (T- A) / 0.006;
    float closest_diff = pow((H[0] - desired_height), 2);
    int closest = 1;
    float diff;
    for (int i=1; i < N; i++){
        diff = pow((H[i] - desired_height), 2);
        if (diff < closest_diff){
            closest_diff = diff;
            closest = i+1;
        }
    }
    cout << closest << endl;
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int m;
    cin >> m;
    vector<int> b(m);
    vector<bool> judge(m, false);
    rep(i, m) cin >> b[i];

    for(int bit = 0; bit < (1 << n); bit++) {
        int tSum = 0;
        rep(i, n) {
            if(bit & (1 << i)) { tSum += a[i]; }
        }
        rep(i, m) {
            if(tSum == b[i]) { judge[i] = true; }
        }
    }
    rep(i, m) {
        if(judge[i])
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}



Measured memory_bytes: 3168
def f(p):
    ans=1
    if p<=5: return 0
    for n in range(2,int(p**0.5)+1):
        if p%n==0:
            if n!=p//n:ans+=n+p//n
            else:ans+=n
    return ans

while 1:
    n=int(input())
    if n==0:break
    m=f(n)
    if n==m:print('perfect number')
    else: print('deficient number' if n>m else 'abundant number')

Measured memory_bytes: 7680
from collections import defaultdict
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

d,n = readInts()

if d==0:
  if n==100:
    print(101)
  else:
    print(n)
elif d==1:
  if n==100:
    print(10100)
  else:
    print(n*100)
else:
  if n==100:
    print(1010000)
  else:
    print(n*10000)

Measured memory_bytes: 9432
import copy

def f(n):
    if n==0:
        return 1
    elif n==1:
        return 2
    else:
        return f(n-1)+f(n-2)

p=10**9+7
H,W,K=map(int,input().split())

if W==1:
    ans=1
else:
    d={}
    for i in range(8):
        d[i]=f(i)
    d[-1]=d[-2]=d[-3]=1

    b=[0 for i in range(W+2)]
    a=[0 for i in range(W+2)]

    b[1]=d[W-2];b[2]=d[W-3]

    for i in range(H-1):
        for k in range(1,W+1):
            a[k]=b[k-1]*d[k-3]*d[W-k-1]
            a[k]+=b[k]*d[k-2]*d[W-k-1]
            a[k]+=b[k+1]*d[k-2]*d[W-k-2]
            a[k]%=p
        b=copy.copy(a)
    
    ans=b[K]

print(ans)

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

int main(){
    // input N
    int N;
    cin >> N;
    // input max values
    vector<int> B(N-1);
    for( int i=0; i<N-1; i++ ){
        cin >> B[i];
    }

    // simple code
    long long ans = B[0] + B[N-2];
    for( int i=1; i<N-1; i++ ){
        if( B[i-1] < B[i] ){
            ans += B[i-1];
        }else{
            ans += B[i];
        }
    }

    /*
    // full description, estimating maximal A
    vector<int> A(N);
    A[0] = B[0];
    for( int i=1; i<N-1; i++ ){
        if( B[i-1] < B[i] ){
            A[i] = B[i-1];
        }else{
            A[i] = B[i];
        }
    }
    A[N-1] = B[N-2];
    long long ans = 0;
    for( int i=0; i<N; i++ ){
        ans += A[i];
    }
    */

    cout << ans << endl;
} 

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

// 内部定数
#define D_ARRAY_MAX		100000									// 最大配列数

// 内部変数
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// ソート関数 - int昇順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// 昇順
	if (*lipVal1 >  *lipVal2) {
		return(1);
	}
	else if (*lipVal1 < *lipVal2) {
		return(-1);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// データ初期化
	siACnt = 0;													// 配列数

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 配列数取得
	int liACnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &liACnt);

	// 配列取得・削除数加算
	int liDel = 0;
	for (i = 0; i < liACnt; i++) {
#ifdef D_TEST
		fscanf(szpFpT, "%d", &si1Array[siACnt]);
#else
		fscanf(stdin, "%d", &si1Array[siACnt]);
#endif

		// 配列数チェック
		if (si1Array[siACnt] > liACnt) {		// 削除確定
			liDel++;
		}
		else {									// 削除未定
			siACnt++;
		}
	}
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif

	// 番兵追加
	si1Array[siACnt] = INT_MAX;
	siACnt++;

	// ソート
	qsort(si1Array, siACnt, sizeof(int), fSortFnc);

	// 件数チェック
	int liSame = 1;
	for (i = 0; i < siACnt - 1; i++) {

		// 値比較
		if (si1Array[i] == si1Array[i + 1]) {	// 一致
			liSame++;
			continue;
		}

		// 件数チェック
		if (liSame < si1Array[i]) {				// 不足
			liDel += liSame;
		}
		else if (liSame > si1Array[i]) {		// 過剰
			liDel += liSame - si1Array[i];
		}

		// 初期化
		liSame = 1;
	}

	// 結果セット
	sprintf(lc1Out, "%d\n", liDel);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



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

int main(){
  
  int r;
  cin>>r;
  
  if (r<1200){
    cout<<"ABC"<<endl;
  }
  
  else if (r<2800){
    cout<<"ARC"<<endl;
  }
  
  else {
    cout<<"AGC"<<endl;
  }
  
  
    
}
  













Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
	int N;
	cin >> N;
	
	bool b = false;
	b |= ((N % 10) == 7);
	N /= 10;
	b |= ((N % 10) == 7);
	N /= 10;
	b |= ((N % 10) == 7);
	
	cout << (b ? "Yes" : "No") << endl;
	
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
#define pi   acos(-1) 
#define endl "\n"
const int mod = 1000000007; 
 
int main()
{
	char x;
	cin >> x;
	printf("%c\n",x + 1);
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int inf=2147483647;
int n,m;
#define V 205
#define E 30010
int head[V],v[E],w[E],cap[E],nxt[E],cur[V],tot=0;
inline void add_edge(int s,int e,int t){
	tot++;v[tot]=e;w[tot]=1;cap[tot]=t;nxt[tot]=head[s];head[s]=tot;
	tot++;v[tot]=s;w[tot]=0;cap[tot]=t;nxt[tot]=head[e];head[e]=tot;
}
int a[V][V];
vector<int> g[V][V];
int res[V][V],tmp[V];
inline int col(int x){
	if(x%m==0)return x/m;
	return x/m+1;
}

int S,T;
int Q[V],hd,tl,d[V];
bool bfs(){
	memset(d,-1,sizeof(int)*(2*n+3));
	d[S]=0;
	hd=tl=0;
	Q[tl++]=S;
	while(hd<tl){
		int u=Q[hd];
		hd++;
		for(int i=head[u];i;i=nxt[i])
		    if(w[i]&&d[v[i]]==-1){
		    	d[v[i]]=d[u]+1;
		    	Q[tl++]=v[i];
				if(v[i]==T)return true; 
			}
	}
	return false;
}
int dfs(int u,int flow){
	if(u==T||!flow)return flow;
	int ans=0,res;
	for(int &i=head[u];i;i=nxt[i])
	   if(w[i]&&d[v[i]]==d[u]+1&&(res=dfs(v[i],min(flow,w[i])))){
	   	    w[i]-=res;
	   	    if(i&1)w[i+1]+=res;
	   	    else w[i-1]+=res;
	   	    ans+=res;
	   	    flow-=res;
	   	    if(!flow)break;
	   }
	return ans;
}

inline void solve(int x){
	S=2*n+1;T=2*n+2;
	memset(head,0,sizeof(int)*(2*n+3));tot=0;
	for(register int i=1;i<=n;++i)
	    for(register int j=1;j<=n;++j)
	        if(g[i][j].size())add_edge(i,j+n,g[i][j][g[i][j].size()-1]);
    for(register int i=1;i<=n;++i){
    	add_edge(S,i,0);
    	add_edge(i+n,T,0);
	}
	int haha=0;
	memcpy(cur,head,sizeof(int)*(2*n+3));
	while(bfs()){
		haha+=dfs(S,inf);
		memcpy(head,cur,sizeof(int)*(2*n+3)); 
	}
	int tmp=-1;
	for(register int i=1;i<=n;++i)
	    for(register int j=1;j<=n;++j){
	    	if(g[i][j].size()){
	    		tmp+=2;
	    	if(w[tmp]==0){
	    		res[i][x]=cap[tmp];
	    		g[i][j].pop_back();
			}
		}
		}
}

inline void rd(int &x){
	x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
}

int main(){
	rd(n);rd(m);
	for(register int i=1;i<=n;++i)
	    for(register int j=1;j<=m;++j){
	    	rd(a[i][j]);
	    	g[i][col(a[i][j])].push_back(a[i][j]);
		}
	for(register int i=1;i<=m;++i)solve(i);
	for(register int i=1;i<=n;++i){
		for(register int j=1;j<=m;++j)printf("%d ",res[i][j]);
		puts("");
	}
	for(register int i=1;i<=m;++i){
		for(register int j=1;j<=n;++j)tmp[j]=res[j][i];
		sort(tmp+1,tmp+n+1);
		for(register int j=1;j<=n;++j)res[j][i]=tmp[j];
	}
	for(register int i=1;i<=n;++i){
		for(register int j=1;j<=m;++j)printf("%d ",res[i][j]);
		puts("");
	}
	return 0;
} 

Measured memory_bytes: 2176
S = input()

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)

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

int main(){
    int n;
    cin >> n;
    ll ans =-1;
    ll num = 0;
    ll ans1=0;
    ll r=0;
    if(n%2==0){
        cout <<ans<<endl;
        return 0;
    }
    if(n%5==0){
        cout <<ans<<endl;
        return 0;
    }
    if(n%7==0)
        n=n/7;
    for(ll i=0;i<100000000000000;i++){
        num = num+1;
//        ans1 = ans1+num/n;
        r = num %n;
        if(r ==0){
            ans = i+1;
            break;
        }
//       ans1 = ans1 *10 ;
        num = r*10;
    }
    
    cout <<ans<<endl;
}





Measured memory_bytes: 3576
import java.util.Arrays;
import java.util.Comparator;

//Village
public class Main{

	class Scanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-') return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
	
	double[] x, y;
	
	void run(){
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		double R = sc.nextDouble(), EPS = 1e-8;
		double cos1 = Math.cos(1*Math.PI/180), sin1 = Math.sin(1*Math.PI/180);
		x = new double[n]; y = new double[n];
		for(int i=0;i<n;i++){
			double X = sc.nextDouble(), Y = sc.nextDouble();
			x[i] = cos1*X-sin1*Y;
			y[i] = sin1*X+cos1*Y;
		}
		Integer[] V = new Integer[n];
		for(int i=0;i<n;i++)V[i]=i;
		Arrays.sort(V, new Comparator<Integer>() {
			public int compare(Integer o1, Integer o2) {
				return (int)Math.signum(x[o1]-x[o2]);
			}
		});
		int[] v = new int[n];
		for(int i=0;i<n;i++)v[i]=V[i];
		int res = 0;
		boolean[] u = new boolean[n];
		for(int i=0;i<n;i++){
			int idx = v[i];
			if(u[idx])continue;
			u[idx] = true;
			res++;
			double lx = x[idx]-R-EPS;
			int l = 0, r = n;
			while(r-l>1){
				int m = (l+r)/2;
				if(lx<=x[v[m]])r=m;
				else l=m;
			}
			for(int j=l;j<n;j++){
				int k = v[j];
				if(x[idx]+R+EPS<x[k])break;
				if(u[k])continue;
				if((x[idx]-x[k])*(x[idx]-x[k]) + (y[idx]-y[k])*(y[idx]-y[k]) < R*R + EPS){
					u[k] = true;
				}
			}
		}
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

typedef struct {
    int x, y;
} POINT;

POINT add[100000], minus[100000];
char group[2][100000];
int n;

int comp(const void *a, const void *b)
{
    POINT p, q;
    
    p = *(POINT *)a;
    q = *(POINT *)b;
    
    return (p.x - q.x);
}

int canDivide(int piv)
{
    int i;
    int a, b;
    
    for (i = 0; i < n; i++){
        group[0][i] = group[1][i] = 2;
    }
    group[0][add[0].y] = 0;
    //suppose distance will be given by |c[0][i] - c[0][j]|
    
    for (i = 0; i < n; i++){
        if (abs(add[i].x - add[0].x) > piv && abs(add[i].x - add[n - 1].x) > piv){
            return (0);
        }
        if (abs(add[i].x - add[0].x) > piv){
            group[0][add[i].y] = 1;
        }
        if (abs(add[i].x - add[n - 1].x) > piv){
            group[0][add[i].y] = 0;
        }
    }
    
    //suppose distance will be given by |c[1][i] - c[1][j]|
    
    group[1][minus[0].y] = 0;
    for (i = 0; i < n; i++){
        if (abs(minus[i].x - minus[0].x) > piv && abs(minus[i].x - minus[n - 1].x) > piv){
            return (0);
        }
        if (abs(minus[i].x - minus[0].x) > piv){
            group[1][minus[i].y] = 1;
        }
        if (abs(minus[i].x - minus[n - 1].x) > piv){
            group[1][minus[i].y] = 0;
        }
    }
    
    a = b = 0;
    for (i = 0; i < n; i++){
        if (group[0][i] == 2 || group[1][i] == 2){
            b++;
            continue;
        }
        if (group[0][i] != group[1][i]){
            a++;
        }
    }
    
    return (a == 0 || a + b == n);
}

int main(void)
{
    int i;
    int left, right, center;
    int x, y;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++){
        scanf("%d%d", &x, &y);
        add[i].x = x + y;
        minus[i].x = x - y;
        add[i].y = minus[i].y = i;
    }
    
    qsort(add, n, sizeof(POINT), comp);
    qsort(minus, n, sizeof(POINT), comp);
    
    left = 0;
    right = 400000;
    
    while (left != right){
        center = (left + right) / 2;
        if (canDivide(center)){
            right = center;
        }
        else {
            left = center + 1;
        }
    }
    
    printf("%d\n", right);
    
    return (0);
}

Measured memory_bytes: 2536
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int [] aArray = new int [1000000];
		int s = sc.nextInt();
		aArray[1] = s;
		int i = 2;
		out: while(true) {
			if(aArray[i-1] % 2 == 0) aArray[i] = aArray[i-1] / 2;
			else aArray[i] = 3 * aArray[i-1] + 1;
			for(int k = 1; k < i; k++) {
				if(aArray[i] == aArray[k]) {
					System.out.println(i);
					break out;
				}
			}
			i++;
		}
		sc.close();
	}

}


Measured memory_bytes: 26068
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	string s;
	cin >> s;

	int d = BIG_NUM;
	for (int i = 0; i < s.length() - 2; i++) {

		int num = 0;
		for (int j = 0; j < 3; j++) {
			num = num * 10 + (s[i + j] - '0');
		}

		d = min(d, abs(num - 753));
	}

	cout << d << endl;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;

}

signed main() {
	ll n, k;

	cin >> n >> k;

	vector<ll> a(n + 1, 0);
	vector<vector<ll>> dp(n + 1, vector<ll>(k + 1, 0));

	REP(i, n) {
		cin >> a[i + 1];
	}

	REP(i, n + 1) {
		dp[i][0] = 1;
	}

	FOR(i, 1, n + 1) {
		FOR(j, 1, k + 1) {
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			if (j - a[i] - 1 >= 0) {
				dp[i][j] -= dp[i - 1][j - a[i] - 1];
			}
			dp[i][j] += MOD;
			dp[i][j] %= MOD;
		}
	}

	cout << dp[n][k] % MOD << endl;
}

Measured memory_bytes: 80256
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

typedef pair<int, int> pr_ii;
int main()
{
	int n;
	cin >> n;
	
	vector<pr_ii> V;
	int x, y;
	while (n--)
	{
		cin >> x >> y;
		V.push_back(pr_ii(x, y));
	}
	
	sort(V.begin(), V.end());
	
	vector<pr_ii>::iterator it = V.begin();
	while (it != V.end())
	{
		cout << (*it).first << ' ' << (*it).second << endl;
		it++;
	}

}


Measured memory_bytes: 3860
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring> 
using namespace std;
long long a[105];
int main()
{
	int n;
	a[0]=2;a[1]=1;
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		a[i]=a[i-1]+a[i-2];
	}
	cout<<a[n]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
int n;
int b[11];
int a[4][4];
bool used[4][4];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	for(int i = 1; i <= 3; ++i) for(int j = 1; j <= 3; ++j) cin >> a[i][j];
	cin >> n;
	for(int i = 1; i <= n; ++i) cin >> b[i];
	for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= 3; ++j)
            for(int k = 1; k <= 3; ++k) if(a[j][k] == b[i]) used[j][k] = 1;
	}
	for(int i = 1; i <= 3; ++i) if(used[i][1] && used[i][2] && used[i][3]) cout << "Yes", exit(0);
	if(used[1][1] && used[2][2] && used[3][3]) cout << "Yes", exit(0);
	if(used[3][1] && used[2][2] && used[1][3]) cout << "Yes", exit(0);
	for(int i = 1; i <= 3; ++i) if(used[1][i] && used[2][i] && used[3][i]) cout << "Yes", exit(0);
	cout << "No";
	return 0;
}


Measured memory_bytes: 256
mod = 10**8+7
n = 1001

def comb(x, y):
    if 2*y > x: return comb(x, x-y)
    return fac[x] * inv[y]* inv[x-y] % mod

fac = [1]*(n+1)
inv = [1]*(n+1)
for i in range(2, n+1):
    fac[i] = fac[i-1] * i % mod
inv[n] = pow(fac[n], mod-2, mod)
for i in range(n-1, 1, -1):
    inv[i] = inv[i+1] * (i+1) % mod

r, c, a1, a2, b1, b2 = map(int, input().split())

row = min(abs(b1-a1), r-abs(b1-a1))
col = min(abs(b2-a2), ｃ-abs(b2-a2))

ans = 1
if row*2 == r: ans *= 2
if col*2 == c: ans *= 2

ans *= comb(row+col, row)
ans %= mod
print(ans)


Measured memory_bytes: 5792
#include <iostream>
using namespace	std;
int main(){
  int n,a[3]={0},tmp;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>tmp;
    if(tmp%4==0) a[2]++;
    else if(tmp%2==0) a[1]++;
    else a[0]++;
  }
  if(n==1&&a[2]!=1) cout<<"No"<<endl;
  else if(a[0]-a[2]==1 && a[1]==0) cout<<"Yes"<<endl;
  else if(a[0]<=a[2]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
typedef long long ll;
using namespace std;

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

ll lcm(ll x, ll y) {
    return x / gcd(x,y) *y;
}

int main() {
	int N;
	cin >> N;
	ll ans = 1;
	for (int i = 0; i < N; ++i) {
		ll T;
		cin >> T;
		ans = lcm(ans, T);
	}

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



Measured memory_bytes: 256
n=input()
for _ in [0]*n:
  i=0
  B=[0]*3
  c=0
  while i<3:
    s=raw_input()[1]
    if s=='I':
      if B[2]==1:c+=1
      B=[1]+B[0:2]
    elif s=='O':
      c+=sum(B)+1
      B=[0]*3
    elif s=='U':i+=1
  print c

Measured memory_bytes: 4228
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const L1 = arg[0].split("");
    const L2 = arg[1].split("");
    const L3 = arg[2].split("");
    
    console.log(L1[0] + L2[1] + L3[2]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
n, m = map(int, input().split())
h = list(map(int, input().split()))
dic = {}
for i in range(1, len(h) + 1):
  dic[i] = h[i - 1]
bad = set()
for i in range(m):
  a, b = map(int, input().split())
  if(dic[a] < dic[b]):
    bad.add(a)
  elif(dic[a] > dic[b]):
    bad.add(b)
  else:
    bad.add(a)
    bad.add(b)
print(n - len(bad))

Measured memory_bytes: 92520
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,m; cin>>n>>m;
	int total=0,ret=0;
	vector <int> a(n); 
	for (int i=0; i<n; i++)
		cin>>a[i], total+=a[i];
	for (int i=0; i<n; i++)
		if (a[i]*m*4>=total)
			ret++;
	cout<<(ret>=m?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 256
N, M, X = map(int, input().split())
CA = [list(map(int,input().split())) for i in range(N)]
m = []
A = []

ans = float('inf')

for i in range(1<<N):
  a = [0] * (M+1)

  for j in range(N):
    if ((i >> j) & 1):
      for x, k in enumerate(CA[j]):
        a[x] += k

  if all(a >= X for a in a[1:]):
    ans = min(ans, a[0])

print(-1 if ans == float('inf') else ans)



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

using namespace std;

int main(){

    int N, T, A;
    cin >> N;
    cin >> T >> A;
    vector<double> H(N);
    double tempdistance = 100000;
    double comparedistance;
    int bestH = 0;
    for(int i=0; i<N; i++){
        cin >> H[i];
        comparedistance = fabs(A - (T - (H[i] * 0.006 )));
        if(tempdistance > comparedistance){
            bestH = i;
            tempdistance = comparedistance;
        }
    }
    cout << bestH+1 << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s, t; cin >> s >> t;
    FOR(i, 0, t.length())cout << s[i] << t[i];
    if (t.length() < s.length())cout << s.back();
    cout << "\n";
}


Measured memory_bytes: 384
#include <stdio.h>
int main() {
	int i, j;
	double e[2];
	int en[2][4];
	double bd[3] = {1.1, 0.6, 0.2};
	for(i = 0; i < 2; ++ i) for(j = 0; j < 4; ++ j) en[i][j] = 0;
	while(scanf("%lf %lf", &e[0], &e[1]) != EOF) {
		for(i = 0; i < 2; ++ i) {
			for(j = 0;j < 3; ++ j) {
				if(e[i] >= bd[j]) {
					break;
				}
			}
			en[i][j] ++;
		}
	}
	for(i = 0; i < 4; ++ i) printf("%d %d\n", en[0][i], en[1][i]);
	return 0;
}

Measured memory_bytes: 624
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		int[] b = Arrays.copyOf(a, a.length);
		Arrays.sort(b);
		for(int i = 0 ; i < n ; i++) {
			if(a[i] < b[n / 2]) {
				System.out.println(b[n / 2]);
			} else {
				System.out.println(b[n / 2 - 1]);
			}
		}
	}
}


Measured memory_bytes: 91892
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			String a = scanner.next();
			if (a.equals("-")) {
				break;
			}
			int b = scanner.nextInt();
			int sum = 0;
			for (int i = 0; i < b; i++) {
				sum += scanner.nextInt();
			}
			String c = a + a;
			System.out.println(c.substring(sum % a.length(), sum
					% a.length() + a.length()));
		}
	}
}

Measured memory_bytes: 18204
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
int N;
int A[1000005];
int ans[1000005];
 
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N;
  for(int i = 1; i <= N; i++)
    cin >> A[i];
  long long s = 0;
  for(int i = 1; i <= N; i++)
    s += A[i] * (i % 2 ? 1 : -1);
  ans[1] = s;
  for(int i = 2; i <= N; i++) {
    ans[i] = (A[i - 1] - ans[i - 1] / 2) * 2;
  }
  for(int i = 1; i <= N; i++)
    cout << ans[i] << " ";
}


Measured memory_bytes: 5888
using System;
using System.Linq;

namespace CanYouSolveThis {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = input[0];
            var m = input[1];
            var c = input[2];

            var b = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var result = 0;

            for (int i = 0; i < n; i++) {
                var ai = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                var sum = 0;
                for (int j = 0; j < m; j++) {
                    sum += ai[j] * b[j];
                }

                if (sum + c > 0) result++;
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
const int mod=1000000007;
typedef long long ll;
using namespace std;
ll n,x,y,sum,k1,k2,ans,fac[200005];
ll qpow(ll a,ll b){
	ll ans=1;
	for(;b;b>>=1,a=(a*a)%mod)if(b&1)ans=(ans*a)%mod;
	return ans;
}
ll C(ll x,ll y){
	ll a=1,b=1;
	for(ll i=1;i<=min(y,x-y);i++){
		a=a*i%mod;
		b=b*(x-i+1)%mod;
	}
	return b*qpow(a,mod-2)%mod;
}
int main(){
	scanf("%lld%lld%lld",&n,&x,&y);fac[0]=1;
    for(int j=1;j<=200000;j++)fac[j]=fac[j-1]*j%mod;
	sum=(qpow(2,n)-1+mod)%mod;
    k1=C(n,x);k2=C(n,y);
	ans=(sum-k1+mod)%mod;
	ans=(ans-k2+mod)%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
  int n,k,s=0;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<k;i++) s+=a[i];
  cout<<s;
}

Measured memory_bytes: 3156
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val (n, m) = (sc.nextInt(), sc.nextInt())
  val odd = m / 2 + m % 2
  val even = m / 2
  val result = (1 to odd).map { i => (i, odd * 2 - i + 1) } ++
      (1 to even).map { i => (i + odd * 2, odd * 2 + even * 2 - i + 2)}
  result.map { case (x, y) => s"${x} ${y}" }.foreach(println)
}


Measured memory_bytes: 67288
main = getContents >>= putOut.formatOut.map calc.formatIn
  where putOut = putStrLn.(++"\n").reverse.dropWhile (\c-> c=='\n' || c==' ').reverse

formatIn :: String -> [[Int]]
formatIn = map ((map toInt).words).takeWhile (/="0 0").lines
  where toInt =read :: String -> Int

formatOut :: [String] -> String
formatOut = unlines

calc :: [Int] -> String
calc (h:w:_) = unlines $map ((take w).draw) [1..h] 
  where draw n | n `mod` 2 == 1 = cycle ['#','.']
               | otherwise      = cycle ['.','#']
        

Measured memory_bytes: 7456
#include<bits/stdc++.h>
   using namespace std;
   vector<int> l[100005];
   int dp[100005];
   int visited[100005];
   long long int mod=1000000000+7;
  int main()
  {
     int n,m;
     cin>>n>>m;

     char mat[n][m];

     for(int i=0;i<n;i++)
     {
        for(int j=0;j<m;j++)
        {
           cin>>mat[i][j];
        }
     }
     int dp[n][m];
     memset(dp,0,sizeof(dp));
     int f=-1,g=-1;

     for(int i=0;i<n;i++)
        dp[i][0]=1; 
     
     for(int i=0;i<m;i++)
        dp[0][i]=1; 

     for(int i=0;i<n;i++)
     {
        if(mat[i][0]=='#')
           { f=i;
            break;
           }
     }

      for(int i=0;i<m;i++)
     {
        if(mat[0][i]=='#')
           { g=i;
            break;
         }
     }
     if(f!=-1)
     {
        for(int i=f;i<n;i++)
           dp[i][0]=0;
     }
      if(g!=-1)
     {
        for(int i=g;i<m;i++)
           dp[0][i]=0;
     }

      for(int i=1;i<n;i++)
      {
         for(int j=1;j<m;j++)
         {
            if(mat[i-1][j]=='.')
              dp[i][j]=(dp[i][j]%mod+dp[i-1][j]%mod)%mod;

            if(mat[i][j-1]=='.')
              dp[i][j]=(dp[i][j]%mod+dp[i][j-1]%mod)%mod; 
         }
      }

      // for(int i=0;i<n;i++)
      // {
      //    for(int j=0;j<m;j++)
      //    {
      //       cout<<dp[i][j]<<" ";
      //    }
      //    cout<<"\n";
      // }

      cout<<dp[n-1][m-1]%mod;

  }



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

using namespace std;

long long solve(vector<long long> a) {
  sort(a.begin(), a.end());
  const long long max = 1e18;
  long long ans = 1;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == 0) {
      return 0;
    } else if (a[i] > max / ans) {
      return -1;
    }
    ans *= a[i];
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << solve(a) << endl;
  return 0;
}


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

int main() {
  int x,y,z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y;
  return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main() {
//	freopen("input.txt", "r", stdin);
	int n;
	map<int, int> mp;
	scanf("%d", &n);
	while (n--) {
		int temp;
		scanf("%d", &temp);
		mp[temp]++;
	}
	scanf("%d", &n);
	int sum = 0;
	while (n--) {
		int temp;
		scanf("%d", &temp);
		if (mp[temp]) {
			sum++;
		}
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 10196
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
/*
   created: 2020-8
   @verified:
   部分文字列の判定を高速に動かす
 
   query(l,r)=hash[l,r)
   lcp(rhT,a,b)=Longest Common Prefix of S[a:] and T[b:], O(logN)
 */
struct RollingHash{
    static const int base1=1009,base2=2009;
    static const int MOD1=1e9+7,MOD2=1e9+9;
    vector<long long> hash1,hash2,pow1,pow2;
    RollingHash(const string &s /* ここを変える */){
        int sz=(int)s.size();
        hash1.assign(sz+1,0); hash2.assign(sz+1,0);
        pow1.assign(sz+1,1); pow2.assign(sz+1,1);
        for(int i=0;i<sz;i++){
            hash1[i+1]=(hash1[i]*base1+s[i]) % MOD1;
            hash2[i+1]=(hash2[i]*base2+s[i]) % MOD2;
            pow1[i+1]=(pow1[i]*base1) % MOD1;
            pow2[i+1]=(pow2[i]*base2) % MOD2;
        }
    }
    inline pair<long long,long long> query(int l,int r)const{
        long long ret1=hash1[r]-hash1[l]*pow1[r-l]%MOD1;
        ret1=(ret1+MOD1)%MOD1;
        long long ret2=hash2[r]-hash2[l]*pow2[r-l]%MOD2;
        ret2=(ret2+MOD2)%MOD2;
        return {ret1,ret2};
    }
    inline int lcp(const RollingHash &t,int a,int b)const{
        int len=min((int)hash1.size()-a,(int)hash2.size()-b);
        int ok=-1,ng=len+1;
        while(ng-ok>1){
            int mid=(ng+ok)/2;
            if(query(a,a+mid)==t.query(b,b+mid)) ok=mid;
            else ng=mid;
        }
        return ok;
    }
};

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; string s;
    cin >> n >> s;
    RollingHash rh1(s);
    int ans=0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            int ln=rh1.lcp(rh1,i,j);
            if(i+ln<=j) chmax(ans,ln);
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3780