akhauriyash/Code-Regression huggingface dataset:
// AOJ 2751 Baseball
// 2018.2.2 bal4u

#include <stdio.h>

#define M 1000000007
#define N 4000000

int fact[N+2], inv[N+2], factinv[N+2];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int comb(int n, int k)
{
	if (n < 0 || k < 0) return 0;
	return (int)((long long)fact[n] * factinv[k] % M * factinv[n-k] % M);
}

int H(int n, int k)
{
	if (!n && !k) return 1;
    return comb(n+k-1, k);
}

int main()
{
	int a, b, c, sx, sy, i;
	long long ans, t;

	fact[0] = 1; for (i = 1; i <= N; i++)
		fact[i] = (long long)fact[i-1] * i % M;
	inv[1] = 1; for (i = 2; i <= N; i++)
		inv[i] = M - (M / i) * (long long)inv[M % i] % M;
	factinv[0] = 1; for (i = 1; i <= N; i++)
		factinv[i] = (long long)factinv[i-1] * inv[i] % M;

	while (1) {
		a = in(), b = in(), c = in(), sx = in(), sy = in();
		if ((a|b|c|sx|sy) == 0) break;

		ans = 0;
		for (i = 0; i <= sx; i++) {
			t = H(a, i-a);
			t = t * H(b, sy-sx+i-b) % M;
			t = t * H(a+b+c, sx-i) % M;
			ans += t;
			if (ans >= M) ans -= M;
		}
		ans = ans * comb(a+b+c, a) % M;
		ans = ans * comb(b+c, b) % M;
		printf("%d\n", (int)ans);
	}
    return 0;
}


Measured memory_bytes: 48728
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	int co=0;
	bool h=true;
	rep(i,n){
		string s;
		cin>>s;
		if(s=="A")co++;
		else co--;
		if(co<0)h=false;
	}
	if(h&&co==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

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

int main() {
    for (int i = 1 ; i < 10 ; i++) {
        for (int j = 1 ; j < 10 ; j++) {
            cout << i << "x" << j;
            cout << "=" << i * j << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3044
#include <iostream>
#include <fstream>
#include <cassert>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int n=t/1000;
    if(n*1000==t)
        cout<<0;
    else
        cout<<1000*(n+1)-t;
	return 0;
}


Measured memory_bytes: 3608
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

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

	h, w, a, b := scanInt(), scanInt(), scanInt(), scanInt()

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if j < a && i < b || j >= a && i >= b {
				fmt.Fprint(wr, 1)
			} else {
				fmt.Fprint(wr, 0)
			}
		}
		fmt.Fprintln(wr)
	}
	wr.Flush()
}


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

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

  int N; cin >> N;
  vector<int> X(N), v(N);
  for (int i = 0; i < N; i++) cin >> X[i];
  v = X;
  sort(v.begin(), v.end());
  for (int i = 0; i < N; i++)
    cout << (X[i] <= v[N/2-1] ? v[N/2] : v[N/2-1]) << "\n";
}

Measured memory_bytes: 3840
using Atcoder;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var first = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            double W = first[0];
            double H = first[1];
            var x = first[2];
            var y = first[3];

            double minArea = W * H / 2;
            var isMulti = (W / 2 == x) && (H / 2 == y);
            if (isMulti)
            {
                Console.Write(minArea.ToString() + " 1");
            }
            else
            {
                Console.Write(minArea.ToString() + " 0");
            }
            
        }
        //static void Main(string[] args)
        //{
        //    var temp = new Atcoder.ABC129.B();
        //    temp.Run();
        //}

    }
}

