akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int R, C, N;
int Ri[101010], Ci[101010], Ai[101010];
vector<pair<int, int> > vals[101010];

vector<pair<int, i64> > row[101010], col[101010];
bool rvis[101010], cvis[101010];
i64 rval[101010], cval[101010];
i64 rmin, cmin;

void visit_row(int p, i64 d)
{
//	printf("ro %d\n", p);
	if (rvis[p]) {
		if (rval[p] != d) {
			puts("No");
			exit(0);
		}
		return;
	}
	rvis[p] = true;
	rval[p] = d;
	rmin = min(rmin, d);
	for (auto e : row[p]) {
		visit_row(e.first, d + e.second);
	}
}
void visit_col(int p, i64 d)
{
//	printf("co %d\n", p);
	if (cvis[p]) {
		if (cval[p] != d) {
			puts("No");
			exit(0);
		}
		return;
	}
	cvis[p] = true;
	cval[p] = d;
	cmin = min(cmin, d);
	for (auto e : col[p]) {
		visit_col(e.first, d + e.second);
	}
}

int main()
{
	scanf("%d%d", &R, &C);
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d%d%d", Ri + i, Ci + i, Ai + i);
		--Ri[i]; --Ci[i];
	}

	for (int i = 0; i < C; ++i) vals[i].clear();
	for (int i = 0; i < N; ++i) {
		vals[Ci[i]].push_back({ Ri[i], Ai[i] });
	}
	for (int i = 0; i < C; ++i) if (vals[i].size() >= 2) {
		for (int j = 1; j < vals[i].size(); ++j) {
			row[vals[i][0].first].push_back({ vals[i][j].first, vals[i][j].second - vals[i][0].second });
			row[vals[i][j].first].push_back({ vals[i][0].first, -vals[i][j].second + vals[i][0].second });
		}
	}
	for (int i = 0; i < R; ++i) vals[i].clear();
	for (int i = 0; i < N; ++i) {
		vals[Ri[i]].push_back({ Ci[i], Ai[i] });
	}
	for (int i = 0; i < R; ++i) if (vals[i].size() >= 2) {
		for (int j = 1; j < vals[i].size(); ++j) {
			col[vals[i][0].first].push_back({ vals[i][j].first, vals[i][j].second - vals[i][0].second });
			col[vals[i][j].first].push_back({ vals[i][0].first, -vals[i][j].second + vals[i][0].second });
		}
	}
	for (int i = 0; i < N; ++i) if (!rvis[Ri[i]]) {
		if (cvis[Ci[i]]) {
			int t = 5;
			t /= t - 5;
			return 0;
		}
		rmin = cmin = 0;
		visit_row(Ri[i], 0);
		visit_col(Ci[i], 0);
	//	printf("%d %lld %lld\n", i, rmin, cmin);
		if (Ai[i] + rmin + cmin < 0) {
			puts("No");
			return 0;
		}
	}

	puts("Yes");
	return 0;
}


Measured memory_bytes: 19200
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,long long> pint;
typedef long long ll;
const ll mod= 1e9+7;
const ll  longinf = 1LL<<60;
const int inf=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};


int main(){
  int n;cin>>n;
  int ret=1;
  while(2*ret<=n)ret*=2;
  cout<<ret<<endl;
  return 0;
  }

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

using namespace std;

int main(void)
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    int A, B, C, K;
    cin >> A >> B >> C;
    cin >> K;

    int Bcnt = 0, Ccnt = 0;
    for(; ; Bcnt++)
    {
        if (A<B)
            break;
        B *= 2;
    }
    for(; ; Ccnt++)
    {
        if (B<C)
            break;
        C *= 2;
    }

    if(Bcnt+Ccnt > K)
        cout << "No";
    else
        cout << "Yes";
}


Measured memory_bytes: 3648
// Code for A - αlphabet
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

  if (isupper(N[0])) {
    cout << "A" << endl;
  } else {
    cout << "a" << endl;
  }
  return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

void gcd(int x,int y){
	int a,r;
	if(x<y){
		a=x;
		x=y;
		y=a;
	}
	while(y>0){
		r=x%y;
		x=y;
		y=r;
	}
	printf("%d\n",x);
}

int main(void){
	int x,y;
	scanf("%d %d",&x,&y);
	
	gcd(x,y);
}



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

int main() {
    int N; cin >> N;
    int ans = 0;
    int cnt_max = 0;
    if(N==1){
        cout << 1 << endl;
        return 0;
    }
    for (int i = 1; i <= N; i++)
    {
        int icpy = i;
        int cnt = 0;
        while(1){
            if(icpy%2!=0) break;
            cnt++;
            icpy /= 2;
        }
        if(cnt_max<cnt) {
            cnt_max = cnt;
            ans = i;
        }
    }
    cout << ans << endl;
        
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        x: usize,
        a: usize,
        b: usize,
    }

    println!("{}", (x-a)%b);

}


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

int main(void){
	string S;
	cin >> S;
	int num0=0,num1=0;
	for(int i=0;i<S.size();i++){
		if(S[i]=='0')num0++;
		else num1++;
	}
	cout << 2*min(num0,num1) << endl;
}

