akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIZE_BUF (30)

int main(int argc, char *argv[]) {
  // read inputs
  int N;
  char cs[SIZE_BUF], buf[SIZE_BUF];
  scanf("%d", &N);
  fgets(buf, SIZE_BUF, stdin);

  // solve binary search
  int le = 0, re = N, gl, gr;
  printf("0\n");
  fflush(stdout);
  scanf("%s", cs);
  fgets(buf, SIZE_BUF, stdin);
  if (strcmp(cs, "Vacant") == 0) {
    return 0;
  } else if (strcmp(cs, "Male") == 0) {
    gl = 0;
    gr = 0;
  } else {
    gl = 1;
    gr = 1;
  }
  while (re - le > 2) {
    const int m = (le + re) / 2, lenl = m - le + 1, lenr = re - m + 1;
    int gm;
    printf("%d\n", m);
    fflush(stdout);
    scanf("%s", cs);
    fgets(buf, SIZE_BUF, stdin);
    if (strcmp(cs, "Vacant") == 0) {
      return 0;
    } else if (strcmp(cs, "Male") == 0) {
      gm = 0;
    } else {
      gm = 1;
    }
    if (lenl % 2 == 0 && gm == gl) {
      re = m;
      gr = gm;
      continue;
    } else if (lenr % 2 == 0 && gr == gm) {
      le = m;
      gl = gm;
      continue;
    } else if (lenl % 2 == 1 && gm != gl) {
      re = m;
      gr = gm;
      continue;
    } else if (lenr % 2 == 1 && gr != gm) {
      le = m;
      gl = gm;
      continue;
    }
    while (1) {
      ;
    }
  }
  printf("%d\n", (le + re) / 2);
  fflush(stdout);

  return 0;
}


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

    int64_t out=1;
    for(int64_t i=1;i<=N;i++){
            out = ((out%(1000000000+7))*(i%(1000000000+7)))%(1000000000+7);
    }

    cout<<out<<endl;
 
    return 0;
}  

Measured memory_bytes: 256
// input macro
// ref: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
fn main() {
    input!(
        n: usize,
        m: usize,
        q: usize,
        lr: [[usize; 2]; m],
        query: [[usize; 2]; q],
    );

    let mut graph: Vec<Vec<usize>> = vec![vec![0; n+2]; n+2];

    for row in lr.iter() {
        let l = row[0];
        let r = row[1];
        graph[l][r] += 1;
    }

    for col in 0..n+1 {
        for row in 0..n+2 {
            graph[row][col+1] += graph[row][col];
        }
    }
    for row in 0..n+1 {
        for col in 0..n+2 {
            graph[row+1][col] += graph[row][col];
        }
    }

    for qi in query.iter() {
        let l = qi[0];
        let r = qi[1];
        println!("{}", graph[r][r]+graph[l-1][l-1] - graph[l-1][r]-graph[r][l-1]);
    }

}


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

using namespace std;
const int IINF = INT_MAX;
using ll = long long;
using P = pair<int,int>;
#define INF 100000000

const double pai = 3.141592653589793238;
int main(){
    int n; cin >> n;
    int m; cin >> m;
    
    
     if(n-2*m > 0)
     cout << n-2*m << endl;
    else cout << 0 << endl;
    return 0;	
}

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

if __name__ == '__main__':
    main()

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

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

    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    const int idx = K - 1;
    switch(S[idx]) {
      case 'A':
          S[idx] = 'a';
          break;
      case 'B':
          S[idx] = 'b';
          break;
      default:
          S[idx] = 'c';
          break;
    }

    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#define ll long long
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
struct Data{
	int x,id;
	friend bool operator < (Data a,Data b){return a.x<b.x;}
};
std::priority_queue<Data>q;
int a[maxn],b[maxn];
int n;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	for(int i=1;i<=n;i++)
		b[i]=read();
	for(int i=1;i<=n;i++)
		if(a[i]<b[i])q.push((Data){b[i],i});
	ll ans=0;
	while(!q.empty()){
		Data now=q.top(); q.pop();
		if(now.x!=b[now.id])continue;
		int l=(now.id+n-2)%n+1,r=now.id%n+1;
		if(b[now.id]-a[now.id]<b[l]+b[r]){
			puts("-1"); return 0;
		}
		int cnt=(b[now.id]-a[now.id])/(b[l]+b[r]);
		ans+=cnt;
		b[now.id]-=cnt*(b[l]+b[r]);
		if(b[now.id]>a[now.id])q.push((Data){b[now.id],now.id});
	}
	for(int i=1;i<=n;i++)
		if(a[i]!=b[i]){
			puts("-1"); return 0;
		}
	writeln(ans);
	return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <cstring>

