akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Gosu_Hiroo
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}

template <typename T>
ostream& operator << (ostream& os, const vector<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

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

//#define int ll

class ASimpleCalculator {
public:

void solve(std::istream& cin, std::ostream& cout) {
    ll x,y;
    cin >> x >> y;
    vector<int> v;
    if(x <= y)v.emplace_back(y - x);
    if(x <= -y)v.emplace_back(-y-x + 1);
    if(-x <= y)v.emplace_back(y + x + 1);
    if(-x <= -y)v.emplace_back(-y - (-x) + 2);
    sort(all(v));
    cout << *v.begin() << endl;
}


};


#undef int
int main() {


	ASimpleCalculator solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    for(int i=0; i<s.length(); i++){
        if(i%2 == 0 && s[i] == 'L'){
            cout << "No";
            return 0;
        }else if(i%2 == 1 && s[i] == 'R'){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
/*

基本的には　(b/x) - ((a - 1) / x)
1からbまでのxの倍数の個数　ー
1からa-1までのxの倍数の個数

a = 0のとき
a-1 = -1 となる
−１がxの倍数でなければ問題なし
→x = 1 のときますい

x = 1のとき


 */


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String x = sc.next();
        long anum = Long.parseLong(a);
        long bnum = Long.parseLong(b);
        long xnum = Long.parseLong(x);

        if (xnum != 1) {
            if (anum != 0) {
                System.out.println((bnum / xnum) - ((anum - 1L) / xnum));
            } else {
                System.out.println((bnum / xnum) + 1L);
            }
        } else {
            System.out.println(bnum - anum + 1L);
        }
    }
}


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

int main() {
    string S,T;
    cin >> S >> T;;
    int n = 0;
    for(int i = 0; i < S.length(); i++){
        if(!(S[i]==T[i])){
            n++;
        }
    }

    cout << n << endl;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<40;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=31;
ll n,m;
vpll a;
vl b;

int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		if(x==0) b.push_back(y+1);
		else a.push_back({x,y});
	}
	sort(a.begin(),a.end(),[](pll p,pll q){
		ll p1=p.first,p2=p.second;
		ll q1=q.first,q2=q.second;
		return p1*(q1+q2+1)<q1*(p1+p2+1);
	});
	reverse(a.begin(),a.end());
	sort(b.begin(),b.end());
	int N=a.size();
	vl dp(M,inf);
	dp[0]=0;
	for(int i=0;i<N;i++){
		vl DP=dp;
		for(int j=0;j<M-1;j++){
			DP[j+1]=min(DP[j+1],(a[i].first+1)*(dp[j]+1)+a[i].second);
		}
		dp=DP;
	}
	for(int i=1;i<n-N;i++) b[i]+=b[i-1];
	int res=0;
	for(int i=0;i<M;i++) if(dp[i]<=m){
		int it=upper_bound(b.begin(),b.end(),m-dp[i])-b.begin();
		res=max(res,it+i);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 6128
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
int a[2002], b[2002];
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n, x, ans = 0, s;
	cin >> n >> x;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		b[i] = a[i];
		ans += a[i];
	}
	for(int i = 1; i < n; i++){
		s = 0;
		for(int j = 0; j < n; j++){
			b[j] = min(b[j] , a[(j - i + n) % n]);
			s += b[j];
		}
		ans = min(ans , s + i * x);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
	# n,k = map(int,input().split())
	n = int(input())
	# s = str(input())
	a = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	ans = 1
	for i in range(1,n):
		# print(max(a[:i]))
		if a[i] >= a[0] and a[i] >= a[i-1] and max(a[:i]) <= a[i]:
			ans += 1
	print(ans)



if __name__ == '__main__':
	main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5+3;
vector<int> g[N];
int dp[N];
int n, M;

inline int mul(int a, int b) { return 1ll*a*b % M; }

void dfs(int u, int p) {
    dp[u] = 1;
    for (auto &v : g[u]) {
        if (v != p) {
            dfs(v, u);
            dp[u] = mul(dp[u], dp[v]+1);
        }
    }
}

void reroot(int u, int p, int pch = 1) {
    dp[u] = mul(dp[u], pch);
    
    int sz = SZ(g[u]);
    int pf[sz], sf[sz];
    
    int x = 1;
    forn(i, 0, sz) {
        int &v = g[u][i];
        if (v != p) {
            x = mul(x, dp[v]+1);
        }
        pf[i] = x;
    }
    
    x = 1;
    for (int i = sz-1; i >= 0; --i) {
        int &v = g[u][i];
        if (v != p) {
            x = mul(x, dp[v]+1);
        }
        sf[i] = x;
    }
    
    forn(i, 0, sz) {
        int &v = g[u][i];
        if (v != p) {
            int a = i > 0 ? pf[i-1] : 1;
            int b = i < sz-1 ? sf[i+1] : 1;
            reroot(v, u, mul(pch, mul(a, b))+1);
        }
    }
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> n >> M;
    
    forn(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
    
    dfs(0, -1);
    reroot(0, -1);
    
    forn(i, 0, n) {
        cout << dp[i] << endl;
    }
}


Measured memory_bytes: 19684
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		for(;;){
			int N=cin.nextInt();
			if(N==0)break;
			Dic d=new Dic(
					new Integer(1),
					new Integer(6),
					new Integer(2),
					new Integer(5),
					new Integer(3),
					new Integer(4)
			);
			int ans=1;
			for(;N--!=0;){
				String s = cin.next();
				if(s.equals("North")){
					d.rollX(false);
				}
				else if(s.equals("East")){
					d.rollY(false);
				} 
				else if(s.equals("West")){
					d.rollY(true);
				} 
				else if(s.equals("South")){
					d.rollX(true);
				} 
				else if(s.equals("Right")){
					d.rollZ(true);
				} 
				else if(s.equals("Left")){
					d.rollZ(false);
				}
				ans+= d.id[0];
			}
			System.out.println(ans);
		}
	}


	//さいころのデータクラス
	//equalsは向きも含めて同値であり,isEquivalentは回転することで同じ賽であることを調べる
	//Verify: AOJ0502, AOJ1057
	static class Dic {
		public Integer[] id;
		enum Face{TOP, BOTTOM, FRONT, BACK, RIGHT, LEFT};

		public Integer get(Face f){
			return id[f.ordinal()];
		}

		public Dic copy(){
			return new Dic(id[0], id[1], id[2], id[3], id[4], id[5]);
		}

		public Dic() {
			@SuppressWarnings("unchecked")
			Integer[] tid = (Integer[])new Object[6];
			id = tid;
		}

		public Dic(Integer top, Integer bottom, Integer front, Integer back, Integer right, Integer left) {
			@SuppressWarnings("unchecked")
			Integer[] tid = new Integer[6];
			id = tid;
			id[Face.TOP.ordinal()] = top;
			id[Face.BOTTOM.ordinal()]= bottom;
			id[Face.FRONT.ordinal()] = front;
			id[Face.BACK.ordinal()] = back;
			id[Face.RIGHT.ordinal()] = right;
			id[Face.LEFT.ordinal()] = left;
		}

		//true: X軸方向に手前に転がす
		//false: X軸方向に奥に転がす
		void rollX(boolean isReverse) {
			if(!isReverse) roll(Face.TOP, Face.FRONT, Face.BOTTOM, Face.BACK);
			else roll(Face.TOP, Face.BACK, Face.BOTTOM, Face.FRONT);
		}

		//true: Y軸方向に左へ転がす
		//false: Y軸方向に右へ転がす
		void rollY(boolean isReverse) {
			if(!isReverse) roll(Face.TOP, Face.LEFT, Face.BOTTOM, Face.RIGHT);
			else roll(Face.TOP, Face.RIGHT, Face.BOTTOM, Face.LEFT);
		}

		//true: Z軸方向に右へ回す
		//false: Z軸方向に左へ回す
		void rollZ(boolean isReverse) {
			if(!isReverse) roll(Face.FRONT, Face.LEFT, Face.BACK, Face.RIGHT);
			else roll(Face.FRONT, Face.RIGHT, Face.BACK, Face.LEFT);
		}

		private void roll(Face w, Face x, Face y, Face z) {
			Integer tmp = id[w.ordinal()];
			id[w.ordinal()] = id[x.ordinal()];
			id[x.ordinal()] = id[y.ordinal()];
			id[y.ordinal()] = id[z.ordinal()];
			id[z.ordinal()] = tmp;
		}

		@Override
		public String toString() {
			String str = "";
			for(Face f : Face.values()){
				str += id[f.ordinal()] + " ";
			}
			return str;
		}

		@Override
		public int hashCode() {
			int hash = 31;
			for(Face f : Face.values()){
				hash += hash*17+id[f.ordinal()].hashCode();
			}
			return hash;
		}
	}



}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int all = 1;
            int even = 1;
            foreach (var v in input)
            {
                all *= 3;
                even *= (v % 2 == 0 ? 2 : 1);
            }
            Console.WriteLine(all - even);
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}


Measured memory_bytes: 13268
import sys
input = sys.stdin.readline
s=input().strip()
g=0
p=0
cnt=0
for i in range(len(s)):
    if s[i]=="g":
        if g>p:
            p+=1
            cnt+=1
        else:
            g+=1
    else:
        if g>p:
            p+=1
        else:
            g+=1
            cnt-=1
    #print(cnt)
print(cnt)


Measured memory_bytes: 39536
import java.util.Scanner;
public class Main
{
	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);
		int a,b;
		while(scan.hasNext()){
			a=scan.nextInt();
			b=scan.nextInt();
			System.out.println(Integer.toString(a+b).length());
		}
		scan.close();
	}
}