Measured memory_bytes: 512
def abc087_c():
    n = int(input())
    a = [list(map(int, input().split())) for _ in range(2)]
    candy = 0

    for i in range(n):
        num = sum(a[0][:i + 1]) + sum(a[1][i:])
        if num > candy:
            candy = num
    print(candy)


abc087_c()

Measured memory_bytes: 3060
#include<stdio.h>
int main(void) {
	int a,b,c,d,e,f,g,h,i,j,k,l,m,n;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	scanf("%d", &e);
	scanf("%d", &f);
	scanf("%d", &g);
	scanf("%d", &h);
	scanf("%d", &i);
	scanf("%d", &j);
	scanf("%d", &k);
	scanf("%d", &l);
	scanf("%d", &m);
	scanf("%d", &n);
	printf("%d\n", a - b);
	printf("%d\n", c - d);
	printf("%d\n", e - f);
	printf("%d\n", g - h);
	printf("%d\n", i - j);
	printf("%d\n", k - l);
	printf("%d\n", m - n);
	return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

#define MOD 1000000007
#define MX 200005

ll fact[MX];
ll invfact[MX];

ll mod_pow(ll x, ll n, ll mod){
  if(n==0) return 1;
  ll res = mod_pow(x * x % mod, n / 2, mod);
  if(n & 1) res = res * x % mod;
  return res;
}
ll mod_comb(ll n, ll k, ll p){
  if(n<0 || k<0 || n<k) return 0;
  return (((fact[n] * invfact[k]) % MOD) * invfact[n-k]) % MOD;
}
void comb_init(){
  fact[0] = fact[1] = 1;
  for(ll i=2; i<MX; i++) fact[i] = (fact[i-1] * i) % MOD;
  invfact[0] = invfact[1] = 1;
  for(ll i=2; i<MX; i++) invfact[i] = mod_pow(fact[i], MOD-2, MOD);
}

int main(){
  comb_init();

  ll N, M, K;
  cin >> N >> M >> K;

  ll ret = 0;

  ll X = mod_comb(M*N-2, K-2, MOD);
  
  REP(i,1,M+1){
    ll tmp = (M-i);
    tmp *= N;
    tmp %= MOD;
    tmp *= N;
    tmp %= MOD;
    tmp *= i;
    tmp %= MOD;
    tmp *= X;
    tmp %= MOD;
    ret += tmp;
    ret %= MOD;
  }
  REP(i,1,N+1){
    ll tmp = (N-i);
    tmp *= M;
    tmp %= MOD;
    tmp *= M;
    tmp %= MOD;
    tmp *= i;
    tmp %= MOD;
    tmp *= X;
    tmp %= MOD;
    ret += tmp;
    ret %= MOD;
  }

  cout << ret << endl;
  
  return 0;
}



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

int D;
vector<int> c(26);
int ss[365][26];
vector<int> ans(0);

double powyabai = 1.2;
double cyabaipow = 1.195;

double evaluate(int day, int kind){

    double yabasa = 0;
    int s = ans.size();
    int idx;
    for(idx = s - 1; 0 <= idx; idx--){
        if(ans[idx] == kind) break;
    }
    yabasa = pow(day - idx, powyabai) * pow(c[kind], cyabaipow);
    double uresisa = ss[day][kind];
    return yabasa + uresisa;
}

int main(){
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D)rep(j, 26) cin >> ss[i][j];
    rep(i, D){
        double max_eva = -inf;
        double choice = 0;
        rep(j, 26){
            if(chmax(max_eva, evaluate(i, j))) choice = j;
        }
        ans.push_back(choice);
    }
    rep(i, D) pt(ans[i] + 1);
    return 0;
}

Measured memory_bytes: 4100
import sys
readline = sys.stdin.readline

N = int(readline())

from collections import defaultdict
dic = defaultdict(int)

for i in range(1, N + 1):
  s = str(i)
  dic[(int(s[0]),int(s[-1]))] += 1
  
ans = 0
for i in range(1, 10):
  for j in range(1, 10):
    ans += dic[(i,j)] * dic[(j,i)]
    
print(ans)

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

int main(){

    ios::sync_with_stdio(0) ;
    string dam ;
    cin >> dam ;
    if(dam[0]==dam[1] && dam[2]==dam[3] && dam[0]!=dam[2]){
        cout << "Yes" ;
        return 0 ;
    }
    if(dam[0]==dam[2] && dam[1]==dam[3] && dam[0]!=dam[1]){
        cout << "Yes" ;
        return 0 ;
    }
    if(dam[0]==dam[3] && dam[1]==dam[2] && dam[0]!=dam[1]){
        cout << "Yes" ;
        return 0 ;
    }
    cout << "No" ;

}


Measured memory_bytes: 256
<?php

function c_p($i,$j){
    global $sum,$a;
    $sum+=1;
    $a[$i][$j]="#";
}

