akhauriyash/Code-Regression huggingface dataset:
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-05-17 20:09
# @url:
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    abhm=list(map(int,input().split()))
    a,b,h,m=abhm[0],abhm[1],abhm[2],abhm[3]
    x=abs(h*30+m*30/60-m*6)
    if x>=180:
        x=360-x
    # print (x)
    # print (math.sin(math.radians(90)))
    res=a*a+b*b-2*b*a*math.cos(math.radians(x))
    print (math.sqrt(res))
if __name__ == "__main__":
    main()

Measured memory_bytes: 68976
from collections import Counter
from itertools import accumulate

N, M = map(int, input().split())
A = [int(x) for x in input().split()]

c = Counter([0] + [x % M for x in accumulate(A)])
ans = 0
for k, v in c.items():
    if v >= 2:
        ans += v * (v - 1) // 2
print(ans)

Measured memory_bytes: 16596
a, b, c = map(int, input().split())
k = int(input())

def count(v1, v2, k):
    while v1 <= v2 and k >= 0:
        v1 *= 2
        k -= 1
    b = v1
    return v1, v2, k

b, _, k = count(b, a, k)
_, _, k = count(c, b, k)
        
if k < 0:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 9140
input1 = list(map(int, (input().split())))
input2 = list(map(int, (input().split())))

n = input1[0]

for a in input2:
    if(a & 1 == 1):
        continue

    if(a % 3 != 0 and a % 5 != 0):
        print("DENIED")
        exit(0)

print("APPROVED")


Measured memory_bytes: 2940
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;

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

	cout << N * (N - 1) / 2 + M * (M - 1) / 2;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 1000000

int N,in_num[NUM],L[NUM];
ll length[NUM];
ll value[NUM];
vector<int> G[NUM];

int main(){

	scanf("%d",&N);

	for(int i = 0; i < N; i++){
		in_num[i] = 0; //データを木構造(森)として扱う
		value[i] = 0;
	}

	for(int i = 0; i < N; i++){
		scanf("%lld %d",&length[i],&L[i]);
		value[i] = length[i];
		if(L[i] == -1)continue;
		G[L[i]].push_back(i);
		in_num[L[i]]++;
	}

	queue<int> Q;
	for(int i = 0; i < N; i++){
		if(in_num[i] == 0){
			Q.push(i);
		}
	}

	int node_id;
	ll ans = 0;
	vector<ll> V;

	int count;

	while(!Q.empty()){

		node_id = Q.front();
		Q.pop();

		if(L[node_id] != -1){

			in_num[L[node_id]]--; //親の未処理枝数を1減らす
			value[L[node_id]] += value[node_id]; //親の文字数を増やす(1つの塊と見なす)

			if(in_num[L[node_id]] == 0){ //全ての枝を処理したら葉として扱う
				Q.push(L[node_id]);
			}
		}

		//子のデータを追加
		V.clear();
		for(int i = 0; i < G[node_id].size(); i++){
			V.push_back(value[G[node_id][i]]);
		}

		if(V.size() == 0)continue;

		sort(V.begin(),V.end());

		count = (int)V.size()-1;

		//★葉の生成コストを求める★→最大のコストは足さない
		for(int i = 0; i < V.size()-1; i++){
			ans += count*V[i]; //★★文字が短いほど、被修飾語側に配置する→影響を与える他の単語が1つずつ減る★★
			count--;
		}
	}

	printf("%lld\n",ans);

	return 0;
}



Measured memory_bytes: 81280
N = int(input())
A = list(input().split())
B = [int(a) for a in A]
x = 10**9+7
summation1 = sum(B) ** 2
summation2 = sum(b ** 2 for b in B)
summation = ((summation1 - summation2) // 2) % x
print(summation)


Measured memory_bytes: 32588
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int[] A = new int[N];
        final int[] counts = new int[N + 1];

        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            counts[A[i]] += 1;
        }

        long total = 0;
        for (int i = 1; i <= N; i++) {
            int n = counts[i];
            total += choose2(n);
        }

        for (int i = 0; i < N; i++) {
            int n = counts[A[i]];
            System.out.println(total - (n - 1));
        }        
    }

    private static long choose2(long n) {
        return n * (n - 1) / 2;
    }
}


