akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  int n;
  cin >> n;
  n = n%10;
  if(n == 2 || n==4 || n==5 || n==7 || n==9){cout << "hon" << endl;}
  else if(n == 3){cout << "bon" << endl;}
  else{cout << "pon" << endl;}
}

Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, K;
  cin>>N>>K;
  int A[N];
  for(int i=0;i<N;++i) {
    cin>>A[i];
  }
  int F[N], B[N];
  for(int i=0;i<N;++i) {
    F[i] = 0;
    B[i] = 0;
  }
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      if(A[i]>A[j]) {
        if(j<i) F[i]++;
        else B[i]++;
      }
    }
  }
  ll ans = 0;
  for(int i=0;i<N;++i) {
    ans += (K-1)*K/2%mod*F[i];
    ans %= mod;
    ans += K*(K+1)/2%mod*B[i];
    ans %= mod;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3616
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;


public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
    public final static int MAX = (int) 90000000;
  // static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
	   
	 FastReader sc = new FastReader();
	 int n = sc.nextInt();
	 int[] a = new int[n];
	 for(int i=0;i<n;++i) a[i] = sc.nextInt();
	 long ans = 0;
     for(int i=1;i<n;++i) {
    	 if(a[i] == a[i-1]) {
    		 a[i] = -1;
    		 ++ans;
    	 }
     }
	 out.print(ans);
	 
	 
	
	 out.close();
		
	}
	
}

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

using namespace std;

