akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

constexpr int kAValue = 500;
constexpr int kBValue = 100;
constexpr int kCValue = 50;

int main() {
  int a, b, c, x;
  std::cin >> a >> b >> c >> x;
  int cnt = 0;
  for (int i = 0; i <= a; ++i) {
    for (int j = 0; j <= b; ++j) {
      for (int k = 0; k <= c; ++k) {
        if (kAValue * i + kBValue * j + kCValue * k == x) {
          ++cnt;
        }
      }
    }
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
//#include<unordered_map>
//#include<unordered_set>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=1; i<=(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> P; 
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 100005;
//////////////////////////////

vector<vector<int>> calcNext(const string &S)
{
	int n = S.size();
	vector<vector<int>> ret(n + 2, vector<int>(26, n + 1));
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < 26; j++) ret[i][j] = ret[i + 1][j];
		ret[i][S[i] - 'a'] = i;
	}
	return ret;
}

void solve()
{
	string S; cin >> S;
	int n = S.size();
	auto next = calcNext(S);

	vector<int> dp(n + 1, INF);
	vector<int> rc(n + 1, 'a');

	//calc dp
	dp[n] = 1;
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < 26; j++) {
			if (next[i][j] == n + 1) {
				if (dp[i] > 1) {
					dp[i] = 1;
					rc[i] = j + 'a';
				}
			}
			else {
				if (dp[i] > dp[next[i][j] + 1] + 1) {
					dp[i] = dp[next[i][j] + 1] + 1;
					rc[i] = j + 'a';
				}
			}
		}
	}

	//recovery
	string ans = "";
	int ind = 0;
	while (ind <= n) {
		ans += rc[ind];
		ind = next[ind][rc[ind] - 'a'] + 1;
	}
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}



Measured memory_bytes: 31592
MAX_N = 10 ** 3 + 10
MAX_M = 2 * (10 ** 3) + 1
INF = 10 ** 13

def bfs(graph, N, M):
    que = []
    que.append([0, 0])
    visited = [-INF for x in range(MAX_N)]
    update_cnt = [0 for x in range(MAX_N)]
    result = -INF
    while (len(que) > 0):
        now = que[0]
        que.pop(0)

        pos = now[0]
        cost = now[1]
        if (visited[pos] > cost):
            continue
        for val in graph[pos]:
            nxt = val[0]
            nxt_cost = val[1]

            if (cost + nxt_cost > visited[nxt] and update_cnt[nxt] < MAX_M):
                visited[nxt] = cost + nxt_cost
                update_cnt[nxt] += 1
                que.append([nxt, nxt_cost + cost])

    if (update_cnt[N - 1] >= MAX_N):
        return (0, False)
    return (visited[N - 1], True)


if __name__ == "__main__":
    N, M = map(int, input().split())
    graph = [[] for x in range(MAX_N)]
    for x in range(M):
        a,b,c = map(int, input().split())
        a -= 1
        b -= 1
        graph[a].append([b, c])
    res,ok = bfs(graph, N, M)
    if (not ok):
        print ('inf')
    else:
        print (res)


Measured memory_bytes: 52056
sa = list(str(input()))
sb = list(str(input()))
sc = list(str(input()))
nextmark = sa.pop(0)
while (nextmark!="a" or sa!=[]) and (nextmark!="b" or sb!=[]) and (nextmark!="c" or sc!=[]):
    if nextmark=="a":
        nextmark = sa.pop(0)
    elif nextmark=="b":
        nextmark = sb.pop(0)
    elif nextmark=="c":
        nextmark = sc.pop(0)
print(nextmark.upper())
        

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2,s3,s4;
    cin>>s1>>s2;
    cin.ignore();
    s3=s1;
    s4=s2;
    reverse(s1.begin(),s1.end());
  //  reverse(s1.begin(),s1.end());

    reverse(s2.begin(),s2.end());
 //   reverse(s2.begin(),s2.end());

    if(s1==s4 && s2==s3 ) cout<<"YES"<<endl;
    else                  cout<<"NO"<<endl;
//   if(s3==s4 ||s4==s3) cout<<"Yes"<<end;
    //  else                cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,K = MI()
A = [0] + LI()

visited = [0]*(N+1)
times = [0]*(N+1)
i = 1
a = 0
visited[1] = 0
times[0] = 1
while True:
    i = A[i]
    a += 1
    if visited[i] != 0:
        times[a] = i
        b,c = visited[i],a
        break
    else:
        visited[i] = a
        times[a] = i


if K <= a:
    print(times[K])
else:
    print(times[a+(K-a)%(b-a)])


Measured memory_bytes: 101300
q=->a,*z,b{puts"? #{a} #{b}";$>.flush;gets[?N]}
A,B=gets.split.map &:to_i
A>B ? (
N,*g=A+B
N.times{|i|g[0]&&q[i,*g]?g.pop: g<<i}
puts"! "+N.times.map{|i|q[*g,i]?0:1}*''
):$><<:Impossible