using namespace std;

int n, s;
int dp[11][340][1 << 11];


int dfs(int idx, int sum, int bit)
{
    int res = 0;

    if (dp[idx][sum][bit] >= 0)
        return dp[idx][sum][bit];

    if (idx == n) {
        if (sum == s)
            return 1;
        else
            return 0;
    }

    for (int u = 0; u < 10; u++) {
        if (!(bit >> u & 1)) {
            if (sum + (idx + 1) * u <= s)
                res += dfs(idx + 1, sum + (idx + 1) * u, (bit | 1 << u));
        }
    }

    return dp[idx][sum][bit] = res;
}

int main()
{
    while (cin >> n >> s) {
        memset(dp, -1, sizeof(dp));
        cout << dfs(0, 0, 0) << endl;
    }

    return 0;
}

Measured memory_bytes: 31088
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
   ll H,N,A,sum=0;
   cin >> H >> N;
   for(int i=0;i<N;i++){
       cin >> A;
       sum+=A;
   }
   if(sum>=H) {
       cout << "Yes" <<endl;
   }
   else{
       cout << "No" << endl;
   }
   
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const double inf=1e18;
const int MOD=1000000007;
class Edge{
public:
//int s;
int t;
double len;
};
class Node{
    public:
    int num;//node番号
    double dist;//startからの距離
    vector<Edge> edge;//自分から生えている辺
    bool comp;//dijkstra中で到達しているかどうか
    int x,y,r;
    void in_edge(int in_t,double in_len){
        Edge in;in.t=in_t;in.len=in_len;
        edge.push_back(in);
    }  
};
bool operator >(const Node& a,const Node &r){
        return a.dist > r.dist;
    }