function search($i,$j){
    global $a;
    if(isset($a[$i+1][$j]) and $a[$i+1][$j]=="."){
        c_p($i+1,$j);
        search($i+1,$j);
    }
    if(isset($a[$i-1][$j]) and $a[$i-1][$j]=="."){
        c_p($i-1,$j);
        search($i-1,$j);
    }
    if(isset($a[$i][$j+1]) and $a[$i][$j+1]=="."){
        c_p($i,$j+1);
        search($i,$j+1);
    }
    if(isset($a[$i][$j-1]) and $a[$i][$j-1]=="."){
        c_p($i,$j-1);
        search($i,$j-1);
    }
}


while(1){
    $a = array();
    $sum=1;
    fscanf(STDIN,"%d %d\n",$w,$h);

    if($w==0 && $h==0)
        exit;
    
    for($i=0;$i<$h;$i++){
        fscanf(STDIN,"%s\n",$a[$i]);
        $a[$i] = str_split($a[$i]);
    }
    
//print_r($a);
    for($i=0;$i<$h;$i++){
        for($j=0;$j<$w;$j++){       
            if($a[$i][$j]=="@"){
                $row = $i;
                $col = $j;
            }
        }
    }
    
    $sum=1;
    
    search($row,$col);
    echo $sum."\n";
}


?>

Measured memory_bytes: 7024
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int N,M,sum,i,k;
  cin >> N >> M;
  sum=0;
  for(i=0;i<M;i++)
  {
    cin >> k;
    sum+=k;
  }
  //cout << sum << endl;
  if(N<sum)
  {
    cout << "-1" << endl;
  }
  else
  {
    cout << N-sum << endl;
  }
  
}




Measured memory_bytes: 3600
//#define _USE_MATH_DEFINES
//#include <cmath>

#include <iostream>


using namespace std;

int N, K;

int main()
{

	cin >> N;
	cin >> K;

	int n = 1;
	int ans = 0;

	while (n <= N) {
		n *= K;
		ans++;
	}



	cout << ans << endl;

	return 0;
}



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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N, M;
int A[11];
int req[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
string dp[11000];

string dfs(int n) {
    if (n == 0)return "";
    if (dp[n] != "!")return dp[n];
    string ret = "0";
    for (int i = 0; i < M; i++) {
        if (n < req[A[i]])continue;
        string s = dfs(n - req[A[i]]);
        if (s == "0")continue;
        s.push_back(A[i] + '0');
        if (ret.size() < s.size())ret = s;
        else if (ret.size() == s.size() && ret < s)ret = s;
    }
    return dp[n] = ret;
}

signed main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++)cin >> A[i];
    fill(dp, dp + 11000, "!");
    cout << dfs(N) << endl;
}

Measured memory_bytes: 42112
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

struct Elem {
    int x, y, d, dist, straight;
    Elem(int x_, int y_, int d_, int dist_, int s) :
        x(x_), y(y_), d(d_), dist(dist_), straight(s) {}
    bool operator<(const Elem &e) const {
        if(dist != e.dist) return dist > e.dist;
        return straight > e.straight;
    }
};

