akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
using T = pair<double, int>;
int main() {
    init();

    int n;
    while (1) {
        cin >> n;
        if (n == 0)break;
        
        int y;
        cin >> y;
        vector<T> ans;
        FOR(i, 0, n) {
            int b, t; double r;
            cin >> b >> r >> t;
            double num;
            if (t == 1)num = 1 + y * r / 100;
            else num = pow(1 + r / 100, y);
            ans.push_back({ num,b });
        }

        rSORT(ans, greater<T>());
        cout << ans[0].second << "\n";
    }
}



Measured memory_bytes: 3568
program Project1;
     
{$APPTYPE CONSOLE}
     
uses
  SysUtils;
var
  a,h,w,i,j,count,count2,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  al:string = 'abcdefghijklmnopqrstuvwxyz';
  tf,tfl,tfr:Boolean;
begin
  try
    { TODO -oUser -cConsole メイン : ここにコードを記述してください }
    Readln(a);
    sum:=0;
    for I := 0 to a - 1 do begin
      Read(b);
      sum:=sum+b;
    end;

    Writeln(sum-a);
    Readln;
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
# B - Counting Roads
def main():
    import collections


    n, m = map(int, input().split())
    cnt = []

    for _ in range(m):
        temp = list(input().split())
        cnt += temp
    else:
        ans = collections.Counter(cnt)
        for i in range(1, n+1):
            print(ans[str(i)])


if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, d;
    cin >> n >> d;
    int x, y, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        if (sqr(x) + sqr(y) <= d * d) {
            ++ans;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std; 

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

typedef long long ll;

int main()
{
    int k,x;
    cin >>k>>x;
    if(k*500 < x)
    cout<<"No";
   
    else
    cout << "Yes";
    return 0;
}



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

int main() {
    string S;
    cin >> S;
    string T, U;
    rep(i, S.size()) {
        if (i % 2 == 0) {
            T += '0';
            U += '1';
        } else {
            U += '0';
            T += '1';
        }
    }
    int tmp1 = 0;
    int tmp2 = 0;
    rep(i, S.size()) {
        if (S[i] != T[i]) tmp1 += 1;
        if (S[i] != U[i]) tmp2 += 1;
    }
    cout << min(tmp1, tmp2) << endl;
    return 0;
}

Measured memory_bytes: 768
//★#1014918 Solution for 0557: A First Grader by daiota
#include<iostream>
using namespace std;
 
int a[101];
long long dp[101][21];
int main(){
	int i,j;
	int N;
	cin >> N;
	for(i=0; i<=100; i++){for(j=0; j<=20; j++){dp[i][j] = 0;}}
	for(i=1; i<=N; i++) {cin >> a[i];}
	dp[1][a[1]] = 1;
	for(i=2; i<N; i++){
		for(j=0; j<=20; j++){
			if(j-a[i] >=  0) dp[i][j] += dp[i-1][j-a[i]];
			if(j+a[i] <= 20) dp[i][j] += dp[i-1][j+a[i]];
		}
	}
	cout << dp[N-1][a[N]] << endl;
	return 0;
}



Measured memory_bytes: 3080
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        //int あ = 10;
         Scanner scan = new Scanner(System.in);
 
        
        int p = scan.nextInt();
        int q = scan.nextInt();
        int r = scan.nextInt();
        
        if(p+q<q+r){
            if(p+q<p+r){
                System.out.println(p+q);
            }
            else{
                System.out.println(r+p);
            }
        }
        else{
            if(q+r<p+r){
                System.out.println(q+r);
            }
            else{
                System.out.println(r+p);
            }
        }
        

    }
}


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

int main(void)
{
	int n,k;
	scanf("%d%d",&n,&k);
	int ans=k,i=1;
	for(i;i<=n-1;i++)
		{ans *= (k-1);}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
	int a, b, c;
	int k;
	
	scanf("%d %d %d",&a, &b, &c);
	scanf("%d", &k);
	
	while(1){
		if(a >= b){
			b *= 2; 
			k--;
		}else{
			break;
		}
	}
	
	while(1){
		if(b >= c){
			c *= 2; 
			k--;
		}else{
			break;
		}
	}
	if(k >= 0){
		printf("Yes");
	}else{
		printf("No");
	}
	
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    int N;
    cin >> N;
    cout << (1000 - (N%1000)) % 1000 << endl;
}

Measured memory_bytes: 3628
//                                                   ¯\_(ツ)_/¯               
  //#pragma GCC optimize("Ofast")												 
 //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")  
//#pragma GCC optimize("unroll-loops")                                             
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pi pair<int,int>
const int N=1e6+5,MOD=998244353;
 
using namespace std;

