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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%ull",&n)
#define ull             unsigned long long int
#define endll           pf("\n")
#define pf              printf
#define PI              acos(-1.0)
#define eps             1e-12
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define mod 998244353
#define var    int i,j,k,z=0,c=0,t,x,y,l,r,mid
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};
//int dx[4]={1,-1,0,0};  //4 direction
//int dy[4]={0,0,1,-1};

ll n,m,cnt[1000005],csum[1000005],inv[1000005];
vector<ll> dv[1000005];
void divisor(ll n)
{
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
        {
            dv[j].pb(i);
        }
    }
}

void inverse(ll m)
{
    //m is prime;
    inv[1] = 1;
    for(int i = 2; i < 1000004; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}

int main()
{
    //freopen("lcm.in","r",stdin);
    ll var;
    divisor(1000000);
    inverse(mod);

    {
        sfl(n);
        z=0;y=0;
        for(i=0;i<n;i++)
        {
            sfl(x);
            cnt[x]++;
            z=max(z,x);
            y+=x;
            for(j: dv[x])
            {
                csum[j]+=x;
                if(csum[j]>mod)csum[j]%=mod;
            }
        }
        for(i=1;i<=z;i++)csum[i]*=csum[i],csum[i]%=mod;
        ll ans=0;
        for(i=z;i>=1;i--)
        {
            ans+=(csum[i]*inv[i]);
            ans%=mod;
            if(csum[i]==0)continue;
            for(j: dv[i])
            {
                csum[j]-=(csum[i]);
                if(csum[j]<0)csum[j]+=mod;
                csum[j]%=mod;
            }
        }
        y%=mod;
        ans-=y;ans+=mod;ans%=mod;
        ans*=inv[2];ans%=mod;
        pf("%lld\n",ans);
    }
}


Measured memory_bytes: 204416
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<pair<int,int> > vp;
typedef pair<int,int> p;
vp red;
vp blue;
int n,x,y,ans=0,ans2=0;
bool usedb[105];
bool usedr[105];
set <p> cand;
bool paircomp(const p &a, const p &b)
{
  return (a.first*a.first+a.second*a.second) < (b.first*b.first+b.second*b.second);
}

int main(int argc,char const* argv[])
{
  //memset(usedb,false,sizeof(usedb));
  //memset(usedr,false,sizeof(usedr));
  cin >> n;
  red.resize(n);
  blue.resize(n);
  for(int i=0;i<n;i++)
    {
      cin >> x >> y;
      red[i].first=x;
      red[i].second=y;
    }
  for(int i=0;i<n;i++)
    {
      cin >> x >> y;
      blue[i].first=x;
      blue[i].second=y;
    }
  sort(red.begin(),red.end());
  sort(blue.begin(),blue.end());
  for(int i=0;i<n;i++)
    {
      cand.insert(red[i]);
    }
  for(int i=0;i<n;i++)
    {
      int tmp=-INF;
      int tindex;
      for(auto itr=cand.begin();itr!=cand.end();itr++)
	{
	  if(itr->second<blue[i].second && itr->first<blue[i].first && itr->second>tmp)
	    {
	      tmp=itr->second;
	      for(int i=0;i<n;i++)
		{
		  if(itr->first==red[i].first && itr->second==red[i].second)
		    {
		      tindex=i;
		    }
		}
	    }
	}
      if(tmp!=-INF)
	{
	  cand.erase(red[tindex]);
	  ans++;
	}
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace D_PANA2020
{
    class MainClass
    {

        static int[] s;
        static int a;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            a = s[0];

            var chara = new char[10] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };

            // var anslst = new List<Dictionary<string, int>>();
            // for (int i = 0; i < a; i++)
            // {
            //     var myans = new Dictionary<string, int>();
            //     if (i == 0)
            //     {
            //         myans.Add("a", 1);
            //         anslst.Add(myans);
            //     }
            //     else
            //     {
            //         var mydic = new Dictionary<string, int>();

            //             foreach (var item in anslst[i-1])
            //             {
            //                 var thiscnt = item.Value;
            //                 for (int k = 0; k <= thiscnt; k++)
            //                 {
            //                     if (k == thiscnt)
            //                     {
            //                         mydic.Add(item.Key + chara[k], thiscnt + 1);
            //                     }
            //                     else
            //                     {
            //                         mydic.Add(item.Key + chara[k], thiscnt);
            //                     }
            //                 }
            //             }

            //         anslst.Add(mydic);

            //     }
            // }

            // foreach(var item in anslst[a-1]){
            //     WriteLine(item.Key);
            // }

            Dfs("a", 'a');




        }
        static void Dfs(string s, char mx)
        {
            if (s.Length == a)
            {
                WriteLine(s);
                return;
            }
            for (char c = 'a'; c <= mx + 1; c++)
            {
                string ss = s + c;
                if (c == mx + 1)
                {

                    Dfs(ss, c);
                }
                else
                {
                    Dfs(ss, mx);
                }
            }
        }
    }
}


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

int main() {
  	int N;
  	cin >> N;
  	int sum = 0;
  	int X = N;
  	while (N > 0){
      	sum = sum + N % 10;
      	N = N / 10;
    }
  	if (X % sum == 0) cout << "Yes" << endl;
  	else cout << "No" << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





long long cof(long long a) {
	if (a < 0)return 0;
	return a * (a + 1) / 2;
}

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

	int n, x, d;
	cin >> n >> x >> d;
	if (d == 0) {
		if (x == 0)cout << 1 << endl;
		else cout << n + 1 << endl;
		return 0;
	}
	if (d < 0) {
		d *= -1;
		x *= -1;
	}

	unordered_map<int, vector<pair<long long, long long>>> seg;

	long long s = cof(n - 1);

	rep(i, n + 1) {
		int n1 = i, n2 = n - i;
		long long a = ((long long)x * n1 % d + d) % d;
		long long bias = ((long long)x * n1 - a) / d;

		long long e = cof(n1 - 1);
		long long f = (s - cof(n2 - 1));
		seg[a].emplace_back(bias + e, bias + f);
	}

	long long ans = 0;
	for (auto &p : seg) {
		sort(all(p.second));
		long long t = 0, last;
		bool first = true;
		for (auto v : p.second) {
			if (first) {
				t += v.second - v.first + 1;
				last = v.second;
			}
			else {
				if (v.first <= last) {
					if (last < v.second) {
						t += v.second - last;
						last = v.second;
					}
				}
				else {
					t += v.second - v.first + 1;
					last = v.second;
				}
			}
			first = false;
		}

		ans += t;
	}
	

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 17864
#include <bits/stdc++.h>
using namespace std;
// std::vector<long long int> ;
long long int getMoves(long long int b,long long int a){
     return b-a;
}
int main() {
	string a;
	cin >> a;
// 	cout << a;
	long long int k = 0;
	long long int st = 0;
	long long int ans = 0;
	for(long long int i=0;i<a.size();i+=1){
	    // cout << a[i];
          if(a[i]=='W' && k==1 ){
               ans+=getMoves(i,st);
               st+=1;
          }
          if(a[i]=='W' && (i-st)<=1 && k==0){
               st = i+1;
          }
          if(a[i]=='B'){
               k=1;
          }
	}
	cout << ans;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    char x;cin>>x;
    if(x>='a')cout<<'a'<<endl;
    else cout<<'A'<<endl;
}

Measured memory_bytes: 3632
import java.util.LinkedHashMap;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        Integer n = Integer.valueOf(scan.next());
        Integer k = Integer.valueOf(scan.next());
        Integer q = Integer.valueOf(scan.next());

        LinkedHashMap<Integer, Integer> score = new LinkedHashMap<>();
        for (int i = 1; i <= n; i++) {
            score.put(i, k);
        }

        int i = 0;
        for (; i < q; i++) {
            Integer winner = Integer.valueOf(scan.next());
            score.put(winner,score.get(winner)+1);
            //System.out.println(score);
        }

        for(int now : score.values()){
            System.out.println(now<=i?"No":"Yes");
        }

    }

}


