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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();
		int a[] = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		int sum = 0;
		for (int i = 0; i < n; i++) {
			int cnt = 0;
			int j = 0;
			while (true) {
				cnt = j * a[i] + 1;
				if (cnt <= d) {
					j++;
				} else {
					break;
				}
			}
			sum += j;
		}

		System.out.println(sum + x);

		sc.close();
	}

}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int main() {
	int x;
	while (cin >> x, x) {
		int ans = INF;
		REP(i, 5000/200 + 1) REP(j, 5000/300 + 1) REP(k, 5000/500 + 1) if (i*200+j*300+k*500 == x) {
			int tmp = int(i / 5 * (380 * 0.8) * 5 + i % 5 * 380
					+ j / 4 * (550 * 0.85) * 4 + j % 4 * 550
					+ k / 3 * (850 * 0.88) * 3 + k % 3 * 850);
			ans = min(ans, tmp);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
//coded by: pranonrahman-------------------------------------
//-----------------------------------------------------------
//-----------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define O_O ios_base::sync_with_stdio(0); cin.tie(NULL)
#define endl '\n'
#define PI acos(-1.0)
#define CASE(n) cout << "Case " << n << ": "
#define CASE_(n) cout << "Case " << n << endl
#define FIXED(n) cout << fixed << setprecision(n)
#define testPrint(n) cout << "test" << n << endl;


int main()
{
    O_O;
    long long t=1;
    //cin >> t;
    long long T = t;
    while(t--)
    {
        //write your code here
        int n,k;
        cin >> n >> k;
        int arr[n+5];
        for(int i=0;i<n;i++)    cin >> arr[i];
        sort(arr,arr+n);
        int sum=0;
        for(int i=0;i<k;i++)    sum+=arr[i];
        cout << sum << endl;
    }
    return 0;
}




Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
    int H,W;
    cin>>H>>W;
    vector<string>G(H);
    int cnt=0;
    for(int i=0;i<H;i++)cin>>G[i];
    queue<pair<int,int>>que;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(G[i][j]=='#'){
                    que.push(make_pair(i,j));
                    cnt++;
                }
            }
        }
        int tmp=0;
        int ans=0;
        int dx[4]={0,0,-1,1};
        int dy[4]={1,-1,0,0};
        while(!que.empty()){
            auto v=que.front();
            que.pop();
            cnt--;
            int flag=0;
            for(int i=0;i<4;i++){
                int x=v.second+dx[i];
                int y=v.first+dy[i];
                if(x<0||x>=W||y<0||y>=H)continue;
                if(G[y][x]=='#')continue;
                G[y][x]='#';
                que.push(make_pair(y,x));
                tmp++;
            }
            if(cnt==0){
                cnt=tmp;
                tmp=0;
                ans++;
            }
        }
        cout<<ans-1<<endl;
    
}

Measured memory_bytes: 9488
var input=require("fs").readFileSync("/dev/stdin","utf8");

input=input.split(" ");
var a=parseInt(input[0]);
var b=parseInt(input[1]);

if(a<b){
    console.log("a < b");
}
else if(a>b){
    console.log("a > b");
}
else{
    console.log("a == b");
}




Measured memory_bytes: 15096
import math

n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

#x,yどちらも0のエンジンは捨てる
xy2 = []
for x,y in xy:
    if(x==y==0):
        continue
    xy2.append((x,y))

#使えるエンジンが0個だったら0を出力して終了
n = len(xy2)
if(n==0):
    print(0)
    exit()

degs = [0]
for x,y in xy2:
    deg = math.atan2(y,x)
    deg1 = (deg + math.pi*0.5)%(2*math.pi)
    deg2 = (deg + math.pi*1.5)%(2*math.pi)
    degs.append(deg1)
    degs.append(deg2)

degs.append(2*math.pi)
degs.sort()

ans = 0
for i in range( len(degs)-1 ):
    deg = (degs[i+1]+degs[i])/2
    sum_x = 0
    sum_y = 0
    for x,y in xy2:
        tmp = x*math.cos(deg) + y*math.sin(deg)
        if (tmp > 0):
            sum_x += x
            sum_y += y
        ans = max(ans, (sum_x**2 + sum_y**2)**0.5)

print(ans)

Measured memory_bytes: 39792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(v) v.begin(),v.end()
#define mod 1000000007
#define MOD -2


