akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef long long ll;
typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;
inline int rd() {
    int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
    while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
const int N=1e5+11;
char s[N];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	int f=0;
	rep(i,1,n){
		f+=s[i]-'0';
	}
	if(!f||f==n){
		printf("%d\n",n);
	}else{
		int ans=n,ans2=n;
		rep(i,1,n)if(s[i]-'0'){
			ans=min(ans,max(i-1,n-i));
		}else ans2=min(ans2,max(i-1,n-i));
		cout<<max(ans,ans2)<<endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vector<int> a(100000,0);
  rep(i,n){
    int t;
    cin >> t;
    a.at(t)++;
  }
  int ans = 0;
  for(int i=0;i+2<100000;i++){
    int count = a.at(i) + a.at(i+1) + a.at(i+2);
    ans = max(ans,count);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
char a[10];
char b[10];
char c[10];
 int add;
  add='A'-'a';
  scanf("%s %s %s",a,b,c);
  a[0]=a[0]+add;
  b[0]=b[0]+add;
  c[0]=c[0]+add;
  printf("%c%c%c",a[0],b[0],c[0]);
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long const MAX=1e12L+2;
long long dp[100005]={MAX};
int main()
{long long i,j,x,n,r,k,p,t,w,y,sum;
cin>>n>>w;
long long a[n],b[n];
sum=0;
dp[0]=0;
t=0;
for(i=0;i<n;i++)
{cin>>a[i]>>b[i];
sum=sum+b[i];}
for(i=1;i<=sum;i++)
{dp[i]=MAX;}
for(i=0;i<n;i++)
{x=a[i];
y=b[i];
    for(j=sum;j>0;j--)
{if(j-y<0)
break;
else 
dp[j]=min(dp[j-y]+x,dp[j]);}
}
for(i=0;i<=sum;i++)
{if(dp[i]<=w)
t=max(t,i);}
cout<<t;
return 0;}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.equals("RRR")) {
            System.out.println(3);
        } else if (s.equals("RRS") || s.equals("SRR")) {
            System.out.println(2);
        } else if (s.equals("RSR") || s.equals("RSS") || s.equals("SSR") || s.equals("SRS")) {
            System.out.println(1);
        } else {
            System.out.println(0);
        }
        sc.close();
    }
}

Measured memory_bytes: 35532
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const int MOD=1000000007;
int INF=100100100100100;
const int d=50;
int a[100];
int bi[100];
int dp[100][2];
signed main(){
  int n,k;cin>>n>>k;
  rep(i,n){
    int x;cin>>x;
    rep(j,d){
      if(x & (1LL<<(d-j-1)))a[j]++;
    }
    
  }
  rep(j,d){
    if(k & (1LL<<(d-j-1)))bi[j]=1;
    //cout<<a[j]<<" "<<bi[j]<<endl;
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0]=0;
  rep(i,d){
    int c0=(1LL<<(d-i-1))*a[i],c1=(1LL<<(d-i-1))*(n-a[i]);
    if(dp[i][1]>=0){
      chmax(dp[i+1][1],dp[i][1]+max(c0,c1));
    }
    if(dp[i][0]>=0){
      if(bi[i]==0)chmax(dp[i+1][0],dp[i][0]+c0);
      else{
        chmax(dp[i+1][1],dp[i][0]+c0);
        chmax(dp[i+1][0],dp[i][0]+c1);
      }
    }
  }
  cout<<max(dp[d][0],dp[d][1])<<endl;
  return 0;
}


Measured memory_bytes: 3524
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int a[3];
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	
	int k=0;
	int e=0;
	if(a[0]%2==a[1]%2 && a[0]%2==a[2]%2){
	    e = a[0]%2;
	}
	else if(a[0]%2==a[1]%2 || a[0]%2==a[2]%2){
	    e = (a[0]+1)%2;
	} else e = (a[1]+1)%2;
    for(int i=0;i<3;i++){
        if(a[i]%2!=e){
            a[i]+=1;
            k++;
        }
    }
    k /= 2;
    int m = max({a[0],a[1],a[2]});
    for(int i=0;i<3;i++){
        k += (m-a[i])/2;
    }
    
	
	printf("%d\n",k);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int N=4e5+1;
