akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
  FAST/**/
   
   pair<ll,ll> sig[4];
   sig[0] = mp(1ll,-1ll);
   sig[1] = mp(1ll,1ll);
   sig[2] = mp(-1ll,1ll);
   sig[3] = mp(-1ll,-1ll);   
   
   ll n;
   cin>>n;
   
   pair<ll,ll> arr[n];
   rep(n)   
        cin>>arr[i].ff>>arr[i].ss;
   
   pair<ll,ll> hold[4];
   for(ll i=0;i<4;i++)
        hold[i].ff = sig[i].ff*arr[0].ff + sig[i].ss*arr[0].ss, hold[i].ss = hold[i].ff;
   
   for(ll i=1;i<n;i++)
   {
       for(ll j=0;j<4;j++)
       {
           ll temp = sig[j].ff*arr[i].ff + sig[j].ss*arr[i].ss;
           hold[j].ff = max(hold[j].ff,temp);
           hold[j].ss = min(hold[j].ss,temp);
       }
   }
   
   ll ans = 0;
   rep(4)
        ans = max(ans, hold[i].ff-hold[i].ss);
   
   cout<<ans;        
   
   return 0;        
}  

  
          
   

Measured memory_bytes: 6764
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(‘ ‘)
#define enter putchar(‘\n‘)
#define MAXN 200005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
int64 L;int N;
int64 a[MAXN],sum[2][MAXN];
void Solve() {
    scanf("%lld %d", &L, &N);
    for(int i = 1 ; i <= N ; ++i) scanf("%lld", &a[i]);
    for(int i = 1 ; i <= N ; ++i) {
        sum[0][i] = sum[0][i - 1] + a[i];
    }
    for(int i = N ; i >= 1 ; --i) {
        sum[1][i] = sum[1][i + 1] + L - a[i];
    }
    int64 ans = max(L - a[1],a[N]);
    for(int i = 1 ; i <= N - 1; ++i) {
        int t = min(i,N - i);
        int64 res = 2 * (sum[0][i] - sum[0][i - t] + sum[1][i + 1] - sum[1][i + 1 + t]);
        int64 c = res - a[i];
        if(i > t) {c += 2 * a[i - t];}
        ans = max(ans,c);
        c = res - (L - a[i + 1]);
        if(N - i > t) c += 2 * (L - a[i + 1 + t]);
        ans = max(ans,c);
    }
    printf("%lld\n", ans);
}
int main() {
    Solve();
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		new Main().start();
	}
	void start(){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		a = insertionSort(a,n);
//		a = selectionSort(a,n);
		printArray(a);
		in.close();

	}

	int[] insertionSort(int[]a, int n){
		for(int i = 1; i < n; i++){
			printArray(a);
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && a[j] > v){
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
		}
		return a;
	}
	int[] selectionSort(int[] a, int n){
		int count = 0;
		for(int i = 0; i < n; i++){
//			printArray(a);
			int minj = i;
			for(int j = i; j < n;j++){
				if(a[j] < a[minj]) minj = j;
			}
			if(minj != i){
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				count++;
			}
		}
		System.out.println(count);
		return a;
	}
	void printArray(int[] a){
		System.out.print(a[0]);
		for(int i= 1; i < a.length; i++){
			System.out.print(" " + a[i]);
		}
		System.out.println();
	}

}

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

int int_sort(const void *a, const void *b){//small -> big
  if(*(int *)a < *(int *)b){
    return -1;
  }else if(*(int *)a == *(int *)b){
    return 0;
  }
  return 1;
}