int main() {
	int a, b, v, w, t;
	int ab, vw;
	cin >> a >> v >> b >> w >> t;
	ab = abs(a - b);
	vw = v - w;
	if (vw <= 0) {
		cout << "NO" << endl;
	}
	else {
		if ((long double)(ab) / vw <= (long double)(t)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>

int main(){
        int a,b;
        int count=0;
        scanf("%d %d",&a,&b);
        for (int i=0;i<b-a+1;i++){
                if ((a+i)==0){
                        printf("Zero");
                        exit(0);
                }
                if ((a+i)<0){
                        count++;
                }
        }
        if (count%2==0){
                printf("Positive");
        }else{
                printf("Negative");
        }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define hell 1000000007
using namespace std;
const int N=500;
void solve()
{
     int i,j,k,n,m,c=0,ans=0;
    string s;
    ll r;
    cin>>n>>m>>k;
    vector < string>  v(n+1);
  //  char v[n+1][m+1];
   rep(i,0,n) cin>>v[i];
 /* rep(i,1,n+1)
  {
      rep(j,1,m+1)
      cin>>v[i][j];
  } */

 /*   rep(i,1,n+1)
  {
      rep(j,1,m+1)
      cout<<v[i][j];cout<<endl;
  } */

    int itr=(1LL)<<n;
    int itc=(1LL)<<m;
    rep(i,0,itr)
    {
        rep(j,0,itc)
        {
            set < int > vr;
            set < int >vc;
            int ii=i; int oo=0;
            while(ii>0)
            {
                if(ii&1)
                {
                    vr.insert(oo);
                }
                oo++;
                ii/=2;
            } oo=0;
            int jj=j;
              while(jj>0)
            {
                if(jj&1)
                {
                    vc.insert(oo);
                }
                oo++;
                jj/=2;
            }
            c=0;
            //cout<<i<<" "<<j<<endl;
           /* cout<<"row"<<endl;
             for(auto it : vr) cout<<it<<" ";
            cout<<endl;
            cout<<"col"<<endl;
            for(auto it1:vc) cout<<it1<<" "; */
            rep(ii,0,n)
            {
                rep(jj,0,m+1)
                {
                    if(!vc.count(jj) and !vr.count(ii)) if(v[ii][jj]=='#') c++;
                    //cout<<"okkkkkkkkkkkkkkkkkk"<<ii<<" "<<jj<<endl;

                }
            }
            //cout<<endl<<endl;
            // cout<<"c=="<<c<<endl;
            if(c==k) ans++;

        }
    }
    cout<<ans;




}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    solve();
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int k=0,u=0,p=0,c=0,a[4];
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='K') k++;
        else if(s[i]=='U') u++;
        else if(s[i]=='P') p++;
        else if(s[i]=='C') c++;
    }
    a[0]=k;
    a[1]=u;
    a[2]=p;
    a[3]=c;
    sort(a,a+4);
    cout<<a[0]<<endl;
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N; ll M; int A[101010];
//---------------------------------------------------------------------------------------------------
ll getCount(int tot) {
	ll res = 0;
	rep(i, 0, N) {
		int Ay = tot - A[i];
		int idx = lower_bound(A, A + N, Ay) - A;
		res += N - idx;
	}
	return res;
}
//---------------------------------------------------------------------------------------------------
ll As[101010];
ll getSum(int tot) {
	rep(i, 0, N) As[i] = A[i];
	rrep(i, N - 2, 0) As[i] += As[i + 1];

	ll res = 0;
	rep(i, 0, N) {
		int Ay = tot - A[i];
		int idx = lower_bound(A, A + N, Ay) - A;
		int cnt = N - idx;
		res += 1LL * A[i] * cnt;
		res += As[idx];
	}
	return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> M;
	rep(i, 0, N) cin >> A[i];
	sort(A, A + N);

	int ok = 0, ng = inf;
	while (ok + 1 != ng) {
		int md = (ok + ng) / 2;
		if (M <= getCount(md)) ok = md;
		else ng = md;
	}

	ll ans = (M - getCount(ok + 1)) * ok + getSum(ok + 1);
	cout << ans << endl;
}







Measured memory_bytes: 1408
import java.util.Arrays;
import java.util.Scanner;
 
 
public class Main{

	
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	
    	final int N = sc.nextInt();
    	
    	NEXT:
    	for(int tt = 0; tt < N; tt++){
    		int[][] array = new int[3][10];
    		int[] count = new int[3];
    	
    		int[][] card = new int[2][9];
    		for(int i = 0; i < 9; i++){
    			card[0][i] = sc.nextInt();
    		}
    		for(int i = 0; i < 9; i++){
    			String in = sc.next();
    			
    			if("R".equals(in)){
    				card[1][i] = 0;
    				count[0]++;
    			}else if("G".equals(in)){
    				card[1][i] = 1;
    				count[1]++;
    			}else if("B".equals(in)){
    				card[1][i] = 2;
    				count[2]++;
    			}
    		}
    		
    		for(int i = 0; i < 9; i++){
    			array[card[1][i]][card[0][i]]++;
    		}
    		
    		for(int i = 0; i < 3; i++){
    			if(count[i] % 3 != 0){
    				System.out.println(0);
    				continue NEXT;
    			}
    		}
    		
    		for(int i = 0; i < 3; i++){
    			for(int num = 0; num < 10; num++){
    				if(array[i][num] >= 3){
    					array[i][num] %= 3;
    				}
    				
    				if(array[i][num] > 0){
    					if(num >= 8){
    						System.out.println(0);
    						continue NEXT;
    					}
    					
    					if(array[i][num+1] > 0 && array[i][num+2] > 0){
    						array[i][num]--;
    						array[i][num+1]--;
    						array[i][num+2]--;
    						num -= 1;
    					}else{
    						System.out.println(0);
    						continue NEXT;
    					}
    				}
    			}
    		}
    		
    		System.out.println(1);
    	}
    }
     
}

Measured memory_bytes: 18988
import java.io.*;
import java.util.*;

public class Main{
    public void run(){
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] args = br.readLine().split(" ");
            int n = Integer.parseInt(args[0]);
            int m = Integer.parseInt(args[1]);
            List<String> list = new ArrayList<>();
            for(int i = 0; i < n; i++){
                list.add(br.readLine());
            }

            for(int i = 0; i< m + 2; i++){
                System.out.print("#");
            }
            System.out.println();
            for(int i = 0; i< n;i++){
                System.out.println("#"+ list.get(i) + "#");
            }
            for(int i = 0; i< m + 2; i++){
                System.out.print("#");
            }
            System.out.println();

        }catch(Exception e){

        }
    }
    public static void main(String... args){
        new Main().run();
    }
}


Measured memory_bytes: 21972
import math
def comb(n, r):
    if n < r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())
K = int(input())
strN = str(N)
lenn = len(strN)
if K == 1:
    print((lenn-1)*9 + int(strN[0]))
elif K == 2:
    if lenn == 1:
        print(0)
    else:
        ans1 = 81*comb(lenn-1,2)
        ans1 += (int(strN[0])-1)*9*(lenn-1)
        for i in range(1,lenn):
            if int(strN[i]) != 0:
                ans1 += int(strN[i])
                ans1 += 9*(lenn-i-1)
                break
        print(ans1)
