akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int x, n;
    cin >> x >> n;
    set <int> used;
    forn (i, 0, n) {
        int t;
        cin >> t;
        used.insert(t);
    }
    int ans = 1e9, ans_i = 1e9;
    forn (i, -100, 110) {
        if (used.find(i) != used.end())
            continue;
        if (abs(x - i) < ans || abs(x - i) == ans && i < ans_i) {
            ans = abs(x - i);
            ans_i = i;
        }
    }
    cout << ans_i;
    return 0;
}

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

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    vector<int> H(N);
    for(auto i=0;i<N;i++)
        cin >> H.at(i);

    int count = 1;

    for(auto i=1;i<N;i++){
        int tmp=0;
        for(auto j=0;j<i;j++){
            if(H.at(j)<=H.at(i))
                tmp++;
            else
                break;
        }
        if(tmp==i)
            count++;
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    static final Scanner sc = new Scanner(System.in);
    
    public static void main(String[] args) {
        String in = nstr();
        
        char[] a = in.toCharArray();
        int ans = 0;
        int l = 0;
        int r = in.length()-1;
        while (r >= l) {
            if (a[r] == a[l]) {
                r--;
                l++;
            } else {
                if (a[r] == 'x') {
                    ans++;
                    r--;
                } else if (a[l] == 'x') {
                    ans++;
                    l++;
                } else {
                    System.out.println(-1);
                    return;
                }
            }
        }
        
        System.out.println(ans);
    }
    
    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++) {
            a[i] = nstr();
        }
        return a;
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0);
    }

    private static char[][] nchars2(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}

