akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int a, l;
	while (cin >> a >> l) {
		if (a == 0 && l == 0) {
			break;
		}
		int kazu[6];
		int kazu2[6];
		int k;
		int hyou[25];
		hyou[0] = a;
		for (k = 1; k <= 20; k++) {
			for (int i = l-1; i >= 0; i--) {
				kazu[i] = kazu2[i] = a % 10;
				a /= 10;
			}
			for (int i = l-1; i > 0; i--) {
				for (int j = 0; j < i; j++) {
					if (kazu[j] < kazu[j+1]) {
						swap(kazu[j], kazu[j+1]);
					}
					if (kazu2[j] > kazu2[j+1]) {
						swap(kazu2[j], kazu2[j+1]);
					}
				}
			}
			int max, min;
			max = min = 0;
			for (int i = 0; i < l; i++) {
				max *= 10;
				min *= 10;
				max += kazu[i];
				min += kazu2[i];
			}
			a = max - min;
			bool hantei = false;
			for (int i = 0; i < k; i++) {
				if (a == hyou[i]) {
					cout << i << ' ' << a << ' ' << k-i << endl;
					hantei = true;
					break;
				}
			}
			if (hantei) {
				break;
			}
			hyou[k] = a;
		}
	}
	return 0;
}

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

typedef long long ll;
#define elif else if
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define For(i, a) for (int i = 0; i < (a); i++)
#define Ford(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define Fd(i, a) for (int i = (a)-1; i >= 0; i--)
#define nl    cout<<"\n";
const int INF=1e+18;
//ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
//bool Possible(bool p) { if(p) printf("YES\n"); else printf("NO\n");}
//bool possible(bool p) { if(p) printf("Yes\n"); else printf("No\n");}
long long sum = 0;
int main()
{
    ffast;
    //freopen("0in.txt","r",stdin);
    //freopen("0out.txt","w",stdout);


    int n,m;
    cin>>n>>m;
    while(m--)
    {
        int a;
        cin>>a;
        sum +=a;
    }
    if(sum>n) {cout<<-1; nl;}
    else {cout<<n-sum;nl;}
    return 0;
}





Measured memory_bytes: 3692
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<int> ans;
int main(){
	int q;
	cin >> q;
	
	for(int i = 0;i < q;i++){
		int n;
		cin >> n;
		int tans = 0;
		vector<int> used;
		while(n >= 10){
			int div = 10;
			int next = 0;
			for(int i = 0;i < 6;i++){
				int l = n/div;
				int r = n%div;
				if(l != 0){
					next = max(next,l*r);
				}
				div*=10;
			}
			if(find(used.begin(),used.end(),next) != used.end()){
				tans = -1;
				break;
			}
			used.push_back(next);
			n = next;
			tans++;
		}
		ans.push_back(tans);
	}
	
	for(int i = 0;i < ans.size();i++) cout << ans[i] << endl;
	return 0;
}

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

int main() {
	int H,W,i,j;
	while(1){
	cin >> H >> W;
	if(H == 0 && W == 0)break;
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			cout << "#";
		}
		cout << endl;
	}
	cout << endl;
	}
	return 0;
}

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

