akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int, ii> iii;
typedef vector<pair<pair<int,int>,int>> viii;
typedef vector<pair<pair<ll,ll>,ll>> viiil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000
#define MOD 1000000007;

void solve() {
    int n;
    cin >> n;
    
    vi a(n);
    rep(i, n) cin >> a[i];
    
    int dp[n];
    rep(i, n) dp[i] = INF;
    dp[0] = 0;
    for (int i = 1 ; i < n ; i++) {
        dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
        if (i >= 2) {
            dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]));
        }
    }
    cout << dp[n - 1] << endl;
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        //solve();
    }
}

int main() {
    //querySolve();
    solve();

}


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

int A[100010];
int B[100010];

int main()
{
    int a, b, m, ma=99999999, mb=99999999;
    scanf("%d%d%d", &a, &b, &m);
    for(int i=1; i<=a; ++i){ scanf("%d", &A[i]); ma = min(ma, A[i]); }
    for(int i=1; i<=b; ++i){ scanf("%d", &B[i]); mb = min(mb, B[i]); }
    int ans = ma+mb;
    for(;m--;){
        int x, y, c;
        scanf("%d%d%d", &x, &y, &c);
        ans = min(ans, A[x]+B[y]-c);
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1024
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

#define FOR(t,x,v) for(t x=0, v_=(v);x < v_; x++)
#define FORR(t,x,v) for(t x=(v); x >= 0; x--)

int main() {
    int N, K, L[50];
    cin >> N >> K;
    FOR(int,x,N) cin >> L[x];
    sort(L, L+N); reverse(L, L+N);
    int ans = 0;
    FOR(int,x,K) ans += L[x];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a, b, c;
	for(int i =0;i<n;i++)
	{
		int fir, sec, tir;
		cin>>fir>>sec>>tir;
		a.push_back(fir);
		b.push_back(sec);
		c.push_back(tir);
	}
	int dp[n+1][3];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	for(int i = 1;i<n;i++)
	{
		dp[i][0] = max(dp[i-1][1] + a[i], dp[i-1][2] + a[i]);
		dp[i][1] = max(dp[i-1][0] + b[i], dp[i-1][2] + b[i]);
		dp[i][2] = max(dp[i-1][1] + c[i], dp[i-1][0] + c[i]);
	}
	
	cout<<max(dp[n-1][0],max(dp[n-1][1], dp[n-1][2]));
	return 0;
}

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

int N;
int a[2][100];

int main(){
  cin>>N;
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      cin>>a[i][j];
    }
  }
  int kotae = 0; // 全体の答え(最大値)
  for(int x=0;x<N;x++){
    int candies = 0; // 左からx列目で下に動いた時のキャンディの数
    int gyou = 0; // 何行目にいるか
    for(int j=0;j<N;j++){
      candies += a[gyou][j];
      if(j==x){
        gyou = 1;
        candies += a[gyou][j];
      }
    }
    if(candies > kotae){
      kotae = candies;
    }
  }
  printf("%d\n", kotae);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,P;
	ll w[100001],b[100001];
	ll score=0;
	ll x[100001];
	scan(N);scan(P);
	rep(i,N){
		scan(w[i]);scan(b[i]);
		score-=b[i]*P;
		x[i]=w[i]*(100-P)+b[i]*P;
	}
	sort(x,x+N,greater<ll>());
	rep(i,N){
		score+=x[i];
		if(score>=0){
			prin(i+1);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];

    int ans = 0;
    for(int i = 0; i < n; i++){
        while(h[i] != 0){
            for(int j = i; h[j] != 0 && j != n; j++){
                h[j]--;
            }
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 384
/******************
 *AUTHOR: speckrel*
 ******************/
 
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long
 
//Function to read int array
void read(ll arr[], ll n){
    for(ll i=0;i<n;i++){
        cin>>arr[i];
    }
}
 
void solve(){
    static int i=1;
    //cout<<"This is a test code "<<i<<"\n";
    i++;
}

struct point{
  ll x;
  ll y;
};

double dist(struct point a){
  double dist = (a.x)*(a.x) + (a.y)*(a.y);
  dist = sqrt(dist);
  return dist;
}

bool close(struct point a, ll d){
  if(dist(a)<=d)
    return 1;
  else
    return 0;
}
 
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  ll n,d;
  cin>>n>>d;
  struct point arr[n];
  for(int i=0;i<n;i++){
    cin>>arr[i].x>>arr[i].y;
  }
  ll count = 0;
  for(int i=0;i<n;i++){
    if(close(arr[i],d)){
      ++count;
    }
      //cout<<dist(arr[i]);
  }
  cout<<count;
    return 0;
}

Measured memory_bytes: 6820
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<functional>

using namespace std;

int main(){
  	int f(0),o(0);
	string a;
  	cin >> a;
  	for(int i = 0 ; i < a.length() ; i ++){
    	if(i % 2 == 0){
          if(a[i] != '1') f ++; else o ++;
        } else {
        	if(a[i] != '1') o ++; else f ++;
        }
    }
  	cout << min(f,o) << endl;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

const int NIL = -1;
const int MAX_N = 50;
vector<ll> fib(MAX_N);

int fibonach(vector<ll> &fib, int i){
    if(i == 0) return fib[0];
    if(i == 1) return fib[1];
    if(fib[i] != NIL) return fib[i];
    fib[i] = fibonach(fib, i-1) + fibonach(fib, i-2);
    return fib[i];
}

int main()
{
    int n; cin >> n;
    rep(i, MAX_N) fib[i] = NIL;
    fib[0] = 1;
    fib[1] = 1;
    ll res = fibonach(fib, n);
    cout << res << endl;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <map>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <utility>
#include <bitset>
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,a,b) for (int i=(a);i<=(b);i++)
#define PER(i,a,b) for (int i=(b);i>=(a);i--)
#define de(x) cout<<">> "<<#x<<" = "<<x<<endl;
using namespace std;
typedef long long LL;

const int INF = 0x3f3f3f3f;
const int MAXN = 1000005; // 1e6;
LL a[MAXN];
int main()
{
	// freopen("in.txt","r",stdin);
	a[0]=2, a[1]=1;
	rep(i,2,MAXN) a[i]=a[i-1]+a[i-2];
	int n; cin>>n;
	cout<<a[n]<<endl;
	return 0;
}



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

typedef long long ll;
typedef long double ld;
const ll M=1e9+7;
const ll MAXN=1e6+7;
const ld pi=acos(-1);

#define gi(n) ll n=read()
#define endl '\n'
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define per(i,a,b) for(ll i=b-1; i>=a; --i)

typedef vector<ll> V;
typedef vector<V> VV;
typedef set<ll> S;
typedef pair<ll,ll> pl;
typedef vector<pl> Vp;

#define all(v) v.begin(),v.end()
#define pb push_back
#define fs first
#define sc second

inline ll read(){
	ll x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll mul(ll a,ll b,ll P){return b?(mul(a*2%P,b>>1,P)+(b&1?a:0))%P:0;}
ll pow1(ll p,ll d, ll P){return d?mul(pow1(mul(p,p,P),d>>1,P),(d&1?p%P:1),P):1;}

V prime;
bool is_composite[MAXN];
void sieve (ll n){
	std::fill (is_composite, is_composite + n, false);
	rep(i,2,n){
		if(!is_composite[i]) prime.pb(i);
		for(ll j = 0; j < prime.size() && i*prime[j] < n; ++j){
			is_composite[i*prime[j]] = true;
			if(i % prime[j] == 0) break;
		}
	}
}
ll modInverse(ll a, ll m){
	ll m0=m,y=0,x=1;
	if(m==1) return 0;
	while(a>1){
		ll q=a/m,t=m;
		m=a%m;
		a=t; 
		t=y;

		y = x-q*y; 
		x = t;
	}
	if(x<0) x += m0;
	return x; 
}

void doit(){
	gi(n);
	ll a[n];
	rep(i,0,n) a[i]=read();
	sort(a,a+n);
	ll s=a[n-1];
	per(i,n-(n-2)/2-1,n-1) s+=2*a[i];
	if(n&1) s+=a[n-(n-2)/2-2];
	cout<<s;
}
int main(){
	//for(gi(t);t--;cout<<endl)
		doit();
	return 0;
}

Measured memory_bytes: 5160
#include <stdio.h>
#include <math.h>

#define DEBUG

#ifndef DEBUG 
#define fprintf (void)
#endif 

int main(void){
	
	int i,rec;
	int high[3]={0,0,0};
	
	for(i=0;i<10;i++){
		scanf("%d",&rec);
		if(rec>=high[0]){
			high[2]=high[1];
			high[1]=high[0];
			high[0]=rec;
		}else if(rec>=high[1]){
			high[2]=high[1];
			high[1]=rec;
		}else if(rec>=high[2]){
			high[2]=rec;
		}
	}
	
	for(i=0;i<3;i++){
		printf("%d\n",high[i]);
	}
	
	return 0;
}

Measured memory_bytes: 2720
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000000000000

int main() {
  long long a, b;
  scanf("%lld %lld", &a, &b);
  if ((a*b*1)%2 == 1 || (a*b*2)%2 == 1 || (a*b*3)%2 == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include<bits/stdc++.h>
const int M=1e5+5;
const int N=2e5+2;
long long i,j,s=0,n,b[55];
char a[55][105],ch[105];
using namespace std;
int main()
{
    cin >> n;
    for(i = 0;i < n; i++){
        cin >> a[i] >> b[i];
    }
    cin >> ch;
    for(i = 0;i < n; i++){
        if(strcmp(ch,a[i])==0) break;
    }
    for(;i < n-1 ;i++){
        s=s+b[i+1];
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 100010
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 1000000007
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return (ans.x+m)%m;
}
int fact[N];
int calc(int n , int r){
 if(r > n)return 0;
 if(r == n)return 1;
 int ans = 1;
 ans = ((ans%mod)*(fact[n])%mod + mod)%mod;
 ans = ((ans%mod)*(mmInverse(fact[n-r] , mod)%mod) + mod)%mod;
 ans = ((ans%mod)*(mmInverse(fact[r] , mod)%mod) + mod)%mod;
 return (ans+mod)%mod;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n , k;
cin>>n>>k;
int arr[n];
fact[0] = 1;
for(int i = 1 ; i <= n+2; i++){
 fact[i] = (((fact[i-1]%mod)*(i%mod))%mod + mod)%mod;
}
for(int i = 0 ; i  < n; i++){
 cin>>arr[i];
}
sort(arr , arr+n);
int fin = 0;
for(int i = 0 ; i  < n; i++){
     int ans = ((arr[i]%mod)*(calc(i , k-1)%mod) + mod)%mod;
     int ans2 = ((arr[i]%mod)*(calc(n-i-1 , k-1)%mod) + mod)%mod;
     ans = ((ans%mod) - (ans2%mod) + mod)%mod;
     fin  = (fin%mod + ans%mod + mod)%mod;
}
cout<<(fin+mod)%mod<<endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>

int color[9];

int main()
{
    int N; std::cin >> N;
    for (int i = 0; i < N; i++)
    {
        int temp;
        std::cin >> temp;
        for (int j = 1; j < 9; j++)
        {
            int disc = j * 400;
            if (temp - disc < 0)
            {
                color[j-1]++;
                break;
            } else if (temp >= 3200)
            {
                color[8]++;
                break;
            }
        }
    }

    int kind = 0;
    for (int i = 0; i < 8; i++)
    {
        if (color[i] > 0) kind++;
    }

    if (kind != 0)
        std::cout << kind << " " << kind + color[8] << std::endl;
    else
        std::cout << 1 << " " << kind + color[8] << std::endl;
    
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    long H[] =new long[N];
    H[0]=sc.nextLong();
    int t=0;
    int ans =0;
    for(int i=1;i<N;i++){
      H[i]=sc.nextLong();
      if(H[i-1]>=H[i]){t=t+1;}
      else{t=0;}
      ans =Math.max(ans,t);}
    System.out.println(ans);
  }
}

Measured memory_bytes: 60256
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import bisect
import math
import fractions
import sys
import copy


def L(): return sys.stdin.readline().split()


def I(): return int(sys.stdin.readline().rstrip())


def S(): return list(sys.stdin.readline().rstrip())


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def IR(n): return [I() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def LIR1(n): return [LI1() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def LR(n): return [L() for _ in range(n)]


alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007


def main():
    N = I()
    print("Yes" if N >= 30 else "No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 72532
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  cout << n*n*n << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut scan = Scanner::new(cin);

    let k = scan.read::<i64>();
    let a = scan.read::<i64>();
    let b = scan.read::<i64>();
    if a+1<b {
        let mut cnt = k;
        cnt -= a-1;
        if cnt <= 0 {
            println!("{}", 1+k);
        } else {
            println!("{}", cnt / 2 * (b - a) + a + (cnt % 2));
        }
    } else {
        println!("{}", 1 + k);
    }
}

// region template
#[allow(dead_code)]
fn uz(i: i32) -> usize { i as usize }

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read_opt<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read_opt().unwrap()
    }
}
// endregion


Measured memory_bytes: 4352
n = int(input())

def t(n):
    div = n
    cnt = 0
    while True:
        div, mod = divmod(div, 2)
        if mod == 0:
            cnt += 1
        else:
            return cnt

ans = 1
maxt = 0
for i in range(1, n+1):
    tt = t(i)
    if maxt < tt:
        maxt = tt
        ans = i
print(ans)  


Measured memory_bytes: 3060
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
int n,l,a[100001];
int main()
{
	re(n),re(l);
	for(int i=1;i<=n;++i)re(a[i]);
	for(int i=1;i<n;++i)
		if(a[i]+a[i+1]>=l)
		{
			puts("Possible");
			for(int j=1;j<i;++j)printf("%d\n",j);
			for(int j=n-1;j>i;--j)printf("%d\n",j);
			printf("%d\n",i);
			return 0;
		}
	puts("Impossible");
}

Measured memory_bytes: 1152
fun main(args: Array<String>) {
    keyence2019c()
}

fun keyence2019c() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toLong() }
    val bList = readLine()!!.split(" ").map { it.toLong() }

    val diffs = aList.withIndex().map { it.value - bList[it.index] }.sortedDescending()

    if (diffs.sum() < 0) return println(-1)

    val negativeDiffs = diffs.filter { it < 0 }

    var negativeDiffSum = negativeDiffs.sum()
    var needChangePositives = 0
    while (negativeDiffSum < 0) {
        negativeDiffSum += diffs[needChangePositives++]
    }

    val answer = negativeDiffs.size + needChangePositives

    println(answer)
}


Measured memory_bytes: 85256
import fractions
n,x = map(int,input().split())
l = list(map(int,input().split()))
l.append(x)
l.sort()
sa = []
for i in range(n):
    sa.append(l[i+1]-l[i])

ans = sa[0]
for i in range(1,n):
    ans = fractions.gcd(ans,sa[i])
print(ans)

Measured memory_bytes: 16244
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use std::collections::HashSet;
use std::cmp::max;
// use std::cmp::min;


fn main() {
    input! {
        N: usize,
    }

    let mut XYs: Vec<Vec<(usize, i64)>> = vec![Vec::new(); N];

    for n in 0..N {
        input! {
            A: usize,
            mut tmpXYs: [(usize, i64); A],
        }

        // 0-origin
        for tpl_ref in tmpXYs.iter_mut() {
            tpl_ref.0 -= 1;
        }

        XYs[n].extend_from_slice(&tmpXYs);
    }



    // N<=15なので、2^15のビット全探索でいけそう
    // 正直者である人たちの集合を全探索
    // https://qiita.com/Cassin01/items/246e795d0d9003c64d0f
    let mut ans = 0;
    for i in 0..1 << N {
        let mut cand = 0;

        // 正直者によって得られた証言セット
        let mut map: HashMap<usize, i64> = HashMap::new();

        let mut is_ok = true;
        let mut honest_set: HashSet<usize> = HashSet::new();

        // 証言記録フェーズ
        for j in 0..N {
            if (1 << j) & i == 0 {
                cand += 1;
                honest_set.insert(j);

                for &(x, y) in XYs[j].iter() {
                    match map.get(&x) {
                        Some(&val) => {
                            if val != y {
                                is_ok = false;
                                break;
                            }
                        }
                        None => {
                            map.insert(x, y);
                        }
                    }
                }
            }
        }

        if !is_ok {
            eprintln!("NG ptn1: {:?}", honest_set);
            continue;
        }

        // 証言の中で言及された正直者/不親切が実際にそうなのか確認フェーズ
        for j in 0..N {
            let j_is_honest = (1 << j) & i == 0;
            let honest_val = if j_is_honest { 1 } else { 0 };

            match map.get(&j) {
                Some(&val) => {
                    if val == honest_val {
                        // ok
                    } else {
                        is_ok = false;
                    }
                }
                None => {
                    // ok
                }
            }
        }

        if is_ok {
            ans = max(ans, cand);
        } else {
            eprintln!("NG ptn2: {:?}", honest_set);
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2220
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 998244353

class BIT2:
    def __init__(self, N):
        self.N = (N+1)
        self.data0 = [0] * (N+1)
        self.data1 = [0] * (N+1)
        
    def _add(self, data, k, x):
        while k < self.N: #k <= Nと同義
            data[k] += x
            k += k & -k

    def _sum(self, data, k):
        s = 0
        while k:
            s += data[k]
            k -= k & -k
        return s

    def add(self, l, r, x):
        self._add(self.data0, l, -x*(l-1))
        self._add(self.data0, r, x*(r-1))
        self._add(self.data1, l, x)
        self._add(self.data1, r, -x)

    def sum(self, l, r):
        return self._sum(self.data1, r-1) * (r-1) + self._sum(self.data0, r-1) \
                - self._sum(self.data1, l-1) * (l-1) - self._sum(self.data0, l-1) #改行

N, Q = map(int, readline().split())
bit1 = BIT2(N)
bit1.add(1,N+1,N-2)
bit2 = BIT2(N)
bit2.add(1,N+1,N-2)
total = (N-2)**2

right = N
low = N
cnt = 0
for _ in range(Q):
    cmd,t = map(int,readline().split())
    if cmd == 1:
        tmp = bit1.sum(t,t+1)
        cnt += tmp
        bit1.add(t,t+1,-tmp)
        if t < right:
            bit2.add(1,low,t-right) 
            right = t
    else:
        tmp = bit2.sum(t,t+1)
        cnt += tmp
        bit2.add(t,t+1,-tmp)
        if t < low:
            bit1.add(1,right,t-low)  
            low = t

ans = total - cnt
print(ans) 

Measured memory_bytes: 83252
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MAX = 1e5;
const ll inf = 1e15;
vector<vector<ll>> g(MAX+5);
ll in_degree[MAX+5];
bool vis[MAX+5];
ll dist[MAX+5];
void dfs( ll a ){
	assert( !vis[a] );
	vis[a] = true;
	for( auto b : g[a] ){
		dist[b] = max( dist[b], dist[a]+1LL );
		--in_degree[b];
		if( in_degree[b] == 0 )
			dfs( b );
	}
}
signed main(){
	ll n, m, i, j, x, y;
	cin >> n >> m;
	for( i = 1 ; i <= m ; i++ ){
		cin >> x >> y;
		g[x].push_back( y );
		++in_degree[y];
	}
	for( i = 1 ; i <= n; i++){
		if( !vis[i] && in_degree[i] == 0 ){
			dfs( i );
		}
	}
	ll ans = 0;
	for( i = 1 ; i <= n ; i++ )
		ans = max( ans, dist[i] );
	cout << ans << endl;
	return 0;
}

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

const int mod = 1e9 + 7;
const int MN = 3010;

int exp(int x, int n) {
    int ret = 1;
    while(n) {
        if(n & 1) ret = 1LL * ret * x % mod;
        x = 1LL * x * x % mod;
        n >>= 1;
    }
    return ret;
}
int inv(int x) {
    return exp(x, mod - 2);
}

const int p = inv(2);

int N, Q;
int A[MN], X[MN], Y[MN], dp[MN][MN];

int main() {
    scanf("%d %d", &N, &Q);

    for(int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    for(int i = 0; i < Q; i++) {
        scanf("%d %d", &X[i], &Y[i]);
        X[i]--; Y[i]--;
    }

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            dp[i][j] = A[i] > A[j];
        }
    }
    for(int i = 0; i < Q; i++) {
        for(int j = 0; j < N; j++) {
            if(j == X[i] || j == Y[i]) continue;

            int t = 1LL * p * (dp[ X[i] ][j] + dp[ Y[i] ][j]) % mod;
            dp[ X[i] ][j] = dp[ Y[i] ][j] = t;

            t = 1LL * p * (dp[j][ X[i] ] + dp[j][ Y[i] ]) % mod;
            dp[j][ X[i] ] = dp[j][ Y[i] ] = t;
        }
        int t = 1LL * p * (dp[ X[i] ][ Y[i] ] + dp[ Y[i] ][ X[i] ]) % mod;
        dp[ X[i] ][ Y[i] ] = dp[ Y[i] ][ X[i] ] = t;
    }

    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            ans += dp[i][j];
            ans %= mod;
        }
    }
    ans = 1LL * ans * exp(2, Q) % mod;
    printf("%d", ans);
}


Measured memory_bytes: 35584
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    int N;
    void calc()
    {
        cin = new Scanner();
        N = cin.nextInt();
        int[] mul = new int[101];
        for (int i = 1; i <= N; i++)
        {
            int tmp = i;
            for (int j = 2; j <= N; j++)
            {
                while (tmp % j == 0)
                {
                    mul[j]++;
                    tmp /= j;
                }
            }
        }

        int MAX = 80;
        long[] dp = new long[MAX];
        dp[1] = 1;
        for (int i = 2; i < 100; i++)
        {
            for (int j = MAX - 1; j >= 0; j--)
            {
                //この素因数をk個使うと、約数が(k+1)倍になる
                for (int k = 1; k <= mul[i]; k++)
                {
                    int next = j * (k + 1);
                    if (next >= MAX) break;
                    dp[next] += dp[j];
                }
            }

        }
        Console.WriteLine(dp[75]);
    }
    
    
}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}



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

int main() {
	int n;cin>>n;
	int q[n];
	int flag=0;
	for(int i=0;i<n;i++)q[i]=0;
	vector<int> v;
	int ans=0;
	v.push_back(0);
	while(1){
		ans++;
		vector<int> v2;
		while(v.empty()==0){
			int num=v.back();
			v.pop_back();
			int num2;
			int numa[12]={1,6,9,36,81,216,729,6*6*6*6,9*9*9*9,6*6*6*6*6,9*9*9*9*9,6*6*6*6*6*6};
			for(int i=0;i<12;i++){
				num2=num+numa[i];
				if(num2<n){
				if(q[num2]==0){
					q[num2]=1;
					v2.push_back(num2);
				}
				}
				if(num2==n)flag=1;
			}
		}

		v=v2;
		while(v2.empty()==0){
//			cout<<v2.back()<<' ';
			v2.pop_back();
		}
//		cout<<endl;
		if(flag)break;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 912
N=int(input())
L=[]
s,e,s1,e1,t=0,0,0,0,0
for i in range(N):
  L.append(int(input()))
s=L.index(max(L))
e=L[s]
L[s]=0
s1=L.index(max(L))
e1=L[s1]
for i in range(N):
  if i!=s:
    print(e)
  else:
    print(e1)

Measured memory_bytes: 12532
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


int cal[8][3]={
	{0,0,0},
	{0,0,255},
	{0,255,0},
	{0,255,255},
	{255,0,0},
	{255,0,255},
	{255,255,0},
	{255,255,255}
};

string t[8]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};

int c[3];

double d(int i){
	double ret=0.0;
	for(int j=0; j<3; j++){
		ret+=(cal[i][j]-c[j])*(cal[i][j]-c[j]);
	}
	return sqrt(ret);
}

int change(char c){
	if(c>='0'&&c<='9')return c-'0';
	return 10+c-'a';
}

int main(){
	string s;
	int ans;
	while(cin>>s){
		if(s=="0")break;
		for(int i=0; i<3; i++){
			c[i]=change(s[i*2+1])*16+change(s[i*2+2]);
		}
		//cout<<c[0]<<" "<<c[1]<<" "<<c[2]<<endl;
		ans=0;
		for(int i=1; i<8; i++){
			if(d(ans)>d(i))ans=i;
		}
		cout<<t[ans]<<endl;
	}
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;
using ll=long long;
int main(){//WA
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    for(int i=0;i<n;++i){
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<ll>());
    ll sum=0;
    for(int i=0;i<a;++i){
        sum+=v[i];
    }
    cout << setprecision(20) << fixed << sum/(double)a << endl;
    int num=0;
    for(int i=0;i<n && v[i]>=v[a-1];++i){
        if(v[i]==v[a-1])
            ++num;
    }
    int m;
    for(int i=0;i<n;++i){
        if(v[i]==v[a-1]){
            m=a-i;
            break;
        }
    }
    vector<vector<ll>> comb(n+1, vector<ll>(n+1, 0));
    for(int i=1;i<=n;++i){
        comb[i][0]=1, comb[i][i]=1;
        for(int j=1;j<i;++j){
            comb[i][j]=comb[i-1][j]+comb[i-1][j-1];
        }
    }
    if(v[0]==v[a-1]){
        int e = min(b-a+m, num);
        ll ans=0;
        for(int i=m;i<=e;++i){
            ans+=comb[num][i];
        }
        cout << ans;
    }else{
        cout << comb[num][m];
    }

    return 0;
}

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

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    rep(i, m) cin >> b[i];

    int ans = 0;
    rep(i, n) {
        int a[m];
        rep(j, m) cin >> a[j];
        int s = c;
        rep(j, m) s += a[j]*b[j];
        if (s > 0) ans++;
    }

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


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int a, b, c, d1, d2, d3;
	cin>> a >> b >> c;

	d1=abs(a-b);
	d2=abs(a-c);
	d3=abs(b-c);

	cout<< min(min(d1+d2, d1+d3), d2+d3) << endl;
 
	return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <math.h>
#include <map>
#include <set>
#include <string>
using namespace std;
#define fio ios::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;

const int INT_INF = 1e9;
const ll LL_INF = 1e18;
const int MAXN = 500003;

typedef struct GE{
    int to;
    ll w;
    GE(){};
}GE;

int n, m;
int cnt[300];
int main() {
    char s[10];
    scanf("%s", s);
    int ans=0;
    for(int i=0;i<4;i++){
    	if(cnt[s[i]]==0){
    		ans++;
    		cnt[s[i]]++;
    	}
    }

    if(ans==2) {
    	puts("Yes");
    }
    else
    	puts("No");
    
    
    return 0;
}

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


void solve(long long N, long long X, long long T){
    long long l = std::floor(N / X);
    if(N % X > 0) {
        ++l;
    }

    cout << l * T << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long T;
    scanf("%lld",&T);
    solve(N, X, T);
    return 0;
}


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

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
typedef long long int ll;
typedef long double ld;

const int NMax = 1e5 + 50;

int A[NMax];
int B[NMax];
int C[NMax];

int Bin(const int v[], int hi, const int &val) {
	int lo = 1;

	int best = 0;
	while(lo <= hi) {
		int mid = (lo + hi) >> 1;

		if(v[mid] < val) {
			best = mid;
			lo = mid + 1;
		} else {
			hi = mid - 1;
		}
	}

	return best;
}

int main() {
	Boost();

	int n;
	cin >> n;

	for(int i = 1; i <= n; ++i) cin >> A[i];
	for(int i = 1; i <= n; ++i) cin >> B[i];
	for(int i = 1; i <= n; ++i) cin >> C[i];

	sort(A + 1, A + n + 1);
	sort(B + 1, B + n + 1);
	sort(C + 1, C + n + 1);

	ll ans = 0;
	for(int i = 1; i <= n; ++i) {
		ans += 1LL * Bin(A, n, B[i]) * (n - Bin(C, n, B[i] + 1));
	}	

	cout << ans;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> vals;
int n,t,dp[3001][3001];

int ans(int curr , int tim){
    if(curr == n || tim >= t){
        return 0;
    }
    if(dp[curr][tim] != -1){
        return dp[curr][tim];
    }
    int ret = max(ans(curr+1,tim),vals[curr].second+ans(curr+1,tim+vals[curr].first));
    return dp[curr][tim] = ret;
}

int main(){
    memset(dp,-1,sizeof dp);
    cin >> n >> t;
    vals.resize(n);
    for(int i = 0 ; i < n ; i += 1){
        cin >> vals[i].first >> vals[i].second;
    }
    sort(vals.begin(),vals.end());
    cout << ans(0,0);
}

Measured memory_bytes: 35584
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;

int main()
{
 int k;
 string s="";
 scanf("%d",&k);
 for(int i=0;i<k;i++)
 {
	s+="ACL";
 }
 cout<<s<<endl;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

int main(){
fastio();

    vector<char>v,ans;
    for(int i='a';i<='z';i++) v.pb(i);


     ll n;
     cin>>n;
    // cout<<n/26<<" "<<n%26<<endl;

     while(n)
     {
         int temp=(n-1)%26;
         ans.pb(v[temp]);
         n=(n-1)/26;
     }
     rev(ans);
     for(auto u:ans) cout<<u;







return 0;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef double db;

const ll mod = 1e9+7;
const db eps = 1e-9;

#define mp make_pair
#define pb push_back
#define endl "\n"
#define deb(x) cout << #x << " " << x << endl

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

        ll a,b,c;
        cin >> a >> b >> c;
        swap(a,b);
        swap(a,c);
        cout << a << " " << b << " " << c;
    

    return 0;
} 

Measured memory_bytes: 256
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

mod = 10**9+7

pl = 0
zr = 0
mn = 0

a.sort()

for i in range(n):
    if a[i] == 0:
        zr += 1
    elif a[i] > 0:
        pl += 1
    elif a[i] < 0:
        mn += 1

hugo = 0

#tmp = k-pl
        
if zr == 0 and pl == 0 and k % 2 == 1:
    hugo = 3#mn
elif zr >= 1 and pl == 0 and k % 2 == 1:
    hugo = 2#zr
else:
    hugo = 1#pl

ans = 1
tmp_ans = 1
    
if hugo == 3:
    for i in range(k):
        ans *= a[mn-1-i]
        ans %= mod
    print(ans%mod)
elif hugo == 2:
    print(0)
else:
    if mn == 0:
        for i in range(k):
            tmp_ans *= a[n-1-i]
            tmp_ans %= mod
        print(tmp_ans)
    else:
        tmp = k
        pl_num = 0
        mn_num = 0
        if tmp % 2 == 1:
            tmp -= 1
            pl_num += 1
            tmp_ans = a[n-1]
        while tmp > 0:
            if tmp >= 2:
                tmp -= 2
                tmp_p_seki = 0
                tmp_m_seki = 0
                if pl_num+1 <= pl:
                    tmp_p_seki = a[n-1-pl_num]*a[n-1-pl_num-1]
                if mn_num+1 <= mn:
                    tmp_m_seki = a[mn_num+0]*a[mn_num+1]
                if tmp_p_seki > tmp_m_seki:
                    tmp_seki = tmp_p_seki
                    pl_num += 2
                elif tmp_p_seki == 0 and tmp_m_seki == 0:
                    tmp_seki = 0
                else:
                    tmp_seki = tmp_m_seki
                    mn_num += 2
            #elif tmp == 1:
            #    tmp_seki = a[n-1-pl_num]
            #    tmp -= 1
            tmp_ans *= tmp_seki
            tmp_ans %= mod
                    
            
        print(tmp_ans%mod)

Measured memory_bytes: 105348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define popcount(x) __builtin_popcount(x)
#define fast ios_base::sync_with_stdio(false) , cin.tie(0) ;
#define w(x) cout << (#x) << " is " << x << "\n" ;
const char nl = '\n';

int main()
{
    fast ;
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int n,t,x,y;
    map<string,int>m;
    string s;
    cin >> t;
    while(t--)
    {
        cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << nl;
    cout << "WA x " << m["WA"] << nl;
    cout << "TLE x " <<m["TLE"]<< nl;
    cout << "RE x " << m["RE"] << nl;

    return 0;


}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

const double pi = 3.141592653589793;
// -------------------------------------------------------

int N, K;
map<int, int> mp;

int main() {
  cin >> N >> K;
  rep(i, 0, N) {
    int a;
    cin >> a;
    mp[a]++;
  }

  vector<pair<int, int>> v;
  for (auto e : mp) {
    v.push_back(make_pair(e.second, e.first));
  }
  sort(v.begin(), v.end());

  int diff = v.size() - K;
  if (diff <= 0) {
    cout << 0;
    return 0;
  }

  int ans = 0;
  rep(i, 0, diff) { ans += v[i].first; }

  cout << ans << endl;
}

Measured memory_bytes: 11768
import sys
input = sys.stdin.readline
import heapq


def read():
    N = int(input().strip())
    P = []
    for i in range(N):
        p = int(input().strip())
        P.append(p)
    return N, P


def solve(N, P):
    Q = [0 for i in range(N)]
    for i in range(N):
        Q[P[i]-1] = i
    max_count = 0
    count = 0
    prev = -1
    for i in range(N):
        q = Q[i]
        if prev < q:
            count += 1
            prev = q
        else:
            max_count = max(max_count, count)
            count = 1
            prev = q
    max_count = max(max_count, count)
    return N - max_count


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 24784
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <functional>
#include <cmath>

using namespace std;
using ll = long long;

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

	int res = (1 << 29);
	for (int start = 0; start <= 1; ++start)
	{
		int val = start;
		int count = 0;
		for (int i = 0; i < s.size(); ++i)
		{
			if (s[i] - '0' != val) ++count;

			val = 1 - val;
		}
		res = min(res, count);
	}
	cout << res << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string.h>

using namespace std;

int main(){

  char record[101];
  int count;
  int play_a;
  int play_b;
  int n;

  while(cin >> record){
    
    if(record[0]=='0')
      break;

    n = strlen(record);
      
    count=0;
    play_a=0;
    play_b=0;
    
    for(int i=1; i<n; i++){
      if(record[i]=='A'){
	play_a++;
      } else {
	play_b++;
      }
    }
    
    if(play_a>play_b){
      play_a++;
    } else {
      play_b++;
    }
    
    cout << play_a << " " << play_b << endl;
  }
}


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

int main()
{
	int bin[101];
	for (int i = 0; i < 101; i++)bin[i] = 0;
	int n;
	while (cin >> n)bin[n]++;
	int ans = 0;
	for (int i = 0; i < 101; i++)
	{
		ans = max(ans, bin[i]);
	}
	for (int i = 0; i < 101; i++)
	{
		if (bin[i] == ans)
		{
			cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
import Data.List
main = do
  [a,b,k] <- map read . words <$> getLine
  putStrLn $ unlines $ f a b k

f p q r
  | q-p >= 2*r = map show ([p..(p+r-1)]++[(q-r+1)..q])
  | otherwise = map show $ filter (\x -> x<p+r || x>q-r) [p..q]


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, K;
    cin >> H >> W >> K;
    K--;

    if (W == 1) {
        cout << 1 << endl;
        return 0;
    }
    
    vector< vector<int> > vs;
    for (int i = 0; i < (1 << (W - 1)); i++) {
        vector<int> v(W);
        for (int j = 0; j < W; j++) v[j] = j;
        
        bool flag = true;
        for (int j = 0; j < W - 1; j++) {
            if ((i & (1 << j)) == 0) continue;
            if (i & (1 << (j + 1))) {
                flag = false;
                break;
            }
            swap(v[j], v[j + 1]);
        }

        if (!flag) continue;

        vs.push_back(v);
    }
    
    vector<ll> dp(W, 0);
    dp[0] = 1;

    for (int i = 0; i < H; i++) {
        vector<ll> ndp(W, 0);
        for (vector<int>& v : vs) {
            for (int j = 0; j < W; j++) {
                (ndp[v[j]] += dp[j]) %= MOD;
            }
        }

        dp = move(ndp);
    }
    cout << dp[K] << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
s = input()
q = int(input())
ans = deque(s)
rev = 0
for i in range(q):
    qi = input()
    if qi[0] == '1':
        rev += 1
    else:
        if (int(qi[2]) + rev%2) % 2:
            ans.appendleft(qi[4])
        else:
            ans.append(qi[4])

if rev % 2:
    ans.reverse()
for i in ans:
    print(i, end='')

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

using namespace std;

int div_ct(int n)
{
    int c = 0;
    int k;
    for (k = 1; k <= n; k++)
    {
        if (n % k == 0)
        {
            c++;
        }
    }
    return c;
}

int main()
{
    int N, Sum = 0;
    cin >> N;

    for (int i = 1; i <= N; i++)
    {
        if (i % 2 != 0)
        {
            if (div_ct(i) == 8)
            {
                Sum++;
            }
        }
    }

    cout << Sum;
}

Measured memory_bytes: 256