Measured memory_bytes: 62808
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int ord[110000], low[110000], n, m, a, b, cnt;
vector<int>x[110000]; bool used[110000];
vector<pair<int, int>>bridge;
void dfs(int v, int k) {
	ord[v] = cnt; used[v] = true;
	low[v] = cnt; cnt++;
	for (int i = 0; i < x[v].size(); i++) {
		if (used[x[v][i]] == false) {
			dfs(x[v][i], v);
			low[v] = min(low[v], low[x[v][i]]);
			if (ord[v] < low[x[v][i]]) { bridge.push_back(make_pair(v, x[v][i])); }
		}
		else if (x[v][i] != k) {
			low[v] = min(low[v], ord[x[v][i]]);
		}
	}
}
int main() {
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		cin >> a >> b;
		x[a].push_back(b);
		x[b].push_back(a);
	}
	used[1] = true; dfs(1, -1);
	for (int i = 0; i < bridge.size(); i++) {
		if (bridge[i].first > bridge[i].second) { swap(bridge[i].first, bridge[i].second); }
	}
	sort(bridge.begin(), bridge.end());
	for (int i = 0; i < bridge.size(); i++) {
		cout << bridge[i].first << ' ' << bridge[i].second << endl;
	}
	return 0;
}

Measured memory_bytes: 7200
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  string ans;
  ans.push_back(toupper(a.front()));
  ans.push_back(toupper(b.front()));
  ans.push_back(toupper(c.front()));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;