Measured memory_bytes: 13396
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            string sT = System.Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "No";
            sT = sT.Substring(0, sS.Length);
            if (sS == sT) { sOut = "Yes"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 25732
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs              v.size()
#define sot(v)        sort(v.begin(),v.end())
#define rev(v)        reverse(v.begin(),v.end())
#define ii                pair<int,int>
#define ll                long long
#define ull              unsigned long long
#define pb              push_back
#define mpp          make_pair
#define Okay         0
#define pi               3.14159

static ll int inf = 1e9;
const int cont = 10e5+10;
using namespace std;

void solve(){
    ll x, k, d;
    cin>>x>>k>>d;
    x = abs(x);
   if(x>0 && x/d >= k){
    ll dd = x/d;
    x-= k*d;
    cout<<x<<endl;
   }
    else {
        ll dd = x/d;
        x -=  dd*d;
        k -= dd;
        if(k%2 == 0)cout<<abs(x)<<endl;
        else cout<<min(abs(x- d),abs(x+d))<<endl;
    }

}

int main(){
    Fast;

    solve();

	return Okay;
}



Measured memory_bytes: 3648
#include<iostream>
#include<cstring>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ac=0,wa=0,tle=0,re=0;
  while(n--){
      string s;
      cin>>s;
      if(s=="AC")ac++;
      else if(s=="WA")wa++;
      else if(s=="TLE")tle++;
      else re++;
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;
 return 0;
}

Measured memory_bytes: 3600
import java.util.*;
import java.io.*;
public class Main {
	static BufferedReader br;
	static PrintWriter out;
	static StringTokenizer st;
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new OutputStreamWriter(System.out));
		int N = readInt();
		int[] coor = new int[N+2];

		coor[0] = 0;
		coor[N+1] = 0;
		for (int i=1; i<=N; i++){
			coor[i] = readInt();
		}
		int total = 0;
		for (int i=1; i<=N+1; i++){

			total+=Math.abs(coor[i]-coor[i-1]);
		}
		for (int i=1; i<=N; i++){
			System.out.println(total-Math.abs(coor[i]-coor[i-1])-Math.abs(coor[i+1]-coor[i])+Math.abs(coor[i+1]-coor[i-1]));
		}

	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}

	static long readLong () throws IOException {
		return Long.parseLong(next());
	}

	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}

	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}

	static char readCharacter () throws IOException {
		return next().charAt(0);
	}

	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


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