Measured memory_bytes: 93580
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int primes[200];
int prime[1000000];
int pr[100000];
int el[314514],wl[314514];
int er[314514],wr[314514];
int a[114514];
int b[214514],c[214514];
int k[11];
int s[11][11];
int pp[11];
int ss[1919][11];
signed main(){
	ic(n) ic(m)
	c(m+100*(10-min(n,10)))
}	

Measured memory_bytes: 256
s = input()
k = int(input())

num1 = 0

for c in s:
    if c == "1":
        num1 += 1
    else:
        break

if num1 == len(s):
    nex = s[num1-1]
else:
    nex = s[num1]
if k <= num1:
    print(1)
else:
    print(nex)

Measured memory_bytes: 3064
from math import *
from collections import *
n=int(input())
a=list(map(int,input().split()))
g=[0 for i in range(10**6+1)]
for i in a:
    g[i]+=1
flg=True
for i in range(2,10**6+1):
    check=0
    for j in range (1,(10**6)//i+1):
        check+=g[i*j]
    if check>1:
        flg=False
if flg:
    print("pairwise coprime")
else:
    tmp=a[0]
    for i in a:
        tmp=gcd(tmp,i)
    if tmp==1:
        print("setwise coprime")
    else:
        print("not coprime")

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

ll N;
ll MOD = 1000000007;
ll a = 10;
ll b = 9;
ll c = 8;

int main(){
  cin >> N;

  rep(i, N-1){
    a = (a * 10) % MOD;
    b = (b * 9) % MOD;
    c = (c * 8) % MOD;
  }

  ll ac = (a + c) % MOD;
  ll ans = ac - 2*b;
  ans = ans % MOD;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}


Measured memory_bytes: 3612
n,x = map(int,input().split())
line = sorted(list(map(int,input().split())))
count = 0
if sum(line) < x:
  count = n - 1
elif sum(line) == x:
  count = n
else:
  for i in range(n):
    left = x - line[i]
    if left >= 0:
      count += 1
      x = left
    else:
      break
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

Vec pn;

bool isPrime(ll n){
	if(n == 1) return false;
	for(ll i : pn){
		if(i * i > n) return true;
		if(n % i == 0) return false;
	}
	return true;
}

void init(ll n = 2e5){
	pn.pb(2);
	REP(num, 3, n) if(isPrime(num)) pn.pb(num);
}

VecP primeFactorization(ll n){
	VecP res;

	for(ll i : pn){
		ll cnt = 0;
		while(n % i == 0){
			n /= i;
			cnt++;
		}
		if(cnt) res.pb({i, cnt});
		if(n < i * i) break;
	}
	if(n != 1) res.pb({n, 1});

	return res;
}

Vec divisorEnumeration(ll n){
	auto v = primeFactorization(n);

	Vec res, a, b, cp;
	res.pb(1);
	for(auto p : v){
		cp.resize(res.size());
		copy(all(res), cp.begin());
		a.resize(res.size());
		repn(k, p.sc){
			ll t = pow(p.fs, k);
			rep(i, a.size()) a[i] = cp[i] * t;
			res.insert(res.end(), all(a));
		}
	}

	sort(all(res));
	return res;
}

int main(void){
	init();
	ll n;
	cin >> n;
	Vec a(n);
	rep(i, n) cin >> a[i];

	multiset<ll> st;
	rep(i, n) st.insert(a[i]);

	ll ans = 0;
	rep(i, n){
		st.erase(st.find(a[i]));
		auto v = divisorEnumeration(a[i]);
		bool flg = true;
		for (ll j : v){
			if(st.find(j) != st.end()){
				flg = false;
				break;
			}
		}
		if (flg) ans++;
		st.insert(a[i]);
	}
	co(ans);

	return 0;
}


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

using ll = long long;
using pii = pair<int, int>;

#define     endl               "\n"
#define     fast_io            ios::sync_with_stdio(false); cin.tie(0);
#define     file_io            freopen("input.txt", "r", stdin);   \
                               freopen("output.txt", "w", stdout);
#define     all(x)             begin(x), end(x)
#define     debug(x)           cerr <<"Line "<< __LINE__ <<" : "<< #x " = "<< x <<endl;
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<"("<<t.first<<", "<<t.second<<")"; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }
 