int main(void){
  int n[3], ans;
  scanf("%d %d %d",&n[0],&n[1],&n[2]);
  qsort((void *)n, 3, sizeof(n[0]), int_sort);
  if((n[0]%2)==(n[1]%2) && (n[1]%2)==(n[2]%2)) ans = (n[2]-n[1])/2+(n[2]-n[0])/2;
  else{
    if(n[0]%2==n[1]%2) ans = (n[2]-n[1]-1)/2+(n[2]-n[0]-1)/2+1;
    else ans = (n[2]-n[1])/2+(n[2]-n[0])/2+2;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <string.h>

int main() {

    while (true) {
        char text[1001];
        std::scanf("%s",text);

        if (!strcmp(text,"0")) {
            break;
        }

        int sum = 0;

        for(int i = 0; text[i] != '\0'; i++) {
        //i番目の文字
            char c = text[i];

            int eachnum = c - '0';

            sum+=eachnum;
        }

        std::printf("%d\n",sum);

    }



}


Measured memory_bytes: 2716
#include <cstdio>
#include <algorithm>
using namespace std;

int a[111111], gf[111111], ge[111111];

int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }

int main(void)
{
	int n, i, ans = 0;

	scanf("%d" ,&n);
	for (i = 1; i <= n; i++)
	{
		scanf("%d" ,&a[i]);
		gf[i] = gcd(gf[i - 1], a[i]);
	}
	for(i = n; i >= 1; i--)
		ge[i] = gcd(ge[i + 1], a[i]);

	for (i = 1; i <= n; i++)
		ans = max(ans, gcd(gf[i - 1], ge[i + 1]));

	printf("%d" ,ans);
	return 0;
}

Measured memory_bytes: 1280
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;    
    vector<ll> a(5);
    rep(i,5) cin>>a[i];
    sort(All(a));
    ll ans = 0;
    ans += (N+a[0]-1)/a[0];
    cout << ans + 4 << nn;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int d,n;
    cin >> d >> n;
    if(d == 0){
        if(n==100){
            cout << 101 <<endl;
        }
        else cout << 1*n << endl;
    }
    if(d==1){
        if(n==100){
            cout << 10100 << endl;
        }
        else cout << 100 * n << endl;
    }
    if(d==2){
        if(n==100){
            cout << 1010000 << endl;
        }
        else cout << 10000 * n << endl;
    }
}

Measured memory_bytes: 256
use std::io::*;
//use std::str::*;

macro_rules! get_in {
	() => {
		{
			let mut buf = String::new();
			stdin().read_line(&mut buf).ok();
			
			buf.replace("\n", "")
		}
	}
}

fn main() {
	let s = get_in!();

	let mut num = 0;
	let mut fla = false;
	for v in s.chars() {
		if v == 'R' {
			if fla {
				num+=1;
			} else if num == 0 {
				num = 1;
			}
			fla = true;
		} else {
			fla = false;
		}
	}
	println!("{}", num);
	
}


Measured memory_bytes: 2088
// created_by  Rishi_Mohan

#include<bits/stdc++.h>

#define    ll           long long
#define    db1(x)       cout<<#x<<"="<<x<<'\n'
#define    db2(x,y)     cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define    db3(x,y,z)   cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

using namespace std;

void solve()
{
    int x , y;
    cin >> x >> y;

    bool ok = 0;

    if(y&1) ok=0;
    else
    {
       int X = y/2 - x;
       int Y = x-X;
       // db2(X,Y);
       if((X+Y)==x && X>=0 && Y>=0) ok = 1;
   }
   if(ok) cout << "Yes" ;
   else cout << "No";

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(m1==m2) cout<<0<<endl;
    else cout<<1<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


	public class Main {
		
		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int n = sc.nextInt();
			int ret = 64;
			
			while(ret>n) {
				ret /= 2;
			}
			
			System.out.println(ret);
			
	    }
		
	}
	


