akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  int d=0;
  cout<<min(b,c)<<' ';
  cout<<max(d,b+c-a)<<endl;
}


Measured memory_bytes: 256
import Control.Monad
main=do
 [n,m]<-map read.words<$>getLine
 lr<-replicateM m (map read.words<$>getLine)
 print(f 1 n m lr)
  where f s t 0 _ =max 0 (t-s+1)
        f s t m ([l,r]:lr) = f (max s l) (min t r) (m-1) lr

Measured memory_bytes: 71036
import java.util.Random;
import java.util.Scanner;

public class Main {
    static void swap(int[] data, int i, int j) {
        int tmp = data[i];
        data[i] = data[j];
        data[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int n = scanner.nextInt();
            if (n == 0) break;

            int max = -1, min = 1001, sum = 0;
            for (int i = 0; i < n; i++) {
                int s = scanner.nextInt();
                max = Math.max(max, s);
                min = Math.min(min, s);
                sum += s;
            }
            System.out.println((int)((sum - max - min) / (double)(n - 2)));
        }
    }
}


Measured memory_bytes: 28296
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,i,a[1010101],p[1010101],p2[1010101],hs;
int main()
{
//	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		p[i]=p[i-1]+a[i];
	}
	for(i=1;i<=n;i++)
		cin>>a[i];
	for(i=n;i>=1;i--)
	{
		p2[i]=p2[i+1]+a[i];
	}
	for(i=1;i<=n;i++)
	{
		hs=max(hs,p[i]+p2[i]);
	}
	cout<<hs<<"\n";
}

Measured memory_bytes: 4352
// ABC074B - 

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

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	int N, K;
	cin >> N >> K;
	int x[N];
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}

	int sum = 0;
	for (int i = 0; i < N; i++) {
		if (x[i] > (K - x[i])) {
			sum += 2 * (K - x[i]);
		} else {
			sum += 2 * x[i];
		}
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
///
// File:  d.cpp
// Author: ymiyamoto
//
// Created on Sat Dec 23 22:00:20 2017
//

#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

int32_t main()
{
  string str;
  cin >> str;

  uint32_t K = str.size();
  for (uint32_t i = 1; i < str.size(); i++) {
    if (str[i - 1] != str[i]) {
      K = min(K, max(i, (int32_t)str.size() - i));
    }
  }
  cout << K << endl;

  return 0;
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int,input().split()))
miner = 0
while sum(a) != miner:
    flag = 0
    miner = min(a)
    for i in range(len(a)):
        if a[i] == miner and flag == 0:
            flag += 1
        else:
            a[i] = a[i]%miner
    a = [i for i in a if i != 0]
print(miner)

Measured memory_bytes: 14252
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int _500 = sc.nextInt();
        int _100 = sc.nextInt();
        int _50 = sc.nextInt();
        int X = sc.nextInt();

        int way=0;
        for (int i = _500; i >= 0; i--) {
            int sub_500 = X - 500 * i;
            if (sub_500 == 0) {
                way++;
                continue;
            } else if (sub_500 < 0) {
                continue;
            }
            for (int j = _100; j >= 0; j--) {
                int sub_100 = sub_500 - 100 * j;
                if (sub_100 == 0) {
                    way++;
                    continue;
                } else if (sub_100<0) {
                    continue;
                }
                for (int k = _50; k >= 0; k--) {
                    int sub_50 = sub_100 - 50 * k;
                    if (sub_50 == 0) {
                        way++;
                        continue;
                    } else if (sub_50<0) {
                        continue;
                    }
                }
            }
        }

        System.out.printf("%d\n", way);
    }
}

Measured memory_bytes: 22740
from collections import Counter
from itertools import accumulate
N = int(input())
As = map(int, input().split())
xs = [0] + sorted([x for x in Counter(As).values()]) + [10**18]
Xs = accumulate(xs)
M = len(xs)-2
rs = [0]*N
mn = N+1
for l, (x, X) in enumerate(zip(xs[1:], Xs)):
    l = M-l
    k = X//(x+1)+l+1
    if x <= X//(k-l):
        k+=1
    for i in range(k, mn):
        rs[i-1] = X//(i-l)
    mn = min(k, mn)
for r in rs:
    print(r)