Measured memory_bytes: 25928
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    double r = v[0];
    for (int i = 0; i < n; i++) {
        r = (r + v[i]) * 0.5;
    }

    printf("%.8f\n", r);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s;
	int n, AC = 0, WA = 0, TLE = 0, RE = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (s == "AC")
			AC++;
		else if (s == "WA")
			WA++;
		else if (s == "TLE")
			TLE++;
		else
			RE++;
	}
	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;
	return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;

    double ans = 0;

    int atmp[100] = {};
    double atmp2[100] = {};
    for(int i = 1;i <= n;i++){
        double tmp = 1;
        int toku = i;
        while(toku < k){
            toku *= 2;
            tmp *= 0.5;
        }
        ans += tmp / n;
    }

    printf("%.12lf\n", ans);

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		Integer[] x = new Integer[200010];
		Arrays.fill(x, 0);
		for(int i = 0 ; i < n ; i++) {
			x[a[i] - 1]++;
		}
		Arrays.sort(x, new Comparator<Integer>() {
			public int compare(Integer p1, Integer p2) {
				return p1 - p2;
			}
		});
		int ans = 0;
		for(int i = 0 ; i <= 200010 - k - 1 ; i++) {
			ans += x[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 65680
#include <iostream>

int main() {
    int k, x;
    std::cin >> k >> x;

    for (int i = x - k + 1; i < x + k; i++) {
        if (i > x - k + 1) {
            std::cout << " ";
        }
        std::cout << i;
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;

static const int BOTTOM = 0;
static const int LEFT = 1;
static const int RIGHT = 2;
static const int TOP = 3;

struct Point{
    double x;
    double y;
};

struct Segment{
    Point p1;
    Point p2;
};

class EndPoint{
public:
    Point p;
    int segId;
    int state;
    EndPoint(){};
    EndPoint(Point p,int segId,int state):p(p),segId(segId),state(state){}
    
    bool operator < (const EndPoint &ep) const {
        if(p.y == ep.p.y){
            // yが同じなら下端、左端、上端、右端で調べる
            return state < ep.state;
        }else{
            return p.y < ep.p.y;
        }
    }
};

EndPoint EP[2 * 100000];

int manhattanInterSection(vector<Segment>s){
    int n = s.size();
    
    for(int i = 0,k = 0;i < n;++i){
        // 端点p1,p2が左下に並ぶようにする
        if(s[i].p1.y == s[i].p2.y){
            if(s[i].p1.x > s[i].p2.x){
                swap(s[i].p1,s[i].p2);
            }
        }else if(s[i].p1.y > s[i].p2.y){
            swap(s[i].p1,s[i].p2);
        }
        
        if(s[i].p1.y == s[i].p2.y){
            // 水平成分を端点へ追加する
            EP[k++] = EndPoint(s[i].p1,i,LEFT);
            EP[k++] = EndPoint(s[i].p2,i,RIGHT);
        }
        else{
            // 垂直成分を端点へ追加する
            EP[k++] = EndPoint(s[i].p1,i,BOTTOM);
            EP[k++] = EndPoint(s[i].p2,i,TOP);
        }
    }
    
    // 端点のy座標に関して昇順に並び替える
    sort(EP,EP + (n * 2));
    
    set<int> BT;
    // 番兵
    BT.insert(__INT_MAX__);
    int cnt = 0;
    
    for(int i = 0;i < 2 * n;++i){
        if(EP[i].state == TOP){
            // 上端点を削除
            BT.erase(EP[i].p.x);
        } else if(EP[i].state == BOTTOM){
            // 下端点を追加
            BT.insert(EP[i].p.x);
        }else if(EP[i].state == LEFT){
            set<int>::iterator b = lower_bound(BT.begin(), BT.end(), s[EP[i].segId].p1.x);
            set<int>::iterator e = upper_bound(BT.begin(), BT.end(), s[EP[i].segId].p2.x);
            cnt += distance(b, e);
        }
    }
    return cnt;
}

int main(){
    int n;
    scanf("%d", &n);
    vector<Segment> s(n);
    for (int i = 0; i < n; ++i){
        scanf("%lf %lf %lf %lf", &s[i].p1.x,&s[i].p1.y,&s[i].p2.x, &s[i].p2.y);
    }
    int crossPointNum = manhattanInterSection(s);
    printf("%d\n", crossPointNum);
}



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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1)/x*t << endl;
    return 0;
    
}


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

#define    ll     long long int

int main( )
{
    int n, m;
    map<string, int> mp1, mp2;
    int i, j, k, l;
    string s;
    vector<string> v;
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> s;
        v.push_back(s);
        mp1[s]++;
    }
    cin >> m;
    for (i = 0; i < m; i++) {
        cin >> s;
        mp2[s]++;
    }
    int mx = 0;
    for (i = 0; i < n; i++) {
        int x = mp1[v[i]];
        int y = mp2[v[i]];
        mx = max(mx, x - y);
    }
    cout << mx << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class D {
    public static enum Color {
        RR, BB, GG, RB, BG, GR, BR, RG, GB, None
    }

    public static final long MOD = 1000000007;

    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final char[] S1 = sc.next().toCharArray();
        final char[] S2 = sc.next().toCharArray();
        final int C = Color.values().length;
        final long[][] dp = new long[N + 1][C];
        dp[0][Color.None.ordinal()] = 1;
        for (int i = 0; i < N; )
            if (S1[i] == S2[i]) {
                dp[i + 1][Color.RR.ordinal()] =
                        dp[i][Color.BB.ordinal()] + dp[i][Color.GG.ordinal()]
                                + dp[i][Color.BG.ordinal()] + dp[i][Color.GB.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 1][Color.BB.ordinal()] =
                        dp[i][Color.GG.ordinal()] + dp[i][Color.RR.ordinal()]
                                + dp[i][Color.GR.ordinal()] + dp[i][Color.RG.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 1][Color.GG.ordinal()] =
                        dp[i][Color.RR.ordinal()] + dp[i][Color.BB.ordinal()]
                                + dp[i][Color.RB.ordinal()] + dp[i][Color.BR.ordinal()] + dp[i][Color.None.ordinal()];
                i++;
            } else {
                dp[i + 2][Color.RB.ordinal()] =
                        dp[i][Color.BR.ordinal()] + dp[i][Color.GR.ordinal()] + dp[i][Color.BG.ordinal()]
                                + dp[i][Color.GG.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 2][Color.BG.ordinal()] =
                        dp[i][Color.GB.ordinal()] + dp[i][Color.BR.ordinal()] + dp[i][Color.GB.ordinal()]
                                + dp[i][Color.RR.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 2][Color.GR.ordinal()] =
                        dp[i][Color.RG.ordinal()] + dp[i][Color.RB.ordinal()] + dp[i][Color.BG.ordinal()]
                                + dp[i][Color.BB.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 2][Color.BR.ordinal()] =
                        dp[i][Color.RB.ordinal()] + dp[i][Color.RG.ordinal()] + dp[i][Color.GB.ordinal()]
                                + dp[i][Color.GG.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 2][Color.RG.ordinal()] =
                        dp[i][Color.GR.ordinal()] + dp[i][Color.GB.ordinal()] + dp[i][Color.BR.ordinal()]
                                + dp[i][Color.BB.ordinal()] + dp[i][Color.None.ordinal()];
                dp[i + 2][Color.GB.ordinal()] =
                        dp[i][Color.BG.ordinal()] + dp[i][Color.BR.ordinal()] + dp[i][Color.RG.ordinal()]
                                + dp[i][Color.RR.ordinal()] + dp[i][Color.None.ordinal()];
                i += 2;
            }
        long ans = 0;
        for (final long i : dp[N])
            ans = (ans + i) % MOD;
        System.out.println(ans);
    }
}
public class Main {
    public static void main(String... args) {
        D.main(args);
    }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
#define int long long
#define mod 1e18+10
#define mx 1000002
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
vector<pair<int,int>> v;
int f(pair<int,int> a,pair<int,int> b)
{
	return a.first>b.first;
}
int32_t main() {
	int x,y,a,b,c,val,i;
	cin>>x>>y>>a>>b>>c;
	for(i=0;i<a;i++)
	{
		cin>>val;
		v.push_back({val,0});
	}
	for(i=0;i<b;i++)
	{
		cin>>val;
		v.push_back({val,1});
	}
	for(i=0;i<c;i++)
	{
		cin>>val;
		v.push_back({val,2});
	}
	sort(v.begin(),v.end(),f);
	int cnt=0,ans=0;
	for(i=0;i<v.size();i++)
	{
		if(x+y-cnt<=0)
			break;
		val=v[i].first;
		int type=v[i].second;
		if(type==0)
		{
			if(x)
			{
				x--;
				ans+=val;
			}	
		}
		else if(type==1)
		{
			if(y)
			{
				y--;
				ans+=val;
			}	
		}
		else
		{
			ans+=val;
			cnt++;
		}
		
	}
	cout<<ans<<"\n";
}	

Measured memory_bytes: 10476
import math

(x1, y1, x2, y2) = [float(i) for i in input().split()]
#distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
distance = math.hypot((x2 - x1), (y2 - y1))
print('{0:.5f}'.format(distance))

Measured memory_bytes: 6820
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[allow(dead_code)]
const MOD: u64 = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        fomula: [String; 3]
    }
    let A: i64 = fomula[0].parse().unwrap();
    let B: i64 = fomula[2].parse().unwrap();
    if fomula[1].chars().nth(0).unwrap() == '+' {
        println!("{}", A + B);
    } else {
        println!("{}", A - B);
    }

}

Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

		int n[] = new int[4];

		for (int i = 0; i < 3; i++) {
			String str[] = br.readLine().split(" ");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			n[a]++;
			n[b]++;
		}

		boolean flag = false;
		for (int i = 0; i < 4; i++) {
			if (n[i] == 3)
				flag = true;
		}

		if (flag)
			System.out.println("NO");
		else
			System.out.println("YES");
	}
}

