akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<vector<int>>v(2, vector<int>(N+1));
	for (int i = 0; i <= 1; i++) {
		for (int j = 1; j <= N; j++) {
			cin >> v[i][j];
		}
	}
	for (int i = 1; i <= N; i++) {
		v[0][i] += v[0][i - 1];
		v[1][i] += v[1][i - 1];
	}
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans = max(ans, v[0][i] + v[1][N] - v[1][i - 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define MAX_N 1000
using namespace std;
typedef long long lnt;
typedef pair<int,int> pii;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, f;
pii p[MAX_N+5];
char s[MAX_N+5][32];
bool chk() {
	for (int i = 1; i <= n; i++)
		if (((p[i].x+p[i].y)&1) ^ f) return false;
	return true;
}
lnt dis(pii u, pii v) {return 1LL*abs(u.x-v.x)+1LL*abs(u.y-v.y);}
bool chkL(int d, pii u, pii v) {u.x -= (1<<d); return dis(u, v) < (1LL<<d);}
bool chkR(int d, pii u, pii v) {u.x += (1<<d); return dis(u, v) < (1LL<<d);}
bool chkD(int d, pii u, pii v) {u.y -= (1<<d); return dis(u, v) < (1LL<<d);}
bool chkU(int d, pii u, pii v) {u.y += (1<<d); return dis(u, v) < (1LL<<d);}
int main() {
	read(n);
	for (int i = 1; i <= n; i++)
		read(p[i].x), read(p[i].y);
	f = (p[1].x+p[1].y)&1;
	if (!chk()) return puts("-1"), 0;
	if (f) {
		puts("31");
		for (int i = 0; i <= 30; i++)
			printf("%d ", (1<<i));
		puts("");
	} else {
		puts("32");
		for (int i = 0; i <= 30; i++)
			printf("%d ", (1<<i));
		puts("1");
		for (int i = 1; i <= n; i++)
			p[i].x++, s[i][31] = 'L';
	}
	for (int id = 1; id <= n; id++) {
		pii c = pii(0, 0);
		for (int i = 30; ~i; i--) {
			if (chkL(i, c, p[id])) c.x -= (1<<i), s[id][i] = 'L';
			else if (chkR(i, c, p[id])) c.x += (1<<i), s[id][i] = 'R';
			else if (chkD(i, c, p[id])) c.y -= (1<<i), s[id][i] = 'D';
			else if (chkU(i, c, p[id])) c.y += (1<<i), s[id][i] = 'U';
		}
	}
	for (int i = 1; i <= n; i++, puts(""))
		for (int j = 0; j <= 30+(!f); j++) putchar(s[i][j]);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

typedef struct tree{
    int v;
    struct tree *p, *l, *r;
}*Tree;

void initNode(Tree * root, int v){
    (*root) = (Tree) malloc (sizeof(struct tree));
    (*root)->l = NIL;
    (*root)->r = NIL;
    (*root)->p = NIL;
    (*root)->v = v;
}

void insert(Tree *root, Tree node){
    Tree y = NIL;
    Tree x = *root;
    while (x != NIL){
        y = x;
        if (node->v < x->v){
            x = x->l;
        } else {
            x = x->r;
        }
    }
    node->p = y;

    if (y == NIL){
        *root = node;
    }
    else if (node->v > y->v){
        y->r = node;
    }
    else{
        y->l = node;
    }
}

void inParse(Tree node){
    if (node != NIL){
        inParse(node->l);
        printf(" %d", node->v);
        inParse(node->r);
    }
}

void preParse(Tree node){
    if (node != NIL){
        printf(" %d", node->v);
        preParse(node->l);
        preParse(node->r);
    }
}

void print(Tree root){
    inParse(root);
    printf("\n");
    preParse(root);
    printf("\n");
}

int main()
{
    Tree root, node;
    root = NIL;

    int n, v;
    char s[10];
    scanf ("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%s", s);
        if (s[0] == 'i'){
            scanf("%d", &v);
            initNode(&node, v);
            insert(&root, node);
        }
        if (s[0] == 'p')
            print(root);
    }

    return 0;
}


Measured memory_bytes: 26140
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    println(
        answer067cAlt(n, a)
    )
}

fun answer067cAlt(n: Int, a: List<Long>): Long {
    val dp = Array<MutableList<Long>>(n - 1) { mutableListOf() }
    dp[0].add(a[0])
    dp[0].add(a.takeLast(n - 1).sum())
    dp[0].add(Math.abs(dp[0][0] - dp[0][1]))
    for (i in 1 until n - 1) {
        dp[i].add(dp[i - 1][0] + a[i])
        dp[i].add(dp[i - 1][1] - a[i])
        dp[i].add(Math.abs(dp[i][0] - dp[i][1]))
    }
    return dp.map { it[2] }.min()!!
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n,a[100010];
	scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	
	int A = -1;
	rep(i,n){
		A = max ( A , a[i] );
	}
	int cnt = 0;
	rep(i,n){
		if(a[i] <= A-2){
			puts("No");
			return 0;
		}
		if(a[i] == A-1)cnt ++;
	}
	
	if(cnt > 0){
		int x = 0 , y = 0;
		rep(i,n){
			if(a[i] == A-1)x ++;
			else y ++;
		}
		if(x+1 <= A && A <= x+y/2)puts("Yes");
		else puts("No");
	}
	else {
		if(A == n-1 || (1 <= A && A <= n/2) )puts("Yes");
		else puts("No");
	}
}



Measured memory_bytes: 640
import sys
from collections import deque

def main():
    line = sys.stdin.readlines()
    deq = deque()
    for i in range(1, int(line[0]) + 1):
        input_command = line[i]

        if input_command[0] == 'i':         # 'insert index'
            deq.appendleft(input_command[7:-1])
        elif input_command[0] == 'd':
            if input_command[6] == ' ':     # 'delete index'
                key = input_command[7:-1]
                if key in deq:
                    deq.remove(key)
            elif input_command[6] == 'F':   # 'deleteFirst':
                deq.popleft()
            elif input_command[6] == 'L':   # 'deleteLast':
                deq.pop()

    print(' '.join(deq))
    return


main()



Measured memory_bytes: 212224
#include <stdio.h>
#include <stdlib.h>

static void Exchange_Void(int *pSortBuff, int insert, int key );

int main(void)
{
	int a;					/* input a */
	int b;					/* input b */
	int remainder = 1;		/* amari */
	int divide;
	int loop;
   
    /* get Data" */
    scanf("%d %d", &a, &b);
	
    while(remainder != 0)
    {
		if(a < b)
		{
			remainder = b % a;
			b = remainder;
			divide = a;
		}
		else
		{
			remainder = a % b;
			a = remainder;
			divide = b;
		}   	
    }
	printf("%d\n", divide);
	
    return 0;
}

Measured memory_bytes: 1860
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define wuyt main
typedef long long ll;
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
//#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();
if(c == '-')Nig = -1,c = getchar();
while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
return Nig*x;}
#define read read()
const ll inf = 1e15;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
#define start int wuyt()
#define end return 0
start{
    ll n=read,k=read;
    ll t = n / k, t1 = (n + k / 2) / k;
    ll ans = t * t * t;
    if (k % 2 == 0) ans += t1 * t1 * t1;
    cout<<ans;
	end;
}


