akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<cassert>
#include<stack>
#include<fstream>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define mod 998244353
#define mad(a,b) a=(a+b)%mod;
vector<P> robo;
int n;
int to[200010],dp[200010];
int main(){
	cin>>n;
	rep(i,n){
		ll x,d;
		cin>>x>>d;
		robo.push_back(make_pair(x,d));
	}	
	sort(all(robo));
	vector<ll> S;//後ろから見たときの、より手前にあってより後ろにto[i]がある頂点のid
	for(int i=n-1;i>=0;i--){
		ll key=robo[i].first+robo[i].second;
		ll l=i,r=n,mid;
		while(l<r-1){
			mid=(l+r)>>1;
			if(robo[mid].first<key)l=mid;
			else r=mid;
		}
		to[i]=r-1;
		if(i<to[i]){
			//Sのindexが大きくなるほど値が小さい
			ll L=-1,R=S.size(),mid;
			while(L<R-1){
				mid=(L+R)>>1;
				if(S[mid]<=to[i])R=mid;
				else L=mid;
			}
			to[i]=to[S[R]];
		}
		while(S.size()>0&&to[S.back()]<to[i])S.pop_back();
		S.push_back(i);
		//cerr<<i<<" "<<to[i]<<endl;
	}
	vector<P> v;//{区間の長さ、左端の頂点のid
	rep(i,n){
		to[i]++;
		v.push_back(make_pair(to[i]-i,i));
	}
	sort(all(v));
	for(auto e:v){
		ll i=e.second;
		//cerr<<e.second<<" "<<e.first<<endl;
		if(e.first==1)dp[i]=2;
		else{
			ll rui=1;
			for(ll x=i+1;x<to[i];x=to[x]){
				rui=rui*dp[x]%mod;
			}
			rui=(rui+1)%mod;
			dp[i]=rui;
		}
	}
	ll ans=1;
	for(ll x=0;x<n;x=to[x]){
		ans=ans*dp[x]%mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 15596
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[]w = new int[n];
 
    int all = 0;
    for(int i=0; i<n; i++){
        w[i] = sc.nextInt();
        all += w[i];
    }
    int mae = 0;
    int cou = 0;
    for(int i=0; i<n; i++) {
    	if(mae*2 < all) {
    		mae += w[i];
    		cou++;
    	}
    }
    int A = all-mae-mae;
    A = Math.abs(A);
    int B = all-(mae-w[cou-1])-(mae-w[cou-1]);
    B = Math.abs(B);
    
    System.out.println(Math.min(A, B));
    }
}


Measured memory_bytes: 35792
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
 
int n;
int chain[10002];
 
int ccount(int a, int b, int cnt){
    if (chain[a] != chain[b])return cnt;
    int len = 0;
    int i, j;
    for (i = a; i >= 0 && chain[a] == chain[i]; i--, len++);
    for (j = b; j < n&&chain[b] == chain[j]; j++, len++);
    if (len < 4)return cnt;
    if (i == -1 || j == n)return cnt + len;
    return ccount(i, j, cnt + len);
}
 
int main(){
    while (true){
        scanf("%d", &n);
        if (!n)return 0;
        int ans = 0;
        for (int i = 0; i < n; i++)scanf("%d", &chain[i]);
        for (int i = 0; i < n; i++){
            char def = chain[i];
            for (int j = 1; j <= 3; j++){
                chain[i] = j;
                int s, g, cnt = 1;
                for (s = i - 1; s >= 0 && chain[s] == chain[i]; s--, cnt++);
                for (g = i + 1; g < n&&chain[g] == chain[i]; g++, cnt++);
                if (cnt >= 4){
                    if (s == -1 || g == n)ans = max(cnt, ans);
                    else ans = max(ccount(s, g, cnt), ans);
                }
            }
            chain[i] = def;
        }
        printf("%d\n", n - ans);
    }
}

Measured memory_bytes: 2600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int sum=0;
		int ten=N;
		
		while(ten>0) {
			sum+=ten %10;
			ten/=10;
		}
		System.out.println(N%sum==0 ? "Yes":"No");
		
	}
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


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

    int t=1,te=0;
    // cin>>t;
    while(t--){
        int d,n;
        cin>>d>>n;
        int res=1,c=0;

        for(int i=0;i<(d*2);++i){
            res*=10;
        }

        if(n==100){
            res=(n+1)*res;
        }
        else{
            res=n*res;
        }

        printf("%d\n",res);
      // main();

        //printf("Case %d: ",++te);
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().execute();
	}
	
	private void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int T = sc.nextInt();
		int mincost = 1001;
		for (int i=0; i<N; i++) {
			int cost = sc.nextInt();
			int time = sc.nextInt();
			if (time <=T) {
				mincost = Math.min(mincost, cost);
			}
		}
		if (mincost == 1001) {
			System.out.println("TLE");
		}
		else {
			System.out.println(mincost);
		}
		
	}
	
}

Measured memory_bytes: 22996
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

