akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1;(i)>=(k);--(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FOR(i,0,n)
#define pb push_back
using namespace std;

int clearnum;

int scoreplus(int *a, int b, int e){
    int scoreplus = 0;
    REP(i,e-b+1){
        scoreplus += *(a + b + i);
    }
    return scoreplus;
}

void clear(int *a,int b,int e){
    REP(i,e-b+1){
        *(a + b + i) = 0;
    }
    clearnum++;
}

int main(){
    int h;
    while(cin >> h && h > 0){
        int a[h][5], score = 0;
        REP(i,h){
            REP(j,5){
                cin >> a[i][j];
            }
        }
        while(1){
            clearnum = 0;
            REP(i,h){
                if(a[i][0] > 0 && a[i][0] == a[i][1] && a[i][0] == a[i][2]){
                    if(a[i][0] == a[i][3]){
                        if(a[i][0] == a[i][4]){
                           score += scoreplus(a[i],0,4);
                            clear(a[i],0,4);
                        }
                        else{
                            score += scoreplus(a[i],0,3);
                            clear(a[i],0,3);
                        }
                    }
                    else{
                        score += scoreplus(a[i],0,2);
                        clear(a[i],0,2);
                    }
                }
                else if(a[i][1] > 0  && a[i][1] == a[i][2] && a[i][1] == a[i][3]){
                    if(a[i][1] == a[i][4]){
                        score += scoreplus(a[i],1,4);
                        clear(a[i],1,4);
                    }
                    else{
                        score += scoreplus(a[i],1,3);
                        clear(a[i],1,3);
                    }
                }
                else if(a[i][2] > 0 && a[i][2] == a[i][3] && a[i][2] == a[i][4]){
                    score += scoreplus(a[i],2,4);
                    clear(a[i],2,4);
                }
            }

            if(clearnum == 0) break;
            REP(j,5){
                vector<int> V(0,0);
                REP(i,h){
                    if(a[i][j]) V.pb(a[i][j]);
                }
                REP(i,h){
                    a[i][j] = 0;
                }
                FOR(i,h-V.size(),h){
                    a[i][j] = V[i-(h-V.size())];
                }
            }
        }
        cout << score << endl;
    }
    return 0;
}

Measured memory_bytes: 1216
#include<stdio.h>
main(){
  int a,b,s;
  scanf("%d%d",&a,&b);
  while(1){
    if(a%b!=0)
      {
	s=a%b;
	a=b;
	b=s;
      }
    else if (a%b==0)
      {
	printf("%d\n",b);
	break;
      }
    
  }
  
  return 0;
  
}

Measured memory_bytes: 592
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int N = 6010;

int n, m;
long long ans;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    if (n == 1 && m == 1)
    {
        cout << 1;
        return 0;
    }
    if (n == 1 || m == 1)
    {
        cout << n + m - 3;
        return 0;
    }
    cout << 1LL * (n - 2) * (m - 2);
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,m;
    cin>>n>>m;
    Vec a(m);
    rep(i,m){
        cin>>a[i];
    }
    ll const MN = n+1;
    Vec match{0,2,5,5,4,5,6,3,7,6};
    Vec dp(MN,-1e10);
    sort(ALL(a));
    dp[0]=0;
    rep(i,MN){
        rep(j,a.size()){
            ll &cm = match[a[j]];
            if(i-cm<0)continue;
            if(dp[i-cm]!=-1e10){
                dp[i] = max(dp[i],dp[i-cm]+1);
            }
        }
    }


    ll use = n;
    rep(i,dp[n]){
        per(j,m-1){
            ll &cm = match[a[j]];
            if(i==dp[n]-1){
                if(use-cm!=0)continue;
            }
            if(dp[use]-dp[use-cm]==1){
                cout<<a[j];
                use -= cm;
                break;
            }
        }
    }
    return  0;
}


