akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i <(n); i++)
#define rep2(i,l,r) for (int i=(l); i<(r); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//~ using P = pair<int, int>;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll INF = 1e10;
vector<int> v(100110);
vector<ll> dp(100110, INF);

int rec(int i){
    if(dp[i]<INF) return dp[i];
    if(i==0) return 0;
    
    int r=INF;
    chmin(r, rec(i-1)+1);
    for(int j=6; i-j>=0; j*=6) chmin(r, rec(i-j)+1);
    for(int j=9; i-j>=0; j*=9) chmin(r, rec(i-j)+1);
        
    return dp[i] = r;
}

int main(){
    int N;
    cin >> N;
    
    cout << rec(N) << endl;
    return 0;
}


Measured memory_bytes: 15252
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    x,y,z=MI()
    x-=z
    print(x//(y+z))
    
    

main()


Measured memory_bytes: 38384
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val s: Scanner = new Scanner(input)
    val n,l = s.nextInt
    val apples = (l until (l + n))
    val aMin = apples.minBy(Math.abs(_))
    apples.filter(_ != aMin).sum.toString
  }

  val tests = List(
    """5 2""".stripMargin -> """18""",
    """3 -1""".stripMargin -> """0""",
    """30 -50""".stripMargin -> """-1044"""
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

Measured memory_bytes: 25652
#include<stdio.h>
int main(void){
	int m,n,ai,min,max;
	long sum;
	scanf("%d",&n);
	for(m=0;m<n;m++){
		scanf("%d",&ai);
		if(m==0){
			min=ai;
			max=ai;
			sum=ai;
		}
		else{
			if(ai<min){
				min=ai;
			}
			if(max<ai){
				max=ai;
			}
			sum+=(long)ai;
		}
	}
	printf("%d %d %ld\n",min,max,sum);
	return 0;
}

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

int cnt(const char *m,int s,int e,int *buff){
  int cnt=0;
  //  printf("%d~%d\n",s,e);
  for(int i=s-1;i<e-1;i++){
    if(m[i]=='A'&&m[i+1]=='C')cnt++;
    buff[i+1] = cnt;
  }
  //  printf("%s",orig);
  return cnt;
}

int main(void){
  int strlength;
  int asklen;
  int *cntbuf;
  scanf("%d%d",&strlength,&asklen);
  char *str;
  str = (char*)malloc(strlength+1);
  cntbuf = (int*)malloc(strlength*sizeof(int));
  scanf("%s",str);
  cntbuf[0] = 0;
  cnt(str,1,strlength+1,cntbuf);
  for(int i=0;i<asklen;i++){
    int s,e;
    scanf("%d%d",&s,&e);
    printf("%d\n",cntbuf[e-1]-cntbuf[s-1]);
  }
  return 0;
}


Measured memory_bytes: 1280
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,(n))
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

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

	int ans = 1;
	while (ans*(ans + 1) < 2*X) {
		ans++;
	}

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

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


using namespace std;
int x[110];


int main ()
{
int n ;
cin >> n ;
int mn=1000 , mx=-1;
for (int i =0 ; i < n ; i++){
    cin>>x[i];
    mx=max(mx,x[i]);
    mn=min(mn,x[i]);
}
long long ans=1000000009;
for (int j=0; j <=100 ; j++){
        long long sum=0;
for (int i =0 ; i<n ; i++){
    sum+= (x[i]-j)*(x[i]-j);
}
ans=min(ans,sum);
}
cout << ans;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int R = scanner.nextInt();
    int S = scanner.nextInt();
    int P = scanner.nextInt();
    int[] scores = new int[] {R, S, P};
    char[] t = scanner.next().toCharArray();

    long total = 0;
    List<Integer>[] hands = new List[K];
    for (int i = 0; i < K; i++) hands[i] = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      List<Integer> h = hands[i % K];
      switch (t[i]) {
        case 'r':
          h.add(2);
          total += P;
          break;
        case 's':
          h.add(0);
          total += R;
          break;
        case 'p':
          h.add(1);
          total += S;
          break;
      }
    }

    for (List<Integer> h : hands) {
      int prev = -1;
      int count = 0;
      for (int ch : h) {
        if (ch != prev) {
          if (prev >= 0) total -= count / 2 * scores[prev];
          count = 1;
        } else {
          count++;
        }
        prev = ch;
      }
      total -= count / 2 * scores[prev];
    }
    System.out.println(total);
  }
}


