akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(void){

    int N,i;
    int64_t L_a;
    int64_t L_b;
    
    cin >> N;

    L_a = 2;
    L_b = 1;

    for (i=2; i<N+1; i++){

        if (i%2 == 0){
            L_a += L_b;
        }
        else{
            L_b += L_a;
        }
    }

    if (N%2 == 0){
        cout << L_a << endl;
    }
    else{
        cout << L_b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	strs := []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
	var s string
	_, _ = fmt.Scan(&s)
	var res int
	for i, v := range strs {
		if s == v {
			res = i
		}
	}
	fmt.Println(strs[res+1])
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define setNil(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
#define setNegINF(x) memset((x),192,sizeof(x)) //NegINF=-INF-1
#define setNeg1(x) memset((x),255,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=100005;
int n,a[N];
ll inv[N],fac[N];
inline ll fpow(ll x,int y=MOD-2){
	if(y==1)return x;
	ll t=fpow(x,y>>1);
	(t*=t)%=MOD;
	if(y&1)(t*=x)%=MOD;
	return t;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=inv[0]=fac[0]=1;i<=n;i++){
		cin>>a[i];
		(a[i]+=a[i-1])%=MOD;
		inv[i]=fpow(fac[i]=fac[i-1]*i%MOD);
	}
	ll ans=a[n]*fac[n]%MOD,cur=0;
	for(int i=1;i<n;i++){
		(ans+=a[i]*fac[n]%MOD*fpow(i+1)%MOD)%=MOD;
		if(i<n-1){
			(cur+=a[n-i]-a[i]+MOD)%=MOD;
			(ans+=cur*2*fac[n]%MOD*fac[i]%MOD*inv[i+2])%=MOD;
		}
		(ans+=(a[n]-a[n-i]+MOD)*fac[n]%MOD*fpow(i+1)%MOD)%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2176
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std;
long long dp[17][17];
int main()
{
    while (true) {
        int a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) break;

        memset(dp, 0, sizeof(dp));
        dp[1][1] = 1;
        int n;
        cin >> n;
        while (n--) {
            int x, y;
            cin >> x >> y;
            dp[x][y]=-1;
        }
        for (int i=1; i<=a; ++i) {
            for (int j=1; j<=b; ++j) {
                if (dp[i][j] < 0)
                    dp[i][j] = 0;
                else
                    dp[i][j] = max(dp[i][j], dp[i-1][j] + dp[i][j-1]);
            }
        }
        cout << dp[a][b] << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    double v;
    while( cin >> v ){
        double t = v / 9.8;
        double y = 4.9 * t * t;
        int N = 1;
        while(1){
            if( (5 * N - 5) > y) break;
            N++;
        }
        cout << N << endl;
    }
}

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


int main()
{
    int n,y,c=0;
    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>y;
        if(y%2!=0 && (i+1)%2!=0)
            c++;
    }
    cout<<c;
}

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

int main() {
    int N,X,Y;
    cin >> N >> X >> Y;
    X--;Y--;
    vector<int> ans(N);
    for (int i = 0; i < N; i++){
        for (int j = i+1; j < N; j++){
            if(j<=X)ans[j-i]++;
            else if(Y<=i)ans[j-i]++;
            else if(i<=X){
                if(j<=Y){
                    int tmp=min(j-X,Y-j+1);
                    ans[X-i+tmp]++;
                }else ans[X-i+j-Y+1]++;
            }else{
                if(j<=Y){
                    int tmp=min(j-i,i-X+Y-j+1);
                    ans[tmp]++;
                }else{
                    int tmp=min(Y-i,i-X+1);
                    ans[tmp+j-Y]++;
                }
            }
        }
    }
    for (int i = 1; i < N; i++){
        cout << ans[i]<<endl;
    }
}

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

int main(){
    long N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<long> l(N);
    for(auto& i : l)cin >> i;

    long S = (1 << N) - 1;


    long ans = numeric_limits<long>::max();
    for(long i = S; i > 0; --i){
        for(long j = S ^ i; j > 0; --j, j &= S ^ i){
            for(long k = S ^ i ^ j; k > 0; --k, k &= S ^ (i | j)){
                long a(0), b(0), c(0);
                for(long m = 0; m < 8; ++m){
                    if(1 & (i >> m))a += l[m];
                    if(1 & (j >> m))b += l[m];
                    if(1 & (k >> m))c += l[m];
                }
                ans = min(ans, 10 * (__builtin_popcount(i) + __builtin_popcount(j) + __builtin_popcount(k)) + abs(A - a) + abs(B - b) + abs(C - c) -30);
            }
        }
    }
    cout << ans << endl;
    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 a=sc.nextInt();
		int b=sc.nextInt();
		int te=-1;
		for(int i=0;i<10000;i++){
			if((int) (i*0.08)==a&&(int) (i*0.1)==b){
				te=i;
				break;
				}
		}
		System.out.print(te);
	}

}


Measured memory_bytes: 24020
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for en500 in range(A+1):
    for en100 in range(B+1):
        for en50 in range(C+1):
            if en500*500 + en100*100 + en50*50 == X:
                ans += 1

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
const long long int mod = 1e9 + 7;
int main()
{
    string S;
    cin >> S;
    if(S == "Sunny")
        cout << "Cloudy" << endl;
    else if(S == "Cloudy")
            cout << "Rainy" << endl;
            else
                cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int H, W;
	cin >> H >> W;
	char a[110][110];
	for (int i = 1; i <= H; ++i) {
		for (int j = 1; j <= W; ++j) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i <= W + 1; ++i) {
		cout << '#';
	}
	cout << endl;
	for (int j = 1; j <= H; ++j) {
		cout << '#';
		for (int i = 1; i <= W; ++i) {
			cout << a[j][i];
		}
		cout << '#' << endl;
	}
	for (int i = 0; i <= W+1; ++i) {
		cout << '#';
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int t;
	cin>>t;
	int arr[t];
	for(int i=0;i<t;i++){
		cin>>arr[i];
	}
	sort(arr,arr+t);
	int fg=0;
	for(int i=0;i<t-1;i++){
		if(arr[i]==arr[i+1]){
			fg=fg+1;
		}
	}
	if(fg==0){
	cout<<"YES";
	}
	else{
		cout<<"NO"<<endl;
	}
    return 0;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)
var wtr = bufio.NewWriter(os.Stdout)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	var n int = nextInt()
	var A []int
	for i := 0; i < n; i++ {
		A = append(A, nextInt())
	}

	for k := 0; k < n; k++ {
		if k != 0 {
			fmt.Fprint(wtr, " ")
		}
		fmt.Fprint(wtr, A[k])
	}
	fmt.Fprintln(wtr)

	for i := 1; i < n; i++ {
		key := A[i]
		/* insert A[i] into the sorted sequence A[0,...,j-1] */
		j := i - 1
		for (j >= 0) && (A[j] > key) {
			A[j+1] = A[j]
			j--
		}
		A[j+1] = key

		for k := 0; k < n; k++ {
			if k != 0 {
				fmt.Fprint(wtr, " ")
			}
			fmt.Fprint(wtr, A[k])
		}
		fmt.Fprintln(wtr)
	}
	_ = wtr.Flush()
}



Measured memory_bytes: 1172
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'

//DP法
template <class T>
inline bool chmin(T &a, T b) //change minimum
{
        if (a > b)
        {
                a = b;
                return true;
        }
        return false;
}
template <class T>
inline bool chmax(T &a, T b) //change max
{
        if (a < b)
        {
                a = b;
                return true;
        }
        return false;
}

typedef long long ll; //64bit型
using namespace std;

//無限大の値
const long long INF = 1LL << 60;

int main()
{
        int N;
        cin >> N;
        vector<int> cost(100010);

        REP(i, N)
        {
                cin >> cost[i];
        }

        ll dp[100010];
        REP(i, N) { dp[i] = INF; }
        dp[0] = 0;

        FOR(i, 1, N)
        {
                chmin(dp[i], dp[i - 1] + abs(cost[i] - cost[i - 1]));
                if (i > 1)
                {
                        chmin(dp[i], dp[i - 2] + abs(cost[i] - cost[i - 2]));
                }
        }
        cout << dp[N - 1] << endl;
        return 0;
}


Measured memory_bytes: 1408
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		
		Integer[] sh = new Integer[s.length()];
		Integer[] th = new Integer[t.length()];
		
		for(int i = 0; i < s.length(); i++) {
			int x = s.charAt(i);
			sh[i] = x;
		}
		
		for(int i = 0; i < t.length(); i++) {
			int x = t.charAt(i);
			th[i] = x;
		}
		
		Arrays.sort(sh);
		Arrays.sort(th, Comparator.reverseOrder());
		
		int check = 0;
		
		if(s.length() <= t.length()) {
			for(int i = 0; i < s.length(); i++) {
				if(sh[i] > th[i]) {
					System.out.println("No");
					check = 1;
					break;
				} else if(sh[i] < th[i]) {
					System.out.println("Yes");
					check = 1;
					break;
				}
			}
			if(check == 0 && s.length() == t.length()) {
				System.out.println("No");
			} else if(check == 0 && s.length() < t.length()){
				System.out.println("Yes");
			}
		} else {
			for(int i = 0; i < t.length(); i++) {
				if(sh[i] > th[i]) {
					System.out.println("No");
					check = 1;
					break;
				} else if(sh[i] < th[i]) {
					System.out.println("Yes");
					check = 1;
					break;
				}
			}
			if(check == 0) {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 23124
//#if !defined(YCM) && 1
//#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx")
////#pragma GCC optimize ("O3")
////#pragma GCC target ("sse4")
//#include <stdio.h>
//#endif
#include <unistd.h>
//#pragma GCC diagnostic ignored "-Wunused-result"
//#pragma GCC diagnostic ignored "-Wunused-function"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define clr(a) memset(a,0,sizeof(a))
#define clr_(a) memset(a,-1,sizeof(a))
#define pb(a) push_back(a)
#define pii pair<int,int>
#define eps 1e-9
#define inf INT_MAX
#define pi acos(-1.0)
#define ff first
#define ss second
#define INF (ll)1e18
#define m_p make_pair
#define all(v) v.begin(),v.end()
int fx[]={0,0,-1,1,-1,1,1,-1};
int fy[]={1,-1,0,0,1,1,-1,-1};
ll lcm(ll a,ll b){return (a/__gcd(a,b))*b;}
ll bigmod(ll a,ll p,ll mod){ll ans=1;while(p){if(p&1)ans=ans*a%mod;a=a*a%mod;p>>=1;}return ans;}
ll power(ll x,ll n){if(n==0)return 1;else if(n%2==0){ll y=power(x,n/2);return y*y;}else return x*power(x,n-1);}

#ifdef shaft
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<endl;
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
const int N=(int)1e6+5;
const int mod=(int)1e9+7;

int main()
{
    ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(100); cout.tie(nullptr); cin.tie(nullptr);
    #ifdef shaft
        freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
    #endif ///shaft
    int a, b , c, x;
    while(cin >> a >> b >> c >> x){
        int res = 0;
        for(int i = 0; i <= a; i ++ ){
            for(int j = 0; j <= b; j++){
                for(int k = 0; k <= c; k++){
                    int y = 500*i+100*j+50*k;
                    if(y == x)
                        res ++ ;
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}





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

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

  double ans = 0;
  for (int i = 1; i <= n; i++)
  {
    double tmp = max(0.0,ceil(log2(k) - log2(i)));
    ans += (1.0/n) * pow(0.5,tmp);
    //printf("%.12f\t%.12f\t%.12f\t%.12f\t%.12f\n",log2(k) , log(i), tmp, pow(0.5,tmp), (1.0/n) * pow(0.5,tmp));
  }

  printf("%.12f\n", ans);
  return 0;
}


Measured memory_bytes: 256
n,m=map(int, input().split())
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
ans=1
for i in pf:
    if pf[i]>=n:
        ans*=i**(pf[i]//n)
print(ans)

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;

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

    int nrest;
    int yrest;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= n; ++j) {
            nrest = n - i - j;
            if(nrest < 0) continue;
            yrest = y - 10000 * i - 5000 * j;
            if(yrest < 0) continue;
            if(1000 * nrest == yrest){
                cout << i << " " << j << " " << nrest << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int syori(int n,int s,int input[]);
void kei(int n,int input[]);
int main(){
    int n;
    while(scanf("%d",&n)){
        if(n==0){
            break;
        }
        int i,input[12];
        for(i=0;i<n;i++){
            scanf("%d,",&input[i]);
        }
        kei(n,input);
    }
    return 0;
}
void kei(int n,int input[]){
    int kai=0,data[12],i;
    while(1){
        for(i=0;i<n;i++){
            data[i]=syori(n,i,input);
        }
        kai++;
        int cnt=0;
        for(i=0;i<n;i++){
            if(input[i]==data[i]){
                cnt++;
            }
            input[i]=data[i];
        }
        if(cnt==n)break;
    }
    printf("%d\n",kai-1);
    for(i=0;i<n-1;i++){
        printf("%d ",input[i]);
    }
    printf("%d\n",input[n-1]);
    return;
}
int syori(int n,int s,int input[]){
    int i,result=0;
    for(i=0;i<n;i++){
        if(input[s]==input[i]){
            result++;
        }
    }
    return result;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  string s, t; 
  cin >> s >> t;

  int N = s.size();

  bool ans = false;
  REP(i, N){
    bool ret = true;
    REP(j, N){
      if(s[(i+j)%N] != t[j]) ret = false;
    }
    ans |= ret;
  }

  ans? Yes: No;

  return 0;
}

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

ll n,m,a=0;

int main() {
    cin>>n;
    rep(i,n){
        cin>>m;
        m%2==0?:a++;
    }
    cout<<((a%2==0)?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/dp/tasks/dp_a

int main() {
  int N; cin >> N;
  ll H[N]; REP(i, N) cin >> H[i];
  ll dp[1000010];
  REP(i, 100001) dp[i] = INF;
  dp[0] = 0;

  for (int i = 1; i < N; i++) {
    chmin(dp[i], dp[i-1] + abs(H[i] - H[i-1]));
    if(i > 1)chmin(dp[i], dp[i-2] + abs(H[i] - H[i-2]));
  }

  cout << dp[N-1] << "\n";

  return 0;
}


Measured memory_bytes: 2304
package main

import (
	"fmt"
)

func cube(n int) int {
	return n * n * n
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	ans := cube(n / k)
	if k%2 == 0 {
		ans += cube(n/(k/2) - n/k)
	}
	fmt.Println(ans)
}


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

int main() {
  
  int N; cin >> N;
  
  for (int i = 0; i < N; i++) {
    
    char S; cin >> S;
    
    if (S == 'Y') {
      cout << "Four" << endl;
      return 0;
    }
    
  }
  
  cout << "Three" << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;

int N;
vector<int> a;
vector<int> used;
bool ok = false;
int ans = 0;

void dfs(int i){
    if(used[i] == 1) return;
    ans++;
    if(a[i] == 2){
        ok = true;
        return;
    }
    used[i] = 1;
    dfs(a[i] - 1);

}

int main(){
    cin >> N;
    a.resize(N);
    rep(i,N) cin >> a[i];
    used.resize(N,-1);
    dfs(0);
    if(ok) cout << ans << endl;
    else cout << -1 << endl;
    
}


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

int main()
{
  int a, b;
  char op;


  while(true){
    cin >> a >> op >> b;
    if(op == '+') cout << a + b << endl;
    else if(op == '-') cout << a - b << endl;
    else if(op == '*') cout << a * b << endl;
    else if(op == '/') cout << a / b << endl;
    else if(op == '?') break;
      }
}



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

#define int long long

using namespace std;

const int maxn = 500/*, mod = 1e9 + 7 */;
const int mod = 1e18;

struct matrix {
        int mat[maxn][maxn], n, m;

        matrix(int n = maxn, int m = -1) : n(n), m(m)
        { if (!~m) m = n; memset(mat, 0, sizeof mat); }

        void fill(int x)
        { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) mat[i][j] = x; }

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

        void print()
        { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cout << mat[i][j] << " \n"[j == m - 1]; }

        void identity()
        { assert(n == m); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) mat[i][j] = i == j; }

        matrix operator+(matrix T)
        {
                matrix R(n, m);
                assert(n == T.n && m == T.m);
                for (int i = 0; i < n; i++)
                        for (int j = 0; j < m; j++)
                                R.mat[i][j] = (mat[i][j] + T.mat[i][j]) % mod;
                return R;
        }

        matrix operator*(matrix T)
        {
                matrix R(n, T.m);
                assert(m == T.n);
                for (int i = 0; i < n; i++)
                        for (int j = 0; j < T.m; j++)
                                for (int k = 0; k < m; k++)
                                        (R.mat[i][j] += mat[i][k] * T.mat[k][j] % mod) %= mod;
                return R;
        }

        matrix operator^(int power)
        {
                matrix R, T = *this;
                R.identity();
                while (power) {
                        if (power & 1)
                                R = R * T;
                        T = T * T;
                        power >>= 1;
                }
                return R;
        }
};

signed main()
{
        ios::sync_with_stdio(false);
        int n, m, l;
        cin >> n >> m >> l;

        matrix a(n, m), b(m, l);
        a.input(), b.input();

        (a * b).print();

        return 0;
}



Measured memory_bytes: 11028
import java.util.Scanner;

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

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

		long cnt = 0;

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextLong();
			while(a[i]%2 == 0) {
				cnt++;
				a[i] /= 2;
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 34788
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   ll n;
   cin>>n;
   
   map<string,ll> ma;
   rep(n)
   {
       string s;
       cin>>s;
       ma[s] = 1;
   }
   cout<<(ll)ma.size();
   
   return 0;        
}  
  
   

Measured memory_bytes: 19180
#include <bits/stdc++.h>
#define MAX 10005
#define INF 1e9
using namespace std;

typedef long long ll;

string dp[MAX];
int arr[] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6}, mark[20];

bool isGreater(string& s, string& t)
{
    if(s.size() != t.size())
        return s.size() > t.size();
    return s > t;
}

string solve(int n)
{
    if(n == 0)
        return "";
    if(dp[n] != "")
        return dp[n];
    string ret = "";
    for(int i = 1; i < 10; i++){
        if(mark[i]){
            if(n - arr[i] >= 0){
                char ch = i + 48;
                string temp = ch + solve(n - arr[i]);
                if(temp[temp.size()-1] == '#')
                    continue;
                if(isGreater(temp, ret)){
                    ret = temp;
                }
            }
        }
    }
    if(ret == "")
        ret = "#";
    return dp[n] = ret;
}   

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    int n, m;

    cin>>n>>m;

    int val;
    for(int i = 0; i < m; i++){
        cin>>val;
        mark[val] = 1;
    }

    string res = solve(n);

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 26624
#include <iostream>
#include <vector>
#include <sstream>
#include <iterator>
#include <unordered_map>

using namespace std;

int main() {
    int n;
    cin >> n;
    unordered_map<string, long long> um;
    for (int i = 0; i < n; ++i) {
        vector<int> d(26, 0);
        string s;
        cin >> s;
        for (char c : s) ++d[c - 'a'];
        ostringstream oss;
        copy(d.begin(), d.end(), ostream_iterator<long long>(oss, "-"));
        ++um[oss.str()];
    }
    long long answer = 0;
    for (pair<string, long long> p : um) {
        if (p.second > 1) {
            answer += (p.second - 1) * (p.second) / 2;
        }
    }
    cout << answer << endl;
}


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

void solve(vector<int> &w, vector<int> &v, int W){
    int n = w.size();
    vector<vector<long long>> dp(n, vector<long long>(W+1, 0));
    
    // Base Cases
    for(int j = 0 ; j <= W ; j++){
        if(j >= w[n-1])
            dp[n-1][j] = v[n-1];
    }
    
    // Filling the dp table
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 0 ; j <= W ; j++){
            if(j >= w[i])
                dp[i][j] = max(v[i]+dp[i+1][j-w[i]], dp[i+1][j]);
            else
                dp[i][j] = dp[i+1][j];
        }
    }
    
    cout << dp[0][W];
}

int main(){
    // INPUT
    int n, W;
    cin >> n;
    cin >> W;
    vector<int> w(n), v(n);
    for(int i = 0 ; i < n ; i++){
        cin >> w[i];
        cin >> v[i];
    }
    
    // OUTPUT
    solve(w, v, W);
}

Measured memory_bytes: 82208
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int a[510][510];
int b[510][510];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    if (w == W && h == H || h == 1 && w == 1) {
        cout << "No" << endl;
        return 0;
    }
    rep(i, H) {
        rep(j, W) {
            if (j % w != w - 1)
                a[i][j] = 1000;
            else 
                a[i][j] -= (w - 1) * 1000 + 1;
        }
    }
    rep(j, W) {
        rep(i, H) {
            if (i % h != h - 1)
                b[i][j] = 1000;
            else 
                b[i][j] -= (h - 1) * 1000 + 1;
        }
    }
    int suma = 0, sumb = 0;
    rep(i, H) {
        rep(j, W) {
            suma += a[i][j];
            sumb += b[i][j];
        }
    }
    ///*
    if (suma < 0 && sumb < 0) {
        cout << "No" << endl;
        return 0;
    }
    //*/
    cout << "Yes" << endl;
    rep(i, H) {
        rep(j, W) {
            if (j != 0) cout << " ";
            if(suma > 0) cout << a[i][j];
            else cout << b[i][j];
        }
        cout << endl;
    }



    return 0;
}


Measured memory_bytes: 5632
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>

using namespace std;

int main(void){

  int x;

  int val;

  int val_max=1;

  cin>>x;

  if(x==1){
    cout << 1 << endl;
    return 0;
  }

  for(int i=2;i <= sqrt(x);i++){

    for(int j=2;powl(i,j) <= x ;j++){
      //cout << powl(i,j) << endl;
      if(val_max < powl(i,j)) val_max= powl(i,j);
    }

  }

  cout << val_max << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	fmt.Println(Calc(n))
}

func Calc(n int) int {
	var sum int
	for i := 1; i <= n; i++ {
		if i%3 != 0 && i%5 != 0 {
			sum += i
		}
	}
	return sum
}


Measured memory_bytes: 1752
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

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

const int N = 1e6 + 123;
int n , m , k;
int f[N] , inv[N];  
string s;
int C(int n , int k){
	if(n - k < 0)return 0;
	return f[n] * inv[n - k] % mod * inv[k]%mod;
}
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n >> m;
	int ans = 0;
	f[0] = inv[0] = 1;
	for(int i = 1 ; i <= 1e6 + 1; i++){
		f[i] = f[i - 1] * i % mod;
		inv[i] = powmod(f[i] , mod - 2 , mod);
	}
	for(int i = 0; i <= 1e6 ; i++){
		int xx = i , yy = 2*i;
		if(xx > n or yy > m)
			break;
		if((n - xx) % 2 == 1)
			continue ;
		int cnt1 = (n - xx)/2 , cnt2 = m - yy;
		if(cnt1 != cnt2)
			continue;		
		ans += C(cnt1+i , cnt1);		
		ans %= mod;
	}
	cout << ans;
}


Measured memory_bytes: 16000
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int n, l;
string s[100];
 
int main() {
	cin >> n >> l;
	
	int i;
	for (i = 0; i < n; i++) cin >> s[i];
	sort(s, s + n);
	for (i = 0; i < n; i++) cout << s[i]; cout << endl;
	return 0;
}

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

int main(){
	int a[4][3][10];
	int n;
	cin >> n;
	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++) a[i][j][k] = 0;
		}
	}
	for(int l=0; l<n; l++){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		a[b-1][f-1][r-1] += v;
	}
	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++) cout << " " << a[i][j][k];
			cout << endl;
		}
		if(i<3) cout << "####################" << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for

int main()
{
    string a,b;
    cin >> a >> b;
    if (a[0] == 'D') {
        if(b[0] == 'D'){
            cout << "H" << endl;
        }else{
            cout << "D" << endl;
        }
    }else{
        if(b[0] == 'D'){
            cout << "D" << endl;
        }else{
            cout << "H" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import math
n, m = map(int, input().split())

div = []
sqrt_m = int(math.sqrt(m))
for i in range(1, sqrt_m + 1):
    if m % i == 0:
        div.append(i)
        div.append(m // i)

div.sort(reverse=True)
for i in div:
    if m >= i * n and (m - i * n) % i == 0:
        print(i)
        exit()

Measured memory_bytes: 3188
fun main(args: Array<String>) {
    val c = readLine()!!.toString()

    if (c == "a") {
        println("b")
    } else if (c == "b") {
        println("c")
    } else if (c == "c") {
        println("d")
    } else if (c == "d") {
        println("e")
    } else if (c == "e") {
        println("f")
    } else if (c == "f") {
        println("g")
    } else if (c == "g") {
        println("h")
    } else if (c == "h") {
        println("i")
    } else if (c == "i") {
        println("j")
    } else if (c == "j") {
        println("k")
    } else if (c == "k") {
        println("l")
    } else if (c == "l") {
        println("m")
    } else if (c == "m") {
        println("n")
    } else if (c == "n") {
        println("o")
    } else if (c == "o") {
        println("p")
    } else if (c == "p") {
        println("q")
    } else if (c == "q") {
        println("r")
    } else if (c == "r") {
        println("s")
    } else if (c == "s") {
        println("t")
    } else if (c == "t") {
        println("u")
    } else if (c == "u") {
        println("v")
    } else if (c == "v") {
        println("w")
    } else if (c == "w") {
        println("x")
    } else if(c == "x") {
        println("y")
    } else if(c == "y") {
        println("z")
    }
}


Measured memory_bytes: 33660
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

int main(){
    ll N,K;
    cin >> N >> K;

    ll ans = 0;

    for (ll i = K; i <= N+1; i++)
    {
        ll first,second;
        first = (0+i-1)*i/2;
        second = (N+N-i+1)*i/2;

        
        ans += second - first + 1;
    }

    ans %= (ll)pow(10,9)+7; //powはdouble方で出力するためllに変えなくてはならない
    cout << ans << endl;
    
}

Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int[] card=new int[5];
			int[] equal=new int[5];
			int equalcount=0;
			String[] str=sc.next().split(",");
			for(int i=0;i<5;i++){
				card[i]=Integer.parseInt(str[i]);
			}
			for(int i=0;i<5;i++){
				for(int j=4;j>i;j--){
					if(card[j-1]>card[j]){
						int box=card[j-1];
						card[j-1]=card[j];
						card[j]=box;
					}
				}
			}
			for(int i=0;i<5;i++){
				for(int j=0;j<5;j++){
					if(card[i]==card[j]){
						equal[i]++;
					}
				}
			}
			for(int i=0;i<5;i++){
				if(equal[i]==2){
					equalcount++;
				}
			}
			if(equal[0]==4||equal[1]==4){
				System.out.println("four card");
			}else if(equal[1]==2&&equal[2]==3||equal[2]==3&&equal[3]==2){
				System.out.println("full house");
			}else if(equal[2]==3){
				System.out.println("three card");
			}else if(equalcount==4){
				System.out.println("two pair");
			}else if(equalcount==2){
				System.out.println("one pair");
			}else if(card[1]==card[0]+1&&card[2]==card[1]+1&&card[3]==card[2]+1&&card[4]==card[3]+1){
				System.out.println("straight");
			}else if(card[0]==1&&card[1]==10&&card[2]==11&&card[3]==12&&card[4]==13){
				System.out.println("straight");
			}else{
				System.out.println("null");
			}
		}
	}
}

Measured memory_bytes: 17300
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&(x));
#define pb push_back
#define fi first
#define se second
#define P pair<int,int>
#define endl '\n'
signed main()
{
    string s;
    cin>>s;
    int n =s.length();
    if(n&1){
        cout<<"No";
        return 0;
    }
    for(int i=0;i<n;i+=2){
        if(s[i]=='h'&&s[i+1]=='i'){

        }else{
        cout<<"No";
        return 0;}
    }
    cout<<"Yes";
}


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

using namespace std;

int main()
{
  int a, b, c; cin >> a >> b >> c;
  if(a == b and a != c)
    cout << "Yes" << endl;
  else if(a == c and a != b)
    cout << "Yes" << endl;
  else if(c == b and a != c)
    cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define       sf                 scanf
#define       pf                 printf
#define       pb                 push_back
#define       sz                 200005
#define       MOD                1000000007
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define 	  optimize           ios::sync_with_stdio(0);cin.tie(0);

using namespace std;

typedef       long long int      ll;

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


int main()
{
	// READ

	ll a;
	long double b;

	cin >> a >> b;

	ll ans = a*b;

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


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll N;
    cin >> N;
    vector<ll> X(N), Y(N), H(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> X[i] >> Y[i] >> H[i];
    }
    bool ans = false;
    for ( int cx = 0; cx <= 100 ; cx++ ) {
        for ( int cy = 0; cy <= 100; cy++ ) {
            ll h = -1;
            bool ok = true;
            for ( int i = 0; i < N; i++ ) {
                ll d = abs(X[i] - cx) + abs(Y[i] - cy);
                if ( H[i] > 0 ) {
                    if ( h == -1 ) {
                        h = H[i] + d;
                        break;
                    }
                }
            }
            for ( int i = 0; i < N; i++ ) {
                ll d = abs(X[i] - cx) + abs(Y[i] - cy);
                if ( H[i] != max(h - d, 0LL) ) {
                    ok = false;
                    break;
                }
            }
            if ( ok ) {
                cout << cx << " " << cy << " "  << h << "\n";
                ans = true;
                break;
            }
        }
        if ( ans ) break;
    }
    
    return 0;
}

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

int main() {
  int A,B,C,D,E=0,F=0;
  cin >> A >> B >> C >> D;
  E = min(A,B);
  F = min(C,D);
  cout << E+F << endl;
  return 0;
  //ツイッターフォローよろしく！
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1e5+5;
int fa[maxn];
int find(int x){
    if(x==fa[x])return x;
    else return fa[x]=find(fa[x]);
}
bool  Merge(int x,int y){
     int xx=find(x);
     int yy=find(y);
     if(xx!=yy){
        fa[xx]=yy;
        return true;
     }
     return false;

}

signed  main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)fa[i]=i;
    int a,b;
    int ans=0;
    while(m--){
        cin>>a>>b;
        if(Merge(a,b)){
            ans++;
        }
    }
    cout<<n-1-ans<<endl;
    return 0;
}


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

#define ll long long
#define ull unsigned long long
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int inf = 1e8 + 5;
void dfs(vector<vector<int>> &adj, vector<int> &distanc, vector<int> &indegree, int n, int i){

	queue<int> arr;
	//int *indegree = new int[n+1];
	arr.push(0);
	while(!arr.empty()){
		int u = arr.front();
		arr.pop();
		for(int v: adj[u]){

			
			indegree[v]--;
			if(indegree[v] == 0){
				distanc[v] = distanc[u] + 1;
				arr.push(v);
			}
		}

	}
}


int main()
{
	fast;
	//int t = 1; cin >> t; while(t--) 
	{
		int n, m;
		cin>>n>>m;
		vector<vector<int>> adj(n+5);
		vector<int> distanc(n+5, 0);
		vector<int> indegree(n+5, 0);
		while(m--){

			int x, y;
			cin>>x>>y;
			adj[0].push_back(x);
			adj[0].push_back(y);
			adj[x].push_back(y);
			indegree[y]+= 2;
			indegree[x]++;
		}
		//distanc[0]= 0;

		dfs(adj, distanc, indegree, n, 0);
		int ans = 0;
		for(int i = 0; i<=n; i++){
			//cout<<distanc[i]<<endl;
			ans = max(ans, distanc[i]);
		}
		cout<<ans -1 <<endl;
	}
	return 0;
}




Measured memory_bytes: 7284
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
 
 
 

 
int main(){
	int X; cin >> X;
	int time = 0;
	int now = 0;
	int ans = 0;
	while(true){
		now += time;
		if(now >= X){
			ans = time;
			break;	
		}
		time++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath> 
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int s[100005]={0};   
int main()  
{ 
/*    int n;
    vector<int>s;
    cin>>n;
    int a=1000000,b=-1;
    int ans=0;
    for(int i=0;i<n;i++){cin>>s[i];a=min(a,s[i]);b=max(b,s[i]);}
    for(int i=a;i<b;i++){
        int cnt=0;
        for(int j=0;j<n;j++){
                if(s[j]+1==i||s[j]==i||s[j]-1==i)cnt++;}
        ans=max(ans,cnt);}
    cout<<ans<<endl;*/
    int n;
    cin>>n;
    int ans=0;
    int c=1000000,b=-1;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        s[a]++;
        s[a-1]++;
        s[a+1]++;
//        c=min(a,c);b=max(b,a);
        }
    for(int i=0;i<100003;i++)ans=max(ans,s[i]);
    cout<<ans<<endl; 
    system("pause");
    return 0;
}

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

using namespace std;

long long n, m, ans;

int main(){
	cin >> n >> m;
	if(n <= m/2){
		ans += n;
		m -= n * 2;
		n = 0;
	}else{
		ans += m/2;
		m = 0;
		n -= m/2;
	}
	ans += m/4;
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli a, b, c;
    cin >> a >> b >> c;
    if(a+b+c<=21){
        out("win");
    }
    else{
        out("bust");
    }
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 220000
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
vector<ll> divs(ll n){
	vector<ll>ret;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			if(i*i==n){
				ret.push_back(i);
			}
			else{
				ret.push_back(i);
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}
void solve(){
	ll n,i,k;
	in2(n,k);
	vector<ll>vec(n);
	nfl(i,n){
		cin>>vec[i];
	}

	sfl(i,k,n){
		if(vec[i]<=vec[i-k]){
			cout<<"No\n";
		}else{
			cout<<"Yes\n";
		}
	}
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	

Measured memory_bytes: 4784
#include<stdio.h>
#define MAX 10000
#define null -1

struct node { int p, l, r; };
struct node t[MAX];
int n;

void prePause(int u){
    if (u == null)
        return;
    printf(" %d", u);
    prePause(t[u].l);
    prePause(t[u].r);
}

void inPause(int u){
    if ( u == null)
        return;
    inPause(t[u].l);
    printf(" %d", u);
    inPause(t[u].r);
}

void postPause(int u){
    if (u == null)
        return;
    postPause(t[u].l);
    postPause(t[u].r);
    printf(" %d", u);
}

int main(){
    int i, v, l, r, root;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        t[i].p = null;
    }
    
    for(i = 0; i < n; i++){
        scanf("%d %d %d", &v, &l, &r);
        t[v].l = l;
        t[v].r = r;
        if (l != null)
            t[l].p = v;
        if (r != null)
            t[r].p = v;
    }
    
    for (i = 0; i < n; i++){
        if (t[i].p == null)
            root = i;
    }         
    
    printf("Preorder\n");
    prePause(root);
    putchar('\n');
    printf("Inorder\n");
    inPause(root);
    putchar('\n');
    printf("Postorder\n");
    postPause(root);
    putchar('\n');
    
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int n, m, k;
vector<vector<int>> to(100000, vector<int>(0));
vector<vector<int>> bu(100000, vector<int>(0));
vector<vector<int>> memo(100000, vector<int>(0));
int ans = 0;
int l = 0;
 
int f(int x){
  	memo.at(x).at(0) = l;
    ans++;
    for(int i=0; i<to.at(x).size(); i++){
      if(memo.at(to.at(x).at(i)).at(0) == -1) f(to.at(x).at(i));
    }
    return 0;
}
 
int main(){
    cin >> n >> m >> k;
    int in0, in1;
    rep(i, n){
      memo.at(i) = {-1, -1};
    }
    rep(i, m){
      cin >> in0 >> in1;
      to.at(in0-1).push_back(in1-1);
      to.at(in1-1).push_back(in0-1);
    }
    rep(i, k){
      cin >> in0 >> in1;
      bu.at(in0-1).push_back(in1-1);
      bu.at(in1-1).push_back(in0-1);
    }
    rep(i, n){
        ans = -1;
        l = i;
    	if(memo.at(i).at(0) == -1){
          f(i);
          memo.at(l).at(1) = ans;
        }else{
          ans = memo.at(memo.at(i).at(0)).at(1);
        }
        rep(j, bu.at(i).size()){
          if(memo.at(bu.at(i).at(j)).at(0) == memo.at(i).at(0)) ans--;
        }
    	cout << ans - to.at(i).size() << ' ';
    }
    cout << endl;
    return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  if((a*b)%2 == 0){
    cout << "Even";
  } else {
    cout << "Odd";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b,c;
	int n=0;

	scanf("%d %d %d",&a,&b,&c);

	n=a; a=b; b=n;
	n=a; a=c; c=n;

	printf("%d %d %d",a,b,c);

	return 0;
}


Measured memory_bytes: 1696
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    int a[3];
    rep(i, 0, 3) cin >> a[i];
    sort(a, a + 3);
    if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256