ll dig[100]={0};
//dp[i]はi番目までのサプリの取り方

int main(){
  ll n;
  cin >> n;
  ll res,tmp=n;
  if(tmp==0){
    cout << 0;
  }else{
    rep(i,80){
      if(tmp>0){
        dig[i]=tmp%2;
        tmp=(tmp-dig[i])/(-2);
      }else if(tmp<0){
        dig[i]=(-tmp)%2;
        tmp=(-tmp+dig[i])/2;
      }
      if(res==1){
        dig[i+1]=1;
        break;
      }
    }
    bool flag=false;
    rep(i,80){
      if(dig[79-i]==1)flag=true;
      if(flag)cout << dig[79-i];
    }
  }
  cout << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> x(n),y(n),h(n);
    for(int i = 0; i < n; i++)
    {
        cin >> x.at(i) >> y.at(i) >> h.at(i);
    }

    int H;
    int ki;
    bool flag;
    for(int i = 0; i < 101; i++)
    {
        for(int j = 0; j < 101; j++)
        {
            flag = true;
            H = 0;
            ki = 0;
            do {
                if (h.at(ki) != 0) {
                    if (i == x.at(ki) && j == y.at(ki)) {
                        H = h.at(ki);
                    }
                    else {  
                        H = h.at(ki) + abs(i - x.at(ki)) + abs(j - y.at(ki));
                    }
                }
                ki++;
            } while (H == 0);
           
            for(int k = ki; k < n; k++)
            {   
                if (h.at(k) != max((H - abs(i - x.at(k)) - abs(j - y.at(k))), 0)) {
                    flag = false;
                    break;
                }
            } 
            for (int k = 0; k < n; k++) {
                if (h.at(k) == 0) {
                    if (h.at(k) != max((H - abs(i - x.at(k)) - abs(j - y.at(k))), 0)) {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag) {
                cout << i << " " << j << " " << H << endl;
                return 0;
            }
        }
    }   
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrr
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<int> s = new List<int>();
            int ans = 0;
            for (int i = 0; i < N; i++)
            {
                int obj = int.Parse(Console.ReadLine());
                if (s.Contains(obj)==false)
                {
                    s.Add(obj);
                    ans++;

                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
// 解き直し.
// https://img.atcoder.jp/abc154/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int dp0[111][4]; // 上からi桁目まで決めて, 0でない桁がj個あり, Nより小さいことが確定.
int dp1[111][4]; // 上からi桁目まで決めて, 0でない桁がj個あり, Nより小さいことが未確定.

int main(){
    
    // 1. 入力情報.
    int K;
    char N[111];
    scanf("%s %d", N, &K);
    int d = strlen(N);
    
    // 2. 解説通り.
    // 2-1. dp1更新.
    int c = 1;
    dp1[0][c] = 1; // 1桁目を更新.
    repx(i, 1, d){
        if(N[i] > '0') c++;
        if(c > K)      break; // この条件が無いと, 上手く動作しないように見える.
        dp1[i][min(3, c)] = 1;
    }
    
    // 2-2. dp0更新.
    // 1桁目を更新.
    dp0[0][0] = 1;
    dp0[0][1] = N[0] - '1';
    
    // 2桁目以降を更新.
    repx(i, 1, d) dp0[i][0] = 1;
    repx(i, 1, d){
        repx(j, 1, 4){
            dp0[i][j] = dp0[i - 1][j - 1] * 9;
            dp0[i][j] += dp0[i - 1][j] * 1;
            dp0[i][j] += dp1[i - 1][j - 1] * (N[i] > '1') * (N[i] - '1');
            dp0[i][j] += dp1[i - 1][j] * (N[i] > '0');
        }
    }
    
    // 3. 出力.
    printf("%d\n", dp0[d - 1][K] + dp1[d - 1][K]);
    return 0;
    
}

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

int main(){
    int n,ans=0;
    cin>>n;

    string s;
    cin>>s;

    for(int i=0;i<n-1;i++){
        if(s[i]!=s[i+1])ans++;
    }

    cout<<ans+1<<endl;

    return 0;
}

Measured memory_bytes: 512
#include<cstdio>
bool setdp[303][303][303];
double dp[303][303][303];
int n, ones, twos, threes;
double N;

double calc(int a, int b, int c){
	double aa=a, bb=b, cc=c;
	if(a<0 || b<0 || c<0)return 0;
	if(setdp[a][b][c])return dp[a][b][c];
	setdp[a][b][c]=true;
	dp[a][b][c] = (N/(aa+bb+cc) 
				+ (aa/(aa+bb+cc))*calc(a-1,b,c) 
				+ (bb/(aa+bb+cc))*calc(a+1,b-1,c) 
				+ (cc/(aa+bb+cc))*calc(a,b+1,c-1));
	return dp[a][b][c];
}

int main(){

	scanf("%d", &n);
	N=n;
	for(int i=0;i<n;i++){
		int x; scanf("%d", &x);
		if(x==1)ones++;
		else if(x==2)twos++;
		else threes++;
	}
	setdp[0][0][0]=1;
	printf("%.10lf", calc(ones, twos, threes));
}


Measured memory_bytes: 243968
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
   ll n,m;
   cin>>n>>m;
   vector<string>s(n);
   ll i,j;
   for(i=0;i<n;i++)
   {
       cin>>s[i];
   }

   unordered_map<ll,ll>mpi,mpj;
   for(i=0;i<n;i++)
   {
       ll flag=1;
       for(j=0;j<m;j++)
       {
           if(s[i][j]=='#')
           {
               flag=0;
               break;
           }
       }
       if(flag)
       {
           mpi[i]++;
       }
   }

   for(i=0;i<m;i++)
   {
       ll flag=1;
       for(j=0;j<n;j++)
       {
           if(s[j][i]=='#')
           {
               flag=0;
               break;
           }
       }
       if(flag)
       {
           mpj[i]++;
       }
   }

   vector<string>ans;
   string ss;

   for(i=0;i<n;i++)
   {
       ss="";
       for(j=0;j<m;j++)
       {
           if(mpi[i]>0 || mpj[j]>0)
           {
               continue;
           }
           else
           {
               ss+=s[i][j];
           }
       }
       ans.pb(ss);

   }

   for(i=0;i<ans.size();i++)
   {
       if(s[i]!="")
       {


            cout<<ans[i]<<endl;
       }
   }
}


Measured memory_bytes: 256
from itertools import *
n,m,v,p,*a=map(int,open(0).read().split())
a.sort(reverse=True)
acc=list(accumulate(a))+[0]
ok,ng=p-1,n
while ng-ok>1:
	mid=(ok+ng)//2
	if a[mid]+m>=a[p-1] and (a[mid]+m)*(mid-p+1)-(acc[mid-1]-acc[p-2])>=m*(v-(p-1)-(n-mid)):
		ok=mid
	else:
		ng=mid
print(ok+1)

Measured memory_bytes: 14564
#include <iostream>
#include <malloc.h>
int main()
{

	int n;
	scanf("%d", &n);
	//int count = 0;
	int* x = (int*)malloc(sizeof(int)*n);
	for (int m = 0; m < n; m++) {
		scanf("%d", x + m);
	}
	for (int k = 1; k <= n; k++) {
		int h = 0;
		while (1) {
			if (k == *(x + h)) {
				printf("%d ", h + 1);
				break;
			}
				h++;
		}
	}
	free(x);
}

Measured memory_bytes: 1152
/*
AUTHOR : Chandan Agrawal
College : Poornima College of Engg. jaipur, Raj
Mail : chandanagrawal23@gmail.com
*/

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 100050

#define ll long long
#define ld long double
#define lli long long int

#define pb emplace_back
#define INF 1000000000
#define mod 1000000007

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define loop(i,n) for (lli i = 0; i < n; i++)
#define loopitr(xt,vec) for (auto xt : vec)
#define FOR(i,a,b) for (lli i = a; i < b; i+=1)
#define loop_rev(i,n) for (lli i = n-1; i >= 0; i--)
#define FOR_REV(i,a,b) for (lli i = a; i >= b; i--)
#define itr :: iterator it
#define WL(t) while(t --)

#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>
#define vi vector<lli>
#define seti set<lli>
#define pii pair<lli,lli>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

template <typename T>
void print(T x){cout<<x<<endl;}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<endl;}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<endl;}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvector(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.pb(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvector(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";
#define printset(st) for(auto xt : st) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define endl '\n'

#define deb(x) cout<<#x<<" "<<x<<endl;

// chandan1,2
void chandan1(){int y=1;return;}
void chandan2(){
        loop(i,10){
        lli x=1;
    }
    return(chandan1());
}

ll modmul(ll a, ll b) {
    return ((a%mod) * (b%mod)) % mod;
}

ll modadd(ll a , ll b){
    return((a%mod)+(b%mod)+mod)%mod;
}

ll modsub(ll a , ll b){
    return((a%mod) - (b%mod) + mod)%mod;
}

lli fastexpo(lli a,lli b ,lli MOD = mod){
    a = a%MOD;
    //b = b%(mod-1); // if mod is prime then only
    lli ans=1;
    while(b){
        if(b&1)
            ans=(ans*1ll*a)%MOD;
        a=(a*1ll*a)%MOD;
        b=b/2;
        }
    return ans;
 }
 

int main(){
fastio
lli t=1;
//cin>>t;
chandan2();
mii mp;
for(lli i=1;i<=100;i++)
    for(lli j=1;j<=100;j++)
        for(lli k=1;k<=100;k++)
            mp[i*i+j*j+k*k+i*j+j*k+k*i]++;

//for(auto xt : mp)
  //  print2(xt.F,xt.S);

while(t--) {
    lli n,b,c;
    string s;
    cin>>n;
    loop(i,n)
        print(mp[i+1]);
    
  }
return 0;
}

Measured memory_bytes: 6032
#include<iostream>
#include<map>
#include<set>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s;
    map<string,int> m;
    set<string> ret;
    for(int i = 0; i < n; i++){
        cin >> s;
        m[s]++;
    }
    int x = 0;
    for(auto p : m)   x = max(x, p.second);
    for(auto p : m)   if(x==p.second) ret.insert(p.first);
    for(string t : ret) cout << t << endl;
    return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    int h,w;cin>>h>>w;

    vector<string> s(h);
    vector<vector<PII>> mp(h);
    REP(i,h){
        mp[i].resize(w);
        cin>>s[i];
    }

    //yoko
    REP(i,h){
        int start = 0;
        //int end = 0;
        REP(j,w+1){
            if(j == w || s[i][j] == '#'){
                //end = j-1;
                FOR(k,start,j){
                    mp[i][k].first = j-start;
                }
                while(j<w){
                    if(s[i][j] == '.'){
                        start = j;
                        break;
                    }
                    j++;
                }
            }
        }
    }

    //tate
    REP(j,w){
        int start = 0;
        //int end = 0;
        REP(i,h+1){
            if(i == h || s[i][j] == '#'){
                //end = i-1;
                FOR(k,start,i){
                    mp[k][j].second = i-start;
                }
                while(i<h){
                    if(s[i][j] == '.'){
                        start = i;
                        break;
                    }
                    i++;
                }
            }
        }
    }

    int result = 0;

    REP(i,h){
        REP(j,w){
            result = max(result,mp[i][j].first+mp[i][j].second-1);
        }
    }
    cout << result << endl;

    /*
    REP(i,h){
        REP(j,w){
            cerr << mp[i][j].first << " ";
        }
        cerr << endl;
    }
    cerr << endl;
    REP(i,h){
        REP(j,w){
            cerr << mp[i][j].second << " ";
        }
        cerr << endl;
    }
    */

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 37848
#include<iostream>
#include <algorithm>
#include <string>
#define syso(s) std::cout<<s<<endl;
#define sc(i) std::cin>>i;
using namespace std;
int main() {
	string str;
	sc(str)
	string ans="consonant";
	if (str == "a" || str == "e" || str == "i" || str == "o" || str == "u") {
		ans="vowel";
	}
	syso(ans)
	return 0;
}

Measured memory_bytes: 256
#include <chrono>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std::chrono;
using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define maxn 300001
#define M   1000000007
#define int long long
#define inf 1e18
#define ninf -1e17
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef cc_hash_table<int, int, hash<int > > ht;

vector<int> adj[maxn];
vector<int> ans(maxn);
void dfs(int u,int p){
   if(p!=-1){
    ans[u]+=ans[p];
   }
   for(auto v:adj[u]){
    if(v!=p){
            dfs(v,u);
    }
   }
}
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int n,q;
  cin>>n>>q;
  for(int i=0;i<n-1;i++){
    int p,q;
    cin>>p>>q;
    adj[p].push_back(q);
    adj[q].push_back(p);
  }
  while(q--){
    int x,y;
    cin>>x>>y;
    ans[x]+=y;
  }
  dfs(1,0);
  for(int i=1;i<=n;i++){
    cout<<ans[i]<<" ";
  }
}


Measured memory_bytes: 27392
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
 string s,t;
 cin>>s>>t;
 t.pop_back();
 if(s==t)cout<<"Yes"<<"\n";
 else cout<<"No"<<"\n";
}


Measured memory_bytes: 3616
<?php
$input = explode(" ",fgets(STDIN));
$N = (int)$input[0];
$M = (int)$input[1];

if ($N == 1){
	$l = ($M * ($M - 1)) / 2;

    echo $l;

}elseif($M == 1){
	$l = ($N * ($N - 1)) / 2;

	echo $l;

}else{
	$i = ($M * ($M - 1)) / 2;
	$l = ($N * ($N - 1)) / 2;
	echo $i + $l;

}



?>

Measured memory_bytes: 4856
#include <stdio.h>

int
main(void)
{
    int n[5];
    int exchanges;
    int i, j, temp;

    for (i = 0; i < 5; i++)
        scanf("%d", n + i);

    for (i = 0; i < 4; i++) {
        exchanges = 0;

        for (j = 4; j > i; j--) {
            if (n[j - 1] < n[j]) {
                temp = n[j - 1];
                n[j - 1] = n[j];
                n[j] = temp;

                exchanges++;
            }
        }

        if (exchanges == 0) break;
    }

    printf("%d %d %d %d %d\n", n[0], n[1], n[2], n[3], n[4]);

    return 0;
}

Measured memory_bytes: 596
module IntSet = Set.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d" @@ function
  | 3 -> print_endline "2 5 63\n"
  | 4 -> print_endline "2 5 20 63\n"
  | 5 -> print_endline "2 5 20 30 63\n"
  | n ->
      let s =
        IntSet.of_list @@
        Array.to_list @@
        Array.init n @@ fun i ->
          i / 4 * 6 + [| 2; 3; 4; 6 |].(i mod 4) in
      let maximum = IntSet.max_elt s in
      IntSet.iter (Printf.printf "%d ")
        begin match IntSet.fold (fun x y -> (x + y) mod 6) s 0 with
        | 0 -> s
        | 2 -> IntSet.add (maximum - maximum mod 6 + 6) @@ IntSet.remove 8 s
        | 3 -> IntSet.add (maximum - maximum mod 6 + 6) @@ IntSet.remove 9 s
        | 5 -> IntSet.add (maximum - maximum mod 6 + if maximum mod 6 < 4 then 4 else 10) @@ IntSet.remove 9 s
        end;
      print_newline ()

Measured memory_bytes: 6016
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    vector<int> ws(n), es(n);
    ws[0] = s[0] == 'W';
    // ws[0] = s[0] == 'W' ? 1 : -1;
    for(int i = 1; i < n; i++){
        ws[i] = ws[i - 1] + (s[i] == 'W');
        // ws[i] = ws[i - 1] + (s[i] == 'W' ? 1 : -1);
    }
    es[n - 1] = s[n - 1] == 'E';
    for(int i = n - 2; i >= 0; i--){
        es[i] = es[i + 1] + (s[i] == 'E');
    }
    prints(ws, es);
    int ans = M;
    for(int i = 0; i < n; i++){
        ans = min(ans, (i ? ws[i - 1] : 0) + (i + 1 < n ? es[i + 1] : 0));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3092
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

#define INF 1e18
#define MOD 1000000007

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

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

    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
}


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

struct edge{
	ll to, cost;
};

ll N, g = -1, ans = 0, INF = 1e18, sub[100001], d[100001], flag = -1;
vector<edge> G[100001];

void dfs(int v, int parent){
	if(g == -1){
		bool f = true, chk = false;
		sub[v] = 1;
		for(int i=0; i<G[v].size(); i++){
			if(G[v][i].to != parent){
				dfs(G[v][i].to, v);
				if(sub[G[v][i].to] > N/2) f = false;
				if(sub[G[v][i].to] == N/2 && (N % 2 == 0)) flag = G[v][i].to;
				sub[v] += sub[G[v][i].to];
			}
		}
		if(N - sub[v] > N/2) f = false;
		if(N - sub[v] == N/2 && (N % 2 == 0)) flag = parent;
		if(f){
			g = v;
		}
	}
	return;
}

int main(){
	cin >> N;
	for(int i=0; i<N-1; i++){
		ll a, b, c; cin >> a >> b >> c;
		a--; b--;
		G[a].push_back({b, c});
		G[b].push_back({a, c});
	}
	dfs(0, -1);
	for(int i=0; i<N; i++) d[i] = INF;
	d[g] = 0;
	queue<int> que;
	que.push(g);
	while(que.size()){
		int aa = que.front(); que.pop();
		for(int i=0; i<G[aa].size(); i++){
			if(d[G[aa][i].to] == INF){
				d[G[aa][i].to] = d[aa] + G[aa][i].cost;
				que.push(G[aa][i].to);
			}
		}
	}
	ll mi = INF;
	for(int i=0; i<N; i++){
		ans += d[i];
		if(mi > d[i] && d[i] != 0) mi = d[i];
	}
	if(flag != -1) cout << 2*ans - d[flag] << "\n";
	else cout << 2*ans - mi << "\n";
	return 0;
}

Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,h,w,H=0,W=0;
    cin>>n>>h>>w;
    if (n==h) {
        H=1;
    } else {
        for (int i=h;i<=n;i++) {
            H++;
        }
    }
    if (n==w) {
        W=1;
    } else {
        for (int i=w;i<=n;i++) {
            W++;
        }
    }
    cout<<H*W<<endl;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

int main() {
  int N;cin>>N;
  string S;cin>>S;
  // 順番に見ていって、出てきた(よりも)が多ければ正しくない
  // 辞書順を守るために、最初に(を連続して集める
  // )))))((((((
  // とある時点で(よりも)が多くなる時、頭に(をつける
  // 一番最後の時点で、(が多い場合、その数だけ)をつける
  string res;
  int before_cnt = 0;
  int after_cnt = 0;
  REP(i,N) {
    char c = S[i];
    res.push_back(c);
    c=='(' ? before_cnt++ : after_cnt++;
    if (after_cnt>before_cnt) {
      res = '('+res;
      before_cnt++;
    }
  }
  REP(i,before_cnt-after_cnt) {
    res.push_back(')');
  }
  OUT(res);

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a%b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	vint a(3 * n);
	rep(i, 3 * n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	llint ans = 0;
	rep(i, n) {
		ans += (llint)a[3 * n - 2 - 2 * i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

N = int(input())
A = [int(input()) for i in range(N)]
last, ans = 0, 0
for a in A:
    if a == 0:
        last = 0
    else:
        ans += (a+last)//2
        last = (a+last)%2
print(ans)


Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.14159265358979323846
#define pdd pair<double,double>
bool comp(int a,int b)
{
	return a>b;
}
long long bigpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int main() 
{
	
	ll n;
	cin>>n;
	if(n<2)
	cout<<0;
	else
	{
		ll mod=1e9+7;
		cout<<(((bigpow(10,n,mod)%mod-bigpow(9,n,mod)%mod +mod)%mod-bigpow(9,n,mod)%mod+mod)%mod+bigpow(8,n,mod))%mod;
	}
	return 0;    
}

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

typedef long long LL;

const int mod=1000000007;

int Power(int a,int k){int res=1;for (;k;k>>=1,a=(LL)a*a%mod) if (k&1) res=(LL)res*a%mod;return res;}

int main(){
  int n;
  scanf("%d",&n);
  int ans=Power(10,n)-Power(9,n)-Power(9,n)+Power(8,n);
  printf("%d\n",(ans%mod+mod)%mod);
  return 0;
}

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

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

using namespace std;

int main(){
	int n,q;
	string s; cin>>n>>q>>s;

	int sum[100001]={};
	rep(i,n-1) if(s[i]=='A' && s[i+1]=='C') sum[i+1]++;
	rep(i,n) sum[i+1]+=sum[i];

	rep(_,q){
		int l,r; cin>>l>>r; l--;
		int ans=sum[r]-sum[l];
		if(r<n && s[r-1]=='A' && s[r]=='C') ans--;
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 1408
'use strict'

const Main = (input) => {
  const Str = parseInt(input.trim().replace(/ /g, ''))


  let result = Number.isInteger(Math.sqrt(Str)) ? 'Yes' : 'No'

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

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

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

    int n, k;
    cin >> n >> k;

    int h[n];
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h, h + n);

    int min_diff = (int) 1e9;

    for (int i = 0; i < n - k + 1; ++i) {
        min_diff = min(min_diff, h[i + k - 1] - h[i]);
    }

    cout << min_diff << '\n';

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <cstring>
#include <string>
#include <bitset>
#include <stdlib.h>
#include <time.h>  
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define st first
#define sd second
#define mkp make_pair
#define pb push_back
void wenjian(){freopen("xxx.in","r",stdin);freopen("xxx.out","w",stdout);}
void tempwj(){freopen("hash.in","r",stdin);freopen("hash.out","w",stdout);}
ll gcd(ll a,ll b){return b == 0 ? a : gcd(b,a % b);}
ll qpow(ll a,ll b,ll mod){a %= mod;ll ans = 1;while(b){if(b & 1)ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans;}
struct cmp{bool operator()(const pii & a, const pii & b){return a.second > b.second;}};
int lb(int x){return  x & -x;}

const double inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;
const int maxn = 1e5+5;


int main()
{
	int h1,m1,h2,m2;
	scanf("%d%d%d%d",&h1,&m1,&h2,&m2);
	int s = h2 * 60 + m2 - h1 * 60 - m1;
	int k = 0;
	scanf("%d",&k);
	int ans = s - k;
	printf("%d\n",max(ans,0));
}


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

int main(){
	int a, b, c, k;
  	cin >> a >> b >> c >> k;
  
  	int ans = 0;
	if(k <= a) ans = k;
  	else if(k <= a+b) ans = a;
  	else ans = a - (k-a-b);
  
  	cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}



int main() {
	prenCkModp(1e6);
	ll N, M,an=1;
	cin >> N >> M;
	for (ll i = 2; i * i <= M; i++) {
		ll k = 0;
		if (M % i == 0) {
			while (M % i == 0) {
				k++;
				M /= i;
			}
			an *= nCk(k + N - 1, k);
			an %= mod;

		}
	}
	if (M != 1) {
		an *= N;
		an %= mod;
	}
	cout << an << endl;
}


Measured memory_bytes: 26592
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int m = scan.nextInt();
        int f = scan.nextInt();
        int b = scan.nextInt();
        if (b < m) {
            System.out.println("0");
        } else if (m < b && m + f >= b) {
            System.out.println(b -= m);
        } else if (m < b && f < b) {
            System.out.println("NA");

        }

    }
}



Measured memory_bytes: 26324
#include<stdio.h>
int main(){
	int table[10][7]={{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,1,0},{1,1,1,1,1,1,1},{1,1,1,1,0,1,1}};
	int a;
	while(scanf("%d",&a),~a){
		int first[]={0,0,0,0,0,0,0};
		for(int i=0;i<a;i++){
			int b;
			scanf("%d",&b);
			for(int j=6;j>=0;j--){
				printf("%d",first[j]^table[b][j]);
				first[j]=table[b][j];
			}
			printf("\n");
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 200010;

vector<ll> tree[N];
ll add[N];
ll ans[N];

int main() {
	ll n, q;
	cin >> n >> q;
	rep(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}

	rep1(i, n) add[i] = 0;
	rep(i, q) {
		ll p, x;
		cin >> p >> x;
		add[p] += x;
	}

	rep1(i, n) ans[i] = -1;
	queue<ll> que;
	ans[1] = add[1];
	que.push(1);
	while(!que.empty()) {
		ll i = que.front();
		que.pop();
		for(ll j : tree[i]) {
			if(ans[j] != -1) continue;
			ans[j] = ans[i] + add[j];
			que.push(j);
		}
	}

	rep1(i, n - 1) {
		cout << ans[i] << ' ';
	}
	cout << ans[n] << endl;
}


Measured memory_bytes: 19440
package main

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

func main() {
	N, D := getStdinInt2()

	ans := 0
	for i := 0; i < N; {
		i += 2*D + 1
		ans++
	}

	fmt.Printf("%d\n", ans)
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2160
#include <iostream>

using namespace std;

int nCr(int n, int r)
{
  int ans = 1;
  for (int i = n; i > n - r; --i)
  {
    ans = ans * i;
  }
  for (int i = 1; i < r + 1; ++i)
  {
    ans = ans / i;
  }
  return ans;
}

int main()
{
  int n, m;
  cin >> n >> m;
  int ans = 0;
  ans += nCr(n, 2);
  ans += nCr(m, 2);
  cout << ans;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var K = input[1];
            var p = ReadArrayInt();
            Array.Sort(p);

            Console.WriteLine(p.Take(K).Sum());
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 28520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 998244353
#define F first
#define S second
#define PB push_back
#define INF 1000000000000000000
ll n,a[405],dp[405][405],c[405][405];
int main(void){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",a+i),a[i]+=a[i-1];
	for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=INF;
	for(int i=0;i<=n;i++)dp[i][i]=0,c[i][i]=i;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=n-i+1;j++){
			ll x=i+j-1,y=j;
			for(int k=c[y][x-1];k<=c[y+1][x];k++){
				if(y<=k&&k+1<=x&&dp[y][x]>dp[y][k]+dp[k+1][x]+a[x]-a[y-1]){
					c[y][x]=k;
					dp[y][x]=dp[y][k]+dp[k+1][x]+a[x]-a[y-1];
				}
			}
		}
	}
	printf("%lld\n",dp[1][n]);
}


Measured memory_bytes: 2816
using System;
using System.Diagnostics;
using System.IO;

namespace AtCoder.ABC121 {
    class A {
        static void Main() => CustomMain();

        static void Solve() {
            var a = ReadIntArray();
            var b = ReadIntArray();

            WriteAnswer((a[0] - b[0]) * (a[1] - b[1]));
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }
    }
}

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

int main()
{
	ll N;
	cin >> N;
	ll ans = 0;
	for (ll i = 1; i <= N; ++i)
	{
		ll k = N / i;
		ans += k * (k+1) / 2 * i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<cmath>
long long n;
int i,tot;
int main()
{
	scanf("%lld",&n);
	for(i=sqrt(n);i;--i)
		if(!(n%i))
			break;
	i=n/i;
	while(i)
	{
		++tot;
		i/=10;
	}
	printf("%d",tot);
	return 0;
 } 

Measured memory_bytes: 128
use text_io::*;
use std::collections::HashMap;
use std::process::exit;
use std::collections::BTreeMap;

fn main() {
    let mut n:usize = read!();
    let mut s:Vec<String> = Vec::new();
    for i in 0..n {
        let mut a:String = read!();
        s.push(a);
    }
    let mut map = BTreeMap::new();
    for s in s {
        *map.entry(s).or_insert(0) += 1;
    }
    let m = *map.values().max().unwrap();
    for (k, v) in map {
        if v == m {
            println!("{}", k);
        }
    }
}

Measured memory_bytes: 24328
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n,m;
  cin>>n>>m;
  vector<ll> a(n);
  vector<ll> b(m);
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  a.erase(unique(a.begin(),a.end()),a.end());
  b.erase(unique(b.begin(),b.end()),b.end());
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  if(n!=a.size()||m!=b.size()) {
    cout << 0 << endl;
    return 0;
  }
  vector<ll> ac(1000000+1);
  set<ll> as;
  vector<ll> bc(1000000+1);
  set<ll> bs;
  rep(i,n) {
    ac[a[i]]++;
    as.insert(a[i]);
  }
  rep(i,m) {
    bc[b[i]]++;
    bs.insert(b[i]);
  }
  revrep(i,1000000) {
    ac[i]+=ac[i+1];
    bc[i]+=bc[i+1];
  }
  ll ans=1;
  const ll p = 1e9+7;
  for(ll x=n*m; x>=1; x--) {
    if(as.find(x)!=as.end()&&bs.find(x)!=bs.end()) {
    } else if(as.find(x)!=as.end()) {
      ans*=bc[x];
      ans%=p;
    } else if(bs.find(x)!=bs.end()) {
      ans*=ac[x];
      ans%=p;
    } else {
      ans*=(ac[x]*bc[x]-(n*m-x));
      ans%=p;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 16000
#include <iostream>

using namespace std;

int main()
{
    int A , B , C ;
    cin >> A >> B >> C ;
    if((C + B - A ) >= 0 )
    {
        cout << C + B - A << endl;
    }
   else
   {
        cout << 0 << endl;
   }
    return 0;
}


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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		if(x==1)
		{
			System.out.println("0");
		}
		else
		{
			System.out.println("1");
		}

	}

}

Measured memory_bytes: 26972