int main() {
    int H, W, K; scanf("%d%d%d", &H, &W, &K);
    int sx, sy, gx, gy; scanf("%d%d%d%d", &sx, &sy, &gx, &gy);
    sx--, sy--, gx--, gy--;

    vector<string> board(H);
    for(int i=0; i<H; i++) {
        cin >> board[i];
    }
    
    const pair<int, int> NIL(INF, INF);
    vector< vector< vector< pair<int, int> > > >
        ans(H, vector< vector< pair<int, int> > >(W,
                                                  vector< pair<int, int> >(4, NIL)));

    priority_queue<Elem> que;
    for(int k=0; k<4; k++) {
        ans[sx][sy][k] = make_pair(0, 0);
        que.emplace(sx, sy, k, 0, 0);
    }
    while(que.size()) {
        // Elem e = que.front(); que.pop();
        Elem e = que.top(); que.pop();
        int x = e.x, y = e.y, d = e.d, dist = e.dist, straight = e.straight;
        if(make_pair(dist, straight) > ans[x][y][d]) continue;
        for(int nd=0; nd<4; nd++) {
            int nx = x + dx[nd], ny = y + dy[nd];
            if(nx < 0 or nx >= H or ny < 0 or ny >= W) continue;
            if(board[nx][ny] == '@') continue;

            int n_dist = dist, n_straight = straight + 1;
            if(d != nd or straight == K) {
                n_dist++;
                n_straight = 1;
            }
            if(make_pair(n_dist, n_straight) < ans[nx][ny][nd]) {
                ans[nx][ny][nd] = make_pair(n_dist, n_straight);
                que.emplace(nx, ny, nd, n_dist, n_straight);
            }
        }
    }

    int res = INF;
    for(int k=0; k<4; k++) {
        if(ans[gx][gy][k] == NIL) continue;
        int cand = ans[gx][gy][k].first;
        if(ans[gx][gy][k].second > 0) cand++;
        chmin(res, cand);
    }
    if(res == INF) puts("-1");
    else printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 144968
n , k , s = map(int,input().split())
l = []
for i in range(k):
    l.append(s)
if s == 1:
    t = 3
elif s == 10**9:
    t = 1
else:
    t = s + 1

for i in range(n-k):
    l.append(t)


print(' '.join(map(str, l)))

Measured memory_bytes: 12056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

bool check(vector<int> &v, int k){
    int V = v.size();
    const int M = V/2;

    vector<int> pos[M];
    rep(i,V) pos[v[i]].pb(i);
    rep(i,M){
        int val = 0;
        for(int j=pos[i][0]; j<=pos[i][1]; ++j) val ^= v[j];
        if(val != k) return false;
    }
    return true;
}

int main(){
    int m,k;
    cin >>m >>k;

    vector<int> v;
    if(m<=1){
        if(k==0) rep(i,1<<m)rep(j,2) v.pb(i);
    }
    else{
        int M = 1<<m;
        if(0<=k && k<M){
            v.pb(k);
            rep(i,M)if(i!=k) v.pb(i);
            v.pb(k);
            for(int i=M-1; i>=0; --i)if(i!=k) v.pb(i);
        }
    }

    // if(!v.empty()) assert(check(v,k));
    int V = v.size();
    if(V==0) cout << -1 << "\n";
    else rep(i,V) cout << v[i] << " \n"[i==V-1];
    return 0;
}


Measured memory_bytes: 2932
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;
const bool DEBUG = false;

signed main() {
	string S[3]; cin >> S[0] >> S[1] >> S[2];
	int k = 0;
	int cnt[3] = {-1,-1,-1};
	int ans;
	S[0] += 'a';
	S[1] += 'b';
	S[2] += 'c';
	while (true) {
		cnt[k]++;
		dump(k);
		dump(cnt[k]);
		if (cnt[k] == S[k].size()) {
			ans = k; break;
		}
		k = S[k][cnt[k]] - 'a';
	}
	cout << (char)(k + 'A') << endl;
	return 0;
}

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

#define FOR(i,s,t ) for (int i = s; i < t ; i++)
using LL = long long; using VI = vector<int>;
using VL = vector<LL>; using VVI = vector<VI>;
const LL LINF = 1e18; const int INF = 1e9;
#define SZ(a) (int)a.size()


void solve() {

	int N;
	cin >> N;
	LL p = 1;
	int ans = 0;
	while (p < N) {
		ans++;
		p *= 3;
	}
	cout << ans << endl;
}

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

	solve();
	return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int l;
char s[20];
int main(){
	scanf("%s",s+1);
	l=strlen(s+1);
	int ans=15-l;
	for(int i=1;i<=l;i++)
	if(s[i]=='o')ans++;
	if(ans>=8)puts("YES");
	else puts("NO");
	return 0;
}


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

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

int building[4][3][10];
int n, b, f, r, v;

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

    cin >> n;
    REP(i, n) {
        cin >> b >> f >> r >> v;
        building[b - 1][f - 1][r - 1] += v;
    }

    REP(i, 4) {
        REP(j, 3) {
            REP(k, 10) {
                cout << ' ' << building[i][j][k];
            }
            cout << '\n';
        }
        if (i != 3) {
            cout << "####################" << '\n';
        }
    }
    return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  ll ans = n* n*n;
  cout << ans<< endl;
  return 0;
}


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

int main(){
  int N, R;
  int rate;

  cin >> N;
  cin >> R;

  if(N <= 10 && N >=1 ){
    rate = R+(100*(10-N));
    cout << rate << '\n';
  }else if(N > 10 && N <= 100){
    rate = R;
    cout << rate << '\n';
  }
  return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  if ((N > 1) && (M > 1)) {
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
  } else if (N > 1) {
    cout << N * (N - 1) / 2<< endl;
  } else if (M > 1) {
    cout << M * (M - 1) / 2 << endl;
  } else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
n = input()
co = 0
su = 0
a = [n[0]]

for i in range(len(n)-1):
    if len(a) == 0:
        a.append(n[i+1])
    else:
        t = n[i+1]
        if t == "T":
            if a[-1] == "S":
                a.pop()
            else:
                a.append(t)
        else:
            a.append(t)
print(len(a))

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979
#define EPS 1e-8
#define mod  998244353
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define NEG_INF -2e18
			 
const ll INF=1e15;	
const int N=2e5+50;
		 
 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(0);
		
	ll n,k;
	cin>>n>>k;
	
	vector<pair<ll,ll> > seg(k);
	
	for(int i=0;i<k;i++)
	{
		cin>>seg[i].fi>>seg[i].se;
	}
	
	ll ans=0;
	vector<ll> dp(n+1,0);
	dp[1]=1;
	
	for(int i=2;i<=n;i++)
	{
		ll val=0;
		for(ll j=0;j<k;j++)
		{
			if(i-seg[j].fi>=1)
			{
				 val+=dp[i-seg[j].fi];
				 val%=mod;
				
			}
			if(i-seg[j].se>1)
			{
				val-=dp[i-seg[j].se-1];
				val%=mod;
				 val+=mod; 	
				 val%=mod;
			}
		}
		dp[i]=val+dp[i-1];
		dp[i]%=mod;
		
		//cout<<i<<" "<<dp[i]<<endl;
	}

	cout<<((dp[n]-dp[n-1])%mod+mod) %mod;
	
	
}


