akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  for (int i = 0; i < N; i++)
    cin >> B[i];
  for (int i = 0; i < N; i++)
    cin >> C[i];
  sort(A.begin(), A.end());
  sort(C.begin(), C.end());
  long ans = 0;
  for (int i = 0; i < N; i++)
  {
    long count1 = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
    long count2 = C.end() - upper_bound(C.begin(), C.end(), B[i]);
    ans += count1 * count2;
  }
  cout << ans << endl;
  return 0;
}

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)
#define INF 1e9

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1000000000+7;
const int MAX_N=1000;

int main(){
	string s,t;
	int q;
	cin>>s>>t;
	cin>>q;
	int a[q];
	int b[q];
	int c[q];
	int d[q];
	REP(i,q){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--;b[i]--;c[i]--;d[i]--;
	}

	int sum_s[s.size()+1];
	sum_s[0]=0;
	for(int i=1;i<=s.size();i++){
		if(s[i-1]=='A')sum_s[i]=sum_s[i-1]+1;
		else sum_s[i]=sum_s[i-1]+2;
	}

	int sum_t[t.size()+1];
	sum_t[0]=0;
	for(int i=1;i<=t.size();i++){
		if(t[i-1]=='A')sum_t[i]=sum_t[i-1]+1;
		else sum_t[i]=sum_t[i-1]+2;
	}

	REP(i,q){
		int si=sum_s[b[i]+1]-sum_s[a[i]];
		int ti=sum_t[d[i]+1]-sum_t[c[i]];

		if((si%3)==(ti%3))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3200
N,A,B,C=gets.split.map &:to_i;L=N.times.map{gets.to_i}.sort.reverse;m=A+B+C;f=->(l,a){10*~-l.size+(l.inject(:+)-a).abs};(4**N).times.map{|i|s=i.to_s(4).rjust(N,"0").chars;a=[];b=[];c=[];N.times{|j|a<<L[j]if s[j]=="0";b<<L[j]if s[j]=="1";c<<L[j]if s[j]=="2"};if a!=[]&& b!=[]&& c!=[]then s=f[a,A]+f[b,B]+f[c,C];m=s if s<m end};p m

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

int main()
{
  int M;
  cin >> M;
  ll n = 0, s = 0;
  rep(i, M)
  {
    ll d, c;
    cin >> d >> c;
    n += c;
    s += d * c;
  }
  cout << n - 1 + (s - 1) / 9 << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()
    val ds = readLine()!!.split(" ").take(n).map { it.toInt() }.sorted().toIntArray()

    var count = 0
    for (ai in (0 until ds.size - 2)) {
        for (bi in (ai + 1 until ds.size - 1)) {
            for (ci in (bi + 1 until ds.size)) {
                if (ds[ci] < ds[ai] + ds[bi]) {
                    count++
                } else {
                    break
                }

            }
        }
    }

    print(count)
}


Measured memory_bytes: 48508
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string s; cin >> s;
	for (int i = 0; i <= s.length() - 1; i++) cout << ((s[i] == '?') ? 'D' : s[i]);

	return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;cin>>n>>k;
	int ans=0;
	for(int i=0;i<n;i++){
		int t;cin>>t;
		if(t>=k)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int A = sc.nextInt();

        int pittari = N % 500;
        int haraeru = pittari - A;
        
        if (haraeru < 0 || pittari == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23892
def main():
    s = int(input())

    ans = 0
    kosuu_saidai = s // 3
    ansdic = dict()

    ansdic[3] = 1
    ansdic[4] = 1
    ansdic[5] = 1
    ansdic[6] = 2
    ansdic[7] = 3
    ansdic[8] = 4
    ansdic[9] = 6
    if s < 3:
        print(0)
        exit()
    elif s <= 9:
        print(ansdic[s])
        exit()
    else:
        for i in range(10, s+1):
            tmp = 1
            hajime = 3
            while hajime <= i-3:
                nokori = i - hajime
                tmp += ansdic[nokori]
                hajime += 1
                #print(nokori, tmp, ansdic)
            ansdic[i] = tmp
    print(ansdic[s] % (10**9+7))



if __name__ == "__main__":
    main()

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

int main() {
    int n;
    ll d;
    cin >> n >> d;
    int ans = 0;
    rep(i,n) {
        ll x, y;
        cin >> x >> y;
        if (x*x+y*y <= d*d) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <double> vd;
typedef vector <ll> vll;
typedef vector <vector <int>> vvi;
typedef vector <vector <long long>> vvll;
typedef vector <vd> vvd;
typedef vector <long long> vll;
typedef pair <int, int> pii;
typedef pair<ll , ll> pll;
typedef vector <pair <int, int>> vpii;

int main()
{
    double l; cin>> l;
    l = l /3.0;
    cout<< fixed << setprecision(7) <<  l*l*l << endl;   
}

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

bc = sorted(bc, reverse=True, key=lambda x: x[1])
a.sort()
num = 0

for i in range(m):
    b, c = bc[i]
    while b>0:
        if num == n:
            break
        if a[num]<c:
            a[num] = c
            b -= 1
            num += 1
        else:
            break

print(sum(a))

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;

int main() {
    ll a,b;
    cin >> a >> b;
    if ((a+b)%2) cout << "IMPOSSIBLE" << endl;
    else cout << (a+b)/2 << endl;
    return 0;
}


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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

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

  int a;
  cin >> a;

  int x = a * 800;

  int y = 200 * int(a / 15);

  cout << x - y << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdbool.h>

bool IsPrime (int n)
{
    if (n <= 3) {
        return true;
    }

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

int main() {
#ifdef TEST
    freopen("input", "r", stdin);
#endif

    int num;
    scanf("%d", &num);
    int tmp;
    int cnt = 0;
    for (int i = 0; i < num; ++i) {
        scanf("%d", &tmp);
        if(IsPrime(tmp)) {
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N, num[16], ret[1<<16];
vpi adj[MX], ADJ[MX];

int dfs(int x, int pre, int val) {
    for (auto a: adj[x]) if (a.f != pre) {
        dfs(a.f,x, a.s);
        val ^= a.s;
    }
    if (x) num[val] ++;
    return val;
}

void addEdge(int z, int i, int j) {
    int Z = z; Z ^= 1<<i;
    if (j == -1) {
        ADJ[Z].pb({z,1});
    } else {
        Z ^= 1<<j;
        if (Z & 1<<(i^j)) ADJ[Z^(1<<(i^j))].pb({z,2});
        else ADJ[Z^(1<<(i^j))].pb({z,1});
    }
}

void gen() {
    F0R(z,1<<16) if (!(z&1)) {
        F0R(i,16) if (z&(1<<i)) {
            FOR(j,1,16) if (i != j && (z&(1<<j))) addEdge(z,i,j);
            addEdge(z,i,-1);
        }
    }
    
    FOR(i,1,1<<16) ret[i] = MOD;
    vi todo[17]; todo[0].pb(0); ret[0] = 0;
    F0R(i,16) while (sz(todo[i])) {
        int x = todo[i].back(); todo[i].pop_back();
        if (ret[x] != i) continue;
        for (auto a: ADJ[x]) if (i+a.s < ret[a.f]) {
            ret[a.f] = i+a.s;
            todo[ret[a.f]].pb(a.f);
        }
    } 
    /*cout << "ZZ " << ret[(1<<16)-2] << "\n";
    cout << "ZZ " << ret[(1<<3)^(1<<4)^(1<<7)] << "\n";
    cout << "ZZ " << ret[(1<<3)^(1<<4)] << "\n";
    exit(0);*/
}

int main() {
    gen();
    // freopen("Input.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    F0R(i,N-1) {
        // int a = i,b = i+1,c = 13; 
        int a,b,c; cin >> a >> b >> c;
        // cout << a << " " << b << "\n";
        adj[a].pb({b,c}), adj[b].pb({a,c});
    }
    dfs(0,-1,0); num[0] = 0;
    int cur = 0, ans = 0;
    F0R(i,16) {
        ans += num[i]/2; 
        if (num[i]&1) cur ^= (1<<i);
    }
    cout << ans+ret[cur];
    // F0R(i,16) cout << num[i] << " ";
    // cout << "\n";
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

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


int main()
{
        char s[100000];
        scanf("%s",&s);

        int n=strlen(s);

        int count1=0,count0=0;

        int i;
        for(i=0; i<n; i++){
                if(s[i] == '1') count1++;
                else count0++;
        }

        int youjo;
        if(count1 < count0) youjo=count1;
        else youjo=count0;

        printf("%d\n",youjo*2);
        return 0;
}


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

struct Block{
    int start, end, cnt;
};

int h, w, k;

int sol(vector<string>& s, vector<Block>& b){
    int cnt = 0;
    for (int c = 0; c < w; c++){
        for (auto& block: b){
            int add_val = 0;
            for (int r = block.start; r < block.end; r++){
                if (s[r][c] == '1')
                    add_val += 1;
            }

            if (add_val > k)
                return h * w + 1000;
            
            block.cnt += add_val;
            
            if (block.cnt > k){
                cnt += 1;
                
                for (auto& block_clear: b)
                    block_clear.cnt = 0;
                c -= 1;
                break;
            }
        }
    }
    
    return cnt;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> h >> w >> k;

    vector<string> s(h);
    for (int i = 0; i < h; i++)
        cin >> s[i];

    int ans = h * w + 1000;
    for (int mask = 0; mask < (1 << h); mask++){
        vector<Block> b;
        b.push_back({0, 0, 0});
        for (int i = 0; i < h; i++){
            if (mask & (1 << i)){
                b[(int) b.size() - 1].end = i + 1;
                b.push_back({i + 1, 0, 0});
            }
        }
        b[(int) b.size() - 1].end = h;

        ans = min(ans, sol(s, b) + (int) b.size() - 1);
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=1e9+7;
#define INF 2*1e9
#define N 200000
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");
int par[N],grade[N];
void init(int n){
    rep(i,n+1){
        par[i]=i;
        grade[i]=0;
    }
}
int root(int x){
    return par[x]==x?x:par[x]=root(par[x]);
}
bool same(int x,int y){
    return root(x)==root(y);
}
void unite(int x,int y){
    x=root(x); y=root(y);
    if(x==y)return;
    if(grade[x]<grade[y]){
        par[x]=y;
    }
    else{
        par[y]=x;
        if(grade[x]==grade[y]) grade[x]++;
    }
}
main(){
    map<ll,int> m;
    int num=0,n;
    ll x=0;
    cin>>n;
    ll a[N]={},b[N]={},c[N],d[N];
    rep(i,n) {cin>>c[i];x^=c[i];}rep(i,n)cin>>d[i];
    int pnt=0,nm=0;
    rep(i,n){
        if(c[i]==d[i]) continue;
        a[pnt]=c[i];b[pnt]=d[i];pnt++;nm++;
    }
    n=nm;
    if(nm==0){cout<<0;return 0;}
    rep(i,n){
        if(m[a[i]]) m[a[i]]++;
        else{
            m[a[i]]=1;num++;
        }
    }
    if(m[x]) m[x]++;
    else{
        m[x]=1;num++;
    }
    init(num);
    map<ll,int> mm;
    int tmp=0;
    for(auto it=m.begin();it!=m.end();++it){
        mm[it->first]=tmp;
        tmp++;
    }
    int ans=n;
    rep(i,n){
        if(m[b[i]]==0){
            cout<<-1;return 0;
        }
        m[b[i]]--;
        unite(mm[a[i]],mm[b[i]]);
    }
    rep(i,num){
        if(par[i]==i)ans++;
    }
    cout<<--ans;
    return 0;
}


Measured memory_bytes: 19328
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		List <Long> list = new LinkedList<Long>();
		ListIterator<Long> listIter = list.listIterator();
		try (Scanner sc = new Scanner (System.in)){
			int times = sc.nextInt();
			long x,d;
			for (int i=0; i < times; i++) {
				int query = sc.nextInt();
				switch (query) {
				//insert(x)
				case 0:
					x = sc.nextLong();
					listIter.add(x);
					listIter.previous();
					break;
				//move(d)
				case 1:
					d = sc.nextLong();
					if (d > 0) {
						for (int j=0; j<d; j++) {
							listIter.next();   //後ろに移動
						}
					} else if (d < 0){
						long a = -d;  //絶対値にする
						for (int j=0; j<a; j++) {
							listIter.previous();   //前に移動
						}
					}
					break;
				//erase()
				case 2:
					listIter.next();  //最後にnext()またはprevious()で返された要素が削除されるため、先に後ろにずらす
					listIter.remove();
					break;
				}
			}
			ListIterator<Long> ite = list.listIterator();			
			while (ite.hasNext()) {
				System.out.println(ite.next());  //最後まで出力する
			}
		}
	}
}


Measured memory_bytes: 308844
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let x: String = input();
    let y: String = input();
    println!(
        "{}",
        if x < y {
            "<"
        } else if x == y {
            "="
        } else {
            ">"
        }
    );
}


Measured memory_bytes: 4352
import java.lang.*;
import java.util.*;
public class Main
{
    static Scanner sc = new Scanner(System.in);
        
    public static void main(String args[])
    {
        while(true){
            int n = sc.nextInt();
            int m = sc.nextInt();

            if(n==0 && m==0) break;
            
            int[] t = new int[n+1];
            int tn = 0;
            for(int i=0; i<n; i++){
                t[i] = sc.nextInt();
                tn += t[i];
            }
            int[] h = new int[m+1];
            int hn = 0;
            for(int i=0; i<m; i++){
                h[i] = sc.nextInt();
                hn += h[i];
            }
            int ans_t = 0;
            int ans_h = 0;
            int min = 100000;
            for(int i=0; i<n; i++){
                for(int j=0; j<m; j++){
                    tn = tn - t[i] + h[j];
                    hn = hn - h[j] + t[i];
                    
                    if(tn == hn && tn < min){
                        ans_t = t[i];
                        ans_h = h[j];
                        min = tn;
                    }
                    tn = tn + t[i] - h[j];
                    hn = hn + h[j] - t[i];
                }
            }
            if(min != 100000) System.out.println(ans_t + " " + ans_h);
            else System.out.println("-1");
        }
    }   
}


	    

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

typedef long long ll;
#define fori(n) for(int i=0;i<n;i++)
#define pb push_back


ll power(ll base,ll e)
{
    ll answer=1;
    //ll e=1000000005;
    while(e)
    {
        if(e%2==1)
        {
            answer*=base;
        }
        base*=base;
       // base%=mod;
        e/=2;
       // answer%=mod;
    }
    return answer;
}

set<ll> ans;

void sieveprimes(ll n)
{
    bool prime[n+1];
    memset(prime,true,sizeof(prime));

    for(ll i=2;i*i<=n;i++)
    {
        if(prime[i]==true)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                prime[j]=false;
            }

        }

    }

    /*for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";*/
    for(ll i=2;i<=n;i++)
    {
        if(prime[i])    ans.insert(i*i);
    }
}


int main()
{

    ll n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0 && (i%3!=0 && i%5!=0))    sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}







Measured memory_bytes: 3636
//minamoto
#include<bits/stdc++.h>
#define R register
#define pb push_back
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
ll sum[N];int a[N],n;
int main(){
	scanf("%d",&n);
	fp(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	fp(i,1,n)sum[i]=sum[i-1]+a[i];
	fd(i,n,1)if(a[i]>(sum[i-1]<<1))return printf("%d\n",n-i+1),0;
	return 233;
}

Measured memory_bytes: 1408
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    while(true) {
        auto n = readInt();
        if(n == 0) {
            return;
        }
        Tuple!(int, int, int, double)[] a;
        foreach(i; iota(n)) {
            int p, h, w;
            readlnTo(p, h, w);
            a ~= tuple(p, h, w, abs(22-w.to!double/h/h*10000));
        }
        a.sort!((x, y) => x[3] < y[3] || (x[3] == y[3] && x[0] < y[0]));
        writeln(a[0][0]);
    }
}

Measured memory_bytes: 2716
#include <stdio.h>

int main()
{
	int a,b,c;
	
    scanf("%d%d%d", &a, &b, &c);
	
	if(a==b && b!=c ){
    	printf("Yes");
    }else if(a==c && b!=c ){
    	printf("Yes");
    }else if(c==b && a!=c ){
    	printf("Yes");
    }else{
    	printf("No");
    }
}

Measured memory_bytes: 128
N, cnt;
char s[55];
main(){
	scanf("%d%s", &N, s);
	for(int i=0; i<N; i++){
		cnt += s[i]=='A' && s[i+1]=='B' && s[i+2]=='C';
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 1696
import java.util.Scanner;
 
public class Main{
      
        public static void main(String[] args) {
            Scanner stdin  = new Scanner(System.in);
             
            int num = Integer.parseInt(stdin.nextLine());
             
            boolean boo = true;
            int[] seq = new int[num];
            if(num <= 100) {
              
                for(int i = 0;i < num;i++) {
                    seq[i] = stdin.nextInt();
                    if(seq[i] >= 0 && seq[i] <= 1000) {
                        continue;
                    }else {
                        boo = false;
                    break;
                    }
                }
            }
              
            if(boo == true) {
                for(int j = num ;j > 0;j--) {
                    if(j != 1) {
                        System.out.print(seq[j - 1]+" ");
                    }else {
                        System.out.println(seq[j - 1]);
                    }
                }
            }
              
        }
      
    }
 

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

using namespace std;
const int N = 1e5 + 10;
int st[N], p[N], mark[N];
vector <int> g[N], vec;

void dfs(int v) {
    mark[v] = 1;
    for (int u : g[v]) if (!mark[u]) p[u] = v, dfs(u);
    vec.push_back(v);
}

bool cmp(int i, int j) {return st[i] < st[j];}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, m; cin >> n >> m; m += n - 1;
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        g[u].push_back(v);
    }
    for (int i = 1; i <= n; i++) if (!mark[i]) dfs(i);
    reverse(vec.begin(), vec.end());
    for (int i = 0; i < n; i++) st[vec[i]] = i;
    for (int i = 1; i <= n; i++) sort(g[i].begin(), g[i].end(), cmp);
    memset(p, 0, sizeof p), memset(mark, 0, sizeof mark), dfs(vec[0]);
    for (int i = 1; i <= n; i++) cout << p[i] << "\n";


    return 0;
}


Measured memory_bytes: 13044
use std::io::*;
use std::str::FromStr;

fn main() {
	let mut temp: u32;
	for i in 1..6 {
		temp = read();
		if temp == 0 {
			println!("{}", i);
		}
	}
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}


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

int main(){
  int a=0,array[5],i;
  string s;
  cin>>s;
  for(i=0;i<4;i++){
    if(s.at(i)=='+'){
      a++;
    }else if(s.at(i)=='-'){
      a--;
    }
  }
  cout<<a<<endl;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll h, w ;
    cin >> h >> w ;
    vector<vector<char>> grid(h,vector<char>(w)) ;
    vvint seen(h,vint(w,0)) ;
    vvint dist(h,vint(w,INF)) ;
    queue<pii> que ;
    int ans = 0 ;
    REP(i,h){
        string s ;
        cin >> s ;
        REP(j,w){
            grid[i][j] = s[j] ;
        }
    }
    REP(i,h){
        REP(j,w){
            if(grid[i][j]=='#'){
                dist[i][j] = 0 ;
                seen[i][j] = 0 ;
                que.push(MP(i,j)) ;
            }
        }
    }

    while(!que.empty()){
        int x, y ;
        x = que.front().FI ;
        y = que.front().SE ;
        que.pop() ;
        REP(k,4){
            int nx = x + dx[k] ;
            int ny = y + dy[k] ;
            if(nx>=0 && nx<h && ny>=0 && ny<w && seen[nx][ny]==0){
                if(grid[nx][ny]=='.'){
                    seen[nx][ny] = 1 ;
                    que.push(MP(nx,ny)) ;
                    dist[nx][ny] = dist[x][y] + 1 ;
                    ans = dist[nx][ny] ;
                }
            }
        }
    }

    cout << ans <<endl;





    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 20184
#include <stdio.h>
int main(){
  int inf[5][4][11]={};
  int n,i,j,k,b,f,r,v;

  scanf("%d",&n);

  for(n;n>0;n--){

    scanf("%d %d %d %d",&b,&f,&r,&v);
    inf[b][f][r]+=v;

  }

  for(i=1;i<5;i++){     //building
    for(j=1;j<4;j++){   //floor
      for(k=1;k<11;k++){//room
	printf(" %d",inf[i][j][k]);
      }
      printf("\n");
    }
    if(i==4)break;
    printf("####################\n");
  }
  return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,arr[100];
	cin>>a>>b;
	for(int i=0;i<a;i++)
		cin>>arr[i];
	sort(arr,arr+a);
	int s=0;
	for(int i=a-1;i>=a-b;i--)
		s+=arr[i];
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
n,a,b = gets.strip.split.map &:to_i

def digit_sum n
  sum = 0
  while n > 0 do
    sum += n % 10
    n /= 10
  end
  sum
end

ans = (1..n)
        .map { |i| [i, digit_sum(i)] }
        .select { |d| a <= d[1] && d[1] <= b }
        .inject(0) { |sum, d| sum + d[0] }
puts ans

Measured memory_bytes: 2300
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0;
	cin >> n;
	vector<lli> a(n);
	for (auto &i : a)
		cin >> i;
	sort(a.begin(), a.end());
	int ct = 1; lli sum = a[0];
	for (int i = 1; i  < n; ++i)
	{
		if (2ll * sum >= a[i])
			++ct;
		else
			ct = 1;
		sum += a[i];
	}
	cout << ct;
}

Measured memory_bytes: 3944
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>

namespace test {
  std::string to_string(char val) {
    return std::string(1, val);
    // return std::string{val};
  }
}

using namespace std;



int main(void) {
  int H, W, hi, wi; cin >> H >> W >> hi >> wi;
  cout << H * W - hi * W - wi * (H - hi)<< endl;

  return 0;
}

Measured memory_bytes: 256
class Imos_1:
    def __init__(self,N):
        self.len=N
        self.list=[0]*(N+1)

    def Add(self,F,T,C=1):
        self.list[F]+=C
        self.list[T+1]-=C

    def Cumulative_Sum(self):
        Y=[0]*(self.len)
        S=0
        for i in range(self.len):
            S+=self.list[i]
            Y[i]=S

        return Y
#================================================
N,M=map(int,input().split())
I=Imos_1(N)

for _ in range(M):
    a,b=map(int,input().split())
    a,b=min(a,b),max(a,b)
    I.Add(a,b-1,1)

J=I.Cumulative_Sum()

F=True
for k in J:
    F&=not(k%2)

if F:
    print("YES")
else:
    print("NO")



Measured memory_bytes: 71500
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    string s;
    cin>>s;
    map<char,int>cnt;
    for(auto ch:s)
    {
        cnt[ch]++;
    }
    int flag=0;
    for(auto x:cnt)
    {
        if(x.si%2!=0)flag=1;
    }
    if(flag)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;

}





































Measured memory_bytes: 3644
#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:tt)*) => (if cfg!(debug_assertions) {print!($($arg)*)});
}

fn main() {
    let mut rd = reader::Reader::new();

    let n: usize = rd.next();
    let k = rd.next();

    let d: Vec<u32> = rd.next_n(k);

    for i in n..100000 {
        let ng = i.to_string().chars().into_iter().map(|c| c.to_digit(10).unwrap()).any(|c| d.contains(&c));
        debug!("{} {}\n", i, ng);
        if ng {
            continue;
        }
        print!("{}\n", i);
        break;
    }


}

trait ToChars {
    fn to_chars(&self) -> Vec<char>;
}

impl ToChars for String {
    fn to_chars(&self) -> Vec<char> {
        self.chars().collect::<Vec<char>>()
    }
}

mod reader {
    use std::fmt::Debug;
    use std::str::FromStr;
    use std::collections::VecDeque;
    use std::io::{self, Read};

    fn _read_line() -> String {
        let mut buf = String::new();
        let _ = io::stdin().read_to_string(&mut buf);
        buf
    }

    fn _read_vec_deque_string() -> VecDeque<String> {
        _read_line()
            .split_whitespace()
            .map(|s| s.to_string())
            .collect()
    }

    #[allow(dead_code)]
    pub struct Reader {
        buf: VecDeque<String>,
    }

    #[allow(dead_code)]
    impl Reader {
        pub fn new() -> Reader {
            Reader { buf: VecDeque::new() }
        }

        fn update_buf(&mut self) {
            if self.buf.is_empty() {
                self.buf = _read_vec_deque_string();
            }
        }

        pub fn next<T>(&mut self) -> T
            where
                T: FromStr,
                T::Err: Debug,
        {
            self.update_buf();
            self.buf.pop_front().unwrap().parse::<T>().unwrap()
        }

        pub fn next_n<T>(&mut self, n: usize) -> Vec<T>
            where
                T: FromStr,
                T::Err: Debug,
        {
            let mut vec: Vec<T> = Vec::with_capacity(n);

            for _ in 0..n {
                vec.push(self.next());
            }
            vec
        }
    }
}


Measured memory_bytes: 4352
n=int(input())
A=list(map(int, input().split()))

flg=True
for i in range(n):
    if A[i]%2==0:
        if A[i]%3!=0 and A[i]%5!=0:
            flg=False

if flg:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
x = int(input())

if 400 <= x <= 599:
    print("8")
elif 600 <= x <= 799:
    print("7")
elif 800 <= x <= 999:
    print("6")
elif 1000 <= x <= 1199:
    print("5")
elif 1200 <= x <= 1399:
    print("4")
elif 1400 <= x <= 1599:
    print("3")
elif 1600 <= x <= 1799:
    print("2")
else:
    print("1")

Measured memory_bytes: 61644
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N;
int main(){
    cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    sort(ALL(a));
    cout << a.back() - a.front() << '\n';
}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  
  for (int i=0; i<M; i++){
    cin >> A.at(i);
    N -= A.at(i);
  }
  if (N<0)
    cout << -1 << endl;
  else
    cout << N << endl;
  // ここにプログラムを追記
}


Measured memory_bytes: 3636
from operator import itemgetter
import heapq

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

AB.sort(key=itemgetter(0))
q = []
idx = 0
ans = 0

for i in range(1, M+1):
    while idx < N:
        a, b = AB[idx]
        if a <= i:
            heapq.heappush(q, -b)
            idx += 1
        else:
            break
    if len(q)>0:
        b = heapq.heappop(q)
        ans -= b
print(ans)


Measured memory_bytes: 31912
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

void ans(bool flag){
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main(){
    int n;
    cin >> n;
    cout << n * (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
inp_line = list(map(int, input().split()))

index = 1
answer = 1000 * 1000 * 1000
while True:
    # 必要なセット数を算出(切り上げ)
    needs = -((-1 * inp_line[0]) // inp_line[index])
    answer = min(answer, (needs * inp_line[index + 1]))

    index += 2
    if index + 1 > len(inp_line):
        break

print(answer)


Measured memory_bytes: 5596
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <ctime>
#include <cstdlib>
#include <bitset>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 101010;
int n,a[N];


int main(){
    scanf("%d",&n);
    rep(i,0,n) scanf("%d",a + i);
    ll ans=0,rm=0;
    rep(i,0,n){
        int m = min(rm,(ll)a[i]);
        a[i]-=m;ans+=m;
        ans+=a[i]/2;
        rm=a[i]%2;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 640
import java.io.*;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	
	public static void main(String[] args) throws IOException{
		
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String str = in.readLine();
		//???????????????????????????????????????????????´?????¨????????????
		str = str.trim();
		//????§?????????????????????????????????¨????????±???
		String[] rio = str.split(" ");
		
		int[] threeNum = new int[3];
		
		threeNum[0] = Integer.parseInt(rio[0]);
		threeNum[1] = Integer.parseInt(rio[1]);
		threeNum[2] = Integer.parseInt(rio[2]);
		
		Arrays.sort(threeNum);
		
		System.out.println(threeNum[0] + " " + threeNum[1] + " " + threeNum[2]);
		
		
		
	}

}

Measured memory_bytes: 24096
s = list(input())
n = len(s)
flag = 0
for i in range(n//2):
    if s[i] != s[n-i-1]:
        flag = 1
if flag == 0:
    s2 = s[:(n-1)//2]
    n2 = len(s2)
    for i in range(n2//2):
        if s2[i] != s2[n2-i-1]:
            flag = 1
#print(n, n2, s, s2)
if flag == 0:
    if flag == 0:
        s2 = s[(n+3)//2-1:]
        n2 = len(s2)
    for i in range(n2//2):
        if s2[i] != s2[n2-i-1]:
            flag = 1
#print(s2)
if flag == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9184
def main():
    N = int(input())
    h = list(map(int, input().split()))
    INF = 10**30
    h_dp = [INF] * N
    h_dp[0] = 0
    for i in range(1, N):
        h_dp[i] = min(h_dp[i], h_dp[i - 1] + abs(h[i] - h[i - 1]))
        if i > 1:
            h_dp[i] = min(h_dp[i], h_dp[i - 2] + abs(h[i] - h[i - 2]))
    print(h_dp[N - 1])


if __name__ == "__main__":
    main()


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

typedef long long ll;
#define D1(a) cout<<#a<<":"<<a<<"\n"

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

    ll N, K; cin >>N>>K;

    ll ans = 0;

    for (ll b = K+1; b <= N; b++) {
        ans += (b-K) * (N/b);
        ll r = N % b;
        if (r != 0 && r >= K) {
            ans += r - max((ll)0, K-1);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
      string[] input = Console.ReadLine().Split(' ');
      int A=int.Parse(input[0]);
      int B=int.Parse(input[1]);
      int C=int.Parse(input[2]);
      int sum=0;
      if(A==B){
        sum++;
      }
      if(A==C){
        sum++;
      }
      if(B==C){
        sum++;
      }
      if(sum==1){
        Console.WriteLine("Yes");
      }
      else{
        Console.WriteLine("No");
      }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;


int main() {
  int N;cin >> N;
  vint a(N),b(N);
  repeat(i,N){
    cin >> a[i];
  }
  repeat(i,N){
    cin >> b[i];
  }
  int ans=0;
  repeat(k,29){
    int T = 1<<k;
    vint amod(N),bmod(N);
    repeat(i,N){
      amod[i] = a[i]%(2*T);
      bmod[i] = b[i]%(2*T);
    }
    sort(bmod.begin(),bmod.end());
    int numbit=0;
    repeat(i,N){
      numbit += (lower_bound(bmod.begin(),bmod.end(),2*T-amod[i])
                      -lower_bound(bmod.begin(),bmod.end(),T-amod[i]));
      numbit += (lower_bound(bmod.begin(),bmod.end(),4*T-amod[i])
                      -lower_bound(bmod.begin(),bmod.end(),3*T-amod[i]));
    }
    //debug(numbit);
    if(numbit&1){
      ans += 1<<k;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    using namespace std;
    unsigned long A, B, C, K;
    cin >> A >> B >> C >> K;
    while(A >= B){
        --K;
        B <<= 1;
    }
    while(B >= C){
        --K;
        C <<= 1;
    }
    puts(K > 10 ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
    int A, B, X;

    scanf("%d %d %d", &A, &B, &X);

    if (X < A){
        printf("NO\n");
    } else if (X > A+B){
        printf("NO\n");
    } else {
        printf("YES\n");
    }

    return 0;
}


Measured memory_bytes: 1652
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct TEMP_OMAZINAI_ { TEMP_OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } TEMP__omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void TEMP_INPUT_IMPL_() {};
template <class T, class... Args> void TEMP_INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; TEMP_INPUT_IMPL_(args...); }
void TEMP_OUTPUT_IMPL_() {};
template <class T, class... Args> void TEMP_OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); TEMP_OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; TEMP_INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (TEMP_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

// ^^^ Template ^^^ //


int main() {
	in(ll, N, x);
	in_v(ll, a, N);
	ll ans = 0;
	if (a[0] > x) {
		ans += a[0] - x;
		a[0] = x;
	}
	loop(i, N - 1) {
		ll t = a[i] + a[i + 1];
		if (t > x){
			a[i + 1] -= t - x;
			ans += t - x;
		}
	}
	out(ans);
	return 0;
}


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

int main(){
  string S, T, U;
  int A, B;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  
  if(U == S){
    cout << A - 1 << " " << B << endl;
    }
  else if(U == T){
    cout << A << " " << B - 1 << endl;
    }
  }
  
  
  

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b, c = (int(i) for i in input().split())
        edge[a-1].append((c % 2, b-1))
        edge[b-1].append((c % 2, a-1))

    dist = [-1]*N
    color = [-1]*N

    def dfs(v, G):
        todo = []
        dist[v] = 0
        color[v] = 0
        todo.append((v, 0)) #最初は0でappend
        while todo:
            u, s = todo.pop() #ここでpopしちゃう
            if s == 0:
                # s==0: 潜っていく時の処理
                todo.append((u, 1)) #1でappendして戻り処理の仕込み
                for c, next_v in G[u]:
                    if dist[next_v] != -1:
                        continue
                    dist[next_v] = dist[u] + c
                    if dist[next_v] % 2 == 1:
                        color[next_v] = 1
                    else:
                        color[next_v] = 0
                    todo.append((next_v, 0))
                    #break
            #else:
            #    s==1: 戻ってくる時の処理(この問題では特にやることなし)

    dfs(0, edge)
    print(*color, sep="\n")
    # print("\n", *dist, sep="\n")


if __name__ == '__main__':
    main()


Measured memory_bytes: 67232