akhauriyash/Code-Regression huggingface dataset:
function main(input) {
  input=input.trim()
  const N = parseInt(input.split(" ")[0], 10);
  var a=Math.floor(N/111);
  if(N%111==0){
    console.log(111*a);
  }else{
    console.log(111*(a+1));
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

namespace D_SMTB2019
{
    class MainClass
    {

        static int[] nin;

        public static void Main(string[] args)
        {
            nin = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            int n = nin[0];
            string s = ReadLine();
            int cnt = 0;
            for (int i = 0; i < 1000; i++)
            {
                int c = 0;
                int[] tmp = new int[3] { i / 100, (i % 100) / 10, i % 10 };
                //WriteLine("{0}{1}{2}",tmp[0],tmp[1],tmp[2]);
                for (int j = 0; j < n; j++)
                {
                    
                    if (tmp[c] == (s[j]-'0')) c++;
                    if (c == 3){
                        cnt++;
                        break;
                    }
                }


            }

            WriteLine(cnt);




        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n;
    cin>>n;
    n=n%10;
    if (n==3)
        cout<<"bon"<<endl;
    else if (n==0||n==1||n==6||n==8)
          cout<<"pon"<<endl;
     else
        cout<<"hon"<<endl;












    return 0;
}


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

struct UnionFind {
  vector<int> parent;
  vector<int> size;

  UnionFind(int n) : parent(n, -1), size(n, 1) {}

  int find(int i) {
    if (parent[i] == -1) {
      return i;
    }
    return parent[i] = find(parent[i]);
  }

  void unite(int i, int j) {
    i = find(i);
    j = find(j);
    if (i == j) {
      return;
    }
    if (size[i] < size[j]) {
      parent[i] = j;
      size[j] += size[i];
    } else {
      parent[j] = i;
      size[i] += size[j];
    }
  }
  int get_size(int i) {
    return size[find(i)];
  }
};
int main() {
  int n, m, k;
  cin>>n>>m>>k;
  vector<int> fr[n], block[n];
  UnionFind uf(n);
  for (int i=0; i<m; i++) {
    int a, b;
    cin>>a>>b;
    --a; --b;
    fr[a].push_back(b);
    fr[b].push_back(a);
    uf.unite(a, b);
  }
  for (int i=0; i<k; i++) {
    int a, b;
    cin>>a>>b;
    --a; --b;
    block[a].push_back(b);
    block[b].push_back(a);
  }
  int ans[n];
  for (int i=0; i<n; i++) {
    ans[i] = uf.get_size(i) - 1;
    for (int f: fr[i]) {
      if (uf.find(i) == uf.find(f)) {
        --ans[i];
      }
    }
    for (int f: block[i]) {
      if (uf.find(i) == uf.find(f)) {
        --ans[i];
      }
    }
  }
  for (int i=0; i<n; i++) {
    cout<<ans[i];
    if (i != n - 1) {
      cout<<" ";
    }
  }
  cout<<endl;
}

Measured memory_bytes: 13048
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
ll MOD;

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,c;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[200010];//適宜変える(ecnt)
	int inv[200010];//逆辺のindex(ecnt)
	int id[100010];//適宜変える(vcnt)
}G;
G g;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}
void makeinvedge();
void readgraph(){
	//適宜変える
	ll n;
	scanf("%lld%lld",&n,&MOD);
	rep(i,0,n-1){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		g.e[2*i].s=x;
		g.e[2*i].g=y;
		g.e[2*i+1].s=y;
		g.e[2*i+1].g=x;
	}
	g.vcnt=n;
	g.ecnt=2*n-2;
	qsort(g.e,g.ecnt,sizeof(E),esort);
	makeinvedge();

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}


//*
void makeinvedge(){
	//逆辺とidx
	rep(i,0,g.ecnt){
		int l=0,r=g.ecnt;
		while(r-l>1){
			int m=(l+r)/2;
			if(g.e[m].s<g.e[i].g||(g.e[m].s==g.e[i].g&&g.e[m].g<=g.e[i].s))l=m;
			else r=m;
		}
		if(g.e[l].s!=g.e[i].g||g.e[l].g!=g.e[i].s){
			g.e[g.ecnt].s=g.e[i].g;
			g.e[g.ecnt].g=g.e[i].s;
			g.e[g.ecnt].c=0;
			g.ecnt++;
		}
	}
	qsort(g.e,g.ecnt,sizeof(E),esort);
	rep(i,0,g.ecnt){
		int l=0,r=g.ecnt;
		while(r-l>1){
			int m=(l+r)/2;
			if(g.e[m].s<g.e[i].g||(g.e[m].s==g.e[i].g&&g.e[m].g<=g.e[i].s))l=m;
			else r=m;
		}
		g.inv[i]=l;
	}
}
//*/



//†全方位木DP†
//*
ll dp1[100010];//頂点に対する答え
ll dp2[200010];//辺に対する答え
ll cum[2][200010];//累積和
ll munit=1;//単位元
ll monoop(ll x,ll y){return x*y%MOD;}//演算

ll dfs2(int);
ll dfs1(int v){
	if(dp1[v]!=-1)return dp1[v];
	rep(i,g.id[v],g.id[v+1]){
		if(i==g.id[v])cum[0][i]=munit;
		else cum[0][i]=monoop(cum[0][i-1],dfs2(i-1)+1);
	}
	for(int i=g.id[v+1]-1;i>=g.id[v];i--){
		if(i==g.id[v+1]-1)cum[1][i]=munit;
		else cum[1][i]=monoop(cum[1][i+1],dfs2(i+1)+1);
	}
 
	ll temp=munit;
	rep(i,g.id[v],g.id[v+1])temp=monoop(temp,dfs2(i)+1);
	return dp1[v]=temp;
}
ll dfs2(int e){
	if(dp2[e]!=-1)return dp2[e];
	if(dp1[g.e[e].g]!=-1){
		return dp2[e]=monoop(cum[0][g.inv[e]],cum[1][g.inv[e]]);
	}
	ll temp=munit;
	int v=g.e[e].g;
	rep(i,g.id[v],g.id[v+1]){
		if(g.e[i].g!=g.e[e].s)temp=monoop(temp,dfs2(i)+1);
	}
	return dp2[e]=temp;
}
//*/


//dfs
void dfs(int v,int pre){
	dfs1(v);
	rep(i,g.id[v],g.id[v+1]){
		if(g.e[i].g!=pre){
			dfs(g.e[i].g,v);
		}
	}
}
 
int main(){
	readgraph();
	rep(i,0,g.vcnt)dp1[i]=-1;
	rep(i,0,g.ecnt)dp2[i]=cum[0][i]=cum[1][i]=-1;
	dfs(0,-1);
	rep(i,0,g.vcnt)printf("%lld\n",dp1[i]);
}

Measured memory_bytes: 20344
# include <cstdio>
# include <cstring>

# define REP(i, n) FOR (i, 1, n)
# define REP_0(i, n) for (int i = 0; i < n; ++ i)
# define REP_0N(i, n) FOR (i, 0, n)
# define REP_D(i, n) DWN (i, 1, n)
# define FOR(i, a, b) for (int i = a; i <= b; ++ i)
# define DWN(i, a, b) for (int i = b; i >= a; -- i)
# define RST(a) memset (a, 0, sizeof (a))
# define NR 2010

const int mod = 924844033;

int fac[NR], f[NR][NR][4], h[NR], tmp[NR];

void inc (int &x, int y) { x = (x + y) % mod; }

void calc (int n) {
	RST (f);
	RST (tmp);
	f[1][0][2] = 1;
	REP (i, n) REP_0N (j, i) REP_0 (k, 4) if (f[i][j][k] != 0) {
		inc (f[i + 1][j][(k >> 1) | 2], f[i][j][k]);
		if (k % 2 == 1) inc (f[i + 1][j + 1][(k >> 1) | 2], f[i][j][k]);
		if (i != n) inc (f[i + 1][j + 1][k >> 1], f[i][j][k]);
	}
	REP_0N (i, n) REP_0 (k, 4) inc (tmp[i], f[n + 1][i][k]);
}

int main () {
	int n, K;
	scanf ("%d%d", &n, &K);
	fac[0] = 1;
	REP (i, n) fac[i] = 1ll * fac[i - 1] * i % mod;
	
	calc (n / K + 1);
	
	h[0] = 1;
	REP_0 (i, n % K) {
		REP_D (j, n) {
			int s = 0;
			REP_0N (k, n / K + 1) {
				if (j >= k) inc (s, 1ll * tmp[k] * h[j - k] % mod);
				else break;
			}
			h[j] = s;
		}
	}
	
	calc (n / K);
	//REP_0N (i, n) printf ("%d ", tmp[i]); puts ("");
	FOR (i, n % K, K - 1) {
		REP_D (j, n) {
			int s = 0;
			REP_0N (k, n / K) {
				if (j >= k) inc (s, 1ll * tmp[k] * h[j - k] % mod);
				else break;
			}
			h[j] = s;
		}
		//REP_0N (t, n) printf ("%d ", h[t]); puts ("");
	}
	
	int ans = fac[n];
	int sgn = 1;
	REP (i, n) {
		sgn = -sgn;
		int f = 1ll * h[i] * fac[n - i] % mod;
		ans += sgn * f;
		if (ans < 0) ans += mod;
		if (ans >= mod) ans -= mod;
	}
	printf ("%d\n", ans);
	return 0;
}

Measured memory_bytes: 63488
#include <bits/stdc++.h>
using namespace std;
const int N = 500000;
const int mod = 1000000007;
typedef long long LL;
int n, a[N];
map<int, int> m;
int main() {
#ifdef TEST
	freopen("input.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0, u; i < n; ++i) {
		scanf("%d", &u);
		m[u]++;
	}
	if (m.size() > 3) {
		printf("No\n");
		return 0;
	}
	for (auto &i : m) {
		for (auto &j : m) {
			auto t = m;
			int fir = i.first;
			int sec = j.first;
			t[fir]--;
			t[sec]--;
			a[0] = fir;
			a[1] = sec;
			if (t[j.first] < 0) continue;
			for (int i = 2; i < n; ++i) {
				a[i] = a[i - 1] ^ a[i - 2];
				t[a[i]]--;
				if (t[a[i]] < 0) goto label;
			}
			if (a[n - 1] == (a[0] ^ a[n - 2])) {
				printf("Yes\n");
				return 0;
			}
		label:
			continue;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 3840
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; 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;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

int N;
string S;

int main() {
  cin >> N;
  cin >> S;

  if (N % 2 == 1) {
    cout << "No";
    return 0;
  }

  for (int i = 0; i < S.size() / 2; ++i) {
    if (S[i] != S[i + S.size() / 2]) {
      cout << "No";
      return 0;
    }
  }

  cout << "Yes";
}


Measured memory_bytes: 3580
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, atan2, degrees
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**8)

INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, m = LI()
G = [[] for _ in range(n)]
for _ in range(m):
    s, t = LI()
    G[s - 1] += [t - 1]

route_len = [0] * n
for u in range(n - 2, -1, -1):
    route_len[u] = sum([route_len[v] + 1 for v in G[u]]) / len(G[u])


prob = [0] * n
prob[0] = 1
for u in range(n - 1):
    for v in G[u]:
        prob[v] += prob[u] / len(G[u])


ans = route_len[0]
for u in range(n - 1):
    if len(G[u]) == 1:
        continue
    new_route_len = (sum([route_len[v] + 1 for v in G[u]]) - max([route_len[v] + 1 for v in G[u]])) / (len(G[u]) - 1)
    ans = min(ans, route_len[0] - prob[u] * (route_len[u] - new_route_len))



print(ans)

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

namespace ans
{
  int val=0;
}

int main()
{
  int h,w,H,W;
  cin>>H>>W>>h>>w;
  int tot=H*W;
  int a1=h*W;
  int a2=(H-h)*w;
  //cout<<a1<<endl;
  //cout<<a2<<endl;
  ans::val=tot-a1-a2;
  cout<<ans::val<<endl;
  
  return 0;
}


Measured memory_bytes: 3584
// AT A
// DeP
#include <cstdio>
#include <cstring>

typedef long long LL;
const int MAXN = 105;

int n; LL K, ans;
char S[MAXN];

int main() {
    scanf("%s%lld", S, &K);
    n = strlen(S);
    bool AllSame = true;
    for (int i = 1; i < n; ++i)
        if (S[i] != S[i-1]) { AllSame = false; break; }
    if (AllSame) {
        ans = n * K / 2;
    } else {
        int a = 1, b = 1, L = 1;
        for (int i = 1; i < n; ++i) {
            if (S[i] != S[i-1]) {
                ans += L / 2;
                // printf("#%d\n", L);
                L = 1;
            } else ++L;
        }
        ans += L/2; ans *= K;
        // printf("!%lld\n", ans);
        if (S[0] == S[n-1]) {
            while (S[a-1] == S[a]) ++a;
            while (S[n-b] == S[n-b-1]) ++b;
            // printf("%d %d\n", a, b);
            ans -= (a/2 + b/2 - (a+b)/2) * (K-1);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

#define INF 10000000
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void shortestPath(const Graph &g, int s, vector<Weight> &dist, vector<int> &prev) {
  int n = g.size();
  dist.assign(n, INF); dist[s] = 0;
  prev.assign(n, -1);
  
  priority_queue<Edge> Q; // "e < f" <=> "e.weight > f.weight"
  for (Q.push(Edge(-2, s, 0)); !Q.empty(); ) {
    Edge e = Q.top(); Q.pop();
    if (prev[e.dst] != -1) continue;
    prev[e.dst] = e.src;
    FOR(f,g[e.dst]) {
      if (dist[f->dst] > e.weight+f->weight) {
        dist[f->dst] = e.weight+f->weight;
        Q.push(Edge(f->src, f->dst, e.weight+f->weight));
      }
    }
  }
}

int main(int argc, char* argv[]){
  int n;

  cin >> n;
  
  Graph graph;

  for(int i = 0; i < n; i++){
    int from, k;
    
    cin >> from >> k;

    Edges edges;    

    for(int j = 0; j < k; j++){
      int to, cost;
      cin >> to >> cost;
      
      Edge edge(from, to, cost);
      edges.push_back(edge);
    }
    // cout << edges.size();

    graph.push_back(edges);
  }

  vector<Weight> dist(n);
  vector<int> prev(n);
  
  shortestPath(graph, 0, dist, prev);

  for(int i = 0; i < n; i++){
    cout << i << " " << dist[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 7340
#include <stdio.h>

int main(){
    int n,i;
    int a[100];
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    
    for(i=n-1;i>0;i--){
        printf("%d ",a[i]);
    }
    
    printf("%d\n",a[0]);
    
    return 0;
}

Measured memory_bytes: 1752
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(var) (var).begin(), (var).end()
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

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

	for(i=k;i<n;i++)
	{
		if(a[i] > a[i-k])
		{
			cout << "Yes\n";
		}
		else
		{
			cout << "No\n";
		}
	}	
	return 0;
}

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

int main() {
    
    string s;
    cin >> s;
    long long len;
    len = s.length();
    for(int i=0; i<len; i++){
        cout << "x";
    }
    cout << endl;
    
    
	return 0;
}

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

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

    int n, t;
    cin >> n >> t;

    int r = 0, b = -t;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        r += t;
        if (a - b < t) r -= t - (a - b);
        b = a;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    int sz = S.size();
    int ans = 0;
    for( int i=0; i<sz; i++){
        if(S[i] == '+'){
            ans++;
        }else if(S[i] == '-'){
            ans--;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
# coding: utf-8
# Your code here!
n,k = map(int,input().split())

a = list(map(int,input().split()))

b = [1 for i in range(n)]


now = 0
next = a[now] - 1
c = []
for i in range(n):
    if b[next] == 0:
        d = c[:c.index(next)]
        e = c[c.index(next):]
        #print(d,e)
        break
    #print(now)
    b[now] = 0
    c.append(now)
    next = a[now] - 1
    #print(" ",next)
    now = next

if k >= len(d):
    k = k - len(d)
    k = k % len(e)
    print(e[k]+1)

else:
    print(d[k]+1)
        
    


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

int main(){
  ll n,k;
  cin >> n >> k;
  ll dp[100005];
  ll h[100005];
  for(int i = 0;i < n;i++)
  {
      cin >> h[i];
  }
  for (int i = 0; i < n; i++)
  {
    dp[i]=-1;
  }
  
  dp[0] = 0;
  if(k==1){
    ll ans=0;
    for (int i = 0; i < n-1; i++)
    {
      ans+=abs(h[i]-h[i+1]);
    }
    cout << ans;
    return 0;
    
  }
  for (int i = 1; i < k; i++)
  {
    dp[i]=abs(h[i]-h[0]);
  }
  if(k>=n){
    cout << abs(h[n-1]-h[0]);
    return 0;
  }
  
  for(int i = k;i < n;i++)
  {
    for (int x = 1; x < k; x++)
    {
      ll temp = min(dp[i-x]+abs(h[i-x]-h[i]), dp[i-x-1]+abs(h[i-x-1]-h[i])); 
      if(dp[i]!=-1){
        dp[i] = min(dp[i],temp); 
      }
      else{
        dp[i] = temp;
      }
    }
  }
  cout << dp[n-1];
}

Measured memory_bytes: 1792
n = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(n-2):
    if (p[i]<p[i+1] and p[i+1]<p[i+2]) or (p[i]>p[i+1] and p[i+1]>p[i+2]) :
        count += 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

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

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


    cout << ceil((float)n/(2*d+1)) << endl;

    return 0;
    




}


Measured memory_bytes: 256
N=int(input())
pre=0
ans=0
for i in range(N):
    a=int(input())
    if i==0 and a!=0:
        print(-1)
        exit()
    if i>0:
        if pre+1<a:
            print(-1)
            exit()
        if a==pre+1:
            ans+=1
        elif pre>=a:
            ans+=a
    pre=a
print(ans)

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n,x,ans=0;cin>>n;
    vector<int> a(n),b(n);
    lint asum=0,bsum=0,fusoku=0;
    for(int i=0;i<n;i++){cin>>x;a[i]=x;asum+=x;}
    for(int i=0;i<n;i++){cin>>x;b[i]=x;bsum+=x;}
    if(asum<bsum){cout<<-1<<endl;return 0;}
    vector<int> zaiko(0);
    for(int i=0;i<n;i++){
        if(a[i]<b[i]){ans++;fusoku+=b[i]-a[i];}
        else zaiko.pb(a[i]-b[i]);
    }
    sort(all(zaiko),greater<int>());
    int pointer=0;
    while(fusoku>0){
        fusoku-=zaiko[pointer];
        pointer++;ans++;
    }
    cout<<ans<<endl;
}


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

typedef long long ll;
using namespace std;

int pot (ll q, ll w){
	ll qw = q;
	q = 1;
	for (int i = 0; i<w; i++)
		q*= qw;
	return q;
}

bool msf(long long a, long long b){
	return a>b;
}

ll n,a[105],d;
double zbr,m;

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

cin >> n >> m;
for (int i = 0; i<n; i++){
 cin >> a[i];
 zbr += a[i];
}
sort(a,a+n,msf);



for (int i = 0; i<m; i++){
	if (a[i] >= (1/(4*m))*zbr){
//		cout << a[i] << endl;	
		d++;
}
}
if (d == m)
	cout << "Yes";
else 
	cout << "No";

//cout << d;
return 0;
}



Measured memory_bytes: 256
Var x:Longint;
Function prime(x:Longint):Boolean;
    var i:Longint;
        OK:Boolean;
    Begin
        OK:=x>=2;
        For i:=2 to trunc(sqrt(x)) do
            If x mod i = 0 then begin
                OK:=False; Break;
            End;
        Exit(OK);
    End;
Begin
    Readln(x);
    While 1=1 do begin
        If prime(x) then begin
            Writeln(x); Break;
        End;
        Inc(x);
    End;
End.

Measured memory_bytes: 128
# 一日ごとに晴れ(Sunny)、くもり(Cloudy)、雨(Rainy)と周期的に変化
# 今日の天気を表す文字列 S が与えられるので、明日の天気を予測
# 制約: Sは Sunny, Cloudy, Rainy のいずれか

S = input()

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Measured memory_bytes: 8852
import sys, collections, heapq
def input(): return sys.stdin.readline().strip()

d = {'A': 0, 'B': 0, 'C': 0}
ans = []
S = []

def distribute(s):
    if d[s[0]] < d[s[1]]:
        d[s[0]] += 1
        d[s[1]] -= 1
        ans.append(s[0])
    else:
        d[s[0]] -= 1
        d[s[1]] += 1
        ans.append(s[1])

def main():
    N, A, B, C = map(int, input().split())
    summation = A + B + C
    d['A'], d['B'], d['C'] = A, B, C

    """
    最低3個は実験しないといけんですわ。。。
    まずA+B+Cが不変量なことに気づく（これはよし）
    そしたらA+B+C=0,1,2の場合に実験してみる。
    和が0の場合は明らかにアウト。和が1の場合は実際にN回通してみれば良い。

    和が2の場合は（これを試さなかったのが敗因！！！！！！）
        (A, B, C) = (2, 0, 0) or (1, 1, 0)
    の２パターン（ただし順不問）があるが、前者はBCの指示がきたらアウト。
    それ以外は後者に変化する。
    一方後者の場合はBC, CAの指示では変化なし、ABの指示で前者になる。
    このとき次の一手でドボンしないようにABのどちらを2にするか考えれば、
    再び後者に戻ってくる。

    つまり後者の安定型に初手でなれれば勝ち。このロジックはN>=3でも通じる。
    """

    if summation == 0:
        print("No")
        return

    if summation == 1:
        for _ in range(N):
            s = input()
            distribute(s)
            if d['A'] < 0 or d['B'] < 0 or d['C'] < 0:
                print("No")
                return
        print("Yes")
        for s in ans: print(s)

    if summation >= 2:
        for _ in range(N): S.append(input())
        S.append("AB") # sentry
        if d[S[0][0]] == 0 and d[S[0][1]] == 0:
            print("No")
            return
        print("Yes")

        for i in range(N):
            if d[S[i][0]] > 1 or d[S[i][1]] > 1:
                distribute(S[i])
            elif d[S[i][0]] == 0 or d[S[i][1]] == 0:
                distribute(S[i])
            else: # both are 1
                char_list = [S[i][0], S[i][1], S[i + 1][0], S[i + 1][1]]
                if S[i] == S[i + 1]:
                    distribute(S[i])
                elif char_list.count('A') == 2:
                    d['A'] += 1
                    d[S[i][1]] -= 1
                    ans.append('A')
                elif char_list.count('C') == 2:
                    d['C'] += 1
                    d[S[i][0]] -= 1
                    ans.append('C')
                else:
                    d['B'] += 1
                    if S[i] == "AB":
                        d['A'] -= 1
                    else:
                        d['C'] -= 1
                    ans.append('B')

        for s in ans: print(s)






if __name__ == "__main__":
    main()


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;
long long stint(string str) {
	long long ret;
	stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ll comb(ll n, ll k) {
	ll ans = 1;
	for (ll i = 0; i < min(k, n - k); i++) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}

void solve() {
	int x, y;
	cin >> x >> y;
	if (x % y == 0) {
		P(-1);
	}
	else {
		P(x);
	}
}

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


Measured memory_bytes: 256
s = int(input())
A = list()

for i in range(1,1000):
    if i == 1:
        A.append(s)
    else:
        if A[i-2]%2 == 0:
            G = int(A[i-2]/2)
            A.append(G)
        else:
            G = int(A[i-2]*3+1)
            A.append(G)
        if A.count(G) == 2:
            print(i)
            break

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

int main(){
    int n,l;
    cin >> n >> l;
    vector<string> s;
    string temp;
    for(int i = 0; i < n; i++){
        cin >> temp;
        s.push_back(temp);
    }

    sort(s.begin(),s.end());
    for(int i = 0; i < s.size(); i++){
        cout << s[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007


int dp[2010][2];

int main(){
	int n,z,w;
	cin >> n >> z >> w;
	VI a(n+1);
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}
	dp[n-1][0] = abs(a[n-1]-a[n]);
	dp[n-1][1] = abs(a[n-1]-a[n]);
	for(int i=n-1;i>=1;i--){
		dp[i][0] = abs(a[i]-a[n]);
		for(int k=i+1;k<n;k++){
			dp[i][0] = max(dp[i][0],dp[k][1]);
		}
		dp[i][1] = abs(a[i]-a[n]);
		for(int k=i+1;k<n;k++){
			dp[i][1] = min(dp[i][1],dp[k][0]);
		}
	}
	dp[0][0] = abs(w-a[n]);
	for(int i=1;i<n;i++){
		dp[0][0] = max(dp[0][0],dp[i][1]);
	}
/*	for(int i=0;i<=n;i++){
		cout << dp[i][0] << " " << dp[i][1] << endl;
	}*/
	cout << dp[0][0] << endl;
	return 0;
}

Measured memory_bytes: 888
import java.util.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws Exception
	{
		// your code goes here
		BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
		String s=bu.readLine();
		int i,flag=0;
		for(i=0;i<3;i++)
		if(s.charAt(i)=='7') {flag=1; break;}
		if(flag==1) System.out.print("Yes");
		else System.out.print("No");
	}
}

Measured memory_bytes: 32544
import sys

def fib(n):
  if n == 0:
    return 1
  elif n == 1:
    return 1
  else:
    return fib(n-1) + fib(n-2)

def main():
  input = sys.stdin.readline
  H, W, K = map(int, input().split())
  DP = [[0 for _ in range(W)] for _ in range(H+1)]
  DP[0][0] = 1
  for i in range(H):
    for j in range(W):
      if (j-1) >= 0:
        X = fib(j-1) * fib(W-(j+1))
        DP[i+1][j-1] += X * DP[i][j]

      if (j+1) <= (W-1):
        Z = fib(j) * fib(W-(j+2))
        DP[i+1][j+1] += Z * DP[i][j]

      Y = fib(j) * fib(W-(j+1))
      DP[i+1][j] += Y * DP[i][j]

  print(DP[H][K-1] % (10**9 + 7))


if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){

  int n,m,count=0;
  char u[257][11],t[257][11];
  
  cin>>n;
  for(int i=0;i<n;i++)
    scanf("%s",u[i]);

  cin>>m;
  for(int i=0;i<m;i++)
    scanf("%s",t[i]);

  for(int i=0;i<m;i++)
    for(int j=0;j<n;j++)
      if(strcmp(t[i],u[j])==0){
	count++;
	if(count%2==1)
	  cout<<"Opened by "<<t[i]<<endl;
	else
	  cout<<"Closed by "<<t[i]<<endl;
	break;
      }
      else if(j==n-1)
	  cout<<"Unknown "<<t[i]<<endl;
  return 0;
}

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

int main() {
  int N,d;
  d=1;
  cin >> N;
  vector<int> mochi(N);
  for(int i=0;i<N;i++){
    cin >> mochi.at(i);
  }
  sort(mochi.begin(), mochi.end());
  reverse(mochi.begin(), mochi.end());
  for(int i=0;i<(N-1);i++){
    if(mochi.at(i)>mochi.at(i+1)){
      d++;
    }
  }
    cout << d;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<>());
    if (s < t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
    }

    if b-a==c-b {
        println!("YES");
    } else {
        println!("NO");
    }

}


Measured memory_bytes: 2180
/* B Maximum Heap */
#include<stdio.h>

int heap_size;

void maxHeapify(int A[],int i);
void buildMaxHeap(int A[]);
int left(int i);
int right(int i);

int main(){
  int i;
  
  scanf("%d",&heap_size);
  int A[heap_size+1];

  /* scan A[1...heap_size] */
  for(i=1;i<=heap_size;i++){
    scanf("%d",&A[i]);
  }
  
  buildMaxHeap(A);

  /* print*/
  for(i=1;i<=heap_size;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int A[],int i){
  int temp;
  int l,r,largest;
  l=left(i);
  r=right(i);

  if(l<=heap_size&&A[l]>A[i]){
    largest=l;
  }else{
    largest=i;
  }
  if(r<=heap_size&&A[r]>A[largest]){
    largest=r;
  }
  if(largest!=i){
    temp=A[i];
    A[i]=A[largest];
    A[largest]=temp;
    maxHeapify(A, largest);
  }
}

void buildMaxHeap(int A[]){
  int i;
  for(i=heap_size/2;i>=1;i--){
    maxHeapify(A,i);
  }
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

Measured memory_bytes: 2360
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return;
		int ans = 0;
		for (int q = 1; q <= n-1; ++q) {
			int cnt = q;
			for (int j = 1; cnt + j + q <= n; j++) {
				cnt += j + q;
				if (cnt == n) {
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}
#undef int

int main() {
	init();
	solve();
}


Measured memory_bytes: 3112
#include <bits/stdc++.h> 
using namespace std;
#define ll long long 
#define mod 1000000007
#define MOD 99824435300000000
inline ll mul(ll a,ll b){
  a=(a+MOD)%MOD;
  b=(b+MOD)%MOD;
  ll c=a*b;
  c=(c+MOD)%MOD;
  return c;
}
inline ll add(ll a,ll b){
  a=(a+MOD)%MOD;
  b=(b+MOD)%MOD;
  ll ans=(a+b);
  ans=(ans+MOD)%MOD;
  return ans;
}

ll power(ll a,ll b,ll c){
  ll ans=1;
  while(b){
    if(b&1){
      ans=mul(ans,a);
    }
    a=mul(a,a);
    b=b/2;
  }
  return ans;
}
inline ll max(ll a,ll b){return a>b?a:b;}
inline ll min(ll a,ll b){return a<b?a:b;}
int main()
{
  int n; cin>>n;
  long double p[n];
  for(int i=0;i<n;++i)cin>>p[i];
  long double dp[n+1][n+5];
  memset(dp,0,sizeof(dp));
  dp[0][1]=p[0];
  dp[0][0]=1-p[0];
  for(int i=1;i<n;++i){
    for(int j=0;j<=i;++j){
      double fx=1-p[i];
      dp[i][j]=(dp[i-1][j])*fx;
    }
    for(int j=1;j<=i+1;j++){
      dp[i][j]=dp[i][j]+dp[i-1][j-1]*p[i];
    }
  }
  long double ans=0;
  int k=n/2+1;
  for(int i=k;i<=n;++i)ans=ans+dp[n-1][i];
  printf("%.16Lf\n",ans);
  return 0;
}

Measured memory_bytes: 141056
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <cmath>
#include <cassert>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define show(x) cerr << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll mergecount(vector<int> &a) {
  ll count = 0;
  int n = a.size();
  if (n > 1) {
    vector<int> b(a.begin(), a.begin() + n/2);
    vector<int> c(a.begin() + n/2, a.end());
    count += mergecount(b);
    count += mergecount(c);
    for (int i = 0, j = 0, k = 0; i < n; ++i)
      if (k == c.size())       a[i] = b[j++];
      else if (j == b.size())  a[i] = c[k++];
      else if (b[j] <= c[k])   a[i] = b[j++];
      else                   { a[i] = c[k++]; count += n/2 - j; }
  }
  return count;
}
int main(){
    string S;
    cin >> S;
    int N = (int) S.size();
    vector<int>A;
    int cnt[26] = {};
    rep(i,N){
        A.push_back(S[i]-'a');
        cnt[A[i]]++;
    }
    int man = -1;
    rep(i,26){
        if(cnt[i] % 2){
            if(man != -1){
                cout << -1 << endl;
                return 0;
            }
            man = i;
        }
    }
    vector<int>B;
    vector<int>C;
    vector<bool>used(N,false);
    int cnt2[26] = {};
    rep(i,N){
        if(cnt[A[i]]/2 > cnt2[A[i]]){
            cnt2[A[i]]++;
            used[i] = true;
            B.push_back(A[i]);
            C.push_back(A[i]);
        }
    }
    if(man!=-1)B.push_back(man);
    if(man!=-1)C.push_back(man);
    rep(i,N){
        if(!used[i] and A[i] == man){
            used[i] = true;
            break;
        }
    }
    rep(i,N){
        if(!used[i])B.push_back(A[i]);
    }
    rep(i,N/2){
        C.push_back(C[N/2-i-1]);
    }
    vector<int>D[26];
    vector<int>E(N);
    rep(i,N){
        D[A[i]].push_back(i);
    }
    rep(i,26)reverse(D[i].begin(),D[i].end());
    // show(A.size());
    // rep(i,N){
    //     cout << A[i] <<  " ";
    // }
    // cout << endl;
    // show(C.size());
    // rep(i,N){
    //     cout << C[i] << " ";
    // }
    // cout << endl;
    rep(i,N){
        E[i] = D[C[i]].back();
        D[C[i]].pop_back();
    }
    cout << mergecount(E) << endl;
}

Measured memory_bytes: 6176
import java.util.Scanner;
//
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		String s = sc.next();
		if (s.equals("AAA")||s.equals("BBB")) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
		
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		}
		//----------------------------------------
		//メソッド置き場
		
		//----------------------------------------
	}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned char ubyte;

const ld EPS = 1e-10;
const ld PI = acos(-1.0);
const int INF = (int)1e9 + 5;
const ll LINF = (ll)1e18 + 5;

template<class T> 
ll abs(const T & x) { return x < 0 ? -x : x; }

template<class T> 
ll round(const T & x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T> 
bool chmin(T & x, const T & y) {
	if (y < x) {
		x = y;
		return true;
	}
	return false;
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
		os << *it;
		if ((it + 1) != v.end()) os << ", ";
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template<class T> 
bool chmax(T & x, const T & y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

#define all(a) (a).begin(), (a).end()


int main() {
	srand(time(0));
#ifdef LOCAL 
	freopen("input.txt", "r", stdin);
#else
#endif

	int a, b;

	cin >> a >> b;

	if (a <= 0 && 0 <= b) {
		cout << "Zero" << endl;
	}
	else {
		int cntNeg = (a < 0 ? -a : 0);
		if (b < 0) {
			cntNeg -= -(b + 1);
		}
		if (cntNeg % 2 == 1) cout << "Negative" << endl;
		else cout << "Positive" << endl;
	}

}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
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; }

int main() {
    int X, N;
    cin >> X >> N;
    vector<bool> p(201, false);
    REP(i, N) {
        int a;
        cin >> a;
        p[a] = true;
    }
    int ans = -1;
    
    rep(i, 200) {
        if (p[i] == false) {
            if (abs(X - ans) > abs(X - i)) {
                ans = i;
            }
        }
    }
    cout << ans << endl;


}



















Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string b;
  cin >> b;
  if (b == "A") {
    cout << "T" << endl;
  }
   else if (b == "T") {
    cout << "A" << endl;
  }
   else if (b == "C") {
    cout << "G" << endl;
  }
   else if (b == "G") {
    cout << "C" << endl;
  }
}
  

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
int N, i;

void solve() {
    printf("%d\n", N - i + 1);
}

int main() {
    cin >> N >> i;
    solve();
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  unsigned long summingM = 0;
  
  if( N == 1 ){
    summingM = 0;
  }else{
    for(int i = 0; i < N ; i++){
      summingM += i;
    }
  }
  cout << summingM << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  int numodd = 0;
  for(int i=0; i<N; i++){
    cin >> A.at(i);
    if(A.at(i)%2!=0){
      numodd++;
    }
  }
  if(numodd%2==0){
    cout << "YES";
  }else{
    cout << "NO";
  }
  return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
    return 0;
}

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

int v[100010];
int main() {
	int N; cin >> N;
	int six=1, nine=1;
	for(int i=1; i<=N; ++i){
	    if(six*6==i) six *= 6;
	    if(nine*9==i) nine *= 9;
	    v[i]=min(v[i-six], v[i-nine])+1;
	}
	cout << v[N] << endl;
	return 0;
}


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

typedef long long LL;
typedef pair<int, int> II;

const int N = (int) 1e5 + 10;
int n, deg[N], c[N], h[N];
vector<int> adj[N];

void DFS(int u, int p = -1) {
    c[u] = 1;
    for (int i = 0; i < (int) adj[u].size(); ++i) {
        int v = adj[u][i];
        if (v != p) {
            h[v] = h[u] + 1;
            DFS(v, u);
            c[u] ^= c[v];
        }
    }
}

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d", &n);
    for (int i = 1; i <= n - 1; ++i) {
        int u, v; scanf("%d%d", &u, &v);
        adj[u].push_back(v); deg[u]++;
        adj[v].push_back(u); deg[v]++;
    }

    DFS(1);
    for (int u = 1; u <= n; ++u) {
        int cnt[2] = {0};
        for (int i = 0; i < (int) adj[u].size(); ++i)
            if (h[adj[u][i]] > h[u]) cnt[c[adj[u][i]]]++;
        if (u != 1) cnt[c[1] ^ c[u]]++;
        if (cnt[1] == 0 || (cnt[1] >= 2)) {
            puts("First");
            return 0;
        }
    }
    puts("Second");
    return 0;
}


Measured memory_bytes: 7040
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int main(){
  string S; cin>>S;
  if(S[S.length()-1] == 's'){
    cout<<S+"es"<<endl;
  }else{
    cout<<S+"s"<<endl;
  }
}

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

using namespace std;

typedef long long ll;
ll a[200005];
ll b[200005];
ll c[200005];
int n;
int main() {
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];

  ll res = 0;
  for(int i = 0; i < 29; i++) {
    ll s = 1 << i;

    for(int j = 0; j < n; j++) {
      c[j] = b[j] % (2 * s);
    }

    sort(c,c+n);
    ll tmp = 0;
    for(int j = 0; j < n; j++) {
      ll A = a[j] % (2 * s);
      ll* l1 = lower_bound(c,c+n,s - A);
      ll* r1 = lower_bound(c,c+n,2*s-A);
      ll* l2 = lower_bound(c,c+n,3*s-A);
      ll* r2 = lower_bound(c,c+n,4*s-A);

      tmp^= ((r1 - l1) + (r2 - l2)) % 2;
    }

    res |= tmp << i;
  }

  cout << res << endl;
}
      


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
#define ll long long
#define out(a) printf("%d",a)
#define ln printf("\n")
const int N=1e5+50;
const int MOD=1e9+7;
const int inf=0x7f7f7f7f;
using namespace std;
int a,b;
int ans=0;
int main()
{
	scanf("%d%d",&a,&b);
	ans=-1e6;
	ans=max(ans,a+b);
	ans=max(ans,a-b);
	ans=max(ans,a*b);
	out(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second

signed main(){
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a;
	cin >> a;
	if(a>=30)
		cout << "Yes";
	else
		cout << "No";


	
	

	return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include<math.h>
#include<stdio.h>


int main()
{
	char n;
	std::cin >> n;
	if (n <= 90) {
		std::cout << "A" << std::endl;
	}
	else
	{
		std::cout << "a" << std::endl;
	}
	
	
}

Measured memory_bytes: 3664
S = [s for s in input()]
if S[0] == "A":
  if "C" in S[2:-1]:
    S.remove("A")
    S.remove("C")
    S = "".join(S)
    if S.islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    // val,count
    map<int,int> mp;
    int N,K;
    cin >> N >> K;
    REP(i,N) {
        int A;
        cin >> A;
        if (mp.count(A) == 0) mp[A] = 0;
        mp[A]++;
    }

    // count
    vector<int> v;
    for(const auto &itr: mp) {
        v.push_back(itr.second);
    }

    sort(ALL(v));

    int ans=0;
    int i=0;
    while(v.size()-i > K) {
        ans += v[i];
        i++;

    }

    cout << ans << endl;


    return 0;
}


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

using namespace std;

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

    int N, K; cin>>N>>K;

    const long MOD = 1e9+7;
    auto mod = [&](long x) {
        return x % MOD;
    };
    const long MAX = 2001;
    vector<long> fact(MAX);
    fact[0] = 1;
    for (long i = 1; i < MAX; i++) {
        fact[i] = mod(fact[i-1]*i);
    }
    auto mod_pow = [&](long x, long y) {
        long t = 1;
        long u = x;
        while (y) {
            if (y & 1) {
                t = mod(t * u);
            }
            u = mod(u * u);
            y>>=1;
        }
        return t;
    };
    auto mod_div = [&](long x, long y) {
        return mod(x * mod_pow(y, MOD-2));
    };
    auto mod_comb = [&](long x, long y) -> long {
        return mod_div(fact[x], mod(fact[y] * fact[x-y]));
    };

    for (int i = 1; i <= K; i++) {
        if (N-K<i-1) {
            cout << 0 << endl;
            continue;
        }
        long ans = mod(mod_comb(K-1, i-1) * mod_comb(N-K+1, i));
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
long long  n,m;
const int N = 1e9+5;
int main() {
	IO
	string s;
	cin>>n;
	cin>>s;
    if(s.size()>n)
    {
	for(int i=0;i<n;i++)
    {
        cout<<s[i];
    }
    cout<<"..."<<endl;

    }
    else
        cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<string>
#include<queue>
#include<stack>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<map>

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

using namespace std;

template <typename TYPE>
void printArray(TYPE* array, int size){
  rep(size,i) cout << array[i] << "\t" << flush;
  cout << endl;
}

int StringToInt(string str){
  return atoi(str.c_str());
}

double factorial(double n){
  double sum=1;
  for(int i=n;i>=1;i--){
    sum = i*sum;
  }
  return sum;
}

double combination(double n, double k){
  double denominator = 1;
  for(int i=n,j=0;j<k;j++,i--) denominator*=i;
  return denominator/factorial(k);
}

#define MAX_LINE 72

int m;
string train;
map<string, bool> dictionary;
int ans = 0;

string reverse(string str){
    string reverse_str = "";
    for(int i=str.length()-1;i>=0;i--){
	reverse_str += str[i];
    }
    return reverse_str;
}


int main(){
    cin >> m;
    rep(m,i){
	ans = 0;
        dictionary.clear();	

	cin >> train;

        for(int i=train.length()-1;i>0;i--){
            string left = train.substr(0, i);
	    string right = train.substr(i, train.length());
	    string reverse_left = reverse(left);
            string reverse_right = reverse(right);

            if(dictionary.find(left + right) == dictionary.end()){
		dictionary[left+right] = true;
		ans++;
	    }
            if(dictionary.find(left + reverse_right) == dictionary.end()){
                dictionary[left+reverse_right] = true;                
		ans++;
	    }
	    if(dictionary.find(reverse_left + right) == dictionary.end()){
		dictionary[reverse_left + right] = true;
		ans++;
	    }
	    if(dictionary.find(reverse_left + reverse_right) == dictionary.end()){
		dictionary[reverse_left + reverse_right] = true;
		ans++;
	    }
	    if(dictionary.find(right + left) == dictionary.end()){
		dictionary[right + left] = true;
		ans++;
	    }
	    if(dictionary.find(right + reverse_left) == dictionary.end()){
		dictionary[right + reverse_left] = true;
		ans++;
	    }
	    if(dictionary.find(reverse_right + left) == dictionary.end()){
		dictionary[reverse_right + left] = true;
		ans++;
	    }
	    if(dictionary.find(reverse_right + reverse_left) == dictionary.end()){
		dictionary[reverse_right + reverse_left] = true;
		ans++;
	    }
	}
	cout << ans << endl;
    }
}

Measured memory_bytes: 1320