Measured memory_bytes: 4772
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define	PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vll vector<ll>
#define vbl vector<bool>
#define vpll vector<pll>
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(x) x.begin(),x.end()
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define mod 1000000007
#define INF 1000000000000000
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set_pll;
#define ook order_of_key
#define fbo find_by_order
/*  
	Query 1 - order_of_key(k) : Number of items strictly smaller than k.
	Query 2 - find_by_order(k) : K-th element in the set (counting from zero).
	less<ll> means Query 1 will return numbers strictly less than k.
	greater<ll> means Query 1 will return numbers strictly greater than k.
*/
ll powmod(ll x, ll n){
	ll res = 1;
	while(n){
		if(n & 1){
			res *= x;
			res %= mod;
		}
		x *= x;
		x %= mod;
		n >>= 1;
	}
	return res;
}
ll invmod(ll a){
	return powmod(a, mod - 2);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin >> n;
	ll k = 1;
	vll a(n);
	ll b = 0;
	for(ll i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] == k){
			k++;
		}
		else{
			b++;
		}
	}
	if(b == n){
		b = -1;
	}
	cout << b;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int A, B;
    cin >> A >> B;
    for (int i = 10; i <= 1000; ++i)
    {
        if (int(i * 0.08) == A && int(i * 0.1) == B)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

int main()
{
    int t;
    cin>>t;
   
    
    int l=0;
    
    while(t>0)
    {
        int z=t%10;
        if(z==7)
        l=1;
        t/=10;
    }
    
    if(l==1)
    cout<<"Yes";
    else
    cout<<"No";
    
    
    return 0;
}


Measured memory_bytes: 3632
#include <cstdio>

int m[16];

int main()
{
  for(int i=0;i<10;i++)
    scanf("%d", m+i);

  for(int i=0;i<3;i++){
    int idx = 0;
    for(int j=0;j<10;j++)
      if(m[idx] < m[j]) idx = j;

    printf("%d\n", m[idx]);
    m[idx] =  -1;
  }
  return 0;
}

Measured memory_bytes: 1028
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>

using namespace std;

int main(){
    int x, a;
    cin >> x >> a;
    if(x < a){
        cout << 0 << endl;
    }else{
        cout << 10 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int type = 26;
        int n = sc.nextInt();
        int[] c = new int[type];
        int[][] s = new int[n+1][type];
        for (int i = 0; i < type; i++) {
            c[i] = sc.nextInt();
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < type; j++) {
                s[i][j] = sc.nextInt();
            }
        }
        
        int[] last = new int[type];
        
        int[] t = new int[n+1];
        for (int i = 1; i <= n; i++) {
            t[i] = sc.nextInt() - 1;
        }
        
        int ans = 0;
        
        // 1日毎に計算する
        for (int i = 1; i <= n; i++) {
            // 開催するコンテストを選択
            int contest = t[i];
            last[contest] = i;
            
            // 満足度上昇
            ans += s[i][contest];
            
            // 満足度減少
            for (int j = 0; j < type; j++) {
                ans -= c[j] * (i - last[j]);
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 46448
n, a, b, k = map(int, input().split())

mod = 998244353

# combination---
# nとmodは適宜変える

fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n+5):
    fac.append(fac[i-1] * i % mod)
    inv.append(mod - inv[mod%i] * (mod//i) % mod)
    finv.append(finv[i-1] * inv[i] % mod)

def nck(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

ans = 0
for ca in range(n+1):
    cb = (k - a * ca) // b
    if (k - a * ca) % b != 0:
        continue
    ans += nck(n, ca) * nck(n, cb)
    ans %= mod

print(ans)


Measured memory_bytes: 100464
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    res = 1
    A = list(map(int, readline().rstrip().split()))
    if 0 in A:
        print(0)
        return
    for a in A:
        res *= a
        if res > 10 ** 18:
            print(-1)
            return

    print(res)
    

if __name__ == '__main__':
    main()

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

#define int int64_t

signed main() {
	int N, K;
	cin >> N >> K;

	int zeroAs = 0;
	vector<int> minusAs;
	vector<int> plusAs;
	minusAs.reserve(N);
	plusAs.reserve(N);

	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		if (a == 0) {
			zeroAs++;
		}
		else if (a < 0) {
			minusAs.push_back(a);
		}
		else {
			plusAs.push_back(a);
		}
	}

	sort(minusAs.begin(), minusAs.end());
	sort(plusAs.begin(), plusAs.end());

	int minusCount = minusAs.size() * plusAs.size();
	int plusCount = (minusAs.size() * (minusAs.size() - 1) / 2) +
		(plusAs.size() * (plusAs.size() - 1) / 2);
	int zeroCount = zeroAs * (zeroAs - 1) / 2 +
		zeroAs * (minusAs.size() + plusAs.size());

	if (K <= minusCount) {
		reverse(plusAs.begin(), plusAs.end());

		auto IsPossible = [&](int x) {
			int cnt = 0;
			for (int i = 0; i < minusAs.size(); ++i) {
				int a = minusAs[i];
				int l = -1;
				int r = plusAs.size();
				while (r - l > 1) {
					int c = (l + r) / 2;
					if (a * plusAs[c] < x) {
						l = c;
					}
					else {
						r = c;
					}
				}
				cnt += r;
			}
			return cnt < K;
		};

		int l = INT64_MIN / 3;
		int r = INT64_MAX / 3;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (IsPossible(c)) {
				l = c;
			}
			else {
				r = c;
			}
		}
		cout << l << endl;
	}
	else if (K <= minusCount + zeroCount) {
		cout << 0 << endl;
	}
	else {
		K -= minusCount + zeroCount;

		reverse(minusAs.begin(), minusAs.end());

		auto IsPossible = [&](int x) {
			int cnt = 0;
			for (int i = 0; i < minusAs.size(); ++i) {
				int a = minusAs[i];
				int l = -1;
				int r = minusAs.size();
				while (r - l > 1) {
					int c = (l + r) / 2;
					if (a * minusAs[c] < x) {
						l = c;
					}
					else {
						r = c;
					}
				}

				r -= (i + 1);
				if (r < 0) {
					r = 0;
				}
				cnt += r;
			}
			for (int i = 0; i < plusAs.size(); ++i) {
				int a = plusAs[i];
				int l = -1;
				int r = plusAs.size();
				while (r - l > 1) {
					int c = (l + r) / 2;
					if (a * plusAs[c] < x) {
						l = c;
					}
					else {
						r = c;
					}
				}
				r -= (i + 1);
				if (r < 0) {
					r = 0;
				}
				cnt += r;
			}
			return cnt < K;
		};

		int l = INT64_MIN / 3;
		int r = INT64_MAX / 3;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (IsPossible(c)) {
				l = c;
			}
			else {
				r = c;
			}
		}
		cout << l << endl;
	}
}


Measured memory_bytes: 4636
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
dic = Counter(A)
cnt = 1
Mcnt = 1
for i in range(0,N):
  if (i-1) in dic and (i+1) in dic:
      cnt = dic[i-1] + dic[i] + dic[i+1]
  elif (i-1) in dic:
      cnt = dic[i-1] + dic[i]
  elif (i+1) in dic:
      cnt = dic[i] + dic[i+1]
  else:
      cnt = dic[i]
  if Mcnt < cnt:
    Mcnt = cnt
print(Mcnt)


Measured memory_bytes: 14564
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >> n;
  string s1,s2;
  cin >> s1 >> s2;
  string ds = "";
  rep(i,n){
    if(s1[i] == s2[i]) ds.push_back('s');
    if(s1[i] != s2[i]){
      ds.push_back('d');
      i ++;
    }
  }
  int m = ds.size();
  ll ans = 1;
  rep(i,m){
    if(i == 0){
      if(ds[i] == 'd') ans = 6;
      if(ds[i] == 's') ans = 3;
    }
    if(i > 0){
      if(ds[i-1] == 's' && ds[i] == 'd'){
        ans *= 2;
        ans %= 1000000007;
      }
      if(ds[i-1] == 'd' && ds[i] == 'd'){
        ans *= 3;
        ans %= 1000000007;
      }
      if(ds[i-1] == 's' && ds[i] == 's'){
        ans *= 2;
        ans %= 1000000007;
      }
    }
  }
  cout << ans << endl;
}

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

int read(){
    int x=0;bool f=0;char c=getchar();
    while(c<'0'||c>'9') f|=c=='-',c=getchar();
    while(c>='0'&&c<='9') x=x*10+(c^48),c=getchar();
    return f?-x:x;
}

#define PI acos(-1)

int main(){
    int A,B,X;
    scanf("%d%d%d",&A,&B,&X);
    double M=2.0*X/(A*B);
    if(M-A<=1e-6)
        printf("%.8f",90-atan(M/B)/PI*180);
    else{
        double H=(double)(A*A*B-X)/(A*A)*2;
        printf("%.8f",90-atan((double)A/H)/PI*180);
    }
}


Measured memory_bytes: 256
n = gets.to_i
s = gets.chomp
i = 0
j = 1
max = 0
while j < n
  if s[j..-1][s[i..j-1]]
    max = j-i if max < j-i
    j += 1
  else
    i += 1
  end
  j += 1 if i == j
end
puts max

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

int main() {
	double d;
	cin >> d;

	double t;
	cin >> t;

	double s;
	cin >> s;

	double totalT = d / s;
	if (totalT > t) {
		cout << "No";
	} else {
		cout << "Yes";
	}
}

Measured memory_bytes: 3732
#include <stdio.h>

int main(void)
{
  int W,H,x,y,r;

  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);

  if (x+r<=W && x-r>=0)
    if (y+r<=H && y-r>=0)
      printf ("Yes\n");
    else
      printf  ("No\n");
    else
      printf ("No\n");

  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <climits>
#include <vector>
#include <numeric>
#include <algorithm>

int main(){
  int n;
  std::vector<int> people;

  std::cin >> n;
  for(int i=0; i<n; i++){
    int x;
    std::cin >> x;
    people.push_back(x);
  }
  
  std::sort(people.begin(), people.end());
  unsigned int v=UINT_MAX;
  unsigned int tmp = 0;
  
  for(int i = people[0]; i <= people[n-1]; i++){
    tmp = 0;
    for(auto itr = people.rbegin(); itr != people.rend(); ++itr) {
        tmp += (i - *itr) * (i - *itr);
    }
    v = std::min(v, tmp); 
  }
  std::cout << v << std::endl;
  return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	bool flag[3] = {};

	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'a') flag[0] = true;
	}
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'b') flag[1] = true;
	}
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'c') flag[2] = true;
	}

	if (flag[0] == true && flag[1] == true && flag[2] == true)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

