akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int M;
int a[7];
int s, g;
int N[301];

bool isChecked[301];
vector<int> milestone[301];  //そのマスで出せばゴールにたどり着ける目を格納する

int iabs(int x){ return x >= 0 ? x : -x; }

bool search(int now){
	if (isChecked[now]) return false;
	else if (now == g)  return true;

	isChecked[now] = true;
	for (int dice = 1; dice <= 6; dice++){
		if (now + a[dice] <= M && search(now + a[dice] + N[now + a[dice]])){
			milestone[now].push_back(a[dice]);
		}
		if (now - a[dice] >= 1 && search(now - a[dice] + N[now - a[dice]])){
			milestone[now].push_back(-a[dice]);
		}
	}

	return milestone[now].size() > 0 ? true : false;
}

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

	cin >> M;
	for (int i = 1; i <= 6; i++){
		cin >> a[i];
	}
	cin >> s >> g;
	for (int i = 1; i <= M; i++){
		cin >> N[i];
	}
	bool canGoal = search(s);

	int now = s; //自分が今いるマスの番号
	for (;;){
		int dice;
		cin >> dice;

		bool found = false;
		for (vector<int>::iterator it = milestone[now].begin(); it != milestone[now].end(); it++){
			if (iabs(*it) == a[dice]){
				if (*it > 0){
					now = now + a[dice] + N[now + a[dice]];
					cout << 1;
				}
				else{
					now = now - a[dice] + N[now - a[dice]];
					cout << -1;
				}
				found = true;
				break;
			}
		}
		if(!found) cout << 0;
		cout << endl;
		cout.flush();

		if (now == g) return 0;
	}
	
	return 0;
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    char c[9];
    rep(i, 0, 9){
        cin >> c[i];
    }

    cout << c[0] << c[4] << c[8] << endl;
    return 0;
}


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



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

	const int mod = 2019;
	int L, R;
	cin >> L >> R;

	auto count = [=](int hi, int m)
	{
		return (hi/mod) + (((hi%mod) >= m) ? 1 : 0);
	};

	auto count_in_range = [=](int m)
	{
		return count(R, m) - count(L-1, m);
	};

	int res = mod;
	for (int i = 0; i < mod; ++i)
	{
		const int cnt_i = count_in_range(i);
		if (cnt_i >= 2) res = std::min(res, (i*i)%mod);
		if (!cnt_i) continue;
		for (int j = i+1; j < mod; ++j)
		{
			if (!count_in_range(j)) continue;
			res = std::min(res, (i*j)%mod);
		}
	}
	cout << res << std::endl;

	return 0;
}


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

import sys


def main():
    _ = sys.stdin.readline()
    arr = set()
    for line in sys.stdin:
        num = line.rstrip()
        if num in arr:
            arr.remove(num)
        else:
            arr.add(num)
    print(len(arr))


if __name__ == "__main__":
    main()


Measured memory_bytes: 14700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
const ll INF=1e9+7;
const ll N = 52;

string s,ans="abc";

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s;
	SORT(s);
	if(s==ans)pri("Yes");
	else pri("No");

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  int n; cin >> n;
  vector<int> a(n);
  int s = 0;
  for(int i=0; i<n; i++){
    cin >> a[i];
    s += a[i];
  }
  double ave = s * 1.0 / n;

  int p = 0;
  double d = abs(a[0]-ave);
  for(int i=0; i<n; i++){
    double dd = abs(a[i]-ave);
    cerr << dd << endl;
    if(dd < d){
      p = i;
      d = dd;
    }
  }
  cout << p << endl;

  return 0;
}




///


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define PI 3.1415926535897932384626
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++)
#define Dep(i,a,b) for (int i = (b)-1; i >= a; i--)
#define dep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for(auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // Random No.

const int MOD = 1000000007;
const char nl = '\n';

void sol() {
    int n ; cin >> n;
    vector<char> v;
    int wh = 0, rd = 0;
    for (int i = 0 ; i < n ; i++) {
        char t ; cin >> t ;
        v.push_back(t);
        if (t == 'W') {
            wh++;
        }

    }

    for (int i = n - wh; i < n; i++) {
        if (v[i] == 'R') {
            rd++;
        }
    }
    cout << rd << nl;

}


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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int T = 1;
    while (T--) {
        sol();
    }

    return 0;
}