Measured memory_bytes: 256
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        if V[i] > C[i]:
            ans += V[i] - C[i]

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 2940
#include <stdio.h>

int main(){
    int idx1, idx2, len;
    scanf("%d", &len);
    for(idx1 = 0; idx1 < len; ++idx1){
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        sort(&a, &b, &c);
        if(a * a + b * b == c * c){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    return 0;
}

void sort(int* a, int* b, int* c){
    if(*a > *b){
        *a = *a ^ *b;
        *b = *a ^ *b;
        *a = *a ^ *b;
    }
    if(*b > *c){
        *b = *b ^ *c;
        *c = *b ^ *c;
        *b = *b ^ *c;
    }
    if(*a > *b){
        *a = *a ^ *b;
        *b = *a ^ *b;
        *a = *a ^ *b;
    }
}

Measured memory_bytes: 0
// ref. https://algo-logic.info/combinatorial-games/
// ref. http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4258159#1

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

const ll N = 105;
// dp[w][b] .. grundy number at (w,b)
vector<vector<ll>> dp;

ll grundy(ll w, ll b) {
  if (dp[w][b] >= 0) { return dp[w][b]; }

  set<ll> st;
  if (w>=1) { st.insert(grundy(w-1,b)); } // (a)
  for (ll c = 1; c <= min(w,b); ++c) { // (b)
    st.insert(grundy(w,b-c));
  }
  if (b>=1) { st.insert(grundy(w+1,b-1)); }

  ll g = 0;
  while (st.find(g)!=st.end()) { ++g; }
  return dp[w][b] = g;
}

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  dp.assign(205, vector<ll>(105, -1));
  dp[0][0] = 0;

  ll n;
  cin >> n;
  ll ans = 0;
  rep(iter,n) {
    ll w,b;
    cin >> w >> b;
    ans ^= grundy(w,b);
  }
  if (ans > 0) { // first wins
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
}



Measured memory_bytes: 3416
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pt;
 
#define fi first
#define se second
#define dump(x) cout << #x << " = " << x << endl
 
ll L, R, res;
 
int main () {
    cin >> L >> R;
    ll M = 2019;
    if(R-L>=2019) {
        cout << 0;
        return 0;
    }
    if (L<=2019 && R>=2019) {
        cout << 0;
        return 0;
    }
    L = L % M;
    R = R % M;
    res=2020;
    for (li i=min(L, R); i <= max(L, R); i++) {
        for (li j=i+1; j <= max(L, R); j++) {
            if((i*j)%M<res) {
                res=(i*j)%M;
                if (res==0) break;
            }
        }
        if (res==0) break;
    }
    cout << res;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    //左を往復して右絵進む
    ll right(vector<ll> L) {
        int n = L.size();
        vector<vector<ll> > dp(n, vector<ll>(5, INFl));
        dp[0][0] = L[0];
        dp[0][1] = L[0] % 2;
        if (L[0] == 0) dp[0][1] = 2;
        dp[0][2] = L[0] % 2 == 0;
        for (int i = 1; i < n; ++i) {
            dp[i][0] = dp[i - 1][0] + L[i];
            if (L[i] == 0) {
                dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + 2;
                dp[i][2] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]}) + 1;
                dp[i][3] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2], dp[i - 1][3]}) + 2;

            } else if (L[i] % 2 == 0) {
                dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]);
                dp[i][2] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]}) + 1;
                dp[i][3] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2], dp[i - 1][3]});

            } else {
                dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + 1;
                dp[i][2] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]});
                dp[i][3] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2], dp[i - 1][3]}) + 1;

            }
            dp[i][4] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2], dp[i - 1][3], dp[i - 1][4]}) + L[i];
        }

        ll ret = *min_element(all(dp[n - 1]));
        return ret;

    }

    void solve() {
        input();
        int n;
        cin >> n;
        vector<ll> L(n);

        rep(i, 0, n) cin >> L[i];

        ll ans = right(L);

        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 17536
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		cout<<s[i];
		if(i<t.size())cout<<t[i];
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  string s;
  cin >> s;

  string ans = "No";
  if (s[2] == s[3] && s[4] == s[5]) {
    ans = "Yes";
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  string _n;
  cin >> _n;
  int n[17];
  REP(i, _n.length())
  {
    n[i] = atoi(_n.substr(i, 1).c_str());
  }

  int ans1 = 0;
  int ans2 = 0;
  REP(i, _n.length())
  {
    if (i == 0)
    {
      ans1 += n[i] - 1;
    }
    else
    {
      ans1 += 9;
    }
    ans2 += n[i];
  }

  cout << max(ans1, ans2) << endl;
}


Measured memory_bytes: 256
from fractions import gcd
a,b,c,d = map(int,input().split())
a = a-1
l = int(c*d/gcd(d,c))
cn = b//c-a//c
dn = b//d-a//d
ln = b//l-a//l
ans = b-a-cn-dn+ln
print(ans)

Measured memory_bytes: 5048
import sys
input=sys.stdin.readline
N,K=map(int,input().split())
L=[]
for i in range(N):
    s,d=map(int,input().split())
    L.append([s,d])

High=10**20
Low =0
while High - Low >1:
    Mid=(High + Low)//2
    cnt=0
    for j in range(N):
        if Mid-L[j][0]<0:
            continue
        else:
            cnt+=max(0,1+(Mid - L[j][0])//L[j][1])
    if cnt>=K:
        High = Mid
    else:
        Low = Mid
    #print(High , Low)
Mid=int(Mid)
ans=0
for j in range(N):
    ans+=max(0,1+(Mid - L[j][0])//L[j][1])
if ans>=K:
    print(Mid)
else:
    print(Mid+1)


Measured memory_bytes: 55644
# -*- coding: utf-8 -*-
"""
Created on Sun Feb  3 20:43:36 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sun Jan 27 20:47:58 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

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

"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())
    
all(nstr.count(c) for c in '753')

ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
#A, B, totAB = zip(*ABT)

"""

T, X = map(int, input().split())

print(T/X)




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

const int INF = 2e9;

int main(){
    int n;
    cin >> n;
    vector<ll> l(n);
    rep(i,n){
        cin >> l[i];
    }
    ll cnt = 0;
    rep(i,n-2){
        for(int j = i+1;j < n-1;j++){
            for(int k = j+1;k < n;k++){
                if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k]){
                    int m = max({l[i],l[j],l[k]});
                    int s = l[i]+l[j]+l[k];
                    s -= m;
                    if(s > m)cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3624
#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[i];
    
    vector<int> rev(N);
    for(int i=0;i<N;i++) rev[A[i]-1]=i+1;
    for(int i=0;i<N;i++) cout << rev[i] <<endl;
    
    return 0;
}


Measured memory_bytes: 1536
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var k = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            var answer = s.Length <= k ? s : s.Substring(0, k) + "...";
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 27464
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 2e5 + 20;
ll a[maxn] , res;
int main()
{
    int n , t;
    cin >> n >> t;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        res += t;
        if(!i)
            continue;
        if(a[i] >= a[i - 1] + t)
            res = res;
        else
            res -= t , res += a[i] - a[i - 1];
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    int counter=0,i=100;
    while(1)
    {
        if(a%i==0&&b%i==0)
        counter++;
        if(counter==k){
            cout<<i<<endl;
            return 0;
        }
        i--;
    }    
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		List<String> ans = new ArrayList<>();
		ans.add("a");
		for (int i = 1; i < n; i++) {
			List<String> work = new ArrayList<>();
			for (String s : ans) {
				char ch = 'a';
				for (int j = 0; j < s.length(); j++) {
					if (s.charAt(j) > ch) ch = s.charAt(j);
				}
				ch++;
				for (char c = 'a'; c <= ch; c++) {
					work.add(s + c);
				}
			}
			ans = work;
		}
		Collections.sort(ans);
		PrintWriter pw = new PrintWriter(System.out);
		for ( String s : ans) {
			pw.println(s);
		}
		pw.flush();
	}
}


Measured memory_bytes: 42908
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    /*
    sort(a.begin(), a.end());
    bool flag = true;
    for(int i = 0; i < n; i++){
        if((a[i] ^ a[(i + 2) % n]) != a[(i + 1) % n]) flag = false;
    }

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    */

    int cnt0 = 0;
    for(int i = 0; i < n; i++){
        cnt0 += (a[i] == 0);
    }

    if(cnt0 == n){
        cout << "Yes" << endl;
        return 0;
    }
    
    if(n % 3 != 0){
        cerr << 3 << endl;
        cout << "No" << endl;
        return 0;
    }
    
    map<int, int> mp;
    for(int i = 0; i < n; i++) mp[a[i]]++;;

    if(mp.size() == 2){
        vector<int> c;
        vector<int> cnt(2, 0);
        int idx = 0;
        for(auto x : mp){
            c.push_back(x.first);
            cnt[idx] = x.second;
            idx++;
        }
        int val = n / 3;

        if(cnt[0] == val and cnt[1] == val * 2){
            if((c[0] ^ c[1]) == c[1] and (c[1] ^ c[1]) == c[0]) cout << "Yes" << endl;
            else cout << "No" << endl;
            return 0;
        }else{
            cout << "No" << endl;
            return 0;
        }

    }

    if(mp.size() != 3){
        cerr << 51 << endl;
        cout << "No" << endl;
        return 0;
    }

    int val = n / 3;

    for(auto x : mp){
        if(x.second != val){
            cerr << 60 << endl;
            cout << "No" << endl;
            return 0;
        }
    }

    
    bool flag = false;
    vector<int> b;
    for(auto x : mp) b.push_back(x.first);

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

    do{
        if((b[0] ^ b[2]) == b[1] and (b[1] ^ b[0]) == b[2] and (b[2] ^ b[1]) == b[0]) flag = true;
    }while(next_permutation(b.begin(), b.end()));

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

typedef long long ll;
using namespace std;

int main() {
    string s;
    ll k;
    cin >> s >> k;
    for (int i = 0; i < min((ll)s.size(), k); i++) {
        if (s[i] != '1') {
            cout << s[i];
            return 0;
        }
    }
    cout << 1;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int[] H = new int[N];

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

    sc.close();

    int count = 0;
    int max = 0;

    for (int i = 0; i < N; i++) {
      if (i != N - 1) {
        if (H[i] >= H[i+1]) {
          count++;
        } else {
          max = Math.max(max, count);
          count = 0;
        }
      } else {
        max = Math.max(max, count);
      }
    }

    System.out.println(max);

  }

}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int T[1<<21],B[1<<21];

int dp[1<<21];
int ans[1<<21];

signed main(){
	for(int i=1;i<1<<21;i++){
		B[i]=__builtin_ctz(i);
		T[i]=31-__builtin_clz(i);
	}
	int N,K;
	cin>>N>>K;


	rep(i,N+1){
		string S;cin>>S;
		rep(j,1<<i){
			if(S[j]=='0')continue;
			ans[1]++;
			dp[j|1<<i]++;
		}
	}

	for(int i=1;i<=N;i++){
		for(int j=1;j<1<<N+1;j++){
			int tmp=dp[j];
			dp[j]=0;

			int t=T[j];
			if(t<i)continue;
			int cur=j&((1<<i-1)-1);
			int b=j-cur;
			
			rep(uku,2){
				int k;
				if(uku==0)k=B[b];
				else k=B[(~(b>>(i-1)))&((1<<21)-1)]+i-1;
				if(k>=t)continue;
				int bb=cur|(b>>k<<(i-1));
				dp[bb]+=tmp;
			}
		}
		for(int j=1;j<1<<N+1;j++){
			int b=j&((1<<i)-1);
			b+=1<<i;
			ans[b]+=dp[j];
		}
	}


	int len=-1;
	for(int j=1;j<1<<N+1;j++)if(ans[j]>=K)len=T[j];

	for(int j=1<<len;j<1<<len+1;j++)if(ans[j]>=K){
		rep(k,len)cout<<(j>>(len-1-k)&1);
		cout<<endl;
		return 0;
	}
	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

long long N, M, K;
vector<LL> A, B;
vector<LL> RA, RB;

int lbound(vector<long long>&v, long long b){
	int s = 0, e = v.size() - 1;
	int l = v.size();
	int m;
	while(e - s > 1){
		m = (s + e) / 2;
		if(v[m] >= b){
			e = m;
		}
		else{
			s = m;
		}
	}
	if(v[max(s - 1, 0)] >= b) return max(s - 1, 0);
	else if(v[s] >= b) return s;
	else if(v[min(s + 1, l - 1)] >= b) return min(s + 1, l - 1);
	else return v.size();
}

int ubound(vector<long long>&v, long long b){
	int s = 0, e = v.size() - 1;
	int l = v.size();
	int m;
	while(e - s > 1){
		m = (s + e) / 2;
		if(v[m] <= b){
			s = m;
		}
		else{
			e = m;
		}
	}
	if(v[max(s - 1, 0)] > b) return max(s - 1, 0);
	else if(v[s] > b) return s;
	else if(v[min(s + 1, l - 1)] > b) return min(s + 1, l - 1);
	else return v.size();
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> M >> K;
	for(int i=0; i<N; i++){
		long long a;
		cin >> a;
		A.push_back(a);
		if(i == 0){
			RA.push_back(a);
		}
		else{
			RA.push_back(RA[i - 1] + a);
		}
	}
	for(int i=0; i<M; i++){
		long long b;
		cin >> b;
		B.push_back(b);
		if(i == 0){
			RB.push_back(b);
		}
		else{
			RB.push_back(RB[i - 1] + b);
		}
	}

	long long ans = 0, read = 0;
	long long ta = 0, tb = 0;
	int i, j, a, b;
	for(i = 0; i < N; i++){
		ta = RA[i];
		if(ta > K) break;
		read = i + 1;
		//Bの本はK-ta分までは読める。
		tb = 0;
		b = ubound(RB, K - ta);
		read += b;
		if(ta + tb <= K && ans < read){
			ans = read;
		}
	}
	for(i = 0; i < M; i++){
		tb = RB[i];
		if(tb > K) break;
		read = i + 1;
		ta = 0;
		a = ubound(RA, K - tb);
		read += a;
		if(ta + tb <= K && ans < read){
			ans = read;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 11412
/*input
10000 1
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h, a; cin >> h >> a;
    cout << (h/a) + (h % a != 0);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <bitset>
#include <regex>
#include <cassert>
#include <set>
#include <map>
using namespace std;
#define inf 2000000000
#define mod 1000000007

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    long long n, k;
    cin >> n >> k;
    cout << min(n%k, k-(n%k));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
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, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



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

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[202020];
int B[202020];
int C[602020];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>A[i];
	FOR(i,N) cin>>B[i];
	
	int ret=0;
	FOR(i,29) {
		FOR(x,N) C[x]=B[x]&((1<<(i+1))-1);
		sort(C,C+N);
		FOR(x,2*N) C[N+x]=C[x]+(1<<(i+1));
		ll tot=0;
		FOR(x,N) {
			y=A[x]&((1<<(i+1))-1);
			tot += lower_bound(C,C+3*N,(4<<i)-y)-lower_bound(C,C+3*N,(3<<i)-y);
		}
		if(tot%2) ret+=1<<i;
	}
	
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 4224
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n = int(input())
    T = [0]
    X = [0]
    Y = [0]
    for _ in range(n):
        t,x,y = map(int,input().split())
        T.append(t)
        X.append(x)
        Y.append(y)
    for i in range(n):
        t_diff = T[i+1]-T[i]
        x_diff = abs(X[i+1]-X[i])
        y_diff = abs(Y[i+1]-Y[i])
        if abs(x_diff + y_diff - t_diff) % 2 == 1 or x_diff+y_diff-t_diff>0:
            print('No')
            return
    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 65240
#include <iostream>
#include <cstdio>

using namespace std;

int n;
int ans = -1;

int main()
{
    /*int a,b;
    cin >> a >> b;
    cout << a+b;*/
    scanf("%d", &n);
    int x = 0;

    for(char c; n--;)
    {
       	cin >> c;

        if(c == 'I')
            x++;
        else x--;

        ans = ans > x ? ans : x;
    }

    if(ans == -1)puts("0");
    else printf("%d\n", ans);

    return 0;
}


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

int main(){

  long long H, W, N, mx, i, Sum=0;
  cin>>H>>W>>N;
  mx=max(H, W);
  
  for(i=0;i<N;i++){
    Sum+=mx;
    if(Sum>=N){
      cout<<i+1<<endl;
      return 0;
    }
  }
  return -1;
}

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

#define ll          long long
#define endl        "\n"
#define inf         10000000002
#define pb          push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      //freopen("inputNew.txt", "r", stdin);

      string s,t;
      cin>>s;
      cin>>t;

      ll len1=s.length();
      ll len2=t.length();

      ll mn=inf;
      for(ll i=0; i<len1; i++){
            ll cnt=0;
            ll j=0,k=i;
            for(j=0,k=i; j<len2 && k<len1; j++,k++){
                  if(s[k]!=t[j]) cnt++;
            }
            if(j!=len2) continue;
            mn=min(cnt,mn);
      }
      cout<<mn<<endl;


      bye;
}


Measured memory_bytes: 3668
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

int main(){
	int m;
	while(~scanf("%d",&m)){
		for(int i=0;i<m;i++){
			int init;
			int n;
			int year;
			scanf("%d",&init);
			scanf("%d",&year);
			scanf("%d",&n);
			int res = 0;
			for(int j=0;j<n;j++){
				double a,b,c;
				
				//0 0.03125 3000
				scanf("%lf %lf %lf",&a,&b,&c);

				if(a==1){
					double A = init;
					int rem=0;
					for(int k=0;k<year;k++){
						double B = floor(A * b);
						A = A+B-c;
					}
					res = max(res,(int)A);
				}
				else{
					double A = init;
					int rem = 0;
					int sum = 0;
					for(int k=0;k<year;k++){
						double B = floor(A * b);
						A -= c;
						sum += B;
					}
					res = max(res,(int)A+sum);
				}				
			}

			printf("%d\n",res);
		}
	}
}

Measured memory_bytes: 0
#include<stdio.h>
#define N 100

int main(){
  int A[N],i,j,minj,n,tmp,count;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    tmp = A[i];
    A[i] = A[minj];
    A[minj] = tmp;
    if(i!=minj){
      count++;
    }
    
  }

  for(i=0;i<n;i++){
    if(i>0){
      printf(" ");
    }
    printf("%d",A[i]);
  }
  printf("\n%d\n",count);
  

  return 0;
}

  



Measured memory_bytes: 2052
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>
#include <map>

using namespace std;

int main() {
	int n, a;
	cin >> n;

	map<int, int> nums;
	for (int i = 0; i < n; i++) {
		cin >> a;
		nums[a]++;
	}

	int ans = 0;
	set<int> check_nums;
	for (auto p: nums) {
		if (p.second > 1) {
			check_nums.insert(p.first);
			continue;
		}

		if (check_nums.count(1) > 0) {
			continue;
		}

		int x = p.first;

		bool ok = true;
		for (int i = 1; i * i <= x; i++) {
			if (x % i != 0) {
				continue;
			}

			if (check_nums.count(i) > 0 ||
				check_nums.count(x/i) > 0
			) {
				ok = false;
				break;
			}
		}

		if (ok) {
			ans++;
			check_nums.insert(p.first);
		}


	}

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


Measured memory_bytes: 21944
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    priority_queue<P> pq;
    for (int i = 0; i < N; ++i) {
        cin >> B[i];
        pq.push(P(B[i], i));
    }
    ll ans = 0;
    while (!pq.empty()) {
        P now = pq.top();
        pq.pop();
        ll now_b = now.first;
        int idx = now.second;
        if (now_b == A[idx]) continue;
        ll sum = B[(idx - 1 + N) % N] + B[(idx + 1) % N];
        ll cnt = (now_b - A[idx]) / sum;
        if (cnt <= 0) {
            cout << -1 << endl;
            return 0;
        }
        now_b -= cnt * sum;
        B[idx] = now_b;
        ans += cnt;
        if (now_b > A[idx]) pq.push(P(now_b, idx));
    }
    for (int i = 0; i < N; ++i) {
        if (A[i] != B[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int N,M;
	cin >> N >> M;
	int lMax,rMin;
	cin >> lMax >> rMin;
	for(int i = 1; i < M;i++){
		int l,r;
		cin >> l >> r;
		if(l > lMax)
			lMax = l;

		if(r < rMin)
			rMin = r;
	}
	int res = rMin - lMax + 1;
	res = (res > 0) ? res: 0;

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


Measured memory_bytes: 256
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def main():
    s = input()
    prev = '\0'
    i, k = 0, 0
    while i < len(s):
        if s[i] == prev:
            i += 2
            prev = '\0'
        else:
            prev = s[i]
            i += 1
        k += 1

    if i == len(s) + 1:
        k -= 1

    print(k)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    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("\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()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 34460
def main():
    N = int(input())

    seed = 97
    answer = ""

    while True:
        remainder = N % 26

        if(remainder == 0):
            answer = "z" + answer
        else:
            answer = chr(seed - 1 + remainder) + answer

        if N <= 26:
            print(answer)
            return

        elif remainder == 0:
            N = N // 26 - 1

        else:
            N = N // 26

if __name__ == "__main__":
    main()

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

string S;

int main()
{
    cin >> S;

    string ans;
    if (S <= "2019/04/30")
    {
        ans = "Heisei";
    }
    else
    {
        ans = "TBD";
    }

    OUT(ans);
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ls rt<<1
#define rs rt<<1|1
#define lson rt<<1, l, M
#define rson rt<<1|1, M+1, r
#ifdef local
#define dbg(a) cout << #a": " << a << endl;
#else
#define dbg(a)
#endif // loacl


using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const int inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-6;
const int mod=1e9+7;
const int maxn=200+10;
const int N=1e6+10;
const int M=N*20;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll MOD)
{
    ll ans=1;
    while(b)
    {
        if(b&1) ans=(ans*a)%MOD;
        b>>=1;
        a=(a*a)%MOD;
    }
    return ans;
}

int n;
int a[200],sum[200];
int main()
{
	IOS;
	cin>>n;rep1(i,n) {cin>>a[i];sum[i]=sum[i-1]+a[i];}
	int ans=inf;
	for(int i=1;i<=n;++i)
    {
        ans=min(ans,abs(sum[i]-(sum[n]-sum[i])));
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
N,P = map(int,input().split())
i = round(P**(1/N))
res = []
if N == 1:
  print(P)
  exit()
elif P == 1:
  print(1)
  exit()
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)
      break

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
pnt = 0
cnt = -2
for i in a:
  if i == cnt+1:
    pnt += c[cnt-1]
  pnt += b[i-1]
  cnt = i
print(pnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

// 入力
int N;
long long W, weight[110], value[110]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[110][100100] = {0};

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

    int A[N];
    rep(i,N){
        cin >> A[i];
    }

    int count = 0;
    rep(i,N){
        if((A[i] % 2) == 0){
            if((A[i] % 3) == 0 || (A[i] % 5) == 0){
            }
            else{
                count += 1;
                break;
            }
        }
    }

    if(count == 0){
        printf("APPROVED\n");
        return 0;
    }

    printf("DENIED\n");

    return 0;

    
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 12 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int to[200001], ne[200001], he[100001];
int kotae[100001], C;
char d[100001];
const int m = (1 << 20) - 1;
const int m2 = (1 << 30) - m - 1;
void sagasu(int P, int D) {
	if (!kotae[P]) kotae[P] = C;
	if (d[P] < D) {
		d[P] = D;
		for (int p = he[P]; p; p = ne[p]) {
			sagasu(to[p], D - 1);
		}
	}
}

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


	int N, M, Q;
	N = getint();
	M = getint();
	int k = 1;
	rep(i, M) {
		int a = getint(), b = getint();
		to[k] = a;
		ne[k] = he[b];
		he[b] = k++;
		to[k] = b;
		ne[k] = he[a];
		he[a] = k++;
	}
	Q = getint();
	int v[100000], d[100000], c[100000];
	rep(i, Q) {
		v[i] = getint();
		d[i] = getint();
		c[i] = getint();
	}
	for (int i = Q - 1; i >= 0; i--) {
		C = c[i];
		sagasu(v[i], d[i]);
	}
	rep1(i, N) putint(kotae[i]);

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 4736