template<class T>
inline void read(T& x) {
  T s = 0, base = 1;
  char c;
  while (!isdigit(c=getchar())) if (c == '-') base = -base;
  while (isdigit(c)) {
    s = s * 10 + (c^48);
    c = getchar();
  }
  x = base * s;
}

string S;

int main() {
  cin >> S;

  int cnt = -1;
  bool check = true;

  if (S[0] == 'A') {
    cnt = 0;
    for (int i = 2; i < S.length() - 1; ++i) {
      if (S[i] == 'C') cnt += 1;
    }
  }

  for (int i = 1; i < S.length(); ++i) {
    if (!('a' <= S[i] && S[i] <= 'z')) {
      if (!(S[i] == 'C' && 2 <= i && i <= S.length() - 2)) check = false;
    }
  }
 
  if (check && cnt == 1) printf("AC\n");
  else printf("WA\n");
  return 0;
}


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

int main(){
  char s[20];
  scanf("%s", s);
  int i = 2;
  int min = 999;
  int k;
  while(s[i] != NULL){
    k = 100*(int)s[i-2] + 10*(int)s[i-1] + (int)s[i] - 4800 - 480 - 48;
    if(min > abs(k - 753)){
      min = abs(k - 753);
    }
    i++;
  }
  printf("%d\n", min);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    string S;
    cin >> S;
    const int n = S.size();

    VEC(int) rem(2019, 0);
    rem[0] = 1;

    int r = 0, p10 = 1;
    lint ret = 0;
    FORD(i, n - 1, -1) {
        int dig = S[i] - '0';
        r = (p10 * dig + r) % 2019;
        p10 = p10 * 10 % 2019;
        ret += rem[r];
        rem[r]++;
    }

    cout << ret << endl;
    return 0;
};


