akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
7
2 1
0 0
1 2
2 2
4 2
1 3
3 3

output:
5
0 0
2 1
4 2
3 3
1 3
"""

import sys
from operator import attrgetter

EPS = 1e-9


def cross(a, b):
    return a.real * b.imag - a.imag * b.real


def dot(a, b):
    return a.real * b.real + a.imag * b.imag


def check_ccw(p0, p1, p2):
    a, b = p1 - p0, p2 - p0
    if cross(a, b) > EPS:
        # print('COUNTER_CLOCKWISE')
        flag = 1
    elif cross(a, b) < -1 * EPS:
        # print('CLOCKWISE')
        flag = -1
    elif dot(a, b) < -1 * EPS:
        # print('ONLINE_BACK')
        flag = 2
    elif abs(a) < abs(b):
        # print('ONLINE_FRONT')
        flag = -2
    else:
        # print('ON_SEGMENT')
        flag = 0
    return flag


def convex_check_Andrew(_polygon):
    upper, lower = list(), list()
    _polygon.sort(key=attrgetter('real', 'imag'))

    upper.extend((_polygon[0], _polygon[1]))
    lower.extend((_polygon[-1], _polygon[-2]))

    for i in range(2, points):
        n1 = len(upper)
        while n1 >= 2 and check_ccw(upper[n1 - 2], upper[n1 - 1], _polygon[i]) == 1:
            n1 -= 1
            upper.pop()
        upper.append(_polygon[i])

    for j in range(points - 3, -1, -1):
        n2 = len(lower)
        while n2 >= 2 and check_ccw(lower[n2 - 2], lower[n2 - 1], _polygon[j]) == 1:
            n2 -= 1
            lower.pop()
        lower.append(_polygon[j])

    lower.reverse()
    # find bottom-left of the hull
    lower_min = min(lower, key=attrgetter('imag', 'real'))
    min_index = lower.index(lower_min)
    lower_right = lower[min_index:]
    lower_left = lower[:min_index]

    for k in range(len(upper) - 2, 0, -1):
        lower_right.append(upper[k])
    return lower_right + lower_left


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    points = int(_input[0])
    p_info = map(lambda x: x.split(), _input[1:])

    polygon = [int(x) + int(y) * 1j for x, y in p_info]
    ans = convex_check_Andrew(polygon)
    print(len(ans))
    for ele in ans:
        print(int(ele.real), int(ele.imag))

Measured memory_bytes: 31044
#include <bits/stdc++.h>
#include <unordered_map>
#define rep(i,m,n) for(int i = m; i < (n); i++)
#define rrep(i,m,n) for(int i = m; i >= n; i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
ll A[200010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    rep(i,0,N){
        cin >> A[i];
    }
    ll lv = 0, rv = N;
    // ll cnt = 0;
    while(rv - lv > 1){
        map<ll,ll> mp;
        ll K = (lv + rv)/2;
        bool is_ok = true;
        rep(i,1,N){
            if(A[i-1] < A[i]) continue;
            if(K == 1 && N >= 2){
                is_ok = false;
                continue;
            }
            ll pre = A[i];
            mp.erase(mp.upper_bound(pre),mp.end());
            // bool is_make = false;
            while(mp[pre] == K-1){
                pre--;
                if(pre == 0) is_ok = false;
            }
            mp.erase(mp.upper_bound(pre),mp.end());
            mp[pre]++;
            // rrep(j,pre-1,0){
            //     // cnt++;
            //     if(mp[1e9-j] == K-1){
            //         mp[1e9-j] = 0;
            //     }else{
            //         mp[1e9-j]++;
            //         is_make = true;
            //         break;
            //     }
            // }
            // if(!is_make){
            //     is_ok = false;
            // }
        }
        if(is_ok){
            rv = K;
        }else{
            lv = K;
        }
    }
    // print(cnt);
    print(rv);
}


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

typedef long long ll;

const int MAXN = 6e5 + 5;
const int LOG = 60;

ll K;
int N;
int a[MAXN];
map <int, int> lst;
int nxt[MAXN][LOG];
ll weight[MAXN][LOG];
map <int, bool> in;

void load() {
	scanf("%d%lld", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", a + i);
		a[i + N] = a[i];
	}
}

void solve() {
	K--;
	for (int i = 3 * N - 1; i >= 0; i--) {
		int tmp = lst[a[i]] + 1;
		weight[i][0] = tmp / N - i / N;
		nxt[i][0] = tmp % N;
		lst[a[i]] = i;
	}
	
	for (int j = 1; j < LOG; j++)
		for (int i = 0; i < N; i++) {
			nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
			weight[i][j] = weight[i][j - 1] + weight[nxt[i][j - 1]][j - 1];
		}
	
	int pos = 0;
	for (int i = LOG - 1; i >= 0; i--)
		if (weight[pos][i] <= K) {
			K -= weight[pos][i];
			pos = nxt[pos][i];
		}
	
	vector <int> ans;
	for (int i = pos + K; i < N; i++)
		if (in[a[i]]) 
			while (1) {
				int tmp = ans.back();
				in[tmp] = false;
				ans.pop_back();
				if (tmp == a[i])
					break;
			}
		else {
			ans.push_back(a[i]);
			in[a[i]] = true;
		}
	
	for (auto it : ans)
		printf("%d ", it);
	puts("");
}

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

Measured memory_bytes: 444916
#include<cstdio>
#include <utility>
#include<algorithm>
#include<cstdlib>
#define MAX 90005
using namespace std;

int main(){
  int h, w, d, i, j, a, q, sum[MAX], l, r, ans;
  pair<int, int> p[MAX];
  scanf("%d%d%d", &h, &w, &d);
  for(i = 0; i < h; i++){
    for(j = 0; j < w; j++){
      scanf("%d", &a);
      p[a] = make_pair(i, j);
    }
  }
  for(i = 1; i <= d; i++){
    sum[i] = 0;
    for(j = i; j+d <= h*w; j += d){
      sum[j+d] += sum[j] + 
        abs(p[j].first - p[j+d].first) + 
        abs(p[j].second - p[j+d].second);
    }
  }
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d%d", &l, &r);
    ans = sum[r] - sum[l];
    printf("%d\n", ans);
  }
}


Measured memory_bytes: 2048
n=int(input())
a=list(map(int,input().split()))
even,odd=0,0
for i in a:
    if i%2==0:
        even+=1
    else:
        odd+=1
if odd==0:
    print("YES")
elif even==0:
    print("YES") if odd%2==0 else print("NO")
else:
    if odd==1 and even==1:
        print("NO")
    else:
        print("YES") if odd%2==0 else print("NO")

    
    


Measured memory_bytes: 14108
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if r < l:
  l, r = r, l
min = 2018
if R-L > 2019:
  min = 0
elif l == 0 or r == 0:
  min = 0
else:
  for i in range(l, r):
    for j in range(i+1,r+1):
      mod = (i*j) % 2019
      if mod < min:
        min = mod
print(min)

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

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


Measured memory_bytes: 256
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif
        ll h, w, k;
        cin >> h >> w >> k;
        ll dp[h + 1][w];
        rep(i, h + 1)rep(j, w) dp[i][j] = 0;
        dp[0][0] = 1;
        rep(i, h) {
            rep(j, w) {
                rep(l, (1LL << (w - 1))) {
                    if (l & (l >> 1)) continue;

                    if (j + 1 <= w - 1 && (l >> j & 1)) {
                        dp[i + 1][j + 1] += dp[i][j];
                        dp[i + 1][j + 1] %= mod;
                    } else if (j - 1 >= 0 && (l >> (j - 1) & 1)) {
                        dp[i + 1][j - 1] += dp[i][j];
                        dp[i + 1][j - 1] %= mod;
                    } else {
                        dp[i + 1][j] += dp[i][j];
                        dp[i + 1][j] %= mod;
                    }
                }
            }
        }
        cout << dp[h][k - 1] << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main() {
  string o;
  cin >> o;
  
  char c = o.at(0);
  
  cout << c;
    
  string s;
  cin >> s;
  
  char d = s.at(0);
  
  cout << d;
  
  string t;
  cin >> t;
    
  char e = t.at(0);
  
  cout << e << endl;
  
}

Measured memory_bytes: 3644
#include<iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;
int D[10000000];
int nfor_rmq = 1;

void init(int n){
  while(nfor_rmq < n) nfor_rmq *= 2;
  for(int i = 0; i < 2*nfor_rmq-1; i++) { D[i] = INT_MAX; }
}


int query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return INT_MAX;
    if(a <= l && r <= b) return D[k];

    int left, right;
    left = query(a,b,2*k+1,l,(l+r)/2);
    right = query(a,b,2*k+2,(l+r)/2,r);
    return min(left,right);
}

void update(int k, int a){
    k += nfor_rmq-1;
    D[k] = a;

    while(k > 0){
        k = (k-1)/2;
        D[k] = min(D[2*k+1],D[2*k+2]);
    }
}

int findMin(int a, int b){
    return query(a,b+1,0,0,nfor_rmq);
}

int main(){
    int i;
    int n, l, ai;
    cin >> n >> l;
    init(n);

    for(int i=0; i<n; i++){
        cin >> ai ;
	update(i,ai);
    }

    for(int i=0; i<=n-l;i++){
      if(i!=n-l)cout << findMin(i,i+l-1) << " ";
      else cout << findMin(i,i+l) << endl;
    }

    return 0;
}


Measured memory_bytes: 11300
#include<stdio.h>
int main(void){
int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
   	scanf("%d",&a[i]);
  }
  int max=0,maxind;
  for(int i=0;i<n;i++){
	if(a[i]>max){max=a[i];
	maxind=i;
                }
  }
  int nmax=0,nmaxind;
  for(int i=0;i<n;i++){
	if(i==maxind)continue;
    if(a[i]>nmax){
      nmax=a[i];
      nmaxind=i;
    }
  }
  for(int i=0;i<n;i++){
	if(i==maxind)printf("%d\n",nmax);
    else printf("%d\n",max);
  }
  return 0;
}

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

int main() {
  char c;
  cin >> c;

  string vowels = "aeiou";
  if (vowels.find(c) == string::npos) {
    cout << "consonant" << endl;
  } else {
    cout << "vowel" << endl;
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q, l;
V ans;

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

  cin >> n >> l;
  rep(i, n) cin >> a[i];
  tmp = -1;
  rep(i, n) {
    if (a[i] + a[i + 1] >= l) tmp = i;
  }
  if (tmp == -1)
    Cout("Impossible");
  else {
    rep(i, tmp) ans.p_b(i);
    rrrep(i, n - 2, tmp) ans.p_b(i);
    Cout("Possible");
    rep(i, Size(ans)) { Cout(ans[i] + 1); }
  }
  return 0;
}

Measured memory_bytes: 2676
H, W = map(int, input().split())
A = [input() for _ in range(H)]

def isOK():
    for h in range(H):
        for w in range(W):
            if A[h][w] == '.':
                continue
            if all([A[h + dh][w + dw] == '.' for dh, dw in [(0, 1), (0, -1), (1, 0), (-1, 0)] if (0 <= h + dh < H and 0 <= w + dw < W)]):
                return False
    return True

print('Yes' if isOK() else 'No')


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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

int n;
vi arr;
void in(){
	cin >> n;
	rep(i,0,5) arr.push_back(input());
}

void solve(){

	int mi = *min_element(all(arr));
	print(ceil(n, mi) + 4);

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        s: Chars,
        t: Chars
    }

    let mut count = 0;

    for i in 0 .. s.len() {
        if s[i] != t[i] {
            count += 1;
        }
    }

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


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

int a[100005];

int gcd(int a,int b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}

int main()
{
    int n,k;
    cin>>n>>k;
    int now=0,mx=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        now=gcd(now,a[i]);
        mx=max(mx,a[i]);
    }
    if(k>mx)
        puts("IMPOSSIBLE");
    else
    {
        if((mx-k)%now==0)
            puts("POSSIBLE");
        else
            puts("IMPOSSIBLE");
    }
    //cout << "Hello world!" << endl;
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> c(n,0);
  rep(i,n-1) {
    int a;
    cin >> a;
    a--;
    c[a]++;
  }
  rep(i,n) cout << c[i] << endl;
  return 0;
}


Measured memory_bytes: 4056
#include<iostream>
#include<vector>
main(){
  int n;
  std::cin>>n;
  std::vector<int64_t> a(n);
  for(auto& ai:a)std::cin>>ai;
  
  int64_t allxor = 0;
  for(auto ai:a)allxor ^= ai;
  
  for(auto ai:a)std::cout<< (allxor^ai) <<std::endl;
}

Measured memory_bytes: 4792
//#pragma comment(linker, "/STACK:134217728")

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VInt;

#define FOR(i, a, b) for(i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair

VInt E[1 << 18];
int A[1 << 18];
int D[1 << 18];
int P[1 << 18];
PII M[1 << 18];
Int C[1 << 18];
Int R[1 << 18];
Int S[1 << 18];

Int dfs(int a, int p, int depth)
{
	P[a] = p;
	A[depth] = a;
	D[a] = depth;
	C[depth] = 0;
	M[depth] = depth == 0 ? PII(-1, -1) : M[depth - 1];
	if (a > M[depth].first) M[depth] = PII(a, M[depth].first);
	else M[depth].second = max(M[depth].second, a);

	int mxa = M[depth].first;
	int mxd = D[mxa];

	Int cnt = 0;
	if(mxd < depth)
	{
		int limit = M[depth] == M[mxd] ? mxd : mxd + 1;
		++cnt;
		--C[limit];
	}

	int i;
	for (auto it = E[a].begin(); it != E[a].end(); ++it)
		if (*it != p)
			cnt += dfs(*it, a, depth + 1);

	cnt += C[depth];
	R[a] = cnt;
	return cnt;
}

void dfs2(int a, int p, Int s)
{
	for (auto it = E[a].begin(); it != E[a].end(); ++it)
		if (*it != p)
			s += R[*it];

	S[a] = s;

	for (auto it = E[a].begin(); it != E[a].end(); ++it)
		if (*it != p)
			dfs2(*it, a, s + 1 - R[*it]);
}

int main()
{
	int n;
	scanf("%d", &n);

	int i;
	FOR(i, 1, n)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		--a;
		--b;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	dfs(0, -1, 0);
	dfs2(0, -1, 0);

	FOR(i, 1, n)
		printf("%lld%c", S[i], i == n - 1 ? '\n' : ' ');
	return 0;
};


Measured memory_bytes: 40448
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

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

Measured memory_bytes: 256
a = list(input())
su = 0
s = 0
k = 0
for i in a:
  s += int(i)
a.reverse()
for i in a:
  su += int(i)*pow(10,k)
  k += 1
  
if su % s == 0:
  print("Yes")
else:
  print("No")

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

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)

Measured memory_bytes: 7084
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j,a[200005],b[200005],c[200005],d[200005],ans;
int main()
{
	ios_base::sync_with_stdio(0);
	cin>>n;
	for (i=1;i<=n;i++) cin>>a[i];
	for (i=1;i<=n;i++) cin>>b[i];
	for (i=0;i<=30;i++)
	{
		for (j=1;j<=n;j++)
		{
			c[j]=(a[j]&((1<<(i+1))-1));
		}
		for (j=1;j<=n;j++)
		{
			d[j]=(b[j]&((1<<(i+1))-1));
		}
		sort(d+1,d+n+1); 
		long long cnt=0;
		for (j=1;j<=n;j++)
		{
			if (c[j]<(1<<i)) cnt+=(lower_bound(d+1,d+n+1,(1<<i)-c[j])-d-1);
			cnt-=(lower_bound(d+1,d+n+1,(1<<(i+1))-c[j])-lower_bound(d+1,d+n+1,(3<<i)-c[j]));
		}
		if ((sqr(n)-cnt)&1) ans|=(1<<i);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
 
 
const int INF = 1000000;
 
 
const int MAX_V = 10000;


//??¨????????????????????????????????¨
const int MAX_PRIME = 10000000;

vector<int> is_prime(MAX_PRIME,1);

void calcPrime(){
	is_prime[0]=is_prime[1]=0;
	for(int i=2; i<MAX_PRIME; i++){
		if(is_prime[i]==1){
			for(int j=i*2; j<MAX_PRIME; j+=i){
				is_prime[j]=0;
			}
		}
	}
}


int main(){
	calcPrime();
	vi v;
	for(int i = MAX_PRIME -1; i > 8; i-=2){
		if(is_prime[i] && is_prime[i - 2] && is_prime[i - 6] && is_prime[i - 8]) v.pb(i);
	}
	reverse(all(v));
	int n;
	while(cin>>n){
		if(n == 0) break;
		vi::iterator it = upper_bound(all(v), n);
		--it;
		cout<<*it<<endl;
	}
}

Measured memory_bytes: 40176
#include<iostream>
#include<algorithm>
#include<utility>

using namespace std;
int n,w;
pair<int,int> b[110];
long long dp[110][100100];

long long solve(int now, int wlim){
	if(dp[now][wlim] != -1) return dp[now][wlim];
	if(now == n) return 0;
	else{
		long long tmp = solve(now+1,wlim);
		if(wlim-b[now].first >= 0){
			tmp=max(tmp,solve(now+1,wlim-b[now].first)+b[now].second);
		}

		return dp[now][wlim]=tmp;
	}
}

int main(){
	cin >> n >> w;
	for(int i=0; i<=n; i++){
		for(int j=0; j<=w; j++){
			dp[i][j]=-1;
		}
	}
	for(int i=0; i<n; i++){
		int we,va;
		cin >> we >> va;
		b[i]=make_pair(we,va);
	}
	
	cout << solve(0,w) << endl;
	return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

int add(int a, int b) {
  return a + b - mod * (a + b >= mod);
}

int mul(int a, int b) {
  return int(1ll * a * b % mod);
}

int pwr(int a, int x) {
  if (x == 0) {
    return 1;
  }
  return mul(pwr(mul(a, a), x >> 1), (x & 1 ? a : 1));
}

int dvd(int a, int b) {
  return mul(a, pwr(b, mod - 2));
}

int sub(int a, int b) {
  return a - b + mod * (a < b);
}

void inc(int& a, int b) {
  a = add(a, b);
}

void dec(int& a, int b) {
  a = sub(a, b);
}

const int N = 1e5 + 10;
int dp[N][2];
vector<int> g[N];

void dfs(int v, int p = -1) {
  dp[v][0] = dp[v][1] = 1;
  for (int to : g[v]) {
    if (to == p) {
      continue;
    }
    dfs(to, v);
    dp[v][0] = mul(dp[v][0], dp[to][1]);
    dp[v][1] = mul(dp[v][1], add(dp[to][0], dp[to][1]));
  }
}

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

  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v), g[v].push_back(u);
  }
  dfs(0);
  cout << add(dp[0][0], dp[0][1]);

  return 0;
}

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

#define INF 1000000000
typedef long long ll;
typedef pair<ll, ll> P;

string S;

int main(){
    cin >> S;

    bool ok = false;
    for(int i=0;i<S.size()-1;i++){
        if(S[i] != S[i+1])  ok = true;
    }
    if(!ok){
        cout << S.size() << endl;
        return 0;
    }

    vector<int> nums;
    int cnt = 1;
    for(int i=1;i<S.size();i++){
        if(S[i-1] != S[i]){
            nums.push_back(cnt);
            cnt = 0;
        }
        cnt++;
    }
    nums.push_back(cnt);

    int l = 0, r = nums.size() - 1;
    ll ans = INF;
    while(l != r){
        if(nums[l] < nums[r]){
            nums[l+1] += nums[l];
            ans = min(ans, (ll)S.size() - nums[l]);
            l++;
        } else {
            nums[r-1] += nums[r];
            ans = min(ans, (ll)S.size() - nums[r]);
            r--;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 768
#include <iostream>

using namespace std;

int main(void){
  int h,w;
  char a[110][110];
  cin >> h >> w;
  for(int i=0; i<=h+1; i++){
    for(int j=0; j<=w+1; j++){
      if((i==0)||(i==h+1)){
        a[i][j] = '#';
      }
      else{
        if((j==0)||(j==w+1)){
          a[i][j] = '#';
        }
        else{
          cin >> a[i][j];
        }
      }
    }
  }
  for(int i=0; i<=h+1; i++){
    for(int j=0; j<=w+1; j++){
      cout << a[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using Graph = vector<vector<int>>;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;

int main (){
  string S;
  cin>>S;
  rep(i,3){
    cout<<S[i];
  }
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int k, s;
    cin >> k >> s;
    int ans = 0;
    rep(i, 0, k + 1){
        rep(j, 0, k + 1){
            int tmp = s - i - j;
            if(0 <= tmp && tmp <= k) ans++;
        }
    }
    o(ans);
}

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

using namespace std;

#define MAX 350

int N, M;
int cost[MAX];
int rank[MAX][3];

void solve(){
  int dp[MAX][MAX][3];
  memset(dp, 0, sizeof(dp));

  int ans = 0;
  for(int k = 0 ; k < 3 ; k++){
    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j <= M ; j++){
        if(j-cost[i] < 0){
          dp[i+1][j][k] = dp[i][j][k];
        }else{
          dp[i+1][j][k] = max(dp[i][j][k],dp[i+1][j-cost[i]][k] + rank[i][k]);
        }
      }
    }
    ans = max(ans, dp[N][M][k]);
  }
  cout << ans << endl;
}

int main(){
  string str;
  while(cin >> N >> M){
    for(int i = 0 ; i < N ; i++){
      cin.ignore(); 
      getline(cin,str);
      cin >> cost[i] >> rank[i][0] >> rank[i][1] >> rank[i][2];
    }
    solve();
  }

  return 0;
}

Measured memory_bytes: 2648
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
module Main where

import Data.Bool

main :: IO ()
main = do
  { s <- getLine
  ; print $ solve s
  }

{- |
>>> solve "BBW"
2
>>> solve "BWBWBW"
6
-}
solve :: String -> Int
solve = hyloL 0 (+) (null . snd) psi . (0,)
  where
    psi (b, 'W':s) = (b, (b, s))
    psi (b, 'B':s) = (0, (succ b, s))

hyloL :: c -> (b -> c -> c) -> (a -> Bool) -> (a -> (b, a)) -> a -> c
hyloL e phi p psi x = bool (case psi x of (y, x') -> phi y (hyloL e phi p psi x')) e (p x)


Measured memory_bytes: 22908
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main()
{
    int n;
    cin >> n;
    vector<vector<int> > m_nd(n, vector<int>(1, -1));
    int depth[n] = {};
    char m_type[n][15];
    rep(i, n)
    {
        int tmpid, tmpdegree;
        cin >> tmpid >> tmpdegree;
        rep(i, tmpdegree)
        {
            int tmp;
            cin >> tmp;
            m_nd[tmp][0] = tmpid;
            depth[tmp] = depth[tmpid] + 1;
            m_nd[tmpid].push_back(tmp);
        }
    }
    rep(i, n)
    {
        if (m_nd[i][0] != -1 && depth[i] - depth[m_nd[i][0]] != 1)
            depth[i] = depth[m_nd[i][0]] + 1;
    }
    rep(i, n)
    {
        if (m_nd[i][0] == -1)
        {
            strcpy(m_type[i], "root");
        }
        else if (m_nd[i].size() <= 1)
        {
            strcpy(m_type[i], "leaf");
        }
        else
        {
            strcpy(m_type[i], "internal node");
        }
    }
    rep(i, n)
    {
        printf("node %d: parent = %d, depth = %d, %s, [", i, m_nd[i][0], depth[i], m_type[i]);
        for (int j = 1; j < m_nd[i].size(); ++j)
        {
            printf("%d", m_nd[i][j]);
            if (j < m_nd[i].size() - 1)
                printf(", ");
        }
        printf("]\n");
    }
}


Measured memory_bytes: 10708
#include <stdio.h>

int main( void )
{
	int a,b,c;
	scanf("%d %d %d", &a, &b, &c);
	
	if(a < b && b < c && a <c)
	printf("Yes\n");
	else{
		printf("No\n");
	}
	return 0;
}
	
	


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

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

	if (a < b && b < c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3100
import numpy as np

def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

num = int(input())
temperature = list(map(int, input().split(" ")))
height = list(map(int, input().split(" ")))

place_temperature = []
for i in range(num):
    place_temperature.append(temperature[0] - height[i] * 0.006) 


near_temperature = getNearestValue(place_temperature, temperature[1])
print(place_temperature.index(near_temperature) + 1)

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

#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math,-ffp-contract=off")
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)


const int maxn = 1e3 + 12, maxh = 1e4 + 12;
long long int n, h, a[maxn], b[maxn], mx = 1e9, dp[maxh];

int main() {
	IOS;
	cin >> h >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < h; i++) dp[i] = 1e9;
	for (int j = h; j > 0; j--) {
		//cout << j << ' ' << dp[j] << '\n';
		for (int i = 0; i < n; i++) {
			if(j - a[i] >= 0) {
				dp[j - a[i]] = min(dp[j - a[i]], dp[j] + b[i]);
			}
			else {
				mx = min(mx, dp[j] + b[i]);
			}
		}
	}
	cout << min(mx, dp[0]);
	return 0;
}

Measured memory_bytes: 384
import itertools

def main():
  n, m = map(int, input().split())
  plst = tuple(map(int, input().split()))
  abclst = [tuple(map(int, input().split())) for _ in range(n - 1)]
  
  sec = [0] * n
  for pi, pi1 in zip(plst, plst[1:]):
    p1, p2 = min(pi, pi1) - 1, max(pi, pi1) - 1
    sec[p1] += 1
    sec[p2] -= 1
  
  sec = tuple(itertools.accumulate(sec))
  
  ans = 0
  for i in range(n - 1):
    a, b, c = abclst[i]
    s = sec[i]
    ans += min(a * s, b * s + c)
  print(ans)
  
main() 


Measured memory_bytes: 31928
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	int n;
	int a[1001], b[1001], c[1001];

	cin >> n;
	FOR(i, 1, n) {
		cin >> a[i] >> b[i] >> c[i];
	}
	FOR(i, 1, n) {
		if (a[i] >= b[i] && a[i] >= c[i]) {
			if (a[i] * a[i] == b[i] * b[i] + c[i] * c[i]) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}

		else if (b[i] >= a[i] && b[i] >= c[i]) {
			if (b[i] * b[i] == a[i] * a[i] + c[i] * c[i]) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}

		else if (c[i] >= b[i] && c[i] >= a[i]) {
			if (c[i] * c[i] == b[i] * b[i] + a[i] * a[i]) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
 
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        10000005
#define mod         998244353  
#define pi          3.1415926535897932384626433
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,count=0,x,ans=0,j;
    cin>>n;
    ll spf[n+1];
    memset(spf,0,sizeof(spf));
    spf[1] = 1; 
    for (ll i=2; i<=n; i++){ 
        spf[i] = i; 
    }
    for (ll i=4; i<=n; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<=n; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (ll j=i*i; j<=n; j+=i) 
                if (spf[j]==j) {
                    spf[j] = i; 
                }
        } 
    } 
    for(i=1;i<=n;i++){
        x=i;
        count=1;
        vector<ll> vi;
        while (x != 1) 
        { 
            vi.pb(spf[x]);
            x = x / spf[x]; 
        } 
        sort(vi.begin(),vi.end());
        // for(auto x:vi){
        //     cout<<x<<" ";
        // }
        // cout<<endl;
        x=vi.size();
        if(x==1){
            count=2;
            ans+=count*1ll*i;
        }
        else{
            count=2;
            ll pa=1;
            for(j=0;j<x-1;j++){
                if(vi[j]==vi[j+1]){
                    count++;
                }
                else{
                    pa=pa*1ll*count;
                    count=2;
                }
            }
            pa=pa*1ll*count;
            ans+=(pa*1ll*i);
        }
        // cout<<ans<<endl;
        // cout<<count<<" "<<i<<endl;
    }
    ans--;
    cout<<ans;
}

Measured memory_bytes: 81744
#入力部
N, M = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(M)]  #sの各要素のはじめはk
p = list(map(int, input().split()))
ans = 0
#print('s= ', s)
#print('p= ', p)


#すべてのスイッチの状態の組み合わせに対するfor
for i in range(2 ** N):
  ptn = bin(i)[2:].rjust(N, "0")  #スイッチの状態の組み合わせを全表示
  light = True  #フラグ
#  すべての電球に対するfor
  for j in range(M):
    tmp = 0  # スイッチOnに対するカウンター
    #電球が接続しているスイッチの数に対するfor
    for n in range(1, s[j][0] + 1):
      if ptn[s[j][n] - 1] == "1": #点灯状態の確認
        tmp += 1
    if tmp%2 != p[j]%2:
      light = False
  if light:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main () {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        int k = 0;
        for (int j = 1; j <= N; ++j) {
            if (i % j == 0) { k++; }
        }
        if (k == 8) {
            ans++;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3168
#include <cstdio>
#include <algorithm>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
int main(){
	int N;
	int a[810893];
	long long int strenth=0;
	scanf("%d",&N);
	REP(i,3*N){scanf("%d",&a[i]);}
	sort(a,a+3*N);
	for(int i=1;i<=N;i++){
		strenth+=a[3*N-2*i];
		//printf("%d\n",strenth);
	}
	printf("%lld",strenth);
	return 0;
}

Measured memory_bytes: 2304
#事前に階乗を計算しておく maximにnの最大値をいれる
maxim = 10**6+1

MOD = 10**9+7
kaijou = [1]*(maxim)
for i in range(1,maxim):
    kaijou[i]=(kaijou[i-1]*i)%MOD

#nCr
def nCr(n,r):
    return ((kaijou[n]*pow(kaijou[r],MOD-2,MOD))%MOD*pow(kaijou[n-r],MOD-2,MOD))%MOD

#nHr
def nHr(n,r):
    return ((kaijou[n+r-1]*pow(kaijou[n],MOD-2,MOD))%MOD*pow(kaijou[r-1],MOD-2,MOD))%MOD


N = int(input())

ans = 1 if N >=3 else 0
for i in range(2,(N//3)+1):
    tmp = nHr(N-3*i,i)
    ans = (ans+tmp)%MOD

print(ans)

Measured memory_bytes: 71644
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;
using namespace std;
const lli MOD = 1000000007;

inline lli mod_add(lli x, lli y) {
    return (x + y) % MOD;
}

inline lli mod_mul(lli x, lli y) {
    return (x * y) % MOD;
}

inline lli mod_sub(lli x, lli y) {
    return x - y >= 0 ? (x - y) % MOD : (x - y + MOD) % MOD;
}

inline lli mod_pow(lli x, lli y) {
    lli ret = 1;
    while (y > 0) {
        if (y & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        y = y >> 1;
    }
    return ret;
}

inline lli mod_inv(lli x) {
    return mod_pow(x, MOD - 2);
}

inline lli mod_div(lli x, lli y) {
    return x * mod_inv(y) % MOD;
}

#define MAX_FAC 1000000
lli fac[MAX_FAC], finv[MAX_FAC];
void init_fac() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    for (int i = 2; i < MAX_FAC; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        finv[i] = finv[i - 1] * mod_inv(i) % MOD;
    }
}
inline lli com(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    vector<int> prim;
    vector<int> cnts;
    for (int i = 2; M > 1; i++) {
        if (M % i == 0) {
            prim.push_back(i);
            int counter = 0;
            while (M % i == 0) {
                M /= i;
                counter += 1;
            }
            cnts.push_back(counter);
        }
    }

    lli ans = 1;
    int kind = prim.size();
    for (int i = 0; i < kind; i++) {
        ans = mod_mul(ans, com(cnts[i] + N - 1, cnts[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 15872
//#include <bits/stdc++.h>
#include <map> 
#include <cstdio>
//#include <unordered_map>
#define ll long long
using namespace std;
const int N=2e5+5;
char s[N];
map<int,int> ma;
int main() {
    //freopen("in.txt","r",stdin);
    int n,p;
//    cout << 24 % 7 << endl;
    scanf("%d%d%s",&n,&p,s+1);
    ll ans=0;
    if(10%p==0) {
        for(int i=1;i<=n;i++) {
            if((s[i]-'0')%p==0) ans+=i;
        }
    }
    else {
        int res=0,t=1;
        for(int i=n;i>=1;i--) {
            ma[res]++;
            res=(res+(s[i]-'0')*t)%p;
            t=t*10%p;
            ans+=ma[res];
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 896
import glob
import os

bn = os.path.basename(__file__).split('.')[0]
dn = os.path.dirname(__file__).split('/')

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = dn[len(dn)-2] + '\\' + dn[len(dn)-1] + '\\' + bn

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        N = int(self.input_data())
        dog_num = 1000000000000001
        alp = 'abcdefghijklmnopqrstuvwxyz'

        name = ''
        for i in range(0, 13, 1):
            n = N % 26
            if n != 0:
                name = alp[n-1] + name
            else:
                name = 'z' +name
            N = (N-1) // 26
            if N < 1:
                break
        print(name)

solver = Solver(REL_PATH)
solver.exec_resolve()


Measured memory_bytes: 9980
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define io ios_base::sync_with_stdio(false); cin.tie(0);

#define fs first
#define sc second
#define pb push_back

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef long double ld;

const ll LINF = 1e18;
const int INF = 1e9;
const ld EPS = 1e-9;
const int MOD = 1e9+7;

/// Scanf para ler char array separado por espacos -> scanf(" %[^\n]", texto);
 
////////////////////////// Solution starts below. //////////////////////////////

const int N = 105;
const int W = 1e5+5;
ll v[N], w[N];
ll dp[N][W];

int main(){

	int n, lim;
	scanf("%d %d", &n, &lim);
	for(int i = 1; i <= n; i++){
		scanf("%lld %lld", &w[i], &v[i]);
		for(int j = 1; j <= lim; j++){
			if(w[i] > j) dp[i][j] = dp[i-1][j];
			else dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
		}
	}
	printf("%lld\n", dp[n][lim]);
	
	return 0;
}

Measured memory_bytes: 79360
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1e9
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N;
int ans = 0;
int dfs(ll i, int x, int y, int z){
    if(i > N) return 0;
    if(x >= 1 && y >= 1 && z >= 1) ans++;
    dfs(10*i + 3,x+1,y,z);
    dfs(10*i + 5,x,y+1,z);
    dfs(10*i + 7,x,y,z+1);
    return 0;
}
int main(){
    cin >> N;
    dfs(3,1,0,0);dfs(5,0,1,0);dfs(7,0,0,1);
    cout << ans << endl;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back

using namespace std;
typedef pair<ll,ll> pll;

ll n, k;
ll a[150];
ll ans;
int main()
{
        cin >> n >> k;
        for(ll i=1;i<=n;i++){
                cin >> a[i];
        }
        for(ll i=0;i<=min(n,k);i++) {
                for(ll j=0;j<=min(k-i,n-i);j++) {
                        vector<ll> nn;
                        ll yo = 0;
                        if(i+j > k) continue;
                        for(ll x=1;x<=i;x++) {
                                yo += a[x];
                                if(a[x]<0) nn.pb(a[x]);
                        }
                        for(ll x=n;x >= n-j+1; x--) {
                                yo += a[x];
                                if(a[x]<0) nn.pb(a[x]);
                        }
                        ll lft = k - (i + j);
                        //if(i==2 && j==1) cout << yo << " " << lft << endl;
                        sort(nn.begin(), nn.end());
                        if(lft > nn.size()) lft = nn.size();
                        //cout << lft << endl;
                        for(ll x=0;x<lft;x++) yo -= nn[x];
                        //if(yo == 19) cout << i << " " << j << endl;
                        ans = max(ans , yo);
                }
        }
        cout << ans << endl;
        return 0;
}


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

[t, a]=[int(i) for i in input().split()]

h=[int(i) for i in input().split()]

ans=[]
for i in h:
    temp=t-a-0.006*i
    if temp <0:
        ans.append(temp*-1)
    else:
        ans.append(temp)

mi=ans[0]
num=0
for j, i in enumerate(ans):
    if mi > i:
        mi=i
        num=j

print(num+1)


Measured memory_bytes: 3060
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n, m;
	LinkedList<E> list;

	void run(){
		for(;;){
			n=sc.nextInt();
			m=sc.nextInt();
			if((n|m)==0){
				break;
			}
			list=new LinkedList<E>();
			for(int i=0; i<m; i++){
				int a=sc.nextInt();
				int b=sc.nextInt();
				int cost=sc.nextInt();
				list.add(new E(a, b, cost));
			}
			solve();
		}
	}

	void solve(){
		E[] es=list.toArray(new E[0]);
		Arrays.sort(es);
		init();
		int wt=0;
		for(E e : es){
			if(find(e.v1)!=find(e.v2)){
				union(e.v1, e.v2);
				wt+=e.w;
			}
		}
		println(""+wt);
	}

	class E implements Comparable<E>{
		int v1, v2, w;

		E(int v1, int v2, int w){
			this.v1=v1;
			this.v2=v2;
			this.w=w;
		}

		@Override
		public int compareTo(E e){
			return w-e.w;
		}
	}

	int[] p, rank;

	void init(){
		p=new int[n];
		rank=new int[n];
		for(int i=0; i<n; i++){
			p[i]=i;
			rank[i]=0;
		}
	}

	int find(int x){
		if(p[x]==x)
			return x;
		else
			return p[x]=find(p[x]);
	}

	void union(int x, int y){
		x=find(x);
		y=find(y);
		if(rank[x]>rank[y]){
			p[y]=x;
		}else{
			p[x]=y;
			if(rank[x]==rank[y])
				rank[y]++;
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

int main(void) 
{
	int N;
	cin >> N;
	vector <ll> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
	}

	ll best = BIGLL;

	for (int i = 0; i < N; ++i)
	{
		a[i] -= (i + 1);
	}

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

	ll now = 0;
	ll b = a[0];
	for (int i = 0; i < N; ++i)
	{
		now += abs(a[i] - b);
	}
	amin(best, now);

	for (ll i = 1; i < N; ++i)
	{

		now += (i-(N-i))*(a[i]-a[i-1]);
		// BEGIN CUT HERE
//		cerr << " i=" << i << " now=" << now << endl;
		// END CUT HERE

		amin(best, now);
	}


	cout << best << endl;









	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)System.out.println("Yes");
      else System.out.println("No");
	}
	
	
}

Measured memory_bytes: 36084