void dijkstra(vector<Node> &node,int s,int n){
    //n個のノードでできたグラフのsからtまでの最短距離を計算する
    //この時各要素のdistの値はsからの最短距離となる
    vector<pair<double,int>> nodes(n);
    for(int i=0;i<n;i++){
        //初期化
        node[i].dist=inf;
        node[i].num=i;
        node[i].comp=true;
        nodes[i].first=inf;
        nodes[i].second=i;
    }
    nodes[s].first=0;
    node[s].dist=0;
    priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> que;
    que.push(nodes[s]);
    while(!que.empty()){
        pair<double,int> hoge;
        hoge=que.top();que.pop();
        Node buf;
        buf=node[hoge.second];
        int k=buf.num;
        if(node[k].comp){
            node[k].comp=false;
            int edge_num=buf.edge.size();
            for(int i=0;i<edge_num;i++){
                int buf_t=node[k].edge[i].t;
                double buf_len=node[k].edge[i].len;
                if(node[buf_t].dist>node[k].dist+buf_len){
                node[buf_t].dist=node[k].dist+buf_len;
                que.push({node[buf_t].dist,buf_t});
                }
            }
        }
    }
}
signed main(){  
  P s,t;cin>>s.first>>s.second>>t.first>>t.second;
  int n;cin>>n;
  vector<Node> node(n+5);
  node[0].x=s.first;node[0].y=s.second;node[0].r=0;
  node[n+1].x=t.first;node[n+1].y=t.second;node[n+1].r=0;
  rep1(i,n){
      int x,y,r;cin>>x>>y>>r;
      node[i].x=x;node[i].y=y;node[i].r=r;
  }
  rep(i,n+2){
      rep(j,n+2){
          if(i==j)continue;
          double dist=sqrt((double)(node[i].x-node[j].x)*(double)(node[i].x-node[j].x)+(double)(node[i].y-node[j].y)*(double)(node[i].y-node[j].y))-(double)node[i].r-(double)node[j].r;
          dist=max(dist,0.0);
          node[i].in_edge(j,dist);
      }
  }
  dijkstra(node,0,n+2);
  printf("%.15lf\n",node[n+1].dist);
  return 0;
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003;

struct point{
    ll diff;
    ll a;
    ll b;
    int num;
};

auto compare1 = [](point &A,point &B){
    if(A.diff==B.diff) return A.a<B.a;
    return A.diff<B.diff;
};

auto compare2 = [](point &A,point &B){
    if(A.diff==B.diff) return A.b<B.b;
    return A.diff<B.diff;
};

int main(){
    
    int N;cin>>N;
    vector<point> S(N);
    vector<bool> C(N,0);
    priority_queue<point,vector<point>,decltype(compare1)> PQ1(compare1);
    priority_queue<point,vector<point>,decltype(compare2)> PQ2(compare2);
    for(int i=0;i<N;i++){
        ll a,b;cin>>a>>b;
        S[i].diff=a+b;
        S[i].a=a;
        S[i].b=b;
        S[i].num=i;
        PQ1.push(S[i]);
        PQ2.push(S[i]);
    }
    ll ans=0;
    
    /*for(int i=0;i<N;i++){
        cout<<PQ1.top().num<<" "<<PQ2.top().num<<endl;
        PQ1.pop();
        PQ2.pop();
    }*/
    
    for(int i=0;i<N;i++){
        if(i%2==0){
            while(C[PQ1.top().num]==1){
                PQ1.pop();
            }
            ans+=PQ1.top().a;
            C[PQ1.top().num]=1;
            PQ1.pop();
        }else{
            while(C[PQ2.top().num]==1){
                PQ2.pop();
            }
            ans-=PQ2.top().b;
            C[PQ2.top().num]=1;
            PQ2.pop();
        }
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 13152
#include <bits/stdc++.h>
#define piii tuple<int, int, int>
using namespace std;

int N;
string A[1000005];
vector<piii> brac[2];
string ans;

int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  int req, mn, mx, id;
  for(int i = 1; i <= N; i++) {
    req = 0, mx = -1, mn = 1;
    cin >> A[i];
    for(char it : A[i]) {
      req += (it == '(' ? 1 : -1);
      mx = max(req, mx);
      mn = min(req, mn);
    }
    if(req >= 0) {
      brac[1].push_back(make_tuple(mn, req, i));
    }else {
      mx = -1, req = 0;
      for(int it = A[i].size() - 1; it >= 0; it--) {
        req += (A[i][it] == '(' ? 1 : -1);
        mx = max(mx, req);
      }
      brac[0].push_back(make_tuple(mx, req, i));
    }
  }
  sort(brac[0].begin(), brac[0].end());
  sort(brac[1].begin(), brac[1].end(), greater<piii>());
  int cnt1 = 0, cnt0 = 0;
  for(auto it : brac[0]) {
    tie(mx, req, id) = it;
    if(cnt1 >= mx) {
      cnt1 += -req;
      ans += A[id];
    }else {
      cout << "No\n";
      return 0;
    }
  }
  reverse(ans.begin(), ans.end());
  string tmp;
  for(auto it : brac[1]) {
    tie(mn, req, id) = it;
    if(cnt0 >= -mn) {
      cnt0 += req;
      ans += A[id];
    }else {
      cout << "No\n";
      return 0;
    }
  }
  if(cnt0 == cnt1) cout << "Yes\n";
  else cout << "No\n";
  cin >> N;
}


Measured memory_bytes: 49152
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
char board[55][55];

bool ok(int i, int j,int a,int b) {
	int num = 0;
	if (board[i][j] == '.')return true;
	else {
		for (int x = 0;x < 4;x++) {
			if (x == 0) {
				int fx = i + 1, fy = j;
				if ((fx >= 0) && (fx <= a) && (fy >= 0) && (fy <= b)) {
					if (board[fx][fy] == '#')num++;
				}
			}
			else {
				if (x == 1) {
					int fx = i - 1, fy = j;
					if ((fx >= 0) && (fx <= a) && (fy >= 0) && (fy <= b)) {
						if (board[fx][fy] == '#')num++;
					}
				}
				else {
					if (x == 2) {
						int fx = i, fy = j + 1;
						if ((fx >= 0) && (fx <= a) && (fy >= 0) && (fy <= b)) {
							if (board[fx][fy] == '#')num++;
						}
					}
					else {
						int fx = i, fy = j - 1;
						if ((fx >= 0) && (fx <= a) && (fy >= 0) && (fy <= b)) {
							if (board[fx][fy] == '#')num++;
						}
					}
				}
			}
		}
		if (num == 0)return false;
		else return true;
	}
}
int main(void){
	int h, w;
	cin >> h >> w;
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			cin >> board[i][j];
		}
	}
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			if (!ok(i, j, h, w)) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 *  Kaiwen Zhou,
 *  CUHK
**/
#include <bits/stdc++.h>
using namespace std;
#define INS ios::sync_with_stdio(false);cin.tie(0)
typedef long long LINT;
#define INF 1000000000000

int main(void) {
    INS;
    LINT n;
    cin >> n;
    LINT h[n], dp[n];
    for(int i = 0; i < n; i ++) {
        cin >> h[i];
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 1; i < n; i ++) {
        if(i - 1 >= 0) {
            dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        }
        if(i - 2 >=0) {
            dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
    cout << dp[n - 1] << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define M 1000000007

using namespace std;
typedef long long int ll;

int main()
{
   long double a,b,c;
   cin>>a>>b>>c;
   ll d = c -a-b;
   if(d>0 && d*d>4*a*b)
    cout<<"Yes\n";
   else
    cout<<"No\n";

}


Measured memory_bytes: 256
/// --- In the name of ALLAH --- ///


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


typedef long long              ll;
typedef vector<int>            vi;
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 double                 dl;

#define endl                   '\n'
#define PB                     push_back
#define F                      first
#define S                      second
#define all(a)                 (a).begin(),(a).end()
#define rall(a)                (a).rbegin(),(a).rend()
#define sz(x)                  (ll)x.size()
#define wt                     ll t; cin>>t; while(t--)
#define input(a,n)             for(int i=0;i<n;i++) cin>>a[i];

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;


#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define mod 10000007
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


const ll mx=1e9;









int main()
{
    optimize();

  int n,i,s=0;
  cin>>n;
  int c[n+1],v[n+1],d[n+1];
  for(i=1;i<=n;i++)
    cin>>v[i];
 for(i=1;i<=n;i++)
    cin>>c[i];
   for(i=1;i<=n;i++)
    {
        d[i]=v[i]-c[i];
        if(d[i]>=0)
            s=s+d[i];
    }
    cout<<s<<endl;





    return 0;
}









































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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int const MOD = (int) 1e9 + 7;
  auto add = [&](int& x, int y) -> int& {
    x += y;
    if (x >= MOD) {
      x -= MOD;
    }
    return x;
  };
  
  vector<vector<int>> dp(n, vector<int>(n));
  dp[0][0] = 1;
  for (int i = 1; i < n; ++i) {
    auto gr = s[i - 1] == '<';
    //  new number [0..i]
    if (gr) {
      int cur = 0;
      for (int j = 0; j + 1 <= i; ++j) {
        add(cur, dp[i - 1][j]);
        add(dp[i][j + 1], cur);
      }
    } else {
      int cur = 0;
      for (int j = i - 1; j >= 0; --j) {
        add(cur, dp[i - 1][j]);
        add(dp[i][j], cur);
      }
    }
  }
  int ans = 0;
  for (int x : dp.back()) {
    add(ans, x);
  }
  cout << ans << '\n';
  return 0;
}


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

int main()
{
    string a, b;
    cin >> a >> b;
    int loops = min(a.size(), b.size());
    int comp = 0;   //0:引き分け, 1:aのほうが大きい, 2:bのほうが大きい
    string ans[3] = {"EQUAL", "GREATER", "LESS"};
    if (a.size() == b.size())
    {
        for (int i = 0; i < loops; i++)
        {
            if(a[i] > b[i]) { comp = 1; break; }
            else if (a[i] < b[i]) { comp = 2; break; }
        }
        cout << ans[comp] << endl;
    }
    else
    {
        cout << ans[(a.size() < b.size()) + 1] << endl;
    }


    return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder_20190218
{
    class Program
    {
        static void Main(string[] args)
        {
            string str_500 = Console.ReadLine();
            string str_100 = Console.ReadLine();
            string str_50 = Console.ReadLine();
            string str_total = Console.ReadLine();


            int Yen500 = int.Parse(str_500);
            int Yen100 = int.Parse(str_100);
            int Yen50 = int.Parse(str_50);
            int total = int.Parse(str_total);

            int count = 0;
            for (int a = 0; a <= Yen500; a++)
            {
                for (int b = 0; b <= Yen100; b++)
                {
                    for (int c = 0; c <= Yen50; c++)
                    {
                        if((a*500+b*100+c*50)==total)
                        {
                            count++;
                        }
                    }
                }
            }
                        Console.WriteLine(count);
        }
    }
}


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

int main(){
    int N;
    cin >> N;
    if (N % 10 == (N / 10) % 10 && N % 10 == N / 100){
        cout << N << endl;
    }
    else{
        int i;
        i = N / 100;
        if (N < i * 111){
            cout << i *111 << endl;
        }
        else{
            cout << (i + 1) * 111 << endl;
        }
    }
}

Measured memory_bytes: 256
# B - 3人でカードゲームイージー
s= [input() for _ in range(3)]
la, lb, lc = [len(x) for x in s]
na, nb, nc = [0]*3
turn = 'a'
for _ in range(la+lb+lc):
    if turn == 'a':
        if la - na == 0:
            print('A')
            break
        turn = s[0][na]
        na += 1
    elif turn == 'b':
        if lb- nb == 0:
            print('B')
            break
        turn = s[1][nb]
        nb += 1
    else:
        if lc - nc == 0:
            print('C')
            break
        turn = s[2][nc]
        nc += 1

Measured memory_bytes: 3064
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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





void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}



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



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

processes = []

for i in range(int(n)):
    process_name, process_time = input().split()
    processes.append([process_name, int(process_time)])

elapsed_time = 0
while len(processes):
    process = processes.pop(0)
    if process[1] > q:
        process[1] -= q
        processes.append(process)
        elapsed_time += q
    else:
        elapsed_time += process[1]
        print(process[0], elapsed_time)

Measured memory_bytes: 15896
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define dbgarrmint(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j].x<<" ";}cerr<<endl;}
#else
#define dbg(...)
#define dbgmap(...)
#define dbgarr(...)
#define dbgdp(...)
#define dbgmint(...)
#define dbgarrmint(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    char c;
    cin>>c;
    bool komoji = c == tolower(c);
    cout<<(komoji?'a':'A')<<endl;
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
    solve();
}