int main() {
  int x, y;
  cin >> x >> y;
  string ans = "Yes";

  if ( y%2 == 1 ) {
    ans = "No";
  } else {
    if ( 2*x > y ) {
      ans = "No";
    } else {
      while ( x-- > 0 ) {
        if ( y >= 4 ) {
          y -= 4;
        } else {
          y -= 2;
        }
      }
      if ( y > 0 ) { ans = "No"; }
    }
    
  }

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


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

int main () {
	int n, m;
	cin >> n >> m;
	int a[n], b[n], c[m], d[m];
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
	for (int j = 0; j < m; j++) cin >> c[j] >> d[j];

	int min[n], ans[n], dis;
	for (int i = 0; i < n; i++) { //人の位置
		min[i] = 1000000000; //初期化(最小値なので0ではなく10^9)
		for (int j = 0; j < m; j++) { //チェックポイントの位置
			dis = abs(a[i] - c[j]) + abs(b[i] - d[j]); //マンハッタン距離
			if (dis < min[i]) {
				min[i] = dis;
				ans[i] = j + 1; //jが0から始まっているので+1
			}
		}
	}
	for (int i = 0; i < n; i++) cout << ans[i] << endl;

	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  const int NMMAX=50;
  
  vector<int> a(NMMAX), b(NMMAX);
  
  for(int i=0; i<M; i++){
    cin >> a.at(i) >> b.at(i);
  }
  
  vector<int> cnt(NMMAX);
  
  for(int i=0; i<N; i++){
    cnt.at(i)=0;
  }
  
  for(int i=0; i<M; i++){
    cnt.at(a.at(i) - 1)+=1;
    cnt.at(b.at(i) - 1)+=1;
  }
  
  for(int i=0; i<N; i++){
    cout << cnt.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll n;
    cin >> n;
    if(n==0){
        ll a0;
        cin >> a0;
        if(a0==1) print(1);
        else print(-1);
        return;
    }
    ll sum=0;
    Vi a(n+1);
    rp(i,n+1){
        cin >> a.at(i);
        sum+=a.at(i);
    }
    if(a[0]!=0){
        print(-1);
        return;
    }
    ll leaf=1;
    ll ans=1;
    repi(i,1,n+1){
        if(leaf*2>sum) leaf=sum;
        else leaf*=2;
        ans+=leaf;
        leaf-=a.at(i);
        sum-=a.at(i);
        if(i!=n&&leaf<=0){
            print(-1);
            return;
        }
        if(i==n&&leaf!=0){
            print(-1);
            return;
        }
    }
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3972
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int n;
int rt[200005],sizee[200005];
void initialize()
{
    for(int i=0;i<n+5;i++)
    {
        rt[i]=i;
        sizee[i]=1;
    }
}
int root(int i)
{
    while(rt[i]!= i)
    {
        rt[i]=rt[rt[i]]; 
        i=rt[i];
    }
    return i;
}
void merge(int A,int B)
{
    int root_A = root(A);
    int root_B = root(B);
    if(rt[root_A]==rt[root_B])
        return;
    if(sizee[root_A] < sizee[root_B])
    {
        rt[root_A] = rt[root_B];
        sizee[root_B] += sizee[root_A];
    }
    else
    {
        rt[root_B] = rt[root_A];
        sizee[root_A] += sizee[root_B];
    }
}
int32_t main()
{
    IOS;
    int m;
    cin>>n>>m;
    initialize();
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        merge(a,b);
    }
    set<int>s;
    for(int i=1;i<=n;i++)
        s.insert(root(i));
    cout<<(s.size()-1);
}

Measured memory_bytes: 8872
import sys

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

if A == 1 or B == 1:
    print(0)
    sys.exit()

i = 0
x = 0
mx = 0

while(x < min(A*B, N)):
    pt = (A * x) // B - A * (x // B)
    mx = max(mx, pt)
    i += 1
    x = i * (B-1)
    
last = (A * N) // B - A * (N // B)
mx = max(mx, last)
print(mx)

Measured memory_bytes: 61852
from heapq import heappush, heappop
from collections import deque
import re
import math
import functools

def sRaw():
    return input().rstrip("\r")

def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29


def make1d_arr(n, val=INF):
    return [val for i in range(n)]


def make2d_arr(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)


def BFord(n,es):
    v_cost = [INF]*n
    v_cost[0] = 0
    for v in range(n*2):
        for e in es:
            frm = e[0]
            to = e[1]
            if v_cost[to] > v_cost[frm]+e[2]:
                v_cost[to] = v_cost[frm]+e[2]
                if v >= n:
                    v_cost[to] = -INF
        if v == n-1:
            prev = v_cost[:]
    v_cost = [-INF if prev[idx]!=v_cost[idx] else v_cost[idx] for idx in range(n)]
    return v_cost
    
def ZAlgo(s):
    l = len(s)
    A = [0]*l
    i =1
    j =0
    A[0]=l
    while i<l:
        while i+j<l and s[j] == s[i+j]:
            j+=1
        if j==0:
            i+=1
            continue
        A[i]=j
        k=1
        while (i+k<l) and (k+A[k]<j):
            A[i+k] =A[k]
            k+=1
        i+=k
        j-=k
    return A


DIV = 998244353

def main():
    N = iRaw()
    S = sRaw()
    dp = [[] for i in range(N+1)]
    dp[N] = [-1]*10
    for si in range(len(S)-1,-1,-1):
        dp[si] = [dp[si+1][d] for d in range(10)]
        dp[si][int(S[si])] = si
    ans = 0 
    for i in range(1000):
        d0 = i%10
        d1 = (i//10)%10
        d2 = (i//100)%10
        idx1 = dp[0][d0]
        if idx1 == -1:
            continue
        idx2 = dp[idx1+1][d1]
        if idx2 == -1:
            continue
        if dp[idx2+1][d2] != -1:
            ans+=1
    return ans

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 47580
#include<iostream>

using namespace std;

int main() {
	long long mon=101,X,y=0;
  	cin>>X;
  	if(mon>=X){}    
    else{y++;}
  	while(mon<X){
    	mon+=mon/100;
      	y++;
    }
  	cout<<y<<endl;
}

Measured memory_bytes: 3504
import sys
from collections import Counter

import numpy as np

n, *aaa = map(int, sys.stdin.buffer.read().split())
cnt = Counter(aaa)
duplicated = {x for x, c in cnt.items() if c > 1}
aaa.sort()

can = np.ones(aaa[-1] + 1, np.int8)

ans = 0
for a in aaa:
    if can[a] == 0:
        continue
    if a not in duplicated:
        ans += 1
    can[a * 2::a] = 0

print(ans)


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


using namespace std;
int l,m,n,tmp;
float f,g,h;
vector<int> vi;



int main(int argc, char const *argv[])
{

  cin >> l >> m;

  // rep(i, n){
    // cout << i<<endl;
  // }
 if(l > m){
  n = l-1;
 }else{
  n = l;
 }
  cout << n << endl;
  return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  
  if( a<=8 && b<=8 ){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
  
  return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> broken(n+1);
    rep(i,m) {
        int a;
        cin >> a;
        broken[a] = true;
    }
    vector<int> dp(n+2);
    const int mod = 1000000007;
    dp[n] = 1;
    for ( int i = n - 1; i >= 0; i-- ) {
        if ( broken[i] ) {
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i+1] + dp[i+2]) % mod;
    }

    cout << dp[0] << endl;

    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		if(s[0]%2==1){
			int p=s[1]<<1;
			for(int i = 0;i<s[1];i++) {
				Console.WriteLine("{1} {2}",i,i+1,p-i);
			}
		}
		else{
			int p=s[0]>>1;
			for(int i = 0;i<s[1];i++) {
				int z=i%2==0?0:((s[0]>>1));
				Console.WriteLine("{1} {2}",i,i/2+1+z,p+z-i/2-(i%2==0?0:1));
			}
		}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 33428
from fractions import gcd

N=int(input())
d={}
#l=[]
MOD = 1000000007
nz=0
for _ in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        nz+=1
        #p=(0,0)
        continue
    elif a==0:
        p=(0,1)
    elif b==0:
        p=(1,0)
    else:
        c=gcd(a,b)
        a,b=a//c,b//c
        if b > 0:
            p=(a,b)
        else: # b < 0
            p=(-a,-b)
    
    #l.append(p)
    if p in d:
        d[p]+=1
    else:
        d[p] = 1

ans=1
#for p in l:
while len(d) > 0:
    p,np=d.popitem()
    if p==(1,0):
        q=(0,1)
    elif p==(0,1):
        q=(1,0)
    else:
        pa,pb=p
        if pa > 0:
            q=(-pb,pa)
        else: #pa < 0
            q=(pb,-pa)
    if q in d:
        nq=d.pop(q)
    else:
        nq=0
    
    ans *= ((2**np + 2**nq - 1) % MOD)
    ans %= MOD

ans -= 1
ans += nz
ans %= MOD
print(ans)

Measured memory_bytes: 48136
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

constexpr ll MOD = 1000000007;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int m = max(h, w);
  cout << (n + m - 1) / m << endl;

#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

Measured memory_bytes: 3652
let n = stdin.ReadLine() |> int
let hs = stdin.ReadLine().Split() |> Array.map int

let countZeroChunk array = 
    array 
    |> Array.fold (fun (count,before) x -> if before<>0 && x = 0 then (count+1, x) else (count, x)) (0, 0)
    |> fst
    |> fun x -> if array |> Array.last |> (=) 0 then x-1 else x 

let highest = hs |> Array.max

let grow seq = seq |> Seq.map (fun x -> if x<>0 then x-1 else 0) |> Seq.toArray 

[1..highest] |> Seq.fold (fun (count, growed) i -> (growed |> countZeroChunk |> (+) (1 + count), grow growed) ) (0, hs)
|> fst |> stdout.WriteLine

Measured memory_bytes: 13524
import sys
s=str(input())
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    print(str(i+1)+" " +str(i+2))
    sys.exit()
for i in range(len(s)-2):
  if s[i]==s[i+2]:
    print(str(i+1)+" " +str(i+3))
    sys.exit()
print(str(-1)+" " +str(-1))

Measured memory_bytes: 3188
h, w = map(int, input().split())
ans = []
for _ in range(h):
  s = input()
  lst = []
  acc = -1
  for c in s:
    if c == "c":
      acc = 0
    elif acc == -1:
      pass
    else:
      acc += 1
    lst.append(acc)
  ans.append(lst)
for lst in ans:
  print(*lst)


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

int main() {
  int N , M;
  cin >> N >> M;
  vector<int> v(N);
  for(int i = 0; i < M * 2; i++){
    int a;
    cin >> a;
    v.at(a - 1)++;
  }
  for(int i = 0; i < N; i++){
    cout << v.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,h,w,ans,minp[200005];
int main()
{
	scanf("%d%d%d",&h,&w,&n);
	ans=h;
	for(int i=1;i<=h;i++)minp[i]=w+1;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		minp[x]=min(minp[x],y);
	}
	int now=0;
	for(int i=1;i<=h;i++)
	{
		if(minp[i]<=now)
		{
			printf("%d\n",i-1);
			return 0;
		}
		if(minp[i]>now+1)now++;
	}
	printf("%d\n",h);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	for(int i=1;i<=9;i++)
		for(int j=1;j<=9;j++){
			if(n== i*j)
			{cout<<"Yes"<<endl;
			return 0;
			}
		}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static int[] primeArray = new int[78498];

        static void Main(string[] args)
        {
            SetPrime();

            List<int> list = new List<int>();

            while (true)
            {
                int sum = int.Parse(Console.ReadLine());
                if(sum == 0)
                {
                    break;
                }

                int left = 0;
                int right = 78497;
                int count = 0;

                while (left <= right)
                {
                    if (primeArray[left] + primeArray[right] > sum)
                    {
                        right--;
                    }
                    else if (primeArray[left] + primeArray[right] < sum)
                    {
                        left++;
                    }
                    else
                    {
                        count++;
                        right--;
                        left++;
                    }
                }

                list.Add(count);
            }
            

            foreach (int a in list)
            {
                Console.WriteLine(a);
            }

        }


        static void SetPrime()
        {
            primeArray[0] = 2;
            int primeNum = 1;

            List<int> serchList = new List<int>();
            for (int i = 3; i <= 1000000; i += 2)
            {
                serchList.Add(i);
            }

            List<int> tmpList = new List<int>();
            while (true)
            {
                int prime = serchList[0];
                primeArray[primeNum] = prime;
                primeNum++;

                if (prime > Math.Sqrt(serchList[serchList.Count - 1]))
                {
                    break;
                }

                for (int k = 0; k < serchList.Count; k++)
                {
                    if (serchList[k] % prime != 0)
                    {
                        tmpList.Add(serchList[k]);
                    }
                }

                serchList = new List<int>(tmpList);
                tmpList.Clear();
            }

            for (int j = 1; j < serchList.Count; j++)
            {
                primeArray[primeNum] = serchList[j];
                primeNum++;
            }

        }
    }
}

Measured memory_bytes: 14324
/*
author:Manson
date:7.7.2018
theme:
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100005;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin>>n>>k;
	cout<<ceil((n-1)*1./(k-1))<<endl;
	return 0;
}


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

using namespace std;

vector<int> P;

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

    for (int i = 2; i <= 100003; i++) {
        bool flag = true;
        for (int j = 2; j * j <= i; j++) {
            if ( i % j == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            P.push_back(i);
        }
        
    }
    int pSize = P.size();

    for (int i = 0; i < pSize; i++) {
        if (P[i] >= x) {
            cout << P[i] << endl;
            break;
        }
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,m,f[100010],a[100010],fa[100010],u,v,b[100010],bk;
int cnt,head[100010],to[200010],nxt[200010];
ll ans;
bool vis[100010];
void add(int x,int y)
{
	cnt++;
	to[cnt]=y;
	nxt[cnt]=head[x];
	head[x]=cnt;
}
void dfs1(int x,int c)
{
	f[x]=c;
	for (int i=head[x];i;i=nxt[i])
	{
		int y=to[i];
		if (y==fa[x])
		{
			continue;
		}
		fa[y]=x;
		dfs1(y,-c);
		f[x]+=f[y];
	}
	ans+=abs(f[x]);
}
void solve1()
{
	dfs1(1,1);
	if (f[1])
	{
		puts("-1");
	}
	else
	{
		cout<<ans<<endl;
	}
}
void dfs2(int x)
{
	f[x]=a[x];
	vis[x]=true;
	for (int i=head[x];i;i=nxt[i])
	{
		int y=to[i];
		if (y==fa[x])
		{
			continue;
		}
		if (vis[y])
		{
			u=x;
			v=y;
			continue;
		}
		a[y]=-a[x];
		fa[y]=x;
		dfs2(y);
		f[x]+=f[y];
	}
}
void solve21()
{
	if (f[1]%2)
	{
		puts("-1");
		return;
	}
	int x=-f[1]/2;
	ans=abs(x);
	int k;
	k=u;
	while (k)
	{
		f[k]+=x;
		k=fa[k];
	}
	k=v;
	while (k)
	{
		f[k]+=x;
		k=fa[k];
	}
	for (int i=1;i<=n;i++)
	{
		ans+=abs(f[i]);
	}
	cout<<ans<<endl;
}
void solve22()
{
	if (f[1])
	{
		puts("-1");
		return;
	}
	memset(vis,false,sizeof(vis));
	int k;
	k=u;
	while (k)
	{
		vis[k]=true;
		k=fa[k];
	}
	int g;
	k=v;
	while (k)
	{
		if (vis[k])
		{
			g=k;
			break;
		}
		k=fa[k];
	}
	memset(vis,false,sizeof(vis));
	k=u;
	while (k!=g)
	{
		vis[k]=true;
		b[bk++]=f[k];
		k=fa[k];
	}
	k=v;
	while (k!=g)
	{
		vis[k]=true;
		b[bk++]=-f[k];
		k=fa[k];
	}
	b[bk++]=0;
	sort(b,b+bk);
	int x=b[bk/2-1];
	for (int i=1;i<=n;i++)
	{
		if (!vis[i])
		{
			ans+=abs(f[i]);
		}
	}
	for (int i=0;i<bk;i++)
	{
		ans+=abs(b[i]-x);
	}
	cout<<ans<<endl;
}
void solve2()
{
	a[1]=1;
	dfs2(1);
	if (a[u]==a[v])
	{
		solve21();
	}
	else
	{
		solve22();
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=0;i<m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	if (n==m+1)
	{
		solve1();
	}
	else
	{
		solve2();
	}
	return 0;
}
//一朝春尽红颜老，花落人亡两不知！
//——曹雪芹《葬花吟》

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

int main(){
int N; cin >> N;
vector<int> V(N), C(N);
for (int i = 0; i < N; i++) {
    cin >> V[i];
}
for (int i = 0; i < N; i++) {
    cin >> C[i];
}
int ans = 0;
for (int i = 0; i < N; i++) {
    if (V[i] - C[i] > 0) {
        ans += V[i] - C[i];
    }
}
cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>

using namespace std; 

int main(){
int a,b;
cin>>a>>b;
int c =b-a;
int max=0;
for(int i=0;i<c;i++){
    max+=i;
}
cout<<max-a;

return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef pair<string, string> S;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[100100];

ll solve() {
    ll res0 = 0;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            if (sum+a[i]>=0) {
                res0 += abs(a[i] + sum + 1);
                sum = -1;
            } else {
                sum += a[i];
            }
        } else {
            if (sum+a[i]<=0) {
                res0 += abs(a[i] + sum - 1);
                sum = 1;
            } else {
                sum += a[i];
            }
        }
    }

    ll res1 = 0;
    sum = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            if (sum+a[i]<=0) {
                res1 += abs(a[i] + sum - 1);
                sum = 1;
            } else {
                sum += a[i];
            }
        } else {
            if (sum+a[i]>=0) {
                res1 += abs(a[i] + sum + 1);
                sum = -1;
            } else {
                sum += a[i];
            }
        }
    }
    return min(res0, res1);
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 4428
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(string, "x", long, "y");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto ary = iota(1, n + 1).array;
    auto p = aryread();
    auto q = aryread();
    long a, b, i;
    do
    {
        if(p.equal(ary))
            a = i;
        if(q.equal(ary))
            b = i;

        i++;
    }
    while(ary.nextPermutation());
    writeln(abs(a - b));
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        if ((A + B)% 2 == 0) {
            System.out.println((A + B) / 2);
        } else {
            System.out.println("IMPOSSIBLE");
        }
        
    }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
#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++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

//modしながら塁乗
ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll n,x;cin>>n>>x;
  vector<ll> v;
  REP(i,n){
    ll t;
    cin>>t;
    v.pb(t);
  }
  VSORT(v);
  int i = 0;
  while(i<n){
    if(v[i]<=x){
      x -= v[i];
      i++;
    }else{
      break;
    }
  }
  if(i==n&&x>0)i--;
  cout<<i<<endl;


  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 1000000

int main(void){
  int n,i,j,cnt, num[MAX];
  num[0]=num[1]=0;
  for(i=2;i<MAX;i++) num[i]=1;

  for(i=2;i*i<MAX;i++)
    if(num[i])
      for(j=2*i;j<MAX;j+=i)
	num[j]=0;

  while(scanf("%d",&n)!=EOF){
    cnt=0;
    for(i=2;i<=n;i++)
      cnt+=num[i];
    printf("%d\n",cnt);
    
  }
  return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int n, m;
int seet[100];

int main() {
	
	while (cin >> n >> m, n || m) {
		memset(seet, -1, sizeof(seet));
		REP(t, m) {
			char c; scanf(" %c", &c);
			
			bool ok = false;
			
			switch (c) {
				case 'A':
					REP(i, n) if (seet[i] == -1) {
						seet[i] = 0;
						break;
					}
				break;
					
				case 'B':
					for (int i = n - 1; i > 0; i--) if (seet[i] == -1) {
						if (seet[i - 1] == 0) i -= 2;
						else {
							seet[i] = 1;
							ok = true;
							break;
						}
					}
					if (ok) break;
					
					REP(i, n) if (seet[i] == -1) {
						seet[i] = 1;
						break;
					}
				break;
					
				case 'C':
					REP(i, n) if (seet[i] != -1) {
						if (i < n - 1 && seet[i + 1] == -1) {
							seet[i + 1] = 2;
							ok = true;
							break;
						}
						if (i > 0 && seet[i - 1] == -1) {
							seet[i - 1] = 2;
							ok = true;
							break;
						}
					}
					if (ok) break;
					seet[n / 2] = 2;
				break;
				
				case 'D':
					pii ma(-1, 0); // ?????¢, ??????
					
					int l = -1, r = 0;
					
					REP(i, n) {
						if (seet[i] == -1) {
							chmax(r, i + 1);
							while (r < n && seet[r] == -1) r++;
							
							int ls = l == -1 ? INF : i - l;
							int rs = r == n ? INF : r - i;
							
							chmax(ma, pii(min(ls, rs), -i));
						}
						else {
							l = i;
						}
					}
					
					if (ma.fi == INF) seet[0] = 3;
					else seet[-ma.se] = 3;
					
				break;
			}
			
		}
		REP(i, n) printf("%c", seet[i] == -1 ? '#' : seet[i] + 'A');
		puts("");
	}
	return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<vector>
using namespace std;
typedef long long int ll;

int main(){
	int N;
	cin >> N;
	vector<ll> s(N);
	for(int i = 0; i < N; i++) cin >> s[i];
	ll res = 0;
	for(int i = 1; i < N; i++){
		ll sum = 0;
		vector<bool> visited(N, false);
		for(int j = 0; j * i <= N - 1; j++){
			visited[j * i] = true;
			if(visited[N - 1 - (j * i)]) break;
			if(N - 1 - (j * i) < i) break;
			sum += s[j * i] + s[N - 1 - (j * i)];
			res = max(res, sum);
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1024
h,w,k=map(int,input().split())
c=[list(input()) for i in range(h)]
a=0

for i in range(1<<h+w):
  x=0
  for j in range(h):
    for l in range(w):
      if i>>j & 1 and i>>l+h & 1:
        if c[j][l]=="#":
          x+=1
  if x==k:
    a+=1
print(a)    

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

int main(){

    int n;
    cin >> n;
    vector<tuple<int,string>> poll(n);
    vector<string> name(n);
    for(int i=0; i<n; i++){
        cin >> name.at(i);
    }
    sort(name.begin(), name.end());
    bool cand;
    int num=0;

    poll[0]=make_tuple(-1,name.at(0));
    for(int i=1; i<n; i++){
        if(name.at(i)==get<1>(poll[num])){
            get<0>(poll[num])--;
        }
        else{
            num++;
            poll[num]=make_tuple(-1,name.at(i));
        }
    }

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

    int i=0;
    while(1){
        cout << get<1>(poll[i]) << endl;
        if(get<0>(poll[i])!=get<0>(poll[i+1])) break;
        i++;
    }
}

Measured memory_bytes: 17264
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


void solve(long long N, std::vector<long long> h){
    ll dp[100010];
    rep(i, N) {
        dp[i] = 1e10;
    }
    dp[0] = 0;
    // dp[1] = abs(h[0]-h[1]);
    
    rep(i, N) {
        // dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
        // cout << endl;
        // cout << i << dp[i] << endl;
        // cout << i+1 << dp[i+1] << endl;
        // cout << i+2 << dp[i+2] << endl;
    }

    cout << dp[N-1] << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, std::move(h));
    // return 0;
}


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

int main() {
    int n, x;
    cin >> n >> x;
    while (n || x) {
        int cnt = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                for (int k = j + 1; k <= n; ++k) {
                    if (i + j + k == x) cnt++;
                }
            }
        }
        cout << cnt << endl;
        cin >> n >> x;
    }
}



Measured memory_bytes: 3068
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func newInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {

	var n int
	sc.Split(bufio.ScanWords)
	n = newInt()
	ans := n + n*n + n*n*n
	fmt.Println(ans)
}


Measured memory_bytes: 1776
#include <stdio.h>
int main(void){
	int a,b,c,d,ans;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if((a*b)>(c*d)){
		ans=a*b;
	}else{
		ans=c*d;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  using P = pair<string, int>;
  using PP = pair<P, int>;
  vector<PP> v;
  for(int i = 0; i < n; i++)
  {
    string s;
    int a;
    cin >> s >> a;
    v.push_back(PP(P(s, -a), i+1));    
  }
  sort(v.begin(), v.end());
  for(int i = 0; i < n; i++)
  {
    cout << v[i].second << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    ll N;
    cin >> N;
    ll X[N], Y[N];
    int mark = -1;
    bool ok = true;
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
        if (i == 0) {
            mark = (abs(X[i]) + abs(Y[i])) % 2;
        } else {
            if (mark != (abs(X[i]) + abs(Y[i])) % 2) {
                ok = false;
            }
        }
    }
    if (!ok) {
        cout << -1 << endl;
        return 0;
    }
    if (mark == 0) {
        for (int i = 0; i < N; i++) {
            Y[i]--;
        }
    }
    ll u[N], v[N];
    for(int i = 0; i < N; i++) {
        u[i] = X[i] + Y[i];
        v[i] = X[i] - Y[i];
    }
    ll m = 31;
    if (mark == 0) {
        m++;
    }
    ll d[m];
    for (int i = 0; i < 31; i++) {
        d[i] = 1 << i;
    }
    if (mark == 0) {
        d[31] = 1;
    }
    string ans[N];
    fill(ans, ans + N, "");
    for (int i = 0; i < N; i++) {
        ll unum = (u[i] + (1 << 31) - 1) / 2;
        ll vnum = (v[i] + (1 << 31) - 1) / 2;
        for (int j = 0; j < 31; j++) {
            bool uok, vok;
            if ((unum & (1 << j)) > 0) {
                uok = true;
            } else {
                uok = false;
            }
            if ((vnum & (1 << j)) > 0) {
                vok = true;
            } else {
                vok = false;
            }
            if (uok) {
                if (vok) {
                    ans[i].push_back('R');
                } else {
                    ans[i].push_back('U');
                }
            } else {
                if (vok) {
                    ans[i].push_back('D');
                } else {
                    ans[i].push_back('L');
                }
            }
        }
        if (mark == 0) {
            ans[i].push_back('U');
        }
    }
    cout << m << endl;
    for (int i = 0; i < m; i++) {
        cout << d[i];
        if (i != m - 1) {
            cout << " ";
        } else {
            cout << endl;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 384
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
	ll n;
	cin>>n;
	ll T,A;
	cin>>T>>A;
	T*=1000;
	A*=1000;
	vector<ll> v;
	rep(i,0,n){
		ll a;
		cin>>a;
		v.pb(a);
	}
	ll mn = abs(A-(T-6*v[0]));
	ll index = 0;
	rep(i,0,v.sz){
		if(mn > abs(A-(T-6*v[i]))){
			mn = abs(A-(T-6*v[i]));
			index = i;
		}
	}
	cout << index+1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
  int n, tmp, count = 1;
  scanf("%d", &n);
  scanf("%d", &tmp);
  int min = tmp;
  rep(i, n - 1) {
    scanf("%d", &tmp);
    if (tmp <= min) {
      count++;
      min = tmp;
    }
  }
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int num = (int) Math.pow(n, 3);
		System.out.println(num);
	}

}

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

int main() {
  int N, A;
  cin >> N;
  A = N % 10;
  	if ( A == 0 || A == 1 || A == 6 || A == 8 ){
      cout << "pon" << endl;
    }
  	else if ( A == 2 || A == 4 || A == 5 || A == 7 || A == 9 ){
      cout << "hon" << endl;
    }
  	else if ( A == 3 ){
      cout << "bon" << endl;
    }  
}

Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
 
using namespace std;
 
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int main(){
	int x,h;
	while(cin>>x>>h,h&x){
		
		double p = sqrt(x*x/4.0+h*h);
		double sum =0;
		sum+=x*x;
		sum+=x*p/2*4;
		
		printf("%.9lf\n",sum);
	}
}

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

int main() {
    char s[10];
    scanf("%s",s);

    if (strcmp(s,"hi")==0)
        printf("Yes");
    
    else if(strcmp(s,"hihi")==0)
        printf("Yes");
    
    else if(strcmp(s,"hihihi")==0)
        printf("Yes");

    else if(strcmp(s,"hihihihi")==0)
        printf("Yes");

    else if(strcmp(s,"hihihihihi")==0)
        printf("Yes");
    
    else
        printf("No");

    return 0;
}

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

using namespace std;

using LL = long long;

LL isprime(LL x){
    for(LL i = 2; i * i <= x; ++i){
        if(x % i == 0){
            return 0;
        }
    }
    return 1;
}

int main(){
    LL A, B;
    scanf("%lld %lld", &A, &B);
    LL N = __gcd(A, B);
    LL ans = 1;
    for(LL i = 2; i * i <= N; ++i){
        if(N % i == 0){
            ans += isprime(i);
            while(N % i == 0){
                N /= i;
            }
        }
    }
    if(N > 1){
        ans += isprime(N);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100009
#define M 20000009
using namespace std;

int n,m,tp,cnt,trtot,tot,dfsclk,fst[N],pnt[M],nxt[M];
int q[N],b[N][2],p[N][2],pos[N],low[N],scc[N],id[N];
struct node{ int x,y; }a[N];
bool operator <(node u,node v){
	return u.x<v.x || u.x==v.x && u.y<v.y;
}
bool operator <=(node u,node v){
	return u.x<v.x || u.x==v.x && u.y<=v.y;
}
void dfs(int x){
	int i,y; low[x]=pos[x]=++dfsclk; q[++tp]=x;
	for (i=fst[x]; i; i=nxt[i]){
		y=pnt[i];
		if (!pos[y]){
			dfs(y); low[x]=min(low[x],low[y]);
		} else if (!scc[y]) low[x]=min(low[x],pos[y]);
	}
	if (pos[x]==low[x])
		for (cnt++; ; ){
			scc[q[tp]]=cnt;
			if (q[tp--]==x) break;
		}
}
void add(int x,int y){
	pnt[++tot]=y; nxt[tot]=fst[x]; fst[x]=tot;
}
void ins(int x,int y){ add(x,y); add(y^1,x^1); }
void build(int k,int l,int r){
	p[k][0]=++trtot; p[k][1]=++trtot;
	if (l==r){
		id[l]=k; return;
	}
	int mid=l+r>>1;
	build(k<<1,l,mid); build(k<<1|1,mid+1,r);
	ins(p[k][1],p[k<<1][1]); ins(p[k][1],p[k<<1|1][1]);
}
void ins(int k,int l,int r,node x,node y,int z){
	if (y<x || y<a[l] || a[r]<x) return;
	if (x<=a[l] && a[r]<=y){
		ins(p[z][0],p[k][1]); return;
	}
	int mid=l+r>>1;
	ins(k<<1,l,mid,x,y,z); ins(k<<1|1,mid+1,r,x,y,z);
}
bool check(int t){
	tot=0; memset(fst,0,sizeof(fst));
	trtot=1; build(1,1,m);
	int i,x,y;
	for (i=1; i<=m; i++){
		ins(1,1,m,(node){a[i].x-t+1,-m},(node){a[i].x,a[i].y-1},id[i]);
		ins(1,1,m,(node){a[i].x,a[i].y+1},(node){a[i].x+t-1,m},id[i]);
	}
	for (i=1; i<=n; i++){
		x=id[b[i][0]]; y=id[b[i][1]];
		ins(p[x][0],p[y][1]); ins(p[x][1],p[y][0]);
	}
	memset(pos,0,sizeof(pos)); memset(scc,0,sizeof(scc));
	tp=cnt=dfsclk=0;
	for (i=2; i<=trtot; i++) if (!pos[i]) dfs(i);
	for (i=2; i<=trtot; i++) if (scc[i]==scc[i^1]) return 0;
	return 1;
}
int main(){
	scanf("%d",&n);
	int i,x,y;
	for (i=1; i<=n; i++){
		scanf("%d%d",&x,&y);
		if (x>y) swap(x,y); 
		a[++m]=(node){x,i}; a[++m]=(node){y,i+n};
	}
	sort(a+1,a+m+1);
	for (i=1; i<=m; i++)
		if (a[i].y>n) b[a[i].y-n][1]=i;
		else b[a[i].y][0]=i;
	int l=0,r=1000000000,mid;
	while (l<r){
		mid=l+r+1>>1;
		if (check(mid)) l=mid; else r=mid-1;
	}
	printf("%d\n",l);
	return 0;
}


Measured memory_bytes: 23040
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fir first
#define sec second
#define MOD 1000000007
#define vvi vector<vector<int> >
#define vvs vector<vector<string> >
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define pb push_back
#define vi vector<int>
#define test(t) int t; cin>>t; while(t--)
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vvl vector<vl>
#define loopin(i, n) for(int i = 0; i < (n); i++)
#define loopdec(i, n) for(int i = n-1; i >= 0; i--)
const int mod=1e9+7;


void solve() {
    string s;
    cin>>s;
    if(s[s.length()-1]=='s'){
       s=s+'e'+'s';
    }
    else{
      s=s+'s';
    }
    cout<<s<<endl;

    }


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

   solve();

   

return 0;
}


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

int main() {
  int n,k,hu=0,sei=0,zero=0;
  cin>>n>>k;
  long long a[n];
  for(int i=0;i<n;i++){
    long long l;
    cin>>l;
    a[i]=l;
    if(a[i]<0)hu++;
    else if(a[i]>0)sei++;
    else zero++;
  }
  k=k-zero;
  long long b[hu],c[sei];
  for(int i=0;i<hu;i++){
    b[i]=a[hu-1-i];
  }
  for(int i=0;i<sei;i++){
    c[i]=a[hu+zero+i];
  }
  long long ans=9999999999;
  if(k==0)ans=0;
  else{
  for(int i=0;i<k+1;i++){
    if(i<=hu&&k-i<=sei){
      if(i==0)ans=min(ans,c[k-1]);
      else if(i==k)ans=min(ans,abs(b[k-1]));
      else ans=min(ans,abs(b[i-1])+c[k-i-1]+min(abs(b[i-1]),c[k-i-1]));
    }
  }
  }
  cout<<ans<<endl;
  }
  

Measured memory_bytes: 1792
using System;

namespace AtCoderBeginnerContest169
{
    class Multiplication3_3
    {
        static void Main(string[] args)
        {
            string[] c = Console.ReadLine().Split();
            ulong a = ulong.Parse(c[0]);
            decimal b = decimal.Parse(c[1]);
            Console.WriteLine((ulong)(a * b));
        }
    }
}

Measured memory_bytes: 27592
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>
#include <iomanip>

using namespace std;
using lint = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
using pql = priority_queue<lint>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define repf(i, f, n) for (int i = (f); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20

constexpr lint MOD = 1e9 + 7;
int A, B, C, D, E, F, G, H, I, J, K, L, M, N;
int O, P, Q, R, S, T, U, V, W, X, Y, Z;
// string s;
lint ans = 0LL;
vl a, b, c;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> X >> Y >> A >> B >> C;

    a.resize(A);
    b.resize(B);
    c.resize(C);
    rep(i, A) cin >> a[i];
    rep(i, B) cin >> b[i];
    rep(i, C) cin >> c[i];

    sort(allr(a));
    sort(allr(b));
    rep(i, X) c.pb(a[i]);
    rep(i, Y) c.pb(b[i]);

    sort(allr(c));
    rep(i, X + Y) ans += c[i];

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

Measured memory_bytes: 2552