Measured memory_bytes: 35752
#include<bits/stdc++.h>
#define int long long int
using namespace std;
#define pb push_back
#define MAX 200005
int par[MAX];
int sz[MAX];
void init()
{
	for(int i=0;i<MAX;i++){
		par[i]=i;
		sz[i]=1;
	}
}
int parent(int x)
{
	if(par[x]==x)	return x;
	par[x]=parent(par[x]);
	return par[x];
}
void unionxy(int x,int y)
{
	int px=parent(x);
	int py=parent(y);
	if(px==py)	return;
	par[py]=px;
	sz[px]+=sz[py];
}
int32_t main()
{
	int n,m;
	cin >> n >> m;
	int t=m;
	init();
	while(t--){
		int x,y;
		cin >> x >> y;
		unionxy(x,y);
	}
	int ans=1;
	for(int i=1;i<=n;i++){
		if(i==parent(i)){
			ans=max(ans,sz[i]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7620
#include <stdio.h>

void print(int a[], int N)
{
	for (int i = 0; i < N; i++)
	{
		printf("%d", a[i]);
		if (i != N - 1)
		{
			printf(" ");
		}
		
	}

}
int main()
{
	int a[100];
	int key;
	int N;
	scanf("%d", &N);

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &a[i]);  //  不能多余若输入为回车就跳出循环的判断语句
		
	}


	print(a, N);
	printf("\n");

	int j;
	for (int i = 1; i < N; i++)
	{
		key = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > key)
		{
			a[j + 1] = a[j];
			j--;
			a[j + 1] = key;
		}
		print(a, N);
		printf("\n");
	}

	return 0;
}


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

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

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

Measured memory_bytes: 256
//author: zekigurbuz (Zeki Gurbuz) 2020
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int N = 1e5 + 10;
const int M = 1e9 + 7;

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

template<class T>void ckmin(T&a,T b){a=min(a,b);}
template<class T>void ckmax(T&a,T b){a=max(a,b);}




void solve() {
	int n, m; cin >> n >> m;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	int sum = 0;
	for (int i : a) sum += i;
	int cnt = 0;
	for (int i : a) if (sum <= 4ll * m *  i) cnt++;
	cout << (cnt >= m ? "Yes" : "No") << endl;
}

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

	int t = 1;
    //cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main(){
	var x,y int
	fmt.Scan(&x,&y)
	if y%2 == 0 {
		if x*2 <= y && y <= x*4 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1816
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    //整数に直す⇒持ち上げた桁数、素因数の2の数、5の数をカウントしておく
    //桁数、2の数、5の数の組合わせが一致している数がいくつあるかをメモっておき、持ち上げた桁数を解消出来る組み合わせの数を求めて終わり

    int N;
    cin >>N;
    vector<tuple<int,int,int>> maps;
    rep(i,N){
        string tmp;
        cin>>tmp;
        long long tmpll=0;
        long long div2=0,div5=0;
        long long upcnt=0;
        long long llwork=0;
        string D="";
        bool pflag=false;
        rep(j,tmp.size()){
            if(tmp[j]=='.'){
                 D=tmp.substr(0,j)+tmp.substr(j+1);
                 tmpll=stoll(D);
                 upcnt=tmp.size()-j-1;
                 pflag=true;
                 break;
            }
        }
        if(!pflag){
            tmpll=stoll(tmp);
        }
        llwork=tmpll;
        while(1){
            if(llwork%2==0){
                div2++;
                llwork=llwork/2;
            }else{
                break;
            }
        }
        while(1){
            if(llwork%5==0){
                div5++;
                llwork=llwork/5;
            }else{
                break;
            }
        }
        maps.push_back(make_tuple(upcnt,div2,div5));
        
    }
    // rep(i,maps.size()){
    //     cout << get<0>(maps[i]) <<":" <<get<1>(maps[i])<<":"<< get<2>(maps[i]) << endl;
    // }
    map<tuple<long long,long long,long long>,long long> ansmap; //(持ち上げ桁数、2の数、5の数)がいくつあるかを管理するマップ
    rep(i,maps.size()){
        if(ansmap.count(maps[i])){
            ansmap[maps[i]]++;
        }else{
            ansmap[maps[i]]=1;
        }
    }
    vector<pair<tuple<long long,long long,long long>,long long>> ans;
    for(auto e : ansmap){
        ans.push_back(make_pair(e.first,e.second));
    }

    // for(auto e : ansmap){
    //     cout << std::get<0>(e.first) << ":" <<std::get<1>(e.first) << ":"<< std::get<2>(e.first) << endl;
    //     cout << e.second<< endl;
    // }

    long long answer=0;
    for(int i=0;i<ans.size();i++){
        for(int j=i;j<ans.size();j++){
            if(std::get<0>(ans[i].first)+std::get<0>(ans[j].first)<=min(std::get<1>(ans[i].first)+std::get<1>(ans[j].first),std::get<2>(ans[i].first)+std::get<2>(ans[j].first))){
                // cout << std::get<0>(ans[i].first)+std::get<0>(ans[j].first) << ":" << std::get<1>(ans[i].first)+std::get<1>(ans[j].first) << ":" << std::get<2>(ans[i].first)+std::get<2>(ans[j].first) << endl;
                if(i==j){
                    // cout << i << ":" << j << endl;
                    // cout << ans[i].second*(ans[i].second-1) << endl;
                    answer=answer+((ans[i].second*(ans[i].second-1))/2);
                }else{
                    // cout << i << ":" << j << endl;
                    // cout << ans[i].second*(ans[j].second) << endl;
                    answer=answer+(ans[i].second*(ans[j].second));
                }
            }
        }
    }
    cout << answer << endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

string S[3];
bool AB[5005];
bool BC[5005];
bool AC[5005];

ll solve(const string &a, const string &b, const string &c) {
    memset(AB, 0, sizeof(AB));
    memset(AC, 0, sizeof(AC));
    memset(BC, 0, sizeof(BC));

    REP(i, 5000) {
        bool ok = true;
        REP(j, c.size()) {
            if (i + j >= a.size())
                break;
            if (a[i + j] == c[j])
                continue;
            if (a[i + j] == '?' || c[j] == '?')
                continue;
            ok = false;
            break;
        }
        AC[i] = ok;
    }
    REP(i, 5000) {
        bool ok = true;
        REP(j, b.size()) {
            if (i + j >= a.size())
                break;
            if (a[i + j] == b[j])
                continue;
            if (a[i + j] == '?' || b[j] == '?')
                continue;
            ok = false;
            break;
        }
        AB[i] = ok;
    }
    REP(i, 5000) {
        bool ok = true;
        REP(j, c.size()) {
            if (i + j >= b.size())
                break;
            if (b[i + j] == c[j])
                continue;
            if (b[i + j] == '?' || c[j] == '?')
                continue;
            ok = false;
            break;
        }
        BC[i] = ok;
    }

    ll min = a.size() + b.size() + c.size();
    REP(i, a.size() + 5) {
        REP(j, b.size() + a.size() + 5) {
            ll ci = i + j;
            if (AC[ci] && BC[j] && AB[i]) {
                min = std::min(min, std::max({(ll) a.size(), (ll) (i + b.size()), (ll) (ci + c.size())}));
            }
        }
    }
    return min;
}

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

    REP(i, 3) {
        cin >> S[i];
    }

    ll ans = INF;
    vector<ll> v = {0, 1, 2};
    do {
        ans = std::min(ans, solve(S[v[0]], S[v[1]], S[v[2]]));
    } while (next_permutation(v.begin(), v.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
 
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
 
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

ll gcd(ll a,ll b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}
ll po(ll a,ll b)
{
    ll ans = 1;
    while(b--)
        ans*=a;
    return ans;
}
ll pom(ll a,ll b,ll mod)
{
    if(b==0)return 1;
    ll k = pom(a,b/2,mod);
    if(b%2==0)return (k*k)%mod;
    else return ((k*k)*mod*a)%mod;
}

int check(int n)
{
    if(n==2)return 1;
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)return 0;
    }
    return 1;
}


void solve()
{
    int n;
    cin>>n;
    while(!check(n))
        n++;
    cout<<n<<endl;
}




int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    */
        ll t;
    //cin>>t;
    //while(t--)
        solve();
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#define rnt register int
using namespace std;
struct node{
	int wz,v;
	bool operator < (const node& o)const
	{
		return v<o.v;
	}
}id[100010];
int n;
int main()
{
	scanf("%d",&n);
	for(rnt i=0;i<n;i=-~i)
	{
		scanf("%d",&id[i].v);
		id[i].wz=i;
	}sort(id,id+n);
	for(rnt i=0;i<n;i=-~i)
		printf("%d ",id[i].wz+1);
	return 0;
}

Measured memory_bytes: 1536
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let mut n = get!(String).chars().map(|e| e as isize - '0' as isize).collect::<Vec<_>>();

    n.insert(0,0);
    let m = n.len();
    let mut count = n.iter().sum::<isize>();
    for i in (1..m).rev() {
        if n[i] >= 6 || (n[i] == 5 && n[i-1] >= 5) {
            n[i-1] += 1;
            count += 11-2*n[i];
        }
    }
    println!("{}", count);
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> vec(H);
  for (int i=0; i<H; i++)
    cin >> vec.at(i);
  for (int i=0; i<W+2; i++)
    cout << '#';
  cout << endl;
  for (int i=0; i<H; i++)
    cout << '#' << vec.at(i) << '#' << endl;
  for (int i=0; i<W+2; i++)
    cout << '#';
  cout << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))