#define int long long

const int MAX_N = 200000;
ll inv[MAX_N + 10];
ll fac[MAX_N + 10], facInv[MAX_N + 10];

class MATH{
public:
	MATH(){
		inverse();
		factroial();
	}
	ll nCk(ll n, ll k){// n! / k!*(n-k)!
		if(k < 0 || k > n) return 0;
		ll ret = fac[n];
		(ret *= facInv[k]) %= MOD;
		(ret *= facInv[n - k]) %= MOD;
		return ret;
	}
	ll nHk(ll n, ll k){// nHk = n+k-1 C k = (n+k-1)! / k! * (n-1)!
		if(n == 0 && k == 0) return 1;
		ll ret = fac[n + k - 1];
		(ret *= facInv[k]) %= MOD;
		(ret *= facInv[n - 1]) %= MOD;
		return ret;
	}
	ll nPk(ll n, ll k){//nPk = n! / (n-k)!
		if(k < 0 || k > n) return 0;
		ll ret = fac[n];
		(ret *= facInv[n - k]) %= MOD;
		return ret;
	}
private:
	void inverse(void){
		inv[1] = 1;
		for (int i = 2; i <= MAX_N; ++i){
			// inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
			inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		}
	}
	void factroial(void){
		fac[0] = facInv[0] = 1;
		for (int i = 1; i <= MAX_N; ++i){
			fac[i] = (fac[i - 1] * i) % MOD;
			facInv[i] = (facInv[i - 1] * inv[i]) % MOD;
		}
	}
};

signed main(void) {

	int n;
	int a[100010];
	cin >> n;
	rep(i, n + 1) cin >> a[i];
	map<int, int> ma;
	rep(i, n) ma[a[i]]++;
	int c;
	for(auto u : ma) {
		if(u.se == 2){
			c = u.fi; break;
		}
	}

	//printf("c %d\n", c);
	int x, y;
	rep(i, n + 1) if(a[i] == c) {
		x = i; break;
	}
	REP(i, n + 1) if(a[i] == c){
		y = n - i;
		break;
	}
	// printf("x %d y %d\n", x, y);
	ll z = x + y;

	MATH math;
	reps(i, 1, n + 2) {
		ll k = i;
		ll ans = math.nCk((ll)(n + 1), k);
		ans %= MOD;
		ans += MOD;
		ans -= math.nCk(z, k - 1);
		ans %= MOD;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 12928
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    long long coins;
    long long happy = 0;
   std::cin >> coins;
   while(coins >= 500){
       coins -= 500;
       happy += 1000;
   }
   while (coins >= 5){
       coins -= 5;
       happy += 5;
   }

   cout << happy;
}


Measured memory_bytes: 256
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
h = {}
for i in range(N):
	h[rs()] = 1
print(len(h))


Measured memory_bytes: 105332
def main():
    N, A, B = map(int, input().split())
    S = input()

    AB = A+B
    n_passed = 0
    n_b = 0
    for s in S:
        passed = False
        if s == "a":
            if n_passed < AB:
                n_passed += 1
                passed = True
        elif s == "b":
            if n_passed < AB and n_b + 1 <= B:
                n_passed += 1
                n_b += 1
                passed = True
        
        if passed:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()


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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(5);
  ll minimum=1e18;
  rep(i,5){
    cin >> a[i];
    minimum = min(minimum,a[i]);
  }
  
  if(n <= minimum){
    cout << 5 << endl;
  }else{
    ll times = ceil((n-minimum)*1.0/minimum);
    cout << times + 5 << endl;
  }

  return(0);
}

Measured memory_bytes: 3660
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;



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

  vector<int> v(26, 0);

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

  bool ans = true;
  for (int i = 0; i < 26; ++i)
  {
    if (v[i] % 2 != 0)ans = false;
  }


  cout << (ans?"Yes":"No") << endl;

  return 0;
}


Measured memory_bytes: 256
N, M, QN = [int(x) for x in input().split()]

MAT0 = [[0] * (N + 1) for _ in range(N + 1)]

for i in range(M):
    l, r = [int(x) for x in input().split()]
    MAT0[l][r] += 1

MAT = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        MAT[i][j] = MAT[i][j - 1] + MAT0[i][j]

MM = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        MM[i][j] = MM[i - 1][j] + MAT[i][j]

for i in range(QN):
    p, q = [int(x) for x in input().split()]
    ret = 0
    ret = ret + MM[q][q] - MM[q][p - 1] - MM[p - 1][q] + MM[p - 1][p - 1]
    print(ret)


