akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//template<typename A, size_t N, typename T>
//void Fill(A(&array)[N], const T &val) {
	//std::fill((T*)array, (T*)(array + N), val);
//}

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

//解法
void solve() {

	ll N, K;
	cin >> N >> K;

	map<ll,ll> MP;
	rep(i, N) {
		ll a;
		cin >> a;
		MP[a]++;
	}

	vector<pair<ll, ll>> vec;

	for (auto itr = MP.begin(); itr != MP.end(); itr++) {

		vec.emplace_back(*itr);

	}

	sort(vec.begin(), vec.end(), [](const pair<ll, ll>& x, const pair<ll, ll>& y) {return x.second > y.second; });

	ll ans = 0;
	rep(i, min(K, (ll)vec.size())) {
		ans += vec[i].second;
	}

	cout << N - ans;
}

int main() {

	//入力

	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 17260
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
inline bool cheak(int x, int y, int xMax, int yMax){ return x >= 0 && y >= 0 && xMax > x && yMax > y; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }

typedef pair<int, int> P;
typedef tuple<int, int,int> T;
typedef long long ll;
typedef unsigned long long ull;

#define For(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

const int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };
const int mod = 1000000007;
const int INF = 1e9;

int d[100000];

int main()
{

	int n;
	while (cin >> n && n){
		clr(d);
		rep(i, n){
			string S, E;
			cin >> S >> E;

			int s = toInt(S.substr(0, 2)) * 3600 + toInt(S.substr(3, 2)) * 60 + toInt(S.substr(6, 2));
			int e = toInt(E.substr(0, 2)) * 3600 + toInt(E.substr(3, 2)) * 60 + toInt(E.substr(6, 2));

			For(i, s, e){
				d[i]++;
			}
		}

		int ans = 0;
		rep(i, 100000){
			ans = max(d[i], ans);
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1624
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	int n;
	scanf("%d", &n);
	string s;
	scans(s);
	decltype(s)::iterator result = std::unique(all(s));
	s.erase(result, s.end());
	printf("%d\n", s.length());

	return 0;
}


Measured memory_bytes: 704
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
  int N;
  int a[100];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  sort(a, a + N, greater<int>());

  int alice = 0, bob = 0;
  for (int i = 0; i < N; i++) {
    // Alice
    if (i % 2 == 0) alice += a[i];
    else bob += a[i];
  }

  cout << alice - bob << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll n,x,A[200001],B[2001][2001];
    ll ans=1e18;
    cin>>n>>x;
    rep(i,n) cin>>A[i],B[i][i]=A[i];
    rep(i,n)rep(j,n-1) B[i][(i+j+1)%n]=min(B[i][(i+j)%n],A[(i+j+1)%n]);
    rep(i,n){
        ll y=0;
        rep(j,n) y+=B[j][(j+i)%n];
        ans=min(ans,y+x*i);
    }
    cout<<ans;
}

Measured memory_bytes: 32896
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
#define print(x) cout<<(x)<<endl
#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

string S;

ll cnt_opt;

void dfs(int idx,ll can_opt, int Acount, bool isB, bool isC) {
	if (idx == S.size()) {
		cnt_opt = can_opt;
		return;
	}

	//Apart
	if (S[idx] == 'A') {
		if(isB==false && isC==false) dfs(idx + 1, can_opt, Acount + 1, false, false);
		else if (isB == true)dfs(idx + 1, can_opt, 1, false, false);
		else dfs(idx + 1, can_opt, Acount + 1, false, false);

	}
	//Bpart
	else if (S[idx] == 'B') {
		if (isB == false && isC == false)dfs(idx + 1, can_opt, Acount, true, false);
		else if (isB == true)dfs(idx + 1, can_opt, 0, true, false);
		else dfs(idx + 1, can_opt, Acount, true, false);
	}
	//Cpart
	else{
		if (isB == false && isC == false)dfs(idx + 1, can_opt, 0, false, true);
		else if (isB == true)dfs(idx + 1, can_opt + Acount, Acount, false, true);
		else dfs(idx + 1, can_opt, 0, false, true);
	}
	return;
}

void solve() {
	bool isb, isc;
	int acount = 0;
	if (S[0] == 'A') {
		isb = false;
		isc = false;
		acount += 1;

	}
	if (S[0] == 'B') {
		isb = true;
		isc = false;
	}
	if (S[0] == 'C') {
		isb = false;
		isc = true;
	}

	dfs(1, 0, acount, isb, isc);

	print(cnt_opt);

	return;
}



int main() {
	cin >> S;

	solve();



	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <time.h>
#include <complex>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
typedef long long ll;

unsigned gcd(int a, int b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

int main(){

	//int N, M, *A, *B, i, j, *W, *flag, sum=0, start, end, length, tmp;
	int i, j, k, l, m, n, len, a, b, c;
	int *A, B, C, N, K,num_R,num_G,num_B;
	ll sum_A = 0, sum_B = 0, sum_C = 0;
	ll **dp;
	double ans;

	scanf("%d", &N);

	ans = 2.0*N*3.1415926535;
	printf("%lf\n", ans);


	/*
	A= (int *)malloc(N * sizeof(int));

	dp = (ll **)malloc(sizeof(ll*)* (N+1));
	for (i = 0; i<=N; i++){
		dp[i] = (ll *)malloc(sizeof(ll)* 3);
	}

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

	*/


	return 0;

}
    


Measured memory_bytes: 3828
package main

import "fmt"

type point struct {
	x, y int
}

func main() {
	var n int
	fmt.Scan(&n)
	points := make([]point, n)
	for i := range points {
		fmt.Scan(&points[i].x, &points[i].y)
	}
	// 1 <= N <= 50なので、全部の2点間のベクトルを計算できる
	if n <= 1 {
		fmt.Println(1) // 点が2個以下ならコスト1
		return
	}
	vectors := make(map[point]int, 0)
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}
			var v point
			v.x = points[i].x - points[j].x
			v.y = points[i].y - points[j].y
			vectors[v]++
		}
	}
	// fmt.Println("points", points)
	// fmt.Println("vectors", vectors)
	maxv := 0
	for _, v := range vectors {
		maxv = max(maxv, v)
	}
	fmt.Println(n - maxv)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 896
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0

a = sorted(a, reverse=True)

for i in range(0,N,2):
    Alice += a[i]
    if i == N - 1:
        continue
    Bob +=a[i + 1]

print(Alice - Bob)

Measured memory_bytes: 3060
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            s = raw_input()
            if s == '.':
                break
            for i in range(len(s)):
                escape = False
                if s[i] == ')':
                    for j in reversed(range(i)):
                        if s[j] == '(':
                            s = list(s)
                            s[i] = '*'
                            s[j] = '*'
                            s = ''.join(s)
                            break
                        elif s[j] == '[':
                            escape = True
                    else:
                        escape = True
                elif s[i] == ']':
                    for j in reversed(range(i)):
                        if s[j] == '[':
                            s = list(s)
                            s[i] = '*'
                            s[j] = '*'
                            s = ''.join(s)
                            break
                        elif s[j] == '(':
                            escape = True
                    else:
                        escape = True
                if escape:
                    print 'no'
                    break
                # print s
            else:
                if '(' in s or '[' in s:
                    print 'no'
                else:
                    print 'yes'
                                      
        
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Measured memory_bytes: 4664
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <list>
using namespace std;


int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	char op[20];
	int x, n;
	list<int> List;
	cin >> n;
	while (n--)
	{
		scanf("%s", op);
		if (op[0] == 'i')
		{
			cin >> x;
			List.push_front(x);
		}
		else if (op[6] == 'F')
			List.pop_front();
		else if (op[6] == 'L')
			List.pop_back();
		else
		{
			cin >> x;
			for (list<int>::iterator it = List.begin(); it != List.end(); ++it)
				if (*it == x)
				{
					List.erase(it);
					break;
				}
		}

	}
	bool flag = false;
	for (list<int>::iterator it = List.begin(); it != List.end(); ++it)
	{
		if (flag)
			cout << ' ';
		cout << *it;
		flag = true;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 34384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
int fun(string str)
{
    int r=str.size()-1;
    while(r>0)
    {
        if(r%2)
        {
            r--;
            continue;
        }
        int mid=(r)/2;
        int f=0;
        for(int i=0;i<mid;i++)
        {
            if(str[i]!=str[i+mid])
            {
                f=1;
                break;
            }
        }
        if(f)
        {
            r--;
        }
        else return r;
    }
    return 0;
}
int main()
{
    string str; cin>>str;
    cout<<fun(str)<<endl;
}

Measured memory_bytes: 256
import sys
N, M = map(int, input().split())

a = [int(line) for line in sys.stdin]

ans = [-1] * (N + 1)  # not evaluated yet

for broken in a:
    ans[broken] = 0  # unreachable

ans[0] = 1  # reachable

if ans[1]:
    ans[1] = 1

for i in range(2, N + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]

print(ans[N] % 1000000007)


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

#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl;
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl "\n"
const int MAX = 5e3+5;
const ll MAX2 = 11;
const ll MOD = 1000000007;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 450;

ll n,dp[MAX][MAX],ans;
pll x[MAX];

inline bool cmp(pll a,pll b){
 if(a.fi+a.se==b.fi+b.se) return a.fi>b.fi;
 return a.fi+a.se<b.fi+b.se;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    rep(i,1,n)cin>>x[i].fi>>x[i].se;
    sort(x+1,x+1+n,cmp);
    rep(i,0,n)rep(j,1,n)dp[i][j] = MOD<<4;
    rep(i,1,n){
		rep(j,1,n){
	    	if(dp[i-1][j-1]<=x[i].fi)dp[i][j] = min(dp[i-1][j],dp[i-1][j-1]+x[i].se);
	    	else dp[i][j] = dp[i-1][j];
		}
	}
	rep(j,1,n)rep(i,1,n)if(dp[i][j]!=MOD<<4)ans = j;
	cout<<ans<<endl;

}

Measured memory_bytes: 195840
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,M;
string S,T;
cin >> S >> T;
N = S.size(); M = T.size();
for(int i = 0 ; i <= N-M ; i++){ 
bool ok = 1;
for(int j = 0 ; j < M ; j++){
if(T[j] != S[i+j]){
ok = 0;
break;
}
}
if(ok){
cout << i << endl;
}
}
return 0;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
#define FAST_IO   ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define Relocate freopen("./in.txt","r",stdin);freopen("./out.txt","w",stdout)
#define up(mi,a,b) for(mi=a;mi<=b;++mi)
#define down(mi,b,a) for(mi=b;mi>=a;--mi)
#define mfill(a,v) memset(a,v,sizeof(a))
#define INF 0x3f3f3f3f
#define MAX 2000005
#define v_n 5005
#define LL long long
#define e_n 5000005
#define MOD 1000000007
#define eps 0.000000001
#define Blen 32
using namespace std;
vector<int> g[MAX];
int N, M;
struct p {
	int par, sz;
};
p ufs[MAX];
void Init()
{
	for (int i = 1; i <= N; i++)
	{
		ufs[i].par = i;
		ufs[i].sz = 1;
	}
}
int Find(int i)
{
	if (ufs[i].par == i)
		return i;
	return ufs[i].par = Find(ufs[i].par);
}
bool Union(int i, int j)
{
	int si = Find(i), sj = Find(j);
	if (si == sj)
	{
		return 0;
	}
	else if (ufs[si].sz < ufs[sj].sz)
	{
		ufs[si].par = sj;
		ufs[sj].sz += ufs[si].sz;
	}
	else
	{
		ufs[sj].par = si;
		ufs[si].sz += ufs[sj].sz;
	}
	return 1;
}
int main(void)
{
	int i, j, k;
	FAST_IO;
	//Relocate;
	int c;
	cin >> N >> M;
	Init();
	up(i, 1, M)
	{
		cin >> j >> k >> c;
		Union(j, k);
	}
	int ant = 0;
	up(i, 1, N)
	{
		if (ufs[i].par == i)
		{
			ant++;
		}
	}
	cout << ant << endl;
	return 0;
}

Measured memory_bytes: 49280
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int n,t,arr1[105],arr2[105];
double p1,p2,p3,p4;
int main() {
	cin>>n;
	for(int i=0; i<n; i++) {
		cin>>t,arr1[i]=t;
	}
	for(int i=0; i<n; i++) {
		cin>>t,arr2[i]=t;
	}
	for(int i=0; i<n; i++) {
		p1+=abs(arr1[i]-arr2[i]);
		p2+=pow(arr1[i]-arr2[i],2);
		p3+=abs(pow(arr1[i]-arr2[i],3));
		p4=p4>abs(arr1[i]-arr2[i])?p4:abs(arr1[i]-arr2[i]);
	}
	printf("%.6lf\n",p1);
	printf("%.6lf\n",sqrt(p2));
	printf("%.6lf\n",pow(p3,1.0/3));
	printf("%.6lf\n",p4);

}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

std::vector<int> color;
std::vector<std::vector<int> > hen;

std::vector<int> size;
void dfs1(int i, int prev) {
	for (auto j : hen[i]) if (j != prev) dfs1(j, i), size[i] += size[j];
}

std::vector<int> cur;
std::vector<int64_t> res;
void dfs2(int i, int prev) {
	int bak = cur[color[i]];
	for (auto j : hen[i]) if (j != prev) {
		cur[color[i]] = size[j];
		dfs2(j, i);
		res[color[i]] += (int64_t) size[j] * (size[j] + 1) / 2;
	}
	cur[color[i]] = bak - size[i];
	res[color[i]] -= (int64_t) bak * (bak + 1) / 2;
	res[color[i]] += (int64_t) cur[color[i]] * (cur[color[i]] + 1) / 2;
}

int main() {
	int n = ri();
	color.resize(n);
	for (auto &i : color) i = ri() - 1;
	hen.resize(n);
	for (int i = 1; i < n; i++) {
		int a = ri() - 1;
		int b = ri() - 1;
		hen[a].push_back(b);
		hen[b].push_back(a);
	}
	size.resize(n, 1);
	dfs1(0, -1);
	cur.resize(n, size[0]);
	res.resize(n, (int64_t) n * (n + 1) / 2);
	dfs2(0, -1);
	for (auto i : res) printf("%" PRId64 "\n", (int64_t) n * (n + 1) / 2 - i);
	return 0;
}


Measured memory_bytes: 33788
#include<stdio.h>
int main(void) {
	int n,x,y,height,weight,i,size,price;

	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		price = 0;
		for (i = 0; i < n; i++) {
			size = 0;
			scanf("%d %d %d %d", &x, &y, &height, &weight);

			size = x + y + height;
			if (size <= 60 && weight <= 2) price += 600;
			else if (size <= 80 && weight <= 5) price += 800;
			else if (size <= 100 && weight <= 10) price += 1000;
			else if (size <= 120 && weight <= 15) price += 1200;
			else if (size <= 140 && weight <= 20) price += 1400;
			else if (size <= 160 && weight <= 25) price += 1600;
		}
		printf("%d\n",price);
	}
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long int li;

int main(void){
    ll ans=0;
    ll n,h,w;
    cin >> n >> h >> w;
    ll a[n+1],b[n+1];
    for(ll i=1;i<=n;i++){
        cin >> a[i];
        cin >> b[i];
    }
    for(ll i=1;i<=n;i++){
        if(a[i]>=h&&b[i]>=w)ans++;
    }
    
        cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


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

	int n,m;
	cin >> n >> m;
	int64_t ans=1;
	for(int i=1; i<=n; i++) ans = ans * i % mod;
	for(int j=1; j<=m; j++) ans = ans * j % mod;
	if(abs(n-m)>1) ans=0;
	if(n==m) ans = ans * 2 % mod;
	cout << ans << endl;

	return 0;
}


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

int main() {
	int i,n,j;
	cin>>n;
	int a[2][n],r1[n],r2[n];
	for(i=0;i<2;i++)
	 {
	    for(j=0;j<n;j++)
	      cin>>a[i][j];
	 }
	long int sum=0;
	r1[0]=a[0][0];
 	for(i=1;i<n;i++)
 	  {
 	     r1[i]=r1[i-1]+a[0][i];
 	  }
 	r2[n-1]=a[1][n-1];  
 	for(i=n-2;i>=0;i--)
 	   {
 	   	r2[i]=r2[i+1]+a[1][i];
 	   }
        int max1=0;
          for(i=0;i<n;i++)
            {
            	max1=max(max1,(r1[i]+r2[i]));
            }
          cout<<max1<<"\n";  
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Created by Reopard on 2014/05/29.
 */
public class Main{
    static Scanner sc = new Scanner(System.in);
    static int[][] map_tile;
    static int[] dx = {-1, 0, 1, 1, 1, 0, -1, -1};
    static int[] dy = {1, 1, 1, 0, -1, -1, -1, 0};

    public static void main(String args[]){
        int w, h, islandcount;
        while((w = sc.nextInt()) != 0 && (h = sc.nextInt()) != 0){
            islandcount = 0;
            map_tile = new int[h+2][w+2];
            for(int i = 0; i <= w+1; i++) map_tile[0][i] = 0;
            for(int i = 1; i <= h; i++){
                for(int j = 0; j <= w+1; j++){
                    map_tile[i][j] = (j == 0 || j == w+1) ? 0 : sc.nextInt();
                }
            }
            for(int i = 0; i <= w+1; i++) map_tile[h+1][i] = 0;
            for(int i = 1; i <= h; i++){
                for(int j = 0; j <= w+1; j++){
                    if(map_tile[i][j] == 1){
                        islandcount++;
                        deleteIsland(i, j);
                    }
                }
            }
            System.out.println(islandcount);
        }
    }

    public static void deleteIsland(int x, int y){
        map_tile[x][y] = 0;
        for(int i = 0; i < dx.length; i++){
            if(map_tile[x + dy[i]][y + dx[i]] == 1){
                deleteIsland(x + dy[i], y + dx[i]);
            }
        }
    }
}

Measured memory_bytes: 43152
builds =[ [ [0 for i in range(10)] , [0 for i in range(10)] , [0 for i in range(10)] ] , [ [0 for i in range(10)] , [0 for i in range(10)] , [0 for i in range(10)] ]  , [ [0 for i in range(10)] , [0 for i in range(10)] , [0 for i in range(10)] ]  , [ [0 for i in range(10)] , [0 for i in range(10)] , [0 for i in range(10)] ]  ]
n = int(input())
for i in range(n):
    b,f,r,v=map(int,input().split())
    builds[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        if j!=0:
            print()
        for z in range(10):
            print(" %d"%builds[i][j][z],end = '')
    if i<3:
        print('\n####################')
print()


Measured memory_bytes: 5628
package main

import (
  "fmt"
)

func query(H *[][]int, from, to, sign, day int) {
  if to * sign <= (*H)[from][0] * sign {
    fmt.Println(day + 1)
    return
  }
  l := 0
  h := len((*H)[from]) - 1
  var m int
  for ; h - l > 1; {
    m = (h + l) / 2
    if (*H)[from][m] * sign < to * sign {
      l = m
    } else {
      h = m
    }
  }
  day += 1 << uint(l)
  query(H, (*H)[from][l], to, sign, day)
}

func main() {
  var N, L, Q int
  fmt.Scan(&N)
  X := make([]int, N)
  for i := range X {
    fmt.Scan(&X[i])
  }
  fmt.Scan(&L)
  H := make([][]int, N)
  RH := make([][]int, N)
  for i := range H {
    H[i] = make([]int, 0)
    RH[i] = make([]int, 0)
  }
  s := 0
  t := 0
  length := 0
  for ; s < N - 1; {
    for ; length <= L; t++{
      if t == N - 1 {
        for ; s < N - 1; s++ {
          H[s] = append(H[s], N - 1)
        }
        break
      }
      length += X[t + 1] - X[t]
    }
    for ; length > L; s++ {
      H[s] = append(H[s], t - 1)
      length -= X[s + 1] - X[s]
    }
  }
  length = 0
  for ; s > 0; {
    for ; length <= L; t-- {
      if t == 0 {
        for ; s > 0; s-- {
          RH[s] = append(RH[s], 0)
        }
        break
      }
      length += X[t] - X[t - 1]
    }
    for ; length > L; s-- {
      RH[s] = append(RH[s], t + 1)
      length -= X[s] - X[s - 1]
    }
  }
  var h, rh int
  for i := 1; i < N; i++ {
    h = 0
    for ; H[N - 1 - i][h] < N - 1; h++ {
      if len(H[H[N - 1 - i][h]]) < h + 1 {
        H[N - 1 - i] = append(H[N - 1 - i], N - 1)
      } else {
        H[N - 1 - i] = append(H[N - 1 - i], H[H[N - 1 - i][h]][h])
      }
    }
    rh = 0
    for ; RH[i][rh] > 0; rh++ {
      if len(RH[RH[i][rh]]) < rh + 1 {
        RH[i] = append(RH[i], 0)
      } else {
        RH[i] = append(RH[i], RH[RH[i][rh]][rh])
      }
    }
  }
  fmt.Scan(&Q)
  var a, b int
  for i := 0; i < Q; i++ {
    fmt.Scan(&a, &b)
    if a < b {
      query(&H, a - 1, b - 1, 1, 0)
    } else {
      query(&RH, a - 1, b - 1, -1, 0)
    }
  }
}

Measured memory_bytes: 69376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = null;

		while((str = br.readLine()) != null) {
			String[] num = str.split(" ");
			int a = Integer.parseInt(num[0]);
			int b = Integer.parseInt(num[1]);

			int digitnum = String.valueOf(a + b).length();
			System.out.println(digitnum);
		}
	}
}

Measured memory_bytes: 24360
#import numpy


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

#dtype('int64')

#ans = numpy.prod(a, dtype = 'int64')

ans = 1

for i in a:
    if(i == 0):
        print(0)
        exit(0)


for i in a:
    ans *= i
    if(ans > int(1e18)):
        print(-1)
        exit(0)

if ans > int(1e18):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 21476
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int main() {
  int n, m; cin>>n>>m;
  int b[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  vector<int> a(m);
  rep(i, m) {
    int t; cin>>t; --t;
    a[i] = t;
  }
  sort(a.begin(), a.end(), greater<int>());

  vector<int> dp(n+1, -1);
  dp[0] = 0;
  REP(i, 1, n+1) rep (j, m) {
    if (i - b[a[j]] >= 0 and dp[i - b[a[j]]] != -1) {
      dp[i] = max(dp[i], dp[i - b[a[j]]] + 1);
    }
  }

  string ans = "";
  int cur = n;
  rep(i, dp[n]) {
    rep(j, m) {
      if (cur - b[a[j]] >= 0 and dp[cur-b[a[j]]] == dp[cur]-1) {
        ans += '1' + a[j];
        cur -= b[a[j]];
        break;
      }
    }
  }
  print(ans);

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;

const int maxN = 1e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b){return !b ? a : gcd(b, a % b);}
ll modP(ll a, ll b) {return (!b ? 1 : (modP(a, b / 2) * modP(a, b / 2) * (b % 2 ? a : 1)) % MOD);}

int n, k, i, j, dp[2][maxN], a[105];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (i = 0; i < n; i++){
		cin >> a[i];
	}
	for (i = 0; i <= k; i++){
		dp[0][i] = 0;
		dp[1][i] = 0;
		for (j = 0; j < n; j++){
			if (a[j] <= i){
				dp[0][i] |= (!(dp[1][i - a[j]]));
				dp[1][i] |= (!(dp[0][i - a[j]]));
			}
		}
	}
	cout << (dp[0][k] == 1 ? "First" : "Second") << endl;
	return 0;
}



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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	ll a, b;
	cin >> n >> a >> b;
	const ll c = a - b;
	vector<ll> h(n);
	for(int i = 0; i < n; ++i){ cin >> h[i]; }
	ll lo = 0, hi = 1000000000;
	while(lo < hi){
		const ll mid = lo + (hi - lo) / 2;
		ll x = 0;
		for(int i = 0; i < n; ++i){
			x += (max(0ll, h[i] - b * mid) + c - 1) / c;
		}
		if(x <= mid){
			hi = mid;
		}else{
			lo = mid + 1;
		}
	}
	cout << lo << endl;
	return 0;
}



Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(auto it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template <typename T>  using ordered_set =
    tree<T, null_type, less<T>,
    rb_tree_tag, tree_order_statistics_node_update>;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t,n,l,i;
    int cnt=0;
    
    cin>>t>>n>>l;
    
    for(i = t; i <= n; i++)
    {
         if(i%l==0)
          cnt++;
    }
    cout<<cnt;

     return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();
		System.out.println((Math.abs(x-a)>Math.abs(x-b))? "B":"A");
	}
}