dp = [False]*(K+1)
for i in range(1,K+1):
    for a in A:
        if i-a >= 0 and dp[i-a] == False:
            dp[i] = True
            break
print("First" if dp[-1] else "Second")


Measured memory_bytes: 3828
#include <iostream>

 int main(void) {
  int N;
  std::cin >> N;
  for(int i=N;i>=1;i--) {
    if(i==1||i==2||i== 4 ||i==8||i==16||i==32||i==64){
       std::cout << i; return 0;
}
  }

  return 0;
}

Measured memory_bytes: 256
import sys
N, K = map(int, input().split())
first = N
list_a = []

if N % K == 0:
    print(0)
    sys.exit()
else:
    X = N // K
    N = N - (K * (X+1))

second = N + K

N = abs(N)

list_a.append(N)
list_a.append(second)
list_a.append(first)

list_a = sorted(list_a)

print(list_a[0])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
using Int = long long;
int main()
{
    int C[4][4] = {};
    for (int y = 1; y <= 3; y++) {
        for (int x = 1; x <= 3; x++) {
            cin >> C[y][x];
        }
    }
    int ok = 1;
    for (int y = 1; y <= 3; y++) {
        for (int x = 1; x <= 2; x++) {
            if (C[y][x+1] - C[y][x] != C[1][x+1] - C[1][x]) ok = 0;
        }
    }
    for (int y = 1; y <= 2; y++) {
        for (int x = 1; x <= 3; x++) {
            if (C[y+1][x] - C[y][x] != C[y+1][1] - C[y][1]) ok = 0;
        }
    }
    const char* L[]={"No", "Yes"};
    cout << L[ok] << endl;
    return 0;
}

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

