akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int N =fsc.nextInt();
        int R =fsc.nextInt();
        fsc.close();
        if (N < 10) {
        	R += 100*(10-N);
        	System.out.print(R);
        } else {
        	System.out.print(R);
        	
        }
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 32336
#include <iostream>

int main() {
    int W, H, x, y;
    std::cin >> W >> H >> x >> y;
    std::cout << (double)W * H / 2.0 << " ";
    std::cout << (W == x * 2 && H == y * 2 ? 1 : 0) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	cin >> n;
	map<ll,ll> mp;
	REP(i, n) {
		ll a;
		cin >> a;
		mp[a]++;
	}

	ll con = 0;
	for (auto i : mp) {
		con += i.second - 1;
	}

	if (con % 2 == 1) con++;
	
	cout << n - con << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <math.h>

int main()
{
        int n;
        double xa,ya,ra,xb,yb,rb,d;

        scanf("%d",&n);
        while(n--){
                scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
                d=hypot((xa-xb),(ya-yb));
                printf("%d\n",(rb>ra&&d<rb-ra)?-2:(rb<ra&&d<ra-rb)?2:(d>(ra+rb))?0:1);
        }
        return 0;
}

Measured memory_bytes: 652
/*
				C++
				encoding:UTF-8
				Modified: <19/May/2019 06:10:14 PM>

				✪ H4WK3yE乡
				Mohd. Farhan Tahir
				Indian Institute Of Information Technology (IIIT), Gwalior
*/

#include <bits/stdc++.h>

using namespace std;

// clang-format off

#define		 ll                     long long
#define		 mod                    1000000007
#define		 ve                     vector
#define		 pb                     push_back
#define		 umap                   unordered_map
#define		 pq                     priority_queue
#define		 endl                   "\n";
#define		 ff                     first
#define		 ss                     second
#define		 pii                    pair<int, int>
#define		 len(v)                 int(v.size())
#define		 all(v)                 v.begin(), v.end()
#define		 reset(a, b)            memset(a, b, sizeof(a));
#define		 sum(v)                 accumulate(v.begin(), v.end(), (ll)0);
#define		 pr1(x)                 cout<<x<<"\n"
#define		 pr2(x, y)              cout<<x<<" "<<y<<"\n"
#define		 pr3(x, y, z)           cout<<x<<" "<<y<<" "<<z<<"\n"
#define		 prv(v, s, n)           fr(i, s, n) cout<<v[i]<<" "; cout<<"\n"
#define		 fr(i, s, n)            for (ll i = s ; i < n ; ++i)
#define		 dfr(i, s, n)           for (ll i = s ; i > n ; --i)

ll powermod(ll _a,ll _b,ll _m) {ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}

// clang-format on

const int N = 5e5 + 5;
ll parent[N], Rank[N];


ll Find (int x) {
	if (parent[x] != x) {
		parent[x] = Find (parent[x]);
	}
	return parent[x];
}

void Union (int x, int y) {
	ll x_id = Find (x);
	ll y_id = Find (y);
	if (x_id == y_id) return;

	if (Rank[x_id] > Rank[y_id]) {
		parent[y_id] = x_id;
	} else {
		parent[x_id] = y_id;
		if (Rank[x_id] == Rank[y_id]) Rank[y_id]++;
	}
}

int n, m;

void init () {
	fr (i, 1, n + 1) parent[i] = i;
}

signed main () {
	ios_base::sync_with_stdio (false), cin.tie (0);
	cin >> n >> m;
	init ();
	fr (i, 0, m) {
		int x, y, z;
		cin >> x >> y >> z;
		Union (x, y);
	}
	umap< int, int > mp;
	int ans = 0;
	fr (i, 1, n + 1) {
		ll x = Find (i);

		if (mp.find (x) != mp.end ()) continue;
		mp[x] = 1;
		ans++;
	}
	pr1 (ans);
	return 0;
}


Measured memory_bytes: 8996
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int x,y,z;
	cin >> x >> y >> z;
	int sum = x - z*2;
	
	int count = 0;
	while(true){
		sum -= y;
		if(sum < 0)break;
		count++;
		sum -= z;
	}
	
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
N, K  = map(int,input().split())

prb = 0
ans = 0
for i in range(1,N+1):
  #print('i=', i)
  tokuten = i
  cnt =0 
  while tokuten < K:
    tokuten = tokuten *2
    cnt += 1
  prb += 1/N * pow(0.5, cnt)
print(prb)



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

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()

using namespace std;

const int INF = 1e18 + 9;
const int Mod = 1e9 + 7;
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
int chara[100005];
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,t,m,a[2],len=2;
    while(1){
    cin >> n;
    if(n==0)break;
    rep(i,0,n){
        cin >> chara[i];
    }
    int ans=n;
    rep(i,0,n){
        int res=n;int col=chara[i];
        int ma=i-1,us=i+1;
        int ren=1;
        while(1){
        int col=chara[ma];
        //if(i)cout << ma <<endl;
        for(int j=ma;;j--){
            if(j>=0&&col==chara[j])ren++;
            else {ma=j;break;}
        }
        for(int j=us;;j++){
            if(j<n&&col==chara[j])ren++;
            else {us=j;break;}
        }
        if(ren>=4){
            res-=ren;
            ren=0;
        }else{
            break;
        }
        }
        //if(res==2)cout << i << endl;
        ans=min(ans,res);
    }
    cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3272
#include <stdio.h>
#include <math.h>
int main(void){
	int n,y,b,r,t,ans,i;
	double tmp,m;
	while(1){
		scanf("%d",&n);
		if(!n){
			break;
		}
		m=0;
		scanf("%d",&y);
		for(i=0;i<n;i++){
			scanf("%d %d %d",&b,&r,&t);
			if(t==1){
				tmp=1.0+(1.0*y*r/100);
			}
			else{
				tmp=pow(1.0+1.0*r/100,y);
			}
			if(tmp>m){
				m=tmp;
				ans=b;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9
int main()
{
    ll n;
    cin>>n;
    vector<ll> vct(n+1);
    for(ll i=1;i<=n;i++)
        cin>>vct[i];
    ll dp[n];
    dp[0] = 0;
    dp[1] = 0;
    for(int i=2;i<=n;i++){
        dp[i] = INF;
        dp[i] = min(dp[i], dp[i-1] + abs(vct[i] - vct[i-1]));
        if(i>2)
            dp[i] = min(dp[i], dp[i-2]+abs(vct[i]-vct[i-2]));
    }
    cout<<dp[n]<<endl;
    return 0;
}


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

signed main () {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int tak = (c + (b - 1)) / b, aok = (a + (d - 1)) / d;
	if (tak <= aok)
		cout << "Yes\n";
	else if (tak == aok + 1 && a % d && d > a)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, n,m , M, K,a;

vector<ll> v,w;
int main(){
    cin >> N >> M;
    if(N%M == 0 ) cout << N/M;
    else cout << N/M + 1;

    return 0;
}



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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            int[] nums = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            for (int i = 0; i < nums.Length; i++)
            {
                if (nums[i] == 0)
                {
                    Console.WriteLine(i + 1);
                    break;
                }
            }
        }

    }
}


Measured memory_bytes: 27928
import copy
import math
import time
import statistics
import math
import itertools
import bisect
import sys
from decimal import *
from collections import deque


def get_int():
    return int(input())

def get_string():
    return input()

def get_int_list():
    return [int(x) for x in input().split()]

def get_string_list():
    return input().split()

def get_int_multi():
    return map(int, input().split())

def get_string_char_list():
    return list(str(input()))

# print("{} {}".format(a, b))
# a_list = [0] * a
sys.setrecursionlimit(10 ** 6)

def main():
    start = time.time()

    n = get_string()

    wk = 0
    for i in range(len(n)):
        wk += int(n[i])

    if wk % 9 == 0:
        print("Yes")
    else:
        print("No")




    #print(ans)

    #print(time.time() - start)


if __name__ == '__main__':
    main()

Measured memory_bytes: 11356
n, l = map(int, input().split())

apples = list(range(l, l + n))

smallest = min(apples)
biggest = max(apples)

if smallest >= 0:
    print(sum(apples) - smallest)
    exit()

if biggest <= 0:
    print(sum(apples) - biggest)
    exit()

print(sum(apples))


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

#define all(p) p.begin(), p.end()
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define ll long long
#define llu unsigned long long
#define ld long double
#define vll vector<long long int>
#define vi vector<int>
#define pii pair <int, int>
#define pll pair <long long int, long long int>
#define vpii vector<pair<int,int> >
#define nl cout<<"\n"
#define sp cout<<" "
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)

const  int  INF = 0x7f7f7f7f;

int  main ()
{
	ios_base::sync_with_stdio(false);
    //freopen ("input.txt", "r", stdin);
    //freopen ("output.txt", "w", stdout);
	char c;
	cin>>c;
	if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u')
		cout<<"vowel\n";
	else cout<<"consonant\n";
    return  0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M); // M個のコストマスを生成
    for(int i=0; i<M; i++){
        cin >> A[i];  // コストマスを指定
    }
    vector<int> v(N+1); // 全体のマスを生成
    for(int i=0; i<=N; i++){
        v[i]=i;         // マスに数字を指定
    }
    int zero = 0;
    int n = 0;
    for(int i=X; i>=0; i--){       // 0に行く場合のかかるコスト
        for(int j=0; j<M; j++){
            if(i==A[j]){
                zero = zero + 1;
            }
        }
    }
    for(int i=X; i<=N; i++){       // Nに行く場合のかかるコスト
        for(int j=0; j<M; j++){
            if(i==A[j]){
                n = n + 1; 
            }
        }
    }

    if(zero<=n){
        cout << zero << endl;
    }else{
        cout << n << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;



int main(){
	ll N;
	cin >> N;
	REP(i,1,10){
		if(N/i < 10 && N%i==0){
		cout << "Yes" << endl;
		return 0;
		}
	}
	
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
 
bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int digitssum(int x){
  return x%10+x/10%10+x/100%10+x/1000%10+x/10000%10;
}

int main(){
  int n,a,m;
  cin >> n;
  a=1000;
  REP1(i,n/2){
    m=digitssum(i)+digitssum(n-i);
    if (m<a) a=m;
  }
  cout << a;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
int main ( void )
{
    unsigned int n , sum = 0 ;
    cin >> n ;
    for ( int i = 1000 ; n >= 500 ; ) {sum += i ; n -= 500 ; }
    for ( int i = 5 ; n >=5 ; ) {sum += i; n -= i ; }
    cout << sum ;
    return 0 ;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int P,Q,R;
  scanf("%d%d%d",&P,&Q,&R);
  if(P>Q){
    if(P>R)printf("%d",Q+R);
    else printf("%d",P+Q);
  }
  else if(Q>R)printf("%d",P+R);
  else printf("%d",P+Q);
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define REP(i, n) rep (i, n)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define CLR(a) memset((a),0,sizeof(a))
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};
//int dx[]={0,1,0,-1,1,1,-1,-1};
//int dy[]={1,0,-1,0,-1,1,1,-1};
int dx[] = {-1, 0, 1, 1, 0, -1};
int dy[] = {-1, -1, 0, 1, 1, 0};

int N, C;
int A[20][20];
bool vis[20][20];
bool visok[20][20];
int dfs(int i, int j, int c) {
  if (i < 0 || j < 0 || A[i][j] == -1 || vis[i][j] || A[i][j] != c) return 0;
  vis[i][j] = true;
  int res = 1;
  rep(k, 6) res += dfs(i+dy[k], j+dx[k], c);
  return res;
}
bool ok(int i, int j, int c) {
  if (i >= 0 && j >= 0 && A[i][j] == 0) return true;
  if (i < 0 || j < 0 || A[i][j] == -1 || visok[i][j] || A[i][j] != c) return false;
  visok[i][j] = true;
  bool b = false;
  rep(k, 6) {
    int ai = i+dy[k], aj = j+dx[k];
    if (ok(ai, aj, c)) b = true;
  }
  return b;
}


int main(int argc, char *argv[])
{
  while(cin >> N >> C, N) {
    memset(A, -1, sizeof(A));
    rep(i, N) rep(j, i+1) cin >> A[i][j];

    int ans = -10000000;
    rep(k, N) rep(l, k+1) if (A[k][l] == 0) {
      //      cout << ": " << k << " " << l << endl;
      A[k][l] = C;

      int score = 0;
      memset(visok, 0, sizeof(visok));
      memset(vis, 0, sizeof(vis));

      rep(i, N) rep(j, i+1) {
        if (A[i][j] != 0 && !visok[i][j] && !ok(i, j, A[i][j])) {
          //          cout << i << " " << j << " " << visok[i][j] << endl;
          score += (A[i][j] == C ? -1 : 1) * dfs(i, j, A[i][j]);
        }
      }
      ans = max(ans, score);
      A[k][l] = 0;
      //      cout << endl;
    }
    cout << ans << endl;


  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

bool solve(int A, int B, int C,	int D) {
  while(true) {
    C -= B;
    if(C <= 0) return true;
    A -= D;
    if(A <= 0) return false;
  }
  return true;
}

int main() {
  int A, B, C, D; cin>>A>>B>>C>>D;
  cout << (solve(A, B, C, D) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3020
import sys
input = sys.stdin.readline

n, m = map(int,input().split())
C = [list(map(int,input().split())) for i in range(m)]
for i in range(m):
    for j in range(2):
        C[i][j] -= 1

D = [0] * n
M = [[] for i in range(n)]
for i in range(m):
    M[C[i][0]].append(C[i][1])

IN = [0] * n
for i in range(m):
    IN[C[i][1]] += 1

S = []
s = 0

for i in range(n):
    if IN[i] == 0:
        S.append(i)

while s < len(S):
    for x in M[S[s]]:
        IN[x] -= 1
        if IN[x] == 0:
            S.append(x)
    s += 1



for i in range(n):
    for j in range(len(M[S[i]])):
        D[M[S[i]][j]] = max(D[M[S[i]][j]], D[S[i]] + 1)
print(max(D))

Measured memory_bytes: 105284
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b, c; cin >> a >> b >> c;
    if(a+b+1 >= c) cout << b+c << endl;
    else cout << a+b+(b+1) << endl;
}

Measured memory_bytes: 3616
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
  int h,n;
  cin >> h >> n;
  int hh=h+10000;
  vector<int> hel(n),point(n);
  for(int i=0; i<n; i++){
      cin >> hel[i] >> point[i];
  }
  vector<int> dp(hh+1,INT_MAX);
  dp[0]=0;
  for(int i=0; i<n; i++){
      for(int j=hel[i]; j<=hh; j++){
          
          dp[j] = min(dp[j] , dp[j-hel[i]]+point[i]);
          
      }
      
  }
  
//   for(auto it: dp)cout << it << " ";
//       cout << endl;
int mm=INT_MAX;
    for(int i=h; i<=hh; i++)mm=min(mm,dp[i]);
  cout << mm << endl;
  
   return 0;
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define CANCER ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define f first
#define s second
#define mod 1000000007

using namespace std;


int main()
{
	CANCER;
	int n;
	vector< pair<ll,ll> > v;
	set< pair<ll,ll> > st;
	cin>>n;
	int m=n;
	while(m--)
	{
		ll x,y;
		cin>>x>>y;
		v.pb(mp(x,y));
		st.insert(mp(x,y));
	}
	ll p,q,cnt=0,ans=n;
	for(int y=0;y<n;y++)
	{
		for(int x=0;x<y;x++)
		{
			p=v[y].f - v[x].f;
			q=v[y].s - v[x].s;
			cnt=0;
			for(int z=0;z<n;z++)
			{
				if(st.count(mp(v[z].f-p,v[z].s-q))==0)
					cnt++;
			}
			ans=min(ans,cnt);
		}
	}
	cout<<ans<<"\n";

	return 0;
}


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

using namespace std;

#define INF 1e9
#define ll long long
#define MAXS 8005
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

string S;
int X, Y;
vi vert, hori;
bool dp[MAXS][MAXS];

bool check(int goal, vi vec){
    int n = vec.size();

    rep(i,n+1){
        rep(j,MAXS) dp[i][j] = 0;
    }

    dp[0][0] = 1;

    for(int i = 1; i <= n; i++){
        int val = vec[i-1];
        
        rep(j,MAXS){
            if(dp[i-1][j] == 1){
                if(j-val>=0) dp[i][j-val] = 1;
                if(j+val<MAXS) dp[i][j+val] = 1;
            }
        }
    }

    return dp[n][goal];
}

int main(){
    cin >> S >> X >> Y;
    if(S[S.size()-1]!='T') S += 'T'; //パディング

    int tmp = 0;
    bool state = true;

    rep(i, S.size()){
        if(S[i] == 'F'){
            tmp++;
        } else {
            if(state)
                hori.push_back(tmp);
            else
                vert.push_back(tmp);
            tmp = 0;
            state = !state;
        }
    }

    X -= hori[0];
    hori.erase(hori.begin()); //初期値だけシフトして対称性を保つ
    X = abs(X);
    Y = abs(Y);
    // printf("goal: (%d,%d)\n",X,Y);

    // printf("vertical: ");
    // rep(i,vert.size())
    //     cout << vert[i] << " ";
    // cout << endl;

    // printf("horizontal: ");
    // rep(i,hori.size())
    //     cout << hori[i] << " ";
    // cout << endl;

    if(check(Y,vert) && check(X, hori)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n>29){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main(){
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if((x - r)>=0 && (x + r)<=w && (y - r)>=0 && (y + r)<=h){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val Array(uku, usi) = readLine.trim.split(' ').map(_.toLong)
  println(math.min(killUkuFirst(uku, usi), killUsiFirst(uku, usi)))
  def killUsiFirst(uku: Long, usi: Long): Int = {
    val ukuT = new Team(uku)
    val usiT = new Team(usi)
    var count = 0
    while (ukuT.isAlive && usiT.isAlive){
      usiT.decrease(ukuT.maxVote)
      if (usiT.isAlive){
        ukuT.decrease(usiT.minVote)
        count += 1
        if (ukuT.isAlive) count += 1
      }
    }
    count
  }
  def killUkuFirst(uku: Long, usi: Long): Int = {
    val ukuT = new Team(uku)
    val usiT = new Team(usi)
    var count = 0
    while (ukuT.isAlive && usiT.isAlive){
      usiT.decrease(ukuT.minVote)
      if (usiT.isAlive){
        ukuT.decrease(usiT.maxVote)
        count += 1
        if (ukuT.isAlive) count += 1
      }
    }
    count
  }
  class Team(private val start: Long) {
    private var health: Long = start * 2
    def decrease(vote: Long): Unit = {
      health -= vote
    }
    def maxVote: Long = math.min(start, health)
    def minVote: Long = (health + 1) / 2
    def isAlive: Boolean = health > 0
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 44224
#include <iostream>

int main(void) {
	// input
	long long N;
	std::cin >> N;

	// loop (h, n)
	for(long long h = 1; h <= 3500; ++h) {
		for(long long n = 1; n <= 3500; ++n) {
			if((4*h*n - N*h - N*n) > 0 && (N*h*n) % (4*h*n - N*h - N*n) == 0) {
				long long w = (N*h*n) / (4*h*n - N*h - N*n);
				std::cout << h << " " << n << " " << w << std::endl;
				goto _end;
			}
		}
	}

	_end:
	return 0;
}


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

const int LIMIT = 10000000;

char in[LIMIT], *p = in;

__inline int nextInt(void) {

    register int res = 0;
    register bool neg = false;

    while (*p < '0' || *p > '9')
        if (*p++ == '-')neg ^= 1;

    while (*p >= '0' && *p <= '9')
        res = res * 10 + *p++ - '0';

    return neg ? -res : res;

}

int min(int x, int y) {
	return x < y ? x : y;	
}

#define N 100005

struct Node {
	
	int lt, rt, mid, mini;
	
}tree[N << 2];

void build(int t, int l, int r) {
	
	Node &tr = tree[t];
	
	tr.lt = l, tr.rt = r;
	tr.mini = 2147483647;
	
	if (l ^ r) {
		tr.mid = (l + r) >> 1;
		build(t << 1, l, tr.mid);
		build(t << 1 | 1, tr.mid + 1, r);
	}
	
}

int query(int t, int l, int r) {
	
	Node &tr = tree[t];
	
	if (tr.lt == l && tr.rt == r)
		return tr.mini;
	
	if (r <= tr.mid)
		return query(t << 1, l, r);
	if (l > tr.mid)
		return query(t << 1 | 1, l, r);
	return min(
		query(t << 1, l, tr.mid),
		query(t << 1 | 1, tr.mid + 1, r)
	);
	
}

void change(int t, int x, int y) {
	
	Node &tr = tree[t];
	
	if (tr.lt == tr.rt) {
		tr.mini = y; return;	
	}
		
	if (x <= tr.mid)
		change(t << 1, x, y);
	else
		change(t << 1 | 1, x, y);
	
	tr.mini = min(
		tree[t << 1].mini,
		tree[t << 1 | 1].mini
	);
	
}

signed main(void) {

	fread(p, 1, LIMIT, stdin);
	
	register int n, m;
	
	n = nextInt();
	m = nextInt();
	
	build(1, 0, n - 1);
	
	for (register int i = 1, k, x, y; i <= m; ++i) {
		
		k = nextInt();
		x = nextInt();
		y = nextInt();
		
		if (k)printf("%d\n", query(1, x, y));
		else change(1, x, y);
		
	}	

}

Measured memory_bytes: 8696
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>

using namespace std;

#define ll long long

int main(void){
    double a, b;
    double h, m;
    cin >> a >> b >> h >> m;

    double theta = abs(2.0*M_PI*h/12.0 + 2.0*M_PI*m/720.0 - 2.0*M_PI*m/60.0);

    if(theta >= M_PI){
        theta = 2.0*M_PI - theta;
    }

    // cout << theta << endl;

    printf("%.20lf\n", sqrt(a*a + b*b - 2.0*a*b*cos(theta)));

    return 0;
}

Measured memory_bytes: 4192
import Control.Monad

toYen :: [String] -> Float
toYen [x, unit] = if unit == "BTC"
                  then i * 380000
                  else i
  where i = read x

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n $ toYen . words <$> getLine
  print $ sum xs

Measured memory_bytes: 636
#include <bits/stdc++.h>
#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, x;
    cin >> n >> x;
    int a[n];
    rep(i,n) cin >> a[i];
    sort(a, a+n);
    int ans = 0;
    rep(i,n) {
        if (i == n-1) {
            if (x == a[i]) ans++;
            break;
        }
        if (x >= a[i]) {
            x -= a[i];
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){

  int n;

  while(cin>>n,n!=0){
    int sa=0,sb=0,a,b;
    for(int i=0;i<n;i++){
      cin>>a>>b;
      if(a==b){
	sa+=a;
	sb+=b;
      } else if(a>b){
	sa+=a+b;
      } else {
	sb+=a+b;
      }
    }

    cout<<sa<<" "<<sb<<endl;
  }

}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  if(b%a==0){
    cout<<a+b<<"\n";
  }
  else{
    cout<<b-a<<"\n";
  }
  return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n,m;
  cin >> n >> m;
  vector<int64_t> a(n);
  rep(i,n){
    cin >> a[i];
  }
  vector<int64_t> ruiseki(n);
  map<int64_t,int64_t> mp;
  mp.insert(make_pair(0,1));
  rep(i,n){
    if(i == 0){
      ruiseki[0] = a[0] % m;
    }else{
      ruiseki[i] = (ruiseki[i-1] + a[i]) % m;
    }
    if(mp.find(ruiseki[i]) == mp.end()){
      mp.insert(make_pair(ruiseki[i],1));
    }else{
      mp[ruiseki[i]]++;
    }
  }
  int64_t cnt = 0;
  for(auto p:mp){
    //cout << p.first << "," << p.second << endl;
    int64_t k = p.second;
    cnt += k*(k-1)/2;
  }
  cout << cnt << endl;
  
  
      
}

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

namespace CSharpSample01
{

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

			var answer = 0;

			if (M >= 2)
			{
				answer += (M * (M - 1)) / 2;
			}

			if (N >= 2)
			{
				answer += (N * (N - 1)) / 2;
			}

			Console.WriteLine(answer);
		}

	}
}

Measured memory_bytes: 13268
n=int(input())
p=[list(map(int,input().split()))for _ in range(n)]
ax,ay,ah=list(filter(lambda x:x[2],p))[0]
for x in range(101):
  for y in range(101):
    H=ah+abs(ax-x)+abs(ay-y)
    if all(max(H-abs(t[0]-x)-abs(t[1]-y),0)==t[2]for t in p):
      print(x,y,H)

Measured memory_bytes: 50140
#include <bits/stdc++.h>
#define maxn 200010
using namespace std;
typedef long long LL;
LL c[maxn], a[maxn];
int main() {
//    freopen("in.txt", "r", stdin);
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
    LL base = 0;
    for (int i = 1; i < n; ++i) {
        LL s = a[i-1], t = a[i];
        if (t < s) t += m;
        base += t - s;
        c[s+2] += 1, c[t+1] -= t-s, c[t+2] += t-s-1;
    }
    for (int i = 1; i <= (m<<1); ++i) c[i] += c[i-1];
    for (int i = 1; i <= (m<<1); ++i) c[i] += c[i-1];
    LL maxx = 0;
    for (int i = 1; i <= m; ++i) maxx = max(maxx, c[i] + c[i+m]);
    printf("%lld\n", base - maxx);
    return 0;
}


Measured memory_bytes: 2560
import sys
e = sys.stdin.readlines()
while 1:
 r=int(e[0].split()[0])
 if r<1:break
 d=[int(''.join(x),2)for x in zip(*map(lambda x:x.split(),e[1:r+1]))]
 a=[]
 for i in range(1<<r):
  b=0
  for j in d:
   c=bin(i^j).count('1')
   b+=c if c>r//2 else r-c
  a+=[b]
 print(max(a))
 del e[:r+1]


Measured memory_bytes: 6976
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <sstream>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <istream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef struct{
    int a;
    int b;
} Num;

bool asc( const Num& left, const Num& right ) {
    return left.a < right.a;
}

int main()
{
    int N;
    long K;
    cin >> N >> K;
    vector<Num> num(N);
    for(int i = 0; i < N; i++) {
        cin >> num[i].a >> num[i].b;
    }

    sort(num.begin(), num.end(), asc);

    long t = K;
    int i = 0;
    while(t > 0) {
        t -= num[i].b;
        i++;
    }
    --i;
    cout << num[i].a << endl;
}


Measured memory_bytes: 1024
l=[0]*4
for _ in range(3):
    a,b=map(int, input().split())
    l[a-1]+=1
    l[b-1]+=1
l.sort()
if l[0]==1 and l[1]==1 and l[2]==2 and l[3]==2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
using System;
using System.Linq;

namespace ABC081_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var f = true;
            var c = 0;

            while (f)
            {
                for (int i = 0; i < N; i++)
                {
                    if (A[i] % 2 == 0) A[i] /= 2;
                    else f = false;
                }
                if (!f) break;
                c++;
            }
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    int n;
    cin>>n;
    vll v(n),div(n,0);
    rep(i,n)cin>>v[i];
    rep(i,n){
        while(v[i]%2==0){
            v[i]/=2;
            div[i]++;
        }
    }
    int sum=0;
    rep(i,n)sum+=div[i];
    fin(sum);
}



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

using namespace std;

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x, y;
    for (size_t i = 0; i < N; i++) {
        int p;
        cin >> p;
        x.push_back(p);
    }
    x.push_back(X);
    for (size_t i = 0; i < M; i++) {
        int p;
        cin >> p;
        y.push_back(p);
    }
    y.push_back(Y);

    int x_max = *max_element(x.begin(), x.end());
    int y_min = *min_element(y.begin(), y.end());

    if( x_max < y_min ) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }
}


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

using namespace std;


int main(){
        int E;
        while(cin >> E && E){
                int m=1000000;
                for(int z=0; z*z*z<=E; ++z){
                        for(int y=0; y*y+z*z*z<=E; ++y){
                                int x = E-z*z*z-y*y;
                                m = min(m,x+y+z);
                        }
                }
                cout << m << endl;
        }

}

Measured memory_bytes: 1164
L, R = map(int, input().split())

if R - L >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        x = i % 2019
        for j in range(i + 1, R + 1):
            a = x * j
            ans = min(a % 2019, ans)

print(ans)


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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
     ifstream in("input.txt");
     cin.rdbuf(in.rdbuf());
  //*/
  int A, B, X;
  cin >> A >> B >> X;
  if(A <= X && A + B >= X) cout << "YES" <<endl;
  else cout << "NO"<<endl;
}


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

int main() {
  int a;
  cin >> a;
  if(a == 25){
    cout << "Christmas" << endl;
  }
  else if(a == 24){
    cout << "Christmas Eve" << endl;
  }
  else if(a == 23){
    cout << "Christmas Eve Eve" << endl;
  }
  else{
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

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

struct point {
	double x;
	double y;
};

int main(void) {
	struct point a1, a2, b1, b2;
	
	while(cin >> a1.x >> a1.y >> a2.x >> a2.y >> b1.x >> b1.y >> b2.x >> b2.y) {
		bool flag  = false;
		
		if(b2.x >= a1.x && b1.x <= a2.x) {
			if(b2.y >= a1.y && b1.y <= a2.y) {
				flag = true;
			}
		}
		
		if(flag) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}


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

using namespace std;

int n;
int v[21];
int c;
int ans;

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


Measured memory_bytes: 256
import numpy as np
N = int(input())
p = np.array(list(map(int,input().split())))
a0 = 0
for i in range(0,N,2):
    a0 += p[i]
    
for i in range(1,N-1,2):
    a0 -= p[i]
    
ans2 = [a0]*N
# iは-1している(slice)ので、+1しないといけないことに注意
for i,one in enumerate(p[1:]):
    ans2[i+1] = 2*p[i] - ans2[i] 
    
ans_s = ""
for one in ans2:
    ans_s += "{} ".format(one)
ans_s = ans_s[:-1]

print(ans_s)

Measured memory_bytes: 23104
import sys
input = sys.stdin.readline

class SegTree:
    def __init__(self, size, f, I):
        n = 1
        while n < size:
            n <<= 1
        self.size = n
        self.f = f
        self.I = I
        self.node = [I] * (2*n)

    def update(self, k, x):
        k += self.size
        self.node[k] = x
        while k > 1:
            k >>= 1
            self.node[k] = self.f(self.node[2 * k], self.node[2 * k + 1])

    def query(self, a, b):
        L = R = self.I
        a += self.size
        b += self.size
        while a < b:
            if a & 1:
                L = self.f(L, self.node[a])
                a += 1
            if b & 1:
                b -= 1
                R = self.f(self.node[b], R)
            a //= 2
            b //= 2
        return self.f(L, R)

n, q = map(int, input().split())
rmq = SegTree(n, lambda x, y: min(x, y), (1 << 31) - 1)
for _ in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        rmq.update(x, y)
    else:
        print(rmq.query(x, y + 1))



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

using namespace std;

int main()
{
	int H, W, N;
	cin >> H >> W >> N;
	vector<int> a(N);
	for (auto &x : a) cin >> x;
	vector<vector<int>> ans(H, vector<int>(W, 0));

	for (int i = 0; i < H * W; ) {
		for (int j = 0; j < N; ++j) {
			for (int m = 0; m < a[j]; ++m) {
				int y = i / W;
				int x = i % W;
				ans[y][x] = j + 1;
				++i;
			}
		}
	}
	for (int i = 1; i < H; i += 2) {
		std::reverse(ans[i].begin(), ans[i].end());
	}
	for (auto &row : ans) {
		cout << row[0];
		for (int x = 1; x < W; ++x) {
			cout << " " << row[x];
		}
		cout << endl;
	}
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

const int INF = 1001001001;

int ck(int a)
{
    if (a == 1)
    {
        return 0;
    }
    for (int i = 2; i * i <= a; i++)
    {
        if (a % i == 0)
        {
            return 0;
        }
    }
    return 1;
}

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

    vector<ll> su(n), cum(n + 1, 0);
    rep(i, n) cin >> su[i];
    rep(i, n) cum[i + 1] += su[i] + cum[i];

    // rep(i, n)
    // {
    //     cout << cum[i] << ' ';
    // }
    // cout << endl;

    map<ll, ll> mp;
    rep(i, n + 1)
    {
        mp[cum[i]]++;
    }

    ll ans = 0;
    for (auto itr:mp)
    {
        ll n = itr.second;
        debug(n);
        ans += n * (n - 1) / 2;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    ll K, A, B;
    cin >> K >> A >> B;
    if(A + 2 < B) {
        ll ans = A;
        K -= A - 1;
        ans += (K/2)*(B - A) + K%2;
        cout << ans << endl;
    } else {
        cout << K + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// to_string(数値)
// %0桁数d とすると表示桁数が「桁数」に満たない場合に0埋めされる
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// printf("%02d:%02d:%02d",hour,minute,second);
// 降順 sort(a.begin(),a.end(),greater<int>());
// bitset<ビット数> 変数名;  // すべてのビットが0の状態で初期化される
// bitset<ビット数> 変数名("ビット列");  // 指定したビット列で初期化される
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int h,w,a,b;
  cin >> h >> w >> a >> b;
  for(int i=0;i<b;i++){
    for(int j=0;j<a;j++) cout << 1;
    for(int j=a;j<w;j++) cout << 0;
    cout << endl;
  }
  for(int i=b;i<h;i++){
    for(int j=0;j<a;j++) cout << 0;
    for(int j=a;j<w;j++) cout << 1;
    cout << endl;
  }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    int modsum = 0; unordered_map<int, int> m;
    REP(i, 0, N) {
        modsum = (modsum + A[i]) % M;
        m[modsum]++;
    }

    ll ans = 0; modsum = 0;
    REP(i, 0, N) {
        ans += m[modsum];
        modsum = (modsum + A[i]) % M;
        m[modsum]--;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7084
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

const int MAX_N = 10000;

struct UnionFind
{
  int par[MAX_N];
  int rank[MAX_N];

  void init(int n){
    for(int i = 0; i < n; i++){
      par[i] = i;
      rank[i] = 0;
    }
  }

  int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);

    if(x == y) return;
    
    if(rank[x] < rank[y]) par[x] = y;
    else{
      par[y] = x;
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
};


struct Edge{
  int u, w, cost;
};

bool comp(const Edge &e1, const Edge &e2)
{
  return e1.cost < e2.cost;
}

const int MAX_E = 100000;
Edge es[MAX_E];
int v, e;


int kruskal()
{
  sort(es, es + e, comp);
  UnionFind uf;
  uf.init(v);
  int ans = 0;

  for(int i = 0; i < e; i++){
    Edge et = es[i];

    if(!uf.same(et.u, et.w)){
      uf.unite(et.u, et.w);
      ans += et.cost;
    }
  }

  return ans;
}


int main()
{
  int gv, ge;
  cin >> gv >> ge;
  v = gv;
  e = ge;
  for(int i = 0; i < e; i++){
    Edge et;
    cin >> et.u >> et.w >> et.cost;
    es[i] = et;
  }

  cout << kruskal() << endl;
}

Measured memory_bytes: 2428