Measured memory_bytes: 21204
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    T = LI()
    A = LI()
    B = LI()

    p1 = (A[0] - B[0]) * T[0]
    p2 = p1 + (A[1] - B[1]) * T[1]
    if p1 * p2 > 0:
        print(0)
        return
    elif p2 == 0:
        print('infinity')
        return

    ans = 1
    p2 = abs(p2)
    p1 = abs(p1)
    if p1 % p2 == 0:
        ans -= 1
    ans += (p1 // p2) * 2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38508
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
ll x[900000], v[900000];
ll m1[900000], m2[900000];
pii v1[900000], v2[900000], back1[900000], back2[900000];
int main(){
    ll n, c; scanf("%lld%lld", &n, &c);
    for(int i = 1; i <= n; i++)
        scanf("%lld%lld", &x[i], &v[i]);
    for(int i = 1; i <= n; i++){
        v1[i].first = v1[i-1].first - x[i]+x[i-1] + v[i];
        v1[i].second = v1[i].first - x[i];
        //cout << v1[i].first <<" "<< v1[i].second << endl;
    }
    x[n+1]=c;
    //puts("aaaaaaaa");
    for(int i = n; i>=1; i--){
        v2[i].first = v[i] + v2[i+1].first - x[i+1]+x[i];
        v2[i].second = v2[i].first - c + x[i];
        //cout << v2[i].first <<" "<< v2[i].second << endl;
    }

    //puts("bbbbbbbb");

    for(int j = n+1; j >= 0; j--){
        m1[j] = max(m1[j+1], v2[j].first);
        m2[j] = max(m2[j+1], v2[j].second);
    }

    ll ans = 0;
    for(int i = 0; i <= n; i++){
        //for(int j = i+1; j <= n+1; j++){
            /*printf("%d %d\n", v1[i].first, v2[j].first);
            printf("%lld %lld\n",v1[i].second+v2[j].first, v1[i].first+v2[j].second);
            */
        ans = max(ans, max(v1[i].second+m1[i+1], v1[i].first+m2[i+1]));
        //}
    }
    printf("%lld\n", ans);
}


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

int main(){
  int H, A;
  cin >> H >> A;
  if (H % A == 0)
    cout << H / A << endl;
  else
    cout << H / A + 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

//-------------------------------------------------------------------
#define P 1000000007
#define N_MAX 2000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll n, m, k, ans = 0;std::cin >> n >> m >> k;
  init();
  ll t = comb(n*m-2, k-2); //point a, bが選ばれる選び方はn*m-2 C k-2
  for(ll i=0;i<n;i++){
    for(ll j=0;j<m;j++){
      ll left = (((i*(i+1))/2)%P + (((n-1-i)*(n-i))/2)%P)%P;
      ll up = (((j*(j+1))/2)%P + (((m-j-1)*(m-j))/2)%P)%P;
      ll tmp = (pp(up, n) + pp(left, m))%P;
      ans = (ans+pp(t, tmp))%P;
    }
  }
  std::cout << pp(ans, inv[2]) << '\n';
  return 0;
}


Measured memory_bytes: 47232
object Main extends App {
	val N = scala.io.StdIn.readInt

	var sum = 0.0

	for(i<-0 until N){
		val Array(a, b) = scala.io.StdIn.readLine.split(" ")
		b match {
			case "JPY" => sum += a.toDouble
			case "BTC" => sum += a.toDouble * 380000.0
		}
	}

	println(sum)

}

Measured memory_bytes: 25664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n;
    cin >> n;

    ll t = 1;
    string ans = "";
    for(int i = 1; i < 100; i++){
        t *= 26;
        if(n <= t){
            n--;
            for(int j = 0; j < i; j++){
                ans += 'a'+n%26;
                n /= 26;
            }
            break;
        }else{
            n -= t;
        }
    }

    reverse(all(ans));
    cout << ans << endl;

    return 0;

}


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