Measured memory_bytes: 3792
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    s=input()
    if s[0]=='S':
        print("Cloudy")
    elif s[0]=='C':
        print("Rainy")
    else: print("Sunny")
resolve()

Measured memory_bytes: 38256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    t = S()
    ans = 0
    for i in range(3):
        if s[i] == t[i]:
            ans += 1
    print(ans)
    return

#B
def B():
    a, b = LI()
    ans = 0
    b -= 1
    while b > 0:
        b -= a - 1
        ans += 1
    print(ans)

    return

#C
def C():
    n = II()
    h = LI()
    i = 0
    ans = 0
    while i < n:
        down = i+1
        while down < n:
            if h[down - 1] >= h[down]:
                down += 1
            else:
                break
        ans = max(ans, down - i - 1)
        i = down
    print(ans)
    return

#D
def D():
    n = II()
    print(n * (n - 1) // 2)
    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 38640
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

#define MAX_N 200010
struct UF
{
	vector<int> par; // 親
	// 初期化
	UF(int n):par(n) {
		for(int i = 0; i < MAX_N; i++){
			par[i] = i;
		}
	}
	// 木の根を求める
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	// xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		// 木の高さが高い方を代表ノードにする
		par[x] = y;
	}
	// xとyが同じ集合ならtrue
	bool same(int x, int y) { return find(x) == find(y); }
};

map<pair<int,int>,int> mp;

int main()
{
	UF D(200010);
	UF T(200010);
	
	int n,k,l;cin >> n >> k >> l;
	
	REP(i,k)
	{
		int p,q;cin>> p>>q;
		D.unite(p-1,q-1);
	}
	REP(i,l)
	{
		int r,s;cin>>r>>s;
		T.unite(r-1,s-1);
	}
	
	REP(i,n)
	{
		int a = D.find(i);int b = T.find(i);
		if(mp.find(MP(a,b)) == mp.end())mp[MP(a,b)] = 1;
		else mp[MP(a,b)]++;
	}
	
	REP(i,n-1)
	{
		cout << mp[MP(D.find(i),T.find(i))] << ' ';
	}
	cout << mp[MP(D.find(n-1),T.find(n-1))] << endl;
	
	return 0;
}

Measured memory_bytes: 13696
#include <stdio.h>
#define Min(a, b) a < b ? a : b
void initArray(int a[], int len);
int main(void)
{
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);
    int min = Min(a, b);
    int divisors[min];
    initArray(divisors, min);
    int count_divisors = 0;
    int first = 1, last = min;
    while(first <= last)
    {
        if (a % first + b % first == 0)
        {
            divisors[count_divisors] = first;
            count_divisors++;
        }
        first++;
    }
    printf("%d\n", divisors[count_divisors - k]);
    return 0;
}