int main() {
	int a, b, c, A = 0, K;
	scanf("%d%d%d%d", &a, &b, &c, &K);
	while(a >= b) b <<= 1, ++A;
	while(b >= c) c <<= 1, ++A;
	puts(K >= A ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 3756
#include <iostream>
using namespace std;
int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a + b > c + d){
    cout << "Left" << endl;
  }else if(a + b == c + d){
           cout << "Balanced" << endl;
  }else{
        cout << "Right" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m,l;
  cin>>n>>m>>l;
  vector<vector<ll>> d(n,vector<ll>(n,inf)),d2(n,vector<ll>(n,inf));
  rep(i,m){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    d[a][b]=c;
    d[b][a]=c;
  }
  rep(i,n) d[i][i]=0;
  rep(k,n)rep(i,n)rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
  rep(i,n)rep(j,n){
    if(d[i][j]<=l) d2[i][j]=1;
  }
  rep(k,n)rep(i,n)rep(j,n) d2[i][j]=min(d2[i][j],d2[i][k]+d2[k][j]);
  int q;
  cin>>q;
  rep(loop,q){
    int s,t;
    cin>>s>>t;
    s--,t--;
    if(d2[s][t]==inf) cout<<-1<<endl;
    else{
      cout<<d2[s][t]-1<<endl;
    }
  }
}

Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
string a;

bool ok1()
{
	for(int i=0;i<a.size();i+=2)
	{
		if(a[i]=='R' or a[i]=='U' or a[i]=='D') continue;
		return false;
	}
	return true;
}

bool ok2()
{
	for(int i=1;i<a.size();i+=2)
	{
		if(a[i]=='L' or a[i]=='U' or a[i]=='D') continue;
		return false;
	}
	return true;
}

int main()
{
	cin>>a;
	if(ok1() and ok2()) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
using namespace std;
string s1,s2,s3;
int main()
{
	cin >> s1 >> s2 >> s3;
	cout << s1[0] << s2[1] << s3[2]<<endl;
	return 0;
}

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

using namespace std;

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

typedef long long ll;
typedef long double ld;

const ll Inf = 1e18;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep (i, n) cin >> a[i];
    b[0] = a[0];
    FOR (i, 1, n) b[i] = b[i - 1] + a[i];
    ll res = Inf;
    rep (i, n - 1) {
        ll rest = b[n - 1] - b[i];
        res = min(res, abs(rest - b[i]));
    }
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3456
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <numeric>
#define ll long long
using namespace std;

int main() {
	int N, T, hoge_c, hoge_t, min_c;
	min_c = 2000;
	cin >> N >> T;
	for (int i = 0; i < N; i++) {
		cin >> hoge_c >> hoge_t;
		if (hoge_t <= T && min_c > hoge_c) {
			min_c = hoge_c;
		}
	}
	if (min_c == 2000)cout << "TLE" << endl;
	else cout << min_c << endl;
}

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


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int     long long
#define F       first
#define S       second
#define _READ   freopen("input.txt","r", stdin);
#define _FAST   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve()
{
    int n;
    cin>>n;
    vector<int> ar(n);
    vector<int> visited(1000001,0);
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        visited[ar[i]]++;
    }
    int cnt=0;
    for(int x=0;x<n;x++)
    {
        int num=ar[x];
        int flag=0;
        if(num==1)
        { 
            if(visited[num]==1)
                ++cnt;
            else
                continue;
        }
        for(int i=1;i*i<=num;i++)
        {
            if(i==1)
            {
                if(visited[i]==0 && visited[num]==1)
                    continue;
                else
                {
                    flag=1;
                    break;
                }
            }
            if(num%i==0)
            {  
                if(!visited[i] && !visited[num/i])
                    continue;
                else
                {
                    flag=1;
                    break;
                }
            }
        }

        if(flag==0)
            ++cnt;
    }
    cout<<cnt;
}
int32_t main()
{
    
    //_READ
    
    int t;
    t=1;
    while(t--)
        solve();

    return 0;
}
/*
===FOR N-Dimensional Vector===
https://codeforces.com/blog/entry/76149
g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined a.cpp -o a -D_GLIBCXX_DEBUG
*/

Measured memory_bytes: 12712
#include<stdio.h>
int main(){
  int h,i,j;
  int n,m,s,d[4000];
  long long k[4000];
  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;
    for(i=0;i<n;i++){
      scanf("%d%d%d",&d[i],&m,&s);
      k[i]=(long long)m*(long long)s;
    }
    for(i=0;i<n;i++){
      if(d[i]){
	for(j=i+1;j<n;j++){
	  if(d[i]==d[j]){
	    k[i]+=k[j];
	    d[j]=0;
	  }
	}
      }
    }
    h=1;
    for(i=0;i<n;i++){
      if(d[i]&&k[i]>=1000000){
	printf("%d\n",d[i]);
	h=0;
      }
    }
    if(h)
      puts("NA");
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#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 all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int w, h, n; cin >> w >> h >> n;
    vvint data(4);
    rep(i,n) {
        int x, y, a; cin >> x >> y >> a;
        a--;
        if (a == 0 || a == 1) data[a].push_back(x);
        else data[a].push_back(y);
    }
    int x_l, x_r, y_l, y_u;
    if (data[0].size() != 0) x_l = *max_element(all(data[0]));
    else x_l = 0;
    if (data[1].size() != 0) x_r = *min_element(all(data[1]));
    else x_r = w;
    if (data[2].size() != 0) y_l = *max_element(all(data[2]));
    else y_l = 0;
    if (data[3].size() != 0) y_u = *min_element(all(data[3]));
    else y_u = h;
    if (x_l >= x_r || y_l >= y_u) cout << 0 << endl;
    else cout << (x_r-x_l)*(y_u-y_l) << endl;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};//RDLU
int main(){
	string n;
	ll a;
	cin>>n>>a;
	int out=-1;
	rep(i,a){
		if(n[i]!='1'){
			cout<<n[i]<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
}



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

#define quart(x) ((x) * (x))

using namespace std;

const int maxn = 1e5+5;

map<int, int> app;

int main()
{
    int n;
    while(~scanf("%d", &n)){
        app.clear();
        for(int i=0;i<n;++i){
            int u; scanf("%d", &u);
            ++app[u];
        }
        int ans = 0;
        for(auto it : app){
            if(it.first > it.second) ans += it.second;
            else ans += it.second - it.first;
        }
        printf("%d\n", ans);
    }
    return 0;
}


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


int main(void){
  char buf[128] = { 0 };
  short grid[64][64] = { {0} };
  int H,W;
  
  fgets(buf, sizeof(buf), stdin);
  sscanf(buf, "%d %d", &H, &W);
  
  for(int i = 0; i < H; i++){
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), stdin);
    for(int j = 0; j < W; j++)
      if(buf[j] == '#') grid[i+1][j+1] = 1;          
  }
  
  for(int i = 1; i < H+1; i++){
    for(int j = 1; j < W+1; j++){
      if(grid[i][j] == 1) printf("#");
      else printf("%d", grid[i-1][j-1]+grid[i][j-1]+grid[i+1][j-1]
                  +grid[i-1][j]+grid[i+1][j]
                 +grid[i-1][j+1]+grid[i][j+1]+grid[i+1][j+1]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 1736
N = int(input())
SP = [list(input().split()) for i in range(N)]

for row in SP:
    row[1] = int(row[1])

hoge = sorted(SP, key = lambda x:x[1], reverse = True)
SPsort = sorted(hoge, key = lambda x:x[0])

for i in range(N):
    print(SP.index(SPsort[i]) + 1)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        byte r = scan.nextByte();
        byte g = scan.nextByte();
        byte b = scan.nextByte();
        if((r * 100 + g * 10 + b) % 4 == 0){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 19668
while True:
    try:
       ban = input()
    except EOFError:
        break

    s = [ban[:3], ban[3:6], ban[6:]]
    s += map(''.join, zip(*s))
    s += [ban[0]+ban[4]+ban[8]] + [ban[2]+ban[4]+ban[6]]

    if 'ooo' in s:
        print('o')
    elif 'xxx' in s:
        print('x')
    else:
        print('d')

Measured memory_bytes: 6716
package main

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

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	_ = io.NextInt()
	s := io.Next()
	r, g, b := []int{}, []int{}, []int{}
	for i := range s {
		switch s[i] {
		case 'R':
			r = append(r, i)
		case 'G':
			g = append(g, i)
		case 'B':
			b = append(b, i)
		}
	}
	//logger.Println(r, g, b)
	ans := len(r) * len(g) * len(b)
	ans -= find(r, g, b) + find(r, b, g) + find(g, r, b) + find(g, b, r) + find(b, r, g) + find(b, g, r)
	io.Println(ans)
}

func find(a, b, c []int) (found int) {
	for i := 0; i < len(a); i++ {
		jBegin := sort.Search(len(b), func(j int) bool { return b[j] > a[i] })
		for j := jBegin; j < len(b); j++ {
			kBegin := sort.Search(len(c), func(k int) bool { return c[k] > b[j] })
			k := sort.Search(len(c[kBegin:]), func(k int) bool { return a[i]-2*b[j]+c[kBegin:][k] >= 0 })
			if k < len(c[kBegin:]) && a[i]-2*b[j]+c[kBegin:][k] == 0 {
				found++
			}
		}
	}
	return found
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

using namespace std;

const int maxn = 2e5 + 3;

int n, a[maxn];
int cnt[maxn];
void read()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
}

void solve()
{
    for (int i = 1; i <= n; i++)
        cnt[a[i]]++;

    long long ans = 0;
    for (int i = 1; i <= n; i++)
        ans += (long long)cnt[i] * (long long)(cnt[i] - 1) / 2;

    for (int i = 1; i <= n; i++)
        cout << ans - (cnt[a[i]] - 1) << endl;
}

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

    read();
    solve();
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a%2==0) {
			System.out.println((double)(a/2)/a);
		}else {
			System.out.println((double)((a/2)+1)/a);
		}
	}

}


Measured memory_bytes: 22868
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        long ans = help(a,b);
        System.out.print(ans);
    }
    static long help(int[] a, int[] b){
        int len = b.length;
        boolean flag = true;
        for(int i=0;i<len;i++) flag &= (a[i]==b[i]);
        if(flag) return 0;
        long sum = 0;
        long min = Long.MAX_VALUE;
        for(int i=0;i<len;i++){
            sum += b[i];
            if(a[i]>b[i]) min = Math.min(min,b[i]);
        }
        return sum-min;
    }
}


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

    const ll INF = 1e18+5;

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

        int n,w;
        cin>>n>>w;
        vector<ll> weight(n),value(n);
        int sumvalue=0;
        for(int i=0;i<n;i++){
            cin>>weight[i]>>value[i];
            sumvalue+=value[i];
        }
        vector<ll> dp(sumvalue+1,INF);
        //dp[i] = the minimum total weight of items with total value exactly equal to i
        dp[0]=0;
        for(int i=0;i<n;i++){
            for (ll curval = sumvalue-value[i]; curval >= 0; --curval) {
                dp[curval+value[i]]=min(dp[curval+value[i]],dp[curval]+weight[i]);
            }
        }
        ll ans=0;
        for(int i=0;i<=sumvalue;i++){
            if(dp[i]<=w) {
                ans = max(ans, 1LL*i);
            }
        }
        cout<<ans<<endl;
        return 0;
    }

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