bool v[N];
int n,d,D,x,f[N],g[N],q[N],t,X,c[N],A,C;
vector<int>a[N],b[N];
void P(int x,int y,int z,int w)
{
	if(0>=z||z>n||0>=w||w>n)
		return;
	a[(x-1)*n+y].push_back((z-1)*n+w);
}
void Q(int x,int y,int z,int w)
{
	if(0>=z||z>n||0>=w||w>n)
		return;
	b[(x-1)*n+y].push_back((z-1)*n+w),b[(z-1)*n+w].push_back((x-1)*n+y);
}
int main()
{
	cin>>n>>d>>D;
	n*=2;
	for(int i=0;i*i<=d;i++)
	{
		x=sqrt(d-i*i);
		if(x*x+i*i!=d||x<i)
			continue;
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
				P(j,k,j-x,k-i),P(j,k,j-x,k+i),P(j,k,j+x,k-i),P(j,k,j+x,k+i),P(j,k,j-i,k-x),P(j,k,j+i,k-x),P(j,k,j-i,k+x),P(j,k,j+i,k+x);
	}
	for(int i=0;i*i<=D;i++)
	{
		x=sqrt(D-i*i);
		if(x*x+i*i!=D||x<i)
			continue;
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
				Q(j,k,j-x,k-i),Q(j,k,j-x,k+i),Q(j,k,j+x,k-i),Q(j,k,j+x,k+i),Q(j,k,j-i,k-x),Q(j,k,j+i,k-x),Q(j,k,j-i,k+x),Q(j,k,j+i,k+x);
	}
	for(int i=1;i<=n*n;i++)
		if(!v[i])
		{
			f[i]=0,q[++t]=i,v[i]=true;
			while(t)
			{
				X=q[t--];
				for(int j=0;j<a[X].size();j++)
					if(!v[a[X][j]])
						f[a[X][j]]=2-f[X],q[++t]=a[X][j],v[a[X][j]]=true;
			}
		}
	memset(v,false,sizeof(v));
	for(int i=1;i<=n*n;i++)
		if(!v[i])
		{
			g[i]=0,q[++t]=i,v[i]=true;
			while(t)
			{
				X=q[t--];
				for(int j=0;j<b[X].size();j++)
					if(!v[b[X][j]])
						g[b[X][j]]=1-g[X],q[++t]=b[X][j],v[b[X][j]]=true;
			}
		}
	for(int i=1;i<=n*n;i++)
		c[f[i]+g[i]]++;
	for(int i=1;i<4;i++)
		if(c[i]>c[A])
			A=i;
	for(int i=1;i<=n*n;i++)
		if(f[i]+g[i]==A&&C<n*n/4)
			cout<<(i-1)/n<<" "<<(i-1)%n<<'\n',C++;
	return 0;
}

Measured memory_bytes: 125312
import java.io.*;
 
