akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define pi acos(-1)
#define pii pair<int,int>
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 1e5 + 10;
const int MAXM = 2e6 + 10;
const ll mod = 1e9 + 7;

vector<pair<int,ll>>vec[MAXN];
ll num[MAXN];
bool flag = true;

void dfs(int u) {
    for(int i=0; i<vec[u].size(); i++) {
        pair<int,ll> v =vec[u][i];
        if(num[v.first] != 1e12) {
            if(num[v.first] - num[u] != v.second) {
//                printf("%d %d\n",u,v.first);
                flag = false;
                return ;
            }
            else continue;
        }
        else {
            num[v.first] = num[u] + v.second;
            dfs(v.first);
        }
    }
}

int main()
{
#ifdef local
    freopen("data.txt","r",stdin);
//    freopen("data.txt","w",stdout);
#endif
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; i++) num[i] = 1e12;
    while(m--) {
        int u,v;
        ll w;
        scanf("%d%d%lld",&u,&v,&w);
        vec[u].push_back(make_pair(v,w));
        vec[v].push_back(make_pair(u,-w));
    }
    for(int i=1; i<=n; i++) {
        if(num[i] == 1e12) {
            num[i] = 0;
            dfs(i);
        }
    }
    if(flag) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 17408
import java.util.Scanner;

/**
 * Hanafuda
 */
public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int n = sc.nextInt();
            int r = sc.nextInt();
            if (n == 0 && r == 0) {
                break;
            }

            int[] fuda = new int[n];
            for (int i = 0; i < n; i++) {
                fuda[i] = n - i;
            }

            for (int i = 0; i < r; i++) {
                int p = sc.nextInt();
                int c = sc.nextInt();
                int[] shuffle1 = new int[p - 1];
                int[] shuffle2 = new int[c];
                for (int j = 0; j < shuffle1.length; j++) {
                    shuffle1[j] = fuda[j];
                }
                for (int j = 0; j < shuffle2.length; j++) {
                    shuffle2[j] = fuda[j + p - 1];
                }
                for (int j = 0; j < shuffle2.length; j++) {
                    fuda[j] = shuffle2[j];
                }
                for (int j = 0; j < shuffle1.length; j++) {
                    fuda[j + c] = shuffle1[j];
                }
            }

            System.out.println(fuda[0]);

        }
        sc.close();
    }
}


Measured memory_bytes: 37204
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int a,b;
    cin >> a >> b;
    dunk(a*b);
    return 0;
}

Measured memory_bytes: 3632
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n,l,t=0;
string s;
int number(){
	int q=0;
	while(t<s.size()&&isdigit(s[t])){
		q*=10;
		q+=s[t]-'0';
		t++;
	}
	return q;
}
vvi f(){
	vvi w(n,vi(n));
	rep(i,n)rep(j,n)w[i][j]=i*n+j;
	while(t<s.size()){
		if(s[t]=='('){
			t++;
			vvi ne=f();
			t++;
			int co=number();
			while(co){
				if(co%2){
					vvi NE(n,vi(n));
					rep(i,n)rep(j,n)NE[i][j]=w[ne[i][j]/n][ne[i][j]%n];
					w=NE;
				}
				vvi NE(n,vi(n));
				rep(i,n)rep(j,n)NE[i][j]=ne[ne[i][j]/n][ne[i][j]%n];
				ne=NE;
				co/=2;
			}
		}else if(s[t]==')')break;
		else{
			char c=s[t];
			t++;
			int co=number()-1;
			int tmp;
			if(c=='U'){
				tmp=w[0][co];
				rep(i,n-1)w[i][co]=w[i+1][co];
				w[n-1][co]=tmp;
			}
			if(c=='D'){
				tmp=w[n-1][co];
				rep(i,n-1)w[n-1-i][co]=w[n-2-i][co];
				w[0][co]=tmp;
			}
			if(c=='L'){
				tmp=w[co][0];
				rep(i,n-1)w[co][i]=w[co][i+1];
				w[co][n-1]=tmp;
			}
			if(c=='R'){
				tmp=w[co][n-1];
				rep(i,n-1)w[co][n-1-i]=w[co][n-2-i];
				w[co][0]=tmp;
			}
		}
	}
	return w;
}
int main(){
	cin>>n>>l>>s;
	t=0;
	vvi out=f();
	rep(i,n)rep(j,n)cout<<out[i][j]+1<<" \n"[j==n-1];
}