#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 rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;

const string YES = "Yes";
const string NO = "No";

void solve()
{
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  string S;
  cin >> S;
  int l = S.size();
  if (A+B+1!=l) {
    cout << NO << endl;
    return;
  }
  for (int i=0; i<l; i++) {
    if (i==A) {
      if (S[i]!='-') {
        cout << NO << endl;
        return;
      }
    } else {
      if (S[i]=='-') {
        cout << NO << endl;
        return;
      }
    }
  }
  cout << YES << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	if(s[k-1]=='A'){
		s[k-1] = 'a';
	}else if(s[k-1]=='B'){
		s[k-1] = 'b';
	}else{
		s[k-1] = 'c';
	}
	cout<<s<<endl;

	return 0;
}


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

int main(){
    using namespace std;
    int N; cin >> N;
    vector<int> A(N+1);
    vector<int> m(N+1, 0);
    vector<int> ans;
    for (int i = 1; i < N+1; i++) cin >> A[i];

    for (int i = N; i >=1; i--) {
        int cnt = 0;
        for (int j = i; j <= N; j+=i)
        {
            if(j%i==0 && m[j]==1) cnt++;
        }
        if(cnt%2 != A[i]){
            m[i] = 1;
            ans.push_back(i);
        }    
    }

    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i];
        if(i!=ans.size()-1) cout << " ";
        else cout << endl; 
    }
}


Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>
using namespace std;
bool minus[100001];
int a[100001];
long long dp[100001][3];
const long long NINF=-1000000000000000000;
int main()
{
    int n;
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        if (i>1)
        {
            char x;
            scanf(" %c",&x);
            minus[i]=x=='-';
        }
        scanf("%d",&a[i]);
    }
    dp[0][1]=dp[0][2]=-1e18;
    for (int i=1;i<=n;++i)
    {
        if (minus[i])
        {
            dp[i][0]=dp[i][1]=max(dp[i-1][0]-a[i],max(dp[i-1][1]==NINF?NINF:dp[i-1][1]+a[i],
                dp[i-1][2]==NINF?NINF:dp[i-1][2]-a[i]));
            dp[i][2]=max(dp[i-1][1]==NINF?NINF:dp[i-1][1]+a[i],dp[i-1][2]==NINF?NINF:dp[i-1][2]-a[i]);
        }
        else
        {
            dp[i][0]=max(dp[i-1][0]+a[i],max(dp[i-1][1]==NINF?NINF:dp[i-1][1]-a[i],
                dp[i-1][2]==NINF?NINF:dp[i-1][2]+a[i]));
            dp[i][1]=max(dp[i-1][1]==NINF?NINF:dp[i-1][1]-a[i],dp[i-1][2]==NINF?NINF:dp[i-1][2]+a[i]);
            dp[i][2]=dp[i-1][2]==NINF?NINF:dp[i-1][2]+a[i];
        }
    }
    printf("%lld\n",dp[n][0]);
    return 0;
}


Measured memory_bytes: 2944
import java.io.IOException;
import java.util.BitSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			n = scanner.nextInt();
			if (n == 0)
				break;
			d = new int[n][n];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n; j++)
					d[i][j] = scanner.nextInt();
			int max = 0;
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n; j++) {
					d[i][j] = Math.max(d[i][j], d[j][i]);
					max = Math.max(max, d[i][j]);
				}
			ans = INF;
			pos = new int[n];
			bitSet = new BitSet();
			dfs(0);
			System.out.println(ans);
		}
	}

	private void dfs(int right) {
		if (ans <= right)
			return;

		if (bitSet.cardinality() == n) {
			ans = right;
			return;
		}
		for (int i = 0; i < n; i++) {
			if (bitSet.get(i))
				continue;
			
			for (int j = 0; j < n; j++) {
				if (bitSet.get(j))
					pos[i] = Math.max(pos[i], pos[j] + d[j][i]);
			}
			bitSet.set(i);
			dfs(pos[i]);
			bitSet.clear(i);
			pos[i] = 0;
		}
	}

	int n, ans;
	int[] pos;
	int[][] d;
	int INF = 1 << 30;
	BitSet bitSet;
}

Measured memory_bytes: 29440
#include <iostream>
#include <sstream>

using namespace std;