class Main{
	public static void main(String[] args) throws IOException{

        	int W,H,x,y,r;

	        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	        String str[] = br.readLine().split(" ");
	        W = Integer.parseInt(str[0]);
	        H = Integer.parseInt(str[1]);
		x = Integer.parseInt(str[2]);
	        y = Integer.parseInt(str[3]);
	        r = Integer.parseInt(str[4]);

		if((x+r)<=W && (x-r)>=0 && (y+r)<=H && (y-r)>=0){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 17060
#include<bits/stdc++.h>
    using namespace std;
    int n,m,cnt=1,head[200005],ans[200005];
    struct edge{
    	int to,next,w;
    }e[500005];
    void addedge(int u,int v){
    	e[cnt].to=v;
    	e[cnt].w=1;
    	e[cnt].next=head[u];
    	head[u]=cnt;
    	++cnt;
    }
    int dis[100005];
    bool vis[100005];
    priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
    int main(){
    	cin>>n>>m;
    	for(int i=1;i<=m;i++){
    		int x,y;
    		cin>>x>>y;
    		addedge(x,y);
    		addedge(y,x);
    	}
    	for(int i=1;i<=n;i++)
    		dis[i]=0x7fffffff;
    	dis[1]=0;
    	q.push(make_pair(dis[1],1));
    	while(!q.empty())
    	{
    		pair<int,int> fr=q.top();
    		q.pop();
    		int now=fr.second;
    		if(vis[now]) continue;
    		vis[now]=true;
    		int ndis=fr.first;
    		for(int i=head[now];i;i=e[i].next)
    		{
    			if(ndis+e[i].w<dis[e[i].to])
    			{
    				dis[e[i].to]=ndis+e[i].w;
    				ans[e[i].to]=now;
    				if (!vis[e[i].to])  q.push(make_pair(dis[e[i].to],e[i].to));
    			}	
    		}
    	}
    	for(int i=2;i<=n;i++){
    		if(ans[i]==0){
    			cout<<"No";
    			return 0;
    		}
    	}
    	cout<<"Yes"<<endl;
    	for(int i=2;i<=n;i++)
    		cout<<ans[i]<<endl;
    	return 0;
    }

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {

  vector<int> v(3);
  int s = 0;
  for (int i = 0; i < 3; i++) {
    cin >> v[i];
    s = max(s, v[i]);
  }
  cout << v[0] + v[1] + v[2] - s << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
flg = 0
val = {'r': P, 's': R, 'p': S}
for i in range(K):
    for j in range(i,N,K):
        if j == i:
            ans += val[T[j]]
            flg=0
        else:
            if T[j] == T[j-K]:
                if flg == 0:
                    flg = 1
                else:
                    ans += val[T[j]]
                    flg = 0
            else:
                ans += val[T[j]]
                flg = 0
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm> 
#include <math.h>
#include <vector>
using namespace std;

int main(){
	
	string s;
	int count =0;
	int maxC =0;
	cin >> s;
	for(char& c: s){
		if(c=='R'){
			count++;
			maxC = max(maxC,count);
		}
		else count = 0;
	}
	cout << maxC;
}




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


int main() {
	int input;
	float output;

	cin >> input;
	if (input % 2 == 0)
	{
		output = 0.5;
		cout << output;
	}
	else if (input % 2 == 1)
	{
		float tmp;
		tmp = (input + 1) / 2;
		output = tmp / input;
		cout << output;
	}
}


Measured memory_bytes: 256
import collections as c
N = int(input())

keys = []
vals = []
for _ in range(N):
	S = c.Counter(input())
	keys.append(list(S.keys()))
	vals.append(list(S.values()))

ans = [0 for _ in range(26)]
for i in range(97,123):
	tmp = float("inf")
	for j in range(N):
		if chr(i) in keys[j]:
			tmp = min(tmp, vals[j][keys[j].index(chr(i))])
		else:
			tmp = -1
			break
	if tmp == -1:
		continue
	else:
		ans[i-97] = tmp

for i in range(26):
	print(chr(i+97)*ans[i], end="")
print()


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

int main(){
  int n; cin >> n;
  long long int a[n];
  for(int i=0; i<n; i++) cin >> a[i];
  long long int tempMin=1000000005, ma=-1000000005;

  for(int i=1; i<n; i++){
    tempMin=min(tempMin, a[i-1]);
    ma=max(ma, a[i]-tempMin);
  }
  cout << ma << endl;
  return 0;
}



Measured memory_bytes: 4680
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<long long> v(n,0);
    for(auto&& x: v)
        cin >> x;

    long long min = *(min_element(v.cbegin(),v.cend()));
    long long max = *(max_element(v.cbegin(),v.cend()));
    long long acc = accumulate(v.cbegin(),v.cend(),0LL);

    cout << min << ' ' << max << ' ' << acc << '\n';

    return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <string>
#include <bits/stdc++.h>

using namespace std;

using wv_tuple = pair<int,int>;
using ull = unsigned long long int;

ull knapsack1(const vector<wv_tuple>& WV, int N, int W) {
    // fij: represents the maximum value
    // using first i items, when budget is j
    vector<vector<ull>> f;
    f.resize(N+1, vector<ull>(W+1));
    
    for (size_t i = 1; i < N+1; ++i)
    {
        for (size_t j = 1; j <= W; j++)
        {   
            // in this case, we must discard i-th item
            if(WV[i-1].first > j) {
                f[i][j] = f[i-1][j];
            } else{
                f[i][j] = max(
                    f[i-1][j], 
                    f[i-1][j-WV[i-1].first] + WV[i-1].second);
            }
        }
    }
    
    return f[N][W];
}


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

    int N,W;
    cin>>N>>W;
    vector<wv_tuple> WV;
    int w,v;
    for (size_t i = 0; i < N; i++)
    {
        cin>>w>>v;
        WV.push_back(make_pair(w,v));
    }
    cout << knapsack1(WV, N, W)<<"\n";
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
 
//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
//save time
#define endl '\n'
#define db(x) cerr << "> " << #x << ": " << x << endl
typedef long long ll;
 
//for sorting
#define all(a) a.begin(),a.end()
 
//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f
 
//loops
#define REP(i,n) 	    for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)
 
//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb 	push_back
 
//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second
 
//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar
 
//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)
 
//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue
 
//general
#define E empty()
 
//Declare all variables and methods needed between this comment and the next one(OCD lol)
const int MAXN=0;
int main(){
    int n , k ; cin >> n >> k ; 
    int ar[n];
    REP(i, n){
        cin >> ar[i];
    }
    vector<bool> dp(n+k, 0);
    REP(size, k+1){
        for(int val : ar){
            if(val <=size && !dp[size - val]){
                dp[size] = true;
            }
        }
    }
    cout << (dp[k] ? "First" : "Second" ) << endl ;
}

Measured memory_bytes: 3620
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let lr = readInts()
    let(l, r) = (lr[0], lr[1])
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    
    if abs(l - r) >= 2019 {
        print(0)
        return
    }
    
    var ans = 2018
    for left in l..<r {
        for right in left + 1...r {
            if left >= right {
                break
            }
            ans = min(left * right % 2019, ans)
        }
    }
    print(ans)
}
main()



Measured memory_bytes: 13668
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
signed main(){
	int n,ans=INT_MAX;
	cin>>n;
	rep(i,n){
		int a;
		cin>>a;
		int m=0;
		while(a){
			if(a&1) break;
			else m++;
			a>>=1;
		}
		ans=min(ans,m);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
List = list(map(int,input().split()))

a = [0,2,5,5,4,5,6,3,7,6]

kazu = [a[List[i]] for i in range(M)]

def dddd(kazu,X):
  dp = [ [ -float('inf') for j in range(X+1)]  for i in range(M)]
  for i in range(M):
    dp[i][0] = 0

  for i in range(M):
    for j in range(X+1):
      if kazu[i] <= j:
        dp[i][j] = max(dp[i][j-kazu[i]] + 1,dp[i-1][j])
      else:
        dp[i][j] = dp[i-1][j]
  return dp[-1]
   
keta_arr = dddd(kazu,N)
keta = keta_arr[-1]
List.sort(reverse=True)
ans = []

while keta>0:
  for aa in List:
    k = a[aa]
    if N-k < 0:
      continue
    if N-k >= 0:
      if keta_arr[N-k] == keta-1:       
        ans.append(aa)
        N = N-k
        keta -= 1
        break
ans.sort(reverse=True)
print(int(''.join(map(str,ans))))

Measured memory_bytes: 46300
s = input()
a = int(s[:2])
b = int(s[2:])

if 1 <= a and a <= 12 and 1 <= b and b <=12:
    print("AMBIGUOUS")
elif 1 <= a <=12 and (12 < b or b < 1):
    print("MMYY")
elif (12 < a or a < 1) and 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
N = int(input())
a = list(map(int, input().split()))

max1 = max(a)
min1 = min(a)

if min1 >= 0:
    print(N-1)
    for i in range(N-1):
        print(i+1, i+2)
elif max1 <= 0:
    print(N-1)
    for i in range(N-1):
        print(N-i, N-i-1)
else:
    if -min1 < max1:
        t = a.index(max1) + 1
        print(2*N - 1)
        for i in range(N):
            print(t, i+1)
        for i in range(N-1):
            print(i+1, i+2)
    else:
        t = a.index(min1) + 1
        print(2*N - 1)
        for i in range(N):
            print(t, i+1)
        for i in range(N-1):
            print(N-i, N-i-1)

Measured memory_bytes: 9136
#include <stdio.h>
bool setMap();
void search(int x,int y);
int map[12][12];
int w=12;
int h=12;


int main(void)
{
	while(setMap()){
	}
}

bool setMap(){
	char t;
	int count=0;
	int r;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			
			r=scanf(" %c",&t);
			if(r<1){
				return false;
			}
			
			map[i][j]=t-'0';
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(map[i][j]==1){
				search(j,i);
				count++;
			}
		}
	}
	printf("%d\n",count);
	return true;
}


void search(int x,int y){
	if(w>x && x>=0 && h>y && y>=0 && map[y][x]==1){
		map[y][x]=0;
		search(x+1,y);
		search(x-1,y);
		search(x,y+1);
		search(x,y-1);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
const int N = 300000;

int n;

struct tData {
    int x, id, ans;
} a[N];

inline bool cmp_x( tData x, tData y ) { return x.x < y.x; }
inline bool cmp_id( tData x, tData y ) { return x.id < y.id; } 

int main()
{
    scanf( "%d", &n );
    for( int i = 1; i <= n; i ++ )
        scanf( "%d", &a[i].x );
    for( int i = 1; i <= n; i ++ )
        a[i].id = i;

    sort( a+1, a+1+n, cmp_x );
    int mid = n / 2;
    for( int i = 1; i <= mid; i ++ )
        a[i].ans = a[mid+1].x;
    for( int i = mid+1; i <= n; i ++ )
        a[i].ans = a[mid].x;

    sort( a+1, a+1+n, cmp_id);
    for( int i = 1; i <= n; i ++ )
        printf( "%d\n", a[i].ans );

    return 0;
}

Measured memory_bytes: 4480
S=input()

B=[]
b=0
for i in range(len(S)):
    if S[i]=="B":
        b+=1
        B.append(b)
    else:
        B.append(b)

ans=0
for i in range(len(S)):
    if S[i]=="W":
        ans+=B[i]

print(ans)

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

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

    int a, b;
    cin >> a >> b;
    if (a == 1) {
        a = 14;
    }
    if (b == 1) {
        b = 14;
    }
    if (a == b) {
        cout << "Draw";
    }
    if (a > b) {
        cout << "Alice";
    } else if (a < b) {
        cout << "Bob";
    }
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut a: [i64; n],
    };
    let mut sum = 0;
    let mut a_p = a[0];
    for i in 1..n {
        let a_i = a[i];
        if a_p > a_i {
            sum += a_p - a_i;
            a[i] = a_p;
        }
        a_p = a[i];
    }
    let ans = sum;
    println!("{}", ans);
}


Measured memory_bytes: 5576
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair
#define MOD (LL)(1e9+7)

string S;
LL dp[100000][13];
LL solve(int now, int mod){
	if(now == S.size()){
		if(mod == 5) return 1;
		else return 0;
	}
	if(dp[now][mod] != -1) return dp[now][mod];
	if(S[now] != '?') return dp[now][mod] = solve(now+1, (mod*10+S[now]-'0')%13);
	LL ret = 0;
	for(int i=0; i<10; i++){
		ret += solve(now+1, (mod*10+i)%13);
	}
	return dp[now][mod] = ret % MOD;
}

int main(){
	cin >> S;
	for(int i=0; i<S.size(); i++){
		for(int j=0; j<13; j++){
			dp[i][j] = -1;
		}
	}
	cout << solve(0, 0) << endl;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  cout << n*n << endl;
  return 0;
}


Measured memory_bytes: 256
N=gets.to_i
a=gets.split
a.each_with_index { |e, i|
  i=i+1
  print "node #{i}: key = #{e}, "
  print "parent key = #{a[i/2-1]}, " unless i==1
  if (i=i*2) <= N
    print "left key = #{a[i-1]}, "
    print "right key = #{a[i]}, " if i+1<=N
  end
  puts
}

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

int main() {
  int x1, x2, x3, x4, x5, ans;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  if (x1==0) ans = 1;
  else if (x2==0) ans = 2;
  else if (x3==0) ans = 3;
  else if (x4==0) ans = 4;
  else if (x5==0) ans = 5;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3584
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

vector<bool> prime;
void primeinit(int N){
    if(N+1>prime.size()){
        prime.resize(N+1,true);
    } 
    prime[0] = false;
    prime[1] = false;
    for(int i=2; i*i<=N;i++) if(prime[i]) for(int j=2; i*j<=N;j++) prime[i*j]=false;
}

int main(void){
  primeinit(60000);
  int N;
  cin >> N;
  int count=0;
  int num=2;
  while(count<N){
    if(num%10==1 && prime[num]){
      cout << num << " ";
      count++;
    }
    num++;
  }
  cout << endl;
}

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

int main(void) {
    int D, T, S;
    cin >> D >> T >> S;

    int time = ceil(D*1.0/S);

    if(time <= T){
        cout << "Yes"<< endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

int main() {
    int x, a, b;
    cin >> x >> a >> b;

    int ans = x - a;
    ans -= ans / b * b;

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


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
//N = number of atoms

int main()
{
  long long int i,j,k,l;
  long long int N;
  scanf("%lld",&N);
  
  long long int str[N+1];
  long long int kaburi[300000] = {0};
  long long int ans;
  long long int sum;
  
  for(i=1;i<=N;i++){
    scanf("%lld",&str[i]);
    j = str[i];
    kaburi[j]++;
  }

  sum = 0;
  for(i=1;i<300000;i++){
    if( kaburi[i] > 0 ){
      sum += (kaburi[i]*(kaburi[i]-1))/2;
    }
  }
  
  for(i=1;i<=N;i++){
    j = str[i];
    l = (kaburi[j]*(kaburi[j]-1))/2 - ((kaburi[j]-1)*(kaburi[j]-2))/2;
    ans = sum - l;
    printf("%lld\n",ans);
  }
  
  
  return 0; 
  
}

Measured memory_bytes: 6400
<?php


[$N] = fscanf(STDIN, "%d");
$array = ["AC" => 0, "WA" => 0, "TLE" => 0, "RE"=> 0];

for($i=0;$i<$N;$i++){
    [$T] = fscanf(STDIN, "%s");
    $array[$T]++;
}

echo <<<TXT
AC x {$array["AC"]}
WA x {$array["WA"]}
TLE x {$array["TLE"]}
RE x {$array["RE"]}
TXT;


Measured memory_bytes: 16296
#include<iostream>
#include <cstdlib>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
#define cd cout<<"asd"<<endl;
const int PI=acos(-1);
const int N=2e2+7;
struct qujian{
    double l,r;
}a[N*2];
bool  cmp(const qujian &a,const qujian &b){
    return a.l<b.l;
}
int main(){
	int n;
	cin>>n;
	cout<<"ABC"<<n<<endl;
}


Measured memory_bytes: 256
let n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'))
const alphabetCounts = 26
const chars = new Array(alphabetCounts).fill().map((_, i) => String.fromCharCode(i + 97))
let current = 1
while (true) {
  const currentPow = Math.pow(alphabetCounts, current++)
  if (n <= currentPow) {
    let str = (n - 1).toString(26)
    while (str.length < current - 1) {
      str = '0' + str
    }
    console.log(Array.from(str).map(v => {
      const cc = v.charCodeAt(0)
      return String.fromCharCode(cc <= 57 ? cc + 49 : cc + 10)
    }).join(''))
    break
  }
  n -= currentPow
}

Measured memory_bytes: 30568
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <cassert>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <utility>
#include <cmath>
#include <bitset>
#include <climits>
#include <iomanip>
#include <fstream>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <numeric>

using namespace std;

#define ll long long
#define N (ll)(1e6+3)
#define INF (ll)(1e18+1)
#define EPS (1e-8)
#define PI (3.14159265358979323846)
#define ld double
#define MOD (ll)(1e9+7)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define fi first
#define se second
#define rep(i,a,n) for (ll i = a; i<n; i++)
#define per(i,a,n) for (ll i = n-1; i>=a; i--)
#define pb push_back

ll x[N], w[N];

void solve() {
    ll n, l, t;
    cin >> n >> l >> t;
    rep(i,0,n) {
        cin >> x[i] >> w[i];
        if (w[i] == 2) w[i] = -1;
    }

    vector<ll> resX;
    rep(i,0,n) {
        resX.push_back((x[i]+w[i]*t+l*t)%l);
    }
    ll cntX = 0;
    rep(i,1,n) {
        if (w[i] != w[0]) {
            ll dist = (x[i]-x[0]+l)%l;
            if (w[0] == -1)
                dist = (x[0]-x[i]+l)%l;
            if (2*t < dist) continue;
            cntX += 1+(2*t - dist)/l;
        }
    }
    cntX %= n;
    if (w[0] == -1)
        cntX = (n-cntX)%n;

    // ant at x[0]+w[0]*t is ant #cntX
    sort(resX.begin(), resX.end());
    ll tar = (x[0]+w[0]*t+l*t)%l;
    ll ans[N];
    rep(i,0,n) {
        if (resX[i] == tar && (w[0] == -1 || i+1 == n || resX[i+1] != tar)) {
            ans[cntX] = resX[i];
            cntX = (cntX+1)%n;
            ll j = (i+1)%n;
            while (j != i) {
                ans[cntX] = resX[j];
                cntX = (cntX+1)%n;
                j = (j+1)%n;
            }
            break;
        }
    }

    rep(i,0,n)
        cout << ans[i] << endl;

}


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

Measured memory_bytes: 9332
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

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

  ll n, t; cin >> n >> t;
  ll b = 0;
  ll ans = 0;
  rep(i, n) {
    ll a; cin >> a;
    ans += min(a-b, t);
    b = a;
  }
  ans += t;
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a =input()
    b=input()
    c=input()
    now = "A"
    for i in range(300):
        if now =="A":
            if len(a) >0:
                now = a[0].upper()
                a=a[1:]
            else:
                print("A")
                break
        if now =="B":
            if len(b) >0:
                now = b[0].upper()
                b=b[1:]
            else:
                print("B")
                break
        if now =="C":
            if len(c) >0:
                now = c[0].upper()
                c=c[1:]
            else:
                print("C")
                break

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	//freopen("***.in","r",stdin);
	//freopen("***.out","w",stdout);
	cin>>a>>b;
	if(a+b==15)
		cout<<"+"<<endl;
	else if(a*b==15)
			cout<<"*"<<endl;
		else
			cout<<"x"<<endl;
	
 	return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input=input.split("\n");
  var S=input[0];
  for(var i=0;i<S.length;i++){
    if(S[i]!==S[S.length-1-i]){
      console.log('No');
      return;
    }
  }
  for(var i=0;i<(S.length-1)/2;i++){
    if(S[i]!==S[(S.length-1)/2-1-i]){
      console.log('No');
      return;
    }
  }
  for(var i=0;i<(S.length-1)/2;i++){
    if(S[i+(S.length+1)/2]!==S[S.length-1-i]){
      console.log('No');
      return;
    }
  }
  console.log('Yes');
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  



  


Measured memory_bytes: 29552
N, K = map(int, input().split())
MOD = 10 ** 9 + 7
i = 1
M = N
div = []
while i * i <= N:
    if N % i == 0:
        div.append(i)
        if N // i != i:
            div.append(N // i)
    i += 1


div = sorted(div)
N1 = len(div)
num = [0] * (N1 + 1)
ans = 0
for i in range(N1):
    num[i] = pow(K, (div[i] + 1) // 2, MOD)
    for j in range(i):
        if div[i] % div[j] == 0:
            num[i] = num[i] - num[j] + MOD
            num[i] %= MOD

    if div[i] % 2 == 0:
        ans += div[i] * num[i] // 2
        ans %= MOD
    else:
        ans += div[i] * num[i]
        ans %= MOD

print(ans)

Measured memory_bytes: 41580
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

int main() {
    int A = 0;
    int B = 0;
    REP(i,4) {
        int j;
        cin >> j;
        A += j;
    }
    REP(i,4) {
        int j;
        cin >> j;
        B += j;
    }
    cout << max(A, B) << endl;
    return 0;
}

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

int main() {
    int N, d1, d2;
    cin >> N;
    int count = 0;
    for (int i = 0; i < N; i++) {
        cin >> d1 >> d2;
        if (d1 == d2) {
            count++;
        }
        else {
            count = 0;
        }
        if (count == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


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

int n;
pair<int, int>p[300000];
bool ok(int t) {
	priority_queue<int>Q; ll sum = 0;
	for (int i = n - 1; i >= n - t + 1; i--) {
		Q.push(p[i].second); sum += p[i].second;
	}
	for (int i = n - t; i >= 0; i--) {
		if (p[i].first*(ll)t >= sum + p[i].second)return 1;
		if (!Q.empty() && Q.top() > p[i].second) {
			sum -= Q.top() - p[i].second; Q.pop();
			Q.push(p[i].second);
		}
	}
	return 0;
}
int main() {
	scanf("%d", &n);
	rep(i, n) {
		int a, b; scanf("%d%d", &a, &b);
		p[i] = { b,a };
	}
	sort(p, p + n);
	int a = 0, b = n;
	while (a != b) {
		int t = (a + b) / 2;
		if (b - a == 1)t = b;
		if (ok(t))a = t;
		else b = t - 1;
	}
	printf("%d\n", a);
}

Measured memory_bytes: 8264
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#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> 
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
vector<ll>adj[1000005];
ll a[1000002];
ll ans[1000002];
ll segTree[1000002];
void build(ll l,ll r,ll id)
{  
   if(l==r)
     { 
     	segTree[id]=0;
     	return ;
	 }
	ll mid;
	mid=(l+r)/2;
	build(l,mid,2*id+1);
	build(mid+1,r,2*id+2);
	segTree[id]=max(segTree[2*id+1],segTree[2*id+2]);	
	return ;
}
ll query(ll l,ll r,ll id,ll queryLeft,ll queryRight)
{ if(queryLeft<=l&&queryRight>=r)
	return segTree[id];
  if(queryLeft>r||queryRight<l)
	  return 0;
  ll mid=(l+r)/2;
  return max(query(l,mid,2*id+1,queryLeft,queryRight),query(mid+1,r,2*id+2,queryLeft,queryRight));
}
void update(ll l,ll r,ll id,ll val,ll index)
{ 
  if(l==r)
  {
  	segTree[id]=val;
  	return ;
  }
  else
  {
  	ll mid;
  	mid=(l+r)/2;
  	if(index<=mid&&index>=l)
  	{
     update(l,mid,2*id+1,val,index);
  	}
  	else
  	{
  	 update(mid+1,r,2*id+2,val,index);
  	}
  	 segTree[id]=max(segTree[2*id+1],segTree[2*id+2]);
  	return ;
  }
}
ll n;
void dfs(ll u,ll p)
{
	ans[u]=query(1,n,0,1, a[u]-1)+1;
	ll prev=query(1,n,0, a[u], a[u]);
	update(1,n,0, ans[u], a[u]);
	ans[u]=max(ans[u], ans[p]);
	for(auto v:adj[u])
	{
		if(v!=p){
			dfs(v, u);
		}
	}
	update(1,n,0, prev, a[u]);
}
vector<pair<ll,ll> >v;
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	ll u, v1;
	cin>>n;
	for (ll i = 1; i <= n; ++i)
	{
		cin>>a[i];
		v.pb(mp(a[i],i));
	}
	sort(v.begin(), v.end());
	for (int i1 = 0; i1 < n; ++i1)
	{
		ll i=v[i1].ss;
		ll val=v[i1].ff;
		if (i1==0)
		{
			a[i]=1;
			continue;
		}
		if (val==v[i1-1].ff)
		{
			a[i]=a[v[i1-1].ss];
		}else{
			a[i]=a[v[i1-1].ss]+1;
		}
	}

	build(1,n,0);
	for (int i = 0; i < n-1; ++i)
	{
		cin>>u>>v1;
		adj[u].pb(v1);
		adj[v1].pb(u);
	}
	dfs(1, 0);
	// 	for (int i = 1; i <= n; ++i)
	// {
	// 	cout<<a[i]<<" "<<endl;
	// }
	for (int i = 1; i <= n; ++i)
	{
		cout<<ans[i]<<"\n";
	}
	//cout<<endl;
	return 0;
}


Measured memory_bytes: 54720
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
int a[] = {400, 800, 1200, 1600, 2000, 2400, 2800, 3200};
int b(int c){
	rep(i, 8) if(c < a[i]) return i;
	return 8;
}
int main(){
	int n;
	cin >> n;
	vi v(9);
	rep(i, n) {
		int d;
		cin >> d;
		v[b(d)]++;
	}
	int sum = 0LL;
	rep(i, 8) sum += v[i] > 0;
	cout << max(1, sum) << " " << sum + v[8] << endl;
}


Measured memory_bytes: 256
/*input
3
100 100
10 10000
1 1000000000
*/

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

int main() {
  int n;
  cin >> n;
  vector<int> ls(n), rs(n);
  rep(i, n) cin >> ls[i] >> rs[i];
  sort(ls.begin(), ls.end());
  sort(rs.begin(), rs.end());
  int ans = 0;
  if (n%2 == 1) {
    int l = ls[n/2];
    int r = rs[n/2];
    ans = r-l+1;
  }
  else {
    int l2 = ls[n/2-1]+ls[n/2];
    int r2 = rs[n/2-1]+rs[n/2];
    ans = r2-l2+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4800
//Keep patience , The Time Will Come
#include"bits/stdc++.h"
using namespace std;

#define nl "\n"
#define sp " "
#define int long long

int32_t main()
{
	int n;
	cin>>n;
	string ans;
	while(n)
	{
		n--;
		ans+='a'+n%26;
		n/=26;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<nl;
	return 0;
}


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

int f(int H, int W) {
  int a1, a2, a3, ret1, ret2;
  a1 = H / 3 * W;
  a2 = (H - H / 3) * (W / 2);
  a3 = (H - H / 3) * (W - W / 2);
  ret1 = max({a1, a2, a3}) - min({a1, a2, a3});
  a1 = (H / 3 + 1) * W;
  a2 = (H - (H / 3 + 1)) * (W / 2);
  a3 = (H - (H / 3 + 1)) * (W - W / 2);
  ret2 = max({a1, a2, a3}) - min({a1, a2, a3});
  return min(ret1, ret2);
}

int main() {
  int H, W;
  cin >> H >> W;
  if (H % 3 == 0 || W % 3 == 0) {
    cout << 0 << endl;
  } else {
    cout << min({H, W, f(H, W), f(W, H)}) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	long long n,m,a[10000],b[10000];

	int co = 0;

	cin >> n;

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

	cin >> m;

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

	if (n >= m)
	{
		for (int j = 0; j < m; j++)
		{
			for (int i = 0; i < n; i++)
			{
				if (a[i] == b[j])
				{
					co += 1;

					a[i] = -1;
					break;
				}
			}
		}
	}
	else
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				co += 1;

				b[j] = -1;
				break;
			}
		}
	}

	cout << co << endl;
}


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

int main(){
    double a, b, x;
    cin >> a >> b >> x;
    double s = x / a;
    double rad;
    if(s >= a*b / 2){
		double h = (a*b-s) *2/a;
		rad = atan2(h, a);
	}
	else{
		double w = s*2/b;
		rad = atan2(b, w);
	}
	double PI = acos(-1);
	double deg = rad/(2 * PI) * 360;
	cout << setprecision(10) << fixed << deg << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
#define MOD 1e9 + 7
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
	IOS
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	if(a[(n/2)-1]==a[n/2])
	{
		return cout<<"0",0;
	}
	cout<<a[(n/2)]-a[(n/2)-1];
}

Measured memory_bytes: 1024
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)	
using namespace std;

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int a, b, c;
	cin >> a >> b >> c;

	int sum = 0;
	bool can = false;
	rep(i, 10000) {
		sum += a;
		if (sum % b == c) {
			can = true;
			break;
		}
	}
	if (can) cout << "YES" << endl;
	else cout << "NO" << endl;
} 

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

vector<vector<ll>> a(200010);
ll c[200010];
bool ch[200010];
void dep(ll now,ll nowc){
	c[now]=nowc;
	if(a[now].size()==0){
		return;
	}
	for(int i=0;i<a[now].size();i++){
		ll next=a[now][i];
		dep(next,nowc+c[next]);
	}
}
int main() {
	ll n,q;
	cin>>n>>q;
	for(int i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		a[x].push_back(y);
	}
	for(int i=0;i<q;i++){
		ll x,y;
		cin>>x>>y;
		x--;
		c[x]+=y;
	}
	dep(0,c[0]);
	for(int i=0;i<n;i++){
		cout <<c[i]<< " ";
	}
	return 0;
}


Measured memory_bytes: 21120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int week = Integer.parseInt(br.readLine());
		
		int debt = 100000;
		for(int i = 0; i < week; i++){
			debt *= 1.05;
			if(debt % 1000 > 0){
				debt = (debt/1000)*1000+1000;
			}
		}
		System.out.println(debt);
	}

}

Measured memory_bytes: 23964
#include<iostream>
#include<stdio.h>
using namespace std;
int m, n, s[100005], t[50005];
int binary_search(int key){
    int left = 0, right = m, mid;
    while (left < right)
    {
        mid = (right + left) / 2;
        if(s[mid] == key)return true;
        if(s[mid] < key)left = mid + 1;
        else right = mid;
    }
    return false;
}
int main(){
    cin >> m;
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &s[i]); 
    }
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &t[i]);
    }
    int ans = 0;
    
    for (int i = 0; i < n; i++)
    {
        ans += binary_search(t[i]);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3720
//c++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
#include <fstream>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define revrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define sz(x) ((int)(x).size())

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const int INF = 1 << 30;//10^9
const ll MOD = 1000000007;
//const ll MOD = 998244353;
double EPS = 1e-10;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A){printf("%.12lf\n", A);}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

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


//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 200010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}

ll disit(ll s, ll base = 10){
  ll res = 0;
  while(s){
    res++;
    s /= base;
  }
  return res;
}

//約数の列挙O(√n)
vector<ll> divisor(ll n){
    vector<ll> res(0);
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n/i) res.push_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}


void solve(){
  string S;
  cin >> S;
  ll N = S.size();
  if(N % 2){
    cout << "No" << endl;
    return;
  }
  bool ok = 1;
  rep(i, N){
    if(i % 2 && S[i] != 'i') ok = 0;
    if(i % 2 == 0 && S[i] != 'h') ok = 0;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<cmath>
#define pub push_back
#define llint long long int
#define mp make_pair
#define fi first
#define se second
const llint big=((llint)1<<30)<<(llint)30;
using namespace std;
int main(void){
    llint n,m,i,j,k,ans,now,q,w,e;
    llint score[1001]={0};
    vector<pair<llint,llint>> hen[1001];
    scanf("%lld %lld",&n,&m);
    for(i=2;i<=n;i++){
        score[i]=-big;
    }
    score[1]=0;
    for(i=0;i<m;i++){
        scanf("%lld %lld %lld",&q,&w,&e);
        hen[q].pub(mp(w,e));
    }
    for(i=0;i<1010;i++){
        for(j=1;j<=n;j++){
            now=score[j];
            for(k=0;k<hen[j].size();k++){
                score[hen[j][k].fi]=max(score[hen[j][k].fi],now+hen[j][k].se);
            }
        }
    }
    ans=score[n];
    for(i=0;i<1010;i++){
        for(j=1;j<=n;j++){
            now=score[j];
            for(k=0;k<hen[j].size();k++){
                score[hen[j][k].fi]=max(score[hen[j][k].fi],now+hen[j][k].se);
            }
        }
    }
    if(ans<score[n]){cout<<"inf"<<endl;}
    else{cout<<score[n]<<endl;}
    return 0;
}

Measured memory_bytes: 384
use proconio::input;


fn main() {
  input! {
    n: usize,
    mut vals: [usize;n],
  }
  	
  let mut base = 0;
  for i in 0..n {
    base ^= vals[i];
  }
  
  for i in 0..n {
    vals[i] ^= base;
  }
  
  println!("{}", vals
    .into_iter()
    .map(|v| v.to_string())
    .collect::<Vec<String>>()
    .join(" ")
  );
}

Measured memory_bytes: 17844