Measured memory_bytes: 3636
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (a, b, n) = {
        let nmq = get_line().split_whitespace()
            .map(|e| e.parse().unwrap())
            .collect::<Vec<i64>>();
        (nmq[0], nmq[1], nmq[2])
    };

    if b > n {
        let result = (a * n) / b;
        println!("{}", result);
    } else {
        let result = (a * (b - 1)) / b;
        println!("{}", result);
    }
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define f18 1000000000000000000

int main()
{
  ll a;cin>>a;
  string b;cin>>b;
  vector<int> bs(3);
  bs[0]=b[0]-'0';
  bs[1]=b[2]-'0';
  bs[2]=b[3]-'0';
  ll bn=bs[0]*100+bs[1]*10+bs[2];
  cout<<a*bn/100<<endl;
}


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

int main(){
    int a,b,c,t;
    cin>>a>>b>>c;
    
    if (a>b) {t=a; a=b; b=t; }
    if (b>c) {t=b; b=c; c=t; }
    if (a>b) {t=a; a=b; b=t; }
    
    cout<<a<<" "<< b<<" "<<c<<endl;
    
    return 0;
}


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

#次に来て欲しい整数
hope_number = 1

#砕いた数
ans = 0

for i in range(N):
    if a[i] == hope_number:
        hope_number += 1
    else:
        ans += 1

