akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long X, long long Y, long long Z) {
  swap(X,Y); swap(X,Z);
  cout << X << " " << Y << " " << Z << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long X;
  std::cin >> X;
  long long Y;
  std::cin >> Y;
  long long Z;
  std::cin >> Z;
  solve(X, Y, Z);
  return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b,c; cin>>a>>b>>c;
	if(a+b==c) cout<<"Yes";
	else if(a+c==b) cout<<"Yes";
	else if(b+c==a) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   

struct z{
  ll x;
  ll y;
  ll l;
};

int main(){
  ll i,j;
  ll h,w; cin>>h>>w;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = -1;
  
  bool judge = true;
  ll k[h][w];
  vector<string> a(h);
  for(i=0;i<h;i++){
    cin >> a[i];
    for(j=0;j<w;j++){
      k[i][j]=0;
      if(a[i][j]=='.')result++;
    }
  }
  queue<struct z> p;
  p.push({0,0,1});
  while(!p.empty()){
    ll x=p.front().x;
    ll y=p.front().y;
    ll l=p.front().l;
    if(x==h-1&&y==w-1){buf=l;break;}
    if(k[x][y]==0&&a[x][y]=='.'){
      k[x][y]=1;
      if(x<=h-2)p.push({x+1,y,l+1});
      if(y<=w-2)p.push({x,y+1,l+1});
      if(x>=1)p.push({x-1,y,l+1});
      if(y>=1)p.push({x,y-1,l+1});
    }
    p.pop();
  }
  
  //cout<<result spa buf<<endl;
  if(buf==-1)result=-1;
  else result-=buf;
  cout<<result<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define UNIQ(v) do { sort(ALL(v)); v.erase(unique(v.begin(), v.end()), v.end()); } while(0)

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

#define MAX 102000
bool prime[MAX];

void erat()
{
	fill(prime, prime+MAX, true);
	prime[0] = false;
	prime[1] = false;
	for (int i = 2; i < MAX; i++)
		for (int j = 2*i; j < MAX; j += i)
			prime[j] = false;
}

int main(void)
{
	int n, p;
	erat();
	while (cin >> n >> p, !(n == -1 && p == -1)) {
		vector<int> vs;
		vector<int> ans;
		for (int i = n+1, cnt = 0; cnt <= p; i++)
			if (prime[i])
				vs.push_back(i), cnt++;

		rep(i, vs.size())
			REP(j, i, vs.size())
				ans.push_back(vs[i]+vs[j]);
		sort(ALL(ans));

		cout << ans[p-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1376
let rec main n =
	if n>0 then Scanf.sscanf (read_line ()) "%d %d %d" (fun y m d ->
		print_int (196471-((y-1)*195)-(y-1)/3*5-(m-1)*20+(if ((y mod 3)==0) then 0 else (m-1)/2)-d); print_string "\n";main (n-1)
	);;

let n = read_int() in main n;;

Measured memory_bytes: 2312
#include <bits/stdc++.h>
  
using namespace std;
 
#define endl "\n"
#define JAM(x) cout<< #x <<" = "<<x<<"\n"

 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef vector<PII> VPI;
 
const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);



long long int power(long long int a,long long int b)
{
    a %= MOD;
    long long int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
bool isprime(int n)
{
    if(n==1)
    return 0;
    int i;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return false;
    }
    return true;
}




/*_______________________________________________*/





int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int i,j,k;
    long int ans=0;
    for(i=1;i<=n;i++)
    {
        int temp=n/i;
        if(n%i==0)
        temp--;
        ans+=temp;
    }
    cout<<ans;
}


Measured memory_bytes: 3648
#include<iostream>
struct D{int a,b,c;};
main(){
  int a,b,c,N,i,w,x,y,z,m[301];
  D t[1001];
  for(;std::cin>>a>>b>>c>>N,a;){
    for(i=301;i>0;)m[--i]=2;
    for(;N-->0;){
      std::cin>>w>>x>>y>>z;
      D d={w,x,y};
      if(z)m[w]=m[x]=m[y]=1;
      else t[i++]=d;
    }
    for(;i>0;){
      if((m[t[--i].a]&1)+(m[t[i].b]&1)+(m[t[i].c]&1)==2){
	m[t[i].a]&=1;
	m[t[i].b]&=1;
	m[t[i].c]&=1;
      }
    }
    for(;i++<a+b+c;)printf("%d\n",m[i]);
  }
}

Measured memory_bytes: 0
def ipt(N=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        return [list(map(int,input().split())) for _ in range(N)]

cnt=0
A,B=ipt()
for i in range(A,B+1):
    if i//10000 == i%10 and (i//1000)%10 == (i%100)//10:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
#include <cmath>

using namespace std;

struct str
{
    int h;
    int i;
    bool operator <(const str &a) const
    {
        return h != a.h ? h > a.h : i < a.i;
    }
};

int arr[100010];
long long res[100010];

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    int n, i;
    scanf("%d", &n);
    for(i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    vector<str> v;
    for(i = 0; i < n; i++)
        v.push_back({ arr[i], i });

    sort(v.begin(), v.end());

    int h = v[0].h;
    int idx = v[0].i;
    int p = 1;
    while(h > 0)
    {
        while(p < n && v[p].h == h)
        {
            idx = min(idx, v[p].i);
            p++;
        }
        
        int nx = (p == n) ? 0 : v[p].h;
        res[idx] += 1LL * p * (h - nx);
        h = nx;
    }

    for(i = 0; i < n; i++)
        printf("%lld\n", res[i]);
    return 0;
}

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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;

//ここから書き始める
int main()
{
	cout << setprecision(10);
	int n; cin >> n;
	ll a[100100][3];
	rep(i,n){ 
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	vector<vector<ll>> dp(100100,vector<ll> (3));
	dp[0][0] = dp[0][1] = dp[0][2] = 0;
	for(int i =  1; i < n + 1 ; i ++){
		rep(j,3){
			rep(k,3){
				if(j!=k){
					chmax(dp[i][j],dp[i-1][k]+a[i-1][j]);
				}
			}
		}
	}
//	for(int i = 0 ; i <= n ; i++){
//		cout << "dp["<<i<<"]= " ;
//		for(int j = 0 ; j < 3 ;j ++){
//			cout << dp[i][j]<<" ";
//		}
//		cout << endl;
//	}
	ll ans = 0;
	rep(i,3){
		chmax(ans, dp[n][i]);
	}
	cout << ans << endl;

	

}


Measured memory_bytes: 8064
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <string.h>

int main(int argc, char *argv[])
{
	int n,m;
	cin >> n>>m;
	
	int a[100001];
	int pe[100001];
	memset(a,0,sizeof(a));
	memset(pe,0,sizeof(pe));

	int ac=0;

	for (int i=0;i<m;i++)
	{
		int p;
		string s;
		cin>>p>>s;
		if (s=="WA")
		{
			if (a[p]==0) pe[p]++;
		}
		else if(s=="AC")
		{
			if (a[p]==0) ac++;
			a[p]=1;
		}
	}
	int pc=0;
	for (int i=1;i<=n;i++)
	{
		if (a[i]) pc+=pe[i];
	}

	cout<<ac<<" "<<pc<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {

	long long X;
	cin >> X;
	cout << (X / 500) * 1000 + ((X % 500) / 5) * 5 << endl;


}

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

int main()
{
    int n, l, r;
    cin>>n>>l>>r;
    for(int i=l; i<=r; i++)
    {
        if(i%n==0)
        {
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
    return 0;
}

Measured memory_bytes: 3620
sx, sy, tx, ty = map(int, input().split())
dist_x = tx - sx
dist_y = ty - sy
root = ''
root += 'U'*dist_y
root += 'R'*dist_x
root += 'D'*dist_y
root += 'L'*dist_x
root += 'L'
root += 'U'*(dist_y + 1)
root += 'R'*(dist_x + 1)
root += 'DR'
root += 'D'*(dist_y + 1)
root += 'L'*(dist_x + 1)
root += 'U'
print(root)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
#define int long long

signed main(){
	int N; cin >> N;
	vector<int> s(N);
	for(int i = 0; i < N; i++) cin >> s[i];
	int Q; cin >> Q;
	vector<int> t(Q);
	for(int i  =0; i < Q; i++)cin >> t[i];
	int ans = 0;
	for(int i = 0; i < Q; i++){
		if(upper_bound(s.begin(), s.end(), t[i]) - lower_bound(s.begin(), s.end(), t[i]) != 0){
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3840
n = int(input())
a = list(map(int, input().split()))+[0]

up = True
b = []
for i in range(n):
    if up and a[i] < a[i+1] or not up and a[i] > a[i+1]:
        b.append(a[i])
        up = not up

m = 1000
for i in range(0, len(b), 2):
    v = m//b[i]
    m += (b[i+1]-b[i])*v
print(m)

Measured memory_bytes: 62008
a[3001];main(i,n,f,k){for(i=0;i<3001;i++)if(!(i&3)&&(i%100||!(i%400)))a[i]=1;for(f=0;scanf("%d%d",&i,&n),n;k?1:puts("NA"),f=1)for(k=0,f?puts(""):1;i<=n;i++)if(a[i])printf("%d\n",i),k=1;return 0;}

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


int main() {
    string S,T;
    cin >> S >> T;
    int flag = 0;
    rep(i,S.size()) {
        S.push_back(S[0]);
        S.erase(0,1);
        if (S == T) {
            cout << "Yes" << endl;
            flag++;
            break;
        }
    }
    if (flag == 0) {
        cout << "No" << endl;
    }
}



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

int main()
{
    int x;
    std::cin >> x;
    // (1 + N) * N / 2 >= x
    // (M + 0.5) * (M - 0.5) >= 2 * x
    // M^2 >= 2 * x - 0.25
    // N >= (2 * x - 0.25)^0.5 - 0.5

    std::cout << static_cast<int32_t>(std::ceil(std::sqrt(2 * x - 0.25) - 0.5)) << std::endl;
    return 0;
}


Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,i,j,a,b;
	cin>>n;
	for(i=1;i<=sqrt(n);i++)
	{
		if (n%i==0)
		{
			a=i;
			b=n/a;
		}
	}
	cout<<a-1+b-1<<endl;
}

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


struct Node {
  int key;
  struct Node *right, *left, *parent;
};

struct Node *root, *NIL;

void insert(int k) {
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else{
     x = x->right;
    }
  }
  
  z->parent = y;
  if(y == NIL){
    root = z;
  }else if(z->key < y->key){
    y->left = z;
  }else{
    y->right = z;
  }

}

struct Node * find(struct Node *u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key){ 
      u = u->left; 
    }else{
      u = u->right;
    }
  }
  return u;
}



void inorder (struct Node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right); 
}

void preorder(struct Node *u){
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

	
int main(void){

  int n, i, x;
  char str[32];
 
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(str[0] == 'f'){
      scanf("%d", &x);
      struct Node *t = find(root, x);
      if(t != NIL){
	printf("yes\n");
      }else{
	printf("no\n");
      }
    }else if(strcmp(str,"insert") == 0){
      scanf("%d", &x);
      insert(x);
    }else if(strcmp(str,"print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

return 0;


}



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

using namespace std;

int A[53], B[53], n;
bool graph[53][53][53], connected[53][53]; 

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &A[i]);
	for(int i = 1; i <= n; ++i) scanf("%d", &B[i]);
	for(int i = 0; i <= 50; ++i) graph[0][i][i] = 1;
	for(int k = 1; k <= 50; ++k) {
		for(int i = 0; i <= 50; ++i) 
			for(int j = 0; j <= 50; ++j)
				graph[k][i][j] = graph[k - 1][i % k][j] | graph[k - 1][i][j];
	}
	for(int i = 1; i <= n; ++i) {
		if(!graph[50][A[i]][B[i]])
			return puts("-1"), 0;
	}
	for(int i = 1; i <= n; ++i) {
		connected[i][A[i]] = 1;
	}
	long long ans = 0;
	for(int k = 50; k > 0; --k) {
		bool flag = 0;
		for(int i = 1; i <= n; ++i) {
			bool is_connected = 0;
			for(int j = 0; j <= 50; ++j)
				is_connected |= connected[i][j] && graph[k - 1][j][B[i]];
			if(!is_connected) {flag = 1; break;}
		}
		if(flag) {
			ans += 1LL << k;
			for(int i = 1; i <= n; ++i) {
				for(int j = 0; j <= 50; ++j)
					connected[i][j % k] |= connected[i][j]; 
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public final class Main {
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		Solver sol = new Solver();
		System.out.println(sol.solve(s));
	}

}

class Solver {
	int getBitPosition(int i) {
		int count = 1;
		while ((i >>= 1) > 0)
			count++;
		return count;
	}

	long getSumOf(long[] aa, int i, int j) {
		long sum = 0;
		for (int a = j; a >= i; a--) {
			sum += (long) (aa[a] * Math.pow(10, j - a));
		}
		return sum;
	}

	long solve(String s) {

		char in[] = s.toCharArray();
		long inp[] = new long[in.length];
		for (int ii = 0; ii < in.length; ii++) {
			inp[ii] = in[ii] - '0';
		}
		long sum = 0;
		int ways = 1 << (in.length - 1);
		for (int ii = 1; ii < ways; ii++) {
			long temp = 0;
			int i = ii;
			int last = inp.length - 1;
			while (i > 0) {
				int n = getBitPosition(i & -i);
				n = in.length - n;
				temp += getSumOf(inp, n, last);
				last = n - 1;
				if ((i & (i - 1)) == 0) {
					temp += getSumOf(inp, 0, last);
				}
				i = i & (i - 1);

			}
			sum += temp;
		}
		return sum + getSumOf(inp, 0, inp.length - 1);
	}

}


Measured memory_bytes: 23124
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();



		if(N>=30) {
			System.out.println("Yes");
		}else {
		System.out.println("No");
		}
	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

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

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
}


Measured memory_bytes: 35704
class Segtree<Monoid> constructor(n : Int ,ori : Monoid, m_fun : (Monoid,Monoid) -> Monoid){
    var dat : MutableList<Monoid>
    //評価関数
    var check : (Monoid,Monoid) -> Monoid = m_fun
    //単位元
    var origin = ori
    //領域
    var range : Int = 1

    //初期化処理、配列の長さを確定させて、モノイドで埋める
    init {
        range = 1
        while (range < n) range *= 2
        dat = MutableList(2*range,{origin})
    }

    fun update(place : Int,value : Monoid){
        var tmp = place + range - 1
        dat[tmp] = value
        while(tmp > 0){
            tmp = (tmp-1).shr(1)
            dat[tmp] = check(dat[2*tmp+1],dat[2*tmp+2])
        }
    }

    fun setValue(place : Int ,value : Monoid){
        dat[place + range - 1] = value
    }

    fun que(a : Int,b :Int,k :Int,l : Int,r : Int) : Monoid{
        if(r <= a || b <= l)return origin
        if(a <= l && r <= b)return dat[k]
        return check(que(a,b,2*k+1,l,(l+r)/2),que(a,b,2*k+2,(l+r)/2,r))
    }
    //fun quety(a : Int,b : Int) = que(a,Math.min(b,range),0,0,range)

    fun quety(a : Int,b : Int) : Monoid{
        var L = origin
        var R = origin
        var A = a + range - 1
        var B = b + range - 1
        while(A < B){
            if(A and 1 == 0)L = check(L,dat[A++])
            if(B and 1 == 0)R = check(R,dat[--B])
            A = A.shr(1)
            B = B.shr(1)
        }
        return check(L,R)
    }

    fun makeTree(){
        var TmpRange = range
        while(TmpRange > 1){
            for(i in 0 until TmpRange step 2){
                val tmp = i + TmpRange - 1
                dat[(tmp- 1).shr(1)] = check(dat[tmp],dat[tmp+1])
            }
            TmpRange = TmpRange.shr(1)
        }
    }
}

fun main(args : Array<String>){
    val (n,q) = readLine()!!.split(' ').map{ it.toInt() }
    val tree = Segtree(n,1L.shl(31)-1,{a : Long,b : Long -> Math.min(a,b)})
    for(i in 0 until n)tree.setValue(0,1L.shl(31)-1)
    tree.makeTree()
    for(i in 0 until q){
        val (a,b,c) = readLine()!!.split(' ').map{ it.toInt() }
        if(a == 0){
            tree.update(b,c.toLong())
        }
        else{
            println(tree.quety(b,c+1))
        }
    }
}


Measured memory_bytes: 101084
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int age, price;
    cin >> age >> price;

    if (age <= 5) {
        cout << 0 << endl;
    } else if (age <= 12) {
        cout << price / 2 << endl;
    } else {
        cout << price << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
n=int(input())
ans=''
i=1
while(i<=n):
  x=i
  if x%3==0:
    ans+=' '+str(i)
  else:
    while(x>0):
      if x%10==3:
        ans+=' '+str(i)
        break
      x//=10
  i+=1

print(ans)

Measured memory_bytes: 7636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=5e5;

  ll n;
  ll a[N],b[N];
void in()
{
  cin>>n;
  for (ll i=0;++i<=n;)
    scanf("%d%d",a+i,b+i);
}

  ll A;
void wor()
{
  for (ll i=n;i;--i)
    if (A+a[i]) A=((A+a[i]-1)/b[i]+1)*b[i]-a[i];
}

void out()
{
  cout<<A;
}

int main()
{
  in();
  wor();
  out();
  exit(0);
}

Measured memory_bytes: 5120
/*
[abc140] F - Many Slimes
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 18;

int N;
int S[1 << MAX_N];

bool solve() {
    multiset<int> ms;
    for (int i = 0; i < (1 << N); i++) {
        ms.insert(-S[i]);
    }

    vector<int> p = {*ms.begin()};
    ms.erase(ms.begin());

    for (int l = 1; l < (1 << N); l <<= 1) {
        for (int i = 0; i < l; i++) {
            int x = p[i];
            auto iter = ms.upper_bound(x);
            if (iter == ms.end()) {
                return false;
            }
            p.push_back(*iter);
            ms.erase(iter);
        }
    }

    return true;
}

int main() {
    cin >> N;
    for (int i = 0; i < (1 << N); i++) {
        cin >> S[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 14716
#include<stdio.h>
#include<stdlib.h>
#include<math.h>



typedef struct tyouten{
   struct tyouten *next;
   double x;
   double y;
}tyouten;

typedef struct{
  double x;
  double y;
}bek;

tyouten *mk_tyouten(double x,double y){
  tyouten *p;
  p=malloc(sizeof(tyouten));
  p->x=x;
  p->y=y;
  p->next=NULL;
  return p;
}



double zettaiti(tyouten *p,tyouten *q){
  return pow(pow(p->x - q->x,2) +pow(p->y - q->y,2) ,0.5);
}


bek *mk_bek(tyouten *p,tyouten *q){
  double a;
  a=zettaiti(p,q);
  bek *P;
  P=malloc(sizeof(bek));
  P->x=(q->x -p->x)/a;
  P->y=(q->y - p->y)/a;
  return P;
}




/*?????°????????????????????????????????¨??????????¬???????????????????????????????????????£????§???¢????????????
?¬????????????????????????????????????????????¬?????????????????????´??????NULL?????????*/
tyouten *mk_tri(tyouten *p){
  bek *pq;
  double kyori;
  tyouten *q;
  q=p->next;
  if(q==NULL) return q;
  kyori=zettaiti(p,q)/3;
  pq=mk_bek(p,q);
  p->next=mk_tyouten(p->x + kyori*(pq->x),p->y + kyori*(pq->y));/*?????¨???????????????*/
  p->next->next=mk_tyouten(p->next->x + ((pq->x)*0.5 - (pq->y)*pow(3,0.5)*0.5)*kyori,p->next->y + (pq->x*pow(3,0.5)*0.5 + 0.5*pq->y)*kyori);/*?????????????????????*/
  p->next->next->next=mk_tyouten(p->x + 2*kyori*(pq->x),p->y + 2*kyori*(pq->y));/*??????????????????*/
  p->next->next->next->next=q;
  return q;
}


int main(){
  tyouten *p1,*p2,*q;
  int n,i;
  p1=mk_tyouten(0.0,0.0);
  p2=mk_tyouten(100.0,0.0);
  p1->next=p2;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    q=p1;
    while(q!=NULL) q=mk_tri(q);
  }
  q=p1;
  while(q!=NULL){
    printf("%lf %lf\n",q->x,q->y);
    q=q->next;
  }
  return 0;
}

Measured memory_bytes: 864
import sys

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sum(A) < sum(B):
    print(-1)
else:
    diff1 = 0
    num = 0
    diff2 = []
    for i in range(N):
        if A[i] < B[i]:
            diff1 += B[i] - A[i]
            num += 1
        elif A[i] > B[i]:
            diff2.append(A[i] - B[i])
    if num == 0:
        print(0)
    else:
        diff2.sort(reverse=True)
        sum = 0
        for i in range(len(diff2)):
            sum += diff2[i]
            if sum >= diff1:
                print(num + i + 1)
                sys.exit()


Measured memory_bytes: 19508
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main(){
  int n,m,x; cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n,vector<int>(m));
  for(int i = 0; i < n; i++){
    cin >> c[i];
    for(int j = 0; j < m; j++){
      cin >> a[i][j];
    }
  }
  int ans = 1<<30;
  vector<int> p(m);
  for(int bit = 0; bit <= 1<<n; bit++){
    for(int i = 0; i < m; i++) p[i] = 0;
    int cost = 0;
    for(int i = 0; i < n; i++){
      if(bit>>i&1){
        cost += c[i];
        for(int j = 0; j < m; j++){
          p[j] += a[i][j];
        }
      }
    }
    bool flg = true;
    for(int cc: p){
      if(cc < x) flg = false;
    }
    if(flg) ans = min(ans, cost);
  }
  if(ans == 1<<30) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
#include <time.h>

typedef int32_t i32;
typedef int64_t i64;
typedef double f64;

void *const null=(void *)0;
i64 const llinf=4611686018427387903LL;
i64 const mod=1000000009LL;
f64 const pi=3.141592653589793;
f64 const rad=57.295779513082323;

#define CODE_

typedef struct data_{
    i64 i;
    i64 p;
    i64 r;
}data;

i32 pcmp(const void *a,const void *b){
    if(((data *)a)->p<((data *)b)->p) return 1;
    else if(((data *)a)->p>((data *)b)->p) return -1;
    else return 0;
}

i32 icmp(const void *a,const void *b){
    if(((data *)a)->i>((data *)b)->i) return 1;
    else if(((data *)a)->i<((data *)b)->i) return -1;
    else return 0;
}

i32 main(void){
    i64 n;
    scanf("%lli",&n);
    data *d=(data *)calloc(n,sizeof(data));
    for(i64 i=0LL;i<n;++i) d[i].i=i;
    i64 m=n*(n-1LL)/2LL;
    i64 s,t,u,v;
    for(i64 i=0LL;i<m;++i){
        scanf("%lli%lli%lli%lli",&s,&t,&u,&v);
        if(u>v) d[s-1LL].p+=3LL;
        else if(u<v) d[t-1LL].p+=3LL;
        else{
            ++d[s-1LL].p;
            ++d[t-1LL].p;
        }
    }
    qsort(d,n,sizeof(data),pcmp);
    d[0LL].r=1LL;
    for(i64 i=1LL;i<n;++i){
        d[i].r=i+1LL;
        if(d[i].p==d[i-1].p) d[i].r=d[i-1].r;
    }
    qsort(d,n,sizeof(data),icmp);
    for(i64 i=0LL;i<n;++i) printf("%lli\n",d[i].r);
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <iterator>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <math.h>
#define vi vector<int>
#define vvi vector<vector<int> > 
#define vl vector<long long>
#define vpi vector<pair<int,int> >
#define ll long long 
#define all(x) x.begin(),x.end()
#define vpl vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pci pair<char,int>
#define un unsigned
# define M_PI           3.14159265358979323846  /* pi */
// #define mod 998244353
#define mod 1000000007
#define MAXN  1000001
using namespace std; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


void solve()
{
    int n;
    cin>>n;
    vl a(n,0);
    vl b(n,0);
    for(int i = 0 ; i < n ; i++)
    cin>>a[i]>>b[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    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;
    }
}


int main()
{
    fast;
    int t;
    t = 1;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 6360
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007ll
//作者:中国江苏南京丁天行
using namespace std;
//数组不要开小了
ll a[100005];
int n,m;
int main()
{
    a[0]=1;
    for(int i=1;i<=100000;i++)a[i]=a[i-1]*(i*1ll)%orz;
    cin>>n>>m;
    if(n==m){
             ll ans=2ll*a[n]*a[m];
             ans%=orz;
             cout<<ans<<endl;
    }
    else if(n==m+1||n==m-1){
             ll ans=a[n]*a[m];
             ans%=orz;
             cout<<ans<<endl;
    }
    else cout<<0<<endl;
	//system("pause");
	return 0;
}


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

int main() {
    int a,b;
    string s;
    cin >> a >> b >> s;
    for (int i = 0; i < a + b + 1; i++)
    {
        if (i == a) {
            if (s.at(i) != '-') {
                cout << "No" << endl;
                return 0;
            }
            else continue;
        }

        if (s.at(i) == '-') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int a = s[k - 1] - 'A';
    s[k - 1] = a + 'a';
    cout << s << endl;
}


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " = " << x << endl
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define infll 1e18
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };



//===========================DEBUG======================//
#define XOX 1
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

//================================================================//



//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=1e5+5;


int main(){
 //    #ifndef ONLINE_JUDGE
 //    freopen("../../input.txt", "r", stdin);
 //    freopen("../../output.txt", "w", stdout);
	// #endif
    fast

    ll x; cin>>x;
    ll cnt=0;
    ll p=100;
    while(p<x){
    	p += p/100;
    	cnt++;
    }
    pt(cnt);
}


/*



*/





Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    ll n,k;
    cin>>n>>k;
    ll t=n%k;
    ll t_diff=abs(k-t); 
    ll ans=min(t,t_diff);
    cout<<ans<<endl;

}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int n, a, b;
int main()
{
	scanf("%d", &n);
	a = n;
	while(a>0)
	{
		b += a%10;
		a/=10;
	}
	if (n%b==0) printf("Yes\n");else printf("No\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
typedef long long ll;
#define INF 1000000000
using namespace std;
ll solve(int b,int p){
    ll ans=1;
    while(p--){
        ans*=b;
    }
    return ans;
}
int main(void){
    int x;
    cin>>x;
    int ans=1;
    for(int b=1;b<=31;b++){
        for(int p=2;p<=10;p++){
            ll tmp=solve(b,p);
            if(tmp<=x&tmp>ans){
                ans=tmp;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int x,y;
  scanf("%d %d",&x,&y);  
  int prize=0;
  if(x==3)prize+=100000;
  if(y==3)prize+=100000;
  if(x==2)prize+=200000;
  if(y==2)prize+=200000;
  if(x==1)prize+=300000;
  if(y==1)prize+=300000;
if(x==1&&y==1)prize+=400000;
  printf("%d",prize);
  return 0; 
}

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

#define ll long long int

using namespace std;

int main() {
    ll n, x, t;
    cin >> n >> x >> t;
    ll res = (n / x) * t;
    if ((n%x) != 0) {
        res += t;
    }
    cout << res << endl;
}


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

int main(){

  int i;
  int n[3];
  int temp;

  cin >> i;
  for(int j=0; j<i; j++){
    cin >> n[0] >> n[1] >> n[2];
    sort(n,n+3, greater<int>());
    if(n[0]*n[0] == n[1]*n[1] + n[2]*n[2]){
      cout << "YES\n";
    }else{
      cout << "NO\n";
    }
  }

  return 0;
}

Measured memory_bytes: 1136
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
int main(){
    vector<pii> data;
    int n,t,h,l;
    cin>>n>>t>>h>>l;
    rep(i,n){
        int t10,t100;
        cin>>t10>>t100;
        data.pb(pii(t10,t100));
    }
    
    int turn = 0;
    int payed = 0;
    while(1){
        pii money = data[turn];
        if(money.first!=0){
            payed += 10;
            t++;
            data[turn].first--;
        }else if(money.second!=0){
            payed+=100;
            data[turn].second--;
        }
        else{
            cout<<turn+1<<endl;
            return 0;
        }
        
        if(t>l){
            cout<<turn+1<<endl;

            return 0;
        }
        
        if(payed>=90){
            data[turn].first+=(payed-90)/10;
            t-=(payed-90)/10;
            payed = 0;
        }
        if(t<0){
            cout<<turn+1<<endl;
            return 0;
        }
        
        turn ++;
        turn %=n;
    }
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;

int main() {
  int A,B; cin>>A>>B;
  string S; cin>>S;
  bool ans=true;
  rep(i,A+B+1){
    if(i==A&&S.at(i)!='-') ans=false;
    if(i!=A&&S.at(i)=='-') ans=false;
  }
  if(ans) cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 3632
nums = int(input())
ary = [0 for i in range(nums)]
for i in range(nums):
    ary[i] = list(map(int,input().split()))

dp = [0 for i in range(nums+1)]
for i in range(len(dp)):
    dp[i] = [0,0,0]

for i in range(nums):
    for x in range(3):
        for y in range(3):
            if x == y: continue
            check = dp[i][x] + ary[i][y]
            if check >= dp[i+1][y]:
                dp[i+1][y] = check

result= 0
for i in range(3):
    if result < dp[nums][i]:
        result = dp[nums][i]
print(result)

Measured memory_bytes: 47284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    string s;
    cin>>s;
    ll n=s.length();
    ll a[n];
    rep(0,i,n)a[i]=atoi(s.substr(i,1).c_str());
    ll c0=0,c1=0;
    rep(0,i,n){
        if(a[i]==0)++c0;
        if(a[i]==1)++c1;
    }
    cout<<2*min(c0,c1)<<endl;
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>
typedef long long ll;
int main() {
	char s[11];
	int n[10];
	ll num, sum = 0;
	scanf("%s", s);
	int len = strlen(s);
	for (int i = 0; i < len; i++)
		n[i] = s[i] - '0';
	for (int i = 0; i < 1 << (len - 1); i++) {
		num = n[0];
		for (int j = 0; j < len - 1; j++) {
			if ((i >> j) & 1) {
				sum += num;
				num = n[j + 1];
			} else {
				num = num * 10 + n[j + 1];
			}
		}
		sum += num;
		// printf("%d\n", sum);
	}
	printf("%lld\n", sum);
	return 0;
}

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

int main(){
  /* miss
 ll n; cin>>n;
  stack<int>s;
  while(n/(-2)!=0){
     s.push(n%(-2));
    n/=(-2);
     if(n==1)s.push(1);
  }
  if(s.empty()) cout<<1<<endl;
  else {
  while(!s.empty()){
  cout<<s.top(); s.pop();
  }
  }
  */
  // correct answer
  int n;  cin>>n;  string ans="";
  while(n!=0){
  if(n%-2!=0){ n--; ans="1"+ans;}
  else ans= "0"+ans;
  n/=-2; }
if(ans=="") ans="0";
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_a_genius = 0; ngtkana_is_a_genius < int(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (int i = int(begin); (i) < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) 0;
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector< int > dp(n+1, false);
  dp.at(0) = true;
  rep(i,0,n+1) {
    rep(j,100, 106) {
      int k = i - j;
      if (k < 0) continue;
      dp.at(i) |= dp.at(k);
    }
  }
  int ans = dp.at(n);
  std::cout << ans << std::endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int rate[n];
  rep(i,n) cin >> rate[i];
  vector<bool> color;
  color.assign(8,false);
  int count = 0;  // rate >= 3200

  rep(i,n) {
    rep(j,9) {
      if (j == 8) {
        count++;
        break;
      }
      if (rate[i] < 400*(j+1)) {
        color[j] = true;
        break;
      }
    }
  }

  int ans = 0;
  rep(i,8) if (color[i]) ans++;
  cout << max(ans,1) << " " << ans+count;
  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1; 
   // cin >> t;
    for(int T = 0; T < t ; T++){
        ll n;
        cin >> n;
        ll a[n];
        for(int i = 0 ; i < n ; i++){
            cin >> a[i];
        }
        sort(a, a + n);
        ll mod = 1e9 + 7, twop = 1, ans = 0;
        ll bits = log2(a[n - 1]) + 1;
        ll p[61];
        p[0] = 1;
        for(ll i = 1; i < 61; i++){
            p[i] = p[i - 1]*2;
            p[i] %= mod;
        }
        for(ll i = 0; i < bits; i++){
            ll ones = 0;
            for(ll j = 0; j < n; j++){
                if(a[j] >> i & 1){
                    ones++;
                }
            }
            //cout << ones <<"df" << endl;
            ans += ((((ones%mod)*((n - ones)%mod))%mod)*(p[i]));
            ans %= mod;
           // cout << ans << endl;
        }
        cout << (ans%mod) << endl;
    }
    return 0;
}

Measured memory_bytes: 6160
program main
implicit none
integer :: i, j, k
character :: s*1

read(*,*) s
if( s == 'a' .or. s=='i' .or. s =='u' .or. s=='e' .or. s=='o' ) then
   write(*,*) "vowel"
else
   write(*,*) "consonant"
end if


end program main


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

typedef long long lint;
const int  N=100010;
vector<pair<int,int> > adj[N];
int visit[N],parent[N][50],depth[N];
lint ans,dist[N][50];

void dfs(int n){
    int size=adj[n].size();
    for(int i=0;i<size;i++){
        int x=adj[n][i].first;
        int d=adj[n][i].second;
        if(!visit[x]){
            visit[x]=1;
            depth[x]=depth[n]+1;
            parent[x][0]=n;
            dist[x][0]=d;
            dfs(x);
        }
    }
}

void lca(int a,int b){
    if(depth[a]<depth[b])swap(a,b);
    int dif=depth[a]-depth[b];
    for(int i=0;dif;i++){
        if(dif%2){
            ans+=dist[a][i];
            a=parent[a][i];
        }
        dif/=2;
    }
    if(a!=b){
        for(int i=49;i>=0;i--)
            if(parent[a][i]!=-1&&parent[a][i]!=parent[b][i]){
                ans+=dist[a][i];ans+=dist[b][i];
                a=parent[a][i];
                b=parent[b][i];
            }
        ans+=dist[a][0];ans+=dist[b][0];
    }
}

int main(void){
    int n;
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
        adj[a].push_back(make_pair(b,c));
        adj[b].push_back(make_pair(a,c));
    }
    memset(parent,-1,sizeof(parent));
    memset(dist,-1,sizeof(dist));
    visit[1]=1;
    depth[1]=1;
    dfs(1);
    for(int j=0;j<50;j++)
        for(int i=1;i<=n;i++)
            if(parent[i][j]!=-1){
                parent[i][j+1]=parent[parent[i][j]][j];
                dist[i][j+1]=dist[parent[i][j]][j]+dist[i][j];
            }
    int q,k;
    scanf("%d %d",&q,&k);
    while(q--){
        int x,y;
        scanf("%d %d",&x,&y);
        ans=0;
        lca(x,k);
        lca(k,y);
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 71296
#include<iostream>
#include<map>
#include<string>
using namespace std;

int main()
{
	int i, j;
	string s, ans;
	map< pair<char, char>, char > list;
	bool f;
	for (i = 0; i < 5; i++)
		for (j = 0; j < 5; j++)
			list[make_pair('1'+i, '1'+j)] = 'a'+i*5+j;
	list[make_pair('6', '1')] = 'z';
	list[make_pair('6', '2')] = '.';
	list[make_pair('6', '3')] = '?';
	list[make_pair('6', '4')] = '!';
	list[make_pair('6', '5')] = ' ';

	while (getline(cin, s)) {
		ans = "";
		f = true;
		if (s.size()&1) {
			f = false;
			s = "";
		}
		for (i = 0; i < s.size(); i+=2) {
			if ( !list.count( make_pair(s[i], s[i+1]) ) ) {
				f = false;
				break;
			}
			ans += list[make_pair(s[i], s[i+1])];
		}
		if (f) cout<<ans<<endl;
		else cout<<"NA"<<endl;
	}
	return 0;
}

Measured memory_bytes: 0