int main()
{
    int n;
    cin >> n;
    int m = n;
    int v[5];
    for (int i = 5; i> 0; i--){
        v[i - 1] = m / pow(10, (i - 1));
        m %= int(pow(10, (i - 1)));
    }
    int s = v[0] + v[1] + v[2] + v[3] + v[4];
    if (s == 1)
    {
        cout << 10 << endl;
    } else {
        cout << s << endl;
    }
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	int a,b,x;
	scanf("%d",&a);
    scanf("%d",&b);
	scanf("%d",&x);
	   if(a+b<x){
	   	 printf("NO");
	   }else if(x<a){
	   		printf("NO");
	   }else{
	   	 printf("YES");
	   }
	   	 
	   
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

  double ans = 0;

  for (int i = 1; i <= N; ++i) {
    double tmp = 1.0 / N;
    int now = i;

    while(now < K) {
      now *= 2;
      tmp /= 2;
    }

    ans += tmp;
  }

  printf("%.12f\n", ans);
}

Measured memory_bytes: 256
#include <cstdio>

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

void insert_sort(int A[],int max){
    for(int i = max; i >= 1; i--){
        if(A[i]<A[i-1]){
            int t = A[i];
            A[i] = A[i-1];
            A[i-1] = t;
        } else {
            break;
        }
    }
}

int main(){
    int A[100], n;
    
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }
    
    for(int i = 0; i < n; i++){
        insert_sort(A, i);
        print(A, n);
    }
    
    return 0;
}



Measured memory_bytes: 2724
#include<bits/stdc++.h>
#include<cstring>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int           long long
#define umapii        unordered_map<int,int>
#define ps(x,y)       fixed<<setprecision(y)<<x // sets precision upto required digits
#define arr(a,n)      int n;cin>>n;int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define outarr(a,n)   for(int i=0;i<n;i++){cout<<a[i]<<" ";}
#define mod           1000000007
#define ff            first
#define big           1e15
#define ss            second
#define add           push_back
#define remove        pop_back
#define mapii         map<int,int>
#define large         *max_element
#define small         *min_element
#define pqi           priority_queue<int>
#define mpqi          priority_queue<int,vector<int>,greater<int>>
#define in(n)         int n;cin>>n;
#define w(t)          int t;cin>>t;while(t--)
#define vi            vector<int>
#define vivi          vector<vector<int>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>pbds;



