akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		while(true){
			Point tri[] = new Point[3];
			for(int i = 0; i < 3; i++){
				tri[i] = new Point();
			}
			Point s = new Point();
			s.x = 1.0;
			s.y = 0.0;
			
			int n = 8;
			String c = br.readLine();
			if(c.equals(""))break;
			
			for(int i = 0; i < 8; i++){
				if(c.indexOf(" ") !=  -1){
					String str = c.substring(0, c.indexOf(" "));
					if(i < 6){
						if(i%2==0){
							tri[i/2].x = Double.parseDouble(str);
						}
						else
							tri[i/2].y = Double.parseDouble(str);
						c = c.substring(c.indexOf(" ") + 1);
					}

					else{
						s.x = Double.parseDouble(str);
						c = c.substring(c.indexOf(" ") + 1);
					}
				}
				else{
					s.y = Double.parseDouble(c);
				}
			}
			
			boolean f = true;
			boolean gyaku = false;
			for(int i = 0; i < 3; i++){
				if(!tri[(i+2)%3].isLeft(tri[i%3],tri[(i+1)%3])){
					gyaku = true;
					break;
				}
				if(!s.isLeft(tri[i],tri[(i+1)%3])){
					f = false;
				}
			}

			if(gyaku){
				for(int i = 2; i >= 0; i--){
					/*if(!tri[(i+1)%3].isLeft(tri[i],tri[i%3])){
						System.out.println("gyaku break");	
						break;
					}*/

					if(!s.isLeft(tri[i], tri[(i+2)%3])){
						f = false;
					}
				}
			}
				if(f)
					System.out.println("YES");
				else
				System.out.println("NO");
			
			
			
		}
	}
}

final class Point{
	public double x;
	public double y;

	public boolean isLeft(Point p, Point q) {
	// ÀµÄ­¾³¢
	// xNg p -> q ÆxNg p -> this Ì¬·½slÓ`Ì
	// tÊÏª³ÈçÎ true »¤ÅÈ¯êÎfalse ðÔ·B
	// tÊÏÌvZÉÍºÌ\bh signedArea ðp¢éB

	// xNgp -> qÍ(q.x-p.x , q.y-p.y)Å è
	// xNgp -> thisÍ(this.x-p.x , this.y-p.y)Å é
	// ±ÌñÂÌxNgª¬·½slÓ`ÌtÊÏðvZµÄ
	// »êª³ÈçtrueAÈçÎfalseðÔ·
	if(signedArea(q.x-p.x, q.y-p.y, this.x-p.x, this.y-p.y) > 0){
		return true;
	}
	else
		return false;
	}
	public double signedArea(double x1, double y1, double x2, double y2) {
	return x1 * y2 - x2 * y1;
	}


	}

Measured memory_bytes: 9836
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

/*-------------------Define Start-------------------*/
typedef bool BL;                        // 布尔类型
typedef char SB;                        // 有符号1字节,8位
typedef unsigned char UB;                // 无符号1字节,8位
typedef short SW;                        // 有符号短整型,16位
typedef unsigned short UW;                // 无符号短整型,16位
typedef long SDW;                        // 有符号整型,32位
typedef unsigned long UDW;               // 无符号整型,32位
typedef long long SLL;                    // 有符号长整型,64位
typedef unsigned long long ULL;            // 无符号长整型,64位
typedef char CH;                        // 单个字符
typedef float R32;                        // 单精度浮点数
typedef double R64;                        // 双精度浮点数

#define Rep(i, n) for (register SDW i = 0; i < (n); ++i)
#define For(i, s, t) for (register SDW i = (s); i <= (t); ++i)
#define rFor(i, t, s) for (register SDW i = (t); i >= (s); --i)
#define foreach(i, c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,0x7f,sizeof(a))
#define LOWBIT(x) ((x)&(-x))

#define MP make_pair
#define PB push_back
#define ft first
#define sd second
#define ALL(x) x.begin(),x.end()

#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl

#define lson l , mid , rt << 1 
#define rson mid + 1 , r , rt << 1 | 1

const ULL mod = 1e9 + 7;                //常用模数(可根据题目需要修改)
const ULL inf = 0x7fffffff;                //用来表示无限大
const ULL infLL = 0x7fffffffffffffffLL;    //用来表示无限大
/*-------------------Define End-------------------*/

const UDW maxN = 5e5 + 7;
SDW N, Q;
string S; 
SDW ans;

void output();

SDW st[maxN << 2];
    
inline void pushUp(SDW rt) {
    st[rt] = st[rt << 1] | st[rt << 1 | 1];
}

inline void build(SDW l, SDW r, SDW rt) {
    if(l >= r) {
        st[rt] = (1 << (S[r] - 'a'));
        return;
    }
    SDW mid = (l + r) >> 1;
    build(lson);
    build(rson);
    pushUp(rt);
}