int a,b,k;
int main() {


		cin>>a>>b>>k;
		int cnt=0;
		for(int i=100;i>=1;i--){

			 if(a%i == 0 && b%i ==0){
			 	cnt++;
			 	if(cnt==k)return !printf("%d\n",i );
			 }
		}	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll A, B, C;
  cin >> A >> B >> C;

  cout << ((A + B + C >= 22) ? "bust" : "win") << endl;
}

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

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

    string a,b,c;
    // 引数の受け取り
    //
    cin >> a >> b >> c;

    if (a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){
    cout << "YES" << endl;
    
    }else{
    cout << "NO" << endl;

    }

    // 出力
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <random>

#include <fstream>
#include <vector>
#include <algorithm>

#define ll long long int

using namespace std;

int main(void)
{

    
    ll n, q, tmp, b, c, res;
    deque<ll> a(100001, 0);
    
    cin >> n;
    
    for(ll i = 0; i < n; i++)
    {
        cin >> tmp;
        a[tmp]++;
    }
    
    cin >> q;
    
    res = 0;
    
    for(ll j = 0; j < (ll)a.size(); j++)
    {
        if(a[j])
        {
            res += j * a[j];
        }
    }
    
    for(ll i = 0; i < q; i++)
    {
        cin >> b >> c;
        
        res -= b * a[b];
        res += c * a[b];
        
        a[c] += a[b];
        a[b] = 0;
        
        cout << res << endl;;
    }
    
    
    return 0;
}

Measured memory_bytes: 4448
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int n;
char s[200004];
int main(){
    scanf("%d",&n);
    scanf("%s",s+1);
    int r = n,cnt=0;
    for(int i=1;i<=r;i++){
        if(s[i] == 'W') {
            while(r > i) {
                if(s[r] == 'R') break;
                r --;
            }
            if(r <= i) break;
            swap(s[i], s[r]);
            r--;
            ++cnt;
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 4000
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner i=new Scanner(System.in);
		int[] x=new int[3];
		int s=0;
		while (s<=2){
			x[s]=i.nextInt();
			s++;}
		int n=0;
		while (n<=1){
			int m=n+1;
			while (m<=2){
				if (x[n]>x[m]){s=x[n];x[n]=x[m];x[m]=s;}
				m++;}
			n++;}
		System.out.println(x[0]+" "+x[1]+" "+x[2]);
	}
}

Measured memory_bytes: 17160
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    b = LI()
    ans = []
    for j in range(n):
        for i in range(len(b))[::-1]:
            if b[i] == i+1:
                x = b.pop(i)
                ans.append(x)
                break
    if b:
        print(-1)
    else:
        print(*ans[::-1],sep = "\n")
    return

#B
def B():
    n,a,b,c,d = LI()
    s = S()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    k = b
    while b < d:
        if s[b+1] == ".":
            b += 1
        else:
            if s[b+2] == "#":
                print("No")
                return
            b += 2
    b = k
    if c < d:
        while a < c:
            if s[a+1] == ".":
                a += 1
            else:
                if s[a+2] == "#":
                    print("No")
                    return
                a += 2
        print("Yes")
    else:
        for i in range(b-1,d):
            if s[i:i+3].count(".") == 3:
                print("Yes")
                return
        print("No")
    return

#C
def C():
    n,a,b,c,d = LI()
    if abs(b-a) > (n-1)*d:
        print("NO")
        return
    if 2*c <= (n-1)*(d-c):
        print("YES")
        return
    mi = a-(n-1)*d
    m = c+d
    f = 1+(n-1)*(d-c)
    if f >= m:
        print("YES")
        return
    if (b-mi)%m < f:
        print("YES")
    else:
        print("NO")
    return

#D
def D():
    s = S()
    n = len(s)
    ans = 0
    for i in range(n):
        if s[i] == "U":
            ans += n-i-1
            ans += 2*i
        else:
            ans += 2*(n-i-1)
            ans += i
    print(ans)
    return

#E
def E():
    n = I()
    a = LI()
    a.sort()
    b = [a[i] for i in range(n)]
    for i in range(n-1):
        b[i+1] += b[i]
    for i in range(n-1)[::-1]:
        if a[i+1] > 2*b[i]:
            break
    else:
        print(n)
        return
    print(n-i-1)
    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    E()


Measured memory_bytes: 61436
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, l[15];
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> l[i];
	}
	sort(l, l + n);
	int sum = 0;
	rep(i, n - 1) {
		sum += l[i];
	}
	if (sum > l[n - 1])cout << "Yes" << endl;
	else cout << "No" << endl;
	endre;
}

