akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
using namespace std;
int main(){
	map<string,int> mp;
  	mp.insert({"SUN",7});
    mp.insert({"MON",6});
  	mp.insert({"TUE",5});
  	mp.insert({"WED",4});
  	mp.insert({"THU",3});
  	mp.insert({"FRI",2});
    mp.insert({"SAT",1});
  	string str;
  	while(cin>>str){
    	cout<<mp[str]<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
//shara's here
//私は大きな男の子
//SPEEEEEEEEEED IS KEEEEEEEEEEY
//REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
#include <bits/stdc++.h>
using namespace std;
//fold
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define vl vector<ll>
#define vll vector<vector<ll> >
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
	ll t;
	set<char>x;
	cin>>t;
	while(t--){
	char k; cin>>k;
	x.insert(k);
	}
	if(x.size()==3)cout<<"Three"<<endl;
	else cout<<"Four"<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


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

using ll = long long;

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

int main() {
    int n;
    ll m;
    cin >> n >> m;

    vector<ll> x(n);
    for (int i = 0; i < n; ++i) cin >> x[i];

    ll d = abs(m - x[0]);
    for (int i = 1; i < n; ++i) {
        d = gcd(d, abs(m - x[i]));
    }

    cout << d << endl;

    return 0;
}

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

int main()
{
    int $=1;
    //cin>>$;
    while($--)
    {
        string s;
        cin>>s;
        if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


/*
8888888888888888888888888888
    Md. Masud Mazumder
    University of Chittagong
    Department of CSE
8888888888888888888888888888
*/


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <algorithm>　　　  //通用算法
#include <cctype>

#include <cmath>
#include <complex>　　　　 //复数类

#include <cstdio>
#include <cstring>

#include <deque>　　　　　 //双端队列容器
#include <functional>　　　 //定义运算函数（代替运算符）
#include <list>　　　　　　 //线性列表容器
#include <map>　　　　　　 //映射容器
#include <iomanip>       //设置输出格式
#include <iostream>

#include <queue>　　　　　  //队列容器
#include <set>　　　　　　 //集合容器
#include <stack>　　　　　//堆栈容器　　　　
#include <string>　　　　　//字符串类
#include <vector>　　　　 //动态数组容器

using namespace std;
#define PI acos(-1)
#define ll long long
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int maxn = 2e5 + 10;
void solve(){
    int n; cin >> n;
    cout << 2 * PI * n << endl;
}
int main(){
    IOS; int t = 1;
    while(t--){
        solve();
    }
    return 0;
}

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

int main() {
  int N, a, x, b, y, min=10000;
  cin >> N;
  
  for(int i=1; i<N; i++){
    x=0;
    a=i;
    while(a > 0){
      x += a%10;
      a /= 10;
    }
    y=0;
    b=N-i;
    while(b > 0){
      y += b%10;
      b /= 10;
    }
    if(x+y <= min){
      min = x+y;
    }
  }
  
  cout << min << endl;
  
  return 0;
}

Measured memory_bytes: 256
arphaList = 'abcdefghijklmnopqrstuvwxyz'
result = ""
N = int(input())

while N != 0:
  arpha = arphaList[(N + 25) % 26]
  result += arpha
  N = N // 26
  if arpha == "z":
    N -= 1
print(result[::-1])

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
  int x, y;
  cin >> x >> y;
  int money = 0;
  if (x == 1) {
    money += 300000;
  } else if (x == 2) {
    money += 200000;
  } else if (x == 3) {
    money += 100000;
  }
  if (y == 1) {
    money += 300000;
  } else if (y == 2) {
    money += 200000;
  } else if (y == 3) {
    money += 100000;
  }
  if (x == 1 && y == 1) {
    money += 400000;
  }
  cout << money << endl;
  return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> b(2 * M);
  
  for(int i = 0;i<M;i++)
  {
  	cin >> b.at(i) >> b.at(i+M);
  }
  vector<int> cnt(N,0);
  for(int j = 0;j < 2 * M;j++)
  {
  	cnt.at(b.at(j) - 1)++;
  }
  for(int k=0;k<N;k++)
  {
  	cout << cnt.at(k) << endl;
  }

}


Measured memory_bytes: 256
#B
N=int(input())
L=sorted(list(map(int,input().split())))

ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i]!=L[j] and L[j]!=L[k]:
                if L[i]+L[j]>L[k]:
                    ans+=1
print(ans)

Measured memory_bytes: 80176
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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



int main(void) {
	int n, k;

	cin >> n >> k;

	if (((n - 1) / 2) + 1 >= k) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;
#define int ll
string s, t;
set<int> Set[150];

int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> s >> t;
	for(int i=0; i<s.length(); i++){
		Set[s[i]].insert(i);
	}
	int time=0, idx=0;
	for(int i=0; i<t.length(); i++){
		if (Set[t[i]].empty())
			return 0*puts("-1");
		if (Set[t[i]].lower_bound(idx) == Set[t[i]].end()) {
			time++, idx = 0;
		}
		idx = *Set[t[i]].lower_bound(idx);
		idx++;
	}
	int ans = (int)s.length()*time + idx;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5200
# 個数の数が一致すれば良いはず
S = list(input())
T = list(input())
dic_S = {}
dic_T = {}

for str in S:
    if str not in dic_S:
        dic_S[str] = 1
    else:
        dic_S[str] += 1
S = list(dic_S.values())
S.sort()

for str in T:
    if str not in dic_T:
        dic_T[str] = 1
    else:
        dic_T[str] += 1
T = list(dic_T.values())
T.sort()

if S == T:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 6704
# Input => 7 500 600
# Output OK (or NG)

# K * n + r = A
# 7 * 71 + 3 = 500
# r == 0 or K * (n+1) <= B 

def resolve(K, A, B):
    n, r = divmod(A, K)
    if r == 0 or K * (n+1) <= B:
        return True
    return False

if __name__ == '__main__':

    K = int(input())
    A, B = map(int, input().split())

    result = resolve(K, A, B)

    if result:
        print('OK')
    else:
        print('NG')


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

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while( true ){
        C = C - B;
        if( C<=0 ){
            break;
        }
        A = A - D;
        if( A<=0 ){
            break;
        }
    }

    if( A<= 0 ){
        cout << "No" << endl;
    }else if( C<=0 ){
        cout << "Yes" << endl;
    }

    return 0;
}

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

using namespace std;

int main() {
    int a;
    scanf("%d", &a);
    vector <int> n(a);
    for(int i = 0; i < a; i++) scanf("%d", &n[i]);
    int maxi = n[0], cnt = 1;
    for(int i = 1; i < a; i++) {
        if(n[i] >= maxi) {
            cnt++;
            maxi = n[i];
        }
    }
    printf("%d\n", cnt);

}

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

int main(){
  int K,S,C,count = 0;
  cin >> K >> S;
  for (int i = 0; i <= K; i++){
    for (int j = 0; j <= K; j++){
      C = S - i - j;
      if (C >= 0 && C <= K){
        count++;
      }
    }
  }
  cout << count << endl;
}

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

using namespace std;

int main(){
	int x;
	cin >> x;
int i = 0;

    if(x == 2){
        cout << "2";
        return 0;
    }
    
	while(1){
	
		if((x % 2) == 0){
			x++;
		}
	
		for(i = 3;i < x;i++){
				if((x % i) == 0){
			    	break;
				}
		}
		if(i >= x){
					cout << x;
					return 0;
				}
	
		x += 2;
	}
	
}

Measured memory_bytes: 256
/**
 *  author: mahfuzz
 *  created: 28.03.2020
**/
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    ll x; cin >> x;
    
    ll a = x / 500;
    
    ll b = x / 5;
    
    ll c = (x - (500 * a)) / 5;
    
    a *= 1000;
    b *= 5;
    
    c = a + (c * 5);
    
    cout << max(max(a, b), c) << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdio>
#define int long long 
using namespace std;
typedef long long ll;
int n,k,a[200005],b[200005];
int Lower_bound(int l,int r,int val1,int val2){
	int mid,ans=r+1;
	while(l<=r){
		mid=(l+r)>>1;
		if((ll)b[mid]*val2>=val1)
			r=mid-1,ans=mid;
		else
			l=mid+1;
	}
	return ans;
}
bool judge(ll tmp){
	int i,res=0;
	for(i=1;i<n;i++){
		if(a[i]==0){
			if(tmp>0)
				res+=n-i;
		} 
		else if(a[i]>0){
			if(tmp>0)
				res+=lower_bound(a+i+1,a+n+1,(tmp-1)/a[i]+1)-a-i-1;
		}
		else{
			//cout<<Lower_bound(1,n-i,tmp,a[i])-1<<endl;
			res+=Lower_bound(1,n-i,tmp,a[i])-1;
		}
	}
	//cout<<tmp<<' '<<res<<' '<<k<<endl;
	return res<k;
}
ll solve(){
	ll l=-1e18,r=1e18,mid,ans=-1;
	while(l<=r){
		mid=(l+r)>>1;
		//cout<<l<<' '<<r<<' '<<mid<<' '<<judge(mid)<<endl;
		if(judge(mid))//小于mid的数的数量<k
			l=mid+1,ans=mid;
		else
			r=mid-1;
	}
	return ans;
}
signed main(){
	ios::sync_with_stdio(false);
	int i;
	cin>>n>>k;
	for(i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	copy(a,a+n+1,b);
	reverse(b+1,b+n+1);
	for(i=1;i<=n;i++)
		if(a[i]>=0)
			break;
	//judge(-100);
	cout<<solve(); 
	return 0;
}

Measured memory_bytes: 6724
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int L[110000];
int R[110000];
int x[110000];
int z[110000];
pair<int,int>t[110000];
long long bit[110000];
long long sum(int a,int b){
	if(a)return (sum(0,b)-sum(0,a-1)+mod)%mod;
	long long ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
	ret%=mod;
	return ret;
}
void add(int a,int b){
	for(;a<110000;a|=a+1){
		bit[a]=(bit[a]+b)%mod;
	}
}
int y[110000];
int main(){
	int a,b;scanf("%d%d",&b,&a);
	for(int i=0;i<b;i++)scanf("%d",y+i);
	for(int i=0;i<a;i++)scanf("%d",x+i);
	int n=0;
	
	for(int i=0;i<b;i++){
		int p=y[i];
		int at=lower_bound(x,x+a,p)-x;
		if(at==0)continue;
		if(at==a)continue;
		L[n]=x[at-1]-p;
		R[n]=x[at]-p;
		n++;
	}
	for(int i=0;i<n;i++){
		z[i]=R[i];
		t[i]=make_pair(L[i],R[i]);

	}
	std::sort(z,z+n);
	std::sort(t,t+n);
	add(n,1);
	for(int i=0;i<n;i++){
		if(i<n-1&&t[i]==t[i+1])continue;

		int at=lower_bound(z,z+n,t[i].second)-z;

		long long tmp=sum(at+1,n);
	//	printf("%d %d: %d(%d) %lld\n",t[i].first,t[i].second,at,z[at],tmp);
		add(at,tmp);
	}
	printf("%lld\n",sum(0,n));
}


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

int main(){
    
    // 1. 入力情報.
    int H, W;
    scanf("%d %d", &H, &W);
    
    // 2. 文字列検索.
    rep(i, H){
        rep(j, W){
            char c[6];
            scanf("%s", c);
            string S(c);
            if(S == "snuke"){
                printf("%c", 'A' + j);
                printf("%d\n", i + 1);
                return 0;
            }
        }
    }
    return 0;
    
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        a: [f64; n],
    }
    let mut sum = 0.0;
    for a in a {
        sum += 1.0 / a;
    }
    let ans = 1.0 / sum;
    println!("{:.6}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main() {
	int n,m;
	char s[100][10];
	char t[100][10];
	scanf("%d", &n);
	for (int i=0; i < n; i++) {
		scanf("%s", s[i]);
	}
	scanf("%d", &m);
	for (int i=0; i<m; i++) {
		scanf("%s", t[i]);
	}
	
	int point=0;
	int max_point=0;
	for (int i=0; i<n; i++) {
		point=0;
		for (int j=0; j<n; j++) {
			if (strcmp(s[i], s[j]) == 0) {
				point++;
			}
		}
		for (int j=0; j<m; j++) {
			if (strcmp(s[i], t[j]) == 0) {
				point--;
			}
		}
		if (point > max_point) {
			max_point = point;
		}
		
	}
	
	printf("%d\n", max_point);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    long double a, b;
    cin >> a >> b;
    cout << ll(a*b) << endl;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define Abs(x) ((x)>=0?(x):(-(x)))
using namespace std;
typedef long long int ll;
int n;
const int maxn = 2e5 + 10;
ll a[maxn], sum[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
        sum[i] = a[i] + sum[i - 1];
    }
    ll ans = 1e16;
    for(int i = 1; i < n; ++i){
        ll t = Abs(sum[i] - (sum[n] - sum[i]));
        ans = min(ans, t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
int main(void){
    
    int d,n;
    
    scanf("%d %d",&d,&n);
    
    if(n!=100){
        switch(d){
            case 0 : printf("%d",n); break;
            case 1 : printf("%d",n*100); break;
            case 2 : printf("%d",n*10000); break;
        }
    }else{
        switch(d){
            case 0 : printf("%d",n+1); break;
            case 1 : printf("%d",n*101); break;
            case 2 : printf("%d",n*10100); break;
        }
    }
    
    return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		long k = scanner.nextLong();
		a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
			if (a[i] < 0)
				negative++;
			else if (a[i] > 0)
				positive++;
		}
		scanner.close();
		Arrays.parallelSort(a);

		long inf = a[0] * a[n - 1] - 1;
		long max = Math.max(a[0] * a[1], a[n - 2] * a[n - 1]);
		long mid;
		while (max - inf > 1) {
			mid = (max + inf) / 2;
			if (count(mid) >= k)
				max = mid;
			else
				inf = mid;
		}
		System.out.println(max);

	}

	static int n;
	static long[] a;
	static int positive = 0;
	static int negative = 0;

	static long comb(int x) {
		return (long) x * (x - 1) / 2;
	}

	static long count(long threshold) {
		long count = 0;
		int left, right;
		if (threshold < 0) {
			left = 0;
			right = n - positive;
			while (left < negative && right < n) {
				if (a[left] * a[right] <= threshold) {
					count += n - right;
					left++;
				} else {
					right++;
				}
			}

		} else {
			count = comb(n) - comb(negative) - comb(positive);
		}
		if (threshold > 0) {
			left = 0;
			right = negative - 1;
			while (left < right) {
				if (a[left] * a[right] <= threshold) {
					count += right - left;
					right--;
				} else {
					left++;
				}
			}
			left = n - positive;
			right = n - 1;
			while (left < right) {
				if (a[left] * a[right] <= threshold) {
					count += right - left;
					left++;
				} else {
					right--;
				}
			}
		}
		return count;
	}
}


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

//const lol mod=1e9+7;

/*  author: H3XoRuSH  */

int main() {
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    lol a;
    cin >> s >> a;
    lol i=0;
    while(i<s.length()){
        cout << s[i];
        i+=a;
    }
    return 0;
}


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


int main(void){
    int a,b;
    cin >> a >> b;
    int ans[3];
    ans[0] = a+b;
    ans[1] = a-b;
    ans[2] = a*b;
    int res=-100000000;
    rep(i,3){
        if(ans[i] > res){
            res = ans[i];
        }
    }
    cout << res <<endl;
    
    return 0;
}


























































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

int n = 0 ;
int m = 0 ;
int a[10001] = {0} ;
int b[10001] = {0} ;
int st_[501] = {0} ;
int st = 0 ;

int main ()
{

    while (1)
    {
        n = 0 ;
        m = 0 ;
        st = 0 ;
        memset (a ,0 ,sizeof (a) ) ;
        memset (b ,0 ,sizeof (b) ) ;
        memset (st_ ,0 ,sizeof (st_) ) ;

        cin >> n >> m ;

        if (!n && !m) break ;

        for (int i = 0 ;i < m ;i++ )
        {
            cin >> a[i] >> b[i] ;
        }

        for (int i = 0 ;i < m ;i++ )
        {
            if (a[i] == 1)
            {
                st_[ b[i] - 1 ]++ ;

                for (int j = 0 ;j < m ;j++ )
                {
                    if (a[j] == b[i])
                    {
                        st_[ b[j] - 1 ]++ ;
                    }
                    else if (b[j] == b [i])
                    {

                        st_[ a[j] - 1 ]++ ;
                    }
                }

            }
        }

        for (int i = 1 ;i < n ;i++ )
        {
            if (st_[i]) st++ ;
        }

        cout << st << endl ;
    }

    return 0 ;
}

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

int main() {
  string s;
  int ans = 0;

  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '+') {
      ans++;
    } else {
      ans--;
    }
  }
  cout << ans << endl;
}


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

int main(){
    int N;

    //入力
    cin >> N;

    int D1[N];
    int D2[N];

    for(int i=0;i<N;i++){
         cin >> D1[i];
         cin >> D2[i];
    }
    bool frag = false;
    //ループ
    for(int i=2; i<N; i++){
        if(D1[i-2]==D2[i-2]&&D1[i-1]==D2[i-1]&&D1[i]==D2[i]){
            frag = true;
        }
    }
    if(frag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

import static java.lang.Math.min;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Map<String, Integer> count = new HashMap<>();
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            String s = sort(in.next());
            if (count.containsKey(s)) {
                count.replace(s, count.get(s) + 1);
            } else {
                count.put(s, 1);
            }
        }
        long res = 0;
        for (Map.Entry<String, Integer> kv : count.entrySet()) {
            res += (long)kv.getValue() * (long)(kv.getValue() - 1) / 2;
        }

        System.out.println(res);
    }


    private static String sort(String text) {
        char[]chars = text.toCharArray();
        Arrays.sort(chars);
        return new String(chars);
    }
}


Measured memory_bytes: 54232
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
        t: String,
    }
    let s = s.chars().collect::<Vec<_>>();
    let t = t.chars().collect::<Vec<_>>();
    let mut ans = 0;
    for i in 0..3 {
        if s[i] == t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {

    int N;
    cin >> N;
    
    if (N <= 5) {
      int a[5] = {2, 5, 63, 20, 30};
      rep(i,N) {
        cout << a[i];
        if (i < N - 1) cout << " ";
        else cout << endl;
      }
      return 0;
    }

    set<int> s;
    int now = 0;
    int sum = 0;
    while (s.size() < N) {
      now++;
      if (now % 6 == 1 || now % 6 == 5) continue;
      s.insert(now);
      sum += now;
    }

    if (sum % 6 == 2) {
      s.erase(8);
      while (++now % 6 != 0) {}
      s.insert(now);
    } else if (sum % 6 == 3) {
      s.erase(9);
      while (++now % 6 != 0) {}
      s.insert(now);
    } else if (sum % 6 == 5) {
      s.erase(9);
      while (++now % 6 != 4) {}
      s.insert(now);
    }

    for (int k : s) {
      if (k < *(s.rbegin())) cout << k << " ";
      else cout << k << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4552
#include <iostream>
#include <array>
#include<stdlib.h>

using namespace std;
long long kaidann(int dannsuu){

    long long current = 1;
    long long next = 1;
    for(int i = 0; i < dannsuu;i++){
        long long tmp = current;
        current=next%1000000007;
        next += tmp;
    }
    return current%1000000007;
}
int main(){
  array<int,1000000>a;
  int n,m;
    long long ans = 1;
  cin>>n>>m;
  a.at(0) = -1;
  for(int i=1;i<=m;i++){
    cin>>a.at(i);
  }
  a.at(m+1)=n+1;
  if(m==0){
    ans=kaidann(n)%1000000007;
  }else{
    //cout<<ans<<endl;
  for(int i=0;i<=m;i++){
    int s = a.at(i+1)-a.at(i);
    if(s == 0){
      ans = ans*1;
    }else if(s==1){
      ans = 0;
    }else{
        //cout<<kaidann(s-2)<<endl;
      ans = ans * kaidann(s-2) % 1000000007;
    }
  }
}
  cout<<ans<<endl;
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
flag = 1
cnt = 0
while(flag == 1):
  for i in range(N):
    if(A[i] % 2 == 1):
      flag = 0
  if(flag == 1):
    cnt += 1
    for i in range(N):
      A[i] = A[i] // 2
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
 
#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);
 
const long double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;
 
using namespace std;
 
void print(int a[],int s,int e){for(int i=s;i<=e;i++)cout<<a[i]<<" ";cout<<"\n";}
void print(vector<int> &v,int s,int e){for(int i=s;i<=e;i++)cout<<v[i]<<" ";cout<<"\n";}
void print(vector<int> &v){for(int x:v)cout<<x<<" ";cout<<"\n";}
 
lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b,lli m=MOD){lli x=a+b;while(x>=m)x-=m;return x;}
lli sub(lli a,lli b,lli m=MOD){lli x=a-b;while(x<0)x+=m;return x;}
lli mul(lli a,lli b,lli m=MOD){lli x=a*b;x%=m;return x;}
 
 
 
int main()
{
    lli A,B,C;
    cin>>A>>B>>C;
    if(A%2==0 || B%2==0 || C%2==0){
        cout<<0;
        return 0;
    }
    cout<<min(min(A*B,B*C),C*A);
 
    return 0;
}

Measured memory_bytes: 256
EOL = '0 0'
stdin = [line for line in iter(input, EOL)]
lines = (map(int, line.split()) for line in stdin)

for H, W in lines:
    even = ('#.' * (W // 2 + 1))[:W]
    odd  = ('.#' * (W // 2 + 1))[:W]
    for i in range(H):
        if i % 2 == 0:
            print(even)
        else:
            print(odd)
    print()
    


Measured memory_bytes: 5628
using System;
using System.Collections.Generic;
using System.Linq;

namespace _0026
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true){
                var inputString = Console.ReadLine();
                string longNameWord = "";
                var wordDictionary = new Dictionary<string, int>();

                if (string.IsNullOrEmpty(inputString))
                {
                    break;
                }

                foreach (var word in inputString.Split(' '))
                {   
                    if(wordDictionary.ContainsKey(word))
                    {
                        wordDictionary[word] += 1; 
                    }
                    else
                    {
                        wordDictionary.Add(word, 1);
                    }

                    if(longNameWord.Count() < word.Count())
                    {
                        longNameWord = word;
                    }
                }
                var sortedDictionary = wordDictionary.OrderByDescending((kvp) => kvp.Value);
                Console.WriteLine("{0} {1}", sortedDictionary.First().Key, longNameWord);
            }
        }
    }
}

Measured memory_bytes: 6248
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

int main()
{
	int n, m;
	std::cin >> n >> m;
	std::vector<std::vector<int>> graph(n, std::vector<int>());
	int a, b;
	for (int i = 0; i < m; i++) {
		std::cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	
	std::vector<bool> seen(n);
	std::vector<int> guid(n - 1);
	std::queue<int> que;
	seen[0] = true;
	que.push(0);
	int v;
	while (!que.empty()) {
		v = que.front();
		que.pop();
		for (int nv : graph[v]) {
			if (seen[nv]) {
				continue;
			}
			seen[nv] = true;
			guid[nv - 1] = v + 1;
			que.push(nv);
		}
	}
	
	std::cout << "Yes\n";
	for (int e : guid) {
		std::cout << e << '\n';
	}
	std::cout << std::flush;
	
	return 0;
}


Measured memory_bytes: 9748
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC132E
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = ReadInt();
            int N = NM[0];
            int M = NM[1];

            List<int>[] edges = new List<int>[3 * N].Select(x => new List<int>()).ToArray();
            for (int i = 0; i < M; i++)
            {
                var input = ReadInt();
                int u = input[0] - 1;
                int v = input[1] - 1;
                edges[u].Add(v + N);
                edges[u + N].Add(v + 2 * N);
                edges[u + 2 * N].Add(v);
            }

            var ST = ReadInt();
            int S = ST[0] - 1;
            int T = ST[1] - 1;

            //幅優先探索
            Queue<int> que1 = new Queue<int>();
            que1.Enqueue(S);
            int[] distance = new int[3 * N].Select(x => int.MaxValue).ToArray();
            distance[S] = 0;

            while (que1.Count > 0)
            {
                int q = que1.Dequeue();

                foreach (var to in edges[q])
                {
                    int dis = distance[q] + 1;
                    if (distance[to] > dis)
                    {
                        distance[to] = dis;
                        que1.Enqueue(to);
                    }
                }
            }

            if (distance[T] != int.MaxValue) Console.WriteLine(distance[T] / 3);
            else Console.WriteLine(-1);
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}


Measured memory_bytes: 55408
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 200010;
const int INF = 2147483600;
const LL Mod = 1000000007LL;

#define fr first
#define sc second
#define pii pair<int,int>
int N,X,Y; LL ans=1;
struct data{ int c,w; }q[MAXN+1];
bool cmpw(data a,data b){ return a.w<b.w; }
vector<pii > vec[MAXN+1];
int Node[MAXN*4],Next[MAXN*4],Root[MAXN+1],cnt;
inline void insert(int u,int v){
	Node[++cnt]=v; Next[cnt]=Root[u]; Root[u]=cnt; 
} bool vis[MAXN+1]; int pt[MAXN+1];
int all,sta[MAXN+1],sum[MAXN+1];
LL inv[MAXN+1],ifac[MAXN+1],fac[MAXN+1];
inline void Addedge1(){
	for(int i=1;i<=N;i++){
		for(int j=1,l=vec[i].size();j<l;j++){
			if(vec[i][0].fr+vec[i][j].fr<=X){
				insert(vec[i][0].sc,vec[i][j].sc);
				insert(vec[i][j].sc,vec[i][0].sc);
			} else break;
		}
	}
}
inline void Addedge2(){
	int now=0; for(int i=1;i<=N;i++) if(q[i].c!=q[1].c) {now=i; break;}
	for(int i=2;i<=N;i++){
		if(q[i].c==q[1].c){
			if(!now) continue;
			if(i==now) continue;
			if(q[now].w+q[i].w<=Y)
				insert(i,now),insert(now,i);
		} else{
			if(q[1].w+q[i].w<=Y)
				insert(1,i),insert(i,1);
		}
	}
}
inline void dfs(int k){
	if(vis[k]) return ;
	vis[k]=1; if(!pt[q[k].c]){
		pt[q[k].c]=++all; sta[all]=q[k].c; sum[all]=0;
	} sum[pt[q[k].c]]++;
	for(int x=Root[k];x;x=Next[x]) dfs(Node[x]);
}
inline void calc(){
	LL sm=0; for(int i=1;i<=all;i++) ans=ans*ifac[sum[i]]%Mod,sm+=sum[i];
	ans=ans*fac[sm]%Mod; for(int i=1;i<=all;i++) pt[sta[i]]=sum[i]=0; all=0;
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(),X=read(),Y=read();
	for(int i=1;i<=N;i++){ q[i].c=read(); q[i].w=read(); } 
	sort(q+1,q+N+1,cmpw); fac[0]=inv[1]=ifac[0]=1;
	for(int i=1;i<=N;i++) vec[q[i].c].push_back(make_pair(q[i].w,i));
	for(int i=1;i<=N;i++) sort(vec[i].begin(),vec[i].end());
	for(int i=1;i<=N;i++) fac[i]=fac[i-1]*i%Mod;
	for(int i=2;i<=N;i++) inv[i]=(Mod-(Mod/i)*inv[Mod%i]%Mod)%Mod;
	for(int i=1;i<=N;i++) ifac[i]=ifac[i-1]*inv[i]%Mod;
	Addedge1(); Addedge2();
	for(int i=1;i<=N;i++) if(!vis[i]) all=0,dfs(i),calc();
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 25344
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Bits (shiftR)

main :: IO ()
main = do
  (n : a : b : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    d = b - a
  print $ if even d then halve d else min (a - 1) (n - b) + 1 + halve (pred d)

halve :: Int -> Int
halve k | 0 <= k = shiftR k 1

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <iostream>
 
using namespace std;
 
const int dir[4] = { -4, -1, 1, 4 };
 
const vector<int> goal = { 0, 1, 2, 3, 4, 5, 6, 7 };
 
map<vector<int>, int> d;
 
void bfs(vector<int> puzzle)
{
    queue<pair<vector<int>, int> > que; que.push(make_pair(puzzle, 1));
     
    d[puzzle] = 1;
     
    while(!que.empty())
    {
        vector<int> v = que.front().first; 
         
        int dist = que.front().second; que.pop();
         
        int zero = -1;
         
        for(int i = 0; i < 8; i++)
        {
            if(v[i] == 0)
            {
                zero = i;
            }
        }
         
        for(int i = 0; i < 4; i++)
        {
            if(0 <= zero + dir[i] && zero + dir[i] < 8 && !(i == 1 && zero == 4) && !(i == 2 && zero == 3))
            {
                vector<int> v2 = v;
                 
                swap(v2[zero], v2[zero + dir[i]]);
 
                if(d[v2] == 0)
                {
                    d[v2] = dist + 1;
                     
                    que.push(make_pair(v2, dist + 1));
                }
            }
        }
    }
}
 
int main()
{
   vector<int> v(8);
    
   bfs(goal);
    
   while(cin >> v[0] >> v[1] >> v[2] >> v[3] >> v[4] >> v[5] >> v[6] >> v[7])
   {
       cout << d[v] - 1 << endl;
   }
    
   return 0;
}

Measured memory_bytes: 5704
// 23.07.2017


# include <iostream>


using namespace std;

int r, g, b;
bool ok;

int main ()
{
   cin >> r >> g >> b;

   ok = ( (g*10 + b) % 4 == 0 );

   if ( ok )
      cout << "YES";
   else
      cout << "NO";

   return 0;
}


Measured memory_bytes: 256
n=int(input())
nums=list(map(int,input().split()))
# 3 2 4 5 1
nums_ans=sorted(nums)
dif_count=0
for i in range(n):
    if nums[i] != nums_ans[i]:
        dif_count+=1
if dif_count <= 2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
package main

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

func main() {
	sc = initScanner(os.Stdin)
	a := scanInt(sc)
	fmt.Println(solve(a))
}

func solve(a int) string {
	if a >= 30 {
		return "Yes"
	}
	return "No"
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanFloat64(sc *bufio.Scanner) float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func scanFloat64Slice(sc *bufio.Scanner, n int) []float64 {
	fs := make([]float64, n)
	for i := 0; i < n; i++ {
		fs[i] = scanFloat64(sc)
	}

	return fs
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 1784
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main()
{
    int R[MAX], n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        /* code */
        cin >> R[i];
    }

    int maxv = -2000000000;
    int minv = R[0];

    for (int i = 1; i < n; i++)
    {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3868
import heapq
import sys

input = sys.stdin.readline

def dijkstra_heap(s,edge):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

################################
n,s,t = map(int,input().split()) #n:頂点数　w:辺の数
w=n-1

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w):
    x,y=i,i+1 #0-indexed
    edge[x].append([1,y])
    edge[y].append([1,x]) 
edge[s-1].append([1,t-1])
edge[t-1].append([1,s-1]) 

distance=dijkstra_heap(0,edge)
memo=[0]*n

for i in range(n-1):#i to j
    for j in range(i+1,n):
        if s-1<i<t-1:#s==2,t==4
            tmp=min(j-i,distance[i]+distance[j]-distance[s-1]*2)
        else:
            tmp=distance[j]-distance[i]

        memo[tmp]+=1
for i in range(1,n):
    print(memo[i])







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

int main()
{
  string s;
  cin >> s;
  int len = s.size();
  len -= 2;

  for (;;len -= 2) {
    if (s.substr(0, len / 2) == s.substr(len / 2, len / 2)) {
      cout << len << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<iomanip>
#define _USE_MATH_DEFINES
#include<math.h>
#include<iostream>
using namespace std;

int main()
{
	int n;
	double dp1 = 0, dp2 = 0, dp3 = 0, dpm = 0, d2 = 0, d3 = 0;
	double x[100];
	double y[100];
	double xy[100];
	
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x[i];
	}
	for (int i = 0; i < n; i++){
		cin >> y[i];
	}
	for (int i = 0; i < n; i++){
		xy[i] = sqrt((x[i] - y[i])*(x[i] - y[i]));
		d2 = d2 + pow(xy[i],(double)2);
		d3 = d3 + pow(xy[i],(double)3);
	}

	for (int i = 0; i < n; i++){
		dp1 = dp1 + xy[i];
		dp2 = sqrt(d2);
		dp3 = pow(d3,(double)1/(double)3);
		if (dpm < xy[i]){
			dpm = xy[i];
		}
	}

	cout << fixed << setprecision(6) << dp1 << endl;
	cout << fixed << setprecision(6) << dp2 << endl;
	cout << fixed << setprecision(6) << dp3 << endl;
	cout << fixed << setprecision(6) << dpm << endl;
	
	return 0;
}


Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0;cin>>n;
  lvector p(n,0),q(n+1,0);
  rep(i,n) cin>>p[i],q[p[i]]=i;
  multiset<ll> st{-1,-1,n,n};
  for(ll i=n;i>=0;--i) {
    ll pos=q[i];
    ll r1=*st.lower_bound(pos);
    ll r2=*next(st.lower_bound(pos));
    ll l1=*prev(st.lower_bound(pos));
    ll l2=*prev(st.lower_bound(pos),2);
    ans+=((r2-r1)*(pos-l1)+(l1-l2)*(r1-pos))*i;
    st.insert(pos);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 6528
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String sl[] = s.split(" ");
            int A = Integer.parseInt(sl[0]);
            int B = Integer.parseInt(sl[1]);

            System.out.println(Math.max(A * B, Math.max(A + B, A - B)));
        }
    }
}


Measured memory_bytes: 22484
#include <stdio.h>

int main(){
    
  int a[100],n,i,j,minj,count=0,tmp;
    
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
    
  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(a[j]<a[minj]) {
	minj=j;
      }  
    }
    tmp = a[i];
    a[i] =a[minj];
    a[minj]=tmp;
    if(i!=minj) count++;
  }
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[n-1]);
  printf("%d\n",count);
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  ll N, M;
  cin >> N >> M;
  priority_queue<ll> A;
  REP(i, N) {
    ll a;
    cin >> a;
    A.push(a);
  }
  REP(i, M) {
    ll b = A.top()/2;
    A.pop();
    A.push(b);
  }
  ll ans = 0;
  REP(i, N) {
    ans += A.top();
    A.pop();
  }
  cout << ans << '\n';
}


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

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int C = scanner.nextInt();
        int[] B = new int[M];
        for (int i = 0; i < M; i++) {
            B[i] = scanner.nextInt();
        }

        int ans = 0;
        for (int i = 0; i < N; i++) {
            int sum = 0;
            for (int j = 0; j < M; j++) {
                sum += scanner.nextInt() * B[j];
            }
            if (sum + C > 0) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 24148
#include<cstdio>
inline int in();
inline void wr(int);
int main(int argc,char**argv){
	register int k=in(),x=in();
	for(register int i=x-k+1;i<=x+k-1;++i)
		wr(i),putchar(' ');
	putchar('\n');
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
//すべてをDに変えてみる

    string T;
    cin >> T;
    int l;
    l=T.size();
    int x;
    x=0;

    for (int i = 0; i < l; i++) {
        if(T.at(i)=='?' || T.at(i)=='D' ){
            x=x+1;
        }
    }

    for (int i = 0; i < l-1; i++) {
        if(T.at(i)=='P' && T.at(i+1)=='D' ){
            x=x+1;
        }
    }

    for (int i = 0; i < l-1; i++) {
        if(T.at(i)=='P' && T.at(i+1)=='?' ){
            x=x+1;
        }
    }

     for (int i = 0; i < l; i++) {
        if(T.at(i)=='?' ){
            T.at(i)='D';
        }
    }

cout <<T;

}


Measured memory_bytes: 3724
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

l = []
for i in range(n):
    num = a[i]
    while num > 0:
        l.append(i+1)
        num -= 1
s = []
cnt = 0
for i in range(0, h*w, w):
    if cnt%2 == 0:
        print(*l[i:i+w])
    else:
        print(*l[i+w-1:i-1:-1])
    cnt += 1


Measured memory_bytes: 9440