Measured memory_bytes: 384
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
	int i,j;
	int n,m,l;;
	scanf("%d%d%d",&n,&m,&l);
	vector<pair<int,int> > a[3000];
	for(i=0;i<m;++i){
		int p,q,r;
		scanf("%d%d%d",&p,&q,&r);
		--p;
		--q;
		a[p].push_back(make_pair(q,r));
		a[q].push_back(make_pair(p,r));
	}
	int b[3000];
	memset(b,0x7f,sizeof(b));
	priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > c;
	for(i=0;i<l;++i){
		int p;
		scanf("%d",&p);
		--p;
		b[p]=0;
		c.push(make_pair(0,p));
	}
	while(!c.empty()){
		int p,q;
		p=c.top().first;
		q=c.top().second;
		c.pop();
		for(i=0;i<(int)a[q].size();++i){
			if(b[a[q][i].first]<=p+a[q][i].second)
				continue;
			b[a[q][i].first]=p+a[q][i].second;
			c.push(make_pair(p+a[q][i].second,a[q][i].first));
		}
	}
	int mx=0;
	for(i=0;i<n;++i)
		for(j=0;j<(int)a[i].size();++j)
			mx=max(mx,max(b[i],b[a[i][j].first])+(a[i][j].second-abs(b[i]-b[a[i][j].first])+1)/2);
	printf("%d\n",mx);
	return 0;
}