Measured memory_bytes: 256
let lcs x y =
  let m = String.length x in
  let n = String.length y in
  let dp = Array.make_matrix (m+1) (n+1) 0 in
  let rec duduwa i j =
    if j > n then doit (i + 1)
    else begin
      dp.(i).(j) <- if x.[i-1] = y.[j-1] then dp.(i-1).(j-1) + 1 else if dp.(i-1).(j) > dp.(i).(j-1) then dp.(i-1).(j) else dp.(i).(j-1);
      duduwa i (j + 1)
    end
  and doit i =
    if i > m then dp.(m).(n)
    else duduwa i 1
  in
  doit 1

let () =
  let q = read_int () in
  let rec doit i =
    if i < q then begin
      let x = read_line () in
      let y = read_line () in
      Printf.printf "%d\n" (lcs x y);
      doit (i + 1)
    end
  in
  doit 0

Measured memory_bytes: 18580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    ll N; cin >> N;
    map<ll, bool> A;

    ll colorful = 0;
    rep(i, N) {
        ll a; cin >> a;
        if (0 <= a && a <= 399) A[0] = true;
        else if (400 <= a && a <= 799) A[1] = true;
        else if (800 <= a && a <= 1199) A[2] = true;
        else if (1200 <= a && a <= 1599) A[3] = true;
        else if (1600 <= a && a <= 1999) A[4] = true;
        else if (2000 <= a && a <= 2399) A[5] = true;
        else if (2400 <= a && a <= 2799) A[6] = true;
        else if (2800 <= a && a <= 3199) A[7] = true;
        else colorful++;
    }

    ll min = 0, max = colorful;
    rep(i, 8) {
        if (A[i]) {
            min++; max++;
        }
    }
    if (min == 0) cout << 1 << " " << max << endl;
    else cout << min << " " << max << endl;
}

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

const int N = 1e5 + 10;
int n, a[N];

template <class T> inline void in(T &x) {
	x = 0; int f = 1; char ch = getchar();
	for (; ch<'0' || ch>'9';) {if (ch=='-') f=-1; ch = getchar();}
	for (; ch>='0' && ch<='9';) x = x*10 + ch-'0', ch = getchar();
	x *= f;
}

int main() {
	int p, y; in(n);
	for (int i = 0; i < n; ++i) in(a[i]);
	sort(a + 0, a + n), reverse(a + 0, a + n);
	for (p = 0; p + 1< n && a[p + 1] > p + 1; ++p);
	for (y = 0; y < n && a[y] > p; ++ y);
	if ((a[p] - p)&1 && (y - p)&1) puts("Second");
	else puts("First");
	return 0;
}

Measured memory_bytes: 768
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  string s; cin >> s;
  ll ans = 0; // ??????
  ll pm = 0; // ?????????????????????????????????
  // J???I?????????????????´???
  ll sumI[N+1], sumJ[N+1];
  sumJ[0] = sumI[N] = 0;
  ll J = 0;
  FOR(i,0,N) {
    if(s[i] == 'J') J++;
    sumJ[i+1] = sumJ[i] + (s[i] == 'O' ? J : 0);
  }
  ll I = 0;
  for(int i = N - 1; i >= 0; i--) {
    if(s[i] == 'I') I++;
    sumI[i] = sumI[i+1] + (s[i] == 'O' ? I : 0);
    //cout << sumI[i] << endl;
  }
  ll JJ = 0, II = I;
  FOR(i,0,N) {
    if(s[i] == 'O') {
      // J < i
      pm = max(pm, sumI[i]);
      // i < I
      pm = max(pm, sumJ[i+1]);
    }
  }
  // O?????????????????´???
  JJ = 0;
  II = I;
  pm = max(pm, JJ * II);
  FOR(i,0,N) {
    if(s[i] == 'O') ans += JJ * II;
    JJ += s[i] == 'J';
    II -= s[i] == 'I';
    pm = max(pm, JJ * II);
  }

  ans += pm;
  cout << ans << endl;
  return 0;
}

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

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

const long long INF = 1LL << 60;
const long long mod = 1000000007;

int main(void){
	int n;cin >> n;
	int m; cin >> m;
	ll a[m],dp[n+1];
	rep(i,n+1)dp[i] = 0;
	rep(i,m){cin >> a[i];dp[a[i]] = INF;}
	dp[0] = 1;
	for(int i=1;i<n+1;i++){
		if(dp[i]==INF)continue;	
		if(dp[i-1]!=INF) dp[i] += dp[i-1] % mod;
		if(i>1 && dp[i-2]!=INF) dp[i] += dp[i-2] % mod;
//		cout << "dp[" <<i <<"]=" << dp[i] << endl; 
	}
	
	cout << dp[n] % mod << endl;
	return 0;
}



Measured memory_bytes: 1792
# n= input().split(" ")
n = int(input())

def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)

# ########関数部分##############
# def Base_10_to_n(X, n):
#     if (int(X/n)):
#         return Base_10_to_n(int(X/n), n)+str(X%n)
#     return str(X%n)
# ############################