// 单点更新 
inline void update(SDW x, SDW y, SDW l, SDW r, SDW rt) {
    if(l >= r) {
        st[rt] = y;
        return;
    }
    SDW mid = (l + r) >> 1;
    if(x <= mid) update(x, y, lson);
    else update(x, y, rson);
    pushUp(rt);
}

// 区间查询 
inline SDW query(SDW L, SDW R, SDW l, SDW r, SDW rt) {
    if(L <= l && r <= R) return st[rt];
    SDW ret = 0;
    SDW mid = (l + r) >> 1;
    
    if(L <= mid) ret |= query(L, R, lson);
    if(R > mid) ret |= query(L, R, rson);
    return ret;
}

void input(){
	cin >> N >> S >> Q;
	S = "#" + S;
	build(1, N, 1);
}

void solve(){
	SDW mode;
	
	Rep(i, Q) {
		cin >> mode;
		if(mode == 1) {
			SDW x;
			CH y;
			cin >> x >> y;
			update(x, (1 << (y - 'a')), 1, N, 1);
		}
		else if(mode == 2) {
			SDW x, y;
			cin >> x >> y;
			ans = query(x, y, 1, N, 1);
			ans = __builtin_popcount(ans);
			output();
		}
	}
}

void output(){
    cout << ans << endl;
}

int main() {
    input();
    solve();
    return 0;
}


Measured memory_bytes: 11160
x, k, d = map(int, input().split())
if x == 0:
    if k % 2 == 0:
        print(0)
    else:
        print(d)
else:
    a = abs(x) // d
    b = abs(x) % d
    if a >= k:
        print(abs(x) - (d * k))
    else:
        if (k - a) % 2 == 0:
            print(abs(b))              
        else:
            print(abs(b - d))

Measured memory_bytes: 9032
#include <stdio.h>

long long a,b,c;