Measured memory_bytes: 21332
using System;

namespace _0592
{
    class Program
    {
        static void Main(string[] args)
        {
            int goukei = 0;
            for (int i = 0; i < 5; i++)
            {
                int now = int.Parse(Console.ReadLine());
                if (now < 40)
                {
                    goukei += 40;
                }
                else
                {
                    goukei += now;
                }

            }
            Console.WriteLine(goukei / 5);
        }
    }
}

Measured memory_bytes: 9072
#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;
ll A[303030];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,3*N) cin>>A[i];
	sort(A,A+3*N);
	reverse(A,A+3*N);
	ll ret=0;
	FOR(i,N) ret += A[2*i+1];
	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);
	solve(); return 0;
}


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

const int N = 1e5 + 10;

vector<int> G[N], H[N];
int f[N];
int findSet (int x) { return x == f[x] ? x : f[x] = findSet(f[x]); }

void dfs (int u, int par) {
	for (auto & v : G[u]) {
		if (v == par) continue;
		dfs(v, u);
		if (H[v].size() & 1) {
			H[v].push_back(u);
		} else {
			H[u].push_back(v);
		}
	}
}

int main (void) {
	int n, m;
	scanf("%d%d", &n, &m);
	if (m & 1) {
		puts("-1");
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		f[i] = i;
	}
	for (int i = 1, u, v; i <= m; i++) {
		scanf("%d%d", &u, &v);
		int uu = findSet(u);
		int vv = findSet(v);
		if (uu != vv) {
			G[v].push_back(u);
			G[u].push_back(v);
			f[vv] = uu;
		} else {
			H[u].push_back(v);
		}
	}
	dfs(1, 1);
	for (int i = 1; i <= n; i++) {
		for (auto & j : H[i]) {
			printf("%d %d\n", i, j);
		}
	}
}