Measured memory_bytes: 3744
#include<iostream>
using namespace std;
int main(){
int x,y,a,b;
  cin >> x >> y;
  for(a=0;a<=x;a++){
  b=x-a;
    if(a*2+b*4==y){
    cout << "Yes" << endl;
      return 0;
      break;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3588
A,B,C,D = map(int, input().split())
THP = A
AHP = C
while(True):
    #高橋のターン
    AHP -= B
    if(AHP <= 0):
        print("Yes")
        break
    #青木のターン
    THP -= D
    if(THP <= 0):
        print("No")
        break

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

void str_change(char s[], int g)
{
  int count = 0;
  int j;
  char box[201] = {'\0'};
  
  while(s[g + count]) {
    box[count] = s[g +count];
    count++;
  }

  for (j = 0; j < g; j++) {
    box[count + j] = s[j];
  }

  j = 0;
  while(box[j]){
    s[j] = box[j];
    j++;
  }
 
    }


 
int main(void){
  char str[201] = {'\0'};
  char box[201] = {'\0'};
  int m;
  int i;
  int h;
  char end[] = "-";

  while(1) {
    scanf("%s", str);
    if(strcmp(str, end) == 0)
      break;
    
    scanf("%d", &m);
    
    for (i = 0; i < m; i++) {
      scanf("%d", &h);
      str_change(str, h);
    }
    printf("%s\n", str);
  }
  

  return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ans=1,t;
    cin>>n;
    cin>>t;
    for(int i=0;i<n-1;i++){
        int x;
        scanf("%d",&x);
        if(x<t)ans++,t=x;
    }
    cout<<ans<<endl;
    return 0;
}

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

long long g(long long a,long long b);

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    long long x,y;
    cin>>x>>y;
    cout<<g(x,y)<<'\n';
    return(0);
}

long long g(long long a,long long b){
    while(b!=0){
    long long r=a%b;
    a=b;
    b=r;
    }
    return(a);
}



Measured memory_bytes: 3212
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define rep(i, a, b) for(int i=(a); i<(b); i++)

int main() {
	IOS
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	int ans = H*W;
	ans -= h*W;
	ans -= H*w;
	ans += h*w;
	cout << ans;
	return 0;
}


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

using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	if(n % 2 == 1) {
		cout << "No" << '\n';
		return 0;
	}
	string t = "";
	for(int i = 0; i < n / 2; ++i) {
		t += "hi";
	}
	if(s == t) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
    ll h, w, d;
    cin >> h >> w >> d;
    vector<pair<ll, ll>> map(h * w);
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            ll a;
            cin >> a;
            a--;
            map.at(a) = make_pair(i, j);
        }
    }

    vector<ll> cost(map.size(), 0);
    for(int i = 0; i < d; ++i){
        for(int j = i + d; j < map.size(); j += d){
            cost.at(j) = cost.at(j - d) + 
                abs(map.at(j - d).first - map.at(j).first) +
                abs(map.at(j - d).second - map.at(j).second);
        }
    }

    ll q;
    cin >> q;
    vector<ll> ans(q, 0);
    for(int i = 0; i < q; ++i){
        ll l, r;
        cin >> l >> r;
        l--; r--;
        ans.at(i) = cost.at(r) - cost.at(l);
    }

    for(ll a : ans){
        cout << a << endl;
    }
    return 0;
}


Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
  int Mou[10];
  int i;
  int n = 0;

  for(i = 0; i < 10; i++){
    cin >> Mou[i];
    n++;
  }

  sort(Mou , Mou + n);

    cout << Mou[n-1] << endl;
    cout << Mou[n-2] << endl;
    cout << Mou[n-3] << endl;
  
    return 0;
}