bool isPrime(int x) {
    for (int i = 2; i*i <= x; i++) {
        if (x % i == 0)
            return false;
    }
    return true;
}



int main() {
    int q;
    cin >> q;
    vector<int> dp(1000001, 0);
    dp[0] = 0;
    dp[1] = 0;

    for (int i = 2; i <= 100000; i++) {
        dp[i] = dp[i - 1];
        if (i % 2 == 0)
            continue;
        else {
            if (isPrime(i) && isPrime((i + 1) / 2))
                dp[i]++;
        }
    }



    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        cout << dp[r] - dp[l - 1] << endl;
    }
    return 0;
}

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  string S;
  cin >> S;
  int cnt = 0;
  for(int i = 0; i < 3; i++) {
    if(S[i] == 'R'){
      cnt++;
    }
  }
  if(S[1] == 'R'){
    cout << cnt <<endl;
  } else{
    if(cnt >= 1){
      cout << 1 <<endl;
    } else{
      cout << 0 <<endl;
    }
  }
}

Measured memory_bytes: 3584
import java.util.Scanner;

/**
 * @author: Happy
 * @date:2020年8月2日 下午8:23:01
 */
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int d=in.nextInt();
		int sum=0;
		for (int i = 0; i < n; i++) {
			long x=in.nextInt();
			long y=in.nextInt();
			double dis=Math.sqrt(x*x+y*y);
			if(dis<=d){
				sum++;
			}
		}
		System.out.println(sum);
	}

}

Measured memory_bytes: 59208
#include <iostream>

using namespace std;

int main() {
    string s;cin>>s;
    long long int k;cin>>k;
    int l=s.length(),a[l]={0},m=0;
    if (l==1) {
        cout<<k/2<<endl;
    }
    else {
    for (int i=1;i<l;i++) {
        if (s[i]==s[i-1]) {
            a[m]++;
        }
        else {
            m++;
        }
    }
   // for (int i=0;i<=m;i++) cout<<a[i]<<" ";
    //cout<<endl;
    if (m==0) {
        cout<<(k*l)/2<<endl;
    } 
    else {
        long int sum=0,p=0,x,y;
            for (int i=0;i<=m;i++) sum+=(a[i]+1)/2;
        if (s[0]==s[l-1]) {
            x=a[0]+1;y=a[m]+1;
            p=(sum*k)-(k-1)*(x/2 + y/2 -(x+y)/2); 
            cout<<p<<endl;
        }
        else cout<<(sum*k)<<endl;
    }
    }
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = 0;
		for (char c : sc.nextLine().toCharArray()) {
			if (c == '+') {
				num++;
			} 
			if (c == '-') {
				num--;
			} 
		}
		System.out.println(num);
	}
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt() - 1;
		System.out.println((b / (a - 1) + (b % (a - 1) > 0 ? 1 : 0)));
	}
}


Measured memory_bytes: 24148
# ABC084D - 2017-like Number
from bisect import bisect_left as bsl, bisect_right as bsr


def get_primes(n: int) -> list:
    # return a list of primes <= n
    sieve = [1] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def main():
    Q, *LR = map(int, open(0).read().split())
    P = get_primes(10 ** 5 + 1)
    S = set(P)
    sel = [p for p in P if (p + 1) // 2 in S]  # 2017-like primes (selected P)
    # the number of 2017-like primes b/w l, r -> bisect[r] - bisect[l]
    ans = [bsr(sel, r) - bsl(sel, l) for l, r in zip(*[iter(LR)] * 2)]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

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

#define int long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pair<int,int> >
#define f first
#define s second
#define all(x) x.begin() , x.end()
#define mii map<int,int>
#define mod 1000000007
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define mk(arr,n,type) type *arr=new type[n]
#define w(x) int x;cin>>x;while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x
#define FOR(i,a,n) for(int i = a;i<n;i++)
#define FORD(i,a,n) for(int i = a;i<=n;i++)
#define FORR(i,n,a) for(int i = n;i>=a;i--)
#define endl "\n"



int dp[100009] = {0};

int solve(int *arr,int n,int i) {
    if(i == 0) {
        return dp[i] = 0;
    }
    if(i == 1) {
        return dp[i] = abs(arr[0]-arr[1]);
    }
    
    if(dp[i] != -1) {
        return dp[i];
    }
    
    int opt1 = solve(arr,n,i-1);
    int opt2 = solve(arr,n,i-2);
    return dp[i] = min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);
}



int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // w(x) {
        int n;
        cin >>n;
        int *arr = new int[n+1];
        FOR(i,0,n) {
            cin >>arr[i];
        }
        memset(dp,-1,sizeof dp);
        cout<<solve(arr,n,n-1)<<endl;
        
    // }
}

Measured memory_bytes: 11304
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline
from collections import deque