Measured memory_bytes: 15104
N,K= map(int,input().split())
X = list(map(int, input().split())) 

answer = 10**9

for i in range(N):
    if i+K-1>= N: break
    answer = min(answer,abs(X[i+K-1]-X[i])+min(abs(X[i]),abs(X[i+K-1])))

print(answer)




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

P p[300000];
int main(){
	int n;cin>>n;
	rep(i,n){
		cin>>p[i].first>>p[i].second;
	}
	sort(p,p+n,[](P a,P b){return a.second<b.second;});
	ll sum=0;
	rep(i,n){
		sum+=p[i].first;
		if(sum>p[i].second){
			puts("No");return 0;
		}
	}
	puts("Yes");
}

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

int main() {
	string s, s1;
	int ans;
	int ans1 = 100;
	bool flg;
	cin >> s;

	for (int i = 0; i < 26; i++) {
		ans = 0;
		int l = s.length();
		int cnt = 1;
		s1 = s;
		while (1) {
			flg = true;
			for (int j = 0; j < l-cnt; j++) {
				if (s1[j+1] != s1[j]) {
					flg = false;
					break;
				}
			}
			if (flg == true) break;
			for (int j = 0; j < l-1; j++) {
				if (s1[j+1] == 'a' + i) {
					s1[j] = 'a' + i; 
				}
			}
			ans ++;
			cnt ++;
		}
		ans1 = min(ans, ans1);
	}
	cout << ans1 << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 500

int main() {
	char sInput[MAX_STRING+1]="";
	char* psInput;

	int i=0;
	int nA=0;
	int nB=0;
	int nC=0;
	int nHands=0;
	int nMax=0;
	int nColumns=0;
	int nUpPoints[101];
	int nDownPoints[101];
	int nSubTotal=0;
	int nMaxTotal=0;

	// read line 1
	gets(sInput);
	nColumns = atoi(sInput);
	// read line 2
	gets(sInput);
	psInput = strtok(sInput," ");
	for (i=0;i<nColumns&&psInput;i++){
		nUpPoints[i] = atoi(psInput);
		nSubTotal=nSubTotal+nUpPoints[i];
		psInput = strtok(NULL," ");
	}
	// read line 3
	gets(sInput);
	psInput = strtok(sInput," ");
	for (i=0;i<nColumns&&psInput;i++){
		nDownPoints[i] = atoi(psInput);
		psInput = strtok(NULL," ");
	}
	nSubTotal=nSubTotal+nDownPoints[nColumns-1];
	nMaxTotal=nSubTotal;

	for(i=nColumns-1;i>0;i--){
		nSubTotal=nSubTotal-nUpPoints[i]+nDownPoints[i-1];
		if ( nMaxTotal<nSubTotal){
			nMaxTotal=nSubTotal;
		}
	}


	printf("%d\n",nMaxTotal);

    return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;

int N;
vector<vector<int>> G;
vector<int> c, ans;
int main(){
  cin >> N;
  G.resize(N);
  c.resize(N);
  ans.resize(N, 0);
  //cout << "hello "<< endl;
  REP(i, N-1){
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  REP(i, N){
    cin >> c[i];
  }
  sort(c.rbegin(), c.rend());
  int msize = G[0].size(), maxi = 0;
  REP(i, N){
    if(msize < G[i].size()){
      maxi = i;
      msize = G[i].size();
    }
  }
  vector<int> homon(N,0);
  homon[maxi] = 1;
  queue<int> q;
  q.push(maxi);
  int cnt = 0;
  //cout << "a" << endl;
  while(!q.empty()){
    int t = q.front();
    homon[t] = 1;
    //cout << t << endl;
    q.pop();
    ans[t] = c[cnt];
    cnt++;
    REP(i, G[t].size()){
      if(homon[G[t][i]] == 0)
        q.push(G[t][i]);
    }
    //cout << "cnt:" << cnt << endl;
  }
  //cout << "h" << endl;
  int sum = 0;
  REP(i, N){
    REP(j, G[i].size()){
      sum += min(ans[i], ans[G[i][j]]);
    }
  }
  cout << sum/2 << endl;
  REP(i, N){
    cout << ans[i] << " ";
  }
  cout << endl;

  // int msize = G[0].size(), maxi = 0;
  // REP(i, N){
  //     if(msize < G[i].size()){
  //       maxi = i;
  //       msize = G[i].size();
  // }
  // int cnt = 2;
  // ans[maxi] = c[c.size()-1];

  

  return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int N = sc.nextInt();
            int Z = 0;
            for (int i = 0; i < N; i++) {
                int D1 = sc.nextInt();
                int D2 = sc.nextInt();
                if (D1 == D2) {
                	Z++;
                } else {
                	Z = 0;
                }
                if (Z == 3) {
                	break;
                }
            }
            if (Z == 3) {
            	System.out.println("Yes");
            } else {
            	System.out.println("No");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 25376
#include<stdio.h>
#include<string.h>

int min(int x, int y){
  if(x<y){
    return(x);
  }else{
    return(y);
  }
}

int main(void){
  char s[100001];
  scanf("%s",s);
  int n=strlen(s);
  int red=0,blue=0;
  
  for(int i=0;i<n;i++){
    if(s[i]=='0'){
      red++;
    }else{
      blue++;
    }
  }
  
  printf("%d",min(red,blue)*2);
  
  return(0);
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

lli GCD(lli x, lli y)
{
    if(x<y)swap(x,y);
    if (y == 0) {
        return x;
    } else {
        return GCD(y, x % y);
    }
}
lli LCM(lli a,lli b)
{
    return a/GCD(a,b)*b;
}

lli d[1000100];
bool vis[1000100];

void func(long long N, std::vector<long long> A){

    lli now = A[0];
    REP(i,1,N){
        now = GCD(now,A[i]);
    }
    if(now != 1){
        cout<<"not coprime"<<endl;
        return;
    }

    set<lli> s;
    lli oneCnt = 0;
    REP(i,0,N){
        if(A[i]==1)oneCnt++;
        else{
            s.insert(A[i]);
            d[A[i]]=1;
        }
    }
    if(s.size()!=N-oneCnt){
        cout<<"setwise coprime"<<endl;
        return;
    }

    bool ok = true;
    for(lli i=2;i<1000100;i++){
        if(vis[i])continue;
        if(!ok)break;
        lli now = i;
        lli cnt = 0;
        while(now<1000100){
            vis[now]=true;
            if(d[now])cnt++;
            if(cnt>=2){
                ok = false;
                break;
            }
            now+=i;
        }
    }

    if(ok){
        cout<<"pairwise coprime"<<endl;
    }
    else{
        cout<<"setwise coprime"<<endl;
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, std::move(A));
    return 0;
}


Measured memory_bytes: 65760
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll k, n;cin >> k >> n;
	vector<ll> v(2 * n);
	REP(i, n)cin >> v[i];
	REP(i, n)v[n + i] = v[i] + k;
	ll ans = LLINF;
	REP(i, n)ans = min(ans, v[n + i - 1] - v[i]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
char alf[26];
int a,n;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	alf[0]='A';
	FOR(i,1,26) alf[i]=alf[i-1]+1;
	cin>>n>>a;
	n=n%500;
	if(n<=a)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF (1e9+10)
#define EPS 1e-9

int main(){
	int n;
	while(cin>>n,n){
	    vs s(n);
	    rep(i,n)cin>>s[i];
	    int mn=-INF,mx=INF;
        for(int i=1;i<n;i+=2){
            if(s[i]=="x"){
                try{mn=max(mn,stoi(s[i-1])+1);}catch(...){cout<<"none"<<endl;goto end;}
            }else{
                try{if(stoi(s[i-1])>=stoi(s[i])){cout<<"none"<<endl;goto end;}}catch(...){}
            }
        }
        for(int i=1;i<n-1;i+=2){
            if(s[i]=="x"){
                try{mn=max(mn,stoi(s[i+1])+1);}catch(...){cout<<"none"<<endl;goto end;}
            }else{
                try{if(stoi(s[i+1])>=stoi(s[i])){cout<<"none"<<endl;goto end;}}catch(...){}
            }
        }
        for(int i=0;i<n-1;i+=2){
            if(s[i]=="x"){
                try{mx=min(mx,stoi(s[i+1])-1);}catch(...){cout<<"none"<<endl;goto end;}
            }else{
                try{if(stoi(s[i+1])<=stoi(s[i])){cout<<"none"<<endl;goto end;}}catch(...){}
            }
        }
        for(int i=2;i<n;i+=2){
            if(s[i]=="x"){
                try{mx=min(mx,stoi(s[i-1])-1);}catch(...){cout<<"none"<<endl;goto end;}
            }else{
                try{if(stoi(s[i-1])<=stoi(s[i])){cout<<"none"<<endl;goto end;}}catch(...){}
            }
        }
        if(mx==mn){
            cout<<mx<<endl;
        }else if(mx>mn){
            cout<<"ambiguous"<<endl;
        }else{
            cout<<"none"<<endl;
        }
        end:;
	}
	return 0;
}



Measured memory_bytes: 3280
// https://atcoder.jp/contests/abc170/tasks/abc170_a

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

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

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

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

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

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

const ll INF = 1e18;

void solve();

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

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

  return 0;
}
#endif

void solve() {
  ll ct = 5;
  VL xs(ct);
  rep(i, ct) cin >> xs[i];

  rep(i, ct) {
    if (xs[i] == 0) drop(i + 1);
  }
}


Measured memory_bytes: 3640