Measured memory_bytes: 1176
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int a,b;
  cin>>a>>b;
  if(a%b==0)cout<<0<<endl;
  else cout<<1<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}

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

    while(true) {
        bool sosuu = true;
        for(int i = 2; i * i <= X; i++) {
            if(X % i == 0) {
                sosuu = false;
                break;
            }
        }
        if(sosuu) {
            cout << X << endl;
            break;
        }
        X++;
    }
}


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

#define int long long

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

  int ans = 0;

  for(int i = 1;i<=n;i++){
    int a;
    cin >> a;
    a--;
    ans+=a;
  }

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


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll x, a;cin >> x >> a;
	if(x < a)cout << 0 << endl;
	else cout << 10 << endl;

	return 0;
}


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

int dp[101010];

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

	fill_n(dp, 101010, 1e9+1);
	dp[0] = 0;
	for (int i=0; i<n; ++i) {
		for (int ki=1; ki<=k; ++ki) {
			if (i+ki < n) dp[i+ki] = min(dp[i+ki], dp[i] + abs(h[i+ki] - h[i]));
		}
	}

	int ans = dp[n-1];
	cout << ans << endl;
	
  return 0;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  int C = A + B;
  if(A % 3 == 0 || B % 3 == 0 || C % 3 == 0){
    cout << "Possible" << endl;
  }
else{
  cout << "Impossible" << endl;
}
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vvi g(n+1);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vi dist(n+1, -1);
  queue<int> que;
  vi prev(n+1);
  dist[1] = 0;
  que.push(1);
  while(!que.empty()){
    int v = que.front();
    que.pop();
    for(int nv : g[v]){
      if(dist[nv] != -1) continue;
      dist[nv] = dist[v] + 1;
      que.push(nv);
      prev[nv] = v;
    }
  }
  cout << "Yes" << endl;
  for(int i=2; i<=n; i++){
    cout << prev[i] << endl;
  }
}


Measured memory_bytes: 10608
#include <stdio.h>
int main (int argc, char * argv[])
{
    int n;//個数
    int x;//sumと比較の値
    int count=0;//組み合わせの個数
    int sum;//i,j,kの合計
    while(1){
        //countのリフレッシュ
        count =0;
        //n xの値入力
        scanf("%d %d",&n,&x);
        //0 0だった場合break
        if(n==0 && x==0)break;
        
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                for(int k=1;k<=n;k++){
                    //重複しなかった場合
                    if(!(i==j==k) && !(i==j) && !(j==k) && !(i==k)){
                        //合計を求める
                        sum = i+j+k;
                        //sum==xだった場合countを加算
                        if(sum==x){
                            count++;
                        }
                    }
                }
            }
        }
        
        printf("%d\n",count/6);
    }
    return 0;
}



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

int main() {
  string S;
  cin >> S;
  
  int n = S.size() + 1;
  vector<ll> a(n, 0);
  ll cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (S[i] == '>') {
      a.at(i + 1) = cnt;
      cnt++;
      a.at(i) = cnt;
    } else {
      cnt = 0;
    }
  }
  if (cnt != 0) a.at(0) = cnt;
  
  cnt = 0;
  for (int i = 0; i < n; i++) {
    if (S[i] == '<') {
      cnt++;
      a.at(i + 1) = max(a.at(i + 1), cnt);
    } else {
      cnt = 0;
    }
  }
  
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a.at(i);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 4740
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
int main(){
  int x,ans=0;
  cin>>x;
  for(int i=2; i<=9; i++){
    for(int j=1; j<=sqrt(x); j++){
      if(ans<pow(j,i) && pow(j,i)<=x){
        ans = pow(j,i);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
 int n , m;
 cin >> n >> m;
 vector<int> a(m),b(m);
  for(int i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i) ;
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  
// cout <<  b.at(0) << a.at(m-1);
  if (b.at(0) >= a.at(m-1)){
  cout<< b.at(0) - a.at(m-1)+1 ;
  }
  else {
    cout << 0;
  }
}


Measured memory_bytes: 1024