int32_t main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output3.txt", "w", stdout);
#endif

    in(a); in(b); in(h); in(m);
    double val = abs(0.5 * ((60 * h) - (11 * m)) * 3.141592653589793238 / 180 );
    cout <<  ps(sqrt(a * a + b * b - 2 * a * b * cos(val)), 9) << endl;
}


Measured memory_bytes: 4196
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}


//#########################################

int main() {
string a;

cin>>a;
if(a[0]=='9'||a[1]=='9'){
cout<<"Yes";
}
else {
cout<<"No";
}



}


Measured memory_bytes: 256
#include<algorithm>
#include<vector>
template<typename T, T INF>
class SegmentTree {
 public:
  SegmentTree(int n) : size_(1) {
    while(size_ < n) size_ <<= 1;
    node_.assign(size_ << 1, 0);
    lazy_.assign(size_ << 1, 0);
  }
  T find(int left, int right) {return find(left, right + 1, 1, 0, size_);}
  void add(int left, int right, T value) {add(left, right + 1, value, 1, 0, size_);}
 private:
  inline int left_child(int node) const {return node << 1;}
  inline int right_child(int node) const {return (node << 1) + 1;}
  inline T merge(T vl, T vr) const {return std::max(vl, vr);}
  inline void propagate(int k) {
    if(k < size_) {
      lazy_.at(left_child(k)) += lazy_.at(k);
      lazy_.at(right_child(k)) += lazy_.at(k);
    }
    node_.at(k) += lazy_.at(k);
    lazy_.at(k) = 0;
  }
  T find(int a, int b, int k, int l, int r) {
    propagate(k);
    if(b <= l || r <= a) return -INF;
    if(a <= l && r <= b) return node_.at(k) + lazy_.at(k);
    auto vl = find(a, b, left_child(k), l, (l + r) / 2);
    auto vr = find(a, b, right_child(k), (l + r) / 2, r);
    return merge(vl, vr);
  }
  T add(int a, int b, T value, int k, int l, int r) {
    propagate(k);
    if(b <= l || r <= a) return node_.at(k);
    if(a <= l && r <= b) return node_.at(k) + (lazy_.at(k) += value);
    auto vl = add(a, b, value, left_child(k), l, (l + r) / 2);
    auto vr = add(a, b, value, right_child(k), (l + r) / 2, r);
    return node_.at(k) = merge(vl, vr);
  }
  int size_;
  std::vector<T> node_;
  std::vector<T> lazy_;
};

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

int main() {
  const int INF = 2e5;

  int W, H, N;
  cin >> W >> H >> N;

  SegmentTree<int, INF> T(INF);
  for(auto i = 0; i < N; ++i) {
    int x, y;
    cin >> x >> y;
    if(T.find(x, x) < y) T.add(x, x, y - T.find(x, x));
  }

  int res = INF;

  for(auto x = 0; x < INF; ++x) {
    res = min(res, x + T.find(x + 1, INF));
  }

  cout << res << endl;
}

Measured memory_bytes: 7072
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll x;

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	REP(i, 1, 5){
		x = read();
		if (x == 0){
			printf("%lld\n", i);
			exit(0);
		}
	}
}

int main(){
	work();
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int cnt = 0, a = 0, b = 0, ba = 0;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    for (int j = 0; j + 1 < S.size(); j++) {
      if (S.at(j) == 'A' && S.at(j + 1) == 'B') cnt++;
    }
    if (S.front() == 'B' && S.back() == 'A') ba++;
    else if (S.front() == 'B') b++;
    else if (S.back() == 'A') a++;
  }
  
  if (a == 0 && b == 0) cnt += max(0, ba - 1);
  else cnt += ba + min(a, b);
  cout << cnt << "\n";
}

Measured memory_bytes: 256
<?php

$input = trim(fgets(STDIN));
$numbers = explode(" ", $input);

$dice = new Dice($numbers);

$n = trim(fgets(STDIN));
do {
  $input = trim(fgets(STDIN));
  List($t, $f) = explode(" ", $input);

  $td = $dice->getDirection($t);
  switch ($td) {
  case "B": $dice->roll("NN"); break;
  case "S": $dice->roll("N");  break;
  case "E": $dice->roll("W");  break;
  case "N": $dice->roll("S");  break;
  case "W": $dice->roll("E");  break;
  }

  $fd = $dice->getDirection($f);
  switch ($fd) {
  case "S": $dir = "E"; break;
  case "E": $dir = "N"; break;
  case "N": $dir = "W"; break;
  case "W": $dir = "S"; break;
  }
  $answer = $dice->getNumber($dir);

  echo $answer . PHP_EOL;

  $n--;
} while ($n > 0);