else:
    if lenn <= 2:
        print(0)
    else:
        ans1 = (9**3)*comb(lenn-1,3)
        ans1 += (int(strN[0])-1)*81*comb(lenn-1,2)
        for i in range(1,lenn):
            if strN[i] != '0':
                break
        strN = strN[i:]
        lenn = len(strN)
        if lenn == 1:
            ans2 = 0
        else:
            ans2 = 81*comb(lenn-1,2)
            ans2 += (int(strN[0])-1)*9*(lenn-1)
            for i in range(1,lenn):
                if int(strN[i]) != 0:
                    ans2 += int(strN[i])
                    ans2 += 9*(lenn-i-1)
                    break
        print(ans1+ans2)        

Measured memory_bytes: 38256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, A = 0, C = 1, G = 2;
int dp[101][4][4][4] = {}, n;
inline void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
void rec(int len) {
  if (len == n) return;
  for (int cur = 0; cur < 4; cur++) {
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        for (int k = 0; k <4; k++) {
          if (cur == C && i == G && j == A) continue;
          if (cur == G && i == C && j == A) continue;
          if (cur == C && i == A && j == G) continue;
          if (cur == C && i == G && k == A) continue;
          if (cur == C && j == G && k == A) continue;
          add(dp[len + 1][cur][i][j], dp[len][i][j][k]);
        }
      }
    }
  }
  rec(len + 1);
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n;  
  dp[0][3][3][3] = 1;
  int ans = 0;
  rec(0);
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        add(ans, dp[n][i][j][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
a,b,c = map(int,input().split())
n_list = list(map(int,input().split()))
ans_1 = 0
ans_2 = 0

for i in n_list:
  if i >=c and i <=a:
    ans_1+=1
    
for i in n_list:
  if i >=0 and i <=c:
    ans_2+=1

print(min(ans_1,ans_2))

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

int main() {
    int n, x;
    cin >> n >> x;
    priority_queue<int> q;
    while (n--) {
        int x;
        cin >> x;
        q.push(-x);
    }
    int res = 0;
    while (x >= -q.top()) x += q.top(), q.pop(), ++res;
    if (q.empty() && x) --res;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String args[] ) {
		Scanner sc = new Scanner(System.in);
		
		int d = sc.nextInt();
		int g = sc.nextInt();
		int[] p = new int[d];
		int[] c = new int[d];
		int[] s = new int[d];
		
		for( int i = 0; i < d; i++ ) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
			s[i] = p[i] * 100 * (i+1) + c[i];
		}
		
		int ans = 0;
		for( int i = 0; i < d; i++ )
			ans += p[i];
		
		
		for( int i = 0; i < (1<<d); i++ ) {
			int sum = 0;
			int s1 = 0;
			int num = 0;
			for( int j = 0; j < d; j++ ) {
				if( (1&(i>>j)) == 1 ) { 
					sum += s[j];
					num += p[j];
				}
				else
					s1 = j;
			}
			if( sum < g ) {
				int need = (int)Math.ceil((double)(g - sum)/(100 * (s1+1)));
				if( need < p[s1] ) {
					ans = Math.min(ans, num+need);
				}
				
			}
			else {
				ans = Math.min(ans, num);
			}
			
		}
		System.out.println( ans );
		
		
		sc.close();
	}
}


Measured memory_bytes: 35580
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <string>

using namespace std;

struct City{
    int index;
    int pref;
    int year;
    string id;
};

bool cmpYear(const City &a, const City &b){
    if(a.pref == b.pref){
        return a.year < b.year;
    } else {
        return a.pref < b.pref;
    }
}

bool cmpIndex(const City &a, const City &b){
    return a.index < b.index;
}