typedef struct{
  int num;
  int cost;
  int vote;
}data;

int main(void){
  data t[1000]={0};
  int n,m,c,num,max=0;

  cin>>n>>m;

  for(int i=0;i<n;i++){
    t[i].num=i+1;
    cin>>t[i].cost;
  }

  for(int j=0;j<m;j++){
    cin>>c;
    for(int k=0;;k++){
      if(t[k].cost<=c){
	t[k].vote++;
	break;
      }
    }
  }

  for(int i=0;i<n;i++){
    if(max<t[i].vote){
      max=t[i].vote;
      num=t[i].num;
    }
  }

  cout<<num<<endl;
 
  return 0;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
string S;
int Rcc[4400], Gcc[4400], Bcc[4400];
signed main() {
    cin >> N >> S;
    rep(i, N) {
        Rcc[i + 1] = Rcc[i] + (S[i] == 'R');
        Gcc[i + 1] = Gcc[i] + (S[i] == 'G');
        Bcc[i + 1] = Bcc[i] + (S[i] == 'B');
    }
    int ans = 0;
    for (int i = 1; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (S[i] == S[j]) { continue; }
            char rest = 'R' + 'G' + 'B' - S[i] - S[j];
            if (rest == 'R') { ans += Rcc[i]; }
            if (rest == 'G') { ans += Gcc[i]; }
            if (rest == 'B') { ans += Bcc[i]; }
            int k = i - (j - i);
            if (k >= 0) { ans -= S[k] == rest; }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3740
#include <stdio.h>
 
int main(){
	int A, B, max = 0;
 
	scanf("%d %d", &A, &B);
 	max = A+B;
	if (A - B > max) max = A - B;
	if (A * B > max) max = A * B;
 
	printf("%d\n", max);
 
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);

	        String S = sc.next();
	        char[] c = S.toCharArray();

	        int a = c[0]-'a';
	        if(a<26&&a>=0) {
	        	System.out.println('a');
	        } else {
	        	System.out.println('A');
	        }

	    }
	}

Measured memory_bytes: 35692
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(void) {
	
	char a, b, c;

	cin >> a >> b >> c;
	cout << (a == '7' || b == '7' || c == '7' ? "Yes" : "No") << endl;
	return 0;

}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var str = ReadLine().ToCharArray();
        var res = 0L;
        var ct = new int[Input.Alfa.Length];
        for (var i = 0; i < str.Length; i++)
            ct[str[i] - 'a']++;
        foreach (var v in ct)
            res += v * (v - 1L) / 2;
        WriteLine(str.Length * (str.Length - 1L) / 2 - res + 1);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static string[] strs(int n)
        => Enumerable.Repeat(0, n).Select(_ => read).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n,m,s[2];
vector<P> g[2][100010];
ll d[2][100010];
ll res[100010];

int main(){
  cin>>n>>m>>s[0]>>s[1];
  s[0]--;s[1]--;
  rep(i,m){
    ll a,b,c,dd;
    cin>>a>>b>>c>>dd;
    a--;b--;
    g[0][a].push_back(P(b,c));
    g[0][b].push_back(P(a,c));
    g[1][a].push_back(P(b,dd));
    g[1][b].push_back(P(a,dd));
  }

  rep(i,2){
    rep(j,n)d[i][j]=INF;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s[i]));
    while(que.size()){
      P p=que.top(); que.pop();
      if(d[i][p.se]!=INF)continue;
      d[i][p.se]=p.fi;
      for(P e : g[i][p.se]){
        que.push(P(p.fi+e.se,e.fi));
      }
    }
  }

  res[n-1]=1e15-(d[0][n-1]+d[1][n-1]);
  for(int i=n-1;i>=1;i--)res[i-1]=max(res[i],1000000000000000-(d[0][i-1]+d[1][i-1]));

  rep(i,n)cout<<res[i]<<endl;

  return 0;
}


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

