akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES":"NO");}
void Yn(bool z){cout<<(z?"Yes":"No");}
void yn(bool z){cout<<(z?"yes":"no");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
int a, b, c, x;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b >> c >> x;
  int ans = 0;
  FOR(i, 0, a+1)FOR(j, 0, b+1)FOR(k, 0, c+1) if(i*500+j*100+k*50==x) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;
typedef pair<int, int> P;
#define MAX_N (105)
#define MAX_C (100010)
#define INF (MAX_N * MAX_C)
vector<P> G[MAX_N];
int dist[MAX_N];
bool arrived[MAX_N];

int main()
{
    int n;
    scanf("%d", &n);
    
    for ( int i = 0; i < n; i++ ) {
	int u, k;
	scanf("%d %d", &u, &k);
	for ( int j = 0; j < k; j++ ) {
	    int v, c;
	    scanf("%d %d", &v, &c);
	    G[u].push_back( make_pair(v, c) );
	}
    }
    
    for ( int i = 0; i < n; i++ ) {
	dist[i] = INF;
    }

    dist[0] = 0;

    while ( true ) {
	int min_dist = INF;
	int u = -1;
	for ( int i = 0; i < n; i++ ) {
	    if ( !arrived[i] ) {
		if ( min_dist > dist[i] ) {
		    min_dist = dist[i];
		    u = i;
		}
	    }
	}
	
	if ( min_dist == INF ) break;
	arrived[u] = true;

	for ( int i = 0; i < G[u].size(); i++ ) {
	    P p = G[u][i];
	    int v = p.first;
	    int c = p.second;

	    if ( !arrived[v] ) {
		dist[v] = min( dist[v], dist[u] + c );
	    }
	}
    }

    for ( int i = 0; i < n; i++ ) {
	printf("%d %d\n", i, dist[i]);
    }

    return 0;
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
#pragma optimize("O3")
#define array vector<vector<int>>
#define thread sort
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (a - 1); i >= (b); i--)
#define all(a) (a).begin(), (a).end()
#define endl "\n"
#define ll long long
#define pb push_back
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vll vector<long long>
#define mii map<int, int>
#define mll map<long long, long long>
#define MOD 1000000007
#define MAX 1000000007
#define MOD2 1234567891
#define MOD3 998244353
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


long long dp[100001][13];






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

    dp[0][0] = 1;

    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < 10; j++) {
            int nxt = s[i] - '0';

            if (s[i] == '?')
                nxt = j;

            for (int k = 0; k < 13; k++) {
                int r = (10 * k + nxt) % 13;
                dp[i + 1][r] += dp[i][k];
                dp[i + 1][r] %= MOD;
            }
            if (s[i] != '?')
                break;
        }
    }

    cout << dp[s.size()][5];

    return 0;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,X;cin>>N>>X;
    vector<int> L(N);
    REP(i, N) cin >> L[i];
    int D=0;
    int ans=0;
    REP(i,N+1){
        if(D<=X) ans++;
        if(i<N) D+=L[i];
    }
    cout<<ans<<endl;
}


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

#define maxn 100002
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 y902
#define y1 y232
#define x0 x92
#define x1 x899
#define next asdfa
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int n, a[maxn];

int main() {
    //freopen("colorfulhats.inp", "r", stdin);
    //freopen("", "w", stdout);
    //ios::sync_with_stdio(0); cin.tie(0);
    scanf("%d", &n);
    FOR(i, 1, n) scanf("%d", &a[i]);
    sort(a+1, a+n+1);
    bool check = true;
    FOR(i, 1, n) {
        check = check && (a[i]==n-1);
    }
    if (check) {puts("Yes"); return 0;}
    int cnt1 = 0, cnt2 = 0;
    FOR(i, 1, n) {
        if (a[i]==a[n]) ++cnt1;
        else ++cnt2;
    }
    if (a[1]<a[n]-1 || a[n]<=cnt2 || (a[n]-cnt2)>cnt1/2) {
        puts("No");
    }
    else puts("Yes");
}



Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextFloat64() float64 {
        sc.Scan()
        f, e := strconv.ParseFloat(sc.Text(), 64)
        if e != nil {
                panic(e)
        }
        return f
}

func main() {
        r := nextFloat64()

        fmt.Printf("%.5f %.5f\n", r*r*math.Pi, r*2*math.Pi)
}


Measured memory_bytes: 1096
#include <iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<deque>
#include<iomanip>
#include<tuple>
#include<stack>

#define _USE_MATH_DEFINES
#include<math.h>


using namespace std;
typedef long long ll;

typedef pair<ll, ll> pll;
typedef tuple<int, int, int> ti3;

const ll MOD_CONST = 1000000007;
//const ll MOD_CONST = 998244353;


const int INF = 1000000000;
//const ll INF = 1000000000000000000;


const int DAY_TIME = 24;