Measured memory_bytes: 4172
import java.util.*;
import java.io.*;
public class Main 
{
	public static void main(String[] args) 
	{
		try
		{
			BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in));
			String line;
			while ((line = stdReader.readLine()) != null)
			{
				if(line.equals("END OF INPUT"))
				{
					break;
				}
				int count = 0;
				for(int i = 0; i < line.length(); ++i)
				{
					if(line.charAt(i) == ' ')
					{
						System.out.print(count);
						count = 0;
					}
					else
					{
						++count;
					}
				}
				System.out.println(count);
			}
			stdReader.close();
		}
		catch (Exception e)
		{
			e.getStackTrace();
			System.exit(-1);
		}
	}
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
#define MOD (1000000007)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = n - 1;

    for(ll i = 2; i <= sqrt(n); i++){
        if(n % i == 0){
            ans = min(ans, i - 1 + n / i - 1);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int n, x;
    while(1){
        cin >> n >> x;
        if(n == 0 && x == 0) break;
        int count = 0;
        for(int i = 1; i <= n - 2; i++){
            for(int j = 2; j <= n - 1; j++){
                for(int k = 3; k <= n; k++){
                    if(i < j && j < k && i + j + k == x){
                        count++;
                    }
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
string s;

int main(){
	cin>>n>>s;
	vl a,dp;
	for(int i=1;i<=n;i++) if(n%i==0&&n/i%2==1) a.push_back(i);
	int m=a.size();
	dp=vl(m);
	for(int i=0;i<m;i++){
		int x=a[i];
		for(int j=0;j<x;j++) dp[i]=(2*dp[i]+(s[j]-'0'))%mod;
		(dp[i]+=1)%=mod;
		bool flag=0;
		for(int j=0;j<n;j++){
			char c=s[j%x];
			if(j/x%2==1){
				if(c=='1') c='0';
				else c='1';
			}
			if(c>s[j]) dp[i]=(dp[i]-1+mod)%mod;
			if(c!=s[j]) break;
		}
		for(int j=0;j<i;j++) if(x%a[j]==0&&x/a[j]%2==1) dp[i]=(dp[i]-dp[j]+mod)%mod;
	}
	ll res=0;
	for(int i=0;i<m;i++) (res+=dp[i]*a[i]*2%mod)%=mod;
	cout<<res<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int ans = -1;
    if(a<=9 && b<=9)ans = a*b;

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



Measured memory_bytes: 256
from math import ceil


def all_green(D: int, G: int, PC: int)->int:
    min_coin_num = float('inf')
    for n in range(1 << D):
        # 中途半端に解く問題の(番号, 数)
        not_used = []
        # 完全に解く問題数と、使った時の得点
        used_coin_num, total_point = 0, 0
        for i, (p, c) in enumerate(PC):
            # n = 0b10110 とすると、
            # レベル 1 問題をとかない
            # レベル 2 問題をとく
            # レベル 3 問題をとく
            # レベル 4 問題をとかない
            # レベル 5 問題をとく
            # と考える。
            if n & 1 == 1:
                # 完全に解く問題
                total_point += (100*(i+1)) * p + c
                used_coin_num += p
            else:
                # 完全にとかない問題
                not_used.append((i, p))
            n = n >> 1

        if total_point >= G:
            # 完全に解く問題だけで間に合うならそれで終わり。
            min_coin_num = min(min_coin_num, used_coin_num)
        else:
            # 完全に解く問題だけで間に合わない場合は、いづれか一種類のレベル
            # の問題を中途半端に解いて補填する。
            for i, p in not_used:
                # (中途半端に使う問題数) = ceil((残っている得点) / (注目している問題一つの得点))
                coin_num = ceil((G-total_point)/(100*(i+1)))
                if coin_num < p:
                    # コインの枚数が足りる場合のみ
                    min_coin_num = min(min_coin_num, used_coin_num+coin_num)

    return min_coin_num


if __name__ == "__main__":
    D = 0
    D, G = map(int, input().split())
    PC = [tuple(int(s) for s in input().split()) for _ in range(D)]
    ans = all_green(D, G, PC)
    print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {

	uint N, W;
	cin >> N >> W;

	vector<pair<uint, uint>> wv(N);
	for(uint i=0; i<N; i++) {
		uint w, v;
		cin >> w >> v;
		wv[i] = make_pair(w, v);
	}

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

	vector<vector<ull>> dp(W+1, vector<ull>(N+1, 0));

	for(uint j=1; j<=W; j++) {
			for(uint i=1; i<=N; i++) {
				uint wi = wv[i-1].first;
				uint vi = wv[i-1].second;
				if(j >= wi) {
					dp[j][i] = max(dp[j-wi][i-1] + vi, dp[j][i-1]);
				} else {
					dp[j][i] = dp[j][i-1];
				}
		}
	}

	ull ans = *max_element(dp[W].begin(), dp[W].end());
	cout << ans;

	return 0;
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int N;
	cin>>N;
	double Y=0;
	vector<double> x(N);
	vector<string> u(N);
	FDS(i,N){
		cin>>x[i]>>u[i];
	}
	
	FDS(i,N){
		if(u[i]=="JPY"){
			Y+=x[i];
		}
		if(u[i]=="BTC"){
			Y+=x[i]*380000.0;
		}
	}
	cout<<Y<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
#define pb push_back
#define PI 3.14159265
int M = 998244353;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, b;
  cin >> a >> b;
  cout << a*b;
}

Measured memory_bytes: 3664
#!/usr/bin/env python3
import math
n = int(input())
def max_digit(p,q):
    p_i = 0
    q_i = 0
    while p+q != 0:
        if p: 
            p //= 10
            p_i +=  1
        if q:
            q //= 10
            q_i += 1
    return max(p_i,q_i)
for i in range(math.ceil(n**(1/2)),0,-1):
    if n % i == 0:
        print(max_digit(i,n//i))
        exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N;
	cin >> N;
	int A,B;
	cin >> A >> B;
	int sum = 0;
	for (int i = 1; i <= N; ++i)
	{
		int tmp = 0;
		int tmp1 = i;
		while(tmp1 != 0){
			tmp += tmp1 % 10;
			tmp1 /= 10;
		}
		if(A <= tmp && tmp <= B){
			sum += i;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]

D = {a:i for i,a in enumerate(sorted(A))}

A = [D[A[i]] for i in range(N)]

odd = [A[i] for i in range(N) if i%2 == 0]
even = [A[i] for i in range(N) if i%2 == 1]

odd.sort()
even.sort()

B = []

for i in range(N):
    if i%2 == 0:
        B.append(odd[i//2])
    else:
        B.append(even[i//2])

count = 0

for i in range(N):
    if i%2 == 0 and B[i]%2 != 0:
        count += 1

print(count)

Measured memory_bytes: 19880
def function(N, L):
    ans = 0
    for i in range(len(L)):
        M = L[len(L)-1-i]
        for j in range(len(L)-i-2):
            for k in range(j+1, len(L)-i-1):
                if not (L[j] == L[k]):
                    if not (M == L[k]):
                        if not (L[j] == M):
                            if L[j]+L[k] > M:
                                ans += 1
    return ans


if __name__ == '__main__':
    N = int(input())
    L = input().split()
    L = [int(i) for i in L]
    L = sorted(L)
    print(function(N, L))


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

int main(){
    ll n = 100;
    ll x;
    cin >> x;
    ll year = 0;
    while (true){
        n = n * 1.01;
        year ++;
        if (n >= x){
            cout << year << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


public class Main {
	
	public static void main(String[] args) throws IOException {
		new Main().exec();
	}
	
	public void exec() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		String S = br.readLine();
		int i=1;
		for(char c: S.toCharArray()) {
			if(i%2==1){
				out.print(c);
			}
			i++;
		}
		out.println("");
		out.flush();
	}
	
}

Measured memory_bytes: 21204
A,B,M=list(int(i) for i in input().split())
acost=list(int(i) for i in input().split())
bcost=list(int(i) for i in input().split())
mina=min(acost)
minb=min(bcost)
amount=10**19+1
for _ in range(M):
    x,y,c=list(int(i) for i in input().split())
    if (acost[x-1]+bcost[y-1]-c)<amount:
        amount=acost[x-1]+bcost[y-1]-c
if amount<=(mina+minb):
    print(amount)
else:
    print(mina+minb)


Measured memory_bytes: 18652
#include <bits/stdc++.h>
using namespace std;
int a[501]={},s=0,n;
int main(){
	cin>>n;
	for (int i=1;i<=2*n;i++)cin>>a[i];
	sort(a+1,a+2*n+1);
	for (int i=1;i<=2*n;i++)
	if (i%2==1) s+=a[i];
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
vector<ll> Dijkstra_list(int n, int s, vector<vector<pair<ll, ll>>> &Edge) {
    vector<bool> visited(n, false); //確定済み
    vector<ll> d(n, __LONG_LONG_MAX__ / 3);
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
        que; //頂点とsからの距離
    d[s] = 0;
    que.push(make_pair(0, s));
    while(!que.empty()) {
        auto now = que.top();
        que.pop();
        visited[now.second] = true;
        for(auto e : Edge[now.second]) {
            if(visited[e.second])
                continue;
            if(d[e.second] > d[now.second] + e.first) {
                d[e.second] = d[now.second] + e.first;
                que.push(make_pair(d[e.second], e.second));
            }
        }
    }
    return d;
}
int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--, y--;
    vector<vector<int>> edge(n);
    edge[x].push_back(y);
    edge[y].push_back(x);
    for(int i = 0; i < n - 1; i++) {
        edge[i].push_back(i + 1);
        edge[i + 1].push_back(i);
    }
    map<int, int> mp;
    for(int i = 0; i < n; i++) {
        vector<int> d(n, -1);
        queue<int> que;
        que.push(i);
        d[i] = 0;
        while(!que.empty()) {
            int now = que.front();
            que.pop();
            for(auto next : edge[now]) {
                if(d[next] == -1) {
                    d[next] = d[now] + 1;
                    que.push(next);
                }
            }
        }
        for(int j = i + 1; j < n; j++) {
            mp[d[j]]++;
        }
    }
    for(int k = 1; k < n; k++) {
        cout << mp[k] << endl;
    }
}


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

        using namespace std;
        typedef long long ll;
        void __print(int x) {cerr << x;}
        void __print(long x) {cerr << x;}
        void __print(long long x) {cerr << x;}
        void __print(unsigned x) {cerr << x;}
        void __print(unsigned long x) {cerr << x;}
        void __print(unsigned long long x) {cerr << x;}
        void __print(float x) {cerr << x;}
        void __print(double x) {cerr << x;}
        void __print(long double x) {cerr << x;}
        void __print(char x) {cerr << '\'' << x << '\'';}
        void __print(const char *x) {cerr << '\"' << x << '\"';}
        void __print(const string &x) {cerr << '\"' << x << '\"';}
        void __print(bool x) {cerr << (x ? "true" : "false");}

        template<typename T, typename V>
        void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
        template<typename T>
        void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
        void _print() {cerr << "]\n";}
        template <typename T, typename... V>
        void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
        #ifndef ONLINE_JUDGE
        #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
        #else
        #define debug(x...)
        #endif
        const long long INF  = 1e18;
        int md = 1e9+7;
   
        int main()
        {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            string s,t;
            cin>>s>>t;
            int ans = INT_MAX;
            for(int i=0;i<=s.length()-t.length();i++)
            {
                
                    int j =0 ;
                    int cnt =0 ;
                    for(int it=i;j<t.length();it++,j++)
                    {
                        if(s[it]!=t[j])
                        {
                            cnt++;
                        }
                    }
                   // debug(i,cnt);
                    ans = min(ans,cnt);
               
            }
            cout<<ans;
        }

        //https://www.youtube.com/watch?v=ZQqccia8bVo

Measured memory_bytes: 3592
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		List<Integer> list = new ArrayList<>();
		int n = sc.nextInt();
		int k = sc.nextInt();
		list.add(0);
		for(int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		int zero = list.indexOf(0);

		
		long min = Long.MAX_VALUE / 10;
		for(int i = k; i >= 0; i--) {
			int a=0, b=0;
			if ((zero + i) > (list.size() - 1)) continue;
			a = list.get(zero + i);
			if (zero - (k - i) < 0) continue;
			b =Math.abs( list.get(zero - (k - i)) );
			//out.println("i:" + i + " a:" + a + " b:" + b);
			if (a < b) a *=2;
			else b *= 2;
			if (( a+ b) < min) min = a + b;
		}
		
		out.println(min);

		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 25512
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	double r, g;
	cin >> r >> g;
	print((int)(2 * (g - r) + r));
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
S = input()
first, second = int(S[:2]), int(S[2:])

if 1 <= first <= 12 and 1 <= second <= 12:
    print("AMBIGUOUS")
elif 1 <= second <= 12:
    print("YYMM")
elif 1 <= first <= 12 and second <= 99:
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 38256
#include<cstdio>
#include<vector>
#include<algorithm>
#define pb push_back
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
using namespace std;

const int N=200010;
char s[N];
int n,m,x,y,d[N][2],vis[N];
vector<int>v[N],q;

int main(){
	scanf("%d%d%s",&n,&m,s+1);
	for (int i=m; i; i--){
		scanf("%d%d",&x,&y); v[x].pb(y); v[y].pb(x);
		++d[x][s[y]-'A']; ++d[y][s[x]-'A'];
	}
	rep(i,1,n) if (!d[i][0] || !d[i][1]) q.pb(i),vis[i]=1;
	for (int j=0; j<(int)q.size(); j++){
		int sz=v[q[j]].size()-1;
		rep(i,0,sz){
			int p=v[q[j]][i];
			if (!--d[p][s[q[j]]-'A'] && !vis[p]) q.pb(p),vis[p]=1;
		}
	}
	if ((int)q.size()<n) puts("Yes"); else puts("No");
	return 0;
}

Measured memory_bytes: 13820
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int A, B, C, D;
    cin >> A >> B >> C >> D;
    A = A + B - C - D;
    if (A > 0) cout << "Left" << endl;
    else if (A < 0) cout << "Right" << endl;
    else cout << "Balanced" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N, M = rl()
A = []
Cs = []
for i in range(M):
	a, b = rl()
	C = rl()
	A.append(a)
	Cs.append(C)

def get_bit(C):
	b = 0
	for c in C:
		b = b | (1 << (c-1))
	return b
bits =[]
for C in Cs:
	b = get_bit(C)
	bits.append(b)

start = 0
end = 2**N-1

import heapq

heap = []
heapq.heappush(heap, (0, start))

visited = {}
ans = -1
while heap:
	c, n = heapq.heappop(heap)
	if n == end:
		ans = c
		break
	for i, b in enumerate(bits):
		m = n | b
		nc = c + A[i]
		if m in visited and nc >= visited[m]:
			continue
		visited[m] = nc
		heapq.heappush(heap, (nc, m))
print(ans)


Measured memory_bytes: 49756
#include <bits/stdc++.h>
using i64 = long long;

i64 calc(i64 n, const std::deque<std::pair<i64, i64>> &q, int level = 0) {
    int lim = q.size();
    if (level == lim - 1) return n / q[level].first * q[level].second + n % q[level].first;

    i64 ret = n;
    for (i64 i = 0; i * q[level].first <= n; i++) {
        ret = std::max(ret, i * q[level].second + calc(n - i * q[level].first, q, level + 1));
    }
    return ret;
}

int main() {
    i64 n, ga, sa, ba, gb, sb, bb;
    std::cin >> n >> ga >> sa >> ba >> gb >> sb >> bb;

    std::deque<std::pair<i64, i64>> p, q;
    auto push = [&](i64 a, i64 b) {
        if (a > b) q.emplace_back(b, a);
        else if (a < b) p.emplace_back(a, b);
    };
    push(ga, gb);
    push(sa, sb);
    push(ba, bb);

    if (p.size()) n = calc(n, p);
    if (q.size()) n = calc(n, q);
    std::cout << n << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
 
signed main(){

    int n;
    int w[101];
    cin >> n;
    rep(i,n)cin >> w[i];
    int ans = INF;
    for(int t = 0;t < n-1;t++){
        int s1 = 0,s2 = 0;
        for(int i = 0;i < n;i++){
            if(i <= t)s1 += w[i];
            else s2 += w[i];
        }
        ans = min(ans,abs(s1-s2));
    }
    cout << ans << endl;
    
    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc129.contest.atcoder.jp/tasks/abc129_a

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
    ll n; cin >> n; vl sumup(n); vl sumdown(n);
    ll x; cin >> x; sumup[0] = x; 
    
    for(ll i=0; i < n-1; i++){
      ll y; cin >> y; sumup[i+1] = sumup[i] + y;
    }
  ll d; cin >> d; sumdown[0] = d;
    for(ll i=0; i < n-1; i++){
      ll x; cin >> x; sumdown[i+1] = sumdown[i] + x;
    }
    
    ll summax = sumup[0] + sumdown[n-1];
    for(ll i=1; i < n; i++){
      ll sum = sumup[i] + sumdown[n-1]- sumdown[i-1];
      summax = max(summax,sum);
    }
  
  cout << summax << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <random>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
#define fst	first
#define scn second
#define bicnt(x)	__buildin__popcount(x)
#define debug(x)	cout<<"debug: "<<x<<endl
#define DEBUG 0

const ll inf = (ll)1e9;
const ll mod = 998244353;
const ld eps = 1e-9;
const int dx[] = { 0,1,0,-1 };
const int dy[] = { 1,0,-1,0 };

int main() {
	int n;	cin >> n;
	vint a(n);
	rep(i, n)	cin >> a[i];
	ll ret = 1;
	rep(i, n)	ret *= 3;
	ll div = 1;
	rep(i, n) {
		if (a[i] % 2 == 0)	div *= 2;
	}
	cout << ret - div << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }


int main() {
	ll n, k;
	cin >> n >> k;
	vector<int> a(n), zc(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
		zc[i] = -1;
	}
	int c = 0;
	int g = 0;
	zc[0] = 0;
	while (1) {
		int next = a[g];
		c++;
		g = next;

		if (zc[next] >= 0) {
			ll r = c - zc[next];
			ll nokori = k - c;
			nokori %= r;

			if (nokori == 0) {
				cout << g + 1 << endl;
				return 0;
			}

			c = 0;
			while (1) {
				int next = a[g];
				c++;
				g = next;
				if (c == nokori) {
					cout << next + 1 << endl;
					return 0;
				}
			}

		}

		zc[next] = c;
		if (c == k) {
			cout << next + 1 << endl;
			return 0;
		}
		
	}
}




Measured memory_bytes: 4904
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
#define N 150
int num[N];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;++i)
	{
		int m;
		cin>>m;
		for(int j=1;j<=m;++j)
		{
			int x;
			cin>>x;
			num[x]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;++i)
	if(!num[i])  ++ans;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3672
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double r = scan.nextDouble();
		double sum = Math.PI * Math.pow(r, 2);
		double length = 2 * Math.PI * r;
		System.out.println(BigDecimal.valueOf(sum).toPlainString() + " " + BigDecimal.valueOf(length).toPlainString());
	}

}

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

int main(void){
  int n,m,p;
  while(cin>>n>>m>>p,n+m+p){
    vector<int> stu(n);
    int sum = 0;
    for(int i = 0 ; i < n ; i ++){
      cin>>stu[i];
      sum += stu[i];
    }
    sum *= 100 - p;
    if(stu[m-1]==0)cout<<0<<endl;
    else cout<<sum/stu[m-1]<<endl;
  }
}

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

long long int a[20][20];
int main()
{
    long long int n, m, i, j=0,sum=0;
    cin>>n;
    for(i=1; i<=n; i++){
            m=i%10; j=i;
            while(j>=10) j/=10;
            a[j][m]++;
    }
    for(i=1; i<=9; i++){
        for(j=1; j<=9; j++){
            sum+=a[i][j]*a[j][i];
        }
    }
    cout<<sum<<endl;
    return 0;
}



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

int main() {
    int N, Q, a, b, c;
    ll ans = 0;
    cin >> N;
    vector<int> cnt(1e5 + 5, 0);
    for (int i = 0; i < N; i++) {
        cin >> a;
        cnt[a]++;
        ans += a;
    }
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        cin >> b >> c;
        ans += (c - b) * cnt[b];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << ans << endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  while(N > 0) {
    N = N - 1000;
  }
  if (N == 0) {
    cout << 0 << endl;
  }
  else {
    cout << - N << endl;
  }
}

Measured memory_bytes: 3592
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        s: String,
        t: String
    };

    let res = format!("{}{}", t, s);
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2152
import java.util.*;
import java.io.*;
import java.util.function.*;

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        int q = scanner.nextInt();
        for (int i = 0; i < q; i++) {
            long a = scanner.nextLong();
            long b = scanner.nextLong();
            long c = (long)Math.sqrt(a * b);
            if (c * (c + 1) < a * b) {
                System.out.println(c * 2 - 1);
            } else if (a * b != c * c || a == b) {
                System.out.println(c * 2 - 2);
            } else {
                System.out.println(c * 2 - 3);
            }
        }
    }

    public static void main(String[]$) {
        try {
            new Main().solve();
            System.out.flush();
        } catch (Throwable t) {
            System.out.flush();
            t.printStackTrace();
        }
    }
}

class System {
    static PrintWriter out = new PrintWriter(java.lang.System.out);

    static void exit() {
        java.lang.System.exit(0);
    }
}

class Scanner {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}


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

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

    vector<int> a(N);

    rep(i, N) {
        cin >> a.at(i);
    }

    int last_broken = -1;
    int wanted_num = 1;
    int ans = 0;

    rep(i, N - 1) {
        if (a.at(i) != wanted_num) {
            continue;
        }
        ans += i - 1 - last_broken;
        last_broken = i;
        wanted_num++;
    }

    if (a.at(N - 1) != wanted_num) {
        if (last_broken == -1) {
            cout << last_broken << endl;
        } else {
            ans += N - 1 - last_broken;
            cout << ans << endl;
        }
    } else {
        ans += (N - 1) - 1 - last_broken;
        cout << ans << endl;
    }
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, m;
    set<int> s;
    cin >> n >> m;
    vii v(n);
    range(i, 1, m)s.insert(i);
    for (auto &p : v)cin >> p.fr >> p.sc;
    sort(ALL(v), [](const pii &a, const pii &b) {
        return a.sc > b.sc || a.sc == b.sc && a.fr < b.fr;
    });


    ll ans = 0;
    for (auto p : v) {
        auto it = s.lower_bound(p.fr);
        if (it != s.end()) {
            s.erase(it);
            ans += p.sc;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5760
r, g, b, n = map(int, input().split())

dp = [0 for i in range(n+1)]
dp[0] = 1

for i in range(r, n+1, r):
    dp[i] = 1
for i in range(g, n+1):
    dp[i] += dp[i-g]
for i in range(b, n+1):
    dp[i] += dp[i-b]

print(dp[-1])

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#define pi 3.14159265358979323846264338327950
 
 
 
int main() {
	long long N, A, B, d; std::cin >> N >> A >> B;
	if (N % (A + B) > A) d = A;
	else d = N % (A + B);
	std::cout << ((N / (A + B)) * A) + d << std::endl;
 
	return 0;
}

Measured memory_bytes: 3512
///   ***   ---   |||		 In the name of ALLAH		|||   ---   ***   ///



#include<bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {			cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


int dx[] = { 0, 0, +1, -1, -1  +1, -1, +1 };
int dy[] = { +1, -1, 0, 0, -1, +1, +1, -1 };

const int mx = 123;
int a[mx];

int main()
{
	optimize();

	int n, x;
	cin >> x >> n;
	map<int, int> vis;
	for ( int i = 1; i <= n; i++ ) {
		cin >> a[i];
		vis[a[i]] = 1;
	}

	int p, ans = inf;
	for ( int i = 0; i <= 200; i++ ) {
		if ( !vis[i] && abs ( x - i ) < ans ) {
			ans = abs ( x - i );
			p = i;
		}
	}

	cout << p << endl;



	return 0;
}


















Measured memory_bytes: 3608