# #####関数をつかってみる．#####
# ######今回は二進数に変換######
# x2 = Base_10_to_n(n,27)

print(num2alpha(n))

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

ll dp[500][500];

const ll LINF = 1e18+5;

int main() {
    int n,k;
    cin >> n >> k;
    int h[500] = {};
    for (int i=1;i<=n;i++) cin >> h[i];

    for (int i=0;i<=n;i++)
        for (int j=0;j<=i;j++)
            dp[i][j] = LINF; // impossible
    
    dp[0][0] = 0;

    for (int i=1;i<=n;i++) {
        for (int j=1;j<=i;j++) {
            for (int x=j-1;x<i;x++) {
                dp[i][j] = min(dp[i][j],dp[x][j-1]+max(0,h[i]-h[x]));
            }
        }
    }

    ll ans = LINF;
    for (int i=n-k;i<=n;i++) {
        ans = min(dp[i][n-k],ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <numeric>
#include <cassert>
#include <cmath>
#include <map>
#include <set>
#include <iostream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef vector<PII > VPII;
typedef vector<VPII> VVPII;

#define FOR(k,a,b) for(int k(a); k < (b); ++k)
#define REP(k,a) for(int k=0; k < (a); ++k)
#define ABS(a) ((a)>0?(a):-(a))
#define EPS 1e-9

int main(int argc, char** argv) {
#ifdef HOME
	freopen("in.txt", "rb", stdin);
	freopen("out.txt", "wb", stdout);
#endif
	int N;
	scanf("%d", &N);
	vector<int> v(N);
	LL su = 0;
	REP(i, N)
	{
		scanf("%d", &v[i]);
		su += v[i];
	}
	LL NN = N;
	NN *= (N + 1);
	NN /= 2;
	if (su%NN)
	{
		printf("NO\n");
		return 0;
	}
	LL k = su / NN;
	LL sd = 0;
	REP(i, N)
	{
		int diff = v[(i + 1) % N] - v[i];
		if (diff > k)
		{
			printf("NO\n");
			return 0;
		}
		diff = k - diff;
		if (diff % N)
		{
			printf("NO\n");
			return 0;
		}
		sd += diff / N;
	}
	printf("%s\n", (sd == k ? "YES" : "NO"));
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll gcd(ll x, ll y) { return (y ? gcd(y, x % y) : x); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main() {
	init();

	ll N, X; cin >> N >> X;
	vector<ll>vec(N);
	rep(i, 0, N)cin >> vec[i];
	ll ans = abs(X - vec[0]);
	rep(i, 1, N) {
		ans = gcd(ans, abs(X - vec[i]));
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024
N = int(input())
X = []
for i in range(N):
    x,l = map(int, input().split())
    X.append([x-l, x+l])
X.sort()
#print(X)

count = N
temp = X[0][1]
for i in range(N-1):
    if X[i+1][0] < temp:
        count -= 1
        temp = min(temp, X[i+1][1])
    else:
        temp = X[i+1][1]
    #print(temp)

print(count)

Measured memory_bytes: 20104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for(int i = 0; i < n; ++i)
#define INF (2e9)

int main() {
  int x, n, tmp; cin >> x >> n;
  int p[102] = {0};

  for(int i = 0; i < n; ++i) {
    cin >> tmp;
    p[tmp] = 1;
  }

  int under = x;
  int over = x;

  while(true) {
    if(p[under] == 0) {
      cout << under << endl;
      return 0;
    } else {
      under--;
    }

    if(p[over] == 0) {
      cout << over << endl;
      return 0;
    } else {
      over++;
    }
  }

  return 0;
}

Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,K; cin>>N>>K;
  string ans="YES";
  if((N+1)/2<K)
    ans="NO";
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end() 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

const int maxn = (int) 1e5;
const int MODULO = MOD;

vi parent, sz, primes;
vector<vi> sieve;

void run_sieve () {
	sieve.resize(maxn + 1);
	for (int i = 2; i <= maxn; i += 1) {
		if (!sieve[i].empty()) continue;
		primes.PB(i);
		for (int j = i; j <= maxn; j += i) sieve[j].PB(i);
	}
}

void make_set (int x) {
	parent[x] = x;
	sz[x] = 1;
}

int find (int a) {
	while (a != parent[a]) a = parent[a];
	return a;
}

void merge (int a, int b) {
	a = find(a), b = find(b);
	if (a == b) return;

	if (sz[a] > sz[b]) {
		parent[b] = a;
		sz[a] += sz[b];
	}
	else {
		parent[a] = b;
		sz[b] += sz[a];
	}
}

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

signed main () {
	start_routine;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif

	int r;
	cin >> r;

	if (r < 1200) print("ABC");
	else if (r < 2800) print("ARC");
	else print("AGC");

	end_routine;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

int main(void) {
    u64 N, M, X;
    cin >> N >> M >> X;
    
    vector<u64> C(N);
    vector<vector<u64>> A(N, vector<u64>(M));
    vector<u64> All(M);

    for(u64 i=0; i<N; i++) {
        cin >> C[i];
        for(u64 j=0; j<M; j++) {
            cin >> A[i][j];
            All[j] += A[i][j];
        }
    }

    for(u64 j=0; j<M; j++) {
        if(All[j] < X) {
            cout << -1 << endl;
            return 0;
        }
    }

    u64 ans = UINT64_MAX;
    for(u64 i=1; i<pow(2, N); i++) {
        u64 ii = i;
        u64 n = 0;
        vector<u64>  sum(M);
        u64 tans = 0;
        boost::dynamic_bitset<> overX(M);

        while(ii > 0) {
            if(ii & 1) {
                for(u64 j=0; j<M; j++) {
                    sum[j] += A[n][j];
                    overX[j] = sum[j] >= X;
                }
                tans += C[n];
            }
            n++;
            ii /= 2;
        }

        if(overX.all()) {
            ans = min(ans, tans);
        }
    }

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

Measured memory_bytes: 4076
#include <stdio.h>

int main(void)
{
	int w[12];
	int k[12];
	int i, j;
	int temp;
	int wten = 0, kten = 0;
	 
	for (i = 0; i < 10; i++){
		scanf("%d", &w[i]);
	}
	for (i = 0; i < 10; i++){
		scanf("%d", &k[i]);
	}
	
	for (i = 0; i < 10 - 1; i++){
		for (j = 10 - 1; j > i; j--){
			if (w[j - 1] < w[j]){
				temp = w[j];
				w[j] = w[j - 1];
				w[j - 1] = temp;
			}
		}
	}
	for (i = 0; i < 10 - 1; i++){
		for (j = 10 - 1; j > i; j--){
			if (k[j - 1] < k[j]){
				temp = k[j];
				k[j] = k[j - 1];
				k[j - 1] = temp;
			}
		}
	}
	for (i = 0; i < 3; i++){
		wten += w[i];
	}
	for (i = 0; i < 3; i++){
		kten += k[i];
	}
	
	printf("%d %d\n", wten, kten);
	
	return (0);
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <deque>
#include <queue>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#define INF 1000000000000
using namespace std;
using ll = long long;
int main() {
	ll n;
	cin >> n;
	vector<ll> h(n);
	ll dp[100010];
	for (ll i = 0; i < n; i++) {
		cin >> h[i];
	}
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for (ll i = 2; i < n; i++) {
		dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]), dp[i-1] + abs(h[i-1] - h[i]));
	}
	cout << dp[n-1] << endl;
}


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

int main(){
    int A,B,C,X,i,j,Asize,Bsize,xdiv,xdiv2,rem,rem2,count=0;
    cin >> A >> B >> C >> X;
    xdiv = X/500;
    if(xdiv<A){
        Asize = xdiv;
    }else{
        Asize = A;
    }
    for(i=Asize;i>=0;i--){
        rem = X - 500 * i;
        xdiv2 = rem / 100;
        if(xdiv2<B){
            Bsize = xdiv2;
        }else{
            Bsize = B;
        }
        for(j=Bsize;j>=0;j--){
            rem2 = rem - 100 * j;
            if(rem2/50<=C){
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = a*b;
        if( ans == 2) {
        	System.out.println("3");
        }else if(ans == 3) {
        	System.out.println("2");
        }else {
        	System.out.println("1");
        }
}
    }

Measured memory_bytes: 21844
n,m = map(int,input().split())
a = [[0 for i in range(m)]for j in range(n)]
b = [0 for i in range(m)]
for i in range(n):
    a[i]=list(map(int,input().split()))
for i in range(m):
    b[i] = int(input())

for i in range(n):
    sum = 0
    for j in range(m):
        sum += a[i][j]*b[j]
    print(sum)



Measured memory_bytes: 6024
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#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 repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
typedef long long int ll;
#define iceil(x,y) (x+y-1)/y

using namespace std;
typedef pair<int, int> PII;

int main() {
	FAST;

	int h, w;
	cin >> h >> w;
	char a[h][w];
	int f[h][w];
	rep(i,h) {
		rep(j,w) {
			cin >> a[i][j];
			if (a[i][j] == '#') f[i][j] = 1;
			else f[i][j] = 0;
		}
	}

	int pr[h] = {};
	int pc[w] = {};
	rep(i,h) {
		rep(j,w) {
			pr[i] += f[i][j];
			pc[j] += f[i][j];
		}
	}

	rep(i,h) {
		rep(j,w) {
			if ((pr[i] != 0) && (pc[j] != 0)) {
				cout << a[i][j];
			}
		}
		if (pr[i] != 0) cout << "\n";
	}

	return 0;
}

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

#define ll long long
#define REP(i,n) for(ll i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}


void solve_D(){
    ll n;
    cin >> n;
    ll a[n];
    ll num[n + 10];
    REP(i,n+10) num[i] = 0;

    REP(i,n){
        cin >> a[i];
        num[a[i]]++;
    }

    ll ans = 0;

    REP(i,n+10){
        ans += num[i] * (num[i] - 1) / 2;
    }

    ll ans_tmp = ans;
    
    REP(k,n){
        ll m = num[a[k]];
        ans_tmp -= m * (m-1) / 2;
        ans_tmp += (m-1) * (m-2) / 2;
        cout << ans_tmp << endl;
        ans_tmp = ans;
    }
}

int main(void){
    solve_D();
    
    return 0;
}

Measured memory_bytes: 5760
function Main(input) {
  input = input.split(" ");
  var output = 0;
  if (input[0] * input[1] < input[2]) {
    output = input[0] * input[1];
  } else {
    output = input[2];
  }
  console.log(output);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    expected = []
    real = []
    for i in range(1, N+1):
        if i == P[i-1]:
            continue
        expected.append(i)
        real.append(P[i-1])
    print("YES" if len(real) == 0 or (len(real)==2 and len(expected)==2 and expected[0]==real[1] and expected[1]==real[0]) else "NO")

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 9128
/** 
If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe.
*/
#include <bits/stdc++.h>
using namespace std;
/**
(▀̿Ĺ̯▀̿ ̿) (ง ͠° ͟ل͜ ͡°)ง
*/
auto main() -> int {
	ios_base::sync_with_stdio(false); cin.tie(0);
    unsigned long long x; cin >> x;

    unsigned long long cur = 100;
    int d = 0;
    while (cur < x) {
        cur *= 1.01;
        ++d;
    }
    cout << d << '\n';
	return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

struct Node
{
  vector<int> to;
  vector<int> cost;
};
Node Graph[100010];
void AddEdge(int from, int to, int cost, Node *graph)
{
  graph[from].to.push_back(to);
  graph[from].cost.push_back(cost);
  graph[to].to.push_back(from);
  graph[to].cost.push_back(cost);
}

int color[100010];

void dfs(int x)
{
  vector<int> t = Graph[x].to;
  vector<int> c = Graph[x].cost;
  for(int i=0;i<t.size(); ++i)
  {
    if(color[t[i]] == -1)
    {
      if(color[x] == 0)
      {
        if(c[i] % 2 ==0)
          color[t[i]] = 0;
        else
          color[t[i]] = 1;
      }
      else
      {
        if(c[i] % 2 == 0)
          color[t[i]] = 1;
        else 
          color[t[i]] = 0;
      }
      dfs(t[i]);
    }
  }
  return;
}

int main()
{
  int n;
  cin >> n;
  for (int i = 0; i < n-1; ++i)
  {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    AddEdge(u, v, w, Graph);
  }

  memset(color, -1, sizeof(color));

  color[0] = 0;
  dfs(0);
  for(int i = 0; i < n; ++i)
    cout << color[i] << endl;

  return 0;
}


Measured memory_bytes: 17536
import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private int W,H,startx,starty,goalx,goaly,N,baseC;
	private boolean flag = false;
	private int[][] F;
	private int[][] vec = {{-1,0},{0,1},{1,0},{0,-1}};
	private boolean[][] State;
	private Stack<Integer[]> stack;

	public void mainrun() {

		scan = new Scanner(System.in);

		while(true) {
			W = scan.nextInt();
			H = scan.nextInt();

			if(W == 0 || H == 0) {
				break;
			}

			F = new int[H + 2][W + 2];
			State = new boolean[H + 2][W + 2];

			for(int i = 0;i < H + 2 ;i++) {
				Arrays.fill(F[i],0);
				Arrays.fill(State[i], false);
			}

			startx = scan.nextInt();
			starty = scan.nextInt();

			goalx = scan.nextInt();
			goaly = scan.nextInt();

			N = scan.nextInt();

			stack = new Stack<>();

			flag = false;

			for(int i = 0;i < N ;i++) {
				int c = scan.nextInt();
				int d = scan.nextInt();
				int x = scan.nextInt();
				int y = scan.nextInt();

				for(int j = y;j < y + (d == 0 ? 2 : 4);j++ ) {
					for(int k = x;k < x + (d == 1 ? 2 : 4);k++) {
						F[j][k] = c;
					}
				}
			}

			baseC = F[starty][startx];

			State[starty][startx] = true;
			stack.push(new Integer[] {startx,starty});
			move();


			System.out.println(flag ? "OK" : "NG");
		}
		scan.close();
	}

	private void move() {

		while(!stack.empty()) {

			Integer[] point = stack.pop();
			int x = point[0];
			int y = point[1];

			if(x == goalx && y == goaly || flag) {
				flag = true;
				return;
			}

			for(int i = 0;i < 4;i++) {

				int nx = x + vec[i][1];
				int ny = y + vec[i][0];

				if( nx == 0 || nx == W + 1 || ny == 0 || ny == H + 1) {
					continue;
				}

				if(F[ny][nx] == baseC && !State[ny][nx]) {
					State[ny][nx] = true;
					stack.push(new Integer[] {nx,ny});
				}
			}
		}
	}
}

class Data{
	int x;
	int y;
	public Data(int x,int y) {
		this.x = x;
		this.y = y;
	}
}


Measured memory_bytes: 32944
/**
 * @see https://practice.contest.atcoder.jp/tasks/practice_1
 * @param  {string} input
 * @returns {string}
 */
const main = function(input) {
    const values = input.split(" ");
    const ab = parseInt(values[0]) * parseInt(values[1]);
    return (ab % 2) === 0 ? "Even" : "Odd";
};

const output = main(require("fs").readFileSync("/dev/stdin", "utf8"));
console.log(output); // console.log outputs with trailing new line!


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

int main(){
	
	int n, x;
	
	cin >> n >> x;
	int ans = 1;
	int help = 0;
	
	for (int i = 0; i < n; i++){
		int l;
		
		cin >> l;
		
		help+=l;
		if (help <= x){
			ans++;
		}
	}
	
	cout << ans;
	
}

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

int cmpint(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}

int main(){
  int N;
  long long K;
  scanf("%d%lld",&N,&K);
  int a[100000][2]={0};
  int i;
  for(i=0;i<N;i++){
    scanf("%d%d",&a[i][0],&a[i][1]);
  }//b[i]がa[i][1]になっている
  long long cnt=0;
  qsort(a,N,sizeof(a[0]),cmpint);
  for(i=0;i<N;i++){
    cnt+=a[i][1];
    if(cnt>=K){
      printf("%d",a[i][0]);
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
using namespace std;
int ss(int a[],int n){
    int i,j;
    int min;
    int c=0;
    for(i=0;i<n;i++){
        min = i;
        for(j=i;j<n;j++){
			if(a[j]<a[min]) min = j;
        }
        swap(a[i],a[min]);
        if(i != min) c++;
    }
    return c;
}
int main(){
    int i;
    int n;
    int a[100];
    int ans;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    ans = ss(a,n);
    for(i=0;i<n;i++){
		printf("%d", a[i]);
		if(i!=n-1) printf(" ");
    }
	printf("\n");
    cout << ans << endl;
}




Measured memory_bytes: 3220
A,B,C = map(int,input().split())
K = int(input())

flag = "No"
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z <= K and A*(2**x) < B*(2**y) and B*(2**y) < C*(2**z):
                flag = "Yes"
print(flag)

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

int main(){
	int M1, M2, D1, D2, FLAG_EOM=0;
	
	cin >> M1 >> D1 >> M2 >> D2;
	
	FLAG_EOM = 0;
	if (M1 < M2){
		FLAG_EOM = 1;
	}
	
	cout << FLAG_EOM << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, M; scanf("%d %d", &N, &M);
  vector<string> A(N), B(M);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < M; ++i) {
    cin >> B[i];
  }

  for (int i = 0; i + M <= N; ++i) {
    string::size_type pos = -1;
    while ((pos = A[i].find(B[0], pos + 1)) != string::npos) {
      bool ok = true;
      for (int j = 0; j < M; ++j) {
        if (A[i + j].find(B[j], pos) != pos) {
          ok = false;
          break;
        }
      }
      if (ok) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename X, typename Y> istream& operator>>(istream& is, pair<X, Y>& p) { return is >> p.first >> p.second; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    cout << min(n % k, abs(n % k - k)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define N 100000
int binarySearch(int key,int S[],int left,int right)
{
    while(left<right)
    {
        int mid=(left+right)/2;
        if(S[mid]==key) return 1;
        else if(S[mid]<key) {left=mid+1;}
        else {right=mid;}
    }
    return 0;
}
int main()
{
    int sum=0;
    int n;
    int q;
    int S[N];
    int T[N];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    scanf("%d",&S[i]);
    scanf("%d",&q);
    for(int i=0;i<q;i++)
    scanf("%d",&T[i]);
    for(int i=0;i<q;i++)
    if(binarySearch(T[i],S,0,n)) sum++;
    printf("%d\n",sum);
    return 0;
}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
      int N, x=1;
	  cin >> N;
  		
 	  while(true){
        x *= 2;
          if(x > N)
            break;
      }
     
  	  cout << x/2 <<endl;
  

    }
       

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#define MOD 1000000007
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
signed main(){
    int n;
    cin>>n;
    double v[50];
    for(int i=0;i<n;i++)cin>>v[i];
    sort(v,v+n);
    double now=(v[0]+v[1])/(double)2;
    for(int i=2;i<n;i++){
        now=(now+v[i])/(double)2;
    }
    cout<<now<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxn= 5e5+5;
#define mod 1000000007
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main() {
    map<int,pair<int,int>> mp;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            int x;
            cin>>x;
            mp.insert({x,{i,j}});
        }
    }
    int arr[3][3]={};
    int n;
    cin>>n;
    while(n--){
        int x;
        cin>>x;
        if(mp.count(x)){
            pair<int,int> p=mp[x];
            arr[p.first][p.second]=1;
        }
    }
    for(int i=0;i<3;i++){
        int temp=0;
        for(int j=0;j<3;j++){
            if(arr[i][j])temp++;
        }
        if(temp==3){
            cout<<"Yes";
            return 0;
        }
    }
    for(int j=0;j<3;j++){
        int temp=0;
        for(int i=0;i<3;i++){
            if(arr[i][j])temp++;
        }
        if(temp==3){
            cout<<"Yes";
            return 0;
        }
    }
    if(arr[0][0]&&arr[1][1]&&arr[2][2]){
        cout<<"Yes";
        return 0;
    }
    if(arr[2][0]&&arr[1][1]&&arr[0][2]){
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
}



Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int H = scan.nextInt();
        int W = scan.nextInt();
        scan.close();

        int Ans = (N - W + 1) * (N - H + 1);

        System.out.println(Ans);

    }
}

Measured memory_bytes: 21716
n = int(input())
a_l = list(map(int,input().split()))
co = 0

for i in range(n):
    while(True):

        if a_l[i]%2 == 0:
            co = co + 1
            a_l[i] = a_l[i]/2
        else:
            break

print(co)

Measured memory_bytes: 4148
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
const int oo = 1e8+7;
const int mod = 1e9+7;

void add_self(int& x, int y) {
    x += y;
    if(x >= mod) {
        x -= mod;
    }
}

int main() {
    
    int n;
    string s;
    scanf("%d",&n);
    getline(cin, s);
    getline(cin, s);
    
    vector<int> dp(n+1, 0);
    dp[1] = 1;
    
    // dp[n][a] - number of valid permutations of size n
    // with ending number a
    
    for(int len = 2; len <= n; ++len) {
        vector<int> new_dp(n+1, 0);
        vector<int> run(len+1, 0);
        int r = 0;
        
        if(s[len-2] == '<') { //a has to be smaller
            for(int i = 1; i <= len-1; ++i) {
                add_self(r, dp[i]);
                run[i] = r;
            }
        } else if(s[len-2] == '>') { //a has to be equal or bigger
            for(int i = len-1; i >= 1; --i) {
                add_self(r, dp[i]);
                run[i] = r;
            }
        }
        
        debug() << imie(s[len-2]) imie(dp) imie(run);
        
        for(int b = 1; b <= len; ++b) {
            
            if(s[len-2] == '<') {
                add_self(new_dp[b], run[b-1]); //a = b-1
            } else {
                add_self(new_dp[b], run[b]); //a = b
            }
            
            /*
            for(int a = 1; a <= len-1; ++a) {
                int real_a = a;
                if(a >= b) {
                    ++real_a; //push one up
                }
                
                if((real_a < b) != (s[len-2] == '<')) {
                    continue;
                }
                
                debug() << imie(a) imie(b) imie(dp[a]) imie(len);
                
                add_self(new_dp[b], dp[a]);   
            }
            */
        }
        dp = new_dp;
    }
    
    int answer = 0;
    for(int i = 1; i <= n; ++i) {
        add_self(answer, dp[i]);
    }
    
    cout << answer << endl;
    
    return 0;
}




Measured memory_bytes: 256
def write(r):
    b=[chr(x+97) for x in r]
    print("".join(b))


def add(a,j):
    for c in a[j]:
        for d in range(max(c)+2):
            e=c+[d]
            a[j+1].append(e)
    

n=int(input())
a=[[] for x in range(n)]
a[0]=[[0]]
for j in range(n-1):
    add(a,j)
for r in a[n-1]:
    write(r)

Measured memory_bytes: 27460
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main(){
    double l,a,b=0;
    scanf("%lf",&l);
    a=l/3.0;
    b=a;
    if(a*3!=l){
        b=l-a*2;
    }
    printf("%.12lf",a*b*a);
}


Measured memory_bytes: 256