if ans == N:
    print(-1)
else: 
    print(ans)

Measured memory_bytes: 26268
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;

    set<int> s;
    for(int i = a; i < a + k && i <= b; i++)
        s.insert(i);
    for(int i = b; i > b - k && i >= a; i--)
        s.insert(i);

    for(auto it = s.begin(); it != s.end(); it++)
        cout << *it << endl;
    return 0;
}


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

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

int main(void)
{
  ll N;cin>>N;
  vector<ll> C(N);
  for(ll i=0;i<N;i++){
    cin>>C[i];
  }

  sort(C.begin(),C.end());

  ll res = 0;
  ll TC = 0;
  ll TT = 1;
  ll sumC = 0;
  for(ll i=0;i<N;i++){
    ll a1 = TT*TT %mod;
    ll b1 = 2ll*((C[i] * a1) %mod)%mod;
    b1 = (b1 + (sumC *a1) %mod) %mod;
    ll b2 = (4ll*TC)%mod;
    TC = (b1+b2) %mod;
    //cout<<sumC<<"!"<<TT<<"!"<<b1<<"!"<<b2<<"!"<<TC<<endl;
    TT = (2ll*TT)%mod;
    sumC = (sumC +C[i]) %mod;
  }
    cout<<TC<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <list>
#include <string>
#include <unordered_map>
#include <limits>
#include <queue>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    long long n, sum = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        if (i % 3 && i % 5) {
            sum += i;
        }
    }
    cout << sum << endl;
}

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


void solve(){
    int a,b;
    cin >> a >> b;
    cout << a*b/2 << endl;
}

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

Measured memory_bytes: 256
n = int(input())
s = input()
num_list = [str(i).zfill(3) for i in range(1000)]
ans = 0
for i in range(1000):
    i100 = num_list[i][0]
    i10 = num_list[i][1]
    i1 = num_list[i][2]
    count = 0
    a = s.find(i100)
    if a != -1:
        count += 1
        a += 1
    b = s.find(i10, a)
    if b != -1:
        count += 1
        b += 1
    c = s.find(i1, b)
    if c != -1:
        count += 1
    if count == 3:
        ans += 1
print(ans)


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

typedef long long ll;

using namespace std;

const long long N = 1e2;
const long long INF = 1e18;

ll n, a, b, c, d, ans;
ll cost[N];

int ok(ll x)
{
    return 0 <= x && x < N;
}

map<ll, ll> mm;