//========================================

class Dice
{
  private $numbers;
  private $IDX_ROLL = array(
    array(4, 0, 2, 3, 5, 1),  // -> S
    array(3, 1, 0, 5, 4, 2),  // -> E
    array(2, 1, 5, 0, 4, 3),  // -> W
    array(1, 5, 2, 3, 0, 4)   // -> N
  );

  public function __construct($numbers)
  {
    $this->numbers = $numbers;
  }

  public function roll($dirs)
  {
    foreach (str_split($dirs) as $dir) {
      $idx = strpos("SEWN", $dir);
      if ($idx === false) {
        continue;
      }

      $old = $this->numbers;
      for ($i = 0; $i < 6; $i++) {
        $this->numbers[$i] = $old[$this->IDX_ROLL[$idx][$i]];
      }
    }
  }

  public function getNumber($dir) {
    $idx = strpos("TSEWNB", $dir);
    if ($idx !== false) {
      return $this->numbers[$idx];
    }
    return false;
  }

  public function getDirection($number) {
    $idx = array_search($number, $this->numbers);
    if ($idx !== false) {
      return substr("TSEWNB", $idx, 1);
    }
    return false;
  }
}

Measured memory_bytes: 15584
import java.util.*;

public class Main {
  	static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {
      	int a = scanner.nextInt();
      	int b = scanner.nextInt();
    	System.out.println(a + b == 15 ? "+" : a * b == 15 ? "*" : "x");
    }
}

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

int main(){
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  vector<int> time = {A, B, C, D, E};
  vector<int> amari = {A % 10, B % 10, C % 10, D % 10, E % 10};
  
  int total = 0;
  for (int i : time) {
    if(i % 10 == 0) {
      total += i;
    }
    else {
      total += (i / 10 + 1) * 10;
    }
  }
  
  sort(amari.begin(), amari.end());
  int last;
  for (int i = 0; i < 5; i++) {
    if (amari.at(i) != 0) {
      last = amari.at(i);
      break;
    }
    if (i == 4) {
      last = 10;
    }
  }
  cout << total - 10 + last << endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> card(n);
    for(int i = 0; i < n; i++) {
        cin >> card.at(i);
    }
    // sort
    sort(card.begin(), card.end(), greater<int>() );

    int alice = 0, bob = 0;

    for(int i = 0; i < n; i++) {
        if(i % 2 == 0){
            alice += card.at(i);
        }else{
            bob += card.at(i);
        }

    }

    cout << alice - bob << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int N, P[10], Q[10];
int count(int* X) {
  int v[10];
  for(int i = 1; i <= N; ++i) v[i] = i;
  int cnt = 0; bool ok;
  do {
    ok = true; ++cnt;
    for(int i = 1; ok && i <= N; ++i) {
        if(X[i] != v[i]) ok = false;
    }
  } while(!ok && next_permutation(v+1, v+N+1));
  return cnt;
}
int main() {
  scanf("%d", &N);
  for(int i = 1; i <= N; ++i) scanf("%d", &P[i]);
  for(int i = 1; i <= N; ++i) scanf("%d", &Q[i]);
  int a = count(P), b = count(Q);
  printf("%d\n", (int) abs(a-b));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

int main() {
  ll n;
  cin >> n;
  n--;
  int i = 0;
  vector<char> s(30, ' ');

  while (true) {
    int c = n % 26;
    s[i] = 'a' + c;
    n = n / 26 - 1;
    i++;
    if (n == -1) break;
  }

  rep(j, i+1) {
    if (s[i-j] != ' ') 
    cout << s[i-j];
  }
  cout << endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
          cin >> a[i];
    }
    int ans = 0;
    for(int i = 0;i < n;i++){
          if(i % 2 == 0 && a[i] % 2 == 1){
                ans++;
          }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	int a=0,b=0,c=0,d=0;
	while(n--){
		cin>>s;
		if(s=="AC") a++;
		else if(s=="WA") b++;
		else if(s=="TLE") c++;
		else d++;
	}
	cout<<"AC x "<<a<<endl;
	cout<<"WA x "<<b<<endl;
	cout<<"TLE x "<<c<<endl;
	cout<<"RE x "<<d;
	return 0;
}


Measured memory_bytes: 3628
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {


        var r = Console.ReadLine().Split(' ').Select(x =>int.Parse(x)).ToArray();
        var N = r[0];
        var D = r[1];
        var ans = 0;

        for(int i = 1; i <= 10; i ++)
        {
            int a = ((2 * D) + 1) * i;
            if (a >= N)
            {
                ans = i;
                break;
            }
        }

        Console.WriteLine(ans);

    }
}

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

int main(void){
    // Your code here!
    int n;
    cin >> n;
    int d[n][2];
    for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
            cin >> d[i][j];
        }
    }
    
    int flag=0;
    
    for(int i=0;i<n;i++){
        if(d[i][0] == d[i][1]){
            flag++;
            if(flag >= 3){
                break;
            }
        }else{
            flag = 0;
        }
    }
    
    if(flag >= 3){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    
    
    
}

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