int main(){
	int n,L,R;
	int ans=2020;
	cin>>L>>R;
	n=R-L;
	for(int i=L;i<L+min(2019,n);i++){
		for(int j=i+1;j<=min(R,i+2019);j++){
			ans=min(((i%2019)*(j%2019))%2019,ans);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3524
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b - a - b + 1 << endl;
}


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

using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;

	if (a > b) {
		swap(a, b);
	}
    if (b > c) {
		swap(b, c);
	}
	if (a > b) {
		swap(a, b);
	}
	cout << a << " " << b << " " << c << endl;
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
void close(){
   	std::ios::sync_with_stdio(false);
   	std::cin.tie(0);
}
int a,b;

int dp[2005][2005];
int main(){
	cin>>a>>b;
	if(a>b){
		while(a--)
			cout<<b;
	}
	else {
		while(b--)
			cout<<a;
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var aho = Console.ReadLine().Split();
    if(aho[0] == aho[1]&&aho[1] == aho[2]){
      Console.WriteLine("No");
    }
    else if(aho[0] != aho[1]&&aho[0] != aho[2]&&aho[1] != aho[2]){
           Console.WriteLine("No");
    }
    else{
          Console.WriteLine("Yes");

    }
  }
}

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

using namespace std;

const int INF = numeric_limits<int>::max() / 2;

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

    int n;
    while(cin>>n,n){
        vector<int> a(n);
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a.begin(),a.end());
        int res=INF;
        for(int i=1;i<n;i++){
            if(a[i]-a[i-1]<res){
                res=a[i]-a[i-1];
            }
        }
        cout<<res<<endl;
    }
}