ll solve(ll x)
{
    if (mm.find(x) != mm.end())
    {
        if (mm[x] == -1) return INF;
        else return mm[x];
    }
    mm[x] = -1;
    //if (x < 0) return INF;
    //if (x < N) return cost[x];
    ll x2 = x / 2;
    ll x3 = x / 3;
    ll x5 = x / 5;
    ll si = INF;
    if (x < INF / d) si = x * d;
    si = min(si, solve(x2) + a + (x % 2) * d);
    si = min(si, solve(x2 + 1) + a + (2 - x % 2) * d);
    si = min(si, solve(x3) + b + (x % 3) * d);
    si = min(si, solve(x3 + 1) + b + (3 - x % 3) * d);
    si = min(si, solve(x5) + c + (x % 5) * d);
    si = min(si, solve(x5 + 1) + c + (5 - x % 5) * d);
    //cout << x << " " << si << " " << x2 << " " << x3 << " " << x5 << endl;
    mm[x] = si;
    return si;
}

void solve()
{
    cin >> n >> a >> b >> c >> d;
    mm.clear();
    cout << solve(n) << endl;
}

signed main()
{
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}


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

using namespace std;

void sort_vertices_dfs(
    const unordered_multimap<int, int> &G, 
    vector<int> &ans,
    unordered_set<int> &discovered,
    const int source
) {
    const auto range = G.equal_range(source);
    for (auto it = range.first; it != range.second; ++it) {
        if (discovered.count(it->second)) continue;

        discovered.insert(it->second);
        sort_vertices_dfs(G, ans, discovered, it->second);
        ans.insert(ans.cbegin(), it->second);
    }
}

int solve(const int N, const unordered_multimap<int, int> &G) {
    vector<int> ordering;
    unordered_set<int> discovered{0};
    sort_vertices_dfs(G, ordering, discovered, 0);
    ordering.insert(ordering.cbegin(), 0);

    vector<int> dp(N + 1, 0);

    for (auto it = ordering.crbegin(); it != ordering.crend(); ++it) {
        const auto range = G.equal_range(*it);
        for (auto jt = range.first; jt != range.second; ++jt) {
            dp[*it] = max(dp[*it], dp[jt->second] + 1);
        }
    }

    return *max_element(dp.cbegin(), dp.cend()) - 1;
}

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

    int N, M;
    cin >> N >> M;

    unordered_multimap<int, int> G;
    for (int i = 1; i <= N; ++i) {
        G.emplace(0, i);
    }

    for (int i = 0; i != M; ++i) {
        int x, y;
        cin >> x >> y;
        G.emplace(x, y);
    }

    cout << solve(N, G) << endl;

    return 0;
}


Measured memory_bytes: 16328
#include <stdio.h>
#include <string.h>

int main()
{
    char s[20];
    scanf("%s", s);

    int i = 0;
    while (i < strlen(s)) {
        if (s[i] == ',') {
            s[i] = ' ';
        }
        i = i + 1;
    }

    printf("%s", s);
    
    return 0;
}

Measured memory_bytes: 128
from collections import deque
n,q = map(int,input().split())
c = [[] for _ in range(n)]
for i in range(n-1):
    A,B = map(int,input().split())
    c[A-1].append(B)
    c[B-1].append(A)
z = [0] * n
for i in range(q):
    P,X = map(int,input().split())
    z[P - 1] += X


d = [-1] * n
d[0] = 0
q = deque([])
q.append(1)
while(q):
    tp = q.popleft()
    td = d[tp - 1]
    for n2 in c[tp - 1]:
        if(d[n2 - 1] == -1):
            d[n2 - 1] = td + 1
            z[n2 - 1] += z[tp - 1]
            q.append(n2)

print(*z)

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



int main() {
    ll l,r; cin >> l >> r;
    ll d = l%2019;
    ll ans = 2020;

    if(r-l > 2019-d) cout << 0;
    else {
        for(ll i = l; i < r; i ++){
            for(ll j = i+1; j <= r; j ++){
                ans = min(ans,((i%2019)*(j%2019))%2019);
            }
        }
        cout << ans;
    }
    return 0;
}











Measured memory_bytes: 3600
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = list(input())

def p(a):
  if a == 'r':
    return P
  elif a == 's':
    return R
  else:
    return S

A = [0]*N
for i in range(K):
  A[i] = p(T[i])

for i in range(K):
  for j in range(1,((N-1-i)//K)+1):
    if T[K*j+i] != T[K*(j-1)+i] or A[K*(j-1)+i] == 0:
      A[K*j+i] = p(T[K*j+i])

print(sum(A))

Measured memory_bytes: 4792
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int num = inputs.nextInt();
		double div = num/3.0;
		double ans = div*div*div;
		System.out.printf("%f\n", ans);
	}

}