int main() {
	int a, b, c, X;
	int sum = 0;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> X;
	for (int i = 0;i <= a;i++)
		for (int j = 0;j <= b;j++)
			for (int k = 0;k <= c;k++)
				if (X == (500 * i + 100 * j + 50 * k))
					sum += 1;
	cout << sum << '\n';
	return 0;

}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int,input().split()))
    # 左から貪欲に1,2,3..ととっていけば良い
    next = 1
    for a in A:
        if a==next:
            next += 1
    if next==1:
        print(-1)
    else:
        print(N-(next-1))

main()


Measured memory_bytes: 24744
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [None]*n
for i in range(n):
    a[i] = input()
s = set(a)
print(len(s))

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

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

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

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

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

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

void Main()
{
    LL a,b,c,d;cin>>a>>b>>c>>d;
    LL result = -INF_LL;

    result = max(result,a*c);
    result = max(result,a*d);
    result = max(result,b*c);
    result = max(result,b*d);
    if((a<=0 && b>=0) || (c<=0 && d>=0)){
        result = max(result,0ll);
    }
    cout<<result<<endl;
    
    
	return;
}

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

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  int ans = 1e9;
  for (char i = 'a'; i <= 'z'; i++)
  {
    string tmp[2] = {s, ""};
    int cnt = 0;
    while (true)
    {
      int size = tmp[0].size();
      bool ok = true;
      for (int j = 0; j < size; j++)
        if (tmp[0][j] != i)
          ok = false;
      if (ok)
        break;
      tmp[1] = "";
      for (int j = 0; j < size - 1; j++)
        if (tmp[0][j] == i || tmp[0][j + 1] == i)
          tmp[1] += i;
        else
          tmp[1] += tmp[0][j];
      tmp[0] = tmp[1];
      cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;

  return 0;
}


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

int main(void){
    string o, e;
    cin >> o >> e;
    
    for(int i = 0; i < o.length(); i++){
        if(i == o.length() - 1 && e.length() != o.length()){
            cout << o[i];
        }else{
            cout << o[i] << e[i];
        }
    }
    
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main{
        private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        public static void main(String[] args) throws IOException{
                int n = Integer.parseInt(br.readLine());
                int[] A = new int[n];
                int max = 0;
                int dis = 0;
                for(int i=0; i<n; i++)
                        A[i] = Integer.parseInt(br.readLine());
                dis = A[n-1]-A[n-2];
                for(int i=n-1; i>0; i--){
                        if(A[i] > max){
                                max = A[i];
                                for(int j=i-1; j>=0; j--){
                                        int t = A[i]-A[j];
                                        if(t>dis)
                                                dis = t;
                                }
                        }
                }
                System.out.println(dis);
        }
}

Measured memory_bytes: 42784
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long

using namespace std;

bitset<4000001> f;
int a[2005],n,sum;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar();
  return q*x;
}

int main(){
  n=gi(); if (n==1) cout<<gi(),exit(0); f.set(0);
  for (RG int i=1,x;i<=n;++i) x=gi(),sum+=x,f|=f<<x;
  for (RG int i=(sum+1)>>1;i<=sum;++i)
    if (f.test(i)) printf("%d\n",i),exit(0);
  return 0;
}


Measured memory_bytes: 1664
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    int a, b, c;

    AtCoder(FastScanner sc) {
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
    }

    void solve(PrintWriter out) {
        int max = Math.max(Math.max(a, b), c);
        out.println(max * 2 == a + b + c ? "Yes" : "No");
    }

}