Measured memory_bytes: 3164
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N=int(input())
    A=list(map(int,input().split()))
    AS =sorted(A)
    right = AS[N//2]
    left = AS[N//2 -1]
    for a in A:
        if a<=left:
            print(right)
        else:
            print(left)




if __name__ == "__main__":
    main()


Measured memory_bytes: 105160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}

   

int main(){
  lint N;
  cin>>N;
  lint x[N];
  lint sum=0,ans=0;
  rep(i,N){
      cin>>x[i];
      x[i]-=(i+1);
  }
sort(x,x+N);
if(N%2==1)sum=x[N/2];
else sum=(x[N/2]+x[N/2-1])/2;
  rep(i,N){
      ans+=abs(x[i]-sum);
      
  }
  cout<<ans;


}

Measured memory_bytes: 1792
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++) {
            list.add(sc.nextInt());
        }
        int count = 0;
        boolean isContinue = true;

        ArrayList<Integer> numberSubList = list;
        while(isContinue) {
            ArrayList<Integer> numberSubSubList = new ArrayList<>();
            for(int number : numberSubList) {
                if(number % 2 == 0) {
                    numberSubSubList.add(number / 2);
                } else {
                    isContinue = false;
                    break;

                }

            }

            if(isContinue) {
                count++;
                numberSubList = new ArrayList<>(numberSubSubList);
            }

        }

        System.out.println(count);
    }
}

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

string s;