Measured memory_bytes: 34148
// <------------- Template -----------------------> //


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(0);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	2 * 1e18;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[200];ll visit[300]={};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,q;
string s,t;
ll sum = 0;
// <------------- Implement Functions Here ----------> //

ll cou(ll a, ll b, ll c) {
	ll val = b/c-a/c;
	if(a%c==0) val++;
	return val;
}

// <------------- Start of main() -------------------> //

void MAIN() {
	ll a,b,c,d,e;
	ll ans = 0;
	cin >> a >> b >> c >> d;
	e = c*d/__gcd(c,d);

	ans += cou(a,b,c) + cou(a,b,d) - cou(a,b,e);
	cout<<(b-a+1)-ans;
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3556
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>

const int MAXN = 200001;

int n;
char s[MAXN][11];

int node[MAXN];

bool cmp(int a,int b) {
    return strcmp(s[a],s[b]) < 0;
}

int main() {
    std::cin >> n;
    for(int i = 1;i <= n;i++) {
        std::cin >> s[i];
        node[i] = i;
    }
    std::sort(node + 1,node + 1 + n,cmp);
    int l = 1,r = 1,max = 0;;
    while(l <= n) {
        while(!strcmp(s[node[r]],s[node[r + 1]]) && r <= n) r++;
        max = std::max(max,r - l + 1);
        l = ++r;
    }
    l = 1,r = 1;
    while(l <= n) {
        while(!strcmp(s[node[r]],s[node[r + 1]]) && r <= n) r++;
        if(r - l + 1 == max) std::printf("%s\n",s[node[l]]);
        l = ++r;
    }

    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int rlr[100000],rll[100000],s[100005];
int main()
{
    string ss;
    cin>>ss;
    int sr=0,sl=0;
    memset(s,0,sizeof(s));
    for(int i=0; i<ss.length(); i++)
    {
        if(ss[i]=='R'&&ss[i+1]=='L')
        {
            rlr[sr++]=i;
            rll[sl++]=i+1;
            s[i]=1;
            s[i+1]=1;
        }
    }
    for(int i=0; i<ss.length(); i++)
    {
        if(!s[i])
        {
            if(ss[i]=='R')
            {
                int l=lower_bound(rlr,rlr+sr,i)-rlr;
                if(i>rlr[sr-1])
                    s[i]=0;
                else
                {
                    s[i]=0;
                    int k=rlr[l]-i;
                    if(k%2)
                        s[rll[l]]++;
                    else
                        s[rlr[l]]++;
                }
            }
            else
            {
                int l=lower_bound(rll,rll+sl,i)-rll-1;
                if(i<rlr[0])
                    s[i]=0;
                else
                {
                    s[i]=0;
                    int k=i-rlr[l];
                    if(!(k%2))
                        s[rlr[l]]++;
                    else
                        s[rll[l]]++;
                }
            }
        }
    }
    for(int i=0; i<ss.length(); i++)
        cout<<s[i]<<" ";
    return 0;
}


Measured memory_bytes: 1408
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll aaa;
    rep(i, n) {
        cin >> a[i];
        a[i] -= i;
    } 
    sort(all(a));


    ll ans = 0;
    rep(i, n/2) {
        ans += abs(a[i]-a[n-1-i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
import sys

def main():
  input = sys.stdin.readline
  N = int(input())
  S = str(input().strip())
  cur = 0
  for i in range(N):
    a, b = S[:i], S[i:]
    cur = max(cur, len(set(a) & set(b)))
  print(cur)


if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int a[] = new int[n];
		for(int i = 0; i < n; i++) a[i] = sc.nextInt();
		
		int chtimes = 0;
		for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(i != minj) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				chtimes++;
			}
		}
		
		for(int i = 0; i < n; i++) {
			if(i != 0) System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("\n" + chtimes);
	}
}


Measured memory_bytes: 26160
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>
#include<stack>
#include <utility>
#define INF 1000000000000
const long long MOD = 1000000007;

using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

//selectを選択した時のn日目での最大幸福
llong dfs(llong n, llong select, vector<vector<llong> > &Table, vector<vector<llong> > &dp){
    llong maxv = -1;
    if(n==1){
        return Table[n][select];
    }
    if(dp[n][select]!=-1){
        return dp[n][select];
    }
    for(int i=0; i<3; i++){
        if(i==select){
            continue;
        }
        maxv = max(maxv, dfs(n-1, i, Table, dp)+Table[n][select]);
    }
    dp[n][select] = maxv;
    return maxv;
}

int main(){
    llong N,K;
    cin >> N;
    vector<vector<llong> > Table(N+1, vector<llong>(3, 0));
    vector<vector<llong> > dp(N+1, vector<llong>(3, -1));
    for(int i=1; i<=N; i++){
        cin >> Table[i][0] >> Table[i][1] >> Table[i][2];
    } 
    llong maxv=-1;
    for(int i=0; i<3; i++){
        maxv = max(maxv, dfs(N, i, Table, dp));
    }
    cout << maxv << endl;
}
//dp[i][j][k]
//i日においての、前日jを選択、前日kを選択した場合の通りsadf
//dp[i+1][j][k]  = dp[i][j][k]
//あとでとく
//https://atcoder.jp/contests/abc037/tasks/abc037_d
//https://atcoder.jp/contests/dp/tasks/dp_i


Measured memory_bytes: 19920
// Problem : B - Easy Linear Programming
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


int solve(){

	int a,b,c,k;cin>>a>>b>>c>>k;
	int ans=0;
	ans+=min(a,k);
	a-=ans;
	k-=ans;
	int z=min(b,k);
	// ans+=z;
	k-=z;
	ans-=min(c,k);
	cout<<ans;


    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
/**
 *      purpose : ABC 120 C
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

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

  string s; cin >> s;
  queue<char> q;

  int n = s.size();

  for (int i = 0; i < n; ++i){
    if (q.empty()){
      q.push(s[i]);
    }
    else if (q.front() == '0' && s[i] == '1'){
      q.pop();
    }
    else if (q.front() == '1' && s[i] == '0'){
      q.pop();
    }
    else q.push(s[i]);
  }
  print(n - (int) q.size());

  return 0;
}

Measured memory_bytes: 512
N = gets.to_i

a = []
i = 0
N.times{
	a << [gets.to_i, i]
	i += 1
}

b = []
a.sort_by{|v, i| v}.each_with_index{|(v, i), j|
#p [v, i, j]
	b[i] = j
}

count1 = 0
count2 = 0

len = b.length
i = 0
while i < len
	if b[i] % 2 != 0
		count1 += 1
	end
	i += 2
end

i = 1
while i < len
	if b[i] % 2 != 1
		count2 += 1
	end
	i += 2
end

puts [count1, count2].max



Measured memory_bytes: 12408
a=input()
b=input()

l=len(a)

for i in range(0,l) :

    s=a[i+1:]+a[:i]+a[i]

    if s==b:
        x=1
        break
    else:
        x=0


if x==1 :
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <iostream>

#define MAX 51

int map[MAX][MAX];
int w, h;

void dfs(int y, int x) {
    map[y][x] = 0;
    for (int dy = -1; dy <= 1; dy++) {
        for (int dx = -1; dx <= 1; dx++) {
            if (dx == 0 && dy == 0) continue;
            int nx = x + dx; int ny = y + dy;
            if (nx >= 0 && nx < w &&
                ny >= 0 && ny < h &&
                map[ny][nx] == 1)
            {
                    dfs(ny, nx);
            }
        }
    }
    return;
}


int main()
{

    int cnt;

    while(std::cin >> w >> h, w+h) {
        cnt = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                std::cin >> map[i][j];
            }
        }

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (map[i][j] == 1) {
                    cnt++;
                    dfs(i, j);
                }
            }
        }

        std::cout << cnt << std::endl;

    }

return 0;
}



Measured memory_bytes: 3292
#include<iostream>
#include<iomanip>
#include<algorithm>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
    long long int a,b;
    long long int x;
    cin >> a >> b >> x;
    if(a%x==0){
        cout << b/x - a/x + 1;
    }else{
        cout << b/x - a/x;
    }
}


Measured memory_bytes: 256
function main(input){
  input = input.split('\n');
  var N = Number(input[0]);
  var A = input[1].split(' ').map(parseFloat);
  var totalA = 0;
  A.map(v => totalA += 1/v); 

  console.log(1/totalA);
}
main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
 
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
 
  combination c(n+5);
 
  mint ans = 0;
  rep(ri,2) {
    rep(i,n) {
      mint now = c(i,k-1);
      if (ri == 1) now = -now;
      ans += now*a[i];
    }
    reverse(a.begin(), a.end());
  }
 
  cout << ans.x << endl;
  return 0;
}


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

typedef long long ll;

const int MAXN = 1e5 + 7;

int a[MAXN];
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }
    int cnt = 0;
    for(int i = 1; i <= n; ++i){
        if(a[i] != i)   cnt++;
    }
    if(cnt > 2) cout << "NO" << endl;
    else    cout << "YES" << 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(void){
  string s;
  cin >> s;
  size_t n = s.length();
  int ans = 0;
  rep(i,n/2){
    if(s.at(i) != s.at(n-i-1)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#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 llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  
  int A, B, C;
  long ans;

  cin >> A >> B >> C;

  if(C <= A + B + 1) ans = B + C;
  else ans = A + B + 1 + B;


  cout << ans << endl;
 

  
}


Measured memory_bytes: 256
#include <stdio.h>
 
 int N[6]={1,5,2,3,0,4},S[6]={4,0,2,3,5,1};
 int E[6]={3,1,0,5,4,2},W[6]={2,1,5,0,4,3},O[6]={0,1,2,3,4,5};
void skt(int *a,int *b,char dir){
    int i,*d;
    if (dir=='N'){d=N;}
    else if (dir=='S'){d=S;}
    else if (dir=='E'){d=E;}
    else if (dir=='W'){d=W;}
    else {d=O;}
    for(i=0;i<6;i++){b[i]=a[d[i]];}
}
int main(){
    int i,buf,d[6],c[6];char od[101];
    for(i=0;i<6;i++){scanf("%d",&d[i]);}
    scanf("%s",od);
    for(i=0;od[i];i++){
        skt(d,c,'O');skt(c,d,od[i]);
    }
    printf("%d\n",d[0]);
    return 0;
}


Measured memory_bytes: 2048
# include <cstdio>
# include <algorithm>
# include <cstring>
# include <cmath>
# include <climits>
# include <iostream>
# include <string>
# include <queue>
# include <vector>
# include <set>
# include <map>
# include <cstdlib>
# include <stack>
# include <ctime>
using namespace std;

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define mct(a,b) memset(a,b,sizeof(a))
# define gc getchar()
typedef long long ll;
const int N=1e5+5;
const int inf=0x7fffffff;
const double eps=1e-7;
template <typename T> void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
	x*=f;
}

int main()
{
	int n;
	read(n);
	printf("%d\n",n*n*n);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;
const long double Pi=acos(-1);
using  P=pair<ll,ll>;
int main(){
  ll N,K,Q;
  cin>>N>>K>>Q;
  vector<ll> A(N);
  unordered_map<ll,ll> mp;
  for(ll i=0;i<Q;i++){
    ll a;
    cin>>a;
    mp[a]++;
  }
  for(ll i=0;i<N;i++){
    A.at(i)=K-Q+mp[i+1];
    if(A.at(i)>0){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
  }
}

Measured memory_bytes: 5540
a1, b1 = (int(x) for x in input().split())
a2, b2 = (int(x) for x in input().split())
a3, b3 = (int(x) for x in input().split())
a4, b4 = (int(x) for x in input().split())
a5, b5 = (int(x) for x in input().split())
a6, b6 = (int(x) for x in input().split())
a7, b7 = (int(x) for x in input().split())

A = [a1, a2, a3, a4, a5, a6, a7]
B = [b1, b2, b3, b4, b5, b6, b7]

for i in range(7):
    print(A[i]-B[i])


Measured memory_bytes: 5604
#include <bits/stdc++.h>
 
using namespace std;
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
 
int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	//vector<string> vs(n)
	string pt="MARCH";
	VI ct(5);
	rep(i,n){
		string s;
		cin >> s;
		rep(j,5){
			if(s[0]==pt[j]){ ct[j]++; break;}
		}
	}
	
	ll ans =0;
	rep(i, 1<<5){
		if(__builtin_popcount(i) !=3) continue;
		ll w=1;
		rep(j, 5) if(i>>j &1) w *= ct[j];
		ans += w;
	}
	cout << ans <<"\n";
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n;
  cin >> n;
  cout << (n*(n+1))/2 << endl;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int H, W;

int main() {
    cin >> H >> W;

    vector<string> A(H);
    vi x(0), y(0);
    for (int i = 0; i < H; i++) {
        cin >> A[i];
        for (int j = 0; j < W; j++) {
            if (A[i][j] == '#') {
                x.push_back(j);
                y.push_back(i);
            }
        }
    }

    int ans = 0;
    int newBlack = 100;
    while (newBlack != 0) {
        newBlack = 0;
        vi x2(0), y2(0);
        for (int i = 0; i < x.size(); i++) {
            int xx = x[i];
            int yy = y[i];
            if (xx > 0 && A[yy][xx - 1] == '.') {  // L
                A[yy][xx - 1] = '#';
                x2.push_back(xx - 1);
                y2.push_back(yy);
                newBlack++;
            }
            if (xx < W - 1 && A[yy][xx + 1] == '.') {  // R
                A[yy][xx + 1] = '#';
                x2.push_back(xx + 1);
                y2.push_back(yy);
                newBlack++;
            }
            if (yy > 0 && A[yy - 1][xx] == '.') {  // U
                A[yy - 1][xx] = '#';
                x2.push_back(xx);
                y2.push_back(yy - 1);
                newBlack++;
            }
            if (yy < H - 1 && A[yy + 1][xx] == '.') {  // D
                A[yy + 1][xx] = '#';
                x2.push_back(xx);
                y2.push_back(yy + 1);
                newBlack++;
            }
        }
        x = x2;
        y = y2;
        if (newBlack != 0) ans++;
    }

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


Measured memory_bytes: 12844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

//long longのシフト演算には気をつけよう

vector<pair<char, char>> td;
int Q, N;
string s;

int Check(int n){ //落ちないなら0 左に落ちるなら1　右に落ちるなら2
    int id = n;
    for(int i=0; i<Q; i++){
        if(s[id] == td[i].first && td[i].second == 'L'){
            id--;
            if(id == 0) return 1;
        }
        else if(s[id] == td[i].first && td[i].second == 'R'){
            id++;
            if(id == N+1) return 2;
        }
    }
    return 0;
}

int leftSolve(){
    int left = 0, right = N+1;
    int mid;
    while(right - left > 1){
        mid = (left+right)/2;
        int v = Check(mid);
        if(v == 1) left = mid;
        else right = mid;
    }

    return left;
}

int rightSolve(){
    int left = 0, right = N+1;
    int mid;
    while(right - left > 1){
        mid = (left+right)/2;
        int v = Check(mid);
        if(v == 2) right = mid;
        else left = mid;
    }

    return right;
}

int main(){
    cin >> N >> Q;
    cin >> s;
    s = '0'+s+'0';
    
    for(int i=0; i<Q; i++){
        char t,d; cin >> t >> d;
        td.push_back({t, d});
    }

    cout << max(0, rightSolve() - leftSolve() - 1) << endl;

    //for(int i=1; i<=N; i++) cout << Check(i) << endl;
}

Measured memory_bytes: 1240
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
    ($line:expr, $name:ident, $t:tt) => {
        let $name = value!($line, $t);
    };
}

macro_rules! values_def {
    ($lines:expr, $n:expr, $name:ident, $t:tt) => {
        let $name = {
            let mut vec = Vec::new();
            for i in 0..$n {
                let mut next = $lines.next().unwrap().split_whitespace();
                vec.push(value!(next, $t));
            }
            vec
        };
    };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(a:i64 b:#));
    let mut b = b.split(".");
    let bx = b.next().unwrap().parse::<i64>().unwrap();
    let by = b.next().map(|x| x.parse::<i64>().unwrap()).unwrap_or(0);

    (a * (bx * 100 + by) / 100).to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "198 1.10\n" => "217\n",
    test2: "1 0.01\n" => "0\n",
    test3: "1000000000000000 9.99\n" => "9990000000000000\n",
}


Measured memory_bytes: 2136
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <cmath>
#include <cstdio>

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;
LL MOD = 1000000007;

double memo[310][310][310];

double solve(vector<int> cnt) {
    //if(memo.find(cnt) != memo.end()) return memo[cnt];
    if(memo[cnt[0]][cnt[1]][cnt[2]] > 0) return memo[cnt[0]][cnt[1]][cnt[2]];
    int N = 0;
    for(auto elem: cnt) N += elem;
    if(N == cnt[0]) return 0;

    double ans = 0;
    for(int i=1; i<=3; i++) {
        if(cnt[i] == 0) continue;
        vector<int> next(4, 0);
        for(int j=0; j<=3; j++) next[j] = cnt[j];
        next[i]--;
        next[i-1]++;
        ans += solve(next) * (double)cnt[i] / (N-cnt[0]); 
    }
    ans += 1. / (1. - (double)cnt[0] / N);
    //cout << cnt[0] << " " << cnt[1] << " " << cnt[2] << " " << cnt[3] << " " << ans << endl;
    return memo[cnt[0]][cnt[1]][cnt[2]] = ans;
}


int main() {
    int N;
    vector<int> cnt(4, 0);
    cin >> N;
    for(int i=0; i<N; i++) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    double ans = solve(cnt);
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 225664
S = input()
# 1-2 3-4 separate
S12 = int(S[:2])
S34 = int(S[2:])
# 判定
# 1 - YYMM
# 2 - MMYY
# 3 - AMBIGOUS
# 4 - NA
flags = [0,0,0,0]

if S12 == 0 or S12 > 12 :
    if S34 == 0 or S34 > 12 :
        #NA
        print('NA')
    else :
        #YYMM
        print('YYMM')
else :
    if S34 == 0 or S34 > 12 :
        #MMYY
        print('MMYY')
    else :
        #AMBI
        print('AMBIGUOUS')


Measured memory_bytes: 2940
#include"bits/stdc++.h"
using namespace std;
int main(){

	string input, answer;
	
	int N;
	int buf;
	int countOne = 0;
	int maxCountOne = 0;

	cin >> N;

	for(int i = 0; i < N; i++){
		cin >> buf;

		if(buf == 0){
			countOne = 0;
			continue;
		}

		countOne++;
		maxCountOne = max(maxCountOne, countOne);
	}

	cout << maxCountOne +1 << endl;

	return 0;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;
const int MAX_N = 200000;
typedef long long int64;
int N;
int A[MAX_N+1];
int64 dp[3][MAX_N+1];
int64 solve(){
	memset(dp,0x3f,sizeof(dp));

	for (int i = 0; i < N; ++i){
		dp[0][i] = A[i];
		if(i-2 >= 0)	dp[0][i] += dp[0][i-2];
	}

	//dp[1][1] = A[0]+A[1];
	for (int i = 0; i < N; ++i){
		if(i-1 >= 0)	dp[1][i] = min(dp[1][i],dp[0][i-1]+A[i]);
		if(i-2 >= 0)	dp[1][i] = min(dp[1][i],dp[1][i-2]+A[i]);
	}

	//dp[2][2] = A[0]+A[1]+A[3];
	for (int i = 0; i < N; ++i){
		if(i-1 >= 0)	dp[2][i] = min(dp[2][i],dp[1][i-1]+A[i]);
		if(i-2 >= 0)	dp[2][i] = min(dp[2][i],dp[2][i-2]+A[i]);
	}

	int64 total = accumulate(A,A+N,0LL);
	//for (int i = 0;i < N; ++i)
		//total += A[i];

	int64 ret = dp[0][N-1];
	if( N % 2 == 0){
		ret = min(ret,dp[0][N-2]);
		ret = min(ret,dp[1][N-2]);
		return total - ret;
	}

	ret = min(ret,dp[1][N-1]);
	ret = min(ret,dp[1][N-2]);

	ret = min(ret,dp[2][N-2]);




	return total - ret;
}
int main(){
	scanf("%d",&N);
	for (int i = 0; i < N; ++i)
		scanf("%d",A+i);
	int64 ans = solve();
	printf("%lld\n",ans);
}



Measured memory_bytes: 7156
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
alp = [chr(ord('a') + i) for i in range(26)]
#A
def A():
    x, a, b = LI()
    if abs(x - a) > abs(x - b):
        print("B")
    else:
        print("A")
    return

#B
def B():
    s = S()
    s = set(s)
    for i in s:
        alp.remove(i)
    if len(alp) == 0:
        print("None")
    else:
        print(alp[0])
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

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


Measured memory_bytes: 4724
#include <iostream>
#include <cmath>

using namespace std;

int n, a[30], s;
int ret;

void rec(bool data[30], int deep)
{
	// cout << deep << endl;
	if (deep == n){
		int a_sum = 0, b_sum = 0;
		for (int i = 0; i < n; i++){
			if (data[i]) a_sum += a[i];
			else b_sum += a[i];
		}

		// cout << sum << endl;
		ret = min(ret, (int)abs(a_sum - b_sum));
		return;
	}
	rec(data, deep + 1);
	data[deep] = true;
	rec(data, deep + 1);
	data[deep] = false;
	return;
}

int main(void)
{
	while (cin >> n, n) {
		ret = 3000000;
		for (int i = 0; i < n; i++){
			cin >> a[i];
		}

		bool data[30];
		fill(data, data + 30, false);
		rec(data, 1);
		data[0] = true;
		rec(data, 1);
		

		cout << ret << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    int i;
    int count[3];
    for(i=0;i<3;i++){
      count[i]=0;
    }
    int P;
    for(i=0;i<N;i++){
      cin >> P;
      if(P<=A)count[0]++;
      if(A<P && P<=B)count[1]++;
      if(P>B)count[2]++;
    }
    int ans=100;
    for(i=0;i<3;i++){
      if(ans>count[i])ans=count[i];
    }
    cout << ans;
    return 0;
}


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

int main() {
    string n; cin >> n;

    int ans = 0;
    rep(i, n.size()) {
        if (n.at(i) == '2')
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>
#include <sstream>
#include <map>

using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

const ll mod = 1e9+7;

int main() {
	ll x;
	cin >> x;
	
	int time = 0;
	int sum = 0;
	FOR(i, 1, x+1) {
		time++;
		sum += i;
		if (x <= sum) {
			break;
		}
	}

	cout << time << endl;

}

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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
void solve() {
    int k;
    cin >> k;
    cout << a[k - 1] << endl;
}

int main() {
	header();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c;
    if(a==b && b==c)
    {
        d=1;
    }
    else if(a==b || b==c || a==c)
    {
        d=2;
    }
    else
    {
        d=3;
    }
    cout<<d<<endl;

    return 0;
}


Measured memory_bytes: 3592
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize,
        mut a: [i64;n]
    }
    a.sort();
    let mut ret = 0;
    for i in 0..n-1 {
        ret += a[i+1] - a[i];
    }
    println!("{}", ret);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int n,k,i;
  cin>>n;
  char ar[n];
  cin>>ar;
  cin>>k;
  
  char ch=ar[k-1];
  for(i=0; i<n; i++)
  {
    if(ar[i]!=ch)
      cout<<"*";
    else
      cout<<ar[i];
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin);i>(end);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" <<; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
ll mod = 1000000007;


int main()
{
	// 入力
	ll H, W, h, w;
	cin >> H >> W >> h >> w;

	cout << (H - h)*(W - w) << endl;

	return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
vector<int> G[1010];
bool checked[1010];
int maxd[1010];
int VI[1010];

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

	cin >> N;
	int p;
	
	rep(i, 0, N)
	{
		rep(j, 0, N - 1)
		{
			cin >> p;
			p--;
			G[i].push_back(p);
		}
	}

	while(true)
	{
		bool ok = false;
		rep(i, 0, N)
		{
			if (VI[i] < N - 1)
			{
				ok = true;
				break;
			}
		}
		if (!ok)break;

		ok = false;
		rep(i, 0, N)
		{
			if (VI[i] == N - 1)continue;
			int to = G[i][VI[i]];
			if (VI[to] < N - 1 && G[to][VI[to]] == i)
			{
				maxd[i] = maxd[to] = max(maxd[i], maxd[to]);
				maxd[i]++;
				maxd[to]++;
				VI[i]++;
				VI[to]++;
				ok = true;
			}
		}

		if (!ok)
		{
			cout << -1 << endl;
			return 0;
		}
	}

	int ans = 0;
	rep(i, 0, N)chmax(ans, maxd[i]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8320
import numpy as np

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

ok = list(range(1,n+1,1)) 

# numpy配列に変換
npp = np.array(p)
npok = np.array(ok)

# 配列の差分を比較
if np.count_nonzero(npp!=npok) <=2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 12496
//code by lynmisakura.wish to be accepted
/****************************/
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;
 
const long long Mod = 998244353;
const long long mod = 1000000007;
const long long INF = 10000000000000;
 
#define itn int
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
vector<vector<int>> G(100010,vector<int>(0));
int visit[100010];
void dfs(int n){
	visit[n] = 1;
	for(int i = 0;i < G[n].size();i++){
		if(visit[G[n][i]] == 0) dfs(G[n][i]);
	}
}
int main(void){
	int n,m;scanf("%d%d",&n,&m);
	for(int i = 0;i < m;i++){
		int x,y,z;scanf("%d%d%d",&x,&y,&z);
		G[--x].pb(--y);
		G[y].pb(x);
	}
	int ans = 0;
	for(int i = 0;i < n;i++){
		if(visit[i] == 0){
			ans++;
			dfs(i);
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 9216