int main(int argc, char** argv) {
    fast_io
   
	
	int n, i = 1;
	while(cin >> n && n) {
	    cout << "Case " << i++ << ": " << n << endl;
	}
	
	

    return 0;
}























Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

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

using namespace std;

struct UnionFind{
  vector<int> par,num;

  UnionFind(int N) : par(N),num(N){
    for(int i=0;i<N;i++){
      par[i] = i;
      num[i] = 1;
    }
  }

  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
    num[ry] = num[ry]+num[rx]; 
  }

  int get_num(int x){
    int rx = root(x);
    return num[rx];
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


int main(void){
  double r;
  cin >> r;
  cout << 2*r*M_PI << endl;
  return 0;
}


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

signed main() {
  string s;
  cin >> s;
  int n = s.size();
  s = " " + s;

  for (int i = 1; i < n; i++) {
    if (s[i] != s[n - i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  if (s[1] == '0' || s[n] == '1') {
    cout << -1 << endl;
    return 0;
  }

  int top = 1;
  for (int i = 1; i < n; i++) {
    cout << top << " " << i + 1 << endl;
    if (s[i] == '1') top = i + 1;
  }
  return 0;
}


Measured memory_bytes: 1660
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		IntStack stack=new IntStack();

		while(sc.hasNext()){
			if(sc.hasNextInt())	stack.push(sc.nextInt());
			else {
				int num=keisan(stack.pop(),stack.pop(),sc.next().charAt(0));
				stack.push(num);
		}
		}sc.close();System.out.println(stack);

	}
	static int keisan(int num1,int num2,char operator){
		switch(operator){
		case '+':num1=num2+num1;break;
		case '-':num1=num2-num1;break;
		case '*':num1=num2*num1;break;
		case '/':num1=num2/num1;break;
		}
		return num1;
	}

}

class IntStack {
	private int pointer=-1;
	ArrayList<Integer> stack;

	IntStack(){
		stack=new ArrayList<Integer>();

	}
	public void push(int a){
		stack.add(a);
		pointer++;
	}
	public int pop(){
		int a=stack.get(pointer);
		stack.remove(pointer);
		pointer--;
		return a;
	}
	public String toString(){
		StringBuilder stb=new StringBuilder();
		for(int i:stack)stb.append(i);
		return stb.toString();

	}

}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    llint ans = 0, p, r;
    for(llint ib=1;ib<=n;ib++) {
        p = n/ib;
        r = n%ib;
        ans += p*max(0LL, ib-k);
        ans += max(0LL, r-k+1);
    }

    if(k==0) ans -= n;

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


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc168/tasks/abc168_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  string N;
  cin >> N;

  ll last_number = N[N.size() - 1] - '0';

  string first_chars = "pphbhhphph";
  char first_char = first_chars[last_number];
  string res = string({first_char}) + "on";

  cout << res << "\n";
}


Measured memory_bytes: 3636
#include<iostream>
#include<cmath>

using namespace std;
#define LIMIT 30
 
struct Puzzle {
  char cont[9][3];
  int space; 
};
 
 
int dx[4]={ 0, 1, 0,-1};
int dy[4]={-1, 0, 1, 0};
 
int limit;
Puzzle puzzle;
char target[9];
 
 
int getHeuristic(){
  int sum = 0;
  for(int i=0;i<9;i++){
    if(puzzle.cont[i][0]=='E')continue;
    sum+=(puzzle.cont[i][0]!=target[i]?1:0);
  }
  return sum;
}
 
bool dfs(int depth,int prev){

  int heuri=getHeuristic();

  if(heuri==0){return true;}
  if(depth+heuri> limit )return false;
 
  
  int px,py,nx,ny;
  Puzzle tmp;
 
  px=puzzle.space%3;
  py=puzzle.space/3;

  tmp=puzzle;
  for(int i=0;i<4;i++){
    nx=px+dx[i];
    ny=py+dy[i];
    if(max(prev,i)-min(prev,i)==2)continue;
 
    if(nx<0||ny<0||nx>=3||ny>=3)continue;
 
     
 
    if(i%2){
      // puzzle.cont[py*3+px]=rb(puzzle.cont[ny*3+nx]);
      puzzle.cont[py*3+px][0]=puzzle.cont[ny*3+nx][2];
      puzzle.cont[py*3+px][1]=puzzle.cont[ny*3+nx][1];
      puzzle.cont[py*3+px][2]=puzzle.cont[ny*3+nx][0];
    }else{
      //  puzzle.cont[py*3+px]=ra(puzzle.cont[ny*3+nx]);
      puzzle.cont[py*3+px][0]=puzzle.cont[ny*3+nx][1];
      puzzle.cont[py*3+px][1]=puzzle.cont[ny*3+nx][0];
      puzzle.cont[py*3+px][2]=puzzle.cont[ny*3+nx][2];
    }
 
    puzzle.space=ny*3+nx;
    puzzle.cont[puzzle.space][0]='E';


    
    
    if(dfs(depth+1,i))return true;
    puzzle=tmp;
  }
  return false;
}

Puzzle in;
void solve(){
  int d;
  d=getHeuristic();
  for(limit=d;limit <= LIMIT ; limit++ ){
    
    if(dfs(0,-100)){
      cout<<limit<<endl;
      return;
    }
 
  }
  cout<<"-1"<<endl;
 
}
 
int main(){
  int x,y;
  while(cin>>x>>y){
    if(x==0&&y==0)break;
    x--;y--;
 
    puzzle.space=y*3+x;
    for(int i=0;i<9;i++){
      cin>>target[i];
      if(i/3==y&&i%3==x){
	puzzle.cont[i][0]='E';
      }else{
	puzzle.cont[i][0]='W';
	puzzle.cont[i][1]='R';
	puzzle.cont[i][2]='B';
      }
    }
    solve(); 
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }

    sort(all(a));

    if(a[0] >= 0 ){
        ll m = 0;
        FOR(i,1,n){
            m += a[i];
        }
        m -= a[0];
        cout << m << endl;

        FOR(i,2,n){
            cout << a[0] << " " << a[i] << endl;
            a[0] = a[0] - a[i];
        }
        cout << a[1] << " " << a[0] << endl;
    }
    else if(a[a.size()-1] <= 0){
        ll m = 0;
        REP(i,n-1){
            m -= a[i];
        }
        m += a[n-1];
        cout << m << endl;

        REP(i,n-1){
            cout << a[n-1] << " " << a[i] << endl;
            a[n-1] = a[n-1] - a[i];
        }
    }
    else {
        ll m = 0;
        REP(i,n){
            m += abs(a[i]);
        }
        cout << m << endl;

        FOR(i,1,n-1){
            if(a[i] < 0){
                cout << a[n-1] << " " << a[i] << endl;
                a[n-1] -= a[i];
            }
            else{
                cout << a[0] << " " << a[i] << endl;
                a[0] -= a[i];
            }
        }
        cout << a[n-1] << " " << a[0] << endl;
    }

    return 0;
}

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

int main(){
	vector<int> a(3);
    for(int i = 0 ; i < 3 ; i ++){
    	cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[0] + a[1] + a[2] * 10;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#define ll long long int
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

void solve(){
ll s=0,to,n;
cin>>to>>n;
ll a;
for(int i=0;i<n;i++)
{
    cin>>a;
    s+=a;
}
if(to-s<0)
    cout<<-1;
else
    cout<<to-s;



}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
//	cin >> t;
	while(t--){
       // cout<<"Case #"<<i<<": ";
		solve();


	}
	return 0;
}


Measured memory_bytes: 3656
sx, sy, tx, ty = map(lambda x: int(x), input().split())
keika = list()

lenx = tx - sx
leny = ty - sy

for i in range(leny):
  keika.append('U')
for i in range(lenx):
  keika.append('R')
for i in range(leny):
  keika.append('D')
for i in range(lenx):
  keika.append('L')

keika.append('L')
for i in range(leny+1):
  keika.append('U')
for i in range(lenx+1):
  keika.append('R')
keika.append('D')
keika.append('R')
for i in range(leny+1):
  keika.append('D')
for i in range(lenx+1):
  keika.append('L')
keika.append('U')
print(''.join(keika))

Measured memory_bytes: 3188
// C++ includes
#include <bits/stdc++.h>
// 俳句
using namespace std;

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

bool tri(ll a,ll b,ll c){
    return (a<b+c)&&(b<c+a)&&(c<a+b);
}

int main(void){
    ll count = 0;
    ll n;
    cin >> n;
    vll l(n);
    REP(i,n){
        ll tmp;
        cin >> tmp;
        l[i] = tmp;
    }

    sort(l.begin(),l.end(),greater<ll>());

    REP(i,n){
        FOR(j,i+1,n-1){
            FOR(k,j+1,n-1){
                if(tri(l[i],l[j],l[k])){
                    count++;
                }else{
                    break;
                }
            }
            if(l[i] > l[j]*2){
                break;
            }
        }
    }

    cout << count << endl;
}

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

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

fn main() {
    let l: i64 = input();
    let a: i64 = input();
    let b: i64 = input();
    let m: i64 = input();

    let last = a + b * (l - 1);
    let mut ans = 0;
    for k in 1..19 {
        let l = i64::pow(10, k as u32 - 1);
        let r = i64::pow(10, k as u32) - 1;
        if last < l || r < a {
            continue;
        }

        let ka = std::cmp::max(a, a + (l - a + b - 1) / b * b);
        let klast = std::cmp::min(last, a + (r - a) / b * b);
        if klast < ka || ka < l || r < ka || klast < l || r < klast {
            continue;
        }

        let kl = (klast - ka) / b + 1;
        ans *= power(i64::pow(10, k as u32), kl, m);
        ans %= m;
        ans += (ka % m * f(k, kl, m) % m + b % m * g(k, kl, m) % m) % m;
        ans %= m;
    }

    println!("{}", ans);
}

fn power(x: i64, p: i64, m: i64) -> i64 {
    if p == 0 {
        1
    } else if p % 2 == 1 {
        x % m * power(x, p - 1, m) % m
    } else {
        let t = power(x, p / 2, m);
        t * t % m
    }
}

fn f(k: i64, l: i64, m: i64) -> i64 {
    if l == 0 {
        0
    } else if l % 2 == 1 {
        let l = l - 1;
        let t = f(k, l, m);
        (t * power(10, k, m) % m + 1) % m
    } else {
        let l = l / 2;
        let t = f(k, l, m);
        (t * power(i64::pow(10, k as u32), l, m) % m + t) % m
    }
}

fn g(k: i64, l: i64, m: i64) -> i64 {
    if l == 0 {
        0
    } else if l % 2 == 1 {
        let l = l - 1;
        let t = g(k, l, m);
        (t * power(10, k, m) % m + l) % m
    } else {
        let l = l / 2;
        let t = g(k, l, m);
        ((t * power(i64::pow(10, k as u32), l, m) % m + t) % m + l % m * f(k, l, m) % m) % m
    }
}


Measured memory_bytes: 4352
mat = []
for i in range(3):
    mat.append(list(map(int,input().split())))
ans = 'Yes'
for i in range(3):
    for j in range(3):
        if mat[0][0] - mat[0][i] != mat[j][0] - mat[j][i]:
            ans = 'No'
for i in range(3):
    for j in range(3):
        if mat[0][0] - mat[i][0] != mat[0][j] - mat[i][j]:
            ans = 'No'
print(ans)

Measured memory_bytes: 3064
#

import sys
input=sys.stdin.readline

def main():
    S=input().strip("\n")
    N=len(S)
    s1=S[:(N-1)//2]
    s2=S[(N+3)//2-1:N]
    if S==S[::-1] and s1==s1[::-1] and s2==s2[::-1]:
        print("Yes")
    else:
        print("No")
            
    
if __name__=="__main__":
    main()


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


char buf[100002];

int main(){
	scanf("%s", buf);
	string s = buf;
	char p = s[0];
	int cnt = 0;
	for (int i = 0; i < s.size(); i++){
		if (p != s[i]){
			p = s[i];
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

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

    int ans = a * x + b * y;
    int ttl = x + y;
    int min_x = 0;
    int min_y = 0;

    for (int i = 0; i <= ttl; ++i) {
        int tmp = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b;
        if (tmp <= ans) {
            ans = tmp;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}


int main(){
  LL N,x=0,d=0,n=0,i,ans=1;
  scanf("%lld",&N);
  LL A[N],a;
  FOR(i,0,N)scanf("%lld",&A[i]);
  FOR(i,0,N){
    a=0;
    if(A[i]==x)a++;
    if(A[i]==d)a++;
    if(A[i]==n)a++;
    if(A[i]==x)x++;
    else if(A[i]==d)d++;
    else n++;
    ans=(ans*a)%MOD;
  }

  printf("%lld\n",ans);
	return 0;
}


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

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

int main(){

	int n;
	cin >> n;
	vector<int> a(n);
	for(auto &i : a) cin >> i;
	
	double ans = 0;
	for(auto& x : a){ans+=1.0/x;}

	cout << setprecision(6) << fixed << 1.0 / ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		Map<String, Integer> map = new HashMap<>();
		map.put("Taka", a);
		map.put("Aoki", b);
		for (int i = 0; i < k; i++) {
			if (i % 2 == 0) {
				if (map.get("Taka") % 2 == 1) {
					map.put("Taka", map.get("Taka")-1);
				}
				map.put("Aoki", map.get("Aoki")+(map.get("Taka")/2));
				map.put("Taka", map.get("Taka")/2);
			} else {
				if (map.get("Aoki") % 2 == 1) {
					map.put("Aoki", map.get("Aoki")-1);
				}
				map.put("Taka", map.get("Taka")+(map.get("Aoki")/2));
				map.put("Aoki", map.get("Aoki")/2);
			}
		}
		System.out.println(map.get("Taka") + " " + map.get("Aoki"));
	}
}

Measured memory_bytes: 23252
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using static System.Math;


class P
{
    static void Main()
    {
        int[] kab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        //+++tt
        //+++++
        //++/++
        kab[0]++;
        int cycle = 1;
        long incr = 1; 
        if (kab[2] -  kab[1] >= 2)
        {
            if(kab[0] <= kab[1])
            {
                Console.WriteLine(kab[0]);
            }
            kab[0] -= kab[1];
            Console.WriteLine(kab[1] + (long)(kab[2] - kab[1]) * ((long)kab[0] / 2) + kab[0] % 2);
            
        }
        else
        {
            Console.WriteLine(kab[0]);
        }
    }
}


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

int main() {
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        if(s == "Y"){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
  // ここにプログラムを追記
}



Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

def main():
    K = int(input())
    S = readline()[:-1]
    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + '...')

if __name__ == "__main__":
    main()


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

#define N 2012
#define mod 1000000007

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    if(fopen("input.in", "r")){
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }
    int n, a[N], ans = 0;
    
    cin >> n;
    vector<int> v(n);
    for(int i = 0 ; i < n ; i++){
    	cin >> v[i];
    }
    
    sort(v.begin(), v.end());
    for(int i = 0 ; i < n-1 ; i++){
    	for(int j = i+1 ; j < n ; j++){
    		int k = (int)((lower_bound(v.begin(), v.end(), v[i]+v[j]))-v.begin());
    		k--;
    		ans += k-j;
    	}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

string a[1010];
ll dp[1010][1010];
int main()
{
	int H, W;
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> a[i];
	}
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			dp[i][j] %= mod;
			if (i + 1 < H) {
				if (a[i + 1][j] == '.') {
					dp[i + 1][j] += dp[i][j];
				}
			}
			if (j + 1 < W) {
				if (a[i][j + 1] == '.') {
					dp[i][j + 1] += dp[i][j];
				}
			}
		}
	}
	cout << dp[H - 1][W - 1] % mod << endl;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(int i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(int i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(int i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll n;
    cin>>n;
    int h[n+1];
    repA(i,1,n) cin>>h[i];
    ll dp[n+1];
    dp[0]=INF;
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(ll i=3;i<=n;i++)
    {
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n]<<'\n';
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  vector<vector<int> > S(N, vector<int>());
  REP(i, M){
    int tmp; cin >> tmp;
    REP(j, tmp){
      int s; cin >> s; s--;
      S[s].push_back(i);
    }
  }
  vector<int> p(M, 0);
  for(auto &i : p) cin >> i;
  int ans = 0;
  REP(i, 1<<N){
    vector<int> a(M, 0);
    REP(j, N){
      if((i >> j) & 1){
        for(auto &k : S[j]){
          a[k] = (a[k] + 1) % 2;
        }
      }
    }
    int tmp = 0;
    REP(j, M){
      if(a[j] == p[j]) tmp++;
    }
    if(tmp == M) ans++;
  }
  cout << ans << endl;
}


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

int main () {
  int N;
  cin >> N;
  
  if (N == 1) {
    cout << "Hello World" << endl;
  }
  else { 
    int A, B;
    cin >> A >> B;
    cout << A + B << endl;
  }
}

Measured memory_bytes: 384
package main

import (
	"fmt"
	"os"
)

func main() {
	var a, b, c int
	fmt.Fscanf(os.Stdin, "%d %d %d", &a, &b, &c)
	
	ret := c - (a - b)
	if ret < 0 {
		ret = 0
	}
	fmt.Println(ret)
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void){
  int a[3];
  int temp;
  scanf("%d %d %d", &a[0], &a[1], &a[2]);
  for(int i = 0; i < 3; i++){
    for(int j = i + 1; j < 3; j++){
      if(a[i] < a[j]){
	temp = a[i];
	a[i] = a[j];
	a[j] = temp;
      }
    }
  }

  if(a[0] == a[1] + a[2]){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}

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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

int main(){
string s;
cin >> s;

int cnt = s.length() - 2;
cout << s.at(0) << cnt << s.at(s.length() - 1);

}

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

#pragma warning(disable:4996)
using namespace std;


int main() {
	int H,A,B;cin>>H>>A>>B;
	int ans=0;
	for (int y = A; y <= B; ++y) {
		ans+=H%y==0;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
// vector<vector<int>> A(3, vector<int>(4));
int main() {
    int N;
    cin>>N;
    vector<string>W(N);
    bool  ans=true;
    rep(i,N){
        cin>>W[i];
        if(i!=0){
            string H=W[i];
            string J=W[i-1];
            if(J[J.size()-1]!=H[0]){
                ans=false;
            }
        }
    }
    sort(W.begin(),W.end());
    rep(i,N){
        if(i!=0){
            if(W[i]==W[i-1]){
                ans=false;
            }
        }
    }
    if(ans==true){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

vector<bool> eratosthenes_sieve(int n) {
    vector<bool> prime(n + 1, true);
    if (n >= 0) { prime[0] = false; }
    if (n >= 1) { prime[1] = false; }
    for (long long i = 2; i * i <= n; i++) {
        if (!prime[i]) { continue; }
        for (long long j = i + i; j <= n; j += i) { prime[j] = false; }
    }
    return prime;
}

int main() {
    int N;
    cin >> N;
    int MAX_N = 1e7;
    vector<bool> ans = eratosthenes_sieve(MAX_N);
    for (int i = N; i <= MAX_N; i++) {
        if (ans[i]) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1408
#include<stdio.h>
main()
{
	int a;
	scanf("%d",&a);
	if(a==1) printf("1\n");
	else if(a<=3) printf("2\n");
	else if(a<=7) printf("4\n");
	else if(a<=15) printf("8\n");
	else if(a<=31) printf("16\n");
	else if(a<=63) printf("32\n");
	else if(a<=100) printf("64\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{
    ll a,b,k; cin >> a >> b >> k;
    ll ans1,ans2;
    if(a-k>=0){
        ans1=a-k; ans2=b;
    }else if(a+b-k>=0){
        ans1=0; ans2=a+b-k;
    }else{
     	ans1=0; ans2=0;
    }  
    cout << ans1 << " " << ans2 << endl;
      
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ b.cpp
./a.out
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int n;
    while(cin >> n, n){
        vii table;
        rep(i, n){
            int m;
            cin >> m;
            vi v;
            rep(j, m){int t; cin >> t; v.pb(t);}
            table.pb(v);
        }
        int k; cin >> k;
        vi l(k);
        rep(i, k) cin >> l[i];

        int ans = 0;
        bool is = false;
        rep(i, n){
            int count = 0;
            rep(j, table[i].size()){
                rep(p, k){
                    if(table[i][j] == l[p]) count++;
                }
            }
            if(count == k && !is){is = true; ans = i+1; }
            else if(count == k && is){cout << -1 << endl; ans = -1; i = n;}
        }
        if(ans == 0) cout << -1 << endl;
        else if(ans != -1) cout << ans << endl;
    }
}

Measured memory_bytes: 1272
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

A,B = II()
print(max(0,A-2*B))

Measured memory_bytes: 38480
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef unsigned long long BigInt;

const BigInt B = 1000000007;

int main() {
  int n, m;
  int l = 0;
  int r = 1;
  BigInt h[300001];
  BigInt b[300001];
  string s, q;
  set<BigInt> hashes;
  cin >> n >> m;
  cin >> s;
  h[n] = 0;
  b[0] = 1;
  for (int i = 0; i < n; ++i) {
    b[i + 1] = b[i] * B;
    h[n - 1 - i] = h[n - i] + b[i] * BigInt(s[n - 1 - i]);
  }
  for (int i = 0; i < m; ++i) {
    cin >> q;
    if (q == "L++") {
      ++l;
    } else if (q == "L--") {
      --l;
    } else if (q == "R++") {
      ++r;
    } else {
      --r;
    }
    hashes.insert((h[l] - h[r]) * b[l]);
  }
  cout << hashes.size() << endl;
  return 0;
}

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

#define pb push_back
#define mp make_pair

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

string s;
bool dp[100005];
string t[] = {
  "dream",
  "dreamer",
  "erase",
  "eraser"
};

int main() {
#ifdef LOCAL                       
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  dp[0] = true;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 4; ++j) {
      if (i + 1 >= (int)t[j].size()) {
        dp[i + 1] |= dp[i + 1 - (int)t[j].size()] && s.substr(i + 1 - (int)t[j].size(), t[j].size()) == t[j];
      }
    }
  }
  cout << (dp[n] ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 592
def solve():
    a, b, c = [int(_) for _ in raw_input().split()]
    if a + b >= c:
        print 'No'
    elif 4 * a * b < (c - a - b)**2:
        print 'Yes'
    else:
        print 'No'

if __name__ == '__main__':
    solve()


Measured memory_bytes: 27884
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int n, m, k, s;
int p, q;
int c[100010]; // ゾンビがいる島
vector<int> roads[100010];
vector<P> g[100010];

void set_graph(int st) { // BFSで有向グラフを作る
	vector<int> dist(n+1, -1), came(n+1, 0);
	queue<int> que;
	que.push(st);
	dist[st] = 0;

	while(!que.empty()) {
		int cur = que.front();
		que.pop();
		if(came[cur]) continue;
		//cout << cur << ": ";
		for(auto &x : roads[cur]) {
			if(dist[x] == -1) dist[x] = dist[cur] + 1;
			que.push(x);
			//cout << x << " ";
			if(dist[cur] == 1) continue; // ゾンビがいる場合
			int setcost;
			if(cur == n-1) setcost = 0;
			else if(dist[cur] <= s) setcost = q;
			else setcost = p;
			g[x].push_back(P(setcost, cur));
		}
		//cout << endl;
		came[cur] = 1;
	}
	// rep(i, n) cout << dist[i] << " ";
	// cout << endl;
}

int dijkstra(int st, int ed) {
	// first: cost, second: to
	priority_queue<P, vector<P>, greater<P>> que;
	vector<int> dist(n+1, INF);
	dist[st] = 0;
	que.push(P(0, st));

	while(!que.empty()) {
		P cur = que.top();
		que.pop();
		int next = cur.second;
		if(dist[next] < cur.first) continue;
		for(auto e : g[next]) {
			if(dist[next] + e.first < dist[e.second]) {
				dist[e.second] = dist[next] + e.first;
				que.push(P(dist[e.second], e.second));
			}
		}
	}
	// rep(i, n) cout << dist[i] << " ";
	// cout << endl;
	return dist[ed];
}

signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	cin >> n >> m >> k >> s;
	cin >> p >> q;
	rep(i, k) {
		cin >> c[i];
		c[i]--;
		roads[n].push_back(c[i]);
	}
	rep(i, m) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		roads[u].push_back(v);
		roads[v].push_back(u);
	}
	s++;
	set_graph(n);

	// rep(i, n) {
	// 	cout << i << ": ";
	// 	for(auto &x : g[i]) cout << "{" << x.second << ", " << x.first << "}, ";
	// 	cout << endl;
	// }
	int ans = dijkstra(0, n-1);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 25056
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    sys.exit()
#A = [int(input()) for _ in range(N)]
A1 = 1
for i in A:
    A1 *= i
    if A1 > 10**18:
        print("-1")
        sys.exit()

print(A1)
#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')

Measured memory_bytes: 21644