Measured memory_bytes: 26460
#include<bits/stdc++.h> 
using namespace std; 
  
  
// Driver program 
int main() 
{ 
    int x, n;
    cin>>x>>n;
    vector<int> v(n);
    int f = 0;
    for(int i=0; i<n; i++){
        cin>>v[i];
        if(v[i]==x)
            f = 1;
    }
    if(!n){
        cout<<x;
        return 0;
    }
    if(!f){
        cout<<x;
        return 0;
    }
    sort(v.begin(), v.end());
    auto it = lower_bound(v.begin() ,v.end(), x);
    if(*it != x)
        cout<<x;
    else if(*it==x){
        int j = it - v.begin();
        int i=1;
        while(true){
            if(j-i>=0&&v[j-i]!=v[j]-i){
                cout<<v[j]-i;
                return 0;
            }
            else if(j+i<n&& v[j+i]!=v[j]+i){
                cout<<v[j]+i;
                return 0;
            }
            else if(j+i<n && j-i>=0){
                i++;
            }
            else{
                break;
            }
        }
        if(j+i==n && j-i>=0){
            if(v[j-i]!=v[j]-i){
                cout<<v[j]-i;
            }
            else
                cout<<v[j]+i;
        }
        else if(j-i<0 && j+i<n){
            if(v[j+i]!=v[j]+i){
                cout<<v[j]+i;
            }
            else
                cout<<v[j]-i;
        }
        else{
            cout<<v[j]-i;
        }
        
    }
} 