typedef long long ll;

string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

int main()
{
	ll n;
	while (cin >> n && n ){
		ll res = 0LL;
		bool sign = (n < 0LL ? true : false );
		if (sign )
			n = -n;
		ll org = (sign ? -1 : 1 )*n;	// for debug
		string s = itos (n );
		for (ll i = 0, d = 1LL; i < s.length(); i++, d *= 10LL ){
			ll m =  s[s.length()-1-i] - '0';
			if (m == 0LL )
				continue;
			if ((!sign && i % 2 == 0 ) || (sign && i % 2 != 0 ) ){
				res += m*d;
				// ÌJèãªèª éB
				if (res >= 10LL*d ){
					int t = res/(d*10LL);
					res = res % (d*10LL)+(20LL-t)*d*10LL;
				} // end if
			}else{
				res += (20LL - m)*d;
				// 	Jèã°
				if (res >= d*20LL ){
					res -= d*20LL;
				} // end if
			} // end if
		} // end for

		cout << res << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    cin>>n;
    int m=1<<n;
    multiset<int> ms;
    for(int i=0;i<m;i++){
        int s;
        cin>>s;
        ms.insert(s);
    }
    vector<int> ans;
    ans.push_back(*prev(ms.end()));
    for(int i=1;i<m;i*=2){
        for(int j=0;j<i;j++){
            auto it=ms.lower_bound(ans[j]);
            if(it==ms.begin()){
                cout<<"No"<<endl;
                return 0;
            }
            ans.push_back(*prev(it));
            ms.erase(prev(it));
        }
    }
    cout<<"Yes"<<endl;
}


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

using namespace std;
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,m;
	cin >>n;
	map<string, int> mpa;
	rep(i,n){
		string s; cin>>s;
		mpa[s]++;
	}
	cin >>m;
	rep(i,m){
		string s; cin>>s;
		mpa[s]--;
	}
	
	int ans =0;
	for(auto x: mpa) if(x.second>ans) ans=x.second;
	cout << ans <<"\n";
	return 0;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,a,b) for(int i=a; i<b; i++)
typedef vector<int> vi;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  ll ans = 1e18;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i != 0) continue;
    ll j = n/i;
    ans = min(ans, i+j-2);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits//stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  if(n%10 == 3) cout << "bon" << endl;
  else if(n%10== 0 || n%10 == 1 || n%10 == 6|| n%10 == 8)
    cout << "pon" << endl;
  else cout << "hon"<<endl;
}

Measured memory_bytes: 3680
A,B,C = map(int,input().split())

if A%2==B%2==C%2==0 and A==B==C:
  print(-1)
  exit()

cnt=0
while(A%2==B%2==C%2==0):
  _A=A;_B=B;_C=C
  A=_B//2+_C//2
  B=_A//2+_C//2
  C=_B//2+_A//2
  cnt+=1
  #print(cnt,A,B,C)
print(cnt)

Measured memory_bytes: 38256
//
//  main.c
//  Matsuzaki Number
//
//  Created by x15071xx on 2016/06/16.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#include <stdio.h>
#include <math.h>

#define NUM 150000


int find_i (int hurui[],int x){
    int i;
    
    for (i=x; i<NUM; i++) {
        if (hurui[i] == 1) {
            break;
        }
    }
    
    return i;
}

int main(int argc, const char * argv[]) {
    
    int hurui[NUM];
    int i,j;
    for (i=0; i<NUM; i++) {
        hurui[i] = 1;
    }
    hurui[0] = 0;
    hurui[1] = 0;
    
    for (i=2; i<sqrt(NUM); i++) {
        if (hurui[i] == 1) {
            for (j=i*2; j<NUM; j+=i) {
                hurui[j] = 0;
            }
        }
    }
    while (1) {
        
        int n=0,p=0,tmp=0;
        
        scanf("%d %d",&n,&p);
        
        if (n==-1 && p==-1) {
            break;
        }
        
        int count_p=0,pp=0,num_array[101],x=0,count_num=0,y=0,k=0;
        for (i=0; i<101; i++) {
            num_array[i]=0;
        }
        //n????????§????????????????´???°???
        x = find_i(hurui, n+1);
        for (i=n+1; count_num<p; i=y+1) {
            y = find_i(hurui, i);
            num_array[count_num] = x + y;
            count_num++;
        }
        
        count_p = num_array[p-1];
        
        for (i=x+1; i<count_p; i=x+1) {
            x = find_i(hurui, i);
            for (j = i; pp < count_p; j=y+1) {
                y = find_i(hurui, j);
                pp= x + y;
                num_array[count_num]=pp;
                //?????????????????????????????\??????
                k = count_num;
                while (num_array[k] < num_array[k-1]) {
                    tmp = num_array[k];
                    num_array[k] = num_array[k-1];
                    num_array[k-1] = tmp;
                    k--;
                }
                if (count_num != 101) {
                    count_num++;
                }
                
            }
            count_p=num_array[p-1];
            pp=0;
            int z = find_i(hurui, i+1);
            if (count_p < z*2) {
                break;
            }
            
        }
        printf("%d\n",num_array[p-1]);
    }
        
    
    
    
    return 0;
}

