akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, x, ans = 1;
    cin >> n >> x;
    vector<int> l(n);
    for(int i = 0; i < n; i++){
        cin >> l[i];
    }
    int p = 0;
    for(int i = 0; i < n; i++){
        p += l[i];
        if(p > x){
            break;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
const int INF = 100000000;
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    char b;
    cin >> b;
    map<char, char> m = {{'A','T'}, {'C','G'}, {'G','C'}, {'T','A'}};
    cout << m[b] << endl;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, k;
    cin >> n >> k;
    vector<ll> v(n);
    REP(i, n){
        cin >> v[i];
    }

    ll ans = 0;

    REP(i, min(n+1, k+1)){
        REP(j, i+1){
            int left = j, right = i - j;
            vector<ll> u;
            REP(l, left){
                u.push_back(v[l]);
            }
            REP(r, right){
                u.push_back(v[n - 1 - r]);
            }
            sort(all(u));
            REP(l, min(k - i, i)){
                if(u[l] < 0) u[l] = 0;
            }
            chmax(ans, SUM(u, 0LL));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
    quid-pro-quo: LOGIC for AC
    written by: codercell07
    LANG: C++ 11
    Problem: random
*/
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL)
#define testcases freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define ui unsigned int
#define ll long long
#define pb push_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sz(x) (int)x.size()
#define pq priority_queue /*maxim at top(max-heap)*/
#define pqmax priority_queue<int, vector<int>, greater<int>> /*minim at top(min-heap)*/
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define asc(x) sort(all(x))
#define desc(x) sort(all(x), greater<int>())
#define time_el (double)time/CLOCKS_PER_SEC
using namespace std;
const int MAX=2e6; //dummy, make sure change as per constraints
const ll M=1e9+7, inf=1e18;
const char nl='\n';
 
ll apbmc(ll a, ll b, ll c){ a%=c; ll res=1; while(b){ if(b&1) res=res*a%c; a=a*a%c; b>>=1; } return res;}
ll apb(ll x, ll y){ ll temp; if(y==0) return 1;  temp=apb(x, y/2); if(y%2==0) return temp*temp;  else return temp*temp*x;}
 


void solve(){   
    //clock_t time;
    string s; cin>>s;
    int n = sz(s);
    if(s[n-1]=='s') s+="es";
    else s+='s';
    cout<<s;
}
int main(){
    fastio;
    // #ifndef ONLINE_JUDGE
    //     testcases;
    // #endif // !DEBUG
    cout<<fixed<<setprecision(10);
    
    //int t; cin>>t; while(t--) solve();    
    solve();

    return 0;
}
//points to check:
//  * check for constraints, mainly array!
//  * EDGE CASES
//  * check for integer overflow, use long long!
//  * learn, do, solve, share something, NOW!

Measured memory_bytes: 3640
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	count := 0
	for i := a; i <= b; i++ {
		s := i % 10
		t := i / 10 % 10
		u := i / 1000 % 10
		v := i / 10000 % 10
		if s == v && t == u {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int[][] a = getIntArr(in, n, n);
		long r = solve(n, a);
		System.out.println(r);
		in.close();
	}

	private static long solve(int n, int[][] a) {
		long[] subSetSum = new long[1 << n];
		long[] dp = new long[1 << n];
		for (int mask = 0; mask < 1 << n; mask++) {
			int subMask = mask & (mask - 1);
			int newComer = -1;
			if (subMask != 0) {
				subSetSum[mask] += subSetSum[subMask];
				for (int i = 0; i < n; i++) {
					if ((mask >> i & 1) > 0) {
						if (newComer == -1) {
							newComer = i;
						} else {
							subSetSum[mask] += a[newComer][i];
						}
					}
				}
			}
		}
		for (int mask = 0; mask < 1 << n; mask++) {
			dp[mask] = subSetSum[mask];
			int x = mask;
			while (x != 0) {
				dp[mask] = Math.max(dp[mask], dp[x] + dp[mask & (~x)]);
				x = mask & (x - 1);
			}
		}
		return dp[(1 << n) - 1];
	}

	static String str(int[] a) {
		String[] str = new String[a.length];
		for (int i = 0; i < a.length; i++) {
			str[i] = a[i] + "";
		}
		return String.join(" ", str);
	}

	static int[] getIntArr(Scanner in, int size) {
		int[] arr = new int[size];
		for (int i = 0; i < size; i++) {
			arr[i] = in.nextInt();
		}
		return arr;
	}

	static int[][] getIntArr(Scanner in, int row, int col) {
		int[][] arr = new int[row][];
		for (int i = 0; i < row; i++) {
			arr[i] = getIntArr(in, col);
		}
		return arr;
	}

	static char[] getCharArr(Scanner in, int size) {
		char[] arr = in.next().toCharArray();
		return arr;
	}

	static String[] getStringArr(Scanner in, int size) {
		String[] arr = new String[size];
		for (int i = 0; i < size; i++) {
			arr[i] = in.next();
		}
		return arr;
	}

	static Map<Integer, List<Integer>> getEdges(Scanner in, int size, boolean directed) {
		Map<Integer, List<Integer>> edges = new HashMap<>();
		for (int i = 0; i < size; i++) {
			int from = in.nextInt();
			int to = in.nextInt();
			if (!edges.containsKey(from)) {
				edges.put(from, new ArrayList<Integer>());
			}
			edges.get(from).add(to);
			if (!directed) {
				if (!edges.containsKey(to)) {
					edges.put(to, new ArrayList<Integer>());
				}
				edges.get(to).add(from);
			}

		}
		return edges;
	}
}


Measured memory_bytes: 25036
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main(void){
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 4){
        if(s.at(i) == '+') ans++;
        else ans--;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
 
int main(){
    int n;
    double xa, ya, ra, xb, yb, rb, d;


    scanf("%d", &n);
    for(; n>0; n--){
        scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
        d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));

        if(fabs(ra - rb) <= d && d <= (ra + rb)){
            printf("1\n");
        } else if(d > (ra + rb)){
            printf("0\n");
        } else {
            if(ra > rb) printf("2\n");
            else printf("-2\n");
        }
    }
    return 0;
}

Measured memory_bytes: 620
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


int bisect_left(long long x,long long  a[],int left,int right){
   int mid;
   right++;
   while (left < right) {
      mid = (left + right) / 2;
      if (a[mid] < x) {
         left = mid + 1;
      } else {
         right = mid;
      }
   }
   return left;
}

int main(void) {
   int A,B,Q;
   scanf("%d%d%d", &A,&B,&Q);
   long long *shrine = (long long *)calloc((A+3) , sizeof(long long));
   long long *temple = (long long *)calloc((B+3) , sizeof(long long));
   shrine[0] = -100000000000000LL;
   temple[0] = -100000000000000LL;
   for (int i = 1; i <= A; i++) {
      scanf("%lld", &shrine[i]);
   }
   for (int i = 1; i <= B; i++) {
      scanf("%lld", &temple[i]);
   }
   shrine[A+1] = 100000000000000LL;
   temple[B+1] = 100000000000000LL;
   for (int i = 0; i < Q; i++) {
      long long now;
      scanf("%lld", &now);
      int s1 = bisect_left(now,shrine,0,A+1)-1;
      int s2 = bisect_left(now,shrine,0,A+1);
      int t1 = bisect_left(now,temple,0,B+1)-1;
      int t2 = bisect_left(now,temple,0,B+1);
      long long ans = 10000000000000LL;
      ans = MIN(ans,ABS(shrine[s1]-now) + ABS(shrine[s1]-temple[t1]));
      ans = MIN(ans,ABS(shrine[s1]-now) + ABS(shrine[s1]-temple[t2]));
      ans = MIN(ans,ABS(shrine[s2]-now) + ABS(shrine[s2]-temple[t1]));
      ans = MIN(ans,ABS(shrine[s2]-now) + ABS(shrine[s2]-temple[t2]));
      ans = MIN(ans,ABS(temple[t1]-now) + ABS(shrine[s1]-temple[t1]));
      ans = MIN(ans,ABS(temple[t1]-now) + ABS(shrine[s2]-temple[t1]));
      ans = MIN(ans,ABS(temple[t2]-now) + ABS(shrine[s1]-temple[t2]));
      ans = MIN(ans,ABS(temple[t2]-now) + ABS(shrine[s2]-temple[t2]));
      printf("%lld\n",ans);
   }
   return 0;
}


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

using namespace std;
typedef long long ll;
const long long mod=1e9+7; //10^9+7


int main() {
    string S;
    cin >> S;
    int sw = true;
    for(int i=0; i<3; i++){
        if(S[i]==S[i+1]) sw = false;
    }
    if(sw){
        cout << "Good" << endl;
    }else{
        cout << "Bad" << endl;
    }

  return 0;
}


Measured memory_bytes: 256
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline

N, K = map(int, read().split())
mod = 10 ** 9 + 7
answer = 0
cnt = list(accumulate(range(N + 1)))
for i in range(K, N + 1):
    tmp = cnt[N] - cnt[N - i] - cnt[i] + 1
    answer = (answer + cnt[N] - cnt[N - i] - cnt[i - 1] + 1) % mod

answer += 1
print(answer)


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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;

bool g[100][100];
int lower[100][100];
int upper[100][100];

int main() {
  int m,n;
  while(cin >> m >> n) {
    REP(i,m)REP(j,n){
      lower[i][j] = -1;
      upper[i][j] = 101;
    }
    REP(i,m) {
      int k;
      cin >> k;
      REP(j,k) {
        int s,t;
        string cond;
        cin >> s >> cond >> t;
        s--;
        if (cond == ">=") {
          chmax(lower[i][s], t);
        } else {
          chmin(upper[i][s], t);
        }
      }
    }
    memset(g,0,sizeof(g));
    bool ng = 0;
    REP(i,n) {
      REP(j,m) {
        if (lower[j][i] > upper[j][i]) ng = 1;
        REP(k,m) {
          if (j==k) continue;
          if (upper[j][i] < lower[k][i]) {
            g[j][k] = 1;
          }
        }
      }
    }
    REP(k,m)REP(i,m)REP(j,m)g[i][j]|=g[i][k]&g[k][j];
    REP(i,m)ng|=g[i][i];
    puts(ng?"No":"Yes");
  }
}

Measured memory_bytes: 1276
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<queue>
#define int long long
using namespace std;
int test[213456], ans[213456];

signed main() {
	int n, a, b = 0, c = 0; cin >> n;
	for (int h = 1; h <= n; h++) {
		cin >> a; test[h] = a; b += a;
		if (h % 2 == 0) { c += a; }
	}
	for (int h = 0; h < n; h++) {
		if (h == 0) {
			ans[h] = b - (c * 2);
		}
		else {
			ans[h] = test[h] * 2 - ans[h - 1];
		}
	}
	for (int h = 0; h < n; h++) {
		if (h == 0) { cout << ans[h]; }
		else { cout << ' ' << ans[h]; }
	}
	cout << endl;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  /*int n, i;
  cin >> n;
  vector<int> D(n);
  rep(i, n) cin >> D[i];*/
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " "<< y << endl;
}



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

using namespace std;

void print(string *s, int a, int b, bool isf) {
    
    for(int i = a; i <= b; i++)
    {
        cout << (*s)[i];
    }
    
    cout << endl;
}

void replace(string *s, int a, int b, string x) {
    for(int i = a; i <= b; i++)
    {
        (*s)[i] = x[i-a];
    }
    
}

void reverse(string *s, int a, int b) {
    int cnt = (b-a)+1;
    
    char rev[cnt];
    
    for(int i = a; i <= b; i++)
    {
        rev[i-a] = (*s)[i];
    }
    
    
  for(int i = a; i <= b; i++)
    {
        (*s)[i] = rev[cnt - (i-a) -1 ];
    }
    
}

int main(){
    string s;
    int n;
    cin >> s;
    cin >> n;
    string op;
    bool isf = 1;
    rep(i,n) {
        cin >> op;
        if(op == "print") {
            int a,b;
            cin >> a >> b;
            print(&s, a, b, isf);
            if(isf) {
                isf = 0;
            }
        } else if(op == "replace") {
            int a,b;
            string x;
            cin >> a >> b >> x;
            replace(&s, a, b, x);
        } else if(op == "reverse") {
            int a,b;
            cin >> a >> b;
            reverse(&s, a, b);
        }
        
    }
    
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#include <cstring>
#include <ctype.h>
#include<stdlib.h>

#define flin            freopen("input.txt", "r", stdin); 
#define flout           freopen("output.txt", "w", stdout);
#define ll              long long
#define ull             unsigned long long
#define fastio          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl              '\n'
#define nll             '\0'
#define pb              push_back
#define bdyptb          return 0;
#define sorted(x)       sort(x.begin(), x.end())
#define reversed(x)     reverse(x.begin(), x.end())
#define all(x)          x.begin(), x.end()
#define mset(a, b)      memset(a, b, sizeof(a));
#define testcase        ll t,tt; cin>>tt; for(t=1;t<=tt;t++)

#define pi acos(-1.00)   
#define mx 1000007

using namespace std;

int main()
{
	fastio;
	
	int n, x, t;
	cin>>n>>x>>t;

	int ans = ceil(1.0*n/x);
	ans*=t;

	cout<<ans<<nl;
	 

    
}

Measured memory_bytes: 3600
A, B, C, X, Y = map(int, open(0).read().split())
ans = 0
res = 0
if A + B > C * 2:
    ans += C * min(X, Y) * 2
    res = X - Y
else:
    ans += A * X + B * Y
    
if res > 0:
    ans += min(A * res, C * res * 2)
elif res < 0:
    ans += min(B * abs(res), C * abs(res) * 2)
    
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
vector<vector<ll>> v(100010);
vector<bool> d(100010);
map<P,ll> m;
void dfs(ll a,ll b,bool c){
  rep(i,v[a].size()){
    if(v[a][i]!=b){
      if(m[P(min(a,v[a][i]),max(a,v[a][i]))]%2){
        d[v[a][i]]=!c;
      }else{
        d[v[a][i]]=c;
      }
      dfs(v[a][i],a,d[v[a][i]]);
    }
  }
}
int main(){
  ll n;
  cin>>n;
  rep(i,n-1){
    ll a,b,c;
    cin>>a>>b>>c;a--,b--;
    m[P(a,b)]=c;
    v[a].push_back(b),v[b].push_back(a);
  }
  d[0]=false;
  dfs(0,-1,false);
  rep(i,n){
    cout<<(d[i]?0:1)<<endl;
  }
}

Measured memory_bytes: 17664
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(c) c.begin(),c.end()
#define INF int(1e9+7)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

int a[1000005];

int main()
{
	IO_OP;

	int s;
	cin >> s;
	for(int i=1;;i++) {
		if(a[s]) {
			cout << i << endl;
			return 0;
		}
		a[s] = 1;
		if(s & 1) s = s * 3 + 1;
		else s /= 2;

	}
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  ll a = 100;
  ll X = nextLong();
  int ans = 0;
  while (a < X) {
    ans++;
    a += a / 100;
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int N, K;

    cin >> N >> K;

    int sum = 0;

    for(int i = 0;i < N;i++)
    {
        int x;
        cin >> x;
        sum += min(x, abs(K - x)) * 2;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long costs[][] = new long[N][3];
        for(int i = 0;i < N;i++){
            for(int h = 0;h < 3;h++)
                costs[i][h] = sc.nextLong();
        }

        long dp[][] = new long[N + 1][3];

        for(int i = 0;i < N;i++){
            for(int h = 0;h < 3;h++){
               for(int j = 0;j < 3;j++)
                   if(h != j)
                       dp[i + 1][h] = Math.max(dp[i + 1][h],dp[i][j] + costs[i][h]);
            }
        }

        System.out.println(Math.max(Math.max(dp[N][0],dp[N][1]),dp[N][2]));
    }










    public static Integer min(List<Integer> ar){
        int min = 10000;
        int index = 0;
        for(int i = 0; i< ar.size();i++){
            if(min > ar.get(i)){
                min = ar.get(i);
                index = i;
            }
        }
        return min;
    }
}


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


int main(){
    int d, n, ans, tmp = 1;
	cin >> d >> n;

    for(int i=0;i<d;i++){
        tmp *= 100;
    }
    n += n / 100;
	ans = tmp * n;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<int> vi;

signed main(){
    int a,b,c;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c;
    cout << min(b,c) << " ";
    if(b + c > a) {
            cout << b + c -a << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
			int [] b = new int[a];
      //int c = sc.nextInt();



			int sum = 0;
      for(int i = 0;i < a; i++){
				b[i] = sc.nextInt();
				sum += b[i];
			}

			int pos = 0;
			if(sum%a >= (float)a/2)pos = (sum/a) + 1;
			else pos = sum/a;
			
			sum = 0;
			for(int i = 0;i < a; i++){

				sum += (b[i] - pos)*(b[i] - pos);

			}
			System.out.println(sum);

    }


    public static long factorial(long n){
      if(n == 0){
        return new Long(1);
       }
       System.out.println(n * factorial(n-1));

      return n * factorial(n-1);
    }
}


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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int main(){
    int N;
    cin >> N;
    int64_t ans = power_mod(10, N);
    add(ans, 2*(MOD - power_mod(9, N)));
    add(ans, power_mod(8, N));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
def yakusu(n):
    a = []
    for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
    a.append(n)
    return a

A, B = map(int, input().split())
b = yakusu(B)
if A in b:
    print(A + B)
else:
    print(B - A)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll k;
    cin >> k;
    ll a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << (a[k - 1]) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		String[] a={" ","'",",","-",".","?","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
		String[] b1={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001","110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
		String[] b2={"11010","11110","11100","11101","11011","11111","00000","00001","00010","00011","00100","00101","00110","00111","01000","01001","01010","01011","01100","01101","01110","01111","10000","10001","10010","10011","10100","10101","10110","10111","11000","11001"};
		Scanner sc=new Scanner(System.in);
		while(sc.hasNextLine()){
			char[] c1=sc.nextLine().toCharArray();
			String str1="";
			for(int i=0;i<c1.length;i++){
				for(int j=0;j<a.length;j++){
					if(a[j].equals(c1[i]+"")){
						str1+=b2[j];
						break;
					}
				}
			}
			String str2="";
			String answer="";
			for(int i=0;i<str1.length();i++){
				str2+=str1.charAt(i);
				for(int j=0;j<b1.length;j++){
					if(str2.equals(b1[j])){
						answer+=a[j];
						str2="";
						break;
					}
				}
			}
			System.out.println(answer);
		}
	}
}

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

int main() {
  int a,b,c ; cin >> a >> b >> c ;
  if(a==b&&b==c){
    cout << 1 << endl;
  }
  else if(a==b&&a!=c||a==c&&a!=b||b==c&&b!=a){
    cout << 2 << endl;
  }
  else{
    cout << 3 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back 
#define mp make_pair
#define sp ": "
#define cs "Case "
#define fi first
#define sn second 
#define po(x) x*x
/* STL */
#define vi vector<int>v
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxa(a) *max_element(a, a.size())
#define r(a) reverse(a.begin(),a.end())
/* loops */
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n)i=1;i<=(n);i++)
#define fa(i,a,n) for(__typeof(a)i=(a);i<=(b);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define db(something)   cerr<<#something<<" - "<<something<<"\n";         
int main()
{
  
   Ezio
   /*Variables*/
   /*Code*/
   string s;
   string t;
   cin>>s>>t;
   t.pop_back();
   
   cout<<(s==t?"Yes":"No")<<endl;
   
   
   return 0;
}
    

Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int n;
int a[10010];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	int sum=0;
	for(int i=0;i<n;i++)
	{
		int k=a[i];
		while(k%2==0)
		{
			sum++;
			k/=2;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

void solve1() {
    int h, w;
    cin >> h >> w;

    map<int, int> s; //　今の位置、開始位置の最大値
    multiset<int> vals; // 最小移動数を求める用

    REP(i, w) s[i] = i;
    REP(i, w) vals.insert(0);

    REP(i, h) {
        int l, r;
        cin >> l >> r;
        --l;

        int l_max = -1;
        auto it = s.lower_bound(l);
        while(it != s.end() && it->fi <= r) {
            l_max = max(l_max, it->se);
            vals.erase(vals.find(it->fi - it->se));
            s.erase(it++);
        }

        if(l_max != -1 && r < w){
            s[r] = l_max;
            vals.insert(r - l_max);
        }

        if (vals.size() == 0) print(-1);
        else print(*vals.begin() + i + 1);
    }
}

void solve2() {
    int h, w; cin >> h >> w;

    map<int, int> m;
    multiset<int> m2;

    REP(i, w) m[i] = i;
    REP(i, w) m2.insert(0);

    REP(i, h) {
        int l, r; cin >> l >> r;
        l--;

        int max_l = -1;
        auto it = m.lower_bound(l);
        while(it != m.end() && it->fi <= r) {
            max_l = max(it->se, max_l);
            m2.erase(m2.find(it->fi - it->se));
            m.erase(it++);
        }

        if (max_l != -1 && r < w) {
            m[r] = max_l;
            m2.insert(r - max_l);
        }

        if (!m2.empty()) print(*m2.begin() + i + 1);
        else print(-1);

    }
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve2();
}


Measured memory_bytes: 22372
module Main where

import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe


getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getListIntFromInputLineAtBSC8 =
    unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readInt = fst . fromJust . BSC8.readInt
readIntList = map readInt . BSC8.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main :: IO ()
main = do
    --s <- getLine
    --[aM,aN] <- getListIntFromInputLineAtBSC8
    --aP                   <- getVUIntFromInputLineAtBSC8
    --aQ                   <- getVUIntFromInputLineAtBSC8
    --aR                   <- getVUIntFromInputLineAtBSC8

    --vP <- VU.fromList . take aX . reverse . sort <$> getIntList
    --vQ <- VU.fromList . take aY . reverse . sort <$> getIntList
    --vR <- VU.fromList . take (aX + aY) . reverse . sort <$> getIntList

    aL <- getInt 
    
    let lSide = realToFrac aL / 3

    putStrLn $ show (lSide ^ 3) 



Measured memory_bytes: 508
import sys
input = sys.stdin.readline
from collections import deque

N = int(input())
ad = [[] for _ in range(N)]
dis = [[-1]*N,[-1]*N]

for _ in range(N-1):
    a,b = map(int,input().split())
    a -= 1; b -= 1
    ad[a].append(b); ad[b].append(a)

def bfs(s):
    index = 0 if s == 0 else 1
    dq = deque()
    dq.append((s,0,-1))
    while dq:
        v,d,pre = dq.popleft()
        dis[index][v] = d
        for nv in ad[v]:
            if nv == pre:continue
            dq.append((nv,d+1,v))

bfs(0); bfs(N-1)
f = 0; s = 0
for d0,d1 in zip(dis[0],dis[1]):
    if d0 <= d1: f += 1
    else: s += 1
ans = "Fennec" if f > s else "Snuke"
print(ans)

Measured memory_bytes: 29336
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int h,w,n;
int main(){
	cin>>h>>w>>n;
	cout<<(n-1)/max(h,w)+1<<endl;
	return 0;
}

Measured memory_bytes: 256
///////////////////////////////////////////////////////////////////////////
// /*Dis = size of the program || TLE. */
/*
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
*/
// #pragma GCC target("avx,avx2,fma")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops") /* D = Too many loops */
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
#define endl '\n'
#define mod 1000000007
typedef long long ll;
//////////////////////////////////////////////////////////////////////////
/* Custom function starts here */

/* Custom function ends here: */
//////////////////////////////////////////////////////////////////////////////

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

  /* MAIN Code STARTS here: */
  long long a, b, x;
  cin >> a >> b >> x;

  if (a % x == 0) {
    cout << ((b / x) - (a / x) + 1) << endl;
  } else {
    cout << ((b / x) - (a / x)) << endl;
  }

  /* MAIN Code ENDS here: */
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}

/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/

Measured memory_bytes: 3652
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var Fijk = new long[N][];
            for (var i = 0; i < N; ++i)
                Fijk[i] = Sarray();
            var Pij = new long[N][];
            for (var i = 0; i < N; ++i)
                Pij[i] = Sarray();
            var lim = 1 << 10;
            var maxVl = long.MinValue / 2;
            for (var i = 1; i < lim; ++i)
            {
                var open = new bool[10];
                var t = i;
                for (var j = 0; j < 10; ++j, t >>= 1)
                {
                    if (0 != (t & 1))
                        open[j] = true;
                }
                var vl = 0L;
                for (var n = 0; n < N; ++n)
                {
                    var cnt = 0L;
                    for (var k = 0; k < 10; ++k)
                        if (open[k] && 1 == Fijk[n][k])
                            cnt++;
                    vl += Pij[n][cnt];
                }
                maxVl = Max(maxVl, vl);
            }
            WriteLine(maxVl);
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28436
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanStrings(n int) []string {
	sl := make([]string, n)
	for i := range sl {
		sl[i] = scanString()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	ss := scanStrings(n)
	m := map[string]int{}

	for _, s := range ss {
		m[s]++
	}

	var max int
	var ans []string
	for k, v := range m {
		if max < v {
			ans = []string{k}
			max = v
		} else if max == v {
			ans = append(ans, k)
		}
	}

	sort.Strings(ans)

	for _, a := range ans {
		fmt.Println(a)
	}
}


Measured memory_bytes: 29328
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef long double ld;
typedef float fl;
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define pb push_back
#define pf push_front
#define mp map<ll,ll>
#define INF 1000000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else
    {
        return gcd(b%a,a);   
    }
}
ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int f(char c)
{
    return (int)c-96;
}
/**********************************************************************
***********************************************************************
*********************ACTUAL CODE BEGINS HERE***************************/
int main()
{   
    fast;
    ll i;
    ll n;
    cin>>n;
    ll x=0;
    for(i=1;i<=1e6+5;i++)
    {
       x=((x%n)*(10%n)+(7%n))%n;
       if(x%n==0)
       {
           cout<<i;
           return 0;
       }
    }
    cout<<-1;
    return 0;
}

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

using namespace std;

int main() {
	int m, f, r;
	while (cin >> m >> f >> r) {
		if (m == -1 || f == -1) {
			if (m == r && f == r) break;
			cout << 'F';
		} else if (m+f >= 80) {
			cout << 'A';
		} else if (m+f >= 65) {
			cout << 'B';
		} else if (m+f >= 50) {
			cout << 'C';
		} else if (m+f >= 30) {
			if (r >= 50) {
				cout << 'C';
			} else {
				cout << 'D';
			}
		} else {
			cout << 'F';
		}
		cout << '\n';
	}
}


Measured memory_bytes: 3056
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			while (true) {
				int n = sc.nextInt();
				if (n == 0) {
					break;
				}
				int[] scores = new int[n];
				for (int i = 0; i < scores.length; i++) {
					scores[i] = sc.nextInt();
				}
				double average = 0, variance = 0, x = 0;
				for (int i = 0; i < scores.length; i++) {
					x = x + scores[i];
				}
				average = x / n;
				x = 0;
				for (int i = 0; i < scores.length; i++) {
					x = x + (scores[i] - average) * (scores[i] - average);
				}
				variance = x / n;
				System.out.println(Math.sqrt(variance));
			}
		}
	}
}



Measured memory_bytes: 31024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '0';}
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;}

int main () {
  int n, m;
  cin >> n >> m;
  vi a(n);
  rep(i,n) cin >> a[i];
  int tot = suma(a);
  
  sort(a.rbegin(), a.rend());

  int ans = 0;
  rep(i,n) {
    if (a[i]*4*m < tot) {
      cout << "No" << endl;
      return 0;
    }
    ans++;
    if (ans == m) break;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
      cout << "a > b" << endl;
    else if (a < b)
      cout << "a < b" << endl;
    else if (a == b)
      cout << "a == b" << endl;    
}


Measured memory_bytes: 3100
n = int(input())
sp_array = [[x for x in input().split()]+[index] for index, y in enumerate(range(n))]
tmp = []
for row in sp_array:
    t = [row[0], int(row[1]), int(row[2])]
    tmp.append(t)
res = sorted(tmp, key=lambda x:(x[0],-x[1]))
for row in res:
    print(row[2]+1)


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

using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  auto ans = 0;
  {
    char m1, m2;
    cin >> m1 >> m2;
    if ((m1 == '0' && '1' <= m2 && m2 <= '9') || (m1 == '1' && '0' <= m2 && m2 <= '2'))
    {
      ans |= 1;
    }
  }
  {
    char m1, m2;
    cin >> m1 >> m2;
    if ((m1 == '0' && '1' <= m2 && m2 <= '9') || (m1 == '1' && '0' <= m2 && m2 <= '2'))
    {
      ans |= 2;
    }
  }

  string ans_table [] = {"NA", "MMYY", "YYMM", "AMBIGUOUS"};
  cout << ans_table [ans] << endl;
}


Measured memory_bytes: 256
def 解():
    iN,ix = [int(_) for _ in input().split()]
    aA =[int(_) for _ in input().split()]

    #if iN*ix < sum(aA)
    if ix == 0 :
        print(sum(aA))
    else:
        iCount = 0
        for i in range(1,iN):
            i差 = aA[i-1] + aA[i] -ix
            if 0 < i差  :
                if aA[i] <= i差:
                    aA[i] = 0
                    iCount += i差
                else:
                    iCount += i差
                    aA[i] -= i差

        print(iCount)
解()


Measured memory_bytes: 14352
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int ans = Integer.MAX_VALUE;
		int upto = 1;
		for(int i=0; i<N; i++) {
			upto = upto * 2;
		}
		for(int i=0; i<=upto; i++) {
			int test = 1;
			int copyi = i;
			for(int j=0; j<N; j++) {
				if(copyi%2==1) {
					test += K;
				} else {
					test *= 2;
				}
				copyi= copyi/2;
			}
			ans = min(ans, test);
		}
		System.out.println(ans);
	}
	
	// print
	static void print(String s) {
		System.out.println(s);
	}
	
	// union find lib
	// usage:
	// 最初にinitを呼ぶ
	// root: 直接は呼ばないで
	// unite: まとめる
	// same: グループ判定
	static void init(int par[], int N) {
		for(int i=0; i<N; i++) {
			par[i] = i;
		}
	}
	
	static int root(int x, int [] par) {
		if(par[x] == x) {
			return x;
		} else {
			return (par[x] = root(par[x], par));
		}
	}
	
	static boolean same(int x, int y, int[] par) {
		return root(x, par) == root(y, par);
	}
	
	static void unite(int x, int y, int[] par) {
		x = root(x, par);
		y = root(y, par);
		if(x == y) return;
		par[x] = y;
	}
	
	// end union find lib
	
	// number lib
	
	static int max(int...ls) {
		int ans = Integer.MIN_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.max(ans, ls[i]);
		}
		return ans;
	}
	
	static int min(int...ls) {
		int ans = Integer.MAX_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.min(ans, ls[i]);
		}
		return ans;
	}
	
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
	
	// end number lib
}