int main() {
	int n;
	cin >> n;
	int num = n + 1;
	vector<int> d(num);

	for (int i = 1; i < num; i++) {
		cin >> d[i];
		
	}

	map<int, int> m;
	for (int i = 0; i < num; i++) {
		m[d[i]]++;
	}

	vector<bool> isFilled(DAY_TIME);


	set<int> se;
	for (auto it = m.begin(); it != m.end(); it++) {
		int cnt = it->second;
		if (cnt > 2) {
			cout << 0 << endl;
			return 0;
		}


		int t = it->first;
		if (cnt == 2) {
			if (t == 0 || t == 12) {
				cout << 0 << endl;
				return 0;
			}

			isFilled[t] = true;
			isFilled[DAY_TIME - t] = true;
		}
		else {
			if (t == 0 || t == 12) {
				isFilled[t] = true;

			}
			else {
				se.insert(t);
			}
		}



	}

	int ans = 0;
	for (int b = 0; b < (1 << se.size()); b++) {
		vector<bool> isF(isFilled);
		int cnt = 0;
		for (auto it = se.begin(); it != se.end(); it++) {
			
			if ((b >> cnt) & 1) {
				isF[*it] = true;
				//cout << "right" << " ";
			}
			else {
				isF[DAY_TIME - *it] = true;
				//cout << "left" << " ";
			}
			cnt++;
			
		}
		//cout << endl;

		int s = INF;
		for (int i = 0; i < DAY_TIME; i++) {
			for (int j = i+1; j < DAY_TIME; j++) {
				if (isF[i] && isF[j]) {

					s = min(s,min(j - i, DAY_TIME + i - j));


				}
			}

		}

		//cout << s << " " << b<< endl;
		ans = max(ans, s);
	}

	

	cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL W[12][12];

void MAIN() {
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    while (v.size() <= 10) {
	int m = v.rbegin()[0] + v.rbegin()[1];
	v.push_back(m+1);
    }

//#ifdef LOCAL
//    rprintf("%d", v.begin(), v.end());
//#endif

    scanf("%d", &N);
    W[0][1] = W[1][0] = 0;
    for (int s=2; s<N; s++) {
	REP (i, s) REP (j, s) W[i][j] *= v[s]-1;
	REP (i, s) W[i][s] = W[s][i] = v[s-1-i];
    }
    REP (i, N) REP (j, N) if (i != j) W[i][j]++;
    REP (i, N) rprintf("%lld", W[i], W[i]+N);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char str[110];
int i,j,k,l,m,n;
int n,e,s,w;
int a[105][7],b[105][7];
int t;

void input() {

  scanf("%d",&n);

  for(j=0;j<n;j++){
  for(i=0;i<6;i++){
    scanf("%d",&a[j][i+1]);
    b[j][i+1] = a[j][i+1];
    // printf("a[%d] = %d\n",i+1,a[i+1]);
  }
  }
}

void N() {
  t = a[m][1];
  a[m][1] = a[m][2];
  a[m][2] = a[m][6];
  a[m][6] = a[m][5];
  a[m][5] = t;
}

void S() {
  t = a[m][1];
  a[m][1] = a[m][5];
  a[m][5] = a[m][6];
  a[m][6] = a[m][2];
  a[m][2] = t;
}

void E() {
  t = a[m][1];
  a[m][1] = a[m][4];
  a[m][4] = a[m][6];
  a[m][6] = a[m][3];
  a[m][3] = t;
}

void W() {
  t = a[m][1];
  a[m][1] = a[m][3];
  a[m][3] = a[m][6];
  a[m][6] = a[m][4];
  a[m][4] = t;
}

void UF() {

  if(a[k][1] == a[m][1]) { // if qu == 1;
    // printf("qu == 1\n");
    if(a[k][2] == a[m][3]) strcpy( str, "NWS");
    else if(a[k][2] == a[m][5]) strcpy(str ,"NEES");
    else if(a[k][2] == a[m][4]) strcpy(str,"NES");


  }  else if(a[k][1] == a[m][2]) {  // if qu == 2;
    // printf("qu == 2\n");
    if(a[k][2] == a[m][3])  strcpy( str, "NWS");
    else if(a[k][2] == a[m][1] ) strcpy(str ,"NEES");
    else if(a[k][2] == a[m][4]) strcpy(str,"NES");
    N();


  } else if(a[k][1] == a[m][3]){ // if qu == 3;
    //   printf("qu(%d) == %d\n",qu[k],a[3]);    
    if(a[k][2] == a[m][6])  strcpy( str, "NWS");
    else if(a[k][2] == a[m][5])  strcpy(str ,"NEES");
    else if(a[k][2] == a[m][1]) strcpy(str,"NES");
    W();


  } else if(a[k][1] == a[m][4]) {
    if(a[k][2] == a[m][1]) strcpy( str, "NWS");
    if(a[k][2] == a[m][5])  strcpy(str ,"NEES");
    if(a[k][2] == a[m][6]) strcpy(str,"NES");
    E();


  } else if(a[k][1] == a[m][5]) {
    if(a[k][2] == a[m][3]) strcpy( str, "NWS");
    else if(a[k][2] == a[m][6])  strcpy(str ,"NEES");
    else if(a[k][2] == a[m][4]) strcpy(str,"NES");
    S();


  } else if(a[k][1] == a[m][6]) {
    if(a[k][2] == a[m][3]) strcpy( str, "NWS");
    else if(a[k][2] == a[m][2])  strcpy(str ,"NEES");
    else if(a[k][2] == a[m][4]) strcpy(str,"NES");
    N();
    N();
  }


}


void output() {

  if(l == 6) printf("No\n");
  else printf("Yes\n");
}

void IF() {

  for(i=0;i<strlen(str);i++) {

    if(str[i] == 'N') N();
    else if(str[i] == 'S') S();
    else if(str[i] == 'W') W();
    else if(str[i] == 'E') E();
  }
}

int main() {


  input();

  for(k=0;k<n;k++) {
    for(m=0; m<n;m++) {

    UF();
    
    IF();

    l=0;

    if(k != m) {
    for(i=1; i<=6;i++) {
      if(a[k][i] == a[m][i]) l++;
      // printf("{a[%d][%d]=%d}  == {a[%d][%d]=%d} ?\n",k,i,a[k][i],m,i,a[m][i]);
    }
    }

    if(l == 6) break;

    }
    if(l ==6) break;
  }

  
    output();



  //  strlen(?) ???????????????(??°)


  return 0;
}



Measured memory_bytes: 2108
def examA():
    S = SI()
    if S in alphabet:
        ans = "a"
    else:
        ans = "A"
    print(ans)
    return

def examB():
    N, K = LI()
    P = LI()
    P.sort()
    ans = sum(P[:K])
    print(ans)
    return

def examC():
    N = I()
    ans = ""
    while(N>0):
        N -= 1
        ans += alphabet[N%26]
        N //= 26
        if N==0:
            break
    print(ans[::-1])
    return

def examD():
    N = I()
    A = LI()
    q = I()

    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10548
from sys import stdin


def main():
    A, B, C, K = [int(x) for x in stdin.readline().rstrip().split()]
    a = B + C
    b = C + A
    c = A + B

    ans = a - b if K % 2 else A - B 
    print('Unfair' if ans > 10 ** 18 else ans)


if __name__ == '__main__':
    main()


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

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


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();
        System.out.println((int)(ceil((double)n / 1000) * 1000 - n));
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
typedef double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1
#define PI 3.14159265


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

    string str;
    cin >> str;
    int ans = 0;
    for(int i = 0 ; i < (int)str.size() ; i++) {
        if(str[i] == '+') ans++;
        else ans--;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
cards = [input() for _ in range(n)]
missings = []

for c in "SHCD":
    for i in range(1, 14):
        card = f'{c} {i}'
        if card not in cards:
           missings.append(card)

if n != 52:
    print('\n'.join(missings))



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define var auto
using ll = long long;

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(15) << fixed;
    int n;
    cin >> n;
    double ySum = 0, xSum = 0;
    vector<pair<double, double>> a;
    for (int i = 0; i < n; i++){
        double y, x;
        cin >> y >> x;
        ySum += y;
        xSum += x;
        a.push_back(make_pair(y, x));
    }
    double EPS = 0.0000001;
    var midY = ySum / n, midX = xSum / n;
    for (int i = 0; i < n; i++){
        bool flag = false;
        double oppositeY = midY * 2 - a[i].first, oppositeX = midX * 2 - a[i].second;
        for (int j = 0; j < n; j++){
            if (abs(a[j].first - oppositeY) < EPS && abs(a[j].second - oppositeX) < EPS) flag = true;
        }
        if (!flag) {
            cout << "NA" << endl;
            return 0;
        }
    }
    cout << midY << " " << midX << endl;
    return 0;
}



Measured memory_bytes: 3300
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
#define MAX 400000

int main() {
    int n;
    int a[MAX];
    int b[MAX];
    cin >> n;
    for (int i=0;i<n-1;i++) {
      cin >> a[i];
    }
    for (int i=0;i<n-1;i++) {
        b[a[i]-1]++;
    }
    for (int i=0;i<n;i++) {
        cout << b[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5160
#include <stdio.h>
#include <stdio.h>
#define N 101
#define WHITE 0
#define GRAY 1
#define BLACK 2



int A[N][N];
int queue[N];
int head = 0;
int tail = 0;
int color[N];
int far[N];
int n;

void enqueue(int a){
  queue[tail] = a;
  tail = (tail+1)%N;
}

int  dequeue(){
  int b;
  b = queue[head];
  head = (head + 1)%N;
  return b;
}

void BFS(){
  int u,i;
  for(i=2;i<=n;++i){
    color[i] = WHITE;
  }

  color[1] = GRAY;
  far[1] = 0;
  enqueue(1);

  while(head != tail){
    u = dequeue();

    for (i=1;i<=n;++i){
      if(A[u][i] == 1 && color[i] == WHITE){
        color[i] = GRAY;
        far[i] = far[u]+1;
        enqueue(i);
      }
    }
    color[u] = BLACK;
  }


}

int main(){
  int i,j,h,sib;

  for(i=0;i<N;++i){
    for(j=0;j<N;++j) A[i][j] = 0;
    far[i] = -1;
  }

  scanf("%d",&n);

  for(i=1;i<=n;++i){
    scanf("%d%d",&sib,&h);

    for(j=1;j<=h;++j){
      scanf("%d",&sib);
      A[i][sib] = 1;
    }
  }

  BFS();

  for(i=1;i<=n;++i)printf("%d %d\n",i,far[i]);


return 0;

}



Measured memory_bytes: 2112
#include<stdio.h>

int main(){
    int w, h, x, y;
    scanf("%d%d%d%d", &w, &h, &x, &y);
    double a = 1.0 * w * h / 2;
    if(2*x == w && 2*y == h){
        printf("%lf 1", a);
    }else{
        printf("%lf 0", a);
    }

    return 0;
}

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

using namespace std;

#define endl "\n"
//a#define ll unsigned long long
#define int long long int
#define vi vector <int >
#define vvi vector < vector < int >  >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define fore(i,c) for(int i = 1; i <= (int)c; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
//#define double long double
#define a first
#define b second


int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);

   int a, b;
   cin >> a >>  b;

   bool g = false;
   int ans = -1;
    fore(i, 11000){
       if(i/10 == b && (i*8)/100 == a){
           g = true;
           ans = i;
           break;
        }
    }
    if(g)
        cout << ans << endl;
    else cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> x(N),y(N),h(N);
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i]>>h[i];
    }
    for(int posx=0;posx<=100;posx++){
        for(int posy=0;posy<=100;posy++){
                int needh = -1;
            for(int j=0;j<N;j++){
                if(h[j]>0){
                    int tmp = h[j] + abs(posx-x[j]) + abs(posy-y[j]);
                    if(needh==-1){
                        needh=tmp;
                    }else{
                        if(needh!=tmp){
                            needh=-2;
                            break;
                        }
                    }
                }
            }
            if(needh==-2)continue;
            for(int j=0;j<N;j++){
                if(h[j]==0){
                    int tmp = h[j] + abs(posx-x[j]) + abs(posy-y[j]);
                    if(needh>tmp){
                        needh=-2;
                        break;
                    }
                }
            }
            if(needh==-2)continue;
            
            cout<<posx<<" "<<posy<<" "<<needh<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <utility>
#define rep(i, n) for(int i = 0; i < n; i++);

using namespace std;

const int INF = 1000000007;
const double PI = acos(-1.0);
typedef long long llong;


int main()
{
	string input1, input2;
	vector<string> vec;
	for (int i = 0; i < 2; i++)
	{
		int n;
		cin >> n;
		for (int j = 0; j < n; j++)
		{
			string time;
			cin >> input1 >> input2;
			time = ((input1.size() == 1) ? "0" : "") + input1 + ":" + ((input2.size() == 1) ? "0" : "") + input2;
			vec.push_back(time);
		}
	}

	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());

	for (int i = 0; i < vec.size(); i++)
	{
		if (vec[i][0] == '0')
			vec[i].erase(vec[i].begin());
		cout << ((i != 0 ) ? " " : "") << vec[i];
	}
	cout << endl;
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if(s == "abc") cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
red = [list(map(int, input().split())) for _ in range(n)]
blue = [list(map(int, input().split())) for _ in range(n)]

blue.sort()

res = 0
for bx, by in blue:
    dist = -1
    for rx, ry in red:
        if rx < bx and dist < ry < by:
            dist = ry
            mx, my = rx, ry
    
    if dist > -1:
        res += 1
        red.remove([mx, my])

print(res)

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

int main() {
  string w;
  cin >> w;
  int cnt[26], n = w.size();
  fill(cnt, cnt+26, 0);
  for (int i=0; i<n; i++) {
    int id = w[i]-'a';
    cnt[id]++;
  }
  for (int i=0; i<26; i++) {
    if (cnt[i]%2) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main() {
  int n; cin >> n;
  double x, sum = 0;
  string u;
  for(int i = 0; i < n; i++) {
    cin >> x >> u;
    u == "JPY" ? sum += x : sum += x*380000;
  }
  cout << sum << endl;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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 main(){
  string s;
  cin>>s;
  string ans="";
  if(s=="Sunny") ans = "Cloudy";
  if(s=="Cloudy") ans = "Rainy";
  if(s=="Rainy") ans = "Sunny";
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) cout << (x) << endl;
#define ENDL cout << endl;
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

int n , y;

signed main(){
    Init_On start;
    cin >> n >> y;
    for(int i = 0 ; i <= n ; ++i){
        for(int j = 0 ; j <= n ; ++j){
            if( i*10000 + j*5000 + (n - i - j)*1000 == y && n - i - j >= 0){
                cout << i << " " << j << " " << n - i - j << endl;
                return 0; 
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

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

typedef long long ll;
const ll INF = 1e18;
const ll MAX_N = 8000;

// 0:X, 1:Y
// cnt
// 8000 - pos
bool dp[2][MAX_N+1][2*MAX_N+2];

int main(int argc, char* argv[])
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  std::string s;
  ll x, y;
  std::cin >> s >> x >> y;

  for (ll axis = 0; axis < 2; axis++) {
    for (ll i = 0; i <= MAX_N; i++) {
      for (ll distance = 0; distance <= MAX_N; distance++) {
	dp[axis][i][distance] = false;
      }
    }
  }

  std::vector< ll > vv[2];
  ll axis = 0;
  ll step = 0;
  std::string::iterator it;
  for (it = s.begin(); it != s.end(); it++) {
    if (*it == 'T') {
      break;
    }
    step++;
  }
  dp[0][0][8000+step] = true;

  axis = 0;
  step = 0;
  for (; it != s.end(); it++) {
    if (*it == 'F') {
      step++;
    } else {
      vv[axis].push_back(step);
      axis = axis == 0 ? 1 : 0;
      step = 0;
    }
  }
  vv[axis].push_back(step);

  dp[1][0][8000] = true;
  for (ll axis = 0; axis < 2; axis++) {
    for (ll i = 1; i <= (ll)vv[axis].size(); i++) {
      for (ll distance = 0; distance < 2 * MAX_N + 2; distance++) {
	if (dp[axis][i-1][distance-vv[axis][i-1]] == true) {
	  //std::cout << axis << " " << i << " " << distance << std::endl;
	  dp[axis][i][distance] = true;
	}
	if (dp[axis][i-1][distance+vv[axis][i-1]] == true) {
	  //std::cout << axis << " " << i << " " << distance << std::endl;
	  dp[axis][i][distance] = true;
	}
      }
    }
  }

  if (dp[0][vv[0].size()][8000+x] == true &&
      dp[1][vv[1].size()][8000+y] == true) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  //std::cout << dp[0][vv[0].size()][8000+x] << std::endl;
  //std::cout << dp[1][vv[1].size()][8000+y] << std::endl;

  return 0;
}


Measured memory_bytes: 250368
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7,MAX = 1e6+5;
const ll INF = 1e18+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
///////////////////PnC/////////////////////
vl Fac(MAX),Inv(MAX);
void CalcFac()
{
	Fac[0]=Inv[0]=1;
	for(int i=1;i<MAX;i++)
	{
		Fac[i]=(Fac[i-1]*i)%MOD;
		Inv[i]=powN(Fac[i],MOD-2);
	}
}

ll NCR(int n,int r)
{
	if(r>n) return 0;
	return (((Fac[n]*Inv[r])%MOD)*Inv[n-r])%MOD;
}
///////////////////PnC/////////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vi MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	int n;
	cin>>n;
	vi A(n);
	take(A,0,n);
	int x=0;
	for(int i=0;i<n;i++)
	{
		if(i%2==0)
		{
			if(A[i]%2) x++;
		}
	}
	cout<<x<<endl;
}	


Measured memory_bytes: 22956
def initialize_buiding(building):
    for i in range(3):
        building.append([0 for j in range(10)])

def change_room(floor, row, v, building):
    building[floor-1][row-1] += v

def print_university_building(building):
    for floor in building:
        print(' ', end='')
        print(' '.join(map(str,floor)))

def print_hash():
    for i in range(1, 20):
        print('#',end="")
    print("#")

uni_building1 = []
uni_building2 = []
uni_building3 = []
uni_building4 = []

initialize_buiding(uni_building1)
initialize_buiding(uni_building2)
initialize_buiding(uni_building3)
initialize_buiding(uni_building4)

n = int(input())

for i in range(n):
    b,f,r,v = (int(x) for x in input().split())
    if b == 1:
        change_room(f,r,v,uni_building1)
    elif b == 2:
        change_room(f,r,v,uni_building2)
    elif b == 3:
        change_room(f,r,v,uni_building3)
    elif b == 4:
        change_room(f,r,v,uni_building4)
    else:
        None

print_university_building(uni_building1)
print_hash()
print_university_building(uni_building2)
print_hash()
print_university_building(uni_building3)
print_hash()
print_university_building(uni_building4)


Measured memory_bytes: 5624
n = int(input())
suretsu0 = []

biggest_num = 0
secondly_biggest_num=0
for i in range(n):
    a = int(input())
    suretsu0.append(a)

suretsu = [x for x in suretsu0]
suretsu.sort()


biggest_num = suretsu[-1]
secondly_biggest_num=suretsu[-2]




for ele in suretsu0:
    if ele==biggest_num:
        print(secondly_biggest_num)
    else:
        print(biggest_num)   


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

int main() {
  string str;
  cin >> str;
  string ans = "No";
  if (str.size() >= 4) {
    if (str.at(0) == 'Y') {
      if (str.at(1) == 'A') {
        if (str.at(2) == 'K') {
          if (str.at(3) == 'I') {
          ans = "Yes";
          }
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second

const int MAXn = 2003;
int deg[MAXn],mx[MAXn];
int fa[MAXn],dep[MAXn];
int ans,col[MAXn],pr[MAXn];
bool vis[MAXn];
vector<int> e[MAXn];
pair<int,int> d[MAXn],tmp[MAXn];
void dfs1(int x,int p){
    fa[x] = p;
    dep[x] = dep[fa[x]] + 1;
    for (auto i:e[x]) {
        if (i == p) continue;
        dfs1(i,x);
    }
}
int LCA(int x,int y){
    while (x != y) {
        if (dep[x] < dep[y]) swap(x,y);
        x = fa[x];
    }
    return x;
}
void dfs2(int x) {
    for (auto i:e[x]) {
        if (i == fa[x]) continue;
        dfs2(i);
        mx[x] += mx[i];
    }
    ans += min(mx[x],2);
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,m;
    cin >> n >> m;
    for (int i=0;i<n-1;++i) {
        int u,v;
        cin >> u >> v;
        e[u].emplace_back(v);
        e[v].emplace_back(u);
        deg[u]++, deg[v]++;
    }
    dfs1(1,0);
    for (int i=1;i<=m;++i) {
        cin >> d[i].X >> d[i].Y;
        tmp[i] = d[i];
        mx[d[i].X]++, mx[d[i].Y]++, mx[LCA(d[i].X,d[i].Y)] -= 2;
    }
    dfs2(1);

    for (int c=0;c<n-1;++c) {
        int now = 0;
        for (int i=2;i<=n;++i) {
            if (!vis[i] && deg[i] == 1) {
                now = i;
                break;
            }
        }
        vis[now] = true;
        int tmpfa = 0;
        for (auto i:e[now]) {
            if (!vis[i]) {
                tmpfa = i;
                break;
            }
        }

        deg[tmpfa]--;
        int ta = 0, tb = 0;
        for (int i=1;i<=m;++i) {
            if ((tmp[i].X == now) ^ (tmp[i].Y == now)) {
                if (ta == 0) ta = i;
                else tb = i;
            }
        }

        if (!ta && !tb) continue;
        if (!tb) {
            if (tmp[ta].X == now) tmp[ta].X = tmpfa;
            else tmp[ta].Y = tmpfa;
            continue;
        }
        if (tmp[ta].X == now) {
            if (tmp[tb].X == now) {
                tmp[ta].X = tmp[tb].Y;
                col[tb] ^= 1;
            }
            else tmp[ta].X = tmp[tb].X;
        }
        else {
            if (tmp[tb].Y == now) {
                tmp[ta].Y = tmp[tb].X;
                col[tb] ^= 1;
            }
            else tmp[ta].Y = tmp[tb].Y;
        }
        pr[tb] = ta;
        tmp[tb].X = tmp[tb].Y;
        for (int i=1;i<=m;++i) {
            if ((tmp[i].X == now) ^ (tmp[i].Y == now)) {
                if (tmp[i].X == now) tmp[i].X = tmpfa;
                else tmp[i].Y = tmpfa;
            }
        }
    }
    for (int i=1;i<=m;++i) {
        if (pr[i]) col[i] ^= col[pr[i]];
    }
    
    cout << ans << endl;
    for (int i=1;i<=m;++i) {
        if (col[i]) swap(d[i].X,d[i].Y);
        cout << d[i].X << " " << d[i].Y << endl;
    }
}


Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
int ch[200];
int main()
{
	int n,k;
	cin>>n>>k;int o=0;int ans=n; 
	for(int i=0;i<k;i++)
	{
		int d;
		cin>>d;
		for(int j=0;j<d;j++)
		{
			int l;
			cin>>l;
		int frag=0;
		for(int p=0;p<200;p++)
			if(ch[p]==l)
				frag=1;
			if(frag==0)
			{
				ch[o++]=l;ans--;
			}
		}
	}
	cout<<ans;
	return 0;
}


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

int S,T,U,N,O,D;
int e[101],c[101];
int h[101],a[101];
int dp[101][101][101];//dp[T][U][X]その日の体力X→その日の消費カロリ

int Dp[101][10001];//dp[N][X]その日の消費カロリX→その日の幸福

int DP[101][101];// DP[I][J]I日目開始時に体力がJあるときの答

void init();
void print_dp();
void make_dp();

void print_Dp();
void make_Dp();

void print_DP();
void make_DP();

int main(){
  while(cin>>S>>T>>U>>N>>O>>D){
    
    for(int i=1;i<=T;i++)cin>>e[i]>>c[i];
    for(int i=1;i<=N;i++)cin>>h[i]>>a[i];
    init();

    make_dp();
    //print_dp();
    make_Dp();
    //print_Dp();
    make_DP();
    //print_DP();
    cout<<DP[1][S]<<endl;
  }
  return 0;
}

void init(){
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      for(int k=0;k<=100;k++){
	dp[i][j][k]=(j==0?0:-1);
      }
    }
  }
  for(int i=0;i<=100;i++){
    for(int j=0;j<=10000;j++)Dp[i][j]=0;
  }
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      DP[i][j]=-1;
    }
  }
}

void make_dp(){
  for(int i=1;i<=T;i++){
    for(int j=1;j<=U;j++){
      for(int k=1;k<=S;k++){
	dp[i][j][k]=dp[i-1][j][k];
	if(k-e[i]>=0){
	  if(dp[i-1][j-1][k-e[i]]!=-1){
	    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k-e[i]]+c[i]);
	  }
	}
	
      }
    }
  }
}

void print_dp(){
  for(int i=1;i<=T;i++){
    for(int j=1;j<=S;j++){
      printf("%3d",dp[i][U][j]);
    }
    cout<<endl;
  }
  cout<<endl;
}

void make_Dp(){
  for(int i=1;i<=N;i++){
    for(int j=1;j<=10000;j++){
      Dp[i][j]=Dp[i-1][j];
      if(j-a[i]>=0)Dp[i][j]=max(Dp[i][j],Dp[i][j-a[i]]+h[i]);
    }
  }
}

void print_Dp(){
  for(int i=1;i<=20;i++) printf("%3d",i);
  cout<<endl;

  for(int i=1;i<=N;i++){
    for(int j=1;j<=20;j++){
      printf("%3d",Dp[i][j]);
    }
    cout<<endl;
  }
  cout<<endl;
}

void make_DP(){
  for(int j=S;j>=0;j--){
    if(dp[T][U][j]==-1)DP[D][j]=-1;
    else DP[D][j]=Dp[N][dp[T][U][j]];
  }

  for(int i=D-1;i>=1;i--){
    for(int j=S;j>=0;j--){
      for(int k=0;k<=j;k++){
	if(dp[T][U][k]==-1)continue;
	if(j-k+O<0||DP[i+1][min(j-k+O,S)]==-1)continue;
	DP[i][j]=max(DP[i][j],Dp[N][dp[T][U][k]]+DP[i+1][min(j-k+O,S)]);
      }
      //DP[i][j]=Dp[N][dp[T][U][j]];
    }
  }

}

void print_DP(){
  for(int i=1;i<=D;i++){
    for(int j=0;j<=S;j++){
      printf("%3d",DP[i][j]);
    }
    cout<<endl;
  }
  cout<<endl;
}

Measured memory_bytes: 9180
h,w = map(int,input().split())
grid = [[0 for j in range(0,w)] for i in range(0,h)]
black = 0
for i in range(0,h):
    c = list(input())
    grid[i] = c
for j in range(0,h):
    for i in range(0,w):
        if grid[j][i] == "#":
            black += 1
#幅探索
point = [[0 for j in range(0,w)] for i in range(0,h)]
q = [(0,0)]
def haba(y,x):
    nextPoint = [[y+1,x],[y,x+1],[y-1,x],[y,x-1]]
    for ny,nx in nextPoint:
        if ny >= 0 and ny < h and nx >= 0 and nx < w:
            if grid[ny][nx] == "." and point[ny][nx] == 0:
                point[ny][nx] = point[y][x] + 1
                q.append((ny,nx))
while len(q)>0:
    (y,x) = q.pop(0)
    haba(y,x)
if point[h-1][w-1] == 0:
    print("-1")
else:
    print((h*w) - point[h-1][w-1] - 1 - black)


Measured memory_bytes: 3064
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var s = Console.ReadLine().Trim();
            if (s == "0.0") break;
            var a = double.Parse(s);
            getAns(a);
        }
    }
    static void getAns(double a)
    {
        var shi = 1;
        var bo = 1;
        while (true)
        {
            var t = (double)shi / bo;
            if (t <= PI + a && t >= PI - a) { Console.WriteLine("{0}/{1}", shi, bo); break; }
            else if (t < PI) shi++;
            else bo++;
        }
    }
}



Measured memory_bytes: 13868
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

#define ROOT (0)
#define INTERNAL_NODE (1)
#define LEAF (2)

class Node{
public:
	int parent;
	std::vector<int> children;

	Node() : parent(-1){
		return;
	}

	~Node(){
		return;
	}

	int get_type(){
		if(parent == -1){
			return ROOT;
		}
		else if(!children.empty()){
			return INTERNAL_NODE;
		}
		else{
			return LEAF;
		}
	}

};


int calc_depth(const std::vector<Node> &nodes, int i){
	int d = 0;
	int n = nodes[i].parent;

	while(n != -1){
		n = nodes[n].parent;
		d++;
	}
	return d;
}

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;
	std::vector<Node> node_vec;

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif

	node_vec.resize(n);

	for(int i = 0; i < n; i++){
		int id = -1;
		int k = -1;

#if INPUT_FROM_FILE
		ifs >> id >> k;
#else
		std::cin >> id >> k;
#endif

		for(int j = 0; j < k; j++){
			int cid = -1;

#if INPUT_FROM_FILE
			ifs >> cid;
#else
			std::cin >> cid;
#endif
			node_vec[id].children.push_back(cid);
			node_vec[cid].parent = id;
		}
	}


	for(unsigned int i = 0; i < node_vec.size(); i++){
		std::cout << "node " << i << ": ";
		
		std::cout << "parent = " << node_vec[i].parent << ", ";

		std::cout << "depth = " << calc_depth(node_vec, i) << ", ";

		if(node_vec[i].get_type() == ROOT){
			std::cout << "root, ";
		}
		else if(node_vec[i].get_type() == INTERNAL_NODE){
			std::cout << "internal node, ";
		}
		else{
			std::cout << "leaf, ";
		}

		std::cout << "[";
		for(unsigned int j = 0; j < node_vec[i].children.size(); j++){
			std::cout << node_vec[i].children[j];
			if(j < node_vec[i].children.size() - 1){
				std::cout << ", ";
			}
			else{
			}
		}
		std::cout << "]" << std::endl;
	}

	return 0;
}


Measured memory_bytes: 6744
import java.util.*;
class Main{
	public static void main(String[]args){
      Scanner in = new Scanner(System.in);
      String n = in.nextLine();
      int c =0, d=0;
      for(int i = 0 ; i < n.length() ; i++){
      	if(n.charAt(i)=='A')
          c++;
        else if(n.charAt(i)=='B')
          d++;
      }
      if(c==2)
        System.out.println("Yes");
      else if(d==2)
         System.out.println("Yes");
      else
         System.out.println("No");
    }
}

Measured memory_bytes: 20820
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
#define enl "\n"
using namespace std;
using ll=long long;
using ld=long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using vlll = vector<vector<vector<ll>>>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
void bl(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void bl2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) {
            for (auto vvv : vv) cout << vvv << " ";
            cout << endl;
        }
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class CManagement {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n;
	    in >> n;
	    vector<ll> a(n);
	    for(int i=0; i<n-1; i++){
	        in >> a[i];
	    }

        vector<vector<ll>> res(n, vector<ll>());
	    for(int i=0; i<n-1; i++){
	        res[a[i]-1].push_back(i);
	    }

	    for(int i=0; i<n; i++){
	        out << res[i].size() << enl;
	    }
	}
};


int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	CManagement solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 15868
#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
LL i,j,k,m,n,a[200040];
string s;
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout<<fixed<<setprecision(12);
	cin>>n>>m;
	cout<<n*m;
	
}

Measured memory_bytes: 3640
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
    int a,b,c,d;
    string s;
    cin>>s;
    a=(int)s[0]-48;
    b=(int)s[1]-48;
    c=(int)s[2]-48;
    d=(int)s[3]-48;

    if(a+b+c+d==7)
        cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";
    else if(a-b+c+d==7)
        cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7";
    else if(a+b-c+d==7)
        cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7";
    else if(a+b+c-d==7)
        cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7";
    else if(a-b-c+d==7)
        cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7";
    else if(a-b+c-d==7)
        cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7";
    else if(a+b-c-d==7)
        cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7";
    else if(a-b-c-d==7)
        cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7";


    return 0;
}

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


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

	int min_ans = INT_MAX;
	sort(a,a+n);

	int start = a[0];
	int end = a[n-1];

	for(int i = start ; i <= end ; i++){
		int curr = i;
		int temp = 0;
		for(int i = 0;i<n;i++){
			temp += abs(a[i] - curr) * abs(a[i] - curr) ;
		}
		if(temp < min_ans){
			min_ans = temp ;
			
		}
	}
	cout<<min_ans<<endl;
}

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

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

    vector<long long> A(N + 1);
    for (long long &a : A)
    {
        cin >> a;
    }

    vector<long long> limit(N + 1, 0);
    limit[0] = 1 - A[0];
    for (size_t i = 1; i <= N; i++)
    {
        limit[i] = min(2 * limit[i - 1] - A[i], (long long)1e17);
    }
    for (long long l : limit)
    {
        if (l < 0)
        {
            cout << -1 << endl;
            return 0;
        }
    }

    long long prev = 0;
    long long ans = 0;
    for (size_t i = N; i <= N; i--)
    {
        if (2 * limit[i] < prev)
        {
            cout << -1 << endl;
            return 0;
        }
        prev = min(prev, limit[i]) + A[i];
        ans += prev;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4840
#include <algorithm>
#include <cstdio>

#define int long long
#define dotimes(i, n) for (int i = 0; i < (n); i++)
#define rint(n) scanf("%lld", &(n))
#define wint(n) printf("%lld\n", (n))

using namespace std;

signed main() {
  int N;
  rint(N);
  int A[N], B[N], C[N];
  dotimes(i, N) rint(A[i]);
  dotimes(i, N) rint(B[i]);
  dotimes(i, N) rint(C[i]);
  sort(A, A + N);
  sort(C, C + N);
  int r = 0;
  dotimes(i, N)
    r += (lower_bound(A, A + N, B[i]) - A) * (C + N - upper_bound(C, C + N, B[i]));
  wint(r);
  return 0;
}


Measured memory_bytes: 2560