Measured memory_bytes: 3624
/*
 * main.c
 *
 *  Created on: 2019/12/29
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;

int sort_inc_u(const void *a, const void *b)
{
    signed long long int da = *(signed long long int*)a;
    signed long long int db = *(signed long long int*)b;
    int val = 0;
    if(da > db) {
        val = 1;
    } else if (da == db) {
        val = 0;
    } else {
        val = -1;
    }

    return val;
}

ll A[200001] = {0};

int main()
{
	ll N = 0, i = 0, ans = 0;;
	scanf("%lld", &N);
	for (i = 0; i < N; i++) {
		ll a = 0;
		scanf("%lld", &a);
		A[i] = a;
	}

	qsort(A, N, sizeof(ll), sort_inc_u);
	for (i = 1; i < N; i++) {
		if (A[i-1] == A[i]) {
			ans = 1;
			break;
		}
	}

	if (ans == 0) {
		printf("YES\n");
	} else {
		printf("NO\n");
	}
    return 0;
}


Measured memory_bytes: 3324
import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);

		String like = sc.next();
		String[] cha = like.split("I",-1);
		
		if(cha[0].equals("YAK")){
			if(like.equals("YAK")){
				System.out.println("No");
			}else{
				System.out.println("Yes");
			}
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}
void YES_NO(bool f) {
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}

template <typename T>
void deb1(T x) {
  cout << x << "\n";
}

template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (b < c or d < a)
    out(0);
  else
    out(min(b, d) - max(a, c));
}
int main(void) { solve(); }

Measured memory_bytes: 3608
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
using namespace std;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int main(){
    //std::stack<int> stack;
    
    int n;
    cin >> n;
    vector <int> a(n);

    for(int i = 1; i < n; i++){
        cin >> a[i];
    }
    vector <int> ans(n);

    for(int i = 1; i < n; i++){
        ans[a[i]-1] ++;
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
    //cout << ans << endl;
    return 0;
}





Measured memory_bytes: 4836
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    ans = 0
    cnt = [0] * 3
    for i in range(N):
        ans += S[i].count('AB')
        if S[i][0] == 'B' and S[i][-1] == 'A':
            cnt[0] += 1
        elif S[i][0] == 'B':
            cnt[1] += 1
        elif S[i][-1] == 'A':
            cnt[2] += 1

    if cnt[0] > 0:
        ans += cnt[0] - 1
        if not(cnt[1] == 0 and cnt[2] == 0):
            ans += 1
            ans += min(cnt[1],cnt[2])
    else:
        ans += min(cnt[1],cnt[2])

    print(ans)

    


if __name__ == "__main__":
    main()

Measured memory_bytes: 75224
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main(){
    ll a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    if(labs(b-a)<=t*(v-w)) cout<<"YES";
    else cout<<"NO";
    
}



Measured memory_bytes: 3628
import heapq

n,m = map(int,input().split())
lb = [[] for _ in range(10**5+5)]
for _ in range(n):
    a,b = map(int,input().split())
    lb[a].append(b)
res = 0
q = []
heapq.heapify(q)
for i in range(1,m+1):
    for b in lb[i]:
        heapq.heappush(q,b * (-1))
    if q:
        res += heapq.heappop(q) * (-1)

print(res)

Measured memory_bytes: 18360
public class Hello {
    public static void Main(){
        string [] inputs = System.Console.ReadLine().Split(' ');
        int a = int.Parse(inputs[0]);
        int b = int.Parse(inputs[1]);
        int c = (a * b);
        int d = (a + b) * 2;
        System.Console.WriteLine(c + " " + d);
    }
}


Measured memory_bytes: 9112
fn main() {
    let prev = read();
    if prev == "ABC" {
        println!("ARC");
    } else {
        println!("ABC");
    }
}
fn read() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

Measured memory_bytes: 2120
N = int(input())
if len(str(N)) == 6:
  print(9+900+90000)
elif len(str(N)) == 4:
  print(9+900)
elif len(str(N)) == 2:
  print(9)
elif len(str(N)) == 5:
  print(9+900+N-10000+1)
elif len(str(N)) == 3:
  print(9+N-100+1)
elif len(str(N)) == 1:
  print(N)

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

int main(){
  long long int n;
  cin >> n;
  
  long long int k=n+1;
  
  for(long long int i=1;i<=sqrt(n);i++){
    if(n%i==0){
      k=min(k,i+n/i);
    }
  }
  
  cout << k-2 << endl;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        int a = x2 - x1, b = y2 - y1;
        int x3 = x2 - b;
        int y3 = y2 + a;
        int x4 = x3 - a;
        int y4 = y3 - b;

        cout << x3 << " " << y3 << " " << x4 << " " << y4 << " " << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    char a;
    cin >> a;
    char ans;
    if ('a' <= a && a <= 'z')
    {
        ans = 'a';
    }else
    {
        ans = 'A';
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
	int N;	
	scanf("%d", &N);

	vector<int> v(N);
	for (int i=0; i<N; i++)
	{
		int tmp;
		scanf("%d", &tmp);
		v[i]=tmp;
	}
	int ret=0;
	for (int i=0; i<N; i++)
	{
		int c;
		scanf("%d", &c);
		if (v[i]>c) ret+=(v[i]-c);
	}
	printf("%d", ret);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  double S;//面積
  long x,y;
  long W,H;
  int tf;
  scanf("%ld %ld %ld %ld", &W, &H, &x, &y);

  S=(W*H+0.)/2;

  if(W%2==0 && H%2==0){
    if(x==W/2&&y==H/2) tf=1;
    else tf=0;
  }else{
    tf=0;
  }

  printf("%lf %d\n", S, tf);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES  // M_PI等のフラグ
#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


void solve(){
    int x;
    cin >> x;
    if (x==0) cout << "1" << endl;
    else cout << "0" << endl;
}


int main(int argc, char const *argv[]){
    solve();
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(void){
  int i;
  int remain=100000,n;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    remain*=1.05;
    if(remain%1000>0){
      remain-=remain%1000;
      remain+=1000;
    }
  }
  printf("%d\n",remain);
  return 0;
}

Measured memory_bytes: 0
#include <cmath>
#include <iostream>

bool isPrime(int n) {
  int c = 0;
  for (int i = 1; i <= (int)sqrt(n); ++i) {
    if (n % i == 0) c++;
    if (c == 2) return false;
  }
  return true;
}

int main() {
  int n, c = 0;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    std::cin >> a;
    if (isPrime(a)) c++;
  }
  std::cout << c << '\n';
}



Measured memory_bytes: 3096
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define YES 1
#define NO 0

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node *NodePointer;

NodePointer root = NULL;

NodePointer make_1node(int, NodePointer);
void insert(int);
int find(NodePointer, int);
void inorder(NodePointer);
void preorder(NodePointer);

int main(){
  int command_num, key, i;
  char command[10];

  scanf("%d",&command_num);
  for(i = 1; i <= command_num; i++){
    scanf("%s",command);
    if( strcmp(command,"print") == 0 ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if( strcmp(command,"insert") == 0 ){
      scanf("%d",&key);
      insert(key);
    }

    else if( strcmp(command,"find") == 0 ){
      scanf("%d",&key);
      if( find(root, key) == YES ) printf("yes\n");
      else if( find(root, key) == NO ) printf("no\n");
    }
  }

  return 0;
}

void insert(int key){
  NodePointer x=root, y=NULL;

  while( x != NULL ){
    y = x;
    if( key < x->key ) x = x->left;
    else x = x->right;
  }
  if( y == NULL ) root = make_1node(key, NULL); //Tree is empty
  else if( key < y->key ) y->left = make_1node(key, y);
  else y->right = make_1node(key, y);
}

NodePointer make_1node(int key, NodePointer parent){
  NodePointer newnode;
  newnode = (NodePointer)malloc( sizeof(struct node) );
  newnode->parent = parent;
  newnode->right = NULL;
  newnode->left = NULL;
  newnode->key = key;
  return newnode;
}

int find(NodePointer x, int key){
    if( x == NULL ) return NO;
  else if( key < x->key ) return find(x->left, key);
  else if( key > x->key ) return find(x->right, key);
  else return YES;
}

void inorder(NodePointer x){
  if( x != NULL ){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}

void preorder(NodePointer x){
  if( x != NULL ){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
}



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

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

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

    if (K > 1) {
        cout << N - K << '\n';
    } else {
        cout << 0 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 998244353;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  int q; cin >> q;
  string s; cin >> s;
  vector<int> dp(n+1);
  for(int i=0; i<n-1; i++) {
    dp[i+1] = dp[i];
    if (s[i] == 'A' && s[i+1] == 'C') {
      dp[i+1]++;
    }
  }

  
  while(q--) {
    int l, r; cin >> l >> r;
    ll ans = dp[r-1] - dp[l-1];
    cout << ans << '\n';
  }
}


Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, w, a, b;
    ll a0, z = 0;
    vector<ll> c[4] = {};
    cin >> n >> w >> a >> b; a0 = a;
    c[0].push_back(b);
    for (int i = 1; i < n; i++) cin >> a >> b, c[a - a0].push_back(b);
    for (int i = 0; i < 4; i++) sort(c[i].begin(), c[i].end()), reverse(c[i].begin(), c[i].end()), c[i].insert(c[i].begin(), 0);
    for (int i = 0; i < 4; i++) for (int j = 1; j < c[i].size(); j++) c[i][j] += c[i][j - 1];
    for (int i = 0; i < c[0].size(); i++) for (int j = 0; j < c[1].size(); j++) for (int k = 0; k < c[2].size(); k++) for (int l = 0; l < c[3].size(); l++) if (i * a0 + j * (a0 + 1) + k * (a0 + 2) + l * (a0 + 3) <= w) z = max(z, c[0][i] + c[1][j] + c[2][k] + c[3][l]);
    cout << z << '\n';
}


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

// #define pr16 

#ifdef pr16
  #define pr(x)                 cerr << #x << ": " << x << endl;
  #define pr2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
  #define pr3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
  #define pr4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
  #define pr5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
  #define pr6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
  #define prdd(a,r,c) for(int i=0;i<(r);i++) { for(int j = 0;j<(c);j++) cerr<<a[i][j]<<" "; cerr<<endl; } cerr<<endl;
  #define prc(a) tr(a, it) cerr<<*(it)<<" "; cerr<<endl
  #define pra(a,n) for(int i=0; i<(n); i++) cerr<<((a)[i])<<" "; cerr<<"\n"
  #define prdd(a,r,c) for(int i=0;i<(r);i++) { for(int j = 0;j<(c);j++) cerr<<a[i][j]<<" "; cerr<<endl; } cerr<<endl; 
  #define prddd(a,x,y,z) for(int i=0;i<x;i++) {cerr<<"layer "<<i<<":\n";prdd(a[i],y,z)}
 
#else
  #define pr(x)
  #define pr2(x, y)
  #define pr3(x, y, z)
  #define pr4(a, b, c, d)
  #define pr5(a, b, c, d, e)
  #define pr6(a, b, c, d, e, f)
  #define prc(a)
  #define pra(a,n)
  #define prdd(a, r, c)
  #define prddd(a,x,y,z)
#endif



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    double a[n];
    for(int i = 0; i < n; i++)
    	cin>>a[i];
    map<pair<int, int>, int> inv;
    for(int i = 0; i < n; i++) {
    	long long num = (1LL*a[i]*1000000000 + 0.1);
    	int c5 = 0, c2 = 0;
    	while(num % 5 == 0)
    		c5 += 1, num /= 5;
    	while(num % 2 == 0)
    		c2 += 1, num /= 2;
    	inv[make_pair(c2, c5)] += 1;
    }

    long long ans = 0;
    for(auto i: inv)
    	for (auto j : inv) {
    		if (i == j) {
    			if (i.first.first >= 9 and i.first.second >= 9)
    				ans += 1LL * (i.second) * (i.second -1);
    			continue;
    		}
    		if (i.first.first + j.first.first >= 18 and i.first.second + j.first.second >= 18)
    			ans += 1LL * i.second * j.second;
    	}
    cout<<ans / 2 <<"\n";
}

Measured memory_bytes: 5352
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int ara[3][3],i,j,n,x,cnt=0;
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			cin>>ara[i][j];
		}
	}
	
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>x;
		for(int l=0;l<3;l++){
		for(j=0;j<3;j++){
			if(ara[l][j]==x){
				ara[l][j]=0;
				break;
			}
		}
		}
	}
	for(i=0;i<3;i++){
		cnt=0;
		for(j=0;j<3;j++){
			if(ara[i][j]==0){
				cnt++;
			}
		}
		if(cnt==3){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	for(i=0;i<3;i++){
		cnt=0;
		for(j=0;j<3;j++){
			if(ara[j][i]==0){
				cnt++;
			}
		}
		if(cnt==3){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cnt=0;
	for(i=0;i<3;i++){
		if(ara[i][i]==0){
			cnt++;
		}
	}
	if(cnt==3){
		cout<<"Yes"<<endl;
		return 0;
	}
	if(ara[0][2]==0&&ara[1][1]==0&&ara[2][0]==0){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
# 方針：黒く塗られるべきマスの隣（縦or横）に、同様のマスがあれば塗れる→Yes
# 逆に、黒く塗られるべきマスに接していない、黒く塗られるべきマスがあると、達成は不可能→No

# 行数・列数の入力(Row, Column)
H, W = list(map(int, input().split(" ")))

# 全入力を２次元配列へと変換
paint_map = []
for h in range(H):
    paint_map.append(list(input()))

# 各マス目の周りに黒があるかを確認する
ans = True  # 最終的な出力。始めは、塗ることが可能であるとして初期化してある

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

for i in range(H):
    for j in range(W):
        if paint_map[i][j] == "#":
            found = False  # 注目している黒マスの周りに、別の黒マスを見つけたか

            for k in range(4):
                ii = i + dx[k]
                jj = j + dy[k]

                if (H > ii >= 0) & (W > jj >= 0):  # 注目している座標がキャンパス上にあるなら
                    if paint_map[ii][jj] == "#":  # かつ黒色なら
                        found = True

            if not found:  # もしも注目している黒マスの周りに、別の黒マスが見つからなかったら
                ans = False

print("Yes") if ans else print("No")


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        
        int TC = in.nextInt();
        while (TC-- > 0) {
            int N = in.nextInt();
            int prev = -99999;
            int down = 0;
            int climb = 0;
            for (int i = 0; i < N; i++) {
                int n = in.nextInt();
                if (i > 0) {
                    if (prev < n) {
                        climb = Math.max(climb, n - prev);
                    } else if (prev > n) {
                        down = Math.min(down, n - prev);
                    }
                }
                prev = n;
            }
            System.out.println(climb + " " + (down * -1));
        }
    }
}



Measured memory_bytes: 35256
//Author: Rahul Purohit

#include<bits/stdc++.h>
#define vi vector<int>
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll  long long int
#define pi pair<ll,ll>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
int gcd(int a, int b)
{
	if(b==0)
		return a;
	else
		return (b,a%b);
}
/*ll isp[N]={1};
void sieve(int n)
{
	isp[0]=isp[1]=0;
	for(int i=2;i<=n;i++)
	{
		if(isp[i]==1)
		{
			for(int j=i*i;j<=n;j+=i)
			{
				isp[j]==0;
			}
		}
	}
}*/
ll pow(int x,int  y,int m)
{
	ll ans=1;
	while(y!=0)
	{
		if(y%2==1)
		{
			ans=(ans*x)%m;
		}
		x=(x*x)%m;
		y/=2;
	}
	return ans;
}
template <class x>
void swap(x &a,x &b)
{
	x tp;
	tp=a;
	a=b;
	b=tp;
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    
    string a;
    cin>>a;
    ll n=a.size();
    ll sum=0;
    for(auto i=0;i<n;++i)
    {
        if(a[i]=='x')
        {
            ++sum;
        }
    }
    if(sum>=8)
    {
        cout<<"NO\n";
    }
    else
    {
        cout<<"YES\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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_MAX	2,147,483,647 = 2*1.0e9

template <typename T> T gcd_euclid(T a, T b){
    if(b == 0) return a;
    else gcd_euclid(b, a%b);
}


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

  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];

  vector<int> gcd_front(N, 0);
  gcd_front[0] = A[0];
  for(int i = 1; i < N; i++){
    gcd_front[i] = gcd_euclid(gcd_front[i-1], A[i]);
  }

  vector<int> gcd_back(N, 0);
  gcd_back[0] = A[N-1];
  for(int i = 1; i < N; i++){
    gcd_back[i] = gcd_euclid(gcd_back[i-1], A[N-1-i]);
  }

  int ans = gcd_back[N-2];
  for(int i = 1; i < N-1; i++){
    ans = max(ans, gcd_euclid(gcd_front[i-1], gcd_back[N-2-i]));
  }
  ans = max(ans, gcd_front[N-2]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>
#include <stdlib.h>
int main() {
    int x,n;
    scanf("%d %d",&x,&n);
    int p[102];
    for(int i = 0; i <= 101; i++) {
        p[i] = 0;
    }
    for(int i = 0;i < n; i++) {
        int a;
        scanf("%d", &a);
        p[a] = 1;
    }
    int ans = 0;
    int min = 1000;
    for (int i = 0; i <= 101; i++) {
        if (p[i] == 0) {
            if (min > abs(x-i)) {
                min = abs(x-i);
                ans = i;
            }
        }
    }
    printf("%d\n",ans);
}

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

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

  int a[3];
  for(int i=0; i<3; ++i){
    cin>>a[i];
  }
  sort(a,a+3);
  int k;
  cin>>k;
  
  int ans= a[0] + a[1] + a[2] * (1<<k);
  cout<<ans<<"\n";
}


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

#define vpp vector<pair<int,int>>
#define ll long long int
#define ull unsigned long long
#define ld long double
#define fi(i,a,b) for(ll i=a;i<b;i++)
#define fj(j,a,b) for(ll j=a;j<b;j++)
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define mpi map<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define pb push_back
#define MOD 1000000007
#define ub upper_bound
#define lb lower_bound
#define itr(v) for(auto it:v)
#define all(v) v.begin(),v.end()  
#define w(t)  int t; cin>>t; while(t--)
#define fio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fast_pow(ll k, ll p)
{
if (p == 0)
        return 1;
 
    ll P = fast_pow(k, p/2);
    P = (P * P) % MOD;
 
    if (p % 2 == 1)
        P = (P * k) % MOD;
 
    return P;
}
ll invmod(ll a,ll m)
{
    return fast_pow(a,m-2);
}

bool isPrime(ll n) 
{ 
   
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
       if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll nextPowerOf2(ll n)
{
    n>>=1;
    ll count = 0;

    if (n && !(n & (n - 1)))
        return n;

    while( n != 0)
    {
        n >>= 1;
        count += 1;
    }

    return 1 << count;
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
  
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 


//////////////////////*********CODE***********/////////////////////

int main(){
int a,b,c,k;
  cin>>a>>b>>c>>k;
 
 
    while(k>0){
     if(c<=b) c=c*2;
      else if(b<=a) b=b*2;
      k--;
    }
    if(c>b&&b>a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3648
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,ans=0; cin>>n;
    vector<ll> a(n,0);
    rep(i,n) cin>>a[i];
    sort(al(a)); reverse(al(a));
    for(int i=1;i<=n-1;i++){
        ans+=a[i/2];
    }
    cout<<ans<<endl;
}

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

int main(){
	int N;
	cin >> N;
	int a[N];
	rep(i,N) cin >> a[i];
	set<int> b(a,a+N);
	if (b.size() > 3) {
		cout << "No" << endl;
		return 0;
	}
	vector<int> cnt(b.size());
	int k = 0;
	for (int i : b) {
		rep(j,N) {
			if (a[j] == i) cnt[k]++;
		}
		k++;
	}

	if (b.size() == 1) {
		if (*b.begin() == 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else if (b.size() == 2) {
		if (*b.begin() == 0) {
			if (2*cnt[0] == cnt[1]) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
		else cout << "No" << endl;
	}
	else if (b.size() == 3) {
		int tot = 0;
		for (int i : b) tot ^= i;
		if (tot == 0) {
			if (cnt[0] == cnt[1] && cnt[1] == cnt[2]) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
		else cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 7336
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<set>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
#define P pair<int,int>
#define F first
#define S second
 
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if(a == 1) a += 13;
  if(b == 1) b += 13;
  if(a > b) cout << "Alice" << endl;
  else if (a < b) cout << "Bob" << endl;
  else cout << "Draw" << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

bool isYear(int n) {
  return true;
}
bool isMonth(int n) {
  return n >= 1 && n <= 12;
}
int main() {
  string S;
  cin >> S;
  int first = atoi(S.substr(0, 2).c_str());
  int second = atoi(S.substr(2, 2).c_str());
  if(isYear(first) && isMonth(second) && isMonth(first) && isYear(second))
    cout << "AMBIGUOUS" << endl;
  else if(isYear(first) && isMonth(second))
    cout << "YYMM" << endl;
  else if(isMonth(first) && isYear(second))
    cout << "MMYY" << endl;
  else
    cout << "NA" << endl;
  return 0;
}


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

const ll MOD = 1e9+7;

ll N, K;

const ll MAX = 200000;

vector<ll> fac(MAX);
vector<ll> finv(MAX);

ll power_MOD(ll a, ll b){
  ll ans = 1;
  while(b > 0){
    if(b&1) ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    b = (b >> 1);
  }
  return ans;
}

void comb_ini(){
  fac[0] = 1; fac[1] = 1;
  finv[0] = 1; finv[1] = 1;
  for(ll i = 2; i <= MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    finv[i] = finv[i - 1] * power_MOD(i, MOD - 2) % MOD;
  }
}

ll comb_MOD(ll n, ll r){
  if(n < r) return 0;
  if(n < 0 || r < 0) return 0;
  if(r == 0) return 1;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

int main(){
  cin >> N >> K;
  comb_ini();
  vector< ll > a(N, 0);
  
  if(K == 1){
    cout << 0 << endl;
    return 0;
  }
  
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  
  ll sumOfMax = 0, sumOfMin = 0;
  
  for(int i = 0; i <= N-K; i++){
    sumOfMin += (comb_MOD(N-1-i, K-1) * a[i]) % MOD;
    sumOfMin %= MOD;
  }
  
  for(int i = K-1; i < N; i++){
    sumOfMax += (comb_MOD(i, K-1) * a[i]) % MOD;
    sumOfMax %= MOD;
  }
  
  ll ans = sumOfMax - sumOfMin;
  while(ans < 0)
    ans += MOD;
  ans %= MOD;
  
  cout << ans << endl;
}

Measured memory_bytes: 4096
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#define BIT(nr) (1ULL << (nr))
#define int long long
//#define ll 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	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }


using namespace std;

// 汎用的な二分探索のテンプレ(めぐる式)
int binary_search(function<bool(int)> isOk, int ng, int ok) {

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOk(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

signed main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N), F(N);
    
    int maxA = -1, maxF = -1;
    rep(i, N) { 
        cin >> A[i];
        chmax(maxA, A[i]);
    }
    rep(i, N) {
        cin >> F[i];
        chmax(maxF, F[i]);
    }
    
    //消化コストは大きい順、食べにくさは小さい順
    sort(ALLOF(A));
    reverse(ALLOF(A));
    sort(ALLOF(F));

    auto isOk = [&](int s) -> bool {
        int calc = K;

        //スコアをsにするにはA[i] * F[i] <= s なる修行が必要
        rep(i, N) {
            int newAi = s / F[i];
            if (newAi < A[i]) {
                calc -= A[i] - newAi;
            }
            
            if (calc < 0) {
                return false;
            }
        }
        return true;
    };

    if (isOk(0)) {
        cout << 0 << "\n";
    }
    else {
        cout << binary_search(isOk, 0, maxA*maxF)<<"\n";
    }

    return 0;
}


Measured memory_bytes: 3456
from math import atan2, pi

a, b, x = map(int, input().split())
if a*a*b/2>=x: print(atan2(b, x/a*2/b) * 180 / pi)
else:
        jt = x/a*2/a - b
        print(atan2(b-jt, a) * 180 / pi)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using tiiii = tuple<int, int, int, int>;

void print(int i, int j, int x, int y)
{
    i++, j++, x++, y++;
    cout << i << ' ' << j << ' ' << x << ' ' << y << endl;
}
int main()
{
    int h, w;
    cin >> h >> w;
    vector<int> a[h];
    rep(i, 0, h)
    rep(j, 0, w)
    {
        int aa;
        cin >> aa;
        a[i].push_back(aa);
    }

    vector<tiiii> ans;
    rep(i, 0, h)
    rep(j, 0, w)
    if (a[i][j] % 2 == 1)
    {
        --a[i][j];
        if (j + 1 < w)
        {
            ans.emplace_back(i, j, i, j+1);
            // print(i, j, i, j + 1);
            ++a[i][j + 1];
        }
        else if (i + 1 < h)
        {
            ans.emplace_back(i, j, i+1, j);
            ++a[i + 1][j];
        }
    }

    cout << ans.size() << endl;
    rep(aa, 0, ans.size())
    {
        int i, j, x, y;
        tie(i, j, x, y) = ans[aa];
        print(i, j, x, y);
    }

    // cout << "********" << endl;
    // rep(i, 0, h)
    // rep(j, 0, w)
    //     cout << i << ' ' << j << ' ' << a[i][j] << endl;
    return 0;
}

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

using namespace std;

const int MAX = 100;

int main() {
    int k, s, z, ans = 0;
    cin >> k >> s;
    
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            z = s - (x + y);

            if (0 <= z && z <= k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a < c && c < b) cout << "Yes" << endl;
  else if(b < c && c < a) cout << "Yes" <<endl; 
  else cout << "No" << endl;
}


Measured memory_bytes: 256