akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

struct _X {
	int back, front;
	int left, right;
	int bottom, top;
};
struct _Y {
	int top, bottom;
	int front, back;
	int left, right;
};
struct _Z {
	int back, front;
	int top, bottom;
	int left, right;
};
class Dice {
private :
	void Swap( int &a, int &b ) { int t = a; a = b; b = t; }
public :
	union {
		_X X;
		_Y Y;
		_Z Z;
		int d[6];
	};
	Dice ( int t, int bt, int f, int bk, int l, int r )
		{ Y.top = t; Y.bottom = bt; Y.front = f; Y.back = bk; Y.left = l; Y.right = r; }
	void RotLeftX	( int n );
	void RotLeftY	( int n );
	void RotLeftZ	( int n );
	void RotRightX	( int n );
	void RotRightY	( int n );
	void RotRightZ	( int n );
};

void Dice::RotLeftX ( int n ) {
	int m[] = { 2, 1, 3 }; // f, bt, bk
	for(int i=0; i < n; ++i) {
		for(int j=0; j < 3; ++j) Swap(d[0], d[m[j]]); // t
	}
}
void Dice::RotLeftY ( int n ) {
	int m[] = { 2, 5, 3 }; // f, r, bk
	for(int i=0; i < n; ++i) {
		for(int j=0; j < 3; ++j) Swap(d[4], d[m[j]]); // l
	}
}
void Dice::RotLeftZ ( int n ) {
	int m[] = { 5, 0, 4 }; // r, t, l
	for(int i=0; i < n; ++i) {
		for(int j=0; j < 3; ++j) Swap(d[1], d[m[j]]); // bt
	}
}
void Dice::RotRightX ( int n ) {
	int m[] = { 3, 1, 2 }; // bk, bt, f
	for(int i=0; i < n; ++i) {
		for(int j=0; j < 3; ++j) Swap(d[0], d[m[j]]); // t
	}
}
void Dice::RotRightY ( int n ) {
	int m[] = { 3, 5, 2 }; // bk, r, f
	for(int i=0; i < n; ++i) {
		for(int j=0; j < 3; ++j) Swap(d[4], d[m[j]]); // l
	}
}
void Dice::RotRightZ ( int n ) {
	int m[] = { 4, 0, 5 }; // l, t, r
	for(int i=0; i < n; ++i) {
		for(int j=0; j < 3; ++j) Swap(d[1], d[m[j]]); // bt
	}
}