Measured memory_bytes: 118712
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c,d,cnt=0;
  cin>>a>>b>>c>>d;
  long long x =c*d,r,tmp;
  long long y=b/c,z=b/d;
 
  long long e,f,g;
  if(a%c==0) e=a/c;
  else if(a%c!=0) e=a/c+1;
  
  if(a%d==0) f=a/d;
  else if(a%d!=0) f=a/d+1;
   
  if(c<d){
    tmp = c;
    c = d;
    d = tmp;
  }
 
  
  r = c % d;
  while(r!=0){
    c = d;
    d = r;
    r = c % d;
  }
  long long gcd=x/d;
  if(a%gcd==0) g=a/gcd;
  else if(a%gcd!=0) g=a/gcd+1;
  long long int x1=b-a+1,x2=e-y-1,x3=f-z-1,x4=1-g+b/gcd;
  
  //cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<endl;
  cout<<x1+x2+x3+x4<<endl;
}

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

int main (void){
    int a[21]={},n[7],L;

    while(cin>>a[0]>>L, a[0]|L){
        int i=0;
        bool notFound=true;
        while(notFound){
            /*??????????????????*/
            n[0]=a[i];
            rep(k,L){
                n[k+1]=n[k]/10;
                n[k]%=10;
            }

            /*??????*/
            sort(n,n+L);

            /*a[i] = ????????§????????´??° - ???????°?????????´??°*/
            a[++i]=0;
            rep(k,L){
                a[i]*=10;
                a[i]+=n[L-1-k]-n[k];
            }

            /*a[i]=a[j]?????????????????????*/
            rep(j,i){
                if(a[i]==a[j]){
                    cout<<j<<" "<<a[i]<<" "<<i-j<<endl;
                    notFound = false;
                    break;
                }
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1184
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int[] a = new int[1000000];
        Arrays.fill(a, 1);
        a[0] = a[1] = 0;
        for(int i = 2; i < a.length; i++){
            if(a[i] == 1){
                for(int j = i * 2; j < a.length; j += i){
                    a[j] = 0;
                }
            }
        }
        for(int i = 1; i < a.length; i++){
            a[i] = a[i] + a[i - 1];
        }
        while(in.hasNextLine()){
            System.out.println(a[Integer.parseInt(in.nextLine())]);
        }
    }
}

Measured memory_bytes: 30588
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {

  int N;
  cin >> N;
  string C;
  cin >> C;

  int ans = 0;
  queue<int> white;
  rep(i,N) if (C[i] == 'W') white.push(i);

  for (int i = N - 1; i >= 0; i--) {
    if (C[i] == 'R') {
      if (white.empty()) break;
      int w = white.front(); white.pop();
      if (i < w) break;
      ans++;
    }
  }

  cout << ans << endl;
      
  return 0;
}

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

int32_t main()
{
	char x;
	cin>>x;
	if(x>='A' && x<='Z')
	{
		cout<<"A"<<endl;
	}else
	{
		cout<<"a"<<endl;
	}
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;

int main(){
    char ch;
    int cnt[26] = {};
    
    while(cin >> ch){
        ch = tolower(ch);
        if(isalpha(ch)){
            cnt[ch-'a']++;
        }
    }
    
    for(int i=0; i<26; i++){
        printf("%c : %d\n", i+'a', cnt[i]);
    }
    
    return 0;
}

Measured memory_bytes: 3152
#define tst(a, b) for (int i = 1; i <= (b); i++) {cout << (a)[i] << " ";} cout << endl;
#define ll long long
#define lf long double
#define ch char
#define F(a) for (int i = 1; i <= (a); i++)
#define For(a, b) for (int (a) = 1; (a) <= (b); (a)++)
#define Rep(a, b, c) for (int (a) = (b); (a) <= (c); (a)++)
#define FD(a) for (int i = (a); i >= 1; i--)
#define ForD(a, b) for (int (a) = (b); (a) >= 1; (a)--)
#define RepD(a, b, c) for (int (a) = (b); (a) >= (c); (a)--)
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back(a)
#define fi first
#define se second
#define il inline
#define reg register
#define ret return
#define opt operator
#define Mem0(a) memset((a), 0, sizeof(a))
#define MemInf(a) memset((a), 115, sizeof(a))
#define Mem(a, n) memset((a), (n), sizeof(a))
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
inline ll Rd() {
	ll C = getchar();
	ll V = 0;
	ll Sign = 0;
	while (C > '9' || C < '0') {
		Sign |= (C == '-');
		C = getchar();
	}

	while (C <= '9' && C >= '0') {
		V = (V << 1) + (V << 3) + (C ^ '0');
		C = getchar();
	}
	Sign && (V = -V);
	return V;
}

ll N;

int main()
{
	cin >> N;
	cout << ((N * (N + 1)) >> 1) << endl;
	return 0;
}


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

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	char c;
	cin >> c;
	if(c>='a') cout << 'a' << endl;
	else cout << 'A' << endl;

	return 0;
}

Measured memory_bytes: 3616
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
a_list.reverse()
b_list.reverse()
total = 0
res = 0

for i in range(len(a_list)):
    if i == 0:
        val_1 = a_list[0]
        val_2 = b_list[0]
        if val_1 <= val_2: # complete
            total += val_1
            res = val_2 - val_1
        else:
            total += val_2
            res = 0
            
    elif i == len(a_list) - 1:
        if res >= a_list[i]:
            total += a_list[i]
        else:
            total += res
        
    else:
        val_1 = a_list[i]
        val_2 = b_list[i] + res
        if  val_1 <= val_2: # complete
            total += val_1
            res = val_2 - val_1
            if res > b_list[i]:
                res = b_list[i]
        else:
            total += val_2
            res = 0
            
print(total)

Measured memory_bytes: 19004
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll m, ll n) {
  if(m < n) swap(m, n);
  if(n == 0) return abs(m);
  else return gcd(n, m % n);
}
ll lcm(ll m, ll n) {
  return abs(m*n) / gcd(m, n);
}

int main() {
  int A, B; cin >> A >> B;
  cout << lcm(A, B) << endl;
  return 0;
}


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

int main(){

    int n, m, x;
    set<int> a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x;
        a.insert(x);
    }
    
    cin >> m;
    set<int> b;
    for(int i = 0; i < m; i++){
        cin >> x;
        b.insert(x);
    }

    set<int> uni;
    set_union(a.begin(), a.end(), b.begin(), b.end(), inserter(uni, uni.end()));

    for(auto x : uni){
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 40604
n = int(input())
s = input()
e = s.count("E")
w = s.count("W")
cnt1 = 0
cnt2 = 0
ans = 10e9
for i in s:
    if i=="E":
        cnt1 += 1
        ans = min(ans,cnt2+e-cnt1)
    else:
        ans = min(ans,cnt2+e-cnt1)
        cnt2 += 1
print(ans)

Measured memory_bytes: 3676
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

s=ss()
if s=="ABC":
    print("ARC")
else:
    print("ABC")






Measured memory_bytes: 72468
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (a : p : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  print $ (3 * a + p) `div` 2

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


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

int main() {
	long long n, a, b, c, x;
	cin >> n;
	cin >> x;
	b = 0;
	vector<long long> s(n);
	for(int i = 0; i < n; i++){
		cin >> a;
		b += a;
		s.at(i) = a;
	}
	sort(s.begin(), s.end());
	if(x > b){
		cout << n - 1 << endl;
	}else if(x == b){
		cout << n << endl;
	}else{
		for(int i = 0; i < n; i++){
			x -= s.at(i);
			if(x < 0){
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>a>>b;
    if(a+b>=10) cout<<"error"<<endl;
    else cout<<a+b<<endl;
    return 0;
}


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

using namespace std;

double solve() {
  double a, b, x;
  cin >> a >> b >> x;

  if (2 * x <= a * b * a) {
    return atan2(b * a * b, 2. * x) * 180. / 3.14159265359;
  } else {
    return atan2(2. * (b * a * a - x), a * a * a) * 180. / 3.14159265359;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(15) << solve() << endl;
}


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

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

  int cnt=0;
  for (int i=a; i<=b; i++) {
    if (i/10000==i%10 && i/1000%10==i%100/10) cnt++;
  }
  cout << cnt;
}

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

typedef long long ll;

int main(){
	int n;
	string S;
	cin >> S;
	n = S.size();

	vector<int> A(S.size());
	
	rep(i,2){
		int cnt=0;
		rep(j,n){
			if(S[j]=='R')cnt++;
			else{
				A[j] += cnt/2;
				A[j-1] += (cnt+1)/2;
				cnt = 0;
			}
		}

		reverse(A.begin(),A.end());
		reverse(S.begin(),S.end());
		rep(j,n){
			if(S[j] == 'L') S[j] = 'R';
			else S[j] = 'L';
		}
	}

	for(int i=0; i<(int)S.size(); i++){
		if(i)cout << " ";
		cout << A[i];
	}cout << endl;
}




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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  vector<char> v(N);
  rep(i, 0, N) { cin >> v[i]; }
  dump(v);
  sort(all(v));
  v.erase(unique(all(v)), v.end());
  dump(v);
  cout << (v.size() == 3 ? "Three" : "Four") << endl;

  return 0;
}


Measured memory_bytes: 256
var
        s1,x:array[1..100000]of char;
        s:string;
        i,j:longint;
        ch:char;
begin
        readln(s); 
        for i:=length(s) downto 1 do
        begin
                inc(j);
                ch:=s[i];
                x[j]:=ch;
        end;
        s1:=x;
        for i:=1 to length(s) do
        begin
                if s1[i]='b' then s1[i]:='d'
                else if s1[i]='d' then s1[i]:='b'
                else if s1[i]='p' then s1[i]:='q'
                else if s1[i]='q' then s1[i]:='p';
        end;
        for i:=1 to length(s) do
                if s[i]<>s1[i] then
                begin
                        writeln('No');
                        halt;
                end;
        writeln('Yes')
end.



Measured memory_bytes: 384
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n"
#define MOD 1000000007

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

void solve()
{
    int n, m, k;
    cin >> n >> m >> k;

    vector<int> a(n);
    vector<int> b(m);

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

    for(int i = 0; i < m; i++)
    {
        cin >> b[i];
    }

    ll L = 0;
    ll R = 0;

    ll count = 0;

    while(count + a[L] <= k)
    {
        count += a[L];
        L++;
        if(L == n)
        {
            break;
        }
    }

    if(L == n || count < k)
    {
        while(count + b[R] <= k)
        {
            count += b[R];
            R++;
             if(R == m)
            {
                break;
            }
        }
    }


    if(R == m && L == n)
    {
        cout << n + m << "\n";
        return;
    }

    ll ans = L + R;

    //debug(R);
    //debug(L);

    L--;

    while(L >= 0 && R < m)
    {
        count -= a[L];
        L--;

        while(count + b[R] <= k)
        {
            count += b[R];
            R++;
            if(R == m)
            {
                break;
            }
        }

        //debug(ans);
        ans = max(ans, L + R + 1);
    }

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

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

    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}



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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  string S;
  cin>>S;
  int ans=0;
  for(auto it:S){
    if(it=='+')ans++;
    else ans--;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<=2*b)
    {
        printf("0");
    }
    else
    {
        printf("%d",a-2*b);
    }
    return 0;
}

Measured memory_bytes: 128
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef long long ll;

#define INF 1000000000000
#define MOD 10000007
//#define int long long
#define pb push_back

void YesNo(bool b) { b ? cout << "Yes" << endl : cout << "No" << endl; return; }
void YESNO(bool b) { b ? cout << "YES" << endl : cout << "NO" << endl; return; }
void yesno(bool b) { b ? cout << "yes" << endl : cout << "no" << endl; return; }

int main() {
	int n = 0;
	int k = 0;
	int a;
	int d = 0;
	bool sunuke[100];
	int ans=0;
	cin >> n >> k;
	for (int i = 0; i < 100; i++)
	{
		sunuke[i] = 0;
	}
	for (int i = 0; i < k; i++)
	{
		cin >> d;
		for (int i = 0; i < d; i++)
		{
			cin >> a;
			sunuke[a - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (sunuke[i]==0)
		{
			ans++;
		}
	}
	cout << ans << endl;
}

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

int main() {
	string s;
	cin >> s;

	bool f = true;
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] != 'R' && s[i] != 'U' &&  s[i] != 'D') {
			f = false;
		}
	}
	for (int i = 1; i < s.size(); i += 2) {
		if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D') {
			f = false;
		}
	}

	if (f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

signed main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n+1), b(m+1);
    a[0] = b[0] = 0;
    rep(i,n){
        cin >> a[i+1];
        a[i+1] += a[i];
    }
    rep(i,m){
        cin >> b[i+1];
        b[i+1] += b[i];
    }
    
    int ans = 0;
    rep(i,n+1){
        int v = k - a[i];
        if(v < 0) break;
        
        auto it = upper_bound(ALL(b), v);
        
        if(it != b.begin()) it--;
        ans = max(ans, i + distance(b.begin(), it));
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 6364
//--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
//#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
ll k;
int a[100001], b[100001];
ll sum = 0;
int main() {
	cin >> n >> k;
	vector<pair<int, int>> v;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		v.push_back(pair<int, int>(a, b));
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < n; i++) {
		sum += v[i].second;
		if (sum >= k) {
			cout << v[i].first << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
    cout <<"hon"<<endl;
  }
  else if(N%10==3){
    cout <<"bon"<<endl;
  }
  else{
    cout<<"pon"<<endl;
  }
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,k=0;
  long minus=0;
  cin>>n>>k;
  minus=k-n%k;
  
  if(n%k<k-n%k){
    cout<<n%k;
  }else{
    cout<<minus;
  }
}

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

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}

const int P = 1e9 + 7;

ll modInv(ll a, ll b){
 return 1<a ? b - modInv(b%a,a)*b/a : 1;
}

ll modDivide(ll a, ll b)
{
    a %=P;
    ll inv = modInv(b, P);
    return (inv * a) % P;
}

int main(int argc, char const *argv[])
{
    // file();
    
    ll n, k;cin>>n>>k;
    ll A[2002];

    for (int i = 0; i < n; ++i)
    {
        cin>>A[i];
    }
    
    ll self_inv = 0;

    for (int i = 0; i < n - 1; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            self_inv+=A[i] > A[j];
        }
    }

    ll type1_inv = (self_inv % P * k % P) % P; // self inverse * number of copies

    ll cp_inv = 0;

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cp_inv+=A[i] > A[j];
        }
    }
    
    // https://www.geeksforgeeks.org/modular-division/
    
    ll pairs_cnt = modDivide(k % P * (k - 1) % P, 2); // number of ways to choose pair (k * (k - 1)) / 2 but with modInverse
    
    ll type2_inv = (pairs_cnt % P * cp_inv % P) % P; // inverse_between_pair * number_of_pairs

    cout<<(type1_inv % P + type2_inv % P) % P;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll dx[]={1,0,-1,0};
ll dy[]={0,1,0,-1};
char a[405][405];
bool vis[405][405];
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll ans=0,n,m;cin>>n>>m;
    for(ll i=0;i<n;i++)cin>>a[i];
    for(ll i=0;i<n;i++){
        for(ll j=0;j<m;j++){
            if(vis[i][j])continue;
            queue< pair<ll,ll> > q;
            q.push({i,j});
            vis[i][j]=1;
            ll w=0,b=0;
            while(!q.empty()){
                auto node=q.front();
                q.pop();
                if(a[node.first][node.second]=='.')w++;
                else b++;

                for(ll dir=0;dir<4;dir++){
                    ll nx=node.first+dx[dir];
                    ll ny=node.second+dy[dir];

                    if(nx<0 || nx>=n || ny<0 || ny>=m || vis[nx][ny])continue;
                    if(a[node.first][node.second]==a[nx][ny])continue;
                    vis[nx][ny]=1;
                    q.push({nx,ny});
                }
            }
            ans+=w*b;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 640
/*
 * a.cc:
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
#include<iomanip>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main(){
  int N,K,num=0;
  cin>>N>>K;

  vector<int> vec(N);
  for (int i=0;i<N;i++){
    cin>>vec.at(i);
  }

  for (int j=0;j<N;j++){
    if (vec.at(j)>=K)
    num+=1;
  }

  cout<<num<<endl;
  return 0;
  





  
}


Measured memory_bytes: 3716
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	Scanner scanner = new Scanner(System.in);
	int sum = 0;
	for(int i = 0;i < 3;i++){
	    int k = scanner.nextInt();
	    sum += k;
	}
	if(sum > 21)
	    System.out.println("bust");
	else
	    System.out.println("win");
    }
}


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

int main() {
    int64_t n;
    cin >> n;
    vector<int64_t> sum(n);
    iota(sum.begin(), sum.end(), 1);
    for (auto i = 1; i < n; i++) sum[i] += sum[i - 1];
    // for (auto& elm : sum) cout << elm << " ";
    // cout << endl;
    auto itr = lower_bound(sum.begin(), sum.end(), n);
    for (auto i = 0; i <= distance(sum.begin(), itr); i++)
        if (*itr - n != i + 1) cout << i + 1 << endl;
    return 0;
}

Measured memory_bytes: 81384
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

string str="ACL";

int n;

int main(void) {
	cin >> n;
	for(int i = 1; i <= n; i ++) {
		cout << str ;
	}
	cout << endl;
	return 0;
} 

Measured memory_bytes: 3636
import java.io.*;
import java.util.*;

public class Main{
	static void main() throws Exception{
		int x=sc.nextInt(),n=sc.nextInt();
		HashSet<Integer>nums=new HashSet<>();
		for(int i=0;i<n;i++) {
			nums.add(sc.nextInt());
		}
		int ans=0,dif=1000000000;
		for(int i=-2000;i<=2000;i++) {
			if(nums.contains(i))continue;
			int curD=Math.abs(x-i);
			if(curD<dif) {
				ans=i;
				dif=curD;
			}
		}
		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		pw=new PrintWriter(System.out);
		sc = new MScanner(System.in);
//		int tc=sc.nextInt();
//		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

Measured memory_bytes: 32924
K,A,B = map(int,input().split())
if A+2 >= B:
	print(1+K)
elif K <= A:
	print(1+K)
else:
	new_K = K-A
	if new_K % 2 == 1:
		temp_K = int((new_K+1)/2)
		print((temp_K*B - (temp_K-1)*A))
	else:
		temp_K = int(new_K/2)
		print((int(temp_K*B - (temp_K-1)*A + 1)))
		
	

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

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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 rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n),b(n);
    rep(i,n)std::cin >> a[i]>>b[i];
    vvector(dp,int,n+1,n+1,INF);
    rep(i,n+1)dp[i][i]=0;
    rep(i,n)dp[i][i+1]=0;
    rep(i,n-1){
        dp[i][i+2]=a[i]*b[i]*b[i+1];
     //   std::cout << dp[i][i+2] << std::endl;
    }
    
    rrep(i,3,n+1){
        rep(j,n-i+1){
            //dp[j][j+i]=min(dp[j][j+i-1]+a[j]*a[j+i-1]*b[j+i-1],dp[j+1][j+i]+b[j+i-1]*a[j]*b[j]);
            rrep(ii,j+1,i+j)chmin(dp[j][j+i],dp[j][ii]+dp[ii][j+i]+a[j]*b[j+i-1]*a[ii]);
        }
    }
    std::cout << dp[0][n] << std::endl;
    
}



Measured memory_bytes: 3240
import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

long mod = 1000000007;

long modinv(long a) {
  long b=mod, u=1, v=0;
  while(b>0) {
    long t=a/b;
    a -= t*b; swap(a,b);
    u -= t*v; swap(u,v);
  }
  u %= mod;
  if(u<0) u+=mod;
  return u;
}

bool solve() {
  int k, a, b;
  k = readln.chomp.to!int;
  readf("%d %d\n", &a, &b);
  int l=k;
  while(l<=b) {
    if(a<=l && l<=b) return true;
    l += k;
  }
  return false;
}

void main() {
  if(solve) writeln("OK");
  else writeln("NG");
}


Measured memory_bytes: 2812
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = Long.parseLong(sc.next());
        long r = Long.parseLong(sc.next());
        long ans = Long.MAX_VALUE;
        long num = 0;
        for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                num = (i * j) % 2019;
                if (num < ans) {
                    ans = num;
                }
                if (num == 0) {
                    System.out.println(0);
                    return;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
n = int(input())
pre_a = input().split()
a = [int(i) for i in pre_a]
a.sort()

alice = 0
bob = 0
is_alice_turn = True
while 0 < len(a):
    if is_alice_turn:
        alice += a[len(a) - 1]
    else:
        bob += a[len(a) - 1]
    a.pop(len(a) - 1)
    is_alice_turn = not is_alice_turn
print(alice - bob)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String line = sc.nextLine();
    String[] input = line.split(" ");
    try{
      int x = Integer.parseInt(input[0]);
      int y = Integer.parseInt(input[1]);
      if(x < y){
        int temp = x;
        x = y;
        y = temp;
      }
      while(y != 0){
        int temp = x;
        x = y;
        y = temp % y;
      }
      System.out.println(x);
    }catch(NumberFormatException nfe){
      System.out.println("数字が有効範囲を外れています．有効範囲：1 <= num <= 1,000,000,000");
    }
  }
}



Measured memory_bytes: 26136
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
////////////


void solve(){
	ll ans = 0;
	int maxi = 1;
	int n;
	scanf("%d",&n);
	fi(0, n){
		int v;
		scanf("%d",&v);
		int cnt = v / maxi;
		if(v % maxi == 0) --cnt;
		ans += cnt;
		if(i == 0){ maxi = 2; continue; }
		if(cnt == 0){
			if(v == maxi) ++maxi;
		}
	}

	printf("%lld\n",ans);
}




int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);


    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n - 1; ++i) {
        int b;
        cin >> b;
        ++a.at(b-1);
    }
    for(int i = 0; i < n; ++i) {
        cout << a.at(i) << endl;
    }
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int H,W,A,B; cin>>H>>W>>A>>B;

    rep(h,0,H){
        rep(w,0,W){
            if(h<B){
                if(w<A) cout<<1;
                else cout<<0;
            }else{
                if(w>=A) cout<<1;
                else cout<<0;
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int a[3][101]={0};
int f[3][101]={0};
int main()
{
	int n,i,j,k,l;
	scanf("%d",&n);
	for(i=1;i<=2;i++)
	{
		for(j=1;j<=n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=1;i<=2;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(f[i-1][j]>f[i][j-1])
			{
				f[i][j]=f[i-1][j]+a[i][j];
			}
			else
			{
				f[i][j]=f[i][j-1]+a[i][j];
			}
		}
	}
	printf("%d",f[2][n]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 


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

i64 a, b, c; cin >> a >> b >> c;

if (a + b + 2 * sqrtl(a*b) < c)
    cout << "Yes\n";
else cout << "No\n";


return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



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

int main(){
    int x,y;
    cin >> x >> y;
    bool ans = 0;
    if(y%2 == 0){
        int z = (4*x - y)/2;
        if((z >= 0)&&(z <= x)){
            ans = true;
        }
    }

    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(){
  int n;
  double s;
  cin>>n;
  vector<int> v;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    v.push_back(a);
    s+=a;
  }
  s/=n;
  double ss=100000.0,ans=0;
  for(int i=0;i<n;i++){
    if(max((double)v[i]-s,s-(double)v[i])<ss){
      ss=max((double)v[i]-s,s-(double)v[i]);
      //cout<<ss<<endl;
      ans=i;
    }
    //cout<<max((double)v[i]-s,s-(double)v[i])<<endl;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int q = sc.nextInt();
		boolean[][] field = new boolean[h + 1][w + 1];
		int[][] sums = new int[h + 1][w + 1];
		int[][] counts = new int[h + 1][w + 1];
		char[][] haCounts = new char[h + 1][w + 1];
		char[][] waCounts = new char[h + 1][w + 1];
		for (int i = 1; i <= h; i++) {
		    char[] arr = sc.next().toCharArray();
		    for (int j = 1; j <= w; j++) {
		        field[i][j] = arr[j - 1] == '1';
		        sums[i][j] = sums[i - 1][j] + sums[i][j - 1] - sums[i - 1][j - 1];
		        if (field[i][j]) {
		            sums[i][j]++;
		        }
		        counts[i][j] = counts[i - 1][j] + counts[i][j - 1] - counts[i - 1][j - 1];
		        haCounts[i][j] = haCounts[i][j - 1];
		        if (field[i][j] && field[i - 1][j]) {
		            counts[i][j]++;
		            haCounts[i][j] = (char)(haCounts[i][j] + 1);
		        }
		        waCounts[i][j] = waCounts[i - 1][j];
		        if (field[i][j] && field[i][j - 1]) {
		            counts[i][j]++;
		            waCounts[i][j] = (char)(waCounts[i][j] + 1);
		        }
		    }
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    int x1 = sc.nextInt();
		    int y1 = sc.nextInt();
		    int x2 = sc.nextInt();
		    int y2 = sc.nextInt();
		    int ans = sums[x2][y2] - sums[x1 - 1][y2] - sums[x2][y1 - 1] + sums[x1 - 1][y1 - 1];
		    ans -= counts[x2][y2] - counts[x1 - 1][y2] - counts[x2][y1 - 1] + counts[x1 - 1][y1 - 1] - (haCounts[x1][y2] - haCounts[x1][y1 - 1]) - (waCounts[x2][y1] - waCounts[x1 - 1][y1]);
		    sb.append(ans).append("\n");
		}
		System.out.print(sb);
	}
}


Measured memory_bytes: 242976
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
	int A, B, C;
	cin >> A >> B >> C;
	Cout(max({A,B,C})*10 + A+B+C - max({A,B,C}));
}


Measured memory_bytes: 256