Measured memory_bytes: 23380
N = int(input())
A = list(map(int,input().split()))
ans = 1

for i in range(N):
    if ans > 10**18+1:
        break
    else:
        ans = ans * A[i]

if 0 in A:
    print(0)
elif ans > 10**18:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 21656
h,w,k = map(int,input().split())
c = [list(input()) for _ in range(h)]
cnt = 0
for c_h in range(2**h):
    for c_w in range(2**w):
        black = 0 
        for i in range(h):
            for j in range(w):
                if (c_h >> i)&1==0 and (c_w >> j)&1==0:
                    if c[i][j]=='#':
                        black += 1
        if black == k:
            cnt += 1
print(cnt)

Measured memory_bytes: 9060
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll pow(ll x, ll ntimes, ll b) {
    ll ret = 1;
    while (ntimes > 0) {
        if ((ntimes & 1) == 1) {
            ret = ret * x;
        }
        x = x * x;
        x%=b;
        ret%=b;
        ntimes >>= 1;
    }
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    string x;
    cin >> x;
    ll b = 0;
    ll yp = 0;
    ll ym = 0; 
    ll tw = 1;
    REP(i,n){
        if(x[i]=='1') b++;
    }
    for(ll i = n-1;i>=0;--i){
        if(x[i]=='1'){
            yp += tw;
            
        }
        tw *= 2;
        tw %= (b+1);
        yp %= (b+1);
    }
    tw = 1;
    if(b>1){
        for(ll i = n-1;i>=0;--i){
            if(x[i]=='1'){
                ym += tw;
                
            }
            tw *= 2;
            tw %= (b-1);
            ym %= (b-1);
        }
    }
    REP(i,n){
        if(x[i]=='1'){
           if(b==1){
                cout << 0 << endl;
           }else{
                ll tm = pow(2, n-1-i, b-1);
                tm = ((ym-tm)%(b-1)+b-1)%(b-1);
               // cout << "--" << tm << endl;
                ll ret = 1;
                while(tm>0){
                    ll cb = 0;
                    ll ttm = tm;
                    while(ttm>0){
                        cb += ((ttm&1));
                        ttm >>= 1;
                    }
                    tm %= cb;
                    ret++;
                }
                cout << ret << endl;
           }
        }else{
            ll tm = pow(2, n-1-i, b+1);
            tm = (yp+tm)%(b+1);
            //cout << "++" << tm << endl;
            ll ret = 1;
            while(tm>0){
                ll cb = 0;
                ll ttm = tm;
                while(ttm>0){
                    cb += ((ttm&1));
                    ttm >>= 1;
                }
                tm %= cb;
                ret++;
            }
            cout << ret << endl;;
        }

    }

    return 0;
}

Measured memory_bytes: 3744