Measured memory_bytes: 17388
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();

		int[] c = new int[N];
		int[] t = new int[N];

		for(int i=0; i<N; i++) {
			c[i] = sc.nextInt();
			t[i] = sc.nextInt();
		}

		int cmin = c[0];
		int imin = 0;

		for(int j=0; j<N; j++) {
			if(c[j] < cmin && t[j] <= T) {
				cmin = c[j];
				imin = j;
			}
		}

		if(t[imin] > T) {
			System.out.println("TLE");
		}else {
			System.out.println(cmin);
		}

	}

}


Measured memory_bytes: 23764
import java.util.Scanner; 
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    System.out.println(a+b+c-Math.max(Math.max(a,b),c));
  }
}

Measured memory_bytes: 21844
import sys
from functools import reduce
# from math import log2 // New in Python 3.3, not in PyPy3 2.4 (Python 3.2.5)

N, K = map(int, input().split())

AB = []
for _ in range(N):
    AB.append([int(s) for s in input().split()])

ans = reduce(lambda v, ab: v + ab[1] if K | ab[0] == K else v, AB, 0)
# for i in range(int(log2(K)), 0, -1):
for i in range(int.bit_length(K) - 1, 0, -1):
    if not K & (1 << i):
        continue
    km = K & ~(1 << i) | (1 << i) - 1
    anscand = reduce(lambda v, ab: v + ab[1] if km | ab[0] == km else v, AB, 0)
    ans = max(ans, anscand)
print(ans)


Measured memory_bytes: 23652
#include<stdio.h>