void initArray(int a[], int len)
{
    for (int i = 0; i < len; i++)
    {
        a[i] = 0;
    }
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll B[100005];
int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    REP(i, N)
    {
        cin >> A[i];
    }
    REP(i, M)
    {
        cin >> B[i].first >> B[i].second;
    }
    sort(B, B + M, [](pll a, pll b) { return a.second > b.second; });
    ll index = 0;
    REP(i, N)
    {
        A.push_back(B[index].second);
        if (--B[index].first <= 0)
            index++;
    }
    sort(A.begin(), A.end(), [](ll a, ll b) { return a > b; });
    ll sum = 0;
    REP(i, N)
    {
        sum += A[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define Mx 200001
#define inf 1e15
const int MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


typedef long long  L;
//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,r,s,t,
u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

//double rat;
char str[10];
int main()
{
    scanf("%s",str);
    if(str[0]=='7'||str[1]=='7'||str[2]=='7'){
        printf("Yes\n");
    }else printf("No\n");
    
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3660
/*
 *  Author : Jun_SH
 *  Solution for sumitrust2019 146 F
 */
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
    int f=1,x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t1,t2,a1,a2,b1,b2;
    cin>>t1>>t2>>a1>>a2>>b1>>b2;
    if(t1*a1+t2*a2==t1*b1+t2*b2)
        puts("infinity");
    else{
        int ans=0;
        if(a1>b1){
            if(a2>=b2)ans=0;
            else {
                int tot=(t1*b1+t2*b2)-(t1*a1+t2*a2);
                int tmp=a1*t1-b1*t1;
                ans+=tmp/tot;
                ans+=(tmp-1)/tot+1;
                if(tot<0)ans=0;
            }
        }
        else if(b1>a1){
            if(b2>=a2)ans=0;
            else {
                int tot=(t1*a1+t2*a2)-(t1*b1+t2*b2);
                int tmp=b1*t1-a1*t1;
                ans+=tmp/tot;
                ans+=(tmp-1)/tot+1;
                if(tot<0)ans=0;
            }
        }
        else ans=t1;
        cout<<ans<<endl;
    }
}


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

typedef long long ll;
typedef vector<int> vi;

#define pb push_back

void slove()
{
	int s, w;
	cin >> s >> w;
	if(w >= s)
		cout << "unsafe" << endl;
	else
		cout << "safe" << endl;
}

int main() 
{
	int t;
	t = 1;
	while(t--) {
		slove();
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
typedef vector<int> VI;

const int N = 100005;
int n, rk[N], m, fa[N];
pii pts[N];

struct Edge{
	int u, v, w;
} E[N << 1];

bool cmpx(int a, int b){
	return pts[a].fi < pts[b].fi;
}


bool cmpy(int a, int b){
	return pts[a].se < pts[b].se;
}

bool cmpw(Edge a, Edge b){
	return a.w < b.w;
}

int Find(int x){return fa[x] == x ? x : fa[x] = Find(fa[x]);}

int main(){
	scanf("%d", &n);
	REP(i, 1, n) scanf("%d%d", &pts[i].fi, &pts[i].se);
	REP(i, 1, n) rk[i] = i;
	sort(rk + 1, rk + n + 1, cmpx);
	REP(i, 1, n - 1){
		int u = rk[i], v = rk[i + 1];
		E[++m] = (Edge){u, v, pts[rk[i + 1]].fi - pts[rk[i]].fi};
	}
	sort(rk + 1, rk + n + 1, cmpy);
	REP(i, 1, n - 1){
		int u = rk[i], v = rk[i + 1];
		E[++m] = (Edge){u, v, pts[rk[i + 1]].se - pts[rk[i]].se};
	}
	sort(E + 1, E + m + 1, cmpw);
	REP(i, 1, n) fa[i] = i;
	LL ans = 0;
	REP(i, 1, m){
		if (Find(E[i].u) != Find(E[i].v)){
			fa[Find(E[i].u)] = Find(E[i].v);
			ans += E[i].w;
		}
	}
	cout << ans << endl;
	return 0;
}

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

def main():
    n = int(input()) + 2
    a_list = list(map(int, input().split()))
    a_list.insert(0,0)
    a_list.append(0)

    all_price = 0
    for i in range(1, n):
        all_price += abs(a_list[i] - a_list[i-1])
    
    for i in range(1, n-1):
        diff = abs(a_list[i] - a_list[i-1]) + abs(a_list[i+1] - a_list[i]) - abs(a_list[i+1] - a_list[i-1])
        print(all_price - diff)

if __name__ == '__main__':
    main()

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

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = [a-1 for a in LIST()]

ans = [0] * N
for a in A:
    ans[a] += 1
[print(a) for a in ans]


Measured memory_bytes: 33264
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
typedef priority_queue<int, vi, greater<int>> pqig;
typedef vector<pqig> vpq;
const int mod = 1000000009;

int n,k,q;
vi a;
int x,y;
int ret;

int popmin(vpq& query){
    int mini = INT_MAX;
    int ind = -1;
    cerr << "qs: " << query.size() << endl;
    REP(i,query.size()){
        if (query[i].top() < mini){
            mini = query[i].top();
            ind = i;
        }
    }
    query[ind].pop();
    if (query[ind].size() < k) query.erase(query.begin()+ind);
    return mini;
}

int solve (vpq& query){
    int remov = 1;
    if (!query.size()){
        return -1;
    }
    int xi = popmin(query);
    while (query.size() && remov < q-1){
        popmin(query);
        remov += 1;
    }
    if (!query.size()){
        return -1;
    } else {
        return popmin(query) - xi;
    }
}

int main(){
    I(n); I(k); I(q);
    if (q == 1) {
        cout << 0 << endl;
        return 0;
    }

    a.resize(n);
    pqig allin;
    REP(i,n) { I(a[i]); allin.push(a[i]); }
    
    ret = INT_MAX;
    int temp = INT_MAX;
    int minim = -1;
    while ( temp >= 0 ){
        vpq query;
        int idx = 0;
        while (idx < n){
            pqig tmpq;
            while (a[idx] > minim && idx < n){
                tmpq.push(a[idx]);
                idx++;
            }
            if (tmpq.size() >= k) query.push_back(tmpq);
            idx++;
        }
        cerr  << "tmp: "<< temp << endl;
        temp = solve(query);
        if (temp < 0) break;
        ret = min(ret,temp);
        minim = allin.top();
        allin.pop();
    }

    cout << ret << endl;
}

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

int main(){
	int x,y,w,h,r;
	cin >> w >> h >> x >> y >> r;
	
	if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r )) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

int main(){
  ll N,M;
  cin>>N>>M;
  vector<ll> st(N+1);
  
  fill(st.begin(),st.end(),0);
  for(int i=0;i<M;i++){
    ll a;
    cin>>a;
    st.at(a)=-1;
  }
  st.at(0)=1;
  if(st.at(1)==-1)
    st.at(1)=0;
  else
    st.at(1)=1;
  
  for(int i=2;i<=N;i++){
    if(st.at(i)==-1)
      st.at(i)=0;
    else{
      st.at(i)=st.at(i-1)+st.at(i-2);
      st.at(i) %= 1000000007;
    }
  }
  cout<<st.at(N)<<endl;
  //for(int i=0;i<=N;i++)
    //cout<<st.at(i)<<endl;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a <= 0 && b >= 0) puts("Zero");
  else if (a > 0) puts("Positive");
  else if ((b - a) % 2) puts("Positive");
  else puts("Negative");
  return 0;
}

Measured memory_bytes: 256
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/*
* File: main.c
* Author: Ivan
*
* Created on July 2, 2018, 3:17 PM
*/

#include <stdio.h>
#include <stdlib.h>
#define INFTY 1000000001
#define MAX_SIZE 500000
/*
*
*/

int Left[MAX_SIZE/2 + 2], Right[MAX_SIZE/2 + 2];
int count = 0;

void merge(int A[], int left, int mid, int right);
void mergeSort(int A[], int left, int right);

int main(int argc, char** argv) {
int *A, n;
scanf("%d", &n);
A = (int *)malloc(sizeof(int) * n);

for (int jx = 0; jx < n; ++jx) scanf("%d", &A[jx]);

mergeSort(A, 0, n);

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

return (EXIT_SUCCESS);
}

void merge(int A[], int left, int mid, int right)
{
int n1 = mid - left;
int n2 = right - mid;
for (int i = 0; i < n1; ++i) Left[i] = A[left + i];
for (int j = 0; j < n2; ++j) Right[j] = A[mid + j];
Left[n1] = INFTY;
Right[n2] = INFTY;
int i = 0, j = 0;
for (int k = left; k < right; ++k)
{
if (Left[i] <= Right[j])
{
A[k] = Left[i];
i = i + 1;
}
else
{
A[k] = Right[j];
j = j + 1;
}
count++;
}
}

void mergeSort(int A[], int left, int right)
{
if (left + 1 < right)
{
int mid = (left + right) / 2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}


Measured memory_bytes: 5612
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;

using ll = long long;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int T, X;
  cin >> T >> X;
  printf("%.10f\n", double(T) / X);
  return 0;
}


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

int main()
{
    int n,a=0,b;
    scanf("%d",&n);
    b=n;
    while(n!=0)
    {
        a+=n%10;
        n=n/10;
    }
    if(b%a==0)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#include <cmath>
#include <bitset>
#include <string>
#include <queue>

using namespace std;

#define int long long

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

    int total = 0;
    for(auto i = mp.begin(); i != mp.end(); i++) {
        int limit = i -> first;
        int time = i -> second;
        if(limit < time) {
            cout << "No" << endl;
            return 0;
        }
        if(limit - total - time <  0) {
            cout << "No" << endl;
            return 0;
        }
        total += time;
    }

    cout << "Yes" << endl;
    return 0;
}

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

int main() {

    int N;
    cin >> N;

    cout << pow(N, 3) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <math.h>
#include <set>
#include <string.h>
#include <vector>
using namespace std;

#define int long long

void fastio()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	fastio();
	int a, b;
	cin >> a >> b;
	int n = a + 1;
	int arr[n];
	int k = 2 * a;
	for (int i = 0; i < n ; i++)
	{
		arr[i] = k;
		k = k + 2;
	}
	if (binary_search(arr, arr + n, b))
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 3132
def solve():
  N, K, C = map(int, input().split())
  workable = [i for i, s in enumerate(input()) if s=="o"]
  if len(workable) == K:
    return workable
    
  prev = workable[-1]
  latest = {prev}
  i = len(workable)-1
  while i > 0:
    i -= 1
    if prev - workable[i] > C:
      latest.add(workable[i])
      prev = workable[i]
      if len(latest) > K:
        return []
  must = []
  i = -1
  prev = -C-1
  while i < len(workable)-1:
    i += 1
    if workable[i] - prev > C:
      if workable[i] in latest:
        must.append(workable[i])
      prev = workable[i]
  return must

for i in solve():
  print(i+1)

Measured memory_bytes: 12576
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	string S; cin >> S;
	if ((S[0] == S[1] && S[1] == S[2]) || (S[1] == S[2] && S[2] == S[3])) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

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

int main(int argc, char **argv) {
    std::string in;
    std::cin >> in; // 6 letters per constraint
    std::cout << (in[2] == in[3] && in[4] == in[5] ? "Yes" : "No") << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		long x = sc.nextLong();
		long counter = 0;
		long org = 100;
		
		while(true) {
			counter++;
			org = (long)(org*1.01);
			if(org>=x)break;
		}

		System.out.println(counter);

	}

	static long divn(int target, int times) {//10_9+7のあまり累乗版
		int sqtimes = (int)Math.sqrt(times);
		long ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		long holder = ans;
		ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans*holder)%(1000000000+7);
		}
		for(int i=0;i<times - sqtimes*sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		return ans;
	}

	static long div(long a) {//10_9+7のあまり
		if(a<0)a+=1000000000+7;
		return a%(1000000000+7);
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


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

int n,k,sum;

int main(){
	cin>>n;
	for(int i = 1;i <= 9;i ++){
		if(n % i != 0){
			sum++;
			continue;
		}else{
			if (n / i > 9){
				sum++;
				continue;
			}else{
				cout<<"Yes"<<endl;
				break;
			}
		}
	}if(sum == 9){
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
def calc_lucas(n):
  """
  Args:
    n (int)
  Returns:
    Luca_n (int)
  """
  luca = [0] * max((n + 1), 2)    # luca[i] = Luca_i
  luca[0] = 2
  luca[1] = 1
  for i in range(2, n+1):
    luca[i] = luca[i-1] + luca[i-2]
  return luca[n]
  



n = int(input())
print(calc_lucas(n))


Measured memory_bytes: 38256
//AOJ 0526 Boat Travel
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
const int INF = 100000000;
typedef pair<int, int> P;
queue <int> a[101];
queue <int> save;
int n, k, go, boat[5000][3], st, list;
int solve(){
	int flag[101];
	queue<P> que;
	que.push(P(st, 0));
	for (int i = 0; i <= 100; i++){
		flag[i] = INF;
	}
	while (que.size()){
		P p = que.front(); que.pop();
		int i = 0;
		save = a[p.first];
		while (save.size()){
			i = save.front();
			save.pop();
			if (p.first == boat[i][0] && flag[boat[i][1]]>p.second + boat[i][2]){
				flag[boat[i][1]] = p.second + boat[i][2];
				que.push(P(boat[i][1], p.second + boat[i][2]));
			}
			if (p.first == boat[i][1] && flag[boat[i][0]] > p.second + boat[i][2]){
				flag[boat[i][0]] = p.second + boat[i][2];
				que.push(P(boat[i][0], p.second + boat[i][2]));
			}
		}
	}
	return flag[go];
}
int main() {
	while (cin >> n >> k){
		int ans;
		bool jud;
		for (int i = 0; i<n; i++){
			while (a[i].size())
				a[i].pop();
		}
		for (int i = 0; i < k; i++){
			cin >> jud;
			if (jud == 1){
				cin >> boat[list][0] >> boat[list][1] >> boat[list][2];
				a[boat[list][0]].push(list);
				a[boat[list][1]].push(list);
				list++;

			}
			if (jud == 0){
				cin >> st >> go;
				ans = solve();
				if (ans == INF)
					cout << -1 << endl;
				else
					cout << ans << endl;
			}
		}
		for (int i = 0; i < 5001; i++){
			boat[i][0] = 0;
			boat[i][1] = 0;
			boat[i][2] = 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1360
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    String s = sc.next();
    String ans = "Yes";

    if(n % 2 == 1){
      ans = "No";
    } else {
    for(int i = 0; i < n / 2; i++){
        if(s.charAt(i) != s.charAt((n / 2) + i)){
          ans = "No";
          break;
        }
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 21588
using System;
using System.Collections.Generic;
using System.Linq;

namespace MyProgram{
    class AtCoder{
        static void Main(){
            var input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var N = input[0];
            var T = input[1];
            var t = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long sum=0;
            for(var i=0;i<N-1;i++){
                if(t[i+1]-t[i]>T)sum+=T;
                else sum+=t[i+1]-t[i];
            }
            System.Console.WriteLine(sum+T);
           
        }
    }
}


Measured memory_bytes: 30880
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可

const ll INF=1e18;

const ll MAX = 2010;
const ll MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    ll n,k;
    cin>>n>>k;
    COMinit();
    for(ll i=1;i<=k;i++){
        ll s=n-k;
        ll t=s+1;
        ll ans=COM(t,i);
        if(i>1) ans=ans*COM(k-1,i-1)%MOD;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n;cin>>n;
    vector<ll> a(n),b(n);
    rep(i,n) cin>>a[i]>>b[i];
    ll bt=0;
    for(int i=n-1;i>=0;i--){
        ll num=a[i]+bt;
        if(num%b[i]==0) continue;
        bt+=(b[i]-num%b[i]);
    }
    cout<<bt<<endl;
    return 0;
}


Measured memory_bytes: 1792
n = int(input())
a = list(map(int, input().split()))

r = sum(a)
if r % 2 == 0:
  print(r // 2)
else:
  a.sort()
  for j in a:
    if (r - j) % 2 == 0:
      print((r-j) // 2)
      break


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

using namespace std;

int top, S[1000];

void push(int x) {
    S[++top] = x;
}

int pop() {
    top--;
    return S[top+1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];
    
    while( scanf("%s", s) != EOF ) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }
    
    printf("%d\n", pop());
    
    return 0;
}


Measured memory_bytes: 3212
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, K = map(int, rl().split())
    A = list(map(int, rl().split()))
    
    def check(t):
        cnt = 0
        for ai in A:
            cnt += -(-ai // t) - 1
        return cnt <= K
    
    ok, ng = 10 ** 9, 0
    while 1 < ok - ng:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    print(ok)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 91896
//K.Chaitanya
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//std::ios::sync_with_stdio(false);
int main(){
    std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int a,b,x;
	cin>>a>>b>>x;
	if(x>=a && x<=(a+b)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}































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

W = []

counter = 0
for i in range(N):
    W.append(input())

if not (len(W)==len(set(W))): #同じ単語
    print("No")

else:
    for i in range(N-1):
        if(W[i][::-1][0] != W[i+1][0]):
            counter +=1

    if(counter>0):
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 3060
<?php
$x = 0;
fscanf(STDIN, "%d %d", $N, $M);

for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d", $A, $B);
    $a[$A][] = $B;
}

$h = new SplMaxHeap;
for ($i = 1; $i <= $M; $i++) {
    if (isset($a[$i]) === true) {
        foreach ($a[$i] as $v) {
            $h->insert($v);
        }
    }
    if ($h->isEmpty() === false) {
        $x += $h->extract();
    }
}
echo $x;

Measured memory_bytes: 47604
#include<stdio.h>

int main(void){
	unsigned long long int n,a,b,x1,x2,r=0,i;
	scanf("%llu%llu%llu",&n,&a,&b);
	scanf("%llu",&x1);
	for(i = 1;i < n;i++){
		scanf("%llu",&x2);
		if(b < (x2-x1)*a){r+=b;}
		else{r+=((x2-x1)*a);}
		x1 = x2;
	}
	printf("%llu\n",r);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int N;
long long ans;
int a[222222];
vector<int>m[22];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>N;
    for(int i=0;i<N;i++){
        int x;
        cin>>x;
        a[i]=x;
        for(int j=0;j<22;j++){
            if(x&(1<<j)){
                m[j].push_back(i);
            }
        }
    }
    for(int i=0;i<22;i++){
        m[i].push_back(N);
        m[i].push_back(N);
    }
    for(int i=0;i<N;i++){
        int cnt = N - i;
        for(int j=0;j<22;j++){
            auto it = upper_bound(m[j].begin(),m[j].end(),i);
            if(a[i]&(1<<j)){
                cnt=min(cnt, *it - i);
            }
            else{
                cnt=min(cnt,*lower_bound(next(it),m[j].end(),*it) - i);
            }
        }
        ans+=cnt;
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 9044
#include <iostream>
#include <string>

using namespace std;

bool r[26];

int main(){
    int state=-1;
    string str;
    int ret=0;
    r['y' - 'a'] = true;
    r['u' - 'a'] = true;
    r['i' - 'a'] = true;
    r['o' - 'a'] = true;
    r['p' - 'a'] = true;
    r['h' - 'a'] = true;
    r['j' - 'a'] = true;
    r['k' - 'a'] = true;
    r['l' - 'a'] = true;
    r['n' - 'a'] = true;
    r['m' - 'a'] = true;
    while(cin >> str){
        ret = 0;
        state = -1;
        if(str == "#") return 0;
        for(int i=0;i<str.size();i++){
            if(r[str[i]- 'a'] == false){
                if(state == 1) ret++;
                state = 0;
            }else{
                if(state == 0) ret++;
                state = 1;
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define Y first
#define X second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int cnt[101][101];
vector<vector<pi> >flr(101, vector<pi>(101));

int func(int y, int x, int now){
  while(cnt[y][x] == 0){
    cnt[y][x] = now;
    int ny = flr[y][x].Y;
    int nx = flr[y][x].X;
    y = ny;
    x = nx;
  }

  if(cnt[y][x] == now) return 1;
  return 0;
}

int main(){
  int N, x, y;
  while(scanf("%d", &N) && N){
    rep(i, N) rep(j, N){
      scanf("%d%d", &x, &y);
      flr[i][j] = make_pair(y, x);
    }

    rep(i, 100) rep(j, 100) cnt[i][j] = 0;
    int res = 0;
    int loop = 1;
    rep(i, N) rep(j, N){
      if(cnt[i][j] == 0){
	res += func(i, j, loop);
	loop++;
      }
    }
    printf("%d\n", res);
  }
  return 0;
}

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

int main(){
  long long a=100, x,i=0;
  cin >> x;
  while(true){
    i++;
    a+=a/100;
    if(a>=x){
      break;
    }
  }
  cout << i <<endl;
  
  return 0;
}


Measured memory_bytes: 3588
#include <stdio.h>
#include <string.h>
#define size 11
#define num 200000

int main(void)
{
    int n=0,count=0;
    char str[num][size]={};

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

    qsort(str,n,size,strcmp);
    for(int i=0;i<n-1;i++){
        if(strcmp(str[i],str[i+1])==0) count++;
    }

    printf("%d",n-count);
    return 0;
}


Measured memory_bytes: 5708
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const ll LINF = 1001002003004005006ll;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    for (int i = 1; i < n - k + 1; ++i) {
        if (a[i - 1] < a[i + k - 1]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    return 0;
}


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

int main() {
    int num_query; scanf("%d", &num_query);
    int command, x, left, right;
    set<int> S;
    
    for (int i = 0; i < num_query; ++i) {
        scanf("%d", &command);
        int find_result = 0;
        switch (command) {
            case 0:
                scanf("%d", &x);
                S.insert(x);
                printf("%d\n", (int) S.size());
                break;
            case 1:
                scanf("%d", &x);
                if (S.find(x) != S.end()) find_result = 1;
                printf("%d\n", find_result);
                break;
            case 2:
                scanf("%d", &x);
                S.erase(x);
                break;
            case 3:
                scanf("%d%d", &left, &right);
                auto lower_itr = S.lower_bound(left);
                auto upper_itr = S.upper_bound(right);
                for (auto itr = lower_itr; itr != upper_itr; ++itr) printf("%d\n", *itr);
                break;
        }
    }
    return 0;
}


Measured memory_bytes: 12516
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define P (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) v.begin(), v.end()
#define int long long
#define MAX 200000+5
int indegree[MAX];
//https://youtu.be/jpIeCsX4oNo?t=396
void topoSort(vi adj[], int N, vi dp){
    set<int> q;
    FOR1(i, N){
        if(indegree[i] == 0){
            q.insert(i);
        }
    }
    while(!q.empty()){
        int v = *q.begin();
        //cout << v << " ";
        for(int neigh : adj[v]){
            dp[neigh] = max(dp[neigh], dp[v] + 1);
        }
        q.erase(q.begin());
        for(int i = 0; i < adj[v].size(); i++){
            indegree[adj[v][i]]--;
            if(indegree[adj[v][i]] == 0) q.insert(adj[v][i]);
        }
    }
    cout << *max_element(all(dp));
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int T = 1;
	//cin>>T;
	while(T-->0)
	{
        int N, M;
        cin>>N>>M;
        vector<int> adj[N+1];
        while(M--){
            int x, y;
            cin >> x >> y;
            adj[x].pb(y);
            indegree[y]++;
        }
        vi dp(N+1, 0);
        topoSort(adj, N, dp);
	    cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 8960
from collections import deque

N = int(input())
A = deque(map(int,input().split()))

ans=[]

A_dict={}

for n in range(N):
    a = A.popleft()
    A_dict[a]=n+1
    
for n in range(N):
    ans.append(A_dict[n+1])

print(*ans, sep=' ')

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

bool contained(int a, int b, int intArray[]){
    while(a>0){
        for(int i=0; i<b; i++){
            if(a%10 == intArray[i]){
                return true;
            }
        }
        a = a/10;
    }
    return false;
}

int main()
{
    int a, b, num, intArray[b];
    cin>>a>>b;
    for(int i=0; i<b; i++){
        cin>>num;
        intArray[i] = num;
    }

    while(contained(a,b, intArray)){
        a = a + 1;
    }
    cout<<a;

    return 0;
}



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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N;
  cin >> N;
  vector<pair<long double, long double>> p(N);
  rep(i,N)
    cin >> p[i].first >> p[i].second;

  sort(begin(p), end(p), [](const auto &l, const auto &r) {
        auto lv = atan2l(l.second, l.first);   
        auto rv = atan2l(r.second, r.first);   
        return lv < rv;
      });

  rep(i, N) {
    p.push_back(p[i]);
  }

  double ans = 0.0;
  rep(i, N) {
    double curx = 0, cury = 0;
    for (int j=i; j<i+N; j++) {
      curx += p[j].first;
      cury += p[j].second;
      ans = max(ans, curx*curx + cury*cury);
    }
  }
  printf("%.20f\n", sqrt(ans));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int dp[100001];

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (auto &e : h)
    cin >> e;

  for (int i = 1; i < n; ++i)
  {
    int tmp = 1e9;
    for (int j = 1; j <= k; ++j)
    {
      if (i < j)
        continue;
      tmp = min(tmp, dp[i - j] + abs(h[i] - h[i - j]));
    }
    dp[i] = tmp;
  }
  cout << dp[n - 1] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;

int main() {
  ll n,a,b;cin>>n>>a>>b;
  ll t=n/(a+b)*a;
  ll r=n%(a+b);
  cout<<t+min(r,a)<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	bool aflag = true;
	int n, alice=0, bob=0, diff;
	cin >> n;
	vector<int> a(n, 0);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for(auto itr = a.rbegin() ; itr!= a.rend(); ++itr){
		if(aflag == true){
			alice += *itr;
			aflag = false;
		}else{
			bob += *itr;
			aflag = true;
		}
	}

	diff = alice - bob;
	cout << diff << endl;
	return 0;
}

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

using namespace std;

int main(){
	
	int A[100] = {};
	int B[100] = {};
	int a, count = 0;
	
	while( cin >> a) {
		
		A[a-1] ++;
		B[a-1] ++;
		count++;
	}
	sort(B, B+count);
	
	for(int i=0;i<100;i++)
	if( A[i] == B[count-1])
	cout << i+1 << "\n";
	
    return 0;
}


Measured memory_bytes: 2948
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define INF 12345678901234
using namespace std;
long long int abss(long long int a){
	return a<0?-a:a;
}
int main(){
	int n;
	cin >>n;
	vector<long long int> a(n);
	rep(i,n)
		cin >>a[i];
	vector<long long int> rsum(n+1);
	long long int sum=0;
	rsum[0]=0;
	rep(i,n){
		sum+=a[i];
		rsum[i+1]+=rsum[i]+a[i];
	}
	int p=0;
	long long int d=INF;
	rep(i,n){
		if(abss(sum-2*rsum[i])<d){
			d=abss(sum-2*rsum[i]);
		}
	}
	cout <<d;
}

Measured memory_bytes: 3328