class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int a(int x, vector<int> y) {
  for (int i = 0; i < 100; i++) {
    int memo = 0;
    for (int j = 0; j < y.size(); j++) {
      if (x + i != y.at(j)) {
        memo++;
      }
    }
    if (memo == y.size()) {
      return x + i;
      break;
    }
  }
}
int b(int x, vector<int> y) {
  for (int i = 0; i < 100; i++) {
    int memo = 0;
    for (int j = 0; j < y.size(); j++) {
      if (x - i != y.at(j)) {
        memo++;
      }
    }
    if (memo == y.size()) {
      return x - i;
      break;
    }
  }
}
        

 
int main() {
  int X, N;
  cin >> X >> N;
  vector<int> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  int A = a(X, S);
  int B = b(X, S);
  if (A - X < X -B) {
    cout << A << endl;
  }
  else {
    cout << B << endl; 
  }
}


Measured memory_bytes: 3628
N = int(input())

T = []
for i in range(N):
    S, P = input().split()
    T.append([S, int(P), i + 1])

T.sort(key=lambda x: x[1], reverse=True)
T.sort(key=lambda x: x[0])

for i in T:
    print(i[2])

Measured memory_bytes: 9104
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        String n = scan.nextLine();
        int sum = 0;
        for(int i=0; i<n.length(); i++){
            sum += Integer.parseInt(n.substring(i, i+1));
        }
        String res = "No";
        if(Integer.parseInt(n) % sum == 0) res = "Yes";
        
        scan.close();
        System.out.println(res);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 998244353
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 1000000000000000000
#define vll vector<ll>
using namespace std;
const int N=1000005;

void solve()
{
	ll n,i,ans=0,m,mp1,j;
	cin>>n;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			mp1=n/i;
			m=mp1-1;
			if(i<m)
				ans+=m;

			if(i*i<=n) 
			{
				j=n/i;
				mp1=n/j;
				m=mp1-1;
				if(j<m)
					ans+=m;
			}
		}
	}
	cout<<ans;
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char ch[111];
int i,j,k,n,m;
int main(){
	scanf("%s",ch);k=0;
	if (strlen(ch)>=4){
		if (ch[0]=='Y'&&ch[1]=='A'&&ch[2]=='K'&&ch[3]=='I') k=1;
	}
	puts(k?"Yes":"No");
	return 0;
}

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

namespace ALDS_1_2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var itemNum = int.Parse(Console.ReadLine());
            var numArray = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
            var result = SelectionSort(numArray);
        }

        static List<T> SelectionSort<T>(IEnumerable<T> target) where T : IComparable
        {
            var result = new List<T>(target);
            var exchangeCount = 0;
            for (int i = 0; i < result.Count - 1; i++)
            {
                var minPos = i;
                for (int j = i + 1; j < result.Count; j++)
                {
                    if (result[j].CompareTo(result[minPos]) < 0)
                    {
                        minPos = j;
                    }
                }

                if(i == minPos)
                {
                    continue;
                }

                var min = result[minPos];
                result[minPos] = result[i];
                result[i] = min;
                exchangeCount++;
            }
            Console.WriteLine(string.Join(" ", result));
            Console.WriteLine(exchangeCount);
            return result;
        }
    }
}



Measured memory_bytes: 20252
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
 
int main() {
  ll n,q,r,s;
  cin>>n;
  q=n/15;
  r=n%15;
  s=(q)*(60+60+15*8*(q-1))/2;
  if(r==0){
    s=(q)*(60+60+15*8*(q-1))/2;
  }
  if(r==1){
    s+=15*q+1;
  }
  if(r==2 || r==3){
    s+=15*q*2+1+2;
  }
  if(r==4 || r==5 || r==6){
    s+=15*q*3+1+2+4;
  }
  if(r==7){
    s+=15*q*4+1+2+4+7;
  }
  if(r==8 || r==9 || r==10){
    s+=15*q*5+1+2+4+7+8;
  }
  if(r==11 || r==12){
    s+=15*q*6+1+2+4+7+8+11;
  }
  if(r==13){
    s+=15*q*7+1+2+4+7+8+11+13;
  }
  if(r==14){
    s+=15*q*8+1+2+4+7+8+11+13+14;
  }
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 3636
# -*- coding: utf-8 -*-

n, m = map(int, input().split())
ps = list(list(input().split()) for _ in range(m))

wal = [0]*n
acl = [0]*n
for [p, s] in ps:
    p = int(p)-1
    if s == 'AC' and acl[p] == 0:
        acl[p] += 1
    elif s == 'WA'and acl[p] == 0:
        wal[p] += 1

wa = 0
for i, ac in enumerate(acl):
    if ac == 1:
        wa += wal[i]

print(sum(acl),wa)

Measured memory_bytes: 27460
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    ans = 0
    total = 0
    for a in A:
        if total * 2 < a:
            ans = 1
        else:
            ans += 1
        total += a
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 63984