def main():
    K = int(input())
    q = deque([])               #キュー
    for i in range(1,10):
        q.append(i) #初期値一桁のlunlun 1-9を登録
    ret = []
    while len(ret)<K:
        p = q.popleft()         #キュー取りだし（先頭）
        ret.append(p)
        pl = p%10
        if pl >= 1:
            q.append(p*10 + pl-1)
        q.append(p*10 + pl)
        if pl <= 8:
            q.append(p*10 + pl+1)
    print(ret[-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 16036
#include<bits/stdc++.h>
using namespace std;
int main() {int A,B,C;
cin>>A>>B>>C;
B=abs(A-B);
C=abs(A-C);
if(B+C==0){cout<<A%2-1<<endl;return 0;}
int ans=0;
for(;;){if(B%2+C%2>0)break;ans++;B/=2;C/=2;}cout<<ans<<endl;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, k;
    cin >> a >> b >> k;
    if(a >= k) cout << a-k << " " << b << endl;
    else if(a + b >= k) cout << 0 << " " <<b-(k-a) << endl;
    else cout << 0 << " " << 0 << endl;

}

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

int main()
{
    int A, B, ct;
    string n;
    int ans = 0;
    cin >> A >> B;
    for (int i = A; i < B+1; ++i)
    {
        ct = 0;
        n = to_string(i);
        for (int i = 0; i < 2; ++i) if (n[i] == n[4-i]) ct ++;
        if (ct == 2) ans++;
    }
    cout << ans << endl;
}


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

int main(){
	int n,m;
	cin>>n>>m;
	if(n>0 and n<10){
		if(m>0 and m<10){
			cout<<n*m;
		}
		else{
			cout<<"-1";
		}
	}
	else{
		cout<<"-1";
	}
	cout<<endl;
}

Measured memory_bytes: 256
//  amiD
#include <bits/stdc++.h>
#define ld long double
#define ll long long int
#define mod 1000000007
#define ll_inf 1000000000000000
#define int_inf 1000000000
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define eps 1e-9
#define PI acos(-1.0)
#define ii pair<int,int>
#define se second
#define fi first
using namespace std;
char a[55][55];
int main(){
    int n, m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]=='#'){
                if(a[i+1][j]=='#' || a[i-1][j]=='#' || a[i][j+1]=='#' || a[i][j-1]=='#')continue;
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N, K = MI()
    if K == 1:
        print(0)
    else:
        print(N-K)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3828
n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))
#print(l)
d = dict()
cnt = 0
for e in l:
  #print("e=",e)
  if e in d:
    #print(e,"in",d)
    d[e] += 1
    cnt += d[e]
    #print('d[',e,']=',d[e],'cnt=',cnt)
  else:
    #print(e,'not in',d)
    d[e] = 0
    #print('d[',e,']=',d[e],'cnt=',cnt)
print(cnt)
#print(d)

Measured memory_bytes: 19504
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
bool pairCompare(const pair<long long int,long long int>& firstElof, const pair<long long int,long long int>& secondElof)
{
    return firstElof.second > secondElof.second;
}