int main(){
  getline(cin, s);
  for(int i = 0; i < s.size(); i++){
    if(islower(s[i])) {
      s[i] = toupper(s[i]);
    }else if(isupper(s[i])) {
      s[i] = tolower(s[i]);
    }
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main(int argc,char* argv[])
{
    ll n,t,a,h,ans;
    cin>>n>>t>>a;
    double mi=LINF;
    rep(i,n){
        cin>>h;
        if(mi>abs(a-t+h*0.006))mi=abs(a-t+h*0.006),ans=i+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    A,B=[0]*N,[0]*N
    for i in range(N):
        A[i],B[i]=map(int,input().split())
    Bargsort=np.argsort(B)
    t=0
    for i in Bargsort:
        t+=A[i]
        if t>B[i]:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()


Measured memory_bytes: 29508
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

const int MOD = 1e9+7;

int msum(int a, int b) {
    return ((a%MOD) + (b%MOD)) % MOD;
}

int msub(int a, int b) {
    int res = ((a%MOD) - (b%MOD)) % MOD;
    if(res < 0) res += MOD;
    return res;
}

int mmul(int a, int b) {
    return ((a%MOD) * (b%MOD)) % MOD;
}

int mpow(int a, int n) {
    int res = 1;
    while(n > 0) {
        if(n & 1) res = mmul(res, a);
        a = mmul(a, a);
        n >>= 1;
    }
    return res;
}

int minv(int a) {
    return mpow(a, MOD-2);
}

int mdiv(int a, int b) {
    return (a%MOD) * minv(b) % MOD;
}


vvi edges(100050);

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

    if(n==1) {
        cout << k << endl;
        return 0;
    }
    int f = -1;
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        if(a < b) swap(a, b);
        a--; b--;
        if(f==-1) f = a;
        edges[a].pb(b);
        edges[b].pb(a);
    }

    int res = k;
    int one = true;
    queue<int> q;
    V(bool) visited(100050, false);
    visited[f] = true;
    q.push(f);
    while(!q.empty()) {
        int now = q.front();
        q.pop();
        int cnt = 0;
        if(one) {
            rep(i, edges[now].size()) {
                if(!visited[edges[now][i]]) {
                    q.push(edges[now][i]);
                    visited[edges[now][i]] = true;
                    res = mmul(res, k-1-cnt);
                    cnt++;
                }
            }
            one = false;
        } else {
            rep(i, edges[now].size()) {
            if(!visited[edges[now][i]]) {
                q.push(edges[now][i]);
                visited[edges[now][i]] = true;
                res = mmul(res, k-2-cnt);
                    cnt++;
            }
        }
        }
        
        
    }

    cout << res << endl;
    return 0;
}

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

using namespace std;
 
int main()
{
    int n, d;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> d;
        cout << "Case " << i+1 << ':' << endl;
        for (int j = 0; j < 10; j++) {
            d = d*d%100000000/100%10000;
            cout << d << endl;
        }
    }   
    return 0;
}

Measured memory_bytes: 3060
local n = io.read("*n", "*l")
local a, b = {}, {}
for i = 1, n do
  local s = io.read()
  a[i] = s:gsub("?", "a")
  b[i] = s:gsub("?", "z")
end
table.sort(a)
table.sort(b)
local t = io.read()
local min = n + 1
for i = n, 1, -1 do
  if b[i] < t then
    break
  else
    min = i
  end
end
local max = 1
for i = 1, n do
  if t < a[i] then
    break
  else
    max = i + 1
  end
end
for k = min, max do
  io.write(k)
  io.write(k == max and "\n" or " ")
end


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

using namespace std;

int arr[20];

int main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
	
    int n, k;
    
    cin >> n >> k;
    for(int i = 0; i < k; i++){
    	int x;
    	cin >> x;
    	arr[x] = 1;
	}
	
	for(int i = 1; i <= 99999; i++){
		string str = to_string(i);
		int len = str.size();
		bool flag = true;
		for(int j = 0; j < len; j++){
			if(arr[str[j] - '0']){
				flag = false;
				break;
			}
		}
		if(flag && i >= n){
			cout << i << endl;
			break;
		}
	}
   
    return 0;
}

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

int digit_cnt(long n){
  int count=0;
  while(n>0){
    n /= 10;
    count++;
  }
  
  return count;
}

int main(){
  long long N;
  cin>>N;
  
  int ans = 1e9;
  for(long long i=1;i<=sqrt(N);i++){
    if(N%i != 0) continue;
    long long A=i;
    long long B=N/A;
    int work = digit_cnt(max(A,B));
    ans = min(ans,work);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
X = [0] * N
sum_A = sum(A)
sum_subA = 0
for i in range(1, N, 2):
    sum_subA += 2 * A[i]
X[0] = sum_A - sum_subA
for i in range(1, N):
    X[i] = 2 * A[i - 1] - X[i-1]
print(*X)

Measured memory_bytes: 14024
N = int(input())
deme = [list(map(int, input().split())) for i in range(N)]

kotae = ["No"]
for i in range(N - 2):
    if deme[i][0] == deme[i][1] and deme[i + 1][0] == deme[i + 1][1] and deme[i + 2][0] == deme[i + 2][1]:
        kotae[0] = "Yes"

print(kotae[0])    

Measured memory_bytes: 9192