int main(){
  int r, b, g;
  
  scanf("%d %d %d", &r, &b, &g);
  
  if((10*b + g) % 4 == 0){
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  
  return 0;
}

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

void countingSort(int n,int A[]){
    int C[10001]={};//最大数は10000なので。
    for(int i=0;i<n;i++){
        C[A[i]]++;//カウントしていく。
    }
    for(int i=0;i<10000;i++){
        C[i+1]+=C[i];//累積和に。
    }
    int B[n];//出力用配列。
    for(int j=n-1;j>-1;j--){
        B[C[A[j]]-1]=A[j];//カウント数とインデックスが1ズレるの注意。
        C[A[j]]--;
    }
    for(int j=0;j<n;j++){
        if(j)cout<<' ';
        cout<<B[j];
    }
    cout<<endl;
}

int main(){
    int n;cin>>n;int A[n];for(int i=0;i<n;i++)cin>>A[i];
    countingSort(n,A);
    return 0;
}


Measured memory_bytes: 18748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
ll i,j;
long long euclid(long long x,long long y){
    long long a=max(x,y);
    long long b=min(x,y);
    if(a%b==0)return b;
    else{
        return euclid(b,a%b);
    }
}



int main(){
   ll A,B,C,D;
   cin>>A>>B>>C>>D;
   ll E=euclid(C,D);
   ll lcm=C*D/E;

   ll ans=B-A+1;
   ans-=B/C;
   ans+=(A-1)/C;
   ans-=B/D;
   ans+=(A-1)/D;
   ans+=B/lcm;
   ans-=(A-1)/lcm;
   cout<<ans<<endl;
}


Measured memory_bytes: 256
x,n=map(int,input().split())
if n!=0:
  s=set(list(map(int,input().split())))
else:
  s=[]
diff=10**18
ans=10**18
for i in range(-10000,10000):
  if i in s:
    continue
  else:
    if abs(x-i)<diff:
      ans=i
      diff=abs(x-i)
print(ans)


Measured memory_bytes: 9184
#include <stdio.h>

int main(){
    int i,N,T,c,t,res = 1001;
    scanf("%d %d",&N,&T);
    for(i=0;i<N;i++){
        scanf("%d %d",&c,&t);
        if(t<=T && c<res){
            res = c;
        }
    }
    if(res == 1001){
        printf("TLE");
    }else{
        printf("%d",res);
    }
    return 0;
}

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

int main() {
  int N,K,R,S,P,Z=0;
  string T;
  cin>>N>>K>>R>>S>>P>>T;
  for(int i=0;i<K;i++){
    if(T.at(i)=='r'){
      Z+=P;
    }
    else if(T.at(i)=='s'){
      Z+=R;
    }
    else if(T.at(i)=='p'){
      Z+=S;
    }
  }
  for(int i=K;i<N;i++){
    if(T.at(i)==T.at(i-K)){
      T.at(i)='a';
    }
    else if(T.at(i)=='r'){
      Z+=P;
    }
    else if(T.at(i)=='s'){
      Z+=R;
    }
    else if(T.at(i)=='p'){
      Z+=S;
    }
  }
  cout<<Z<<endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	     Scanner sc = new Scanner(System.in);
	     int a = sc.nextInt();
	     int b = sc.nextInt();

	     if ((a * b ) % 2 != 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define lli long long int

int main() {
    int n;
    cin>>n;
    lli a[n+1], prefix[n+1], val[n+1];
    for(int i=1;i<=n;i++)cin>>a[i];
    prefix[0] = 0ll;
    for(int i=1;i<=n;i++){
        prefix[i] = prefix[i-1] + a[i];
        val[i] = val[i-1] + (a[i-1] - 1);
    }    
    lli ans = 1e15;

    for(int i=1;i<=n;i++){
        lli pref = prefix[i];
        lli suff = prefix[n] - prefix[i];
        lli v1 = val[i];
        lli v2 = val[n] - val[i];
        if(pref == suff){
            cout<<"0\n";
            return 0;
        }else if(pref > suff){
            lli left = pref - suff;
            if(v2 >= left){
                ans = min(ans, left);
            }
        }else{
            lli left = suff - pref;
            if(v1 >= left){
                ans = min(ans, left);
            }
        }
    } 
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <limits>
using namespace std;
#define REP(i,n) for(int(i)=0;i<n;i++)

struct edge {
    int to, cost;
};

typedef pair<int, int> P;

vector<vector<edge>> g;
vector<double> d;

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    d[s] = 0;
    que.push(P(0,s));
    
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        REP(i,g[v].size()) {
            edge e = g[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

void appendEdge(int from, int to, int cost) {
    edge e;
    e.to = to;
    e.cost = cost;
    g[from].push_back(e);
}

int main() {
    int n;
    cin >> n;
    g = vector<vector<edge>>(n, vector<edge>());
    d = vector<double>(n,numeric_limits<double>::infinity());
    
    int a, b, c;
    REP(i,n-1) {
        cin >> a >> b >> c;
        appendEdge(a - 1, b - 1, c);
        appendEdge(b - 1, a - 1, c);
    }
    
    int q, k;
    cin >> q >> k;
    
    dijkstra(k - 1);
    
    int x, y;
    
    REP(i,q) {
        cin >> x >> y;
        cout << (long long)d[x - 1] + (long long)d[y - 1] << endl;
    }
}

Measured memory_bytes: 8820
#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define mp make_pair
#define f first
#define s second
#define mod 1000*1000*1000+7
int dp[3010][3010];
int br[3010][2];
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    int n,t;cin>>n>>t;
//    multiset<int> mm;
//    for(int i=0;i<n;i++)
//    {
//        cin>>br[i][0]>>br[i][1];
//    }
//    for(int i=1;i<=n;i++)
//    {
//        for(int j=1;j<=t-1;j++)
//        {
//            if(j>=br[i-1][0])
//            {
//                dp[i][j]=max(dp[i-1][j],dp[i-1][j-br[i-1][0]]+br[i-1][1]);
//            }
//            else
//            {
//                dp[i][j]=dp[i-1][j];
//            }
//        }
//    }
//    int pos=t-1;
//    for(int i=n;i>=1;i--)
//    {
//        if(dp[i][pos]==dp[i-1][pos])
//        {
//            mm.insert(br[i-1][1]);
//        }
//        else
//        {
//            pos-=br[i-1][0];
//        }
//    }
//    int ans=dp[n][t-1]+(mm.size() ? *mm.rbegin() : 0);
//    cout<<ans<<"\n";
    int n, t;
    cin>>n>>t;
    vector<pair<int, int>> a(n);
    for (int i = 0; i<n; i++) cin>>a[i].first>>a[i].second;
    sort(a.begin(), a.end());
    vector<int> dp(t+1);
    dp[0] = 0;
    int best = 0;
    for (int i = 0; i<n; i++)
    {
        best = max(best, dp[t-1]+a[i].second);
        for (int j = t-1; j>=a[i].first; j--) dp[j] = max(dp[j], dp[j-a[i].first] + a[i].second);
    }
    cout<<best;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
ll a,b;
void kill_monst()
{
	cin>>a>>b;
	cout<<(a>=b?(a%b?(a/b)+1:(a/b)):1)<<"\n";
}
int main()
{
	kill_monst();
	return 0;
}

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

int main(){
  long long N,A,B;
  cin >>N >>A >>B;
  long long amari,sho,ans;
  amari=N%(A+B);
  sho=N/(A+B);
  if(amari>=A){
    ans=sho*A+A;
  }
  else ans=sho*A+amari;
  cout<<setprecision(20)<<ans<<endl;
  return 0;
}

  
  


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

// 約数列挙
vector< ll > divisor(ll n) {
	vector< ll > ret;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret), greater<ll>());
	return (ret);
}

int main() {
	string S;
	ll a;
	cin >> a;
	cin >> S;
	if (a >= 3200) {
		cout << S << endl;
		return 0;
	}

	cout << "red" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;

int main(){
    int n,wlim;
    cin >>n>>wlim;
    vector<pair<int,long long>>data(n+1);//wight,value;
    vector<vector<long long>>dp(n+1,vector<long long>(100000+3,0));
    //n,wight->value
    for(int i=0;i<n;i++){
        cin>>data[i].first>>data[i].second;
    }
    for(int N=1;N<=n;N++){
        for(int wight=1;wight<=wlim;wight++){
            chmax(dp[N][wight], dp[N - 1][wight]) ;
            if (wight >= data[N-1].first)
            {
             chmax(dp[N][wight], dp[N - 1][wight - data[N-1].first] + data[N-1].second);
            }
        //    cout <<dp[N][wight]<<" ";
        }
       // cout<<endl;
    }
    cout<<dp[n][wlim];
}


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

using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FOR(i, a) for (int i = 0; i < (a); i++)

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    char c[20];
    int n, p;
    scanf("%d", &n);
    vector<pair<string, pair<int, int>>> v;
    for(int i = 0; i < n; i++){
        scanf("%s %d", c, &p);
        v.push_back({string(c), {p*-1, i+1} });
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < v.size(); i++){
        printf("%d\n", v[i].second.second);
    }
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


Measured memory_bytes: 256
#!/usr/bin/env python3                                                                                        
# -*- coding: utf-8 -*-

n,k = map(int,input().split())
h = list(map(int,input().split()))

h = sorted(h)
ans = 0 
for i in range(n):
    if(h[i] >= k): 
        ans += 1

print(ans)


Measured memory_bytes: 11908
#include <cstdio>
typedef long long ll;
inline int rd(){
    int x=0,p=1;
    char a=getchar();
    while((a<48||a>57)&&a!='-')a=getchar();
    if(a=='-')p=-p,a=getchar();
    while(a>47&&a<58)x=(x<<1)+(x<<3)+(a&15),a=getchar();
    return x*p;
}
const int N=200002,S=5002;
const ll mod=1e9+7;
int n,a[N],b[N];
ll f[S][S];
ll ans,fac[N],inv[N];
inline ll fpow(ll b,ll p=mod-2){
	ll ans=1,tmp=b;
	while(p){
		if(p&1)ans=ans*tmp%mod;
		tmp=tmp*tmp%mod;
		p>>=1;
	}
	return ans;
}
inline ll C(int n,int m){
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main(){
	n=rd();
	for(int i=1;i<=n;i++)a[i]=rd(),b[i]=rd(),f[2020-a[i]][2020-b[i]]++;
	for(int i=1;i<=4040;i++)
		for(int j=1;j<=4040;j++)
			f[i][j]=((f[i][j]+f[i-1][j])%mod+f[i][j-1])%mod;
	fac[0]=1;
	for(int i=1;i<=100000;i++)fac[i]=fac[i-1]*i%mod;
	inv[100000]=fpow(fac[100000]);
	for(int i=99999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
	for(int i=1;i<=n;i++){
		(ans+=f[a[i]+2020][b[i]+2020])%=mod;
		ans=(ans-C(a[i]*2+b[i]*2,a[i]*2)+mod)%mod;
	}
	printf("%lld\n",((ans*fpow(2)%mod)+mod)%mod);
    return 0;
}

Measured memory_bytes: 164736
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
using namespace std;
const ll INF = 1e10;
vector<int> a(3);
int ans;
int main(){
  cin>>a[0]>>a[1]>>a[2];
  sort(a.begin(),a.end());

  if((a[1]-a[0])%2==0){
    ans+=(a[1]-a[0])/2;
    ans+=(a[2]-a[1]);
  }else{
    ans+=((a[1]-a[0])/2+1);
    ans+=(a[2]-a[1]+1);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var xy = IO.RSInt;
            var x = xy[0];
            var y = xy[1];

            if (x % y == 0)
                WriteLine(-1);
            else
                WriteLine(x);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

bool ismm(int n) {
  return (0 < n && n <= 12);
}

// ====================================================================

int main() {
  string s;
  cin >> s;
  int a = 0, b = 0;
  a += (s[0] - '0') * 10 + s[1] - '0';
  b += (s[2] - '0') * 10 + s[3] - '0';
  // cout << a << " " << b << endl;
  if (ismm(a) && ismm(b)) {
    cout << "AMBIGUOUS" << endl;
  } else if (ismm(a) && !ismm(b)) {
    cout << "MMYY" << endl;
  } else if (!ismm(a) && ismm(b)) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
}


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

#define SELECT_NUM 5
#define MAX_NUM 55555
#define N_MAX 55

int main()
{
    int n;
    bool primes[MAX_NUM + 1] = {true, true};
    cin >> n;
    for(int i = 0; i < sqrt(MAX_NUM); ++i)
    {
        if(primes[i] == false)
        {
            for(int j = 2; i*j < MAX_NUM; ++j)
            {
                primes[i*j] = true;
            }
        }
    }

    int num = 0;
    int cnt = 0;
    while(cnt != n)
    {
        if(primes[num] == false
        && num%10 == 1)
        {
            cout << num;
            ++cnt;
            if(cnt != n)
            {
                cout << " ";
            }
        }
        ++num;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
  int N, D;
  cin >> N >> D;
  int X[10][10] = { };
  for (int i = 0; i < N; i++) {
	  for (int j = 0; j < D; j++) {
		  cin >> X[i][j];
		}
	}
  int ans = 0;
  for (int i = 0; i < N; i++) {
	  for (int j = i + 1; j < N; j++) {
		  int dist = 0;
		  for (int k = 0; k < D; k++) {
			  dist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
		  if (floor(sqrt(dist)) * floor(sqrt(dist)) == dist) {
			  ans++;
			}
		}
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n1 = sc.nextInt();
        int n2 = sc.nextInt();
        int n3 = sc.nextInt();
        if(n2 - n1 == n3 - n2){
        	System.out.println("YES");
        }else{
        	System.out.println("NO");
        }
    }
}

Measured memory_bytes: 35648
N = int(input())
A  = [int(input()) for i in range(N)]

dp = [-(10**10)]*N
dp[0] = A[1]-A[0]
for i in range(1,N-1):
    dp[i] = max(A[i+1]-A[i]+dp[i-1], A[i+1]-A[i])

print(max(dp))



Measured memory_bytes: 21388
/******************************\
*  Everyone has a different way of thinking, so God Created us
Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Murad   *
\******************************/
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define MP make_pair
#define ff first
#define ss second
#define INF 2147483647
#define _INF -2147483647
#define pq priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
int main()
{
	El3zba;
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int mi = max({ a,b,c });
	int sum = a + b + c;
	for (int i = 1; i <= k; i++) {
		sum += mi;
		mi += mi;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = map(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = (res+k) // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    vector<ll> a(n),b(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    //sort(a.begin(),a.end());
    //sort(b.begin(),b.end());
    ll pl=0,mn=0;//,r=0;
    for(int i=0;i<n;i++){
      if(a[i]<b[i]){
        pl+=abs(a[i]-b[i])/2;
        //r +=(a[i]-b[i])%2;
      }
      else if(a[i]>b[i]) mn+=(a[i]-b[i]); 
    }
    if(pl>=mn) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 384
n,X=map(int,input().split())
x = list(map(int, input().split()))

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
ans=abs(X-x[0])
for i in range(1,n):
    ans=gcd(ans,abs(X-x[i]))
print(ans)

Measured memory_bytes: 62576
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n,m;
  cin>>n>>m;
  int p[m],y[m];
  
  for(int i = 0; i < m; i++)
  {
    cin>>p[i]>>y[i];
  }

  map<pair<int, int>, int> mp;
  vector<pair<int, int>> pairs(m);
  
  for(int i = 0; i < m; i++)
  {
    pairs[i] = make_pair(p[i], y[i]);
  }
  sort(pairs.begin(), pairs.end());
  int cnt = 0;
  int tmp = pairs[0].first;
  for(int i = 0; i < m; i++)
  {
    if(pairs[i].first != tmp) cnt = 0;
    tmp = pairs[i].first;
    mp[pairs[i]] = ++cnt;
  }
  
  for(int i = 0; i < m; i++)
  {
    int ans = mp[make_pair(p[i], y[i])];
    printf("%06d%06d\n", p[i], ans);
  }

  return 0;
}


Measured memory_bytes: 9344
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    int n;cin >> n;
    if(n<10)cout << n << endl;
    else if(n>=10 && n<100)cout << 9 << endl;
    else if(n>=100 && n<1000)cout << 10+(n-100) << endl; 
    else if(n>=1000 && n<10000)cout << 909 << endl;
    else if(n>=10000 && n<100000)cout << 910+(n-10000) << endl;
    else cout << 90909 << endl;
    return 0;
}

Measured memory_bytes: 256
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, K, S):
    sachi = 0
    L_cluster, R_cluster = (0, 1) if S[0] == 'R' else (1, 0)
    for i in range(N):
        if S[i] == 'R' and i != N - 1 and S[i + 1] == 'R':
            sachi += 1
        if S[i] == 'L' and i != 0 and S[i - 1] == 'L':
            sachi += 1
        if i > 0 and S[i] != S[i - 1]:
            if S[i] == 'R':
                R_cluster += 1
            else:
                L_cluster += 1

    ans = 0
    reverse_cluster = min(L_cluster, R_cluster)
    if K >= reverse_cluster:
        ans = N - 1
    else:
        ans = sachi + K * 2

    print(ans)


if __name__ == '__main__':
    # N = int(input())
    N, K = map(int, input().split())
    S = input()
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, K, S)


Measured memory_bytes: 9252
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
using ll = long long;
using namespace std;
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;
}

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

    string s;
    cin >> s;
    int cnt = 0;
    REP(i, s.size()) {
        if (s[i] == 'o')
            cnt++;
    }

    cnt += 15 - s.size();
    if (cnt >= 8)
        std::cout << "YES" << '\n';
    else
        std::cout << "NO" << '\n';

    return 0;
}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline
import math

def main():
    N = int(input())
    ans = 0
    for i in range(1, N + 1):
        if i % 5 != 0 and i % 3 != 0:
            ans += i
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt();
		if(b / a > c) System.out.println(c);
		else System.out.println(b /a);
	}
}


Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
import copy

X=input()

C={}    #n円を構成する品物の最小個数の集合

for n in range(100):
    org_n=copy.deepcopy(n)
    kosu=0     #n円を構成する品物の最小個数
    for i in range(5,0,-1):     
        kosu+=n/i
        n=n%i   #iで割った余りが残る
        if n==0:
            C[org_n]=kosu
            break

max_kosu=X/100
x=X%100

if max_kosu>=C[x]:
    print 1
else:
    print 0


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

#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
 
namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) {int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) {  for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0;}
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void gp (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::gp;
 
void scan() {
	return;
}
 
template<class T, typename... Args>
void scan(T &a, Args&&... args) {
	gi(a);
	scan(args...);
	return;
}

template<typename T>
void scann(T a, T b) {
	for (auto it = a; it != b; ++it)
		scan(*it);
}
 
template<typename T>
void scerr(T a, T b) {
	for (auto it = a; it != b; ++it)
		cerr << *it << " ";
	cerr << '\n';
}

void print() {
	return;
}
 
template<class T, typename... Args>
void print(T a, Args... args) {
	gp(a);
	pc(' ');
	print(args...);
	return;
}
 
void cer() {
	return;
}
 
template<class T, typename... Args>
void cer(T a, Args... args) {
	cerr << " " << a;
	cer(args...);
	return;
}
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 5e5 + 2;
const int M = 4e6 + 2;
const int mod = 998244353;
const int inf = 2e9 + 3;
const ll INF = 1e16;

void data() {
	#ifdef PC
		freopen("b.in", "r", stdin);
		freopen("b.out", "w", stdout);
	#endif
}

int n, k, d, a;
set <int> was;

int main() {
	data();
	scan(n, k);
	while (k--) {
		scan(d);
		while (d--) {	
			scan(a);
			was.insert(a);
		}
	}
	print(n - sz(was));
}

Measured memory_bytes: 3680
#include<stdio.h>
int main(void)
{
  int a,b;
  int c;
  int d=1; 
  int i;

  while(scanf("%d %d", &a, &b)!=EOF){
    d=1;
    c=a+b;
    for(i=1;i<2000001;i++){
      d*=10;
      if(c/d==0)break;
    }
    printf("%d\n", i);
  }
  return 0;
}

Measured memory_bytes: 600
/* ex_3-4. nknm */

#include <stdio.h>

int main(void){

    //Nを入力
    int N;
    int i;
    

    scanf("%d", &N);

    //Nがiで割り切れ商が９以下の時のみyesを表示
    for(i = 1; i <= 9; i++){
        if(N / i <=9 && N % i == 0){
            printf("Yes\n");
            break;
        }else if(i == 9 && (N > 81 || N % i != 0)){
            printf("No\n");
        }
    }
    return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
#ifdef DEBUG
	
#endif
	int R, G;

	scanf("%d %d", &R, &G);

	float ans = 2*G - R;

	printf("%.0f\n", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string S,C="No";
  cin>>S;
  if(S.at(0)!=S.at(1))C="Yes";
  if(S.at(0)!=S.at(2))C="Yes";
  if(S.at(1)!=S.at(2))C="Yes";
  cout<<C<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
#include <iomanip>
using namespace std;
int main(){
    int n,i;
    double s[1000]={},sum=0,a=0;
    cin >> n;
    while(n!=0){
        for(i=0;i<n;i++){
            cin >> s[i];
            sum+=s[i];
        }
        for(i=0;i<n;i++){
            a+=((sum/n)-s[i])*((sum/n)-s[i])/n;
        }
        cout << fixed;
        cout << setprecision(8) << sqrt(a) << endl;
        cin >> n;
        sum=0;a=0;
    }
    
    return 0;
}


Measured memory_bytes: 3260
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ant = {
                int.Parse(Console.ReadLine()),
                int.Parse(Console.ReadLine()),
                int.Parse(Console.ReadLine()),
                int.Parse(Console.ReadLine()),
                int.Parse(Console.ReadLine()) };
            int k = int.Parse(Console.ReadLine());
            for (int i = 0; i < 5; i++)
            {
                for (int j = i + 1; j < 5; j++)
                {
                    if (Math.Abs(ant[i] - ant[j]) > k)
                    {
                        Console.WriteLine(":(");
                        return;
                    }

                }
            }

            Console.WriteLine("Yay!");
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <type_traits>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;



int main(void) {
	static constexpr uint64 MOD = 1000000007;
	uint32 n;
	std::string s;
	std::cin >> n >> s;
	uint64 dp[5003][5003] = {};
	dp[0][0] = 1;
	for (uint32 i = 1;i <= n;++i) {
		for(uint32 j=0;j<=i;++j) {
			if (j == 0) {
				dp[i][j] = (dp[i - 1][j + 1] * 2 + dp[i - 1][j]) % MOD;
			}
			else {
				dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j + 1] * 2) % MOD;
			}
		}
	}
	std::cout << dp[n][s.length()] << "\n";
	return 0;
}

Measured memory_bytes: 195840
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int x[100001], y[100000];

signed main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> y[i];
	}
	int mx = 0, left = 1, right = n - 1;
	for (int i = 0; i < n-1; i++) {
		int addNum = abs(x[i] - x[i+1]);
		addNum = (addNum % mod) * (left % mod);
		addNum = (addNum % mod) * (right % mod);
		left++;
		right--;
		mx += addNum;
		mx %= mod;
	}
	int my = 0, down = 1, up = m - 1;
	for (int i = 0; i < m - 1; i++) {
		int addNum = abs(y[i] - y[i + 1]);
		addNum = (addNum % mod) * (down % mod);
		addNum = (addNum % mod) * (up % mod);
		down++;
		up--;
		my += addNum;
		my %= mod;
	}

	
	cout << ((mx % mod) * (my % mod) % mod) << "\n";

	return 0;
}

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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int d=max({a,b,c});
    int count=3*d-a-b-c;
    if(count % 2==0){
        cout << count/2 << endl;
    }
    else{
        cout << (count+3)/2 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)	{
	
	int ttotal, htotal, temps, inittsum, inithsum, rest, resh;
	int taros[100];
	int hanakos[100];
	
	while (true)	{
		
		scanf("%d %d", &ttotal, &htotal);
		
		if (ttotal == 0)	{ break; }
		
		// 諸々の初期化
		inittsum = 0;
		inithsum = 0;
		rest = -1;
		resh = -1;
		
		for (int i = 0; i <= ttotal - 1; i++)	{
			
			scanf("%d", &temps);
			
			inittsum += temps;
			taros[i] = temps;
		}
		
		for (int i = 0; i <= htotal - 1; i++)	{
			
			scanf("%d", &temps);
			
			inithsum += temps;
			hanakos[i] = temps;
		}
		
		for (int taro = 0; taro <= ttotal - 1; taro++)	{
			for (int hanako = 0; hanako <= htotal - 1; hanako++)	{
				if (inittsum - taros[taro] + hanakos[hanako] == inithsum + taros[taro] - hanakos[hanako])	{
					rest = taros[taro];
					resh = hanakos[hanako];
					
					goto outside;
				}
			}
		}
		outside:
		
		if (rest == -1)	{
			printf("-1\n");
		} else	{
			printf("%d %d\n", rest, resh);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2584
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

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

int main(void)
{
  int n;
  cin >> n;
  multiset<int> a;
  rep(i, n) {
    int x;
    cin >> x;
    a.insert(- x);
  }
  int ans = 0;
  while(!a.empty()) {
    auto it = a.begin();
    int x = - (*it);
    a.erase(it);
    int y = - 1;
    rep(i, 33) {
      if (x < (1 << i)) {
        y = (1 << i) - x;
        break;
      }
    }
    if (a.find(- y) == a.end()) continue;
    a.erase(a.find(- y));
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10232
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int n;
	cin >> n;
	rep(i, n) {
		VI a(3);
		rep(j, 3)cin >> a[j];
		SORT(a);
		if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])puts("YES");
		else puts("NO");
	}
}


Measured memory_bytes: 2956
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define PI 3.141592653589

int main()
{
	

	ll a;
	cin>>a;
	string b;
	cin>>b;
	ll x=0;
	x+=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
	cout<<(x*a)/100;
	 

	return 0;
}

Measured memory_bytes: 3584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTwoAnagrams solver = new BTwoAnagrams();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTwoAnagrams {
        private static final String YES = "Yes";
        private static final String NO = "No";

        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            char[] s = in.string().toCharArray();
            char[] t = in.string().toCharArray();
            Arrays.sort(s);
            Arrays.sort(t);
            ArrayUtil.reverse(t, 0, t.length - 1);
            if (String.valueOf(s).compareTo(String.valueOf(t)) < 0) {
                out.println(YES);
            } else {
                out.println(NO);
            }
        }

    }

    static final class ArrayUtil {
        private ArrayUtil() {
        }

        public static void reverse(char[] a, int left, int right) {
            while (left < right) {
                char temp = a[left];
                a[left] = a[right];
                a[right] = temp;
                left++;
                right--;
            }
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    int A,B;
    cin >> A >> B;
    int C = (A * 100 + 7) / 8;
    int Ca;
    if(A % 2 == 0) {
        Ca = C + 12;
    }
    else {
        Ca = C + 11;
    }
    int D = B * 10;
    int E = max(C,D);
    int F = min(Ca,D + 9);
    if(E > F) {
        cout << -1 << endl;
    }
    else {
        cout << E << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int, ii> iii;
typedef vector<pair<pair<int,int>,int>> viii;
typedef vector<pair<pair<ll,ll>,ll>> viiil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000
#define MOD 1000000007;

ll a[200005];
ll n;
ll k;

bool check(ll x) {
    int ct = 0;
    rep(i, n) {
        ct += a[i] / x;
        if (a[i] % x != 0) {
            ct++;
        }
    }
    return ct <= (n + k);
}

void solve() {
    cin >> n >> k;
    rep(i, n) cin >> a[i];
    ll lo = 1;
    ll hi = (1 << 30);
    while (lo != hi) {
        ll mid = (lo + hi) / 2;
        if (check(mid)) {
            hi = mid;
        }
        else {
            lo = mid + 1;
        }
    }
    cout << lo << endl;
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

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

}


Measured memory_bytes: 5172