Measured memory_bytes: 19156
N, K = gets.split.map(&:to_i)
R, S, P = gets.split.map(&:to_i)
T = gets.strip

t = T
(K .. N).each{|i| t[i] = '*' if t[i - K] == t[i]}
puts t.count('r')*P + t.count('s')*R + t.count('p')*S

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

int main(void) {
	int a ,b;
	cin >> a >> b;
	if(a==b){
		cout << "Draw" << endl;
		return 0;
	}else if (a==1 || a>b && b!=1){
		cout << "Alice" << endl;
		return 0;
	}else if (b==1 || b>a){
		cout << "Bob" << endl;
		return 0;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,mst=0,mn,p[100005];
vector<tuple<long long,long long,long long> > v1,v2,g;
long long f(long long a)
{
	if(p[a]==a)
	{
		return a;
	}
	return p[a]=f(p[a]);
}
void un(long long b,long long c)
{
	p[f(b)]=f(c);
}
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&x,&y);
		v1.push_back(make_tuple(x,y,i));
		v2.push_back(make_tuple(y,x,i));
		p[i]=i;
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	for(int i=0;i<v1.size()-1;i++)
	{
		mn=min(abs(get<0>(v1[i])-get<0>(v1[i+1])),abs(get<1>(v1[i])-get<1>(v1[i+1])));
		g.push_back(make_tuple(mn,get<2>(v1[i]),get<2>(v1[i+1])));
	}
	for(int i=0;i<v2.size()-1;i++)
	{
		mn=min(abs(get<0>(v2[i])-get<0>(v2[i+1])),abs(get<1>(v2[i])-get<1>(v2[i+1])));
		g.push_back(make_tuple(mn,get<2>(v2[i]),get<2>(v2[i+1])));
	}
	sort(g.begin(),g.end());
	for(int i=0;i<g.size();i++)
	{
		if(f(get<1>(g[i]))!=f(get<2>(g[i])))
		{
			un(get<1>(g[i]),get<2>(g[i]));
			mst+=get<0>(g[i]);
		}
	}
	printf("%lld",mst);
}

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

int main(){
  string S,T; cin >> S >> T;
  char a;
  bool flag = false;

  for(int i = 0;i < S.size();i++){
    a = S[S.size()-1];
    S.pop_back();
    S.insert(S.begin(),a);
    if(S == T){
      flag = true;
      break;
    }
  }

  if(flag)cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	uf := make([]int, n)
	cc := make([]int, n)
	for i := 0; i < n; i++ {
		uf[i] = i
	}
	for i := 0; i < m; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		ra := root(a, uf)
		rb := root(b, uf)
		if ra == rb {
			continue
		}
		uf[rb] = ra
	}
	for i := 0; i < n; i++ {
		cc[root(i, uf)]++
	}
	var ans int
	for i := 0; i < n; i++ {
		if ans < cc[i] {
			ans = cc[i]
		}
	}
	fmt.Fprintln(writer, ans)
}
func root(i int, uf []int) int {
	if i == uf[i] {
		return i
	}
	uf[i] = root(uf[i], uf)
	return uf[i]
}


Measured memory_bytes: 8632
#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int a, b, k;

    cin >> a >> b >> k;
    int menor;
    if (a < b) {
        menor = a;
    }
    else {
        menor = b;
    }

    int qtd = 0;
    for (int i = menor; i >= 0; i--) {
        if (a % i == 0 && b % i == 0) {
           qtd++;
        }   
        if (qtd == k) {
            cout << i << endl;
            break;
        }
    }
    

    return 0;
}

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

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

int main() {
    int x;
    cin >> x;
    
    long int a5, b5;
    a5 = b5 = 1;
    int a, b;
    a = 1;
    b = -200;
    
    for(a = 1; a < 200; a++) {
        rep(i,5) {
            a5 *= a;
        }
        for(b = -200; b < a; b++) {
            rep(i,5) {
                b5 *= b;
            }
            if(a5 - b5 == x) {
                break;
            }
            b5 = 1;
        }
        if(a5 - b5 == x) {
            break;
        }
        a5 = 1;
    }
    
    cout << a << " " << b << endl;
    
    return 0;
}



Measured memory_bytes: 3600
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            int S = int.Parse(Console.ReadLine());
            int s = S % 60;
            int m = ((S - s) / 60) % 60;
            int h = ((S - s) / 60 - m) / 60;
            Console.WriteLine("{0}:{1}:{2}",h,m,s);
        }
    }
}

Measured memory_bytes: 9188
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int N, M;
int pSeg[1 << 19];