int main( void )
{
	int n;
	while(cin >> n, n) {
		string in;
		Dice dice(1, 6, 2, 5, 4, 3);
		int sum = 1;
		for(int i=0; i < n; ++i) {
			cin >> in;
			switch(in[0]) {
			case 'N':
				dice.RotRightX(1);
				break;
			case 'E':
				dice.RotRightZ(1);
				break;
			case 'W':
				dice.RotLeftZ(1);
				break;
			case 'S':
				dice.RotLeftX(1);
				break;
			case 'R':
				dice.RotRightY(1);
				break;
			case 'L':
				dice.RotLeftY(1);
				break;
			}
			sum += dice.Y.top;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 0
// 1_1_B
#include <stdio.h>

long gcd(long x, long y){
    long tmp;
    while(y){
        tmp = y;
        y = x % y;
        x = tmp;
    }
    return x;
}

int main(){
    long x, y;
    scanf("%ld %ld", &x, &y);
    printf("%ld\n", gcd(x, y));
    return 0;
}

Measured memory_bytes: 592
#include<cstdio>
#include<iostream>

using namespace std;
int main(){
	int masu[4000],n,m,iti;
	while(cin>>n>>m&&n){
		iti=1;
	for(int i=1;i<=n+m;i++){
		cin>>masu[i];
	}
	for(int i=1;i<=m;i++){
		iti+=masu[i+n];
		iti+=masu[iti];
		if(iti>=n){
			printf("%d\n",i);
			break;
		}
	}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define itrep(type, it, t) for(type::iterator it=t.begin(); it!=t.end(); it++)
using namespace std;


int main(void) {

    int A, B, C;
    cin >> A >> B >> C;

    if(A == B && B == C) cout << "No";
    else if(A == B || B == C || A == C) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 256
/*
 *
 * Author: r3gz3n
 * 
 * 3b 13 12 9 56 4e
 * 6 56 a a 5f f
 * 6 56 47 18 56 d
 * 13 46 14 1f 13 27
 * 52 52 a 5a 47 1
 * 1d 13 b 1b 49 17
 *
 */


#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;


#define endl '\n'


void solve(std::istream& in, std::ostream& out) {
    int a, b, c;
    in >> a >> b >> c;
    out << c << ' ' << a << ' ' << b << endl;
}


#include <fstream>
#include <iostream>


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


    istream& in = cin;


    ostream& out = cout;

    solve(in, out);
    return 0;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define fore(i,a,b) for(int i = a; i < b; i++)
#define fst first
#define snd second
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int>
#define piii pair<int, pii>
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define mp make_pair

using namespace std;

const int N_MAX = 3003;
const ll P = 998244353LL;
ll dp[N_MAX][N_MAX];

int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    fore(i,A,C+1){
        fore(j,B,D+1){
            if(i==A and j==B) dp[i][j]=1;
            else if(i==A) dp[i][j] = (1LL*i*dp[i][j-1])%P;
            else if(j==B) dp[i][j] = (1LL*j*dp[i-1][j])%P;
            else dp[i][j] = ((1LL*i*dp[i][j-1])%P + (1LL*j*dp[i-1][j])%P - (1LL*(i-1)*(j-1)*dp[i-1][j-1])%P + P)%P;
        }
    }
    cout<<dp[C][D]<<endl;
    return 0;
}

Measured memory_bytes: 73948
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>

using namespace std;

/*
真ん中の二つをa, b (a<=b)とする。
X_i <= aであれば中央値はb、
X_i >= bであれば中央値はaである。

*/
int N;
int A[200000];
int B[200000];
int a, b;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		B[i] = A[i];
	}
	sort(B, B + N);
	a = B[N / 2 - 1];
	b = B[N / 2];
	for (int i = 0; i < N; i++) {
		if (A[i] <= a) { printf("%d\n", b); }
		else { printf("%d\n", a); }
	}

}

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

using namespace std;

#define pb push_back
#define mp make_pair
constexpr int INF = 1 << 29;

typedef long long ll;
typedef unsigned long long ull;

constexpr int dx[4] = {1, 0, -1, 0};
constexpr int dy[4] = {0, 1, 0, -1};


ll mod = 998244353LL;

ll fact[300011];
ll fact_inv[300011];

ll pow_mod(ll x, ll n, ll mod) {
	ll ans = 1;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x % mod;
		}
		x = x * x % mod;
		n >>= 1;
	}
	return ans % mod;
}

ll f(ll N, ll x, ll y, ll z) {
	ll ret = fact[N] * fact_inv[x - z] % mod;
	ret *= fact_inv[z];
	ret %= mod;
	ret *= fact_inv[y - z];
	ret %= mod;
	ret *= fact_inv[N - (x + y - z)];
	ret %= mod;
	return ret;
}

void init() {
	fact[0] = fact_inv[0] = 1;

	for(ll i = 1; i <= 300010; i++) {
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = pow_mod(fact[i], mod - 2, mod) % mod; // フェルマーの小定理で逆元を求める
	}
}

ll comb(ll n, ll r) {
	return ((fact[n] * fact_inv[n - r] % mod) * fact_inv[r]) % mod;
}

ll inv(ll x) {
	return pow_mod(x, mod - 2, mod) % mod;
}


int main() {
	ll N, A, B, K;
	cin >> N >> A >> B >> K;

	init();

	ll ans = 0;
	for(ll x = 0; x <= N; x++) {
		if (K < A * x) continue;
		if ((K - A * x) % B != 0) continue;

		ll y = (K - A * x) / B;
		if (y > N) continue;
		ans += comb(N, x) * comb(N, y) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int i,j,a,b,c,ans=0;

int main(){
	while(scanf("%d %d",&a,&b)!=EOF){
		c=a+b;
		while(c!=0)c=c/10,ans++;
		printf("%d\n",ans);ans=0;
	}
	
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    int a, b;
    int sum = 0;

    cin >> n;
    for( int i = 0; i < n; i++)
    {
        scanf("%d%d", &a, &b);
        sum += b-a+1;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func removeElement(L []int, i int) []int {
	ans := make([]int, i)
	copy(ans, L[:i])
	ans = append(ans, L[i+1:]...)
	return ans
}

func permutation(L []int) (ans [][]int) {
	if N := len(L); N == 1 {
		ans = append(ans, L)
		return
	}

	for i, l := range L {
		for _, R := range permutation(removeElement(L, i)) {
			elm := []int{l}
			elm = append(elm, R...)
			ans = append(ans, elm)
		}
	}
	return
}

func intMin(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func main() {
	sc.Split(bufio.ScanWords)

	INF := int(math.Pow10(10))
	N, M, R := scanInt(), scanInt(), scanInt()

	r := make([]int, R)
	for i := 0; i < R; i++ {
		r[i] = scanInt() - 1
	}

	G := make([][]int, N)
	for i := 0; i < N; i++ {
		G[i] = make([]int, N)
		for j := 0; j < N; j++ {
			G[i][j] = INF
		}
		G[i][i] = 0
	}

	for i := 0; i < M; i++ {
		A, B, C := scanInt()-1, scanInt()-1, scanInt()
		G[A][B], G[B][A] = C, C
	}

	for k := 0; k < N; k++ {
		for i := 0; i < N; i++ {
			for j := 0; j < N; j++ {
				G[i][j] = intMin(G[i][j], G[i][k]+G[k][j])
			}
		}
	}

	ans := INF
	for _, order := range permutation(r) {
		tmp := 0
		for i := 0; i < R-1; i++ {
			tmp += G[order[i]][order[i+1]]
		}
		ans = intMin(ans, tmp)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 12304
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
int main(){
  int a,b;
  cin>>a>>b;
  if(b%a==0){
    cout<<a+b<<endl;
  }
  else{
    cout<<b-a<<endl;
  }
}

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

public class Main{
    public static void main(String args[]) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

	int n=Integer.parseInt(br.readLine());
	int a[]=new int[n];

	String str[]=br.readLine().split(" ");
	for(int i=0;i<n;i++){
	    a[i]=Integer.parseInt(str[i]);
	}

	int count=0;
	for(int i=0;i<n;i++){
	    for(int j=n-1;j>i;j--){
		if(a[j]<a[j-1]){
		    int temp=a[j];
		    a[j]=a[j-1];
		    a[j-1]=temp;
		    count++;
		}
	    }
	}

	System.out.print(a[0]);
	for(int i=1;i<n;i++){
	    System.out.print(" "+a[i]);
	}
	System.out.print("\n"+count+"\n");
    }
}



Measured memory_bytes: 24436
nk = [int(i) for i in input().split()]
n = nk[0]
k = nk[1]
s = input()
if s[k-1] == 'A' :
    print(s[:k-1] + 'a' + s[k:])
elif s[k-1] == 'B':
    print(s[:k-1] + 'b' + s[k:])
else:
    print(s[:k-1] + 'c' + s[k:])


Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>

int main() {
long x,y,cnt=0;
scanf("%ld %ld",&x,&y);
while(x--){
    long p,q;
    scanf("%ld %ld",&p,&q);
    double ans;
    ans=sqrt((p*p)+(q*q));
   // printf("%lf ",ans);
    if(ans<=y) cnt++;
}
printf("%ld",cnt);
    return 0;
}

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

typedef long long ll;

using namespace std;

string solve(int n) {
    
    n=n%10;
    
    if(n==3)
        return "bon";
    
    else if(n==0 || n==1 || n==6 || n==8)
        return "pon";
        
    return "hon";
}

int main() {
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    cout<<solve(n);
}


Measured memory_bytes: 3656
#include<stdio.h>
 int main(void)
 {
     int N,d[100];
     int i,j,k=0,l=0,tmp;

     scanf("%d",&N);

     for(i=0;i<N;i++)
       scanf("%d",&d[i]);

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(d[i]>d[j]){
           tmp=d[i];
           d[i]=d[j];
           d[j]=tmp;
         }
       }
     }

     for(i=0;i<N;i++)
       if(d[i]!=d[i+1]) k++;
       else l++;

     if(l==N) printf("1\n");
     else printf("%d\n",k);

     return 0;
 }


Measured memory_bytes: 128
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
      int count=0;
      List<string> s = ReadLine().ToList().ConvertAll(x=>x.ToString());
      for (int i=0;i<3;i++)
      {
        if (s[i]=="o")
        {
          count+=1;
        }
      }
      WriteLine(700+100*count);
    }
}

Measured memory_bytes: 26648
#include <stdio.h>

int main(void) {
    int k, ce, co;
    scanf("%d", &k);

    if (k % 2 == 0) {
        ce = k / 2;
        co = k / 2;
    } else {
        ce = (k - 1) / 2;
        co = (k + 1) /2;
    }

    int ans = ce * co;
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#include <cstring>

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

const int ms = 5050;
const int MOD = 1e9 + 7;

int par[ms];
bool good[ms];

int getPar(int x) { return par[x] < 0 ? x : par[x] = getPar(par[x]); }

void makeUnion(int a, int b) {
	a = getPar(a), b = getPar(b);
	if(a != b) {
		par[a] += par[b];
		par[b] = a;
	}
}

int n, m;
int a[ms];
long long fat[ms];
int memo[ms][ms];

int dp(int on, int got) {
	int &ans = memo[on][got];
	if(ans != -1) return ans;
	ans = 0;
	if(on == m) {
		if(got > 1) {
			ans = (int) fat[got-1];
		}
	} else {
		ans = (int) (((long long) dp(on+1, got+1) * a[on] + dp(on+1, got) * (n - 1LL)) % MOD);
	}
	return ans;
}

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	std::cin >> n;
	for(int i = 0; i < n; i++) {
		std::cin >> a[i];
		a[i]--;
		par[i] = -1;
	}
	for(int i = 0; i < n; i++) {
		if(a[i] >= 0) {
			makeUnion(i, a[i]);
		}
	}
	for(int i = 0; i < n; i++) {
		if(a[i] < 0) good[getPar(i)] = true;
	}
	int wtf = 0;
	for(int i = 0; i < n; i++) {
		if(getPar(i) == i && good[i]) {
			//std::cout << "at " << i << " got size " << -par[i] << '\n';
			a[m++] = -par[i];
		} else if(getPar(i) == i) {
			wtf++;
		}
	}
	fat[0] = 1;
	for(int i = 1; i <= n; i++) {
		fat[i] = fat[i-1] * i % MOD;
	}
	memset(memo, -1, sizeof memo);
	long long ans = 1;
	for(int i = 0; i < m; i++) {
		ans = ans * (n-1LL) % MOD;
	}
	//std::cout << "has " << ans << " choices, " << wtf << " wtf, " << dp(0, 0) << " ways of getting cycles\n";
	ans = (ans * (n - wtf) - dp(0, 0) + MOD) % MOD;
	long long haha = 1;
	for(int i = 1; i < m; i++) {
		haha = haha * (n-1LL) % MOD;
	}
	for(int i = 0; i < m; i++) {
		ans = (ans - haha * (a[i] - 1) % MOD + MOD) % MOD;
	}
	std::cout << ans << '\n';
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll N,K;
ll nmod[200010];
ll ans;
int main() {
    cin>>N>>K;
    REP(i,1,N+1){
        nmod[i%K]++;
    }
    ans+=pow(nmod[0],3);
    if(K%2==0) ans+=pow(nmod[K/2],3);

    p(ans);
    return 0;
}

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

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

    int r = 0;
    int b = 0;
    for(auto s_i:s) {
        if(s_i == 'R') {
            r++;
        } 
        if(s_i == 'B') {
            b++;
        }
    }

    if(r > b) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    vector<int> x(n), y(n), h(n);
    rep (i, n) {
      cin >> x[i] >> y[i] >> h[i];
    }
    int Max = 101;
    rep (posY, Max) {
      rep (posX, Max) {
        int height = -1;
        rep (i, n) {
          if (h[i] > 0) {
            int tmp = h[i] + abs(posX - x[i]) + abs(posY - y[i]);
            if (height == -1) {
              height = tmp;
            } else if (height != tmp) {
              height = -2;
            }
          }
          if (height == -2) break;
        }
        if (height == -2) continue;

        rep (i, n) {
          if (h[i] == 0) {
            int dist = abs(posX - x[i]) + abs(posY - y[i]);
            if (height > dist) {
              height = -2;
              break;
            }
          }
        }
        if (height == -2) continue;

        cout << posX << " " << posY << " " << height << endl;
        return 0;
      }
    }

    return 0;
}


Measured memory_bytes: 256
import sys
L,R=map(int,input().split())
ans=[]
if (R-L)>2019:
    print(0)
else:
    for m in range(L,R+1):
        for j in range(m+1,R+1):
            ans.append(m*j%2019)
            if m*j%2019==0:
              print(0)
              sys.exit()
    print(min(ans))

Measured memory_bytes: 6892
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    ll a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    int l = -1;
    int r = 1e9;
    int m;
    while(r - l > 1) {
        m = (l + r) / 2;
        ll cnt = 0;
        rep(i, n) {
            if (h[i] > b * m) {
                cnt += (h[i] - b * m + (a - b - 1) ) / (a - b);
//                cnt += (h[i] - b * m + - 1) / (a - b) + 1;
            }
        }
        if (cnt > m) {
            l = m;
        }
        else {
            r = m;
        }
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3992
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

#define N_MAX 100001

int main()
{
	int N; scanf("%d", &N);
	pair<int,int> A[N_MAX];
	for (int i = 0; i < N; i++){
		scanf("%d", &A[i].first);
		A[i].second = i;
	}

	sort(A, A + N);
	for (int i = 0; i < N;i++){
		printf("%d\n", A[i].second+1);
	}

	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <math.h>

int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  double degree, s, l ,h;
  degree = M_PI * c / 180;
  s = a * b * sin(degree) / 2;
  l = a + b + sqrt(a*a + b*b - 2*a*b*cos(degree));
  h = b * sin(degree);
  printf("%lf\n%lf\n%lf\n", s, l, h);

  return 0;
}

Measured memory_bytes: 636
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
board = [[0 for i in range(11)] for j in range(11)]

for l in range(0, len(N), 9):
    for i in range(l, l+8):
        for j in range(len(N[i])):
            board[i-l][j] = int(N[i][j])
    ans = "X"
    for i in range(8):
        for j in range(8):
            if board[i][j] == 1:
                if board[i+1][j] == 1 and board[i][j+1] == 1 and board[i+1][j+1] == 1:
                    ans = "A"
                elif board[i+1][j] == 1 and board[i+2][j] == 1:
                    ans = "B"
                elif board[i][j+1] == 1 and board[i][j+2] == 1:
                    ans = "C"
                elif board[i][j+1] == 1 and board[i+1][j+1] == 1:
                    ans = "E"
                elif board[i+1][j] == 1 and board[i+1][j+1] == 1:
                    ans = "F"
                elif board[i][j+1] == 1:
                    ans = "G"
                else:
                    ans = "D"
                break
        if ans != "X":
            break
    print(ans)


Measured memory_bytes: 5620
def len(a,b,h,m)
  s = (h * 30 + m * 0.5 - m * 6).abs
  s = 360 - s if s > 180
  rad = s * Math::PI * 2.0 / 360.0
  c = Math.sqrt(a ** 2 + b ** 2 - 2.0 * a * b * Math.cos(rad))
end

a, b, h, m = gets.split.map(&:to_f)
puts len(a,b,h,m)

Measured memory_bytes: 14696
package main

import "fmt"

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	if len(a) > len(b) {
		fmt.Println("GREATER")
	} else if len(a) < len(b) {
		fmt.Println("LESS")
	} else { // len(a) == len(b)
		for i := 0; i < len(a); i++ {
			if a[i] < b[i] {
				fmt.Println("LESS")
				return
			} else if a[i] > b[i] {
				fmt.Println(("GREATER"))
				return
			}
		}
		fmt.Println("EQUAL")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define mdsaqib std::ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define all(c) (c).begin(),(c).end()
#define endl '\n'
using namespace std;

signed main(){
    mdsaqib;
    int n;
    cin >> n;
    vector <int> A(n);
    for(int i=0;i<n;i++)cin >> A[i];
    sort(all(A));
    int ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            if(A[j]==A[i])continue;
            for(int k=j+1;k<n;k++){
                if(A[k]==A[j])continue;
                if(A[i]+A[j]>A[k])ans++;
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
char a[5];
int len;
int main(){
	scanf("%s",a+1);
	len=strlen(a+1);
	if (len==2) puts(a+1);else{
		for (int i=3;i>=1;i--) putchar(a[i]);
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;
#define MAX_R 10
#define MAX_C 10000

int senbei[MAX_R][MAX_C];

int main(){
	int R,C;
	cin >> R >> C;
	while(R){
		for(int i = 0; i < R; ++i){
			for(int j = 0; j < C; ++j){
				cin >> senbei[i][j];
			}
		}
		int max_kueru = 0;
		for(int i = 0; i < (1<<R); ++i){
			int retsu[MAX_C] = {0};
			int max_kueru_local = 0;
			for(int j = 0; j < C; ++j){
				for(int k = 0; k < R; ++k){
					if((senbei[k][j] == 0 && !(i&(1<<k)))||(senbei[k][j] == 1 && (i&(1<<k)))){
						++retsu[j];
					}
				}
				max_kueru_local += max(retsu[j], R-retsu[j]);
			}
			max_kueru = max(max_kueru, max_kueru_local);
		}
		cout << max_kueru << endl;
		cin >> R >> C;
	}
}

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

template < typename T >
string ch_base(T num, const int & base){
    stringstream ss;
    while(num){
        T rest = num % base;
        ss << rest;
        num /= base;
    }
    string s = ss.str();
    reverse(s.begin(), s.end());
    return s;
}

// ------------------------

void solve() {
    ll N; cin >> N;
    int K; cin >> K;

    string dig = ch_base(N, K);

    cout << dig.size()  << "\n";
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

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

// Problem https://atcoder.jp/contests/abc083/tasks/abc083_b

int sumDigit(int n){
    int sum;
    sum = 0;
    while(n > 0){
        int oneDigit;
        oneDigit = n % 10;
        sum = sum + oneDigit;
        n = n / 10;
    }
    return sum;
}

int solver(int gInt,int sumFr,int sumTo){
    int result=0;
    for(int j=1;j <= gInt;j++){
        int aNum = sumDigit(j);
        if(sumFr <= aNum and aNum <= sumTo){
            result = result + j;
         //   cout << j << " SumDigit :" << aNum << endl;
            }
        }
//    result = gInt;
    return result;
}

int main(void){
    int N,A,B;
    int answer;
    cin >> N >> A >> B;
    answer = solver(N,A,B);
    cout << answer << endl;
}

Measured memory_bytes: 256
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  a,b,c,x,y=pM(split(readline()))
  min(max(x,y)*2c,min(x,y)*min(a+b,2c)+(max(x,y)==x ? a : b)*(max(x,y)-min(x,y))) |> println
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

Measured memory_bytes: 167348
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cout << (#x) << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main()
{
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vi d(N);
    REP(i, N) cin >> d[i];
    sort(d.begin(), d.end());
    // REP(i, N) cerr << d[i] << " " ;
    // cerr << endl;
    int res = d[N / 2] - d[N / 2 - 1];
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
 
using namespace std;
 
signed main()
{
    fast;
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b(n);

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

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

    int sum = 0;
    for ( int i = 0 ; i < a.size() ; i++ )
    {
        if ( a[i]-b[i] > 0 )
        {
            sum += (a[i]-b[i]);
        }
    }

    cout<<sum<<endl;
    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define FORalld(it, a) for (__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
template<class T> inline T isqrt(T k) {T r = sqrt(k) + 1; while (r * r > k) r--; return r;}
template<class T> inline T icbrt(T k) {T r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}

const int maxn = 1e5 + 5;
int n;
int a[maxn];
long long sum[maxn];

void solve() {
    cin >> n;
    FOR(i, 0, n) cin >> a[i];
    sort(a, a + n);
    FOR(i, 0, n) {
        sum[i] = a[i];
        if (i) sum[i] += sum[i - 1];
    }
    FORd(i, n, 1) {
        if (sum[i - 1] + sum[i - 1] < a[i]) {
            cout << n - i << "\n";
            return;
        }
    }
    cout << n << "\n";
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif
    solve();
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(){
    
    int ap,bp,cp,t;
    char a[999],b[999],c[82];
    
    scanf("%d",&t);
    while (~scanf("%s %s",a,b)) {
        ap = strlen(a);
        bp = strlen(b);
        c[cp=(ap>80 || bp>80)? 0:81]='\0';
        t=0;
        while ((t||ap||bp) && cp>0) {
            t +=(ap? a[--ap]-'0':0) + (bp? b[--bp]-'0':0);
            c[--cp] = t%10 + '0';
            t /=10;
        }
        if(cp>0) printf("%s",&c[cp]);
        else printf("overflow");
        printf("\n");
    }
    
    return 0;
    
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  i64 k;
  cin >> n >> k;
  map<int, i64> mp;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  i64 cnt = 0;
  each(m, mp) {
    cnt += m.second;
    if (cnt >= k) {
      cout << m.first << endl;
      return;
    }
  }
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans=0;

  rep(i,N-2){
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C'){
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

vector<vector<int>> pl;
vector<int> conn;
int N, M;

void dfs(int p) {
	if (conn[p]) return;
	conn[p] = true;
	for (int i = 0; i < pl[p].size(); i++) {
		dfs(pl[p][i]);
	}
}

int main(void) {


	cin >> N >> M;

	pl.resize(N + M);
	conn.resize(N + M);
	for (int i = 0; i < N + M; i++) conn[i] = false;
	

	for (int i = 0; i < N; i++) {
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int l;
			cin >> l;
			l--;
			pl[i].push_back(N + l);
			pl[N + l].push_back(i);
		}
	}

	dfs(0);

	int i;

	for (i = 0; i < N; i++) if (!conn[i]) break;
	if (i >= N) cout << "YES" << endl;
	else cout << "NO" << endl;

	//system("pause");

	return 0;
}

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

int main()
{
	long long int n;
	cin >> n;
	int ans = 10000000;
	for(long long int i = 1; i * i <= n; ++i){
		if(n % i == 0){
			int d = 0;
			long long int t = n / i;;
			while(t > 0){
				t /= 10;
				++d;
			}
			ans = d;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# Problem B - Small and Large Integers

A, B, K = map(int, input().split())

# initialization

if B-A<=2*K:
    num_list = [i for i in range(A,B+1)]
    # output process 1
    for i in range(K):
        if len(num_list)<=0:
            break
        n = num_list[0]
        print(n)
        num_list.remove(n)

    # output process 2
    output_list = []
    for i in range(K):
        if len(num_list)<=0:
            break
        n = num_list[-1]
        output_list.append(n)
        num_list.remove(n)

    output_list = output_list[::-1]

    for o in output_list:
        print(o)
else:
    num_list_1 = [i for i in range(A, A+K+1)]
    num_list_2 = [i for i in range(B-K+1, B+1)]
    # output process 1
    for i in range(K):
        n = num_list_1[i]
        print(n)

    # output process 2
    for i in range(K):
        n = num_list_2[i]
        print(n)


Measured memory_bytes: 38384
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

ans = 0
for i in A:
    if sum(b * a for (b, a) in zip(B, i)) + C > 0:
        ans += 1
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 +c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M;
int a[MAXN];
void Solve() {
    read(N);read(M);
    for(int i = 1 ; i <= 2 * N ; ++i) read(a[i]);
    sort(a + 1,a + 2 * N + 1);
    int r = -1;
    for(int i = 2 * N ; i >= 1 ; --i) {
        int t = lower_bound(a + 1,a + 2 * N + 1,M - a[i]) - a;
        if((t & 1) == (i & 1)) ++t;
        if(r == -1) r = i + t;
        else r = max(r,i + t);
    }
    if(r == -1) r = 4 * N + 1;
    int ans = 0;
    for(int i = 2 * N ; i >= 1 ; --i) {
        if(r - i < i) ans = max(ans,(a[i] + a[r - i]) % M);
        else break;
    }
    r = 1 + r - 2 * N - 1;
    for(int i = 1 ; i <= 2 * N ; ++i) {
        if(i < r - i) ans = max(ans,a[i] + a[r - i]);
        else break;
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		if (s.equals("AAA") || s.equals("BBB")) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}


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

int main() {
  int n; cin >> n;
  vector<int> d(n); for(int i = 0; i < n; i++) cin >> d.at(i);
  
  sort(d.begin(), d.end());
  int m = 1;
  for(int i = 0; i < n-1; i++){
    if(d.at(i) - d.at(i+1) < 0) m++;
  }
  cout << m << endl;
}

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

int main() {
  double pi = 3.141592653589793;
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  int mm = h * 60 + m;
  double larg = 2 * pi * mm / 60.0;
  double sarg = larg / 12.0;

  double arg = larg - sarg;
  while (arg > pi) {
    arg -= pi * 2;
  }
  double cc = a * a + b * b - 2.0 * a * b * cos(arg);
  cout << fixed << setprecision(20) << sqrt(cc);
}

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

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

using namespace std;
typedef pair<int,int> P;
typedef long long int ll;


int main()
{
    char c;
    cin >> c;

    cout << char(c+1) << endl;

    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    cout << n * 2 - 1 << endl;
    int a[55];
    int largest = 0, num = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(abs(a[i]) > largest){
            largest = abs(a[i]);
            num = i;
        }
    }
    for(int i = 0; i < n; i++){
        cout << num + 1 << " " << i + 1 << endl;
    }
    if(a[num] < 0){
        for(int i = n - 1; i > 0; i--){
            cout << i + 1 << " " << i << endl;
        }
    }
    if(a[num] >= 0){
        for(int i = 0; i < n - 1; i++){
            cout << i + 1 << " " << i + 2 << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int d[MAXn];
int main(){
    IOS();
    int n;
    cin >> n;
    for (int i=0;i<n;++i) {
        cin >> d[i];
    }
    sort(d,d+n,greater<int>());
    int cur = 0;
    while (cur+1 < n && cur+1 < d[cur+1]) cur++;
    debug(cur);
    int r = cur;
    while (r < n && d[r] > cur) r++;
    if (((r-cur)&1) && ((d[cur]-cur)&1)) cout << "Second" << endl;
    else cout << "First" << endl;
}


Measured memory_bytes: 4032
#include<stdio.h>
int main(){
  int n,a[201],i,cnt=0,x=0;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&a[i]);
  }
  while(x==0){
    for(i=0; i<n; i++){
      if(a[i]%2==0){
        a[i]=a[i]/2;
      }
      else{
        x=1;
      }
    }
    cnt++;
  }
  printf("%d\n",cnt-1);
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(A: int, B: int, C: int):
    l = [A,B,C]
    l.sort()
    # print(l)
    if(l[2] == l[0] == l[1]):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10**5 + 1)

N, M = map(int, input().split())
nodes = [[] for _ in range(N)]

for _ in range(M):
  x, y = map(int, input().split())
  nodes[x-1].append(y-1)

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  else:
    edges = 0
    for i in nodes[index]:
      edges = max(edges, 1+judge(i))
    dp[index] = edges
    return edges

answer = 0  
for i in range(N):
  answer = max(answer, judge(i))
print(answer)

Measured memory_bytes: 63644
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
const int MOD = 1e9+7;
const int INF = 1e9;
const int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
#else
#define debug(...) 42
#endif


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

  vi X(N);
  rep(i, N)
    cin >> X[i];

  all(sort, X);

  int ans = 1e9;
  fromto(p, 1, 100) {
    int sum = 0;
    rep(i, N) {
      sum += (X[i] - p) * (X[i] - p);
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}


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

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

  if(N.at(0) == N.at(1) && N.at(1) == N.at(2) && N.at(0) == N.at(2)){
    cout << "No" << endl;
  }
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
long long a[5005];
int main()
{
    int n;
    long long k;
    cin>>n>>k;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    int ans=n;
    long long sum=0;
    for (int i=n;i>=1;--i)
    {
        if (sum+a[i]<k)
        {
            sum+=a[i];
        }
        else
        {
            ans=i-1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
LH=[]
ans=10000000000
for i in range(N):
    LH.append(int(input()))
LH.sort()
for i in range(N-K+1):
    num=LH[K-1+i]-LH[i]
    if ans>num:
        ans=num
print(ans)


Measured memory_bytes: 7384
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	n%=10;
	if(n==2||n==4||n==5||n==7||n==9)cout<<"hon\n";
	if(n==0||n==1||n==6||n==8)cout<<"pon\n";
	if(n==3)cout<<"bon\n";
	return 0;
}


Measured memory_bytes: 3692
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
using namespace std;


int main() {
    char a, b;
    cin >> a >> b;
    if (a == 'H') {
        if (b == 'H')cout << 'H' << endl;
        else cout << 'D' << endl;
    }
    else if(a=='D') {
        if (b == 'H' )cout<<'D'<< endl;
        else cout << 'H' << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
package main

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

// const abcd = "abcdefghijklmnopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

var inf int = 1e13
var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	k := next.Int()
	s := next.Int()
	ans := 0
	for x := 0; x <= k; x++ {
		for y := 0; y <= k; y++ {
			z := s - x - y
			if in(z, 0, k+1) {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

// ---------------------------------------------------------

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a []int) int {
	r := 0
	for i := 0; i < len(a); i++ {
		r += a[i]
	}
	return r
}

func pow(a []int) int {
	r := 1
	for i := 0; i < len(a); i++ {
		r *= a[i]
	}
	return r
}

func fill(a []int, n int) []int {
	for i := 0; i < len(a); i++ {
		a[i] = n
	}
	return a
}

func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) String() string {
	return s.next()
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Ints(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = s.Int()
	}
	return r
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640