Measured memory_bytes: 21204
#include <bits/stdc++.h> 
using namespace std;
///////////////////////////////////////////
const long long int INF = INT32_MAX;
const long long int Mod = 1000000007;
const long long int mod = 100000;//10^5
using ll = long long int; //long long int は64bit
using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using pii = pair<int,int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
#define np nullptr
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define fill(x,num) memset(x,num,sizeof(x));
typedef vector<vector<ll> > matrix;
//       cin.tie(0);ios::sync_with_stdio(false);
void cinit(){cin.tie(0);ios::sync_with_stdio(false);}
//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////

ll n;
string s;
ll name[5]={0};
char march[5]={'M','A','R','C','H'};
ll kai(ll n){
    ll ans=1;
    for(int i=1;i<=n;i++){
        ans*=i;
        ans%=Mod;
    }
    return ans;
}

namespace NCR{
    const long long int max_n = 1001;
    const long long int max_r = 501;
    ll ncr_box[max_n][max_r]={0};
}

ll ncr(int n,int r){
    r=min(n-r,r);
    if(NCR::ncr_box[n][r]!=0) {
        return NCR::ncr_box[n][r];
    }else if(r==0){
        return NCR::ncr_box[n][r]=1;
    }else if(r==1){
        return NCR::ncr_box[n][r]=n;
    }else{
        return NCR::ncr_box[n][r] = ncr(n-1,r)%Mod + ncr(n-1,r-1)%Mod ;
    }
}