int main()
{
	scanf ("%lld %lld %lld",&a,&b,&c);

	for (int t=0;t<10000;t++){
		if (a % 2 || b % 2 || c % 2){
			printf ("%d\n",t);
			return 0;
		}
		long long p = (b + c) / 2;
		long long q = (c + a) / 2;
		long long r = (a + b) / 2;
		a = p; b = q; c = r;
	}
	puts("-1");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <array>
#include <list>
#include <math.h>
using namespace std;

/* 
素因数分解
AOJ NTL_1_A Accepted
*/

// global var
const int max_n = 1000000000;
const int array_size = (int)(sqrt(max_n)) + 1;
const int check_p = (int)(sqrt(sqrt(max_n))) + 1;
array <int, array_size> is_prime;
list <int> prime_number;

// Sieve of Eratosthenes
void eratosthenes ()
{
    // init
    for (int i=0; i<array_size; ++i){
        if(i < 2 || (i % 2 == 0 && i != 2) || (i % 3 == 0 && i != 3)){
            is_prime[i] = 0;
        }
        else  {
            is_prime[i] = 1;
        }
    }
    int itr = 0;
    while(itr <= check_p){
        if(is_prime[itr]){
            prime_number.push_back(itr);
            for (int i=2; itr*i<=array_size; ++i){
                is_prime[itr*i] = 0;
            }
        }
        itr++;
    }
    for(int i=itr; i<array_size; ++i){
        if(is_prime[i]){
            prime_number.push_back(i);
        }
    }
    /*
    int j=0;
    for(auto itr=prime_number.begin(); itr!=prime_number.end(); ++itr){
        cout << ++j << ":" << *itr << endl;
    }
    */
}

int main()
{
    eratosthenes();
    int n, output_num;
    output_num = 0;
    cin >> n;
    for(auto itr=prime_number.begin(); itr != prime_number.end(); itr++){
        if(*itr % 10 == 1){
            cout << *itr;
            output_num++;
            if(output_num < n){
                cout << " ";
            }
            else {
                break;
            }
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    a,b=map(int,input().split())
    if a>=13:
        print(b)
    elif a>=6:
        print(b//2)
    else:
        print(0)
    

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 8964
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; k < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#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 pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int Q,H,S,D;
  int N;
  cin >> Q >> H >> S >> D;
  cin >> N;
  ll cost1L = min(Q*4,min(H*2,S));
  ll cost2L = min((ll)D,cost1L*2);
  if(N % 2 == 0) {
    cout << (N/2) * cost2L << endl;
  } else {
    cout << (N/2) * cost2L + cost1L << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
char arr[n][n];
char arr1[m][m];
    for(int i=0; i<n; i++)
        scanf("%s",arr[i]);
 
    for(int i=0; i<m; i++)
        scanf("%s",arr1[i]);
 
 
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            int cnt=0;
            for(int a=0; a<m; a++)
            {
                for(int b=0; b<m; b++)
                {
                    if(arr1[a][b]==arr[i+a][j+b])
                        cnt++;
                }
 
            }
            if(cnt==(m*m))
            {
                printf("Yes\n");
                return 0;
            }
 
        }
    }
    printf("No\n");
 
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
struct Vector {
	double x;
	double y;
};

struct Vector sub_vector(struct Vector *a, struct Vector *b) {
	struct Vector ret;
	ret.x = a->x - b->x;
	ret.y = a->y - b->y;
	return ret;
}

int main(void)
{
	struct Vector a1, b2, c3, dp;
	struct Vector vecAB,vecBP, vecBC,vecCP,vecCA,vecAP;
	double c0, c1, c2;

	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a1.x,&a1.y,&b2.x,&b2.y,&c3.x,&c3.y,&dp.x,&dp.y) != EOF) {

		vecAB = sub_vector(&b2,&a1);
		vecBP = sub_vector(&dp, &b2);

		vecBC = sub_vector(&c3, &b2);
		vecCP = sub_vector(&dp, &c3);

		vecCA = sub_vector(&a1, &c3);
		vecAP = sub_vector(&dp, &a1);

		c0 = vecAB.x * vecBP.y - vecAB.y * vecBP.x;
		c1 = vecBC.x * vecCP.y - vecBC.y * vecCP.x;
		c2 = vecCA.x * vecAP.y - vecCA.y * vecAP.x;

		if ((c0 > 0 && c1 > 0 && c2 > 0) || (c0 < 0 && c1 < 0 && c2 < 0))
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   string t;
   cin>>s>>t;
   int n=s.length();
   int r=t.length();
   int arr[n+1][r+1];
   for(int i=0;i<=n;i++)
   {
       for(int j=0;j<=r;j++)
       {
           if(i==0 || j==0)
           {
               arr[i][j]=0;
           }
           else
           {
              if(s[i-1]==t[j-1])
              {
                  arr[i][j] = arr[i-1][j-1]+1;
              }
              else
              {
                  arr[i][j] = max(arr[i-1][j],arr[i][j-1]);
              }

           }
       }
   }
   int i=n,j=r;
   stack<char> s1;
   while(i>0 && j>0)
   {
       if(s[i-1]==t[j-1])
       {
           s1.push(s[i-1]);
           i--;
           j--;
       }
       else if(arr[i-1][j]>arr[i][j-1])
       {
           i--;
       }
       else
       {
           j--;
       }
   }
   while(!s1.empty())
   {
       cout<<s1.top();
       s1.pop();
   }
}


Measured memory_bytes: 35456
#include<stdio.h>
int main(void)
{
    int n,k,x[100],i,j,s=0;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
        scanf("%d",&x[i]);
    for(i=0;i<n;i++){
        j=k-x[i];
        if(j<0) j=-j;
        if(x[i]<=j)
            s+=x[i]*2;
        else 
            s+=j*2;
    }
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    VL a(n);
    REP(i,n) scanf("%lld", &a[i]);
    ll ans1 = 0, ans2 = 0;

    VL b(a);
    if (a[0] <= 0){
        ans1 += 1-a[0];
        a[0] = 1;
    }
    ll s = a[0];
    FOR(i,1,n-1){
        s += a[i];
        if (i % 2 == 1 && s >= 0){
            ans1 += s + 1;
            s = -1;
        }else if (i % 2 == 0 && s <= 0){
            ans1 += 1 - s;
            s = 1;
        }
    }

    a = b;
    if (a[0] >= 0){
        ans2 += a[0]+1;
        a[0] = -1;
    }
    s = a[0];
    FOR(i,1,n-1){
        s += a[i];
        if (i % 2 == 0 && s >= 0){
            ans2 += s + 1;
            s = -1;
        }else if (i % 2 == 1 && s <= 0){
            ans2 += 1 - s;
            s = 1;
        }
    }

    cout << min(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner

import scala.io.StdIn._
object Main extends App {

  val Array(a,b,h,m) = scala.io.StdIn.readLine().split(" ").map(_.toInt)

  def solve() = {
    val angle = 360 * { (h.toDouble + m.toDouble/60) / 12 - m.toDouble/60 }
    Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(angle.toRadians))
  }

  println(solve())

}



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

using namespace std;

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

    vector<unsigned long long int> x;
    for (unsigned long long int i = 0; i < n; i++) {
        unsigned long long int tmp;
        cin >> tmp;
        x.push_back(tmp);
    }

    vector<unsigned long long int> ans = x;
    sort(ans.begin(), ans.end(), greater<int>());
    for (unsigned long long int i = 0; i < n; i++) {
        if (x[i] > ans[n/2]) {
            cout << ans[n/2] << endl;
        } else {
            cout << ans[n/2-1] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 5488
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
#define PI  acos(-1)
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;


signed main(){
  int N;cin>>N;
  vector<int> arr1(N), arr2(N), arr3(N);
  REP(i,0,N)cin>>arr1[i];
  arr2[0]=arr1[0];arr3[N-1]=arr1[N-1];
  REP(i,1,N)arr2[i]=arr2[i-1]+arr1[i];
  RREP(i,N-2,-1)arr3[i]=arr3[i+1]+arr1[i];
  int ans=INF;
  REP(i,0,N-1){
    ans=min(ans,abs(arr2[i]-arr3[i+1]));
  }
  print(ans);
}


Measured memory_bytes: 4992
n = int(input())

ls = []
for _ in range(n):
    x, l = map(int, input().split())
    ls.append([x-l, x+l])
ls.sort(key=lambda x: x[1])

ans = n
for i in range(1, n):
    if ls[i][0] < ls[i-1][1]:
        ls[i][1] = ls[i-1][1]
        ans -= 1
print(ans)


Measured memory_bytes: 25516
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
a = I[1:]

def main():
    c = np.bincount(a) 
    tot = np.sum(c * (c - 1) // 2)
    res = tot - (c[a] - 1)
    return res
        
if __name__ == "__main__":
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 32540
while 1:
  a, b = map(int, input().split())
  
  if a==0 and b==0:
    break
  
  for i in range(a//2):
    
    for j in range(b//2):
      print("#.", end="")
    for k in range(b%2):
      print("#", end="")
    print()
    
    for j in range(b//2):
      print(".#", end="")
    for k in range(b%2):
      print(".", end="")
    print()
    
  for i in range(a%2):
    for j in range(b//2):
      print("#.", end="")
    for k in range(b%2):
      print("#", end="")
    print()

  print()


Measured memory_bytes: 6388
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N; cin >>N;
  vector<int> c(N * 2);
  REP(i, N * 2) c[i] = i + 1;
  int M; cin >>M;
  REP(i, M){
    int k; cin >>k;
    //cout <<k <<": "; REP(i, N * 2) cout <<c[i] <<", "; cout <<" -> ";
    vector<int> next(N * 2, -1);
    if(k == 0){
      REP(i, N){
        next[i * 2] = c[i];
        next[i * 2 + 1] = c[i + N];
      }
    } else{
      for(int a = 0, b = N * 2 - k; a < k; ++a, ++b) next[b] = c[a];
      for(int a = k, b = 0; a < N * 2; ++a, ++b) next[b] = c[a];
    }
    c = next;
    //REP(i, N * 2) cout <<c[i] <<", "; cout <<endl;
  }
  REP(i, N * 2) cout <<c[i] <<endl;
  return 0;
}

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

#define endl '\n'



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

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int l = a + b;
    int r = c + d;
    if(l == r) {
        cout << "Balanced";
    }
    else if(l > r) {
        cout << "Left";
    }
    else {
        cout << "Right";
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#define l(x) (x<<1)
#define r(x) ((x<<1)+1)
#define IL inline
#define reg register
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;

int n,i,x;
int p[5],u[5],s[2][200010];
char c[200010];

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL int Max(int a,int b){return (a>b)?a:b;}

IL int read(){
	int p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

IL int Cal(int x){
	int cnt=0,y=0,t=0;
	while (x){
		y=0;	t=x;
		while (x){y+=(x&1);	x/=2;}
		cnt++;	x=t%y;
	}
	return cnt;
}

IL void Ready(){
	int i=0,j=0;
	p[0]=x-1;	p[1]=x+1;
	if (p[0]>0)
	for (i=0,j=1;i<n;i++,j=(j<<1)%p[0]){
		s[0][i]=j;
		if (c[i]=='1')	u[0]=(u[0]+j)%p[0];
	}
	if (p[1]>0)
	for (i=0,j=1;i<n;i++,j=(j<<1)%p[1]){
		s[1][i]=j;
		if (c[i]=='1')	u[1]=(u[1]+j)%p[1];
	}
}

IL int Work(int no,int f){
	if (!f){
		return 1+Cal((u[1]+s[1][no])%p[1]);
	}	else {
		if (p[0]==0)	return 0;
		else return 1+Cal((u[0]-s[0][no]+p[0])%p[0]);
	}
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	n=read();
	scanf("%s",&c);
	char s=0;
	for (i=0;i<n;i++)	x+=c[i]-48;
	for (i=0;n-i-1>i;i++){
		s=c[i];	c[i]=c[n-i-1];	c[n-i-1]=s;
	}
	if (x==0){
		for (i=1;i<=n;i++)	puts("1");
		return 0;
	}
	Ready();
	for (i=n-1;i>=0;i--){
		if (c[i]=='0')	printf("%d\n",Work(i,0));
		else printf("%d\n",Work(i,1));
	}
	return 0;
}

Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,w,a,b;
ll dp[100007];
int main()
{
	cin>>n>>w;
	for(int i=0;i<=100000;i++) dp[i]=1e18;
    dp[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b;
		for(int j=100000;j>=b;j--)
		{
			dp[j]=min(dp[j],dp[j-b]+a);
		}
	}
	int ans=0;
	for(int i=0;i<=100000;i++)
	{
		if(dp[i]<=w) ans=i;
	}
	cout<<ans;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define N 3002
int f[N][N], n, ans;
char c[N];
int main() {
    scanf("%d%s", &n, c + 1);
    f[1][1] = 1;
    for (int i = 2; i <= n; i++) {
        if (c[i - 1] == '<')
            for (int j = 2; j <= i; j++)
                f[i][j] = (f[i][j - 1] + f[i - 1][j - 1]) % mod;
        else
            for (int j = i - 1; j; j--)
                f[i][j] = (f[i][j + 1] + f[i - 1][j]) % mod;
    }
    for (int i = 1; i <= n; ++i) ans = (ans + f[n][i]) % mod;
    printf("%d\n", ans);
    return 0;
}

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

const ll inf = 1ll << 60ll;
ll n, m;
vector<pair<ll, ll> > g[100005];
ll min_cost[100005];

int main() {
	cin >> n >> m;
	
	for (int i = 1; i < n; i++) {
		g[i + 1].push_back({0, i});
	}
	
	for (int i = 1; i <= n; i++) {
		min_cost[i] = inf;
	}
	
	for (int i = 0; i < m; i++) {
		ll s, t, c;
		
		cin >> s >> t >> c;
		g[s].push_back({c, t});
	}
	
	priority_queue<pair<ll, ll>, vector<pair<ll, ll> >, greater<pair<ll, ll> > > p_que;
	
	p_que.push({0, 1});
	min_cost[1] = 0;
	while (!p_que.empty()) {
		ll pos = p_que.top().second;
		ll cos = p_que.top().first;
		p_que.pop();
		
		for (int i = 0; i < g[pos].size(); i++) {
			ll npos = g[pos][i].second;
			ll ncos = cos + g[pos][i].first;
			
			if (min_cost[npos] > ncos) {
				min_cost[npos] = ncos;
				p_que.push({ncos, npos});
			}
		}
	}
	
	if (min_cost[n] == inf) cout << -1 << endl;
	else cout << min_cost[n] << endl;
	
	return 0;
}

Measured memory_bytes: 10104
#! /usr/local/bin/python3
# coding: utf-8

from sys import setrecursionlimit

setrecursionlimit(21)


class Node():
    def __init__(self, parent=-1, child=[]):
        self.parent = parent
        self.child = child


def node_depth(u, id):
    if u[id].parent == -1:
        return 0
    else:
        return node_depth(u, u[id].parent) + 1


def node_type(u, id):
    if u[id].parent == -1:
        return "root"
    elif u[id].child == []:
        return "leaf"
    else:
        return "internal node"


def main():
    n = int(input())
    u = [Node() for _ in range(n)]

    for _ in range(n):
        id, _, *child = (int(x) for x in input().split())
        u[id].child = child
        for c in child:
            u[c].parent = id

    for id in range(n):
        print("node {}: parent = {}, depth = {}, {}, {}".
              format(id, u[id].parent,
                     node_depth(u, id), node_type(u, id),
                     u[id].child))


if __name__ == '__main__':
    main()



Measured memory_bytes: 38224
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

string s;
ll a,b;
const ll m=8003;

void solve(){
 cin >> s >> a >> b;
 vector<bitset<16005>> dp(2);
 dp[0].set(m);
 dp[1].set(m); 
  
 vvll d(2); 
  
 ll flag=0;
 ll n=s.size();
  for(int i=0;i<n;){
     ll cnt=0;
   while(i<n&&s[i]=='F') {
     cnt++;
     i++;
   }
    d[flag].eb(cnt);
   while(i<n&&s[i]=='T') {
     flag=1-flag;
     i++; 
   }
  }
   
  rep(i,0,2){
    rep(j,0,d[i].size()){
      bitset<16005> mask;
      swap(mask,dp[i]);
    rep(k,0,16005){
     if(mask[k]){ 
       if(k+d[i][j]<16005) dp[i].set(k+d[i][j]);
       if(k-d[i][j]>=0&&(i!=0||j!=0)) dp[i].set(k-d[i][j]);
     }
    }
    }
  }
  
  if(dp[0][m+a]&&dp[1][m+b]) cout << "Yes" << endl;
  else cout << "No" << endl;
 
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

Measured memory_bytes: 384
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: usize1,
        b: usize1,
        c: usize1,
        d: usize1,
        s: chars,
    }

    let mut between_flag = false;
    let mut ans = true;

    for i in a..max(c, d) {
        if format!("{}{}", s[i], s[i+1]) == "##" {
            ans = false
        }
    }
    if d < c {
        for i in b..d+1 {
            if format!("{}{}{}", s[i-1], s[i], s[i+1]) == "..." {
                between_flag = true
            }
        }
        if !between_flag {
            ans = false;
        }
    }
    println!("{}", if ans { "Yes" } else { "No" })
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))

const ll mod = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);

	vector<ll> a,b;ll p=0,n=0,z=0;
	ll m,k;cin>>m>>k;
	forn(i,m){ll x;cin>>x;if(x<0)a.pb(-1*x);else if(x>0)b.pb(x);else z++;}
	n=a.size();p=b.size();
	sort(all(a));reverse(all(a));
	sort(all(b));reverse(all(b));

	if(k > n+p){cout<<0<<endl;return 0;}

    ll jx = min(k,p);
    ll ix = k-jx;
    ll ans =1;
	if(ix%2 == 1)jx--,ix++;

	if(jx>=0 && ix<=n)
	{
		while(jx>=2 && ix<=n-2){
			ll s = b[jx-1]*b[jx-2] ;
			ll t=a[ix]*a[ix+1];
			if(s<=t)jx-=2,ix+=2;
			else break;
		}
		ans =1;
		forn(i,ix){ans*=a[i];ans%=mod;}
		forn(i,jx){ans*=b[i];ans%=mod;}
		cout<<ans<<endl;
		return 0;
	}

	if(z!=0){cout<<0<<endl;return 0;}

	reverse(all(a));reverse(all(b));
	jx=min(k,p);ix=k-jx;
	if(ix%2==0)jx--,ix++;

	while(jx>=2 && ix<=n-2){
			ll s = b[jx-1]*b[jx-2] ;
			ll t=a[ix]*a[ix+1];
			if(s>=t)jx-=2,ix+=2;
			else break;
		}
	ans =1;
	forn(i,ix){ans*=a[i];ans%=mod;}
	forn(i,jx){ans*=b[i];ans%=mod;}
	cout<<mod-ans<<endl;


}



Measured memory_bytes: 5484
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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


string s, t;
int ans = 1000000;

int main() {

	cin >> s >> t;

	rep(i, s.size() - t.size() + 1){
		int cnt = 0;
		rep(j, t.size()){
			if (s[i + j] != t[j])cnt++;
		}
		ans = min(ans, cnt);
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3616
using System;

public class Problem_C
{
  public static void Main(string[] args)
  {
    var nums = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    int a = nums[0], b = nums[1], c = nums[2];

    var m = Math.Max(a, Math.Max(b, c));
    var sum = a + b + c;
    if ((3 * m) % 2 == sum % 2) Console.WriteLine($"{((3 * m) - sum) / 2}");
    else Console.WriteLine($"{(3 * (m + 1) - sum) / 2}");
  }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
//#define N 110
//#define M 61
//#define MOD 100003
//vector <pair<int,int> > edge[M];
//int d[N][N];
//priority_queue <pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >q;
//queue <int> q;
//ll cnte[N];
//int ans=0;
//vector <int> edge[N];
//int arr[N];
void solve()
{
	string s;
	cin>>s;
	for (int i=0;i<3;i++)
		cout<<s[i];
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	int t;
//	cin>>t;
//	while (t--)
		solve();
	return 0;
} 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef ONLINE_JUDGE
#define debug(x) {}
#else
#define debug(x) { cerr << #x << " = " << x << endl; }
#endif
int rs;

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  int a[3];
  for(a[0] = 0; a[0]<=9; ++a[0]){
    for(a[1] = 0; a[1]<=9; ++a[1]){
      for(a[2]=0; a[2]<=9; ++a[2]){
        int seen = 0;
        for(int i=0; i<s.size(); ++i){
          if(s[i] - '0' == a[seen]) seen++;
          if(seen == 3) break;
        }
        if(seen == 3) rs++;
      }
    }
  }
  cout<<rs<<'\n';
	return 0;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 20:41:10 2020

@author: Kanaru Sato
"""

n,m =list(map(int, input().split()))

a = list(map(int, input().split()))

s = 0
for i in range(m):
    s += a[i]

if s <= n:
    print(n-s)
else:
    print(-1)

Measured memory_bytes: 10048
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CWalkOnMultiplicationTable {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        int res = INF;
        for (int i = 1; i * i <= N; i++) {
            if (N % i != 0) continue;
            int j = N / i;
            res = min(res, i - 1 + j - 1);
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CWalkOnMultiplicationTable solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long
#define mod 1000000007

double A,B,H,M,ar,br;
double pi=3.14159265358979323;

int main() {
	cin>>A>>B>>H>>M;
	br=M/30.0*pi;
	ar=(H/6.0+M/360.0)*pi;
	double rd=abs(ar-br);
	double ans=cos(rd);
	ans=A*A+B*B-2*A*B*ans;
	ans=sqrt(ans);
	cout<<setprecision(20)<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4136
N, M, C = [int(e) for e in input().split(" ")]
Bs = [int(e) for e in input().split(" ")]
count = 0
for _ in range(N):
    As = [int(e) for e in input().split(" ")]
    d = sum([a*b for a, b in zip(As, Bs)]) + C
    if d > 0:
        count = count + 1
print(count)




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

const int INF = 1000000000;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int l = -1, r = -1;
    
    for(int i = 2; i < n; i++){
        set<char> st;
        st.insert(s[i - 2]);
        st.insert(s[i - 1]);
        st.insert(s[i]);
        if((int)st.size() < 3){
            l = i - 1;
            r = i + 1;
        }
    }
    if(n == 2){
        if(s[0] == s[1])l = 1, r = 2;
    }
    cout << l << " " << r << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define FORR(i, m, n) for (ll i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<ll> a(n),b(n);
    REP(i,n){
        cin >> a[i];
    }
    REP(i,n){
        cin >> b[i];
    }
    ll u=0,v=0;
    REP(i,n){
        if(a[i]>b[i]){
            u+=a[i]-b[i];
        }
        if(a[i]<b[i]){
            v+=(b[i]-a[i])/2;
        }
    }
    cout << (u<=v?"Yes":"No") << endl;
}

Measured memory_bytes: 3804
#include<stdio.h>
int main(void){
	int N,M,ze[100],i,j,x;
	scanf("%d %d",&N,&M);
	for(i=0;i<N;i++){
		scanf("%d",&ze[i]);
	}
	for(j=1;j<=M;j++){
		for(i=0;i<N-1;i++){
			if(ze[i]%j>ze[i+1]%j){
				x=ze[i];
				ze[i]=ze[i+1];
				ze[i+1]=x;
			}
		}
	}
	for(i=0;i<N;i++){
		printf("%d\n",ze[i]);
	}
	return 0;
}

Measured memory_bytes: 596
from math import ceil 
A, B = map(int,input().split())
def non_taxed_price_8(x):
    min_8 = x*12.5
    Max_8 = (x+1)*12.5
    eight = set(range(ceil(min_8), ceil(Max_8)))
    return eight

def non_taxed_price_10(x):
    min_10 = x*10
    Max_10 = (x+1)*10
    ten = set(range(ceil(min_10), ceil(Max_10)))
    return ten

a = non_taxed_price_8(A)
b = non_taxed_price_10(B)

r = a&b
if len(r) == 0:
    print(-1)
else:
    print(min(list(r)))


Measured memory_bytes: 3064
using System;

using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        //整数の入力
        //int N = int.Parse(Console.ReadLine());

        // 複数の入力
        string[] line = Console.ReadLine().Split(' ');
        int N = int.Parse(line[0]);
        int X = int.Parse(line[1]);
        int T = int.Parse(line[2]);

        Console.WriteLine(Math.Ceiling((double)N / X) * T);





        //スペース区切りの整数の入力
        //string[] dates = Console.ReadLine().Split(' ');
        //string[] amounts = Console.ReadLine().Split(' ');

        //double date = double.Parse(input[0]);
        //double amount = double.Parse(input[1]);

        //double date = double.Parse(input[0]);
        //double amount = double.Parse(input[1]);

        //var L2 = L.Distinct().OrderBy(o => o);
        //var L2 = L.OrderBy(o => o).ToArray();

        //string input = Console.ReadLine();
        //int b = int.Parse(input[0]);
        //int c = int.Parse(input[1]);
        //文字列の入力
        //string s = Console.ReadLine();
        //出力




        //onsole.WriteLine(N);
        //Console.WriteLine(string.Join(" ", L));


        //for (int i = 1; i < N; i++)
        //{
        //    for (int j = i - 1; j > 0; j--)
        //    {
        //        if (amounts[i] >= amount)
        //        Console.WriteLine(double.Parse(amounts[i]));
        //    }
        //}

        //for (int i = 0; i < K; i++)
        //{
        //    if(D / 10  X)

        //    if(now > 0)
        //    {
        //        now -= D;
        //    }
        //    else
        //    {
        //        now += D;
        //    }

        //    //Console.WriteLine(now);
        //}

        //Console.WriteLine(Math.Abs(now));
    }
}




Measured memory_bytes: 27588
fh=STDIN
while fh.gets do
  reg = Regexp.new("[\+\=]")
  s=$_.chomp.split(reg)
  t =("0".."9").to_a.select { |x|
    s0=s[0].gsub(/X/,x)
    s1=s[1].gsub(/X/,x)
    s2=s[2].gsub(/X/,x)
    s0==s0.to_i.to_s and s1==s1.to_i.to_s and s2==s2.to_i.to_s and s0.to_i + s1.to_i == s2.to_i}
  puts (t.length==0) ? "NA" : t[0]
end

Measured memory_bytes: 9552
def multiple_gift(X: int, Y: int) -> int:
    n = X
    count = 0
    while n <= Y:
        n <<= 1
        count += 1
    return count


if __name__ == "__main__":
    X, Y = map(int, input().split())
    ans = multiple_gift(X, Y)
    print(ans)


Measured memory_bytes: 2940
package main

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

func getNextWord(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextWord(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	aa := make([]int, n)
	bb := make([]int, n)
	k := 10000
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	countingSort(aa, bb, k)
	fmt.Fprintln(writer, strings.Trim(fmt.Sprintf("%v", bb), "[]"))

	writer.Flush()
}

func countingSort(aa, bb []int, k int) {
	n := len(aa)
	cc := make([]int, k+1)
	for i := 0; i < n; i++ {
		cc[aa[i]]++
	}
	for i := 1; i <= k; i++ {
		cc[i] += cc[i-1]
	}
	for i := n - 1; i >= 0; i-- {
		bb[cc[aa[i]]-1] = aa[i]
		cc[aa[i]]--
	}
}



Measured memory_bytes: 68312
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const A = parseInt(args[0][0], 10)
	const B = parseInt(args[0][1], 10)
	const X = parseInt(args[0][2], 10)
	if (A <= X && A + B >= X) console.log('YES')
	else console.log('NO')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		100000									// 最大配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// ソート関数 - int降順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// 降順
	if (*lipVal1 >  *lipVal2) {
		return(-1);
	}
	else if (*lipVal1 < *lipVal2) {
		return(1);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 配列数取得
	int liACnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &liACnt);

	// 配列取得
	int li1Array[D_ARRAY_MAX];
	for (i = 0; i < liACnt; i++) {
#ifdef D_TEST
		fscanf(szpFpT, "%d", &li1Array[i]);
#else
		fscanf(stdin, "%d", &li1Array[i]);
#endif
	}
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif

	// ソート
	qsort(li1Array, liACnt, sizeof(int), fSortFnc);

	// 辺取得
	int liCnt = 0;
	int li1Edge[2];
	for (i = 1; i < liACnt; i++) {

		// １つ前と比較
		if (li1Array[i] != li1Array[i - 1]) {		// 不一致
			continue;
		}

		// 辺セット
		li1Edge[liCnt] = li1Array[i];
		liCnt++;

		// １つ次へ
		i++;

		// 辺数
		if (liCnt == 2) {
			break;
		}
	}

	// 面積
	long long llArea = 0;
	if (liCnt == 2) {
		llArea = (long long)li1Edge[0] * (long long)li1Edge[1];
	}

	// 結果セット
	sprintf(lc1Out, "%lld\n", llArea);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
   ll a, b, x; cin >> a >> b >> x;
   ll aa = 0, bb = 0;
   bb = b / x;
   if(a == 0) aa = -1;
   else aa = (a - 1) / x;
   cout << bb - aa << endl;
}


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


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = float('inf')

    # See:
    # https://atcoder.jp/contests/s8pc-4/submissions/2122030
    if n == 1:
        print(0)
        exit()

    for bit in range(1 << (n - 1)):
        color_count = 1
        cost = 0
        height_min = a[0]

        for j in range(n - 1):
            if height_min < a[j + 1]:
                color_count += 1
                height_min = a[j + 1]
                continue

            if bit & (1 << j):
                cost += height_min - a[j + 1] + 1
                color_count += 1
                height_min += 1

        if color_count >= k:
            ans = min(ans, cost)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include<iomanip>
using namespace std;

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

int main()
{
   int N,M;
   cin>>N>>M;
   int p[M];
   vector<string> S(M);
   for(int i= 0;i<M;i++)
   {
       cin>>p[i]>>S[i];
   }
   int acCount = 0;
   int waSum = 0;
   int waCount[N] = {0};
   bool acFlag[N] = {false};

   for(int i=0;i<M;i++)
   {
       if(acFlag[p[i]-1]==true)
       {
           
       }
       else
       {
           if(S[i] == "WA")
           {
               waCount[p[i]-1]++;
           }
           else
           {
               acCount++;
               acFlag[p[i]-1]=true;
           }
       }
   }

   for(int i=0;i<N;i++)
   {
       if(acFlag[i]==true)
       {
           waSum+=waCount[i];
       }

   }
   cout<<acCount<<" "<<waSum<<endl;

}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define vi vector<ll>
#define all(v) v.begin(), v.end()

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

	ll n = 0, a = 0, b = 0;
	cin >> n >> a >> b;
	ll cost1 = n * a;
	cout << min(cost1, b) << endl;
	//cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 256
N, *L,  = [list(map(int, s.split())) for s in open(0)]
L = L[0]
minj = 0
for l in L:
    if l == minj + 1:
        minj = l
if minj == 0:
    print(-1)
else:
    print(len(L) - minj)

Measured memory_bytes: 26228