string zeroFill(int n){
    string tmp = "";
    for(int i = (int)log10(n)+1; i < 6; i++){
        tmp += "0";
    }
    return tmp += to_string(n);
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<City> cities(m);
    for(int i = 0; i < m; i++){
        int tmpp, tmpy;
        cin >> tmpp >> tmpy;
        cities[i].index = i;
        cities[i].pref = tmpp;
        cities[i].year = tmpy;
    }

    sort(cities.begin(), cities.end(), cmpYear);

    int cPref = 0;
    int cCount = 1;
    for(int i = 0; i < m; i++){
        if(cPref != cities[i].pref){
            cPref = cities[i].pref;
            cCount = 1;
        }
        cities[i].id = zeroFill(cPref) + zeroFill(cCount);
        cCount++;
    }

    sort(cities.begin(), cities.end(), cmpIndex);
    for(int i = 0; i < m; i++){
        cout << cities[i].id << endl;
    }
}

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

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(){
  string S, T;
  int A, B;
  string U;
  cin >> S >> T >> A >> B >> U;

  if(S==U) cout << A-1 << " " << B;
  else cout << A << " " << B-1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int A[3];
void solve()
{
    sort(A,A+3);
    if (A[0]==A[1]) cout<<A[2];
    else cout<<A[0];
    cout<<endl;
}
int main()
{
    while(cin>>A[0]>>A[1]>>A[2])
        solve();
}

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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N+1),R(N+1);
  for(int i(0);i<=N;i++){
    cin>>A[i];
  }
  if((A[0] != 0 && N != 0 )|| A[0] > 1){
    cout << -1 << endl;
    return 0;
  }
  R[N] = A[N];
  for(int i(N-1);i>=0;i--){
    R[i] = R[i+1] + A[i];
  }
  ll ans(1);
  ll nowha(1);
  for(int i(1);i<=N;i++){
    ll cap = nowha * 2;
    if(cap < A[i]){
      cout << -1 << endl;
      return 0;
    }
    ll cnt(0);
    if(cap <= R[i]){
      nowha *= 2;
      cnt = nowha;
      nowha -= A[i];
      if(nowha < 0){
        cout << -1 << endl;
        return 0;
      }
    }else{
      cnt = R[i];
      nowha = R[i]-A[i];
    }
    ans += cnt;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4844
using System;

public class Program
{
    private static void Main()
    {
        string[] WHxyr = Console.ReadLine().Split(' ');
        int W = int.Parse(WHxyr[0]);
        int H = int.Parse(WHxyr[1]);
        int x = int.Parse(WHxyr[2]);
        int y = int.Parse(WHxyr[3]);
        int r = int.Parse(WHxyr[4]);

        if (x >= W || y >= H || x - r < 0 || y - r < 0 || x + r > W || y + r > H)
            Console.WriteLine("No");
        else
            Console.WriteLine("Yes");
    }
}

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

using namespace std;

int main(void) {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector <int> x(N + 1), y(M + 1);
  for(int i = 1; i <= N; i++) {
    cin >> x[i];
  }
  for(int i = 1; i <= M; i++) {
    cin >> y[i];
  }

  for(int Z = X + 1; Z <= Y; Z++) {
    bool tmp = true;
    for(int j = 1; j <= N; j++) {
      if(!(x[j] < Z)) {
	tmp = false;
      }
    }
    for(int j = 1; j <= M; j++) {
      if(!(y[j] >= Z)) {
	tmp = false;
      }
    }
    if(tmp) {
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
    int a,f=0;
    cin>>a;
    for(int i=1;i<=9;i++){
        if(a%i==0&&a/i>=1&&a/i<=9)f=1;
    }
    if(f==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    
    return 0;
}



Measured memory_bytes: 256
/*
 * Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
 *       Example:-   $ g++ -std=c++11 c++Template.cpp
 *
 * Author : Denzil Bernard  / Edgar Monis
 * Handle: 1_mn_RMY / the_king_in_the_north
 *
 */

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
//#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

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

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define read(type) readInt<type>()
#define ll long long
typedef pair< ll, ll> PII;
typedef vector<ll> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<ll,ll> MPII;
typedef set<ll> SETI;
typedef multiset<ll> MSETI;

ll SI(){
    ll x;
    cin>>x;
    return x;
}


ll mod(ll a){
	return a<0?-a:a;
}


/********** Main()  function **********/
int main()
{
	ll H = SI(), W = SI(), h = SI(), w = SI();
	cout<<H*W - (h * W) - (w * H) + h * w;
    
    return 0;
}





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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=1;

int main()
{
    ll x,k,d;
    scanf("%lld%lld%lld",&x,&k,&d);
    x=abs(x);
    ll tmp=min(x/d,k);
    k-=tmp;
    x-=tmp*d;
    if(k%2)
    {
        x=d-x;
    }
    printf("%lld",x);

}


Measured memory_bytes: 3808
#include <stdio.h>

int n, A[50];

// 入力値のMから選んだ要素を引いていく再帰関数
int solve(int i, int m) {
    if(m==0) return 1;
    if(i>=n) return 0;
    int res = solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(void) {
    int q, M, i;

    scanf("%d", &n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++) {
        scanf("%d", &M);
        if(solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


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


int main() {
  	long a, b, c, d, s1, s2, s3, s4;
	cin >> a >> b >> c >> d;
  	s1 = a*c;
  	s2 = a*d;
  	s3 = b*c;
  	s4 = b*d;
  if(s1>=s2 && s1 >=s3 && s1>=s4){
  	cout << s1;
  }else if(s2 >=s3 && s2>=s4){
  	cout << s2;
  }else if(s3>=s4){
  	cout << s3;
  } else {
  	cout << s4;
  }
  
  
  
  return 0;
}


Measured memory_bytes: 3592
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
odd = 0
even4 = 0
a.each do |x|
  if x % 4 == 0
    even4 += 1
  elsif x % 2 != 0
    odd += 1
  end
end
if even4 + odd == n
  puts (odd <= even4 + 1)? "Yes" : "No"
else
  puts (odd <= even4)? "Yes" : "No"
end

Measured memory_bytes: 9476
use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let mut iter = s.as_str().chars();
    let mut flag = false;

    if iter.next() != Some('A') {
        println!("WA");
        return;
    }
    if !iter.next().unwrap().is_lowercase() {
        println!("WA");
        return;
    }
    for _ in 0..s.len() - 3 {
        let c = iter.next();
        if c == Some('C') {
            flag = true;
            break;
        } else if !c.unwrap().is_lowercase() {
            println!("WA");
            return;
        }
    }
    for c in iter {
        if !c.is_lowercase() {
            println!("WA");
            return;
        }
    }
    if flag {
        println!("AC");
    } else {
        println!("WA");
    }
}


Measured memory_bytes: 2160
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const int INF = INT_MAX;
// const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (500000)

class BitSum{
protected:
  static const int max_value = 500000 + 2;
  ll bit[max_value + 1];

public:
  BitSum(int size) {
    assert(size < max_value);
    init();
  }
  void init(){
    for (int i = 0; i < max_value; i++){
      bit[i] = 0;
    }
  }
  void add(int idx, ll val){
    int p = idx+1;
    while(p < max_value){
      bit[p] += val;
      p += p & -p;
    }
  }
  /**
   * [0, idx]のsumを求める
   */
  ll calc(int idx){
    ll res = 0;
    int p = idx+1;
    while(0 < p){
      res += bit[p];
      p -= p & -p;
    }
    return res;
  }
  /**
   * [idx1, idx2]のsumを求める
   */
  ll range(int idx1, int idx2) {
    return calc(idx2) - calc(idx1 - 1);
  }
};

ll getNth(BitSum &bs, int index, int max_size){
  ll l = 1, h = max_size;

  while (l < h) {
    ll m = (l + h) / 2;
    ll res = bs.calc(m);
    // printf("l = %lld, h = %lld: calc(%lld) = %lld\n", l, h, m, res);
    if (res < index) {
      l = m + 1;
    }
    else {
      h = m;
    }
  }

  return (l + h) / 2;
}

void exec(int q, int lim){
  unordered_map<int, int> number2index;
  unordered_map<int, int> index2number;
  VI incubated;
  BitSum bs = BitSum(MAX_N);
  int index;
  int count = 0;

  for (int i = 0; i < q; i++){
    int query, x;
    scanf("%d%d", &query, &x);
    // printf("query = (%d, %d)\n", query, x);

    switch (query) {
      case 0:
        incubated.push_back(x);
        bs.add(incubated.size(), 1);
        number2index[x] = incubated.size();
        index2number[incubated.size()] = x;
        count++;

        if (count > lim) {
          index = getNth(bs, 1, incubated.size());
          // printf("0: overflow. delete (%d, %d)\n", index, index2number[index]);
          bs.add(index, -1);
          count--;
        }
        break;
      case 1:
        index = getNth(bs, x, incubated.size());
        // printf("1: delete by index = (%d, %d)\n", index, index2number[index]);
        bs.add(index, -1);
        count--;
        break;
      case 2:
        index = getNth(bs, x, incubated.size());
        // printf("DEBUG 2: index = %d\n", index);
        // printf("DEBUG 2: range = %lld\n", bs.range(index, index));
        printf("%d\n", index2number[index]);
        break;
      case 3:
        bs.add(number2index[x], -1);
        // printf("3: delete by number = (%d, %d)\n", x, number2index[x]);
        count--;
        break;
    }
  }

  printf("end\n");

}

void solve(){
  while (true){
    int q, lim;
    scanf("%d%d", &q, &lim);

    if (q + lim == 0) {
      break;
    }

    exec(q, lim);
  }
}

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



Measured memory_bytes: 41688
K=int(input())
if K%2==0:
    print(-1)
else:
    if K%7==0:
        L=9*K//7
    else:
        L=9*K
    rest=10%L
    for i in range(1,L+1):
        if rest==1:
            print(i)
            exit()
        else:
            rest=(rest*10)%L
        if i==L and rest!=1:
            print(-1)

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define MN 300005
#define MM 600005
#define ll long long
#define mod 1000000007
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
typedef pair<int,int> pii;
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
int n;
int x[MN];
int pre[MN],suf[MN],ans;
int main(){
	scanf("%d",&n);
	F(i,1,n)scanf("%d",x+i);
	pre[0]=suf[n]=1;
	F(i,1,n-1)pre[i]=(ll)pre[i-1]*i%mod;
	dF(i,n-1,1)suf[i]=(ll)suf[i+1]*i%mod;
	F(i,1,n-1)ans=(ans+(ll)(x[n]-x[i])*pre[i-1]%mod*suf[i+1])%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


signed main(){
  int a, b, c;
  cin >> a >> b>> c;
  cout << (c/a)*b << endl;
  return 0;
}






Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define pb push_back
#define f first
#define s second
#define double long double
const int MAX=2e5+10;
const int MAX2=2e5+4;
const int MAAX=2e18;
const int MOD=1e9+7;
int dp[MAX][2];
int n,k;
int a[105];
int ans=0;
int fun(int left,int last)
{
    //cout<<left<<" "<<last<<endl;
    int &ret=dp[left][last];
    if(ret!=-1)
    {
        return ret;
    }
  //  cout<<ans++<<endl;
    bool ok=0;
  for(int i=0;i<n;i++)
  {
      if(left>=a[i]&&fun(left-a[i],!last)==last)
      {
          return ret=last;

      }
  }
  return ret=!last;
}
in main()
{
  memset(dp,-1,sizeof dp);
cin>>n>>k;
for(int i=0;i<n;i++)
{
    cin>>a[i];
}
if(fun(k,0))
{
    cout<<"Second"<<endl;
    return 0;
}
cout<<"First"<<endl;
    return 0;
}


Measured memory_bytes: 5888
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: u64,
        b: u64,
        n: u64,
    }
    let f = |x: u64| -> u64 {
        a * x / b - a * (x / b)
    };
    println!("{}", f(std::cmp::min(n, b-1)));
}


Measured memory_bytes: 2132
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int x, n;
    cin >> x >> n;
    vector<int> a(102,0);
    for(int i = 0; i < n; ++i) {
        int v;
        cin >> v;
        ++a[v];
    }
    int mi = 0, ma = 101;
    for(int i = 0; i < 102; ++i) {
        if(i  < x && a[i] == 0) {
            mi = i;
        }
        if(i >= x && a[i] == 0) {
            ma = i;
            break;
        }
    }
    //cout << mi << ' ' << ma << endl;
    if(abs(x - mi) <= abs(x - ma))
        cout << mi << endl;
    else
        cout << ma << endl;

}

Measured memory_bytes: 3644
N,K,Q = map(int,input().split())
A_list = [int(input()) for _ in range(Q)]
ans = [K]*N
con = [0]*N

for i in A_list:
    con[i-1] += 1

ans = [x+y-Q for (x,y) in zip(ans,con)]

for k in ans:
    if k>0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 12588
#include<stdio.h>
	int main()
{
	char s[1003],t[1003];
	scanf("%s%s",s,t);
	int x,y,i,j;
	for(x=0;s[x]!='\0';x++);
	for(y=0;t[y]!='\0';y++);
	int ans=y,a;
	for(i=0;i<=x-y;i++){
		a=0;
		for(j=0;j<y;j++){
			if(s[i+j]!=t[j]){
				a++;
			}
		}
		if(a<ans){
			ans=a;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1720
#include <iostream>
#include <utility>
#include <algorithm>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[200005];
llint sum[200005];

P divi(llint l, llint r)
{
	llint s = sum[r] - sum[l-1];
	s = sum[l-1] + s / 2;
	
	//cout << "s" << s << endl;
	int p = upper_bound(sum+l, sum+r+1, s) - sum;
	//cout << p << endl;
	P ret = make_pair(-inf, inf);
	
	if(p <= r){
		llint sm1 = (sum[p-1] - sum[l-1]), sm2 = (sum[r] - sum[p-1]);
		llint mx = max(sm1, sm2), mn = min(sm1, sm2);
		if(mx - mn < ret.second - ret.first) ret = make_pair(mn, mx);
		
		sm1 = (sum[p] - sum[l-1]), sm2 = (sum[r] - sum[p]);
		 mx = max(sm1, sm2), mn = min(sm1, sm2);
		if(mx - mn < ret.second - ret.first) ret = make_pair(mn, mx);
	}
	if(p-1 != l){
		llint sm1 = (sum[p-2] - sum[l-1]), sm2 = (sum[r] - sum[p-2]);
		llint mx = max(sm1, sm2), mn = min(sm1, sm2);
		if(mx - mn < ret.second - ret.first) ret = make_pair(mn, mx);
	}
	//cout << ret.first << " " << ret.second << endl;
	return ret;
}

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for(int i = 1; i <= n; i++) sum[i] = sum[i-1] + a[i];
	
	llint ans = inf;
	for(llint i = 3; i <= n-1; i++){
		P res1 = divi(1, i-1);
		P res2 = divi(i, n);
		ans = min(ans, max(res1.second, res2.second) - min(res1.first, res2.first));
	}
	cout << ans << endl;
	return 0;
}



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

using namespace std;

int main(void){
  string S;
  string P = "CODEFESTIVAL2016";
  cin >> S;
  int ans = 0;
  for(int i = 0; i < min(S.length(), P.length()); i++){
    if(S[i] != P[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) {return (n==0)?1:10*TEN(n-1);}
template<class T> using V = vector<T>;

ll calc1(int n, V<ll> x, V<ll> y) {
    // pattern 1 [min, ???], [???, max]
    for (int i = 0; i < n; i++) {
        if (x[i] > y[i]) swap(x[i], y[i]);
    }
    sort(begin(x), end(x));
    sort(begin(y), end(y));
    return (x[n-1] - x[0]) * (y[n-1] - y[0]);
}

ll calc2(int n, V<ll> x, V<ll> y) {
    // pattern 2 [min, max], [???, ???]
    using P = array<ll, 2>;
    V<P> v;
    ll mi = TEN(18), ma = -TEN(18);
    multiset<ll> s;
    for (int i = 0; i < n; i++) {
        if (x[i] > y[i]) swap(x[i], y[i]);
        v.push_back(P{x[i], y[i]});
        mi = min(mi, x[i]);
        ma = max(ma, y[i]);
        s.insert(x[i]);
    }
    sort(begin(v), end(v));
    ll ans = (ma - mi) * (*s.rbegin() - *s.begin());
    for (int i = 0; i < n; i++) {
        s.erase(s.find(v[i][0]));
        s.insert(v[i][1]);
        ans = min(ans, (ma - mi) * (*s.rbegin() - *s.begin()));
    }
    return ans;
}

int main() {
    int n;
    scanf("%d", &n);
    V<ll> x(n), y(n);
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &(x[i]), &(y[i]));
    }
    printf("%lld\n", min(calc1(n, x, y), calc2(n, x, y)));
    return 0;
}


Measured memory_bytes: 21100
N = int(input())
S = input()

cnt = {'R' : 0, 'G' : 0, 'B' : 0}
for Si in S:
    cnt[Si] += 1

ans = 1    
for key, val in cnt.items():
    ans *= val
# print("#", ans)
    
for i in range(N):
    for j in range(i + 1, N):
        k = 2 * j - i
        if k >= N: continue
        #
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1

print(ans)

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

using namespace std;

const int HUGEI = 2147483647;  // (1 << 31) - 1
const long long HUGEL = 9223372036854775807;  // (1 << 63) - 1
const string ABC = "abcdefghijklmnopqrstuvwxyz";

int main(void) {
    int n;
    vector <int> an;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        an.push_back(a);
    }
    deque <int> bn;
    for (int i = 0; i < n; i++) {
        if ((n - (i + 1)) % 2 == 0) {
            bn.push_front(an[i]);
        } else {
            bn.push_back(an[i]);
        }
    }
    for (int i = 0; i < n; i++) {
        cout << bn[i];
        if (i < n - 1) {
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3828
#include <cstdio>

int main() {
  int k, a, b;
  bool flag = false;
  scanf("%d%d%d", &k, &a, &b);
  for(int i=a;i<=b;i++) {
    if(i % k == 0) flag = true;
  }
  flag ? puts("OK") : puts("NG");
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int a,b; cin>>a>>b;
	int sum=0;
	rep(i,b-a) sum+=i+1;
	cout<<sum-b<<endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()
ans=0
for i in range(0,10):
    si=s.find(str(i))
    if si<0:
        continue
    for j in range(0,10):
        sj=s[si+1:].find(str(j))
        if sj<0:
            continue
        for k in range(0,10):
            sk=s[si+1:][sj+1:].find(str(k))
            if sk>=0:
                ans+=1
print(ans)

Measured memory_bytes: 39792
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

ll MAX_S = 100005;

int main(){
    ll N, C; cin >> N >> C;
    vector<vector<ll>> cums(C, vector<ll>(MAX_S, 0));
    rep(i, N){
        ll s, t, c; cin >> s >> t >> c;
        c--;
        cums[c][s] += 1;
        cums[c][t] += -1;
    }
    rep(i, C) rep(j, MAX_S - 1)
        cums[i][j + 1] += cums[i][j];

    rep(i, C) rep(j, MAX_S - 1)
        if(!cums[i][j] && cums[i][j + 1])
            cums[i][j] = 1;

    ll ans = 0;
    // debug2(cums);
    rep(i, MAX_S){
        ll jdm = 0;
        rep(j, C){
            jdm += cums[j][i];
        }
        chmax(ans, jdm);
    }
    pt(ans);
    return 0;
}

Measured memory_bytes: 27556
/*author : Yashvardhan
Saturday, April 04, 2020
5:29 PM
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))
#define printArr(name,from,to) for(int x = from; x < to; x++) cout << name[x] << " ";


#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << 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) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int a,b,c;
	cin >> a >> b >> c;
	swap(a,b);
	swap(a,c);

	cout << a << " " << b << " " << c << endl; 
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char ch[10000010];
bool flag;
int main ( )
{
    scanf("%s",ch);
    for(int i=0;i<strlen(ch);i++)
    {
        if(ch[i]=='C')flag=1;
        if(ch[i]=='F'&&flag)
            return puts("Yes")&0;
    }
    puts("No");
    return 0;
}

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

int main(){
    string S;
    cin >> S;
    int N = S.length();
    vector<int> RL;
    RL.reserve(100000);
    string old="R";
    int count = 1;
    for(int n=1; n<N; n++){
        string temp = S.substr(n,1);
        if(temp != old){
            RL.push_back(count);
            count = 1;
        }
        else{
            count ++;
        }
        old = temp;
    }
    RL.push_back(count);
    string res="";
    for(int n=0; n<RL.size(); n+=2){
        int R=RL[n];
        int L=RL[n+1];
        for(int r=0; r<R-1; r++){
            res += "0 ";
        }
        if((R-L) % 2 == 0){
            int num = (R+L)/2;
            res += to_string(num) + " " +to_string(num) + " ";
        }
        else{
            int big = (R+L+1)/2;
            int small = (R+L-1)/2;
            int max_num = max(R,L);
            if((max_num % 2 == 0 && max_num == R) || (max_num % 2 == 1 && max_num == L)){
                res += to_string(small) + " " + to_string(big) + " ";
            }
            else{
                res += to_string(big) + " " + to_string(small) + " ";
            }
        }
        for(int l=0; l<L-1; l++){
            res += "0 ";
        }
    }
    res.pop_back();
    cout << res << endl;
}


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

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

  int ans = 0;
  int flag = 0;
  for(int i = 1; i <= n; i += 2){
    flag = 0;
    for(int j = 1; j <= i; j += 2){
      if(i % j == 0){
        flag++;
      }
    }
    if(flag == 8){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 256
import sys
from collections import deque
from collections import  Counter
import statistics
import math

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

x = ni()
li = []
for b in range(1, 34):
    for p in range(2, 34):
        num = b ** p
        if num <= 1000:
            li.append(num)
list.sort(li, reverse=True)
for i in range(len(li)):
    if x >= li[i]:
        print(li[i])
        break

Measured memory_bytes: 5260