Measured memory_bytes: 24084
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int table[] = new int[3];

		Scanner sc = new Scanner(System.in);

		table[0] = sc.nextInt();
		table[1] = sc.nextInt();
		table[2] = sc.nextInt();

		int work;

		for(int base_loc = 0; base_loc <= 1; base_loc++){
			for(int comp_loc = table.length-1;comp_loc >= base_loc+1; comp_loc--){
				if(table[comp_loc] < table[comp_loc-1]){
					work = table[comp_loc-1];
					table[comp_loc-1] = table[comp_loc];
					table[comp_loc] = work;
				}
			}
		}

		for(int i = 0; i < table.length; i++){
			if(i != 0)System.out.printf(" ");
			System.out.printf("%d", table[i]);
		}
		System.out.printf("\n");
	}
}





Measured memory_bytes: 26348
import java.util.*;
public class Main implements Runnable {
    public static void main(String[] args) {
      new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行
    }
    public void run() {
      //ここに処理を書く
      
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
        long ans = 0;
        for(int i = 1; i <= n; i++) {
          if (i == 1) {
            continue;
          } 
          ans += i - 1;
        }
    
		// 出力
		System.out.println(ans);
    }
}

Measured memory_bytes: 22996
main = do
  s <- getContents
  let ss = init . filter (not . null) . lines $ s
  mapM_ (mapM_ putStrLn . reverse . (:) "" . reverse . solve [] . map read . words) ss

genLineSha :: Int -> String -> String
genLineSha 0 line = reverse line
genLineSha x line = genLineDot (x - 1) ('#' : line)

genLineDot :: Int -> String -> String
genLineDot 0 line = reverse line
genLineDot x line = genLineSha (x - 1) ('.' : line)

  
solve :: [String] -> [Int] -> [String]
solve ss [x,y] 
  | x == 0    = ss 
  | even x    = solve (genLineDot y "" : ss) [(x - 1),y]
  | otherwise = solve (genLineSha y "" : ss) [(x - 1),y] 

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