int main() {
int N,K;
long long int ans=4999999996000000001;
scanf("%d %d",&N,&K);
  vector<pair<long long int, long long int> > pairs(N);
  
  for (int i = 0; i < N; i++) {
    long long int po1,po2;
    scanf("%lld %lld",&po1,&po2);
    pairs[i] = make_pair(po1,po2);
  }

  // firstが小さい順、secondが小さい順にソート
  sort(pairs.begin(), pairs.end());
  for(int i=0;i<N;i++)for(int j=i+K;j<=N;j++){
        vector<pair<int, int> > unko(j-i);
        for(int k=0;k<j-i;k++)unko[k]=pairs[i+k];
            sort(unko.begin(), unko.end(), pairCompare);
            for(int l=0;l+K<=j-i;l++){
                if(ans>((pairs[j-1].first-pairs[i].first)*(unko[l].second-unko[l+K-1].second))){ans=((pairs[j-1].first-pairs[i].first)*(unko[l].second-unko[l+K-1].second));}
            }
  }
  printf("%lld",ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <set>
#include <map>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INF64 = 3e18;
const unsigned long long HASHBASE=1222827239ull;
const long long MODNUM=1000000007ll;
/////////////////////////
int a[100010];
/////////////////////////
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    int n,sum;
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
    }
    sum=a[1];
    for(int i=2;i<=n;++i)
    {
        sum=sum^a[i];
    }
    if(sum==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<algorithm>
#define M 10000000007
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define L long long
#define endl '\n'
using namespace std;

int main(){
    string S,T;
    cin>>S>>T;
    int x=S.size();
    int y=T.size();
    int res=y;
    for(int i=0;i<x-y+1;i++){
        int temp=0;
        for(int j=0;j<y;j++){
            if(S[j+i]!=T[j]){
                temp++;
            }
        }
        res=min(res,temp);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long n, k;
long long a[200020];
bool check(long long x) {
	long long co = 0;
	for (int i = 0; i < n; i++) {
		co += (a[i] + x - 1) / x - 1;
	}
	if (co <= k) {
		return true;
	}
	else {
		return false;
	}
}
int main() {
	cin >> n >> k;
	long long m = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (m < a[i]) {
			m = a[i];
		}
	}
	long long ok = m, ng = 0;
	while (ok - ng > 1) {
		long long mid = (ok + ng) / 2;
		if (check(mid)) {
			ok = mid;
		}
		else {
			ng = mid;
		}
	}
	cout << ok << endl;
	return 0;
}


Measured memory_bytes: 5188
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
    int h,w;
    cin>>h>>w;
    string s[30][30];
    rep(i,h)rep(j,w)cin>>s[i][j];
    
    
    rep(i,h)rep(j,w)if(s[i][j]=="snuke"){
        cout<<(char)('A'+j)<<i+1<<endl;
        break;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
    int m;
    cin>>m;
    long long int sum=0;
    for(int i=1;i<=m;i++)
    {
        if(i%15!=0&&i%3!=0&&i%5!=0)
        {
            sum=sum+i;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3628
x = int(input())
def check(i):
    a = 1
    while True:
        b = a - i
        temp = pow(a, 5) - pow(b, 5)
        #if i == 17:print(temp, a, b)
        if temp == x:
            return (a, b)
        if b > 0 and temp > x:
            return -1
        a += 1

num = int(pow(x, 0.5)//1)
for i in range(1, num + 1):

    if x % i == 0:
        temp = check(i)
        if temp == -1:continue
        else:
            print(*temp)
            exit()

Measured memory_bytes: 62608
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    int k; cin >> k;
    string s; cin >> s;
    if(s.size() <= k){
        cout << s << endl;
        return 0;
    }
    string ans = "";
    rep(i, k){
        ans += s[i];
    }
    string u = "...";
    ans += u;
    cout << ans << endl;

    system("pause");
}


Measured memory_bytes: 3644
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let print_int n = Printf.printf "%d\n" n
let scan_array len read_func = Array.init len (fun _ -> read_func())

let modulo = 1000000007
let fmod f a b = (f a b) mod modulo

let calc_inversion array len =
  let count = ref 0 in
  let _ =
    for i = 0 to len-2 do
      for j = i+1 to len-1 do
        if array.(i) > array.(j) then count := !count+1
      done
    done in
  !count

let () = 
  let n = scan_int() and k = scan_int() in
  let a = scan_array n scan_int in
  let inv_of_a = calc_inversion a n in
  let aa = Array.append a a in
  let inv_of_aa = calc_inversion aa (n*2) in
  let c = fmod (-) inv_of_aa (inv_of_a * 2) in
  let ans = fmod (+) (fmod ( * ) inv_of_a k) (fmod ( * ) c (k * (k-1) / 2 mod modulo)) in 
  print_int ans

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

int main(){
    int n,l;
    cin >> n >> l;
    vector<string> S(n);
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }
    
    sort(S.begin(), S.end());
    string s;
    for(string x : S){
        s += x;
    }
    cout << s << endl;
}

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

using namespace std; 


int main(){
	
	int n;
	
	vector<int> container(11);
	
	cin >> n; 
	
	int big = -1;
	
	int sum = 0;
	
	for(int i=0;i<n;i++){
		cin >> container[i];
		big = max(big,container[i]);
		sum += container[i];
	}
	
	if(sum-big*2 > 0 ){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	
	
    return 0;
}


Measured memory_bytes: 256
/* long long or int */
/* inline & usighed & sighned main */
/* xx 396*/

#include<bits/stdc++.h>
using namespace std;

const int MAX_N=1e5+10;

vector <int> G[MAX_N];
queue <int> Q;
int dist[MAX_N],deg[MAX_N],N,M,ans=0;

signed main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>N>>M;
	for(int i=0;i<M;i++){
		int X,Y; cin>>X>>Y; X--; Y--;
		G[X].push_back(Y); deg[Y]++;
	}
	for(int i=0;i<N;i++) if(deg[i]==0) Q.push(i);
	while(!Q.empty()){
		int fr=Q.front(); ans=max(ans,dist[fr]); Q.pop();
		for(int i=0;i<G[fr].size();i++){
			int to=G[fr][i]; deg[to]--;
			dist[to]=max(dist[to],dist[fr]+1);
			if(deg[to]==0) Q.push(to);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){ 
  int N; cin >> N;
  vector<int> vec(N,0);
  
  map<string,int> mp;
  
  for(int i = 0; i < N; i++){ 
    string s;  int t; cin >> s >> t;
    mp[s] = i;
    
    vec[i] = t;
    
  }
  
  vector<int> sum(N,0);
  
  sum[N-1] = vec[N-1];
  
  for(int i = N-2; i >= 0 ; i--){
    
    sum[i] = sum[i+1]+vec[i];
    
  }
  
  string p; cin >> p;
  
  int c = mp[p];
  
  cout << sum[c]-vec[c] << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define min(a,b) (a<b)?a:b

int main(void) {
    int i, N, h[100010], dp[100010];
    scanf("%d", &N);
    for(i=1;i<=N;i++) {
        scanf("%d",&h[i]);
    }

    dp[1] = 0;
    dp[2] = abs(h[1]-h[2]);
    for(i=3;i<=N;i++) {
        dp[i] = min( dp[i-1] + abs(h[i-1]-h[i]) , dp[i-2] + abs(h[i-2]-h[i]) );
    }
    printf("%d\n", dp[N]);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int Nmax=200010;
 
int main() {
	int N,a[100],b[100],c[100],d[100];
	int Index1[200]={},Index2[200]={};
	for(int i=0;i < 200; i++){
		Index1[i] = -1;
		Index2[i] = -1;
	}
	cin >> N;
	for(int i=0;i < N;i++){
		cin >> a[i] >> b[i];
		Index1[a[i]]=b[i];
	}
	for(int i=0;i < N;i++){
		cin >> c[i] >> d[i];
		Index2[c[i]]=d[i];
	}
	int o,mac=-1,cnt=0;
	for(int i=0;i < 2*N;i++){
      mac=-1;
		if(Index2[i] != -1){
			for(int j=i-1;j >= 0;j--){
				if(Index1[j] != -1){
                  	if(Index2[i] > Index1[j]){
						mac = max(Index1[j],mac);
						if(mac == Index1[j]) o=j;
                    }
				}
			}
			if(o != -1){
              Index1[o] = -1;
				cnt++;
              o=-1;
            }
		}
		Index2[i] = -1;
	}
  	cout << cnt << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}


int main(){
    int n;cin >> n;
    string s;cin >> s;
    int ans = 0;
    for(int i=0;i<s.size()-2;i++){
        if(s.substr(i,3) == "ABC")ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
typedef long long int ll;
#define REP(i,n) for(int i=0;i<signed(n);i++)
using std::cout;
using std::vector;
using std::endl;
using std::cin;
using std::string;
using std::min;
using std::max;
const ll MOD = 1000000007;
const ll INF = 9e9;
ll N, M, ans = INF;
ll A[300010], S[301000];

using namespace std;
int main() {
	//fill(begin(A), end(A), 0);
	//fill(begin(S), end(S), 0);
	//N = M = 0;
	std::ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> A[i];
		S[i] += A[i];
		S[i + 1] = S[i];
	}
	//a:右半分の区切り i:真ん中 b:左半分
	//s:右の和 t:左の和
	ll a = 0, b = 2, s, t;
	REP(i, N - 1) {
		if (i == b)b++;
		s = (S[i] - S[a]) - S[a];
		t = (S[N - 1] - S[b]) - (S[b] - S[i]);
		bool f = true;
		if (i == 0)continue;
		while (f) {
			f = false;
			if (a + 1 == i)continue;
			if (abs(s)>abs(s - A[a + 1] * 2)) {
				s -= A[a + 1] * 2;
				a++; f = true;
			}
		}
		f = true;
		while (f) {
			f = false;
			if (b + 1 == N - 1 || b == N - 1)continue;
			if (abs(t)>abs(t - A[b + 1] * 2)) {
				t -= A[b + 1] * 2;
				b++; f = true;
			}
		}
		ans = min(ans, (max({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })
			- min({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3840
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll a[5];
	rep(i, 0, 5) 	cin >> a[i];
	ll sum = INT_MAX;
	ll h = 5, ans = 0;

	// do
	// {
	// 	cout << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl;
	// } while (next_permutation(a, a + 5));

	do
	{
		ll s1 = a[0] + (10 - ((a[0] % 10) == 0 ? 10 : a[0] % 10));
		ll s2 = s1 + a[1];
		s2 = s2 + (10 - ((s2 % 10) == 0 ? 10 : s2 % 10));
		ll s3 = s2 + a[2];
		s3 = s3 + (10 - ((s3 % 10) == 0 ? 10 : s3 % 10));
		ll s4 = s3 + a[3];
		s4 = s4 + (10 - ((s4 % 10) == 0 ? 10 : s4 % 10));
		ll s5 = s4 + a[4];
		// s5 = s5 + (10 - ((s5 % 10) == 0 ? 10 : s5 % 10));
		// deba(s5);
		if (s5 < sum)
			sum = s5;
	} while (next_permutation(a, a + 5));
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
signed main()
{
	long long a, ans = 0, s, t, u;
	string b;
	cin >> a >> b;
	s = a * (b[0] - '0');
	t = a * (b[2] - '0');
	u = a * (b[3] - '0');
	ans = s + (t / 10) + (u / 100) + (t % 10 * 10 + u % 100) / 100;
	cout << ans << "\n";
}


Measured memory_bytes: 3604
/*input
5
2 7 1 8 2
3 1 4 1 5
*/
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define per(i,a,b) for(int (i) = (n-1); (i) >= (a); --(i))
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(), (v).end()
#define sz(v) (int) (v).size()
#define fast() ios::sync_with_stdio(0);cin.tie(0);
 
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
 
const int inf = 0x3f3f3f3f;
const int neginf = 0xc0c0c0c0;
const int mod = 1000000007;
 
// 0 -> eq, 1 ( a > b), -1 ( a < b)
bool cmp(const double& a, const double& b, const double TOL = 1e-9){
	return (a + TOL > b)? (b + TOL > a)? 0 : 1 : -1;
}
 
ll powmod(ll a, ll b){
	ll res = 1;
	a %= mod;
	assert(b >= 0);
	for(;b;b>>=1){
		if(b&1) res = (res*a)%mod;
		a = (a*a)%mod;
	} 
	return res;
}

const int ms = 1e4 + 13;

ll a[ms], b[ms];
int main(){
	int n;
	scanf("%d", &n);
	rep(i,0,n) scanf("%lld", a + i);
	rep(i,0,n) scanf("%lld", b + i);
	ll xablau = 0;
	ll credito = 0;
	rep(i,0,n){
		if(a[i] > b[i]){
			credito -= (a[i] - b[i]);
		}
		else{
			credito += (b[i] - a[i]) >> 1;
		}
	}
	if(credito >= 0) puts("Yes");
	else puts("No");	
}

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

#define LL long long

LL n,bil,a,b,tot=0,freq[100100],q;
int main() {
	cin>>n;
    for(int i=1;i<=n;i++){
        cin>>bil;
        freq[bil]++;
        tot+=bil;
    }
    cin>>q;
    while(q--){
        cin>>a>>b;
        tot+=(b-a)*freq[a];
        freq[b]+=freq[a];
        freq[a]=0;
        cout<<tot<<endl;
    }
}

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

namespace CSharpSample01
{
	class Program
	{

		static void Main(string[] args)
		{
			var valueList = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			var X = valueList[0];
			var N = valueList[1];

			var flag = true;
			var count = 1;
			var answer = 0;

			if(N == 0)
			{
				answer = X;
			}
			else
			{
				var numDic = Console.ReadLine().Split(' ').Select(int.Parse).ToDictionary<int, int>(x => x);

				if (!numDic.ContainsKey(X))
				{
					answer = X;
					flag = false;
				}

				while (flag)
				{
					//					if (X - count > 0 && !numDic.ContainsKey(X - count))
					if (!numDic.ContainsKey(X - count))
					{
						answer = X - count;
						flag = false;
					}
					else if (!numDic.ContainsKey(X + count))
					{
						answer = X + count;
						flag = false;
					}
					count++;

					if (count > 100)
					{
						answer = 0;
						flag = false;
					}
				}
			}


			Console.WriteLine(answer);
		}
	}
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl

int32_t main() {

    int r, g, b, n; cin >> r >> g >> b >> n;

    int ans = 0;
    for(int rr = 0; rr <= n/r; ++rr) {
        for(int gg = 0; rr*r + gg*g <= n; ++gg) {
            int cur = rr*r + gg*g;
            if((n-cur)%b == 0) ++ans;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  int a = 0;
  for (int i = 0; i < 3; i++){
    if (s.at(i) == '1'){
      a += 1;
    }
  }
  cout << a <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 10000
int main(void){
    int n, mmin, min, ans, sum;
    ans = 0;
    std::cin >> n;
    std::vector<int> A(n), B(n);
    for(int i = 0; i < n; i++){
        std::cin >> A[i];
    }

    B = A;
    std::sort(B.begin(), B.end());

    std::vector<bool> flag(n, false);
    std::vector<int> order(MAX + 1);

    
    for(int i = 0; i < n; i++){
        order[B[i]] = i;
    }
    mmin = B[0];
    for(int i = 0; i < n; i++){
        if(B[i] == A[i]) continue;
        int cur = i;
        int a = 0;
        sum = 0;

        
        if(flag[cur] == true){
            continue;
        }

        min = 1001001001;
        while(true){
            a++;
            flag[cur] = true;
            int v = A[cur];
            min = std::min(min, v);
            sum += v;

            
            cur = order[v];
            if(flag[cur] == true){
                break;
            }
        }

        
        ans += std::min(sum + (a - 2) * min, sum + min + (a + 1) * mmin);
        
    }

    std::cout << ans << std::endl;
    
}


Measured memory_bytes: 3212
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

int n;
string a, b;

int main() { 

  scanf("%d\n", &n);
  cin >> a >> b;

  string s = "";

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

  cout << s << endl;

  return 0;
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N;
	set<llong> d;

	cin >> N;
	llong in;
	for(int i = 0; i < N; i++){
		cin >> in;
		d.insert(in);
	}

	cout << d.size() << endl;

	return 0;
}

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

int main() {
   int N,T,A;
   cin >> N >> T >> A;
   A *= 1000;
   vector<int> vec(N);
   for(int i = 0; i < N; i++){
       cin >> vec.at(i);
   }
   
   for(int i = 0; i < N; i++){
       vec.at(i) = 1000 * T - vec.at(i) * 6;
   }
   
   for(int i = 0; i < N; i++){
       if(vec.at(i) >= A){
           vec.at(i) = vec.at(i) - A;
       }
       else{
           vec.at(i) = A - vec.at(i);
       }
   }
   
   int ans;
   int res = 1000000;
   for(int i = 0; i < N; i++){
       if(res > vec.at(i)){
           res = vec.at(i);
           ans = i;
       }
   }
   cout << ans+1 << endl;
}

Measured memory_bytes: 256
a = int(input())

if 400 <= a and a <= 599:
    print(8)
elif 600 <= a and a <= 799:
    print(7)

elif 800 <=  a and a <= 999:
    print(6)
elif 1000 <= a and a <= 1199:
    print(5)

elif 1200 <= a and a <= 1399:
    print(4)
elif 1400 <= a and a <= 1599:
    print(3)
elif 1600 <= a and a <= 1799:
    print(2)

elif 1800 <= a and a <= 1999:
    print(1)

Measured memory_bytes: 9128
#include<stdio.h>
int main(){
	int x[10000],i,a;
	
	i=1;
	a=1;
	while(1)
	{
		scanf("%d",&x[i]);
		a=x[i];
			i++;
	 if(a==0)
		{
		i=1;
		break;
		
		}
	}
 while(1){
 	printf("Case %d: %d\n",i,x[i]);
			i++;
			 if(x[i]==0){
			  break;
			 }
 }
	return 0;
}

Measured memory_bytes: 2600
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll INF =1e9+7;
    typedef pair<ll,ll> ii;
    #define f(i,a,b) for(long long i = a;i < b;i++)
    #define rf(i,a,b) for(long long i=a;i>=b;i--)
    #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #define w(t) while(t--)
    #define c(n); cin>>n;
    #define p(n) cout<<n;
    #define pl(n) cout<<n<<endl;
    #define ps(n); cout<<n<<" ";
    int main(void){
        fastio;
        ll r;
        c(r);
        pl(r*r);
   }


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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1e18+1;

signed main() {
	int h, w;
	cin >> h >> w;
	string s[h];
	Rep(i, h) cin >> s[i];

	if ( h == 8 ) {
     	cout << "NO" << endl;
      	return 0;
    }
	
	vector<int> cnt[13];
	Rep(i, h) {
		vector<int> a(26);
		Rep(j, w) a[s[i][j]-'a']++;
		cnt[i] = a;
	}
	
	int used[13] = {0};
	int c = 0;
	Rep(i, h) {
		if ( used[i] ) continue;
		Rep(j, h) {
			if ( used[j] || i == j ) continue;
			if ( cnt[i] == cnt[j] ) {
				used[i] = used[j] = 1;
				c += 2;
				break;
			}
		}
	}
	//cout << c << endl;
	
	if ( h - c > 1 ) {		
		cout << "NO" << endl;
		return 0;
	}

	
	Rep(i, w) {
		vector<int> a(26);
		used[i] = 0;
		cnt[i].clear();
		Rep(j, h) a[s[j][i]-'a']++;
		cnt[i] = a;
	}
	c = 0;
	Rep(i, w) {
		if ( used[i] ) continue;
		Rep(j, w) {
			if ( used[j] || i == j ) continue;
			if ( cnt[i] == cnt[j] ) {
				used[i] = used[j] = 1;
				c += 2;
				break;
			}
		}
	}
	if ( w - c > 1 ) {		
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

bool isprime(int n) {
	for (int i = 2; i < n; i++) {
		if (n % i == 0) return false;
	}
	return true;

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

	int n;
	cin >> n;

	while (!isprime(n)) n++;
	cout << n << "\n";

	return 0;
}



Measured memory_bytes: 888
#include <stdio.h>
#include <string.h>
int main(void)
{
	char o[51],e[51];
	int a,i;
	scanf("%s%s",o,e);
	a=strlen(o);
	if(strlen(o)==strlen(e)){
		for(i=0; i<a; i++){
			printf("%c%c",o[i],e[i]);
		}
		printf("\n");
	}else{
		for(i=0; i<a-1; i++){
			printf("%c%c",o[i],e[i]);
		}
		printf("%c\n",o[a-1]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n, a;

    cin >> n;

    multiset<int> t;

    cin >> a;
    t.insert(a);

    for (int i = 1; i < n; i++)
    {
        cin >> a;

        if (*t.begin() >= a)
        {
            t.insert(a);
        }
        else
        {
            auto e = t.lower_bound(a);
            e--;
            t.erase(e);
            t.insert(a);
        }
    }

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

Measured memory_bytes: 4992
#!/usr/bin/env python3
import sys
from math import sqrt

def solve(N: int, X: int):
    # 平行四辺形の面積
    answer = N
    a,b = max(N-X,X),min(N-X,X)
    while True:
        answer += 2*(a//b)*b
        if a%b == 0:
            answer -= b
            break
        a,b = b,a%b

    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(N, X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

//引用元
//http://drken1215.hatenablog.com/entry/2019/03/03/224600
//union くっつける
//find  どのグループか調べる
struct UnionFind {
    vector<LL> parent;
    
    UnionFind(LL n) : parent(n, -1) { }
    void init(LL n) { parent.assign(n, -1); }
    
    //xの属している木の根っこを返す
    LL root(LL x) {
        if (parent[x] < 0) return x;
        else return parent[x] = root(parent[x]);//経路圧縮
    }
    
    LL size(LL x) {return -parent[root(x)];}//xの属する木の要素数を求める
    bool is_same_tree(LL x,LL y) {return root(x)==root(y);}
    
    bool merge(LL x,LL y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (parent[x] > parent[y]) swap(x, y);//xの親の方がyの親より小さくなるようにする
        parent[x] += parent[y];//経路の長さを加算
        parent[y] = x;//yの親をxとする
        return true;
    }
};

LL N;
vector<tuple<LL,LL,LL>> xy;
vector<tuple<LL,LL,LL>> yx;

LL ans = 0;

void solve(){
	sort(xy.begin(),xy.end());
	sort(yx.begin(),yx.end());
	
	priority_queue<tuple<LL,LL,LL>,vector<tuple<LL,LL,LL>>,greater<tuple<LL,LL,LL>>> pq;
	for(int i=0;i<=N-2;i++){
		LL weight = min(abs(get<0>(xy[i]) - get<0>(xy[i+1])),
						abs(get<1>(xy[i]) - get<1>(xy[i+1])));
		LL p1 = get<2>(xy[i]);
		LL p2 = get<2>(xy[i+1]);
		pq.push(tuple<LL,LL,LL>(weight,p1,p2));
	}
	for(int i=0;i<=N-2;i++){
		LL weight = min(abs(get<0>(yx[i]) - get<0>(yx[i+1])),
						abs(get<1>(yx[i]) - get<1>(yx[i+1])));
		LL p1 = get<2>(yx[i]);
		LL p2 = get<2>(yx[i+1]);
		pq.push(tuple<LL,LL,LL>(weight,p1,p2));
	}

	UnionFind uf(N);
	while(!pq.empty()){
		LL weight = get<0>(pq.top());
		LL p1 = get<1>(pq.top());
		LL p2 = get<2>(pq.top());
		pq.pop();
		if(uf.is_same_tree(p1,p2)) continue;
		uf.merge(p1,p2);
		ans += weight;
	}
}

int main(){
    cin >> N;
    for(int i=0;i<N;i++){
    	LL x,y;cin >> x >> y;
    	xy.push_back(tuple<LL,LL,LL>(x,y,i));
    	yx.push_back(tuple<LL,LL,LL>(y,x,i));
    }

    solve();

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

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

int main(){
    int k,a,b,number[1000];
    cin >> k >> a >> b;

    for(int i=0;i<b-a+1;i++){
        number[i]=a+i;
    }

    for(int i=0;i<b-a+1;i++){
        if(number[i] %k ==0){
            cout << "OK" <<endl;
            break;
        }
        else if(i==b-a){
            cout << "NG" <<endl;
        }
    }
}

Measured memory_bytes: 3624
'use strict'

function Main(input) {
  const N = Number(input.split('\n')[0]);
  const line = input.split('\n')[1].split(' ').map(x => Number(x));

  const max = Math.max.apply(null, line);
  const min = Math.min.apply(null, line);

  console.log(max - min);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 21064
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    for(int i = 0;i<10000;i++){
        cin>>H>>W;
     if(H == 0 && W == 0)
     {break;}
     for(int h = 0;h<H/2;h++){
         for(int w = 0;w<W/2;w++){
            cout<<"#"<<"."; 
            }
            if(W%2==1){cout<<"#";}
            cout<<endl;
         for(int o = 0;o<W/2;o++){
            cout<<"."<<"#"; 
            }
            if(W%2==1){cout<<".";}
            cout<<endl;
        }
     if(H%2==1){for(int p = 0;p<W/2;p++){
            cout<<"#"<<"."; 
            }
            if(W%2==1){cout<<"#";}
            cout<<endl;}
            cout<<endl;
    }
}


Measured memory_bytes: 3036
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,k;
	cin>>a>>b>>c>>d>>e>>k;
	if(b-a<=k&&c-a<=k&&d-a<=k&&e-a<=k&&c-b<=k&&d-b<=k&&e-b<=k&&d-c<=k&&e-c<=k&&e-d<=k){
		cout<<"Yay!"<<endl;
	}
	else
		cout<<":("<<endl;
}

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

int main()
{
	int n; std::cin >> n;
	
	int* A = new int[n];
	for (int i=0; i<n; i++) std::cin >> A[i];
	
	int q; std::cin >> q;
	for (int i=0; i<q; i++) {
		int k; std::cin >> k;
		if (std::binary_search(A, A+n, k)) std::cout << 1 << std::endl;
		else std::cout << 0 << std::endl;
	}
	
	delete[] A;
	
	return 0;
}



Measured memory_bytes: 3104