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

using namespace std;

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

	string s;
	cin >> s;

	string ans = (s[2] == s[3] and s[4] == s[5]?"Yes":"No");

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int m,s,g,p[200];
  while(cin>>m>>s>>g,m){
    int ans=-1,an;
    for(int i=0;i<m;i++)cin>>p[i];
    sort(p,p+m,greater<int>());
    for(int i=g;i>=s;i--)if(ans<p[i-1]-p[i])ans=p[i-1]-p[i],an=i;
    cout<<an<<endl;
  }
  return 0;
}

Measured memory_bytes: 3072
#include<stdio.h>
int main(void){
  int N;
  scanf("%d",&N);
  int H[N];
  for(int i = 0;i < N;i ++){
    scanf("%d",&H[i]);
  }
  int ans = 0;
  int highest = 0;
  for(int k = 0;k < N;k ++){
    if(highest <= H[k]){
      ans ++;
      highest = H[k];
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 128
from operator import itemgetter
n,m= map(int,input().split())
city = []
for i in range(m):
    city.append([int(i) for i in input().split()])
per = []
for i in range(n):
    per.append([])

for i,c in enumerate(city):
    per[c[0] - 1].append([i, c[1]])
per_id = 1
for p in per:
    per_id_str = str(per_id)
    while len(per_id_str) < 6:
        per_id_str = "0" + per_id_str
    sort = sorted(p,key = itemgetter(1))
    city_id = 1
    for s_city in sort:
        city_id_str = str(city_id)
        while len(city_id_str) < 6:
            city_id_str = "0" + city_id_str
        city[s_city[0]].append(per_id_str + city_id_str)
        city_id += 1
    per_id += 1
for i in range(m):
    print(city[i][2])

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

int a, b, n;

int main()
{
  while((cin >> n >> a >> b) && n){
    int res = n;
    bool* ok = new bool[n + 1];
    rep(i, n + 1) ok[i] = false;

    rep(i, n / a + 1) ok[i * a] = true;
    //rep(i, n / a + 1) if(ok[i]) for(int j = i + b; j <= n; j += b) ok[j] = true;
    rep(i, n + 1) if(ok[i] && i + b <= n) ok[i + b] = true;

    rrep(i, 1, n + 1) if(ok[i]) res -= 1;
    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 5156
/**
 *    This code has been written by YueGuang, feel free to ask me question. Blog: http://www.yx.telstudy.xyz
 *    created:
 */
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;

int main()
{
    int  x, y;
    cin >> x >> y;
    ll  sum = 0;
    for(int i = y+1; i <= x;i++)
    {
        sum=sum+(i-y)*(x/i);
        if(x%i-y>=0)
            sum=sum+1+x%i-y;
    }
    if(y==0)
        sum=sum-x;
    cout<<sum <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

int sum(int x){
    int res = 0;
    while(x){
        res += x%10;
        x /= 10;
    }
    return res;
}

int main(){
    ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    int answer = 1e9;
    for(int a = 1; a < n; a++){
        int res = sum(a) + sum(n-a);
        answer = min(answer, res);
    }

    cout << answer << endl;
}


Measured memory_bytes: 3648
# coding: utf-8
import sys
from collections import Counter

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
S = [sr() for _ in range(N)]
count_S = Counter(S)
M = ir()
T = [sr() for _ in range(M)]
count_T = Counter(T)
answer = 0
for k, v in count_S.items():
    temp = v - count_T[k]
    if temp > answer:
        answer = temp

print(answer)
    

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

const int MOD=998244353;
int dp[5000][5000];
int sum[5000],sum2[5000];

int main(){
	string s;cin>>s;
	rep(i,s.size()*2){
		if(i)sum[i]+=sum[i-1],sum2[i]+=sum2[i-1];
		if(i<s.size()){
			int d=s[i]-'0';
			sum[i]+=d;sum2[i]+=2-d;
		}
	}
	dp[0][0]=1;
	rep(i,s.size()*2)rep(j,sum[s.size()]+1){
		if(!dp[i][j])continue;
		if(j+1<=sum[i]){
			(dp[i+1][j+1]+=dp[i][j])%=MOD;
		}
		if(i-j+1<=sum2[i]){
			(dp[i+1][j]+=dp[i][j])%=MOD;
		}
	}
	cout<<dp[s.size()*2][sum[s.size()]]<<endl;
}

Measured memory_bytes: 78592
s = input()
t = input()
ans = []
for i in range(len(t),len(s)+1):
    k = 1
    for j in range(len(t)):
        if t[j]==s[i-len(t):i][j] or s[i-len(t):i][j]=='?':
            pass
        else:
            k = 0
            break
    if not k:
        continue
    m = s[:i-len(t)]+t+s[i:]
    m = m.replace('?','a')
    ans.append(m)
if ans==[]:
    print('UNRESTORABLE')
else:
    print(min(ans))

Measured memory_bytes: 3064
import fractions as m
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
ans = 0
mod = 10**9+7
def lcm(x,y):
    return (x*y//m.gcd(x,y))
def lcml(nums):
    return reduce(lcm,nums,1)
l = lcml(a)
for x in a:
    ans+= (l*pow(x,mod-2,mod)) %mod
    ans%=mod
print(ans)

Measured memory_bytes: 6136
<?php
$stack=[];
$top=0;
$data=explode(' ',trim(fgets(STDIN)));
foreach($data as $d){
  if($d=='+') $stack[$top-1]+=$stack[$top--];
  elseif($d=='-') $stack[$top-1]-=$stack[$top--];
  elseif($d=='*') $stack[$top-1]*=$stack[$top--];
  else $stack[++$top]=$d;
}
echo $stack[$top];
?>

Measured memory_bytes: 15500
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll A, B, K;
    cin >> A >> B >> K;

    ll v = min(A, B) + 1;
    ll counter = 0;
    while(counter < K){
        v--;
        if(A % v == 0 && B % v == 0){
            counter++;
        }
    }

    cout << v << endl;

    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

int main(){
    string s; cin>>s;
    while(true){
        s.pop_back();
        if(s.size()%2!=0) continue;
        if(s.substr(0,s.size()/2)==s.substr(s.size()/2,s.size()/2)){
            cout<<s.size()<<endl;
            return 0;
        }
    }
}

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

int main(){
    int r;
    float pie=3.141592,ans;
    char token[5000]={};
    fgets(token, sizeof(token), stdin);r=atoi(token);
    ans=2*pie*r;
    printf("%f",ans);
    return 0;
}



Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    string s,t;
    cin >> s >> t;
    ll ans = 0;
    for (ll i = 0;i<s.size();i++) {
        if (s.at(i) != t.at(i)) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3852
from sys import stdin
input = stdin.readline

s = input()
a = b = c = 0
a = (s[0] == 'R') * 1
b = (s[1] == 'R') * (1 + a)
c = (s[2] == 'R') * (1 + b)
print(max(a, b, c))


Measured memory_bytes: 61496
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

vector<int> game(vector<int> t, vector<int> h, int n){
	
	int turn = 1; //1=taro 0=hana
	int field = 0, f; 
	vector<int> res;

	sort(t.begin(),t.end());
	sort(h.begin(),h.end());
	
	while(1){
		
		f = 1;
	
		if(turn){	
			rep(i,t.size()){
				if(field < t[i]){
					
//					cout << "taro -> " << t[i] << endl;
					
					field = t[i];
					t.erase(remove(t.begin(), t.end(), t[i]), t.end()); 
					f = 0;
					break;
				}
			}
			turn = 0;
		}
		else{
			rep(i, h.size()){
				if(field < h[i]){

//					cout << "hana -> " << h[i] << endl;

					field = h[i];
					h.erase(remove(h.begin(), h.end(), h[i]), h.end()); 
					f = 0;
					break;
				}
			}
			turn = 1;
		}
		
		if(f) field = 0;

		if(t.size() == 0 || h.size() == 0) break;
	}		
	
	res.push_back(h.size());
	res.push_back(t.size());

	return res;
}

int main(){
	int n;
	
	while(cin >> n, n){
	
	vector<int> taro,hana,res;
	int m;
	
	rep(i,n*2) hana.push_back(i+1);
	

	rep(i,n){
		cin >> m;
		taro.push_back(m);
		hana.erase(remove(hana.begin(), hana.end(), m), hana.end());
	}
	//rep(i,n) cout << taro[i] << "\n";
	//rep(i,n) cout << hana[i] << "\n";

	res = game(taro,hana,n);

	rep(i,2) cout << res[i] << "\n";
	
	}
	return 0;
}

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

int main(void){
    int n;
    cin>>n;
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        ll c = sqrt(a*b);
        assert(c*c <= a*b && (c+1)*(c+1) > a*b);
        if(a > b) swap(a,b);
        if(a == b){
            cout<<2*c-2<<endl;
        }else if(c*(c+1) < a*b){
            cout<<2*c-1<<endl;
        }else if(c*c == a*b){
            cout<<2*c-3<<endl;
        }else{
            cout<<2*c-2<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def main():
    input = sys.stdin.readline
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())
    #ps = list(map(int, input().split()))

    N = int(input())
    Bs = list(map(int, input().split()))

    Asum = 0
    for i in range(N):
        if i == 0:
            Asum += Bs[0]
        elif i == N - 1:
            Asum += Bs[N-2]
        else:
            Asum += min([Bs[i-1], Bs[i]])
    print(Asum)


if __name__ == '__main__':
    main()


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

// dp[node] = max(dp[node], 1 + max(dp[child1], dp[child2], dp[child3]..))
void addEdge(vector<int> adj[],int u,int v) {
	adj[u].emplace_back(v);
}

void dfs(int node,vector<int> adj[],int dp[], bool vis[]) {
	vis[node]=true;
	for(int i=0; i<adj[node].size(); ++i) {
		if(!vis[adj[node][i]])
			dfs(adj[node][i],adj,dp,vis);
		dp[node] = max(dp[node], 1+dp[adj[node][i]]);
	}
}

int findLongestPath(vector<int> adj[], int v) {
	int dp[v+1];
	memset(dp,0,sizeof(dp));
	bool vis[v+1];
	memset(vis,0,sizeof(vis));

	for(int i=1; i<=v; ++i) {
		if(!vis[i]) 
			dfs(i,adj,dp,vis);
	}
	int ans = 0;
	for(int i=1; i<=v; ++i) {
		ans = max(ans,dp[i]);
	}
	return ans;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int v,e;
	cin >> v >> e;
	vector<int> adj[v+1];
	for(int i=0; i<e; ++i) {
		int u,v;
		cin >> u >>v;
		addEdge(adj,u,v);
	}
	cout << findLongestPath(adj,v) << "\n";
	return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct X{
	int Id;
	string S;
	int P;
};
bool Comp(X&l,X&r){
	if (l.S.compare(r.S)<0){
		return true;
	}else if (l.S.compare(r.S)==0){
		return l.P>r.P;
	}
	return false;
}
int main(int argc, char* argv[])
{
	int N,i;
	cin>>N;
	vector<X> x(N);
	for (i=0;i<N;i++){
		cin>>x[i].S>>x[i].P;
		x[i].Id=i+1;
	}
	sort(x.begin(),x.end(),Comp);
	for (i=0;i<N;i++){
		cout<<x[i].Id<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n,k; cin >> n >> k;
    vi h(n);
    rep(i,n) cin >> h[i];
    vc<ll> dp(n,INF);
    dp[0] = 0;
    
    rep(i,n-1){
        rng(j,i+1,min(i+k+1,n)){
            chmin(dp[j],dp[i]+abs(h[j]-h[i]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1408
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):

    i = 0
    for _ in range(N):

        if a[i] == 2:
            print(_+1)
            return
        i = a[i] - 1

    print(-1)
    

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 7112
#include <stdio.h>
#include <algorithm>
using namespace std;

const int coin = 2555;
long long t[55][coin + 1];
int N, M, S, X[111], Y[111], A[111], B[111], C[55], D[55];

int main()
{
	scanf ("%d %d %d", &N, &M, &S);
	if (S > coin) S = coin;

	for (int i = 1; i <= M; i++) scanf ("%d %d %d %d", &X[i], &Y[i], &A[i], &B[i]);
	for (int i = 1; i <= N; i++) scanf ("%d %d", &C[i], &D[i]);

	for (int i = 1; i <= N; i++) for (int j = 0; j <= coin; j++) t[i][j] = 1e18;
	t[1][S] = 0;

	for (int k = 0; k < N * N; k++){
		for (int i = 1; i <= N; i++) for (int j = 0; j <= coin; j++){
			int k = j + C[i];
			if (k > coin) k = coin;
			t[i][k] = min(t[i][k], t[i][j] + D[i]);
		}

		for (int i = 1; i <= M; i++){
			for (int j = A[i]; j <= coin; j++){
				int k = j - A[i];
				t[X[i]][k] = min(t[X[i]][k], t[Y[i]][j] + B[i]);
				t[Y[i]][k] = min(t[Y[i]][k], t[X[i]][j] + B[i]);
			}
		}
	}

	for (int i = 2; i <= N; i++){
		long long ans = 1e18;
		for (int j = 0; j <= coin; j++) ans = min(ans, t[i][j]);
		printf ("%lld\n", ans);
	}

	return 0;
}

Measured memory_bytes: 2736
#include <bits/stdc++.h>
using namespace std;
string s;
int main () {
	cin>>s;
	if (s[0]==s[1]&&s[1]==s[2]) printf("Yes\n");
	else if (s[1]==s[2]&&s[2]==s[3]) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
	int e,y,cnt=0;
	cin>>e>>y;
	if(e==0){
		if(y>=1868 && y<=1911){
			for(int i=1868;i<=y;i++){
				cnt=cnt+1;}	
			cout<<"M"<<cnt<<endl;}	
		if(y>=1912 && y<=1925){
			for(int i=1912;i<=y;i++){
				cnt=cnt+1;}
			cout<<"T"<<cnt<<endl;}
		if(y>=1926 && y<=1988){
			for(int i=1926;i<=y;i++){
				cnt=cnt+1;}
			cout<<"S"<<cnt<<endl;}
		if(y>=1989 && y<=2016){
			for(int i=1989;i<=y;i++){
				cnt=cnt+1;}
			cout<<"H"<<cnt<<endl;}
	}
	if(e==1){
		cout<<1867+y<<endl;}
	if(e==2){
		cout<<1911+y<<endl;}
	if(e==3){
		cout<<1925+y<<endl;}
	if(e==4){
		cout<<1988+y<<endl;}
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>

using namespace std;

int main()
{
    string s; int AC = 0 ,counter = 0;
    cin >> s;
    int sz = s.size();
    for(int i = 0 ; i < sz ; i++){
        if(islower(s[i])){
            counter ++;
        }
    }
    if (s[0] == 'A' && counter == sz - 2 ){
        for(int j = 2 ; j < sz - 1 ; j++){
            if(s[j]== 'C'){
                AC++;
            }
        }
        if(AC == 1)
            cout << "AC"<<endl;
        else
            cout<< "WA" <<endl;
    }
    else cout << "WA" <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static int N;
    static int[] A;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        A = sc.nextIntArray(N);
        System.out.println( solve() );
    }

    private static String solve() {
        Arrays.sort(A);
        int a = A[N-1];
        if( a % 2 == 0 ) {
            int r =  a/2; // risou
            int g = -1; // genjitsu
            for (int i = 0; i < N-1; i++) {
                if( Math.abs(r - A[i]) < Math.abs(r - g) ) {
                    g = A[i];

                    if( r == g ) {
                        return a + " " + g;
                    }
                }
            }
            return a + " " + g;

        } else {
            int r1 = a/2; // risou 1
            int r2 = r1 + 1; // risou 2

            int g = -1; // genjitsu
            for (int i = 0; i < N-1; i++) {
                if( Math.abs(r1 - A[i]) < Math.abs(r1 - g) || Math.abs(r2 - A[i]) < Math.abs(r2 - g)) {
                    g = A[i];

                    if( r1 == g || r2 == g ) {
                        return a + " " + g;
                    }
                }
            }
            return a + " " + g;
        }
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

int main(){
    int d;
    cin >> d;

    switch(d){
        case 22: cout << "Christmas Eve Eve Eve"<<endl; break;
        case 23: cout << "Christmas Eve Eve"<<endl; break;
        case 24: cout << "Christmas Eve" <<endl; break;
        case 25: cout << "Christmas" << endl; break;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<int,int> pii;

int main(){
    int n;
    scanf("%d", &n);

    int x, y;
    vector<pii> vp;
    for(int i = 0; i < n; i++){
        scanf("%d %d\n", &x, &y);
        vp.push_back({x,y});
    }

    sort(vp.begin(), vp.end());
    for(pii x : vp) printf("%d %d\n", x.first, x.second);

    return 0;
}


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

int main() {
  string s;
  cin >>s;
  int a;
  a = s.size();
  if(s.at(a-1)=='3'){
    cout <<"bon" <<endl;
  }
  else if(s.at(a-1)=='0'||s.at(a-1)=='1'||s.at(a-1)=='6'||s.at(a-1)=='8'){
    cout <<"pon" <<endl;
  }
  else{
    cout <<"hon" <<endl;
  }
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(){
  int k,x;
  scanf("%d%d",&k,&x);
  int s=x-(k-1);
  int g=x+(k-1);
  int a[g-s+1];
  for (int i=0;i<g-s+1;i++){
    a[i]=s+i;
  }
  for(int i=0;i<g-s+1;i++){
    printf("%d ",a[i]);
  }
  printf("\n");
}
    
  

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int a[1000000];
int main(){
    int n;
    cin >> n;
    a[0] = -1;
    for(int i = 1; i <= n; i ++) cin >> a[i];
    for(int i = 1; i <= n; i ++)
    if(a[i] - a[i-1] > 1){
        cout << -1 << endl;
        return 0;
    }
    long long res = 0;
    for(int i = 2; i <= n; i ++)
        res += (a[i-1] == a[i] - 1 ? 1 : a[i]);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 200010;

ll H, W, N;
set<pii> pts;
ll maxy[maxn];

void MAIN() {

    cin >> H >> W >> N;
    fori (i, N) {
        ll x, y; cin >> x >> y;
        pts.insert({x, y});
    }
    maxy[0] = 0;
    fori (i, H) {
        maxy[i + 1] = maxy[i];
        if (pts.count({i + 1, maxy[i] + 1}) == 0) ++maxy[i + 1];
    }
    ll ans = H;
    for (auto p : pts) {
        if (maxy[p.F - 1] >= p.S) smin(ans, p.F - 1);
    } 
    cout << ans << '\n';

}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
10 10 14
4 3
2 2
7 3
9 10
7 7
8 1
10 10
5 4
3 4
2 8
6 4
4 4
5 8
9 2
    )";
    MAIN();
    return 0;
}


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

using namespace std;

template<typename T = int>
class cumulative_sum_2d {
private:
    std::vector<std::vector<T>> vec;
    std::vector<std::vector<T>> sum;
    bool invalid;
    int H, W;
public:
    cumulative_sum_2d() {invalid = true;}
    cumulative_sum_2d(const std::vector<std::vector<T>> &v) {
        init(v);
    }
    void init() {
        vec.clear();
        sum.clear();
        H = W = -1;
        invalid = true;
    }
    void init(const std::vector<std::vector<T>> &v) {
        init();
        invalid = false;
        H = v.size();
        W = v.front().size();
        std::copy(v.begin(), v.end(), std::back_inserter(vec));
        sum.resize(H + 1, std::vector<T>(W + 1, 0));
    }
    bool calc_sum() {
        if (invalid) {
            return false;
        }
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                sum[i + 1][j + 1] = vec[i][j];
            }
        }
        for (int i = 0; i < H + 1; i++) {
            for (int j = 0; j < W; j++) {
                sum[i][j + 1] += sum[i][j];
            }
        }
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W + 1; j++) {
                sum[i + 1][j] += sum[i][j];
            }
        }
        return true;
    }
    // [p1, p2)
    T get_sum(std::pair<int, int> p1, std::pair<int, int> p2) {
        if (invalid) return 0;
        int h1, w1, h2, w2;
        std::tie(h1, w1) = p1; std::tie(h2, w2) = p2;
        h2--; w2--;
        return sum[h2 + 1][w2 + 1] - sum[h2 + 1][w1] - sum[h1][w2 + 1] + sum[h1][w1];
    }
    T get_sum(int x1, int y1, int x2, int y2) {
        return this->get_sum(std::make_pair(x1, y1), std::make_pair(x2, y2));
    }
    std::vector<std::vector<T>> get_sum_vec() {return sum;}
};

const int MAX = 2e5 + 10;
int N, M, Q;
int L[MAX], R[MAX], p[MAX], q[MAX];
cumulative_sum_2d<int> sum;

void naive() {
    for (int i = 0; i < Q; i++) {
        int ans = 0;
        for (int j = 0; j < M; j++) {
            if (p[i] <= L[j] && R[j] <= q[i]) {
                ans++;
            }
        }
        cout << ans << endl;
    }
}

int main() {
    //cin >> N >> M >> Q;
    scanf("%d%d%d", &N, &M, &Q);
    vector<vector<int>> vec(N, vector<int>(N));
    for (int i = 0; i < M; i++) {
        //cin >> L[i] >> R[i];
        scanf("%d%d", L + i, R + i);
        L[i]--;R[i]--;
        vec[L[i]][R[i]]++;
    }
    for (int i = 0; i < Q; i++) {
        //cin >> p[i] >> q[i];
        scanf("%d%d", p + i, q + i);
        p[i]--;q[i]--;
    }
    //naive();
    sum.init(vec);
    sum.calc_sum();
    for (int i = 0; i < Q; i++) {
        //cout << sum.get_sum(p[i], p[i], q[i] + 1, q[i] + 1) << endl;
        printf("%d\n", sum.get_sum(p[i], p[i], q[i] + 1, q[i] + 1));
    }
}


Measured memory_bytes: 6272
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

    vector<ll> A(N);

    ll one_pos = -1;
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] == 1) {
            one_pos = i;
            break;
        }
    }

    ll left = one_pos;
    ll right = N - 1 - one_pos;

    ll ans = 0;

    ans += (left + (K - 1 - 1)) / (K - 1);
    right -= (left % (K - 1) == 0 ? 0 : K - 1 - left % (K - 1));
    ans += (right + (K - 1 - 1)) / (K - 1);

    cout << ans << endl;
}

Measured memory_bytes: 1024
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{   
     IOS;
     
     string s;
     bool A=false;
     bool B=false;
     cin>>s;
     for(ll i=0;i<(ll)s.length();i++)
     {
      if(s[i]=='A') A=true;
      else B=true;
     }
     if(A&B) cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

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

int main(){

  ll N,K=0;
 
  cin>>N>>K;
  
  if(N>K)N=N%K;
  
  cout<<min(N,abs(K-N))<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>

using namespace std;

vector<pair<long long int, long long int>> getPrimeElements(long long int num) {

	long long int firstnum = num;

	vector<pair<long long int, long long int>> result;
	pair<long long int, long long int> wk;

	if (num % 2 == 0) {
		wk.first = 2;
		wk.second = 0;
		while (num % 2 == 0) {
			wk.second++;
			num /= 2;
		}

		result.push_back(wk);
	}

	long long int waru = 3;

	while (true) {

		if (num % waru == 0) {
			wk.first = waru;
			wk.second = 0;
			while (num % waru == 0) {
				wk.second++;
				num /= waru;
			}

			result.push_back(wk);
		}
		waru += 2;

		if (waru * waru > num) break;

	}

	if (num != 1) {
		wk.first = num;
		wk.second = 1;
		result.push_back(wk);

	}

	return result;
}


int getKeta(int num) {

	if (num == 0)return 1;

	int res = 0;

	while (num > 0) {
		num /= 10;
		res++;
	}

	return res;
}

vector<int> bunkai(int num) {

	string str = to_string(num);
	vector<int> res;

	for (int i = 0; i < str.size(); i++) {
		int a = str[i] - '0';
		res.push_back(a);
	}

	return res;

}


int main()
{
    
	int n;
	cin >> n;
	vector<string> s(n);
	for (auto& i : s)cin >> i;

	int m;
	cin >> m;
	vector<string> t(m);
	for (auto& i : t)cin >> i;

	int ans = 0;

	for (int i = 0; i < s.size(); i++) {
		int okane = 0;
		string call = s[i];

		for (int j = 0; j < s.size(); j++) {
			if (call == s[j])okane++;
		}

		for (int j = 0; j < t.size(); j++) {
			if (call == t[j])okane--;
		}

		ans = max(ans, okane);



	}

	cout << ans << endl;

	return 0;

}




Measured memory_bytes: 256
from math import sqrt
n = int(input())
l = [0]*(n)
s = int(sqrt(n))
for x in range(1, s+1):
  for y in range(1, s+1):
    for z in range(1, s+1):
      i = x**2+y**2+z**2+x*y+y*z+z*x
      if i-1 < n:
        l[i-1] += 1
        
for i in l:
  print(i)

Measured memory_bytes: 69488
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;
int main() {
    long long N;
    cin >> N;
    long long a = N % 3;
    N -= N % 3;
    long long count = 100000;
    for(int i = 0; i <= N; i+= 9){
        long long tmpC = 0;
        long long tmp = i;
        while(tmp != 0){
            tmpC += tmp % 9;
            tmp = tmp / 9;
        }
        tmp = N - i;
        while (tmp != 0){
            tmpC += tmp % 6;
            tmp = tmp / 6;
        }
        count = min(count, tmpC);
    }
    cout << count + a << endl;

}

Measured memory_bytes: 256
def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i)
  b = gets.chomp.split(' ').map(&:to_i)

  s = a.reduce(:+)
  t = b.reduce(:+)
  if s > t then
    puts 'No'
    return
  end

  c = t - s
  d = [0, 0]
  n.times do |i|
    if a[i] > b[i] then
      d[0] += a[i] - b[i]
    elsif a[i] < b[i] then
      d[1] += (b[i] - a[i] + 1) / 2
    end
  end

  puts (d.max <= c ? 'Yes' : 'No')
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 5116
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
const ll MAX_NUM = 1e9;

ll N, A, B;

bool is_ok(std::vector< ll >& vh, ll limit)
{
  std::vector< ll >::iterator it;

  ll cnt = 0;
  for (it = vh.begin(); it != vh.end(); it++) {
    cnt += std::max(0LL, (*it - limit * B + A - B - 1) / (A - B));
  }

  bool judge = false;
  if (cnt <= limit) {
    judge = true;
  }
  return judge;
}

int main(int argc, char* argv[])
{
  std::cin >> N >> A >> B;
  std::vector< ll > vh(N, 0);

  for (ll i = 0; i < N; i++) {
    std::cin >> vh[i];
  }

  ll left = 0;
  ll right = MAX_NUM;
  while (right - left > 1) {
    ll mid = (left + right) / 2;
    if (is_ok(vh, mid)) {
      right = mid;
    } else {
      left  = mid;
    }
  }

  std::cout << right << std::endl;
  
  return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x <= K - x)
      sum += x * 2;
    else
      sum += (K - x) * 2;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void a(){
    int A,B; cin >> A >> B;

    int ans = 0;
    if (A > B){
        ans +=A;A--;
    } else {
        ans += B;
        B--;
    }

    if (A > B){
        ans +=A;A--;
    } else {
        ans += B;B--;
    }

 cout << ans;

}

void b(){

    int N; cin >> N;
    vector<int> H(N);
    for(int i = 0; i < N; i++){
        cin >> H[i];
    }

    int c = 0;
    int max_h = 0;
    for(int i = 0; i < N ;i++){

        if(max_h <= H[i]){
            c++;
            max_h = H[i];
        }
    }

    cout << c;

}

void c(){

    string S; cin >> S;
    int N = S.size();
    int stBlack = 0;
    for(int i = 0; i < N; i++){
        if (i % 2 == 0 && S[i] == '1') stBlack++;
        if (i % 2 == 1 && S[i] == '0') stBlack++;
    }

    int stWhite = 0;
    for(int i = 0; i < N; i++){
        if (i % 2 == 0 && S[i] == '0') stWhite++;
        if (i % 2 == 1 && S[i] == '1') stWhite++;
    }

    cout << min(stBlack, stWhite);

}

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


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n;
    ll k;
    cin >> n >> k;

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

    int count[40];
    fill(count, count+40, 0);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 40; j++) {
            if (a[i] & (1LL << j)) {
                count[j]++;
            }
        }
    }

    ll ans = 0LL;
    ll tmp = 0LL;
    for (int i = 39; i >= 0; i--) {
        if (tmp + (1LL << i) > k) {
            ans += (ll)(count[i]) * (1LL << i);
        } else {
            if (count[i] < n - count[i]) {
                tmp += (1LL << i);
                ans += (ll)(n - count[i]) * (1LL << i);
            } else {
                ans += (ll)count[i] * (1LL << i);
            }
        }
    }

    cout << ans << "\n";
    return 0;
}

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

int main(){
    int n;
    while(cin >> n){
        int ans = 0;
        for(int a = 0; a < 10; a++){
            for(int b = 0; b < 10; b++){
                for(int c = 0; c < 10; c++){
                    for(int d = 0; d < 10; d++){
                        if(a+b+c+d == n) {
                            ans++;
                        }
                    }
                }
            }
        }
      
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
using namespace std;
typedef pair <int,int> P;
typedef long long int ll;
ll A,B,ans=0;
int main()
{
	scanf("%lld%lld",&A,&B);
	if(A==B)
	{
		printf("1\n");
		return 0;
	}
	int t=59;
	while(!((A>>t&1)^(B>>t&1)))t--;
	A&=(1ll<<(t+1))-1;
	B&=(1ll<<(t+1))-1;
	int r=t-1;
	while(r>=0&&(!(B>>r&1)))r--;
//	cout<<t<<" "<<A<<" "<<B<<" "<<r<<endl;
	ans+=(1ll<<t)-A;
	ans+=(1ll<<(r+1));
	ans+=(1ll<<t)-A;
//	cout<<ans<<endl;
	if(A<=((1ll<<(r+1))-1))ans-=(1ll<<(r+1))-A;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
import math
 
N=int(input())

A=[]

for i in range(1,int(math.sqrt(N))+1):
  if N % i ==0:
    A.append(i)
    A.append(int(N/i))
    
A.sort()
base = int(len(A)/2)

print(A[base]-1 +A[base-1] -1)

Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <cmath>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;

int main(){
    int n,a,b;
    vector<pii> arr,arr1;
    scanf("%d", &n);
    while(n--){
        scanf("%d%d", &a,&b);
        arr.emplace_back(a,b);
        arr1.emplace_back(a,(int)1e9-b);
    }
    sort(arr.begin(), arr.end(), [](pii& lhs, pii& rhs){ 
        return (long long)lhs.first+lhs.second > (long long)rhs.first+rhs.second;
    });
    sort(arr1.begin(), arr1.end(), [](pii& lhs, pii& rhs){ 
        return (long long)lhs.first+lhs.second > (long long)rhs.first+rhs.second;
    });
    pii lhs, rhs;
    lhs = arr.front(); rhs = arr.back();
    long long ans = abs((long long)lhs.first-rhs.first) + abs((long long) lhs.second-rhs.second);
    lhs = arr1.front(); rhs = arr1.back();
    long long ans2 = abs((long long)lhs.first-rhs.first) + abs((long long) lhs.second-rhs.second);
    printf("%lld", ans > ans2 ? ans : ans2);

    return 0;
}

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

int main() {
    int s, low, high;
    string ans;
    cin >> s;
    low = s % 100;
    high = (s - low) / 100;
    if ((high > 12 || high == 0) && low > 0 && low < 13) ans = "YYMM";
    else if (high < 13 && high > 0 && (low > 12 || low == 0)) ans = "MMYY";
    else if (high < 13 && high > 0 && low < 13 && low > 0) ans = "AMBIGUOUS";
    else {
        ans = "NA";
    }
    cout << ans << endl;
}

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

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        long A = long.Parse(s[0]);
        long B = long.Parse(s[1]);
        long K = long.Parse(s[2]);

        if(A - K < 0)
        {
            Console.WriteLine("0 " + (Math.Max(B-(K-A), 0)).ToString());
        }
        else
        {
            Console.WriteLine((A - K).ToString() + " " + B.ToString());
        }
    }
}


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

#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;

int main()
{
    fio;
    ll t, l, a, n, q, k, i, m, c, u, f, j, p, r, x, y, s, b, d;

    cin >> l >> r >> d;
    set<int> S;
    for (i = 1; i  <= r; i++)
        if ( i*d >=l && i*d <=r)
        {
            S.insert(i);
        }
    cout << S.size();
    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
int main()
{
  char s[105];
  scanf("%s",s);
  int len =strlen(s);
  for(int i = 0;i < len;i++)
  {
    if(i%2==0)
    {
      if(s[i]=='L')
      {
        printf("No\n");
        return 0;
      }
    }
    else
    {
       if(s[i]=='R')
      {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
  
  
  return 0;
}

Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	r := nextInt()
	if r < 1200 {
		fmt.Println("ABC")
	} else if r < 2800 {
		fmt.Println("ARC")
	} else {
		fmt.Println("AGC")
	}
}


Measured memory_bytes: 640
n, k = map(int, input().split())

ans = 0
for num in range(k, n + 2):
    maximum = (2 * n - num + 1) * num // 2
    minimum = (num - 1) * num // 2
    ans += maximum - minimum + 1
    
ans = ans % (10**9 + 7)

print(ans)

Measured memory_bytes: 9188
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

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

ll M,N;
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
  cin>>N>>M;
 ll a[N];
 ll sum = 0 ,temp , ans = 0;
 vector<ll> va;


  for(ll i = 0 ; i<N ; i++){
    cin>>temp;
    va.push_back(temp);
    sum += temp;
  }


sort(va.rbegin() , va.rend());

 for(ll i = 0 ; i<M ; i++){
  if( 4*M*va[i] >= sum)
    ans++;
 }

 if(ans >=M)
  cout<<"Yes"<<'\n';

else
  cout<<"No"<<'\n';




}



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

	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s, t, u;
  cin >> s >> t >> u;
  cout << char(s[0] - 32) << char(t[0] - 32) << char(u[0] - 32) << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;
use std::cmp::{min, max};
use itertools::Itertools;
use num_integer::div_floor;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}

fn read_tuple3<T: FromStr, S: FromStr, R: FromStr >() -> (T, S, R) {
    let a = read();
    let b = read();
    let c = read();
    (a, b, c)
}

fn main() {
    let n:u64 = read();
    let alist:Vec<u64> = (0..n).map(|_|read()).collect();
    let mut counter = HashMap::new();
    for a in alist {
        let ent =counter.entry(a).or_insert(0);
        *ent += 1;
    }
    let mut twos:Vec<u64> = counter.iter()
        .filter(|(key, val)|**val > 1)
        .map(|(key, val)|*key)
        .collect();
    twos.sort_by(|a, b|b.cmp(a));
    if let (Some(f), Some(s)) = (twos.get(0), twos.get(1)) {
        let ans = max(f * s, if *counter.get(f).unwrap_or(&0) > 3 { f * f } else { 0 });
        println!("{}", ans);
    } else {
        let mut fours:Vec<u64> = counter.iter()
            .filter(|(key, val)|**val > 3)
            .map(|(key, val)|*key)
            .collect();
        fours.sort_by(|a, b|b.cmp(a));
        if let Some(f) = fours.get(0) {
            println!("{}", f * f);
        } else {
            println!("0");
        }
    }


}



Measured memory_bytes: 6152
#include <stdio.h>
int main(int argc, char const *argv[])
{
  int h,a,c;
  scanf("%d%d",&h,&a);
  c=h%a;
  a=h/a;
  if(c==0){
    printf("%d",a);
  }else{
    printf("%d",a+1);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    ll A,B,Q;
    cin >> A >> B >> Q;
    vector<ll> s(A + 2);
    vector<ll> t(B + 2);
    vector<ll> q(Q);
    s[0] = (- (1ll << 60));
    t[0] = (- (1ll << 60));

    for(int i = 0; i  < A; i++)
        cin >> s[i + 1];
    for(int i = 0; i  < B; i++)
        cin >> t[i + 1];
    for(int i = 0; i  < Q; i++)
        cin >> q[i];

    s[A + 1] = ( (1ll << 60));
    t[B + 1] = ( (1ll << 60));

    for(int i = 0; i < Q; i++){
        ll x = q[i];
        decltype(s)::iterator us = lower_bound(s.begin(),s.end(),x);
        decltype(t)::iterator ut = lower_bound(t.begin(),t.end(),x);
        ll usPos = distance(s.begin(),us);
        ll utPos = distance(t.begin(),ut);
        vector<ll> tmps = {s[usPos - 1],s[usPos]};
        vector<ll> tmpt = {t[utPos - 1],t[utPos]};
        //cout << tmps[0] << " " << tmps[1] << " " << tmpt[0] << " " << tmpt[1] << endl;
        ll m = 1ll << 60;
        for(unsigned int j = 0; j < (1 << 3); j++){
            ll S;
            ll T;
            if(j & (1 << 0)){
                S = tmps[0];
            }else{
                S = tmps[1];
            }
            if(j & (1 << 1)){
                T = tmpt[0];
            }else{
                T = tmpt[1];
            }
            if(j & (1 << 2)){
                //cout << abs(x - S) + abs(S - T) << endl;
                m = min(m,abs(x - S) + abs(S - T));
            }else{
                //cout << abs(x - T) + abs(T - S) << endl;
                m = min(m,abs(x - T) + abs(T - S));
            }
        }
        cout << m << endl;
    }

}


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

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

	int a, b;
	cin >> a >> b;
	int cnt = 0;
	int bb = b;
	while (bb > 0) {
		cnt++;
		bb /= 10;
	}
	int c = 1;
	rep(i, cnt) c *= 10;
	int ai = a * c + b;
	for (int i = 1; i * i <= ai; i++) {
		if (i * i == ai) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1)
    {
        c=c-b;
        if(c<=0)
        {
            cout<<"Yes"<<endl;
            break;
        }
    a=a-d;
    if(a<=0)
    {
        cout<<"No"<<endl;
        break;
    }
    }
}

Measured memory_bytes: 3620