int main() {
  int a, b, p, q;
  cin >> a >> b;
  for(int i = 0; i < a; i++){
    bool r = 0;
    for(int j = 0; j < b; j++){
      string s;
      cin >> s;
      if(s == "snuke"){
        p = i + 1;
        q = j;
        r = 1;
        break;
      }
    }
    if(r)
      break;
  }
  char c = 'A' + q;
  cout << c << p << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a[100]{0};
    for(int i=1;i<=9;i++)
        for(int j=1;j<=9;j++)
        a[i*j]=1;
    int n;cin>>n;
    cout<<(a[n]?"Yes":"No");
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#define lowbit(n) n & (-n)
#define lson rt<<1
#define rson rt<<1|1
#define ls lson, l, mid
#define rs rson, mid+1, r
#define clc(a, b) memset(a, b, sizeof(a))
#define Buff ios::sync_with_stdio(false)
#define rush() int Case = 0; int T; scanf("%d", &T);  while(T--)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define per(i, a, b) for(int i = a; i >= b; i --)
#define reps(i, a, b) for(int i = a; b; i ++)
#define read(a) scanf("%d", &a)
#define readd(a) scanf("%lf", &a)
#define readl(a) scanf("%lld", &a)
#define readc(a) scanf("%c", &a)
#define reads(a) scanf("%s", a)
#define sqr(x) x*x
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>PII;
const int mod = 998244353;
const double eps = 1e-6;
const int N = 2e5+7;
ll sum[N << 2], power[N << 2], pow10[N];
int color[N << 2];
void pushup(int rt)
{
    sum[rt] = (sum[lson] + sum[rson]) % mod;
    if(color[lson] != color[rson])  color[rt] = -1;
    else                            color[rt] = color[lson];
}
void pushdown(int rt)
{
    if(color[rt] == -1) return ;
    color[lson] = color[rson] = color[rt];
    sum[lson] = power[lson] * 1ll * color[rt];
    sum[rson] = power[rson] * 1ll * color[rt];
    color[rt] = -1;
}
void build(int rt, int l, int r)
{
    if(l == r)
    {
        color[rt] = 1;
        power[rt] = pow10[l];
        sum[rt] = power[rt];
//        printf("%lld\n", sum[rt]);
        return ;
    }
    int mid = l + r >> 1;
    build(ls);  build(rs);
    pushup(rt);
    power[rt] = (power[lson] + power[rson]) % mod;
}
void update(int rt, int l, int r, int L, int R, int x)
{
    if(l >= L && r <= R)
    {
        sum[rt] = power[rt] * 1ll * x % mod;
//        printf("sum[%d] = %lld\n", rt, sum[rt]);
        color[rt] = x;
        return ;
    }
    pushdown(rt);
    int mid = l + r >> 1;
    if(L <= mid)    update(ls, L, R, x);
    if(R > mid)     update(rs, L, R, x);
    pushup(rt);
}
int main()
{
    int n, q;
    read(n);    read(q);
    pow10[n] = 1ll;
    per(i, n-1, 1)  pow10[i] = pow10[i+1] * 10ll % mod;
//    rep(i, 1, n)    cout << pow10[i] <<" ";puts("");
    build(1, 1, n);
    while(q --)
    {
        int l, r, x;
        read(l);    read(r);    read(x);
        update(1, 1, n, l, r, x);
        printf("%lld\n", sum[1]);
    }
	return 0;
}


Measured memory_bytes: 15036
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        ((a)*((b)/gcd((a),(b))))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    int n;
    cin>>n;

    int z=n%10;

    if(z==3)
        cout<<"bon";
    else if(z==0 || z==1 || z==6 || z==8)
        cout<<"pon";
    else
        cout<<"hon";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 3640
#D    高橋君と見えざる手 / An Invisible Hand
N,T = [int(i) for i in input().split(" ")]
A=[int(i) for i in input().split(" ")]
Max = 0
count = 1
Min = A[0]
for i in range(N):
    if A[i] <= Min :
        Min = A[i]
    else :
        temp = A[i]-Min
        if temp > Max:
            Max = temp 
            count = 1
        elif temp == Max :
            count += 1
print(count)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define FOR(i,a) for(int i=1;i<=a;i++)
#define logo(s) std::cout<<s;
using namespace std;

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    FOR(i,a)
    {
        FOR(j,b)
        {
            if ((j <= c && i <= d) || (c < j && d < i))
            {
                logo(1);
            }
                else
                {
                    logo(0);
                }
        }
        std::cout<<std::endl;
    }
    std::cin.get();
}


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

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> field(h);
    rep(i, h) cin >> field[i];
    vector<vector<int>> yoko(h, vector<int>(w, 0));
    vector<vector<int>> tate(h, vector<int>(w, 0));
    rep(i, h){
        vector<bool> done(w, 0);
        rep(j, w){
            if(field[i][j] == '#') continue;
            if(done[j]) continue;
            int l = 0;
            while(j + l < w){
                if(field[i][j + l] == '.') l++;
                else break;
            }
            rep(k, l){
                yoko[i][j + k] = l;
                done[j + k] = true;
            }
        }
    }
    rep(i, w){
        vector<bool> done(h, 0);
        rep(j, h){
            if(field[j][i] == '#') continue;
            if(done[j]) continue;
            int l = 0;
            while(j + l < h){
                if(field[j + l][i] == '.') l++;
                else break;
            }
            rep(k, l){
                tate[j + k][i] = l;
                done[j + k] = true;
            }
        }
    }
    int ans = 0;
    rep(i, h){
        rep(j, w){
            ans = max(ans, tate[i][j] + yoko[i][j] - 1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35712
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,l,r) for(int i=(l),i##_len=(r);i<r;++i)
#define int long long
using namespace std;
constexpr int mod = 1e9+7;
class mint {
 private:
  int _num,_mod;
  mint set(int num){ 
      _num = num ;
      if(_num>=0) _num%=_mod;
      else _num+=(1-(_num+1)/_mod)*_mod; 
      return *this;
  }
  int mpow(int a,int n);  
  int imod(int n){return mpow(n , _mod-2);}
 public:
  mint(){ _num = 0;_mod=mod; }
  mint(int num){ _mod = mod; _num = (num+(1LL<<25)*mod) % mod; }
  mint(int num,int M){ _mod=M;_num=(num+(1LL<<25)*mod)%_mod; }
  mint(const mint &cp){_num=cp._num;_mod=cp._mod;}
  mint operator= (const int x){ return set(x); }
  mint operator+ (const int x){ return mint(_num + (x % _mod) , _mod); }
  mint operator- (const int x){ return mint(_num - (x % _mod), _mod); }
  mint operator* (const int x){ return mint(_num * (x % _mod) , _mod); }
  mint operator/ (int x){ return mint(_num * imod(x) , _mod);}
  mint operator+=(const int x){ return set(_num + (x % _mod)); }
  mint operator-=(const int x){ return set(_num - (x % _mod)); }
  mint operator*=(const int x){ return set(_num * (x % _mod)); }
  mint operator/=(int x){ return set(_num * imod(x));}
  mint operator+ (const mint &x){ return mint(_num + x._num , _mod); }
  mint operator- (const mint &x){ return mint(_num - x._num , _mod);}
  mint operator* (const mint &x){ return mint(_num * x._num , _mod); }
  mint operator/ (mint x){ return mint(_num * imod(x._num) , _mod);}
  mint operator+=(const mint &x){ return set(_num + x._num); }
  mint operator-=(const mint &x){ return set(_num - x._num); }
  mint operator*=(const mint &x){ return set(_num * x._num); }
  mint operator/=(mint x){ return set(_num * imod(x._num));}

  bool operator<(const mint &x){return _num<x._num;}

  friend mint operator+(int x,const mint &m){return mint(m._num + (x % m._mod) , m._mod);}
  friend mint operator-(int x,const mint &m){return mint(m._num - (x % m._mod) , m._mod);}
  friend mint operator*(int x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend mint operator/(int x,mint m){return mint(m.imod(m._num) * x , m._mod);}

  explicit operator int() { return (int)_num; }

  friend ostream& operator<<(ostream &os, const mint &x){ os << x._num; return os; }
  friend istream& operator>>(istream &is, mint &x){int val; is>>val; x.set(val); return is;}
};
signed main(){
    int N;cin>>N;
    string s;cin>>s;
    vector<vector<mint>> dp(N,vector<mint>(N,0));
    REP(i,N) dp[0][i]=1;
    vector<mint> sum(N+1);
    REP(i,N-1){ 
        sum[0]=0;
        REP(j,N-i) sum[j+1]=sum[j]+dp[i][j];
        REP(j,N-i-1){
            if(s[i]=='>'){ 
                dp[i+1][j]=sum[N-i]-sum[j+1];
            }
            if(s[i]=='<'){ 
                dp[i+1][j]=sum[j+1];
            }
        }
    }
    cout<<dp[N-1][0]<<endl;
}

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

int half(int n){
    int i=0;
    while(n%2==0){
        n/=2;
        i++;
    }
    return i;
}

int main(){
    int n; cin>>n;
    int ans=1,sum=0;
    for(int i=1; i<=n; i++){
        if(sum<half(i)){
            ans=i; sum=half(i);
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

int main()
{
    while(1){
    int dp[100][100] = {0},built[100][100] = {0},x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
    dp[1][1] = 1;
    scanf("%d%d%d",&x,&y,&n);
    if(x == 0 && y == 0)break;
    for(int i = 1;i <= n;i++){
        scanf("%d%d",&X,&Y);
        built[X][Y] = -1;
    }
    for(int i = 1;i <= x;i++){
        for(int j = 1;j <= y;j++){
            for(int k = 0;k < 2;k++){
                    if(built[i][j] >= 0){
                        dp[i][j] += dp[i + dx[k]][j + dy[k]];
                }
            }
        }
    }

    printf("%d\n",dp[x][y]);
    }

    return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5+100;
char str[MaxN];int l;
char c[MaxN];

inline void fail() {
	puts("NO");
	exit(0);
}

int main() {
	scanf("%s",str);
	l=strlen(str);
	for (int i=0;i<l;++i) {
		if (!strncmp(str+i,"dream",5)) c[i]='D';
		if (!strncmp(str+i,"erase",5)) c[i]='E';
	}
	for (int i=0;i<l;++i) {
		if (c[i]=='D') {
			for (int j=i+1;j<=i+4;++j) {
				if (c[j]!=0) fail();
				c[j]='d';
			}
			if (i+6<l && !c[i+5] && !c[i+6] && str[i+5]=='e' && str[i+6]=='r') c[i+5]=c[i+6]='d';
		}
		if (c[i]=='E') {
			for (int j=i+1;j<=i+4;++j) {
				if (c[j]!=0) fail();
				c[j]='e';
			}
			if (i+5<l && !c[i+5] && str[i+5]=='r') c[i+5]='e';
		}
		if (!c[i]) fail();
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 384
s=int(input())
def f(x):
  if x%2==0:
    return x/2
  else:
    return 3*x+1

a=set([s])
mae=s
for i in range(100000):
  ai=f(mae)
  if ai in a:
    print(i+2)
    break
  else:
    a.add(ai)
    mae=ai


Measured memory_bytes: 3064
import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def Main():
    n, m = read_ints()
    py = []
    for i in range(m):
        p, y = read_ints()
        py.append([y, p, i])
    py.sort(key=lambda x: x[0])  
    cnt = [0] * n
    ans = [''] * m
    
    for year, prefecture, idx in py:
        cnt[prefecture - 1] += 1
        ans[idx] = f'{prefecture:06d}{cnt[prefecture-1]:06d}'

    print(*ans, sep='\n')        

if __name__ ==  '__main__':
    Main()

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

using namespace std;

typedef long long ll;

int b[80];
ll n;

int main() {
    cin >> n;
    if (n == 0) {
        cout << "0" << endl;
        return 0;
    }
    ll mult = 1;
    ll exp = 0;
    while (n != 0) {
        if (n%abs(2*mult) != 0) {
            b[exp] = 1;
            n-=mult;
        }
        mult*=(-2);
        exp++;
        if (n == 0) {
            break;
        }
    }
    for (ll i = exp-1; i >= 0; i--) {
        cout << b[i];
    }
    cout << endl;
}

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

int main(){

    //データ定義
    int sec;
    int minute;
    int hour;

    //秒データを取得
    cin >> sec;

    //時間、分、秒に分ける
    hour = sec / 3600;
    minute = (sec % 3600) / 60;
    sec %= 60;

    //結果出力
    cout << hour << ":" << minute << ":" << sec << endl;

    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
namespace LCY{
	#define double long double
	const double EPS=1e-10;
	inline int dcmp(double x){if(fabs(x)<EPS)return 0;return (x<0)?-1:1;}
	struct Point{double x,y;Point(double _x=0,double _y=0){x=_x;y=_y;}};
	struct Vector{double x,y;Vector(double _x=0,double _y=0){x=_x;y=_y;}};
	
	Vector operator - (Point a,Point b){return Vector(a.x-b.x,a.y-b.y);}
	Vector operator * (Vector a,double d){return Vector(a.x*d,a.y*d);}
	Point operator + (Point a,Vector b){return Point(a.x+b.x,a.y+b.y);}
	
	inline double dot(Vector a,Vector b){return a.x*b.x+a.y*b.y;}
	inline double cross(Vector a,Vector b){return a.x*b.y-a.y*b.x;}
	inline double norm(Vector a){return dot(a,a);}
	
	struct Line{
		Point p1,p2;
		Line(Point _p1=Point(0,0),Point _p2=Point(0,0)){p1=_p1;p2=_p2;}
	};
	
	Point project(Line l,Point p){
		Vector base=l.p2-l.p1;
		double r=dot(p-l.p1,base)/norm(base);
		return l.p1+base*r;
	}
	Point reflect(Line l,Point p){
		Point q=project(l,p);
		Vector v=p-q;v.x=-v.x;v.y=-v.y;
		return q+v;
	}
}
using namespace LCY;
int main(){
	Point p1,p2;cin>>p1.x>>p1.y>>p2.x>>p2.y;
	int n;cin>>n;while(n--){
		Point q;cin>>q.x>>q.y;Point res=reflect(Line(p1,p2),q);
		cout<<setiosflags(ios::fixed)<<setprecision(10)<<res.x<<" "<<res.y<<endl;
	}
	return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int A, B, C;
  cin >> A >> B >> C;
  if ((A == 7 && B == 5 && C == 5) || (A == 5 && B == 7 && C == 5) ||
      (A == 5 && B == 5 && C == 7)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n;
	int k;
	char str[11];

	scanf("%d", &n);
	scanf("%s", str);
	scanf("%d", &k);

	for (int i = 0; i < n; i++) {
		if (str[i] == str[k - 1]) {
			putchar(str[i]);
		}
		else {
			putchar('*');
		}
	}

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <time.h>
// #define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  string s;
  cin>>s;
  int a = 0;
  if((s[0] == '0' && s[1] >= '1' && s[1] <= '9') || (s[0] == '1' && s[1] >= '0' && s[1] <= '2')) {
    a += 1;
  }
  if((s[2] == '0' && s[3] >= '1' && s[3] <= '9') || (s[2] == '1' && s[3] >= '0' && s[3] <= '2')) {
    a += 10;
  }
  string ans;
  if(a == 11) {
    ans = "AMBIGUOUS";
  }  else if (a == 1) {
    ans = "MMYY";
  } else if (a == 10) {
    ans = "YYMM";
  } else {
    ans = "NA";
  }
  cout << ans << endl;

  // string fi = s.substr(0,2);
  // string se = s.substr(2,2);
  // if(fi) {

  // }
  // int a,b;
  // if()
  // a = stoi(fi);
  // b = stoi(se);
  



  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstring>
using namespace  std;
int main()
{
	const string ori = "CODEFESTIVAL2016";
	string str;
	cin >> str;
	int ret = 0;
	for(int i = 0; i < str.size(); i ++) {
		if(ori[i] != str[i])
			ret ++;
	}
	cout << ret;
}


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

long n;
long a[200000];
long b[200000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
  sort(a, a + n);
  sort(b, b + n);
  
  if (n % 2 == 1) {
    cout << b[n / 2] - a[n / 2] + 1 << endl;
  } else {
    cout << (b[n / 2 - 1] + b[n / 2]) - (a[n / 2 - 1] + a[n / 2]) + 1 << endl;
  }
}

Measured memory_bytes: 6748
import sys
from heapq import heappush, heappop

n, k, *td = map(int, sys.stdin.read().split())
td = list(zip(*[iter(td)] * 2))

def main():
    td.sort(key=lambda x: x[1], reverse=True)
    delis = [[] for _ in range(n+1)]
    cnt = [0] * (n + 1)
    base = 0
    x = 0
    toppings = set()
    for t, d in td[:k]:
        toppings.add(t)
        if cnt[t] == 0:
            x += 1
        cnt[t] += 1
        heappush(delis[t], d)
        base += d
    score = base + x * x

    cand_to_remove = []
    for t in range(1, n+1):
        if cnt[t] >= 2:
            heappush(cand_to_remove, (heappop(delis[t]), t))
            cnt[t] -= 1

    for t, d in td[k:]:
        if not cand_to_remove:
            break
        if t in toppings:
            continue
        r_d, r_t = heappop(cand_to_remove)
        toppings.add(t)
        base -= r_d
        cnt[t] += 1
        heappush(delis[t], d)
        base += d
        x += 1
        if cnt[r_t] >= 2:
            heappush(cand_to_remove, (heappop(delis[r_t]), r_t))
            cnt[r_t] -= 1
        score = max(score, base + x * x)

    return score
        
if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 32552
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
using namespace std;
using ll = long long;

const int MAX = 1000000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

int main()
{

  //cout << fixed << setprecision(10);
  
  rep(i,3){
    rep(j,3){
      char c; cin >> c;
      if (i==j) {cout << c;}
    }
  }

  return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())

flag1 = 1 if a==b and a!=c else 0
flag2 = 1 if a==c and a!=b else 0
flag3 = 1 if b==c and a!=b else 0

ans = 'Yes' if flag1==1 or flag2==1 or flag3==1 else 'No'
print(ans)

Measured memory_bytes: 3060
def partition(A, l, r):
    i = l - 1
    for j in range(l, r):
        if int(A[j][1]) <= int(A[r][1]):
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1

def quick_sort(A, l, r):
    if l < r:
        q = partition(A, l, r)
        quick_sort(A, l, q - 1)
        quick_sort(A, q + 1, r)

n = int(input())
arr = [input().split() + [i] for i in range(n)]
quick_sort(arr, 0, n - 1)
tag = True
for i in range(1, n):
    if arr[i][1] == arr[i - 1][1] and arr[i - 1][2] > arr[i][2]:
        tag = False
        break
print(['Not stable', 'Stable'][tag])
for s in arr:
    print(*s[:2])


Measured memory_bytes: 24416
<?php

$a=explode(' ',trim(fgets(STDIN)));
if($a[0] == $a[1]){
    echo "a == b".PHP_EOL;
}else if($a[0] > $a[1]){
    echo "a > b".PHP_EOL;
}else if($a[0] < $a[1]){
    echo "a < b".PHP_EOL;
}



Measured memory_bytes: 9184
import math
import fractions

def main():

    A,B,C,D = (int(i) for i in input().split())

    CD = C * D / fractions.gcd(C,D)
    #print("CD = ", CD)

    count_C = B//C - (A-1)//C
    #print("count_C = ", count_C)

    count_D = B//D - (A-1)//D
    #print("count_D = ", count_D)

    count_CD = B//int(CD) - (A-1)// int(CD)
    #print("count_CD = ", count_CD)

    print(int(B-A+1 - (count_C + count_D - count_CD)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 5048
import sys
from collections import Counter
n = int(input())
ds = [int(i) for i in sys.stdin.readline().split()]
ds = Counter(ds)
m = int(input())
ts = [int(i) for i in sys.stdin.readline().split()]
ts = Counter(ts)
flg = True
for t, value in ts.items():
    if ds.get(t) is None or ds.get(t) < value:
        flg = False
        break
if flg:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 55520
/*
 * I wish I could travel by the road that crosses baby's mind,
 * and out beyond all bounds;
 * Where messengers run errands for no cause 
 * between the kingdoms of kings of no history;
 * Where Reason makes kites of her laws and flies them, 
 * and Truth sets Fact free from its fetters.
 *                                         Rabindranath Tagore
 */

#include <cstdio>
#include <iostream>
using namespace std;

#ifndef ORZ_EVERYBODY
#define ORZ_EVERYBODY
#endif

const size_t MAX_N = 1e5 + 5;

int par[MAX_N << 1], sz[MAX_N << 1], n, m;

inline int getPar(int x) {
    return par[x] = (par[x] - x ? getPar(par[x]) : x);
}

inline void Union(int x, int y) {
    x = getPar(x); y = getPar(y);
    par[y] = x; sz[x] += sz[y];
}

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1, _ = n << 1; i <= _; ++i) {
        par[i] = i;
        sz[i] = (i <= n);
    }
    for (int i = 0, a, b; i < m; ++i) {
        scanf("%d%d", &a, &b);
        Union(a, b + n);
        Union(b, a + n);
    }
    long long cnt1 = 0, cnt2 = 0;
    for (int i = 1; i <= n; ++i)
        if (getPar(i) == getPar(i + n))
            return cout << 1LL * n * (n - 1) / 2 - m, 0;
        else if (getPar(i) == getPar(1))
            ++cnt1;
        else
            ++cnt2;
    return cout << cnt1 * cnt2 - m, 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

void solve() {
  ll n; cin >> n;

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

  string ans;
  ll d = 1;
  while (n != 0) {
    if (n % (2*d) != 0) {
      ans.push_back('1');
      n -= d;
    }
    else {
      ans.push_back('0');
    }
    d *= -2;
  }

  reverse(all(ans));
  cout << ans << endl;
  return;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int x,y;
    cin>>x>>y;
    if(y%2==0&&y>=2*x&&y<=4*x){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}




Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;

void solve(){
  string s; cin >> s;
  int num = 0, n = 0;
  for(int i = 0; i < s.length(); i++){
    num += s[i] - '0';
    n += (s[i] - '0') * pow(10, s.length() - i - 1);
  }
  if(n % num == 0) cout << "Yes\n";
  else cout << "No\n";
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 384
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input = '';
process.stdin.on('data', function (chunk) {
  input += chunk;
});
process.stdin.on('end', function () {
  var ab = input.split(' ');
  console.log(ab[0] * ab[1] / 3.305785);
});

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

int main()
{
	int a,b;
	cin >> a >> b;
	if(a==1){
		a=a*14;
	}
	
	if(b==1){
		b=b*14;
	}
	
	if(a>b){
		cout << "Alice" << endl;
	}
	else if(a<b){
		cout << "Bob" << endl;
	}
	else{
		cout << "Draw" << endl;
	}
	return 0;
}

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

int main(void){
	char inStr[20];
	char outStr[20];
	int len,i;
	
	scanf("%s", inStr);
	
	len = strlen(inStr);
	
	for(i = 0;i < len; i++){
		outStr[i] = inStr[len - 1 - i];
	}
	outStr[i] = '\0';
	
	printf("%s\n", outStr);
	
	return 0;
}

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

using namespace std;

int main() {

	int n, k; scanf("%d %d", &n, &k);

	vector<int> num;

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

		int a; scanf("%d", &a);
		num.push_back(a);

	}

	for (int i = n; i < 10 * n; i++) {

		string str = to_string(i);

		bool ok = true;

		for (char c : str)
			for (int w : num)
				if (c - '0' == w) ok = false;

		if (ok) {

			printf("%d", i);
			break;

		}

	}

	return 0;

}

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

int main() {
    int n;
    cin >> n;
    int t[n];
    int sumt = 0;
    rep(i,n) {
        cin >> t[i];
        sumt += t[i];
    }
    int m;
    cin >> m;
    P drink[m];
    rep(i,m) {
        cin >> drink[i].first >> drink[i].second;
    }
    rep(i,m) {
        int ans = sumt - t[drink[i].first-1] + drink[i].second;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer a[] = new Integer[N];

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(a, Collections.reverseOrder());
		int A = a[0], B = 0;

		for (int i = 1; i < N; i++) {
			if (i % 2 == 0) {
				A += a[i];
			} else {
				B += a[i];
			}
		}
		System.out.println(A - B);
	}
}


Measured memory_bytes: 23764
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <cassert>
using namespace std;
 
int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k <= a){
        cout << k << endl;
        return 0;
    }
    else if(k <= a+b){
        cout << a << endl;
        return 0;
    }
    else{
        cout << a - (k - (a+b)) << endl;
        return 0;
    }

 }

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==1)
	{
        cout<<"YES"<<endl;
        return 0;
    }
    for(int i=1;i<=100;i++)
        if(a*i%b==c)
        {
            cout<<"YES\n";
            return 0;
        }
    cout<<"NO\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  string S,T;cin>>S>>T;
  
  int ans=0;
  
  for(int i=0;i<3;i++){
    if(S[i]==T[i]){
      ans++;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA'

elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA'
print(out_print)


Measured memory_bytes: 61824
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main(){
    int N,i,j,k,minus=0,zero=0;
    long sums=0,min;
    cin >> N;
    long *A = new long[N];
    for(i=0;i<N;i++){
        cin >> A[i];
        if(A[i]<0) minus++;
        if(A[i]==0) zero++;
    }
    if(zero>0 || minus%2 == 0){
        for(i=0;i<N;i++) sums += labs(A[i]);
    }
    else{
        min = labs(A[0]);
        for(i=0;i<N;i++){
            sums += labs(A[i]);
            if(min>labs(A[i])) min = labs(A[i]);
        }
        sums = sums - 2*min;
    }
    cout << sums << endl;
}

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

int count(const string &S){
    int res=0;
    for(int i = 0; i +1 < S.size();++i){
        if(S[i]=='A'&&S[i+1]=='B')++res;
    }
    return res;
}

int N;
vector<string> S;

long long solve(){
    long long res = 0;
    for(int i = 0; i < N ;i++)res += count(S[i]);
    
    int a = 0 , b = 0 , c = 0;
    for(int i = 0; i < N ; ++i){
        if(S[i][0]=='B'&&S[i][S[i].size()-1]=='A')++a;
        else if (S[i][S[i].size()-1]=='A')++b;
        else if (S[i][0]=='B')++c;
    }
    long long add = 0;
    if(b+c==0)add = max(0,a-1);
    else add = a+min(b,c);
    
    res += add;
    return res;
    
}

int main(){
  cin >> N;
  S.resize(N);
  for(int i = 0; i < N ;i++)cin >>S[i];
  cout << solve()<<endl;  
}









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

#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vec;
typedef vector<pll> vecp;
typedef map<ll, ll> mpll;

const long double PI  = 3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << to_string(H) << endl;
  debug_out(T...);
}
#define LOCAL 3
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:" << endl, debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


void solve()
{
	ll k ,x;
	cin>>k>>x;
	ll aa = 500 * k;
	if(aa >= x) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;	
}


int main()
{
	ll Tests = 1;
    //cin>>Tests;
    while(Tests--)
    {
    	solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i) 
#endif

#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int EPS = 1e-9;
const int MOD = 1e9+7;

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  map<int,int> M;
  REP(i,n){
    int ai;
    cin >> ai;
    M[ai]++;
  }
  vector<int> VI;
  for(auto a:M){
    VI.push_back(a.second);
  }
  sort(ALL(VI));
  reverse(ALL(VI));
  int ans = 0;
  FOR(i,k,SZ(VI)){
    ans += VI[i];
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 10744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<60;

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

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

using namespace std;

const int N=105;
int n,m,a[N],k,b[N],l;

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)scanf("%d",&a[i]),k+=a[i]&1;
	if(k>2)puts("Impossible"),exit(0);
	for(int i=1;i<=m;i++)if(a[i]&1)swap(a[1],a[i]);
	for(int i=2;i<=m;i++)if(a[i]&1)swap(a[i],a[m]);
	for(int i=1;i<=m;i++)printf("%d ",a[i]);puts("");
	if(m==1)++m;for(int i=1;i<=m;i++)b[i]=a[i]-(i==1)+(i==m),l+=b[i]>0;
	printf("%d\n",l);for(int i=1;i<=m;i++)if(b[i])printf("%d ",b[i]);puts("");
	return 0;
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int dp[41][401][401];

int main(){
    int n, ma, mb;
    cin >> n >> ma >> mb;
    vector<int> a(n), b(n), c(n);
    rep(i, n){
        cin >> a[i] >> b[i] >> c[i];
    }
    rep(i, n+1){
        rep(j, 401){
            rep(k, 401){
                dp[i][j][k] = IINF;
            }
        }
    }
    dp[0][0][0] = 0;
    REP(i, 1, n+1){
        rep(j, 401){
            rep(k, 401){
                dp[i][j][k] = dp[i-1][j][k];
                if(j >= a[i-1] && k >= b[i-1]){
                    dp[i][j][k] = min(dp[i][j][k], dp[i-1][j-a[i-1]][k-b[i-1]] + c[i-1]);
                }
            }
        }
    }
    int ans = IINF, l = ma, m = mb;
    while(l <= 400 && m <= 400){
        ans = min(ans, dp[n][l][m]);
        l += ma;
        m += mb;
    }
    if(ans < IINF){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 25984
#include <bits/stdc++.h>
using namespace std;
const int   N=1e2+10,M=1e5+10;
long long f[N][M],w[N],v[N];
int main()
{
	long long n,m;
	cin>>n>>m;
	for(int  i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];
	}
	for(int i=0;i<=n;i++)
		for(int j=0;j<=M;j++)f[i][j]=1e9+1;
	f[0][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=M;j++)
		{

			if(j>v[i])f[i][j]=min(f[i-1][j],f[i-1][j-v[i]]+w[i]);
			else f[i][j]=min(w[i],f[i-1][j]);
		}
	}
	long long ans=0;
	for(long long  j=1;j<=M;j++)
		if(f[n][j]<=m)ans=max(ans,j);
	cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 82508
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
l=list(mi())
l=list(map(lambda x: x*-1 , l))
heapq.heapify(l)
for i in range(b):
  s=heapq.heappop(l)
  s=(-1)*(((-1)*s)//2)
  heapq.heappush(l,s)
ans=0
for i in range(a):
  d=heapq.heappop(l)
  ans+=(-1)*d
print(ans)

Measured memory_bytes: 14736