void update(int k, int x)
{
	k += (1 << 18) - 1;
	pSeg[k] = x;
	
	while (k){
		k = (k - 1) / 2;
		pSeg[k] = min(pSeg[k * 2 + 1], pSeg[k * 2 + 2]);
	}
}

int getMin(int a, int b, int k, int l, int r)
{
	if (b <= l || r <= a){
		return (1 << 30);
	}
	
	if (a <= l && r <= b){
		return (pSeg[k]);
	}
	int lch = getMin(a, b, k * 2 + 1, l, (l + r) / 2);
	int rch = getMin(a, b, k * 2 + 2, (l + r) / 2, r);
	
	return (min(lch, rch));
}

int main(void)
{
	static int rSum[100000];
	
	while (1){
		scanf("%d %d", &N, &M);
		
		if (N + M == 0){
			break;
		}
		
		for (int i = 0; i < 1 << 19; i++) pSeg[i] = M;
		memset(rSum, 0, sizeof(rSum));
		
		for (int i = 0; i < N; i++){
			int t;
			scanf("%d", &t);
			rSum[i + 1] = (rSum[i] + (t % M)) % M;
		}
		int ans = 0;
		
		for (int i = 0; i < N; i++){
			update(rSum[i + 1], rSum[i + 1]);
			int lMin = getMin(0, rSum[i + 1], 0, 0, 1 << 18);
			int rMin = getMin(rSum[i + 1] + 1, M, 0, 0, 1 << 18);
			
			ans = max(max(ans, rSum[i + 1]), max(rSum[i + 1] - lMin, (rSum[i + 1] - rMin + M) % M));
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}

Measured memory_bytes: 3472
#include <iostream>
using namespace std;
int main()
{
    int i, j, k, h, w;
   
    cin >> h >> w;
    while(h>0 || w>0)
    {
        for(i=1; i<=h; i++)
        {
           
            for(j=1; j<=w; j++)
            {
               if(i%2!=0&&j%2==0||i%2==0&&j%2!=0)
                cout<<".";
              else
             cout<<"#";
            }
            cout << endl;
        }
        cout << endl;
        cin >> h >> w;
    }
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

const int MAX_N=500;

struct edge{
    int to,cap,rev;
};

vector<edge> G[MAX_N];
vector<int> check(MAX_N,0);

int dfs(int v,int t, int f ){
    if(v==t){return f;}
    check[v]=1;
    for(int i=0;i<G[v].size();i++){
        if(check[G[v][i].to]==0 && G[v][i].cap > 0){
            int ff =dfs(G[v][i].to,t,min(f,G[v][i].cap));
            if(ff>0){
                G[v][i].cap -= ff;
                G[G[v][i].to][G[v][i].rev].cap += ff;
                return ff;
            }
        }
    }
    return 0;
}

int maxflow(int s,int t){
    int flow = 0;
    while(1){
        fill(check.begin(),check.end(),0);
        int f = dfs(s,t,INT_MAX);
        if(f==0){return flow;}
        flow += f;
    }
}

int bipartite_matching_flow(int X, int Y, vector<pii> &edge_list){
    //X: ?????¨??°??????????????????????????°???Y: ???????????????????????°???edge_list: ??¨????????????????????§??¨???????????????
    for(int i=0;i<edge_list.size();i++){
        int s = edge_list[i].first;
        int t = edge_list[i].second;
        G[s].push_back((edge){X+t,1,G[X+t].size()});
        G[X+t].push_back((edge){s,0,G[s].size()-1});
    }

    for(int i=0;i<X;i++){
        G[X+Y].push_back((edge){i,1,G[i].size()});
        G[i].push_back((edge){X+Y,0,G[X+Y].size()-1});
    }

    for(int i=X;i<X+Y;i++){
        G[i].push_back((edge){X+Y+1,1,G[X+Y+1].size()});
        G[X+Y+1].push_back((edge){i,0,G[i].size()-1});
    }
    return maxflow(X+Y,X+Y+1);
}

int main(){
    int X,Y,E,s,t;
    cin >> X >> Y >> E;
    vector<pii> edge_list(E);
    REP(i, E){
        cin >> edge_list[i].first >> edge_list[i].second;
    }
    cout << bipartite_matching_flow(X, Y, edge_list) << endl;
    return 0;
}

Measured memory_bytes: 3440
import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        List<String> mae = new ArrayList<>();
        List<String> usiro = new ArrayList<>();

        for (int i=0;i<s.length();++i)
        {
            mae.add(s.substring(i,i+1));
        }

        for (int i=s.length()-1;i >= 0;--i)
        {
            usiro.add(s.substring(i,i+1));
        }

        for (int i=0;i<s.length();++i)
        {
            if (!mae.get(i).equals(usiro.get(i))) ++count;
        }

        System.out.println(count/2);

        sc.close();
    }

    public class Pair<F,S>
    {
        private final F first;
        private final S second;

        Pair(F first,S second)
        {
            this.first = first;
            this.second = second;
        }

        public void print() { System.out.println("("+this.first+","+this.second+")"); }

        //get
        public F first() {return this.first;}
        public S second() {return this.second;}

        @Override
        public boolean equals(Object object)
        {
            if (object instanceof Pair)
            {
                Pair pair = (Pair)object;
                return this.first==pair.first && this.second==pair.second;
            }else
            {
                return false;
            }
        }

        @Override
        public int hashCode()
        {
            return Objects.hash(first,second);
        }
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, K; cin >> N >> K;
    vec a(N); readvec(a);

    int ans = 0;
    REP(i, N) ans += max(a[i], 0LL);

    vec sum1(N + 1, 0), sum2(N + 1, 0);
    REP(i, N){
        sum1[i + 1] = sum1[i] + a[i];
        sum2[i + 1] = sum2[i] + max(a[i], 0LL);
    }
    int m = INF;
    FOR(i, K, N + 1) m = min(m, sum2[i] - sum2[i - K] - max(0LL, sum1[i] - sum1[i - K])); 
    ans -= m;
    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 2560
#include<iostream>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;

int main() {
    int N,M;
    cin >> N >> M;
    vector<int> p(M);
    // vector<int> y(M);
    vector< pair<int, int> > order(M);
    vector<int> cnt(N,0);
    for (int i = 0; i < M; i++) {
        cin >> p[i] >> order[i].first;
        order[i].second = i;
    }
    sort(order.begin(), order.end());
    for (int i = 0; i < M; i++) {
        cnt[p[order[i].second]-1]++;
        int tmp = cnt[p[order[i].second]-1];
        order[i].first = order[i].second;
        order[i].second = tmp;
    }
    sort(order.begin(), order.end());
    for (int i = 0; i < M; i++) {
        cout << setw(6) << setfill('0') << p[i];
        cout << setw(6) << setfill('0') << order[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
void outvi(vi v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void outvvi(vvi v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
ll n;cin>>n;
vi v(n);
rep(i,n){
ll k;cin>>k;
v[k-1]++;
}
sort(all(v));
vi rui(n+1);
rui[0]=0;
REP(i,1,n+1)rui[i]=v[i-1]+rui[i-1];
rep(i,n){
ll ok=0,ng=n+1;
while(ng-ok>1){
ll mid=(ok+ng)/2;
ll u=lb(v,mid);
if((i+1)*mid<=(n-u)*mid+rui[u])ok=mid;
else ng=mid;
}
cout<<ok<<endl;
}
}

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

a=[0]*q
for i in range(q):
  a[i] = int(input())


score = [k-q]*n

for i in range(q):
  score[a[i]-1] += 1

ret = ["Yes" if si>0 else "No" for si in score]

for i in range(n):
  print(ret[i])

Measured memory_bytes: 11244
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int a=sc.nextInt();
        int b=sc.nextInt();

        if((a*b)%2==1){
            System.out.println("Odd");
        }else{
            System.out.println("Even");
        }
    }
}

Measured memory_bytes: 21332
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N = Int()
A = IntList()

B = []

for i in range(N):
    B.append(-A[i]-(i+1))
    A[i] -= i+1
    
from collections import defaultdict

G = defaultdict(list)

for i in range(N):
    G[A[i]].append(i)
    
ans = 0
import bisect

for i in range(N):
    query = B[i]
    L = len(G[query]) - bisect.bisect(G[query],i)
    ans += L

print(ans)

Measured memory_bytes: 151152
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 
 
int32_t main()
{
    fast;
    int a, b; char o;
    cin >> a >> o >> b;
    if(o == '+') cout << a+b;
    else cout << a - b;
    
    
    
    return 0;
}

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

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;

string to_string(string s) { return s; }
template <class S>
string to_string(unordered_set<S> s);
template <class S>
string to_string(set<S> s);
template <class S, class T>
string to_string(map<S, T> m);
template <class T>
string to_string(vector<T> v);

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S>
string to_string(set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

ll euclidean_gcd(ll a, ll b) {
  if (a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int N, U, V;
  cin >> N >> U >> V;
  vector<vector<int>> G(N);
  FOR(i, N - 1) {
    int a, b;
    cin >> a >> b;
    G[a - 1].push_back(b - 1);
    G[b - 1].push_back(a - 1);
  }
  vector<int> dista(N), distb(N);
  int teban = 0;
  function<void(int, int)> dfs = [&](int u, int pre) {
    for (int v : G[u]) {
      if (pre != v) {
        if (teban == 0) {
          dista[v] = dista[u] + 1;
        } else {
          distb[v] = distb[u] + 1;
        }
        dfs(v, u);
      }
    }
  };
  dfs(U - 1, -1);
  teban = 1;
  dfs(V - 1, -1);
  int ans = 0;
  FOR(i, N) {
    if (G[i].size() == 1) {
      int v = G[i][0];
      if (distb[U - 1] % 2 == 1) {
        if (dista[i] <= distb[v] && dista[i] <= distb[i]) {
          ans = max(ans, distb[v]);
        }
      } else {
        if (dista[i] <= distb[v] && dista[i] <= distb[i]) {
          ans = max(ans, distb[v]);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12928
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int x, a;
  cin >> x >> a;
  if(x < a) cout << 0 << endl;
  else cout << 10 << endl;
}


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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e6 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

void megaRandom() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  srand(FOR);
}

int n, a[N];
int cnt[5];

int main() {
	megaRandom();
	cin >> n;
	for(int i = 1; i <= n; i ++) {
		cin >> a[i];	
		cnt[a[i] % 2] ++;
	}	
	if(cnt[1] % 2) cout << "NO";
	else cout << "YES";
	return 0;         
}


Measured memory_bytes: 640
#include<cstdio>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<complex>
#define inf 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define ll long long
#define pii pair<int,int> 
const int N=1e6+10;
const int mod=1e9+7;
using namespace std;


void solve(){
	 double r; cin>>r;
	 double pi=acos(-1.0);
	 cout<<2*pi*r<<endl;
}
int main() 
{
    int _=1;  //scanf("%d",&_);
    while(_--) solve();
return 0;
}
/*
*/




Measured memory_bytes: 3260
s = gets.chomp
k = gets.to_i
n = s.size

abc = ('a'..'z').to_a

(0..n-1).each do |i|
  ss = s[i]
  next if ss == 'a'
  t = 26 - abc.index(ss)
  if t <= k
    s[i] = 'a'
    k -= t
  end
end

s[n-1] = abc[(abc.index(s[n-1]) + k) % 26]

puts s

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

signed main () {
	int n, m;
	cin >> n >> m;
	multiset < int > a;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		a.insert(x);
	}
	int64_t ans = 0;
	while (m && *prev(a.end())) {
		int x = *prev(a.end());
		a.erase(prev(a.end()));
		a.insert(x / 2);
		--m;
	}
	for (int x: a)
		ans += x;
	cout << ans << '\n';
}


Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  ll m;
  while (cin >> n >> m && n && m) {
    vector<ll> a, b, c, d;
    a.push_back(0);
    b.push_back(0);
    c.push_back(0);
    d.push_back(0);
    REP(i, n) {
      ll p;
      cin >> p;
      a.push_back(p);
      b.push_back(p);
      c.push_back(p);
      d.push_back(p);
    }
    a.push_back(1e9);
    b.push_back(1e9);
    c.push_back(1e9);
    d.push_back(1e9);
    vector<ll> ab;
    REP(i, a.size()) REP(j, b.size()) ab.push_back(a[i] + b[j]);
    sort(ALL(ab));
    ll ans = -1e18;
    REP(i, c.size()) REP(j, d.size()) {
      ll k = m - (c[i] + d[j]);
      if (k < 0) continue;
      int ok = 0, ng = ab.size() - 1;
      while (1 < abs(ok - ng)) {
        int mid = (ok + ng) / 2;
        if (ab[mid] <= k)
          ok = mid;
        else
          ng = mid;
      }
      ans = max(ans, c[i] + d[j] + ab[ok]);
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 18964
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <list>
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
 
// #define int ll
 
using namespace std;
 
bool test = 0;
 
/* ?????????????????¬??¨ */
 
int main(){
  int i,j,k,l;
  int n;
  while(scanf("%d",&n) != EOF) {
    if(n == 0) break;
    int score[2] = {0};
    for(i=0;i<n;i++) {
      int num[2];
      cin >> num[0] >> num[1];
      auto sum = num[0]+num[1];
      if(num[0] > num[1]) score[0] += sum;
      else if(num[0] < num[1]) score[1] += sum;
      else {
        for(j=0;j<2;j++) score[j] += num[j];
      }
    }
    printf("%d %d\n",score[0],score[1]);
  }
  return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<int>dam(n),yama(n);
  rep(i,n)cin>>dam[i];
  ll s=0;
  rep(i,n)s+=dam[i];
  rep(i,n)
  {
    if(i%2==1)
    {
      s-=(ll)dam[i]*2;
    }
  }
  yama[0]=s;
  rep(i,n-1)
  {
    yama[i+1]=(ll)dam[i]*2-yama[i];
  }
  rep(i,n)cout<<yama[i]<<"\n";
  cout<<flush;

}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int k, tx, ty;
	cin >> k >> tx >> ty;
	int x_neg = tx < 0 ? -1 : 1;
	int y_neg = ty < 0 ? -1 : 1;
	tx = abs(tx), ty = abs(ty);
	
	if(k % 2 == 0 && (tx+ty) % 2 == 1) {
		cout << -1 << endl;
		return 0;
	}
	
	vector<pair<int, int>> ans;
	int n = (tx+ty+k-1)/k;
	if(n == 1 && tx+ty != k) n++;
	while((n*k-tx-ty)%2 != 0) n++;
	//$ cerr << n << endl;
	int b = (n*k - tx - ty) / 2;
	int x = 0, y = 0;
	//$ cerr << b << endl;
	while(b > k) {
		if(abs(x - tx) < abs(y - ty)) {
			x -= k;
		} else {
			y -= k;
		}
		ans.emplace_back(x, y);
		b -= k;
	}
	if(b > 0) {
		if(abs(x - tx) < abs(y - ty)) {
			x -= b;
			y += k - b;
		} else {
			x += k - b;
			y -= b;
		}
		ans.emplace_back(x, y);
	}
	
	//$ for(auto& p : ans) {
		//$ cerr << p.first << ' ' << p.second << endl;
	//$ }
	
	int it = 0;
	while((x != tx || y != ty)/* && it++ < 5 */) {
		if(x != tx) {
			if(x + k <= tx) {
				x += k;
			} else {
				int dy = k - (tx - x);
				x = tx;
				y += dy;
			}
			ans.emplace_back(x, y);
		} else {
			y += k;
			ans.emplace_back(x, y);
		}
	}
	
	cout << ans.size() << endl;
	for(auto& p : ans) {
		p.first *= x_neg;
		p.second *= y_neg;
		cout << p.first << ' ' << p.second << '\n';
	}
}


Measured memory_bytes: 3952
#include<iostream>
#include<algorithm>
#include<string>
#include<set>
using namespace std;


int main(){
	int const N_MAX=100000;
	int n,a[N_MAX],ans=0,num[N_MAX],j;

	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)num[i]=0;
	sort(a,a+n);
	for(int i=0;i<n;i++){
		for(j=i;j<n;j++){
			if(a[i]==a[j])num[i]++;
			else break;
		}
		i=j-1;
	}
	for(int i=0;i<n;i++)
		ans+=num[i]%2;
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int MOD = 1e+7;

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

  int64_t n, k;
  cin >> n >> k;
  int64_t t = n % k;
  cout << min(t, k-t) << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
char s[100001];
int main()
{
	scanf("%s",s+1);
	int r=strlen(s+1);
	while(r>=1){
		if(s[r]=='r'&&s[r-1]=='e'&&s[r-2]=='m'&&s[r-3]=='a'&&s[r-4]=='e'&&s[r-5]=='r'&&s[r-6]=='d'){
			r-=7;
		}else if(s[r]=='m'&&s[r-1]=='a'&&s[r-2]=='e'&&s[r-3]=='r'&&s[r-4]=='d'){
			r-=5;
		}else if(s[r]=='e'&&s[r-1]=='s'&&s[r-2]=='a'&&s[r-3]=='r'&&s[r-4]=='e'){
			r-=5;
		}else if(s[r]=='r'&&s[r-1]=='e'&&s[r-2]=='s'&&s[r-3]=='a'&&s[r-4]=='r'&&s[r-5]=='e'){
			r-=6;
		}else{
			break;
		}
	}
	printf("%s\n",r<=0?"YES":"NO");
	return 0;
}

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

struct edge {
	int s, t, d;
};

int v, e, r, ct = 0;
edge es[2000];
long d[1000];
const long Mx = 0xFFFFFFF;

int main()
{
	cin >> v >> e >> r;

	for (int i = 0; i < e; i++)
		cin >> es[i].s >> es[i].t >> es[i].d;

	for (int i = 0; i < v; i++)
		d[i] = Mx;

	d[r] = 0;

	while (true) {
		bool f = true;
		for (int i = 0; i < v; i++) {
			for (int j = 0; j < e; j++) {
				edge e = es[j];
				if (d[e.s] != Mx && d[e.t] > d[e.s] + e.d) {
					d[e.t] = d[e.s] + e.d;
					f = false;
				}
			}
		}
		ct++;
		if (ct > v || f)
			break;
	}

	if (ct > v)
		cout << "NEGATIVE CYCLE" << endl;
	else {
		for (int i = 0; i < v; i++) {
			if (d[i] == Mx)
				cout << "INF" << endl;
			else
				cout << d[i] << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3112