int main(){
	cin>>n;
	rep(i,n){
		cin>>s;
		rep(i,5){
			if(march[i]==s[0])name[i] +=1;
		}
	}
	ll sum = 0;
	ll tmp  =0;
	for(int i=1;i<(1<<5);i++){
		if(__builtin_popcount(i)==3){
			//cout<<"jj";
			tmp=1;
			rep(j,5)if((i&(1<<j)) != 0)tmp*=name[j];
			//cout<<i<<" "<<tmp<<endl;
			sum += tmp;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env pypy
 
import sys

def get_int(): return int(sys.stdin.readline().strip())
def get_ints(): return map(int, sys.stdin.readline().strip().split()) 
def get_list(): return list(map(int, sys.stdin.readline().strip().split())) 
def get_string(): return sys.stdin.readline().strip()
def out(data): return sys.stdout.write(str(data))
def out_list(arr): return sys.stdout.write(' '.join(str(e) for e in arr))

MAX = 10**9
MOD = 10**9 + 7

n, k = get_ints()
arr = get_list()
arr.sort()

out(sum(arr[:k]))



Measured memory_bytes: 62396
#include<stdio.h>
int main ()
{
    int a , b , rslt ;

    scanf("%d%d" ,&a ,&b) ;

    rslt = a*b ;

    if (rslt%2 ==0 ){
        printf("Even\n");
    }
    else {
        printf("Odd");
    }
    return 0 ;

}


Measured memory_bytes: 128
package main

// AGC017A - Biscuits(200)
// https://atcoder.jp/contests/agc017/tasks/agc017_a

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func pow(b, n int) (r int) {
	r = 1
	for i := 0; i < n; i++ {
		r *= b
	}
	return r
}

func main() {
	var N, P int
	fmt.Scan(&N, &P)
	A := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	even := true
	for i := range A {
		A[i] = nextInt(sc)
		if A[i]%2 == 1 {
			even = false
		}
	}
	var ans int
	if even { // 全て偶数
		if P == 0 {
			ans = pow(2, N)
		}
		// P == 1の場合、どのように選んでも総数は偶数のため答えは0通り
	} else { // 奇数が存在する
		// ある一つの奇数の袋をAkとすると、それ以外の選び方は2^(N-1)通り
		// 2^(N-1)通りそれぞれについて、Akを選ぶか選ばないかで総数を偶数あるいは奇数にできる
		// よって答えはPによらず2^(N-1)通りとなる
		ans = pow(2, N-1)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  map<int,int> m;
  rep(i,n){
    int a;
    cin >> a;
    m[a]++;
  }
  int ans = 0;
  for(auto i:m) ans += i.second%2;
  cout << ans << endl;
}


Measured memory_bytes: 4992
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

const int mod = 1e9+7;

int n;
int k;
int q;
int cm[N];

int main(){
    scanf("%d%d%d" , &n , &k , &q);
    while(q--){
        int x;
        scanf("%d" , &x);
        cm[0]--;
        cm[x]++;
        cm[x+1]--;
        cm[n+1]++;
    }
    for(int i = 1; i <= n; i++){
        cm[i] += cm[i - 1];
        if(k+cm[i] > 0){
            puts("Yes");
        } else {
            puts("No");
        }
    }
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
		public static void main(String[] args) {
		
	   Scanner sc = new Scanner(System.in);
	   
	   int N = sc.nextInt();
	   char str[] = sc.next().toCharArray();
		
		for(int i=0; i<str.length; i++) {
			 str[i] = (char) ((str[i] - 'A' + N) % 26 + 'A');
		}
      System.out.println(str);
		}
}


Measured memory_bytes: 22868
#include<stdio.h>

#define N 500000
#define M 1000000000

void merge(int [], int, int, int);
void mergeSort(int [], int, int);

int L[N/2+2],R[N/2+2];
int c=0;

main(){
  int i,n;
  int A[N];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  mergeSort(A,0,n);

  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",c);
  return 0;
}

void merge(int A[], int l, int m, int r){
  int n1;
  int n2;
  int i,j,k;
  n1=m - l;
  n2=r - m;

  for(i=0;i<n1;i++) L[i]=A[l+i];
  for(i=0;i<n2;i++) R[i]=A[m+i];

  L[n1]=R[n2]=M;
  i=0;
  j=0;

  for(k=l;k<r;k++){
    c++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
  }
}

void mergeSort(int A[], int l, int r){
  int m;
  if(l+1<r){
    m=(l+r)/2;
    mergeSort(A, l, m);
    mergeSort(A, m, r);
    merge(A, l, m, r);

  }
}



Measured memory_bytes: 5668
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T>
T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T>
T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T>
bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    double res = 0;
    REP(i, N) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") {
            res += x;
        } else {
            res += x * 380000.0;
        }
    }
    printf("%lf\n", res);
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	N := nextInt()
	A := make([]int, N)
	B := make([]int, N)
	C := make([]int, N-1)

	for i:= 0; i < N; i++ {
		A[i] = nextInt()
	}
	for i:= 0; i < N; i++ {
		B[i] = nextInt()
	}
	for i:= 0; i < N - 1; i++ {
		C[i] = nextInt()
	}

	total := 0
	before := -1
	for _, i := range A {
		index := i - 1
		total += B[index]

		if (before >= 0 && before <= N - 2) && index == before + 1 {
			total += C[before]
		}

		before = index
	}

	fmt.Printf("%d", total)
}


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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int A[N], B[N], C[N];
  for (auto &a : A) cin >> a;
  for (auto &b : B) cin >> b;
  for (auto &c : C) cin >> c;

  sort(A, A + N);
  sort(C, C + N);

  long long ans = 0;

  for (int i = 0; i < N; i++) {
    ans += (lower_bound(A, A + N, B[i]) - A) * (N - (upper_bound(C, C + N, B[i]) - C));
  }

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

Measured memory_bytes: 1408
#include <stdio.h>

int main(){
	int N, i, a[200] = {0}, k=0;
  	
  	scanf("%d", &N);
  	for(i=0; i < N; i++){
  		scanf("%d", &a[i]);
    }
  
  	i = N;
	while(i == N){
      	i = 0;
  		while(a[i]){
      	if(a[i] % 2 == 0) a[i]=a[i]/2;
      	else break;
        i++;
    	}
    k++;
    }
  
  	printf("%d",k-1);
return 0;
}

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

int main(){
    string S,T;
    cin>>S>>T;
    int n=S.size(), m=T.size();
    vector<vector<int>> Dp(n+1, vector<int>(m+1,0));
    for(int i=1; i<=n; ++i){
        for(int j=0; j<=m; ++j){
            if(S[i-1]==T[j-1]) Dp[i][j]=Dp[i-1][j-1]+1;
            else Dp[i][j]=max(Dp[i-1][j],Dp[i][j-1]);
        }
    }
    //cout<<Dp[n][m]<<'\n';
    string Ans="";
    int i=n,j=m;
    while(i>=1 && j>=1){
        if(S[i-1]==T[j-1]){
            Ans+=S[i-1];
            --i;--j;
        }
        else if(Dp[i][j-1]>Dp[i-1][j]){
            --j;
        }
        else --i;
    }
    reverse(Ans.begin(),Ans.end());
    cout<<Ans<<'\n';
}

Measured memory_bytes: 38556
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;

int main(int argc, char **argv) {
    int N, K, trash;
    cin >> N >> K;
    for(int i = 0; i < N; ++i)
        cin >> trash;
    cout << (N - 1 + K - 2) / (K - 1) << endl;
}

Measured memory_bytes: 256