Measured memory_bytes: 1184
s = input()

if len(s) % 2 == 0:
  s_len = len(s) // 2
else:
  s_len = len(s) // 2 + 1

cnt = 0

for i in range(s_len):
  if s[i] != s[-(i+1)]:
    cnt += 1

print(cnt)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin>>A[i];
  vector<int> rev(N);
  for(int i=0;i<N;i++) rev[A[i]-1]=i+1;
  std::string ss = "";
  for(int i=0;i<N;i++) {
    if(i != N - 1){
      ss = ss + std::to_string(rev[i]) + " ";
    }else{
      ss = ss + std::to_string(rev[i]);
    }
  }
  cout<<ss<<endl;
  return 0;
}


Measured memory_bytes: 5988
def calc_cost(book_dict, book_list, M, X):
    algo_score = [0] * M
    cost = 0
    for book_index in book_list:
        A = book_dict[book_index][1]
        cost += book_dict[book_index][0]
        for i in range(len(A)):
            algo_score[i] += A[i]
            
    for i in range(M):
        if (algo_score[i] < X):
            return -1
    
    return cost
        
    


def main():
    from itertools import combinations
    N, M, X = map(int, input().split())
    book_dict = {}
    for i in range(N):
        record = list(map(int, input().split()))
        c = 0
        A = []

        for j in range(M+1):
            if (j == 0):
                c = record[j]
            else:
                A.append(record[j])
        book_dict[i] = (c, A)

    max_cost = (10**5) * N + 1
    min_cost = max_cost
    is_possible = False
    for i in range(1, N+1, 1):
        for comb in combinations(list(range(N)), i):
            cost = calc_cost(book_dict, list(comb), M, X)
            if(cost != -1):
                is_possible = True
                min_cost = min(min_cost, cost)

    if(is_possible):
        print(min_cost)
    else:
        print(-1)            

main()

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long get, count = 0;
  cin >> get;
  while(get>=500){
    count+=1000;
    get-=500;
  }
  while(get>=5){
    count+=5;
    get-=5;
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n;
  cin >> n;
  int t = -1, now = 0;
  map<int, set<int>> mp;
  rep(i, n) {
    int l;
    cin >> l;
    if (l == now + 1) {
      now = l;
    }
  }
  if (now == 0) cout << -1 << endl;
  else
  cout << n - now << endl;
}


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

#ifndef ONLINE_JUDGE
#include "myfile.h"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;


void solve() {
	int n;
	cin >> n;
	map<string, int> m;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		m[s]++;
	}

	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;

}

int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

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

// [桁][未満フラグ][0の個数]
ll dp[101][2][101];
string N;
int K;

ll memo(int i, int smaller, int k) {
  if (i >= N.size()) {
    return k == K;
  }

  if (dp[i][smaller][k] != -1) {
    return dp[i][smaller][k];
  }

  ll ret = 0;
  int current = N[i] - '0';
  int limit = smaller ? 9 : current;
  for (int d = 0; d <= limit; d++) {
    ret += memo(i + 1, smaller || d < current, k + (d != 0));
  }

  return dp[i][smaller][k] = ret;
}

int main() {

  // fill(dp[0][0], dp[0][0] + 101 * 2 * 101, -1LL);
  memset(dp, -1, 101 * 2 * 101 * sizeof(ll));

  cin >> N;
  cin >> K;

  ll cnt = memo(0, 0, 0);
  cout << cnt << endl;
}

Measured memory_bytes: 384
# -*- coding: UTF-8 -*-

import math

n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
c = 0


def distance(y, z):
    k = 0
    cc = 0
    for (i, j) in zip(y, z):
        k += (i - j) ** 2
    if math.sqrt(k).is_integer() == True:
        cc += 1
    return(cc)


for i, s in enumerate(x):
    for t in x[i+1:]:
        c += distance(s, t)

print(c)


Measured memory_bytes: 3064
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

x, y = MAP()
a = 2*x - y
b = 2*y - x

if a >= 0 and b >= 0 and a % 3 == 0 and b % 3 == 0:
    a //= 3
    b //= 3
    ans = cmb(a+b, a, 10**9+7)
else:
    ans = 0

print(ans)

Measured memory_bytes: 128564
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  string S; cin >> S;
  for (int i = 0; i < 3; i++) cout << S[i];
  cout << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main(){
  int K, N, dis=0, ans;
  cin >> K >> N;
  int A[N];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N-1; i++){
    if(A[i+1]-A[i] > dis) dis = A[i+1]-A[i];
  }
  if(K+A[0]-A[N-1] > dis) dis = K+A[0]-A[N-1];
  ans = K-dis;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
N = int(input())
value = []
for i in range(N):
    A, B = map(int, input().split())
    value.append([A+B, A, B])

value.sort(reverse=True)
takahashi = 0
aoki = 0
flag = 1
for i in range(N):
    if flag == 1:
        takahashi += value[i][1]
    else:
        aoki += value[i][2]
    flag *= -1
print(takahashi - aoki)


Measured memory_bytes: 59804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())
 
int main()
{
    int n;
    cin >> n;

    set<string> res;
    rep(i,n){
      string s; cin >> s;

      res.insert(s);
    }

    cout << res.size() << endl;
}

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

int main(){
    int n,numbers[100];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>numbers[i];
    }
    
    for(int j=n-1;j>=0;j--){
        if(j!=n-1)cout<<" ";
        cout<<numbers[j];
        
    }
    cout<<endl;
        
    return 0;
}



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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > root_first;
    vector<pair<int, int> > root_second;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        root_first.push_back(make_pair(a, b));
        root_second.push_back(make_pair(b, a));
    }
    sort(root_first.begin(), root_first.end());
    sort(root_second.begin(), root_second.end());

    int ans[n + 1] = {};
    vector<vector<int> > way(n + 1);

    rep(i, m) {
        way[root_first[i].first].push_back(root_first[i].second);
        way[root_second[i].first].push_back(root_second[i].second);
    }

    queue<int> q;
    q.push(1);
    while(!q.empty()) {
        for(int i = 0; i < way[q.front()].size(); i++) {
            if(ans[way[q.front()][i]] == 0) {
                ans[way[q.front()][i]] = q.front();
                q.push(way[q.front()][i]);
            }
        }
        q.pop();
    }
    int f = 0;
    for(int i = 2; i <= n; i++) {
        if(ans[i] == 0) f = 1;
    }
    if(f == 0) {
        cout << "Yes" << endl;
        for(int i = 2; i <= n; i++) cout << ans[i] << endl;
    } else
        cout << "No" << endl;

    // rep(i, n) {
    //     rep(j, way[i].size()) {
    //         cout << way[i][j] << " ";
    //     }
    //     cout << endl;
    // }
}

Measured memory_bytes: 13092
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


S = S()

lis = [0] * (len(S) + 1)  # 左に連続する'<' の数、右に連続する'<'の数の大きい方
left = [0] * (len(S) + 1)
right = [0] * (len(S) + 1)
left_count = 0
for i, s in enumerate(S):
    if (s == '<'):
        left_count += 1
        left[i+1] = left_count
    else:
        left_count = 0

right_count = 0
i = len(S)
for s in reversed(S):
    if (s == '>'):
        right_count += 1
        right[i-1] = right_count
    else:
        right_count = 0
    i -= 1


ans = 0
for l, r in zip(left, right):
    ans += max(l, r)
print(ans)


Measured memory_bytes: 69096
using System;

namespace AOJ.Volume0
{
    public class LeapYear
    {
        public static void Main()
        {
            bool first = true;
            while (true)
            {
                var input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[0]);
                int b = int.Parse(input[1]);
                if (a <= 0 || b <= 0) { break; }

                if (!first) { Console.WriteLine(); }
                else { first = false; }

                // 最初のうるう年を見つける
                for (int i = 0; i < 8; i++)
                {
                    if (a % 4 == 0)
                    {
                        if (a % 100 == 0)
                        {
                            // うるう年
                            if (a % 400 == 0) { break; }
                            // うるう年ではない
                            a++;
                            continue;
                        }
                        // うるう年
                        break;
                    }
                    a++;
                }

                // 指定期間にうるう年無し
                if (a > b) { Console.WriteLine("NA"); }
                else
                {
                    Console.WriteLine(a);
                    for (int i = a + 4; i <= b; i = i + 4)
                    {
                        if (i % 100 == 0)
                        {
                            if (i % 400 == 0) { Console.WriteLine(i); }
                            else { continue; }
                        }
                        else { Console.WriteLine(i); }
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 15876