akhauriyash/Code-Regression huggingface dataset:
def a(s) :
	if s[0] != 'A':
		return 'WA'
	count = 0
	for w in s[2:-1]:
		if w =='C':
			count += 1
	if count != 1:
		return 'WA'
	for w in s:
		if w != 'A' and w != 'C' and w.isupper() :
			return'WA'
	return 'AC'
print a(raw_input())


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
const int mod=1e9+7;
const int N=2005;
int n,k;
int f[N][N],jc[N*N],inv[N*N];
inline int C(int n,int m)
{
	return jc[n]*inv[m]%mod*inv[n-m]%mod;
}
signed main()
{
    n=read();k=read();
    if(k==1){cout<<1;return 0;}
    jc[0]=jc[1]=inv[0]=inv[1]=1;
	for(int i=2;i<=4000000;i++)jc[i]=jc[i-1]*i%mod;
    for(int i=2;i<=4000000;i++)inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    for(int i=2;i<=4000000;i++)inv[i]=inv[i]*inv[i-1]%mod;
    f[0][0]=1;
    for(int i=1;i<=n;i++)
	{
        for(int j=0;j<=i;j++)
		{
            f[i][j]=f[i-1][j];
            if(!j)continue;
            (f[i][j]+=f[i][j-1]*(n-j+1)%mod*C(n-i+(n-j+1)*(k-1)-1,k-2)%mod)%=mod;
        }
    }
    printf("%lld\n",f[n][n]);
    return 0;
}

Measured memory_bytes: 94464
#include<bits/stdc++.h>
using namespace std;
string s;int a[1<<17],b,n,i;
int main(){
	cin>>s;
	n=s.size();
	for(i=n-1;i>=0;i--){
		if(s[i]=='L')b=i;
		else a[b-((b-i)&1)]++;
	}
	for(i=0;i<n;i++){
		if(s[i]=='R')b=i;
		else a[b+((i-b)&1)]++;
	}
	for(i=0;i<n;i++)cout<<a[i]<<" ";
	return 0;
}


Measured memory_bytes: 1024
#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;
 
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pl;
 
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define form(i, n) for (size_t i = 0; i < size_t(n); ++i)
#define forn(i, n) for (size_t i = 1; i <= size_t(n); ++i)
template<class T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll mod(ll a, ll b) { return (a%b+b)%b; }
ll gcd(ll x, ll y) { return __gcd(x, y); }
ll lcm(ll x, ll y) { return x * 1ll * y / gcd(x, y); }
 
 
const ll MAXN = 1e18;
const ll SIZE = 2e5 + 5;
const ll MOD  = 1e9 + 7;

ll n, a[SIZE], b[SIZE];

int main() { speedhack()

	cin >> n;
	forn (i, n) 
		cin >> a[i] >> b[i];

	sort (a + 1, a + 1 + n);
	sort (b + 1, b + 1 + n);

	ll x, y;
	
	if (n % 2) {
		x = a[(n + 1) / 2];
		y = b[(n + 1) / 2];
	}  else {
		x = a[n / 2] + a[n / 2 + 1];
		y = b[n / 2] + b[n / 2 + 1];
	}	cout << y - x + 1;

	return 0;
}


Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin>>n;
    cin>>s;
    if(s.size()<=n)
        cout<<s<<endl;
    else if(s.size()>n)
    {
        for(int i=0;i<n;i++)
            cout<<s[i];
        cout<<"..."<<endl;
    }
    return 0;
}


Measured memory_bytes: 3560
def main():
    n = int(input())
    a = tuple([int(t)for t in input().split()])
    if 0 in a:
        print(0)
        return

    ans = 1
    for a_i in a:
        ans *= a_i
        if ans>10**18:
            print(-1)
            return

    print(ans)

if __name__ == "__main__":
    main()

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
    summon_tourist;

    string S; cin >> S;
    if(S[0]==S[1] or S[1]==S[2] or S[2]==S[3]){
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7


int main(){
    ll n,m; cin >> n >> m;
    vector<vpl> G(n);
    REP(i,1,n) G[i].emplace_back(i-1,0);
    rep(i,m){
        ll a,b,c; cin >> a >> b >> c;
        a--; b--;
        G[a].emplace_back(b,c);
    }
    vl d(n,linf);
    d[0] = 0;
    priority_queue<P,vector<P>,greater<P>> pq;
    pq.emplace(0,0);
    while(!pq.empty()){
        P p = pq.top(); pq.pop();
        ll u = p.second;
        if(d[u] < p.first) continue;
        for(auto v : G[u]){
            if(d[v.first] > d[u] + v.second){
                d[v.first] = d[u] + v.second;
                pq.emplace(d[v.first], v.first);
            }
        }
    }
    if(d[n-1]!=linf) cout << d[n-1] << endl;
    else puts("-1");
}

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

int main() {
	int N,d[110];
	cin >> N;
	for (int i = 0; i < N; i++)cin >> d[i];
	int num[110] = { 0 };
	for (int i = 0; i < N;i++) {
		num[d[i]]++;

	}
	int res = 0;
	for (int i = 1; i <= 100; i++) {
		if (num[i]) ++res;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n , m; 
	cin >> n >> m; 
	int cnt = 0;
	vi v(n+1);
	rep(i,0,m){
		int l ,r ;
		cin >> l >> r;
		l--;
		v[l]++;
		v[r]--;
	}
	rep(i,0,n) v[i+1] += v[i];
	rep(i,0,n) cnt+=(v[i]==m);
	cout << cnt << endl;
	
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 510000;

// https://atcoder.jp/contests/abc110/submissions/16264948
ll fac[MAX], finv[MAX], inv[MAX];
void combinationInit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

ll combination(ll n, ll k) {
  if (n < k) {
    return 0;
  } else if (n < 0 || k < 0) {
    return 0;
  }
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<ll, ll>> primeFactorize(ll n) {
  vector<pair<ll, ll>> r;
  for (int i = 2; i * i <= n; i++) {
    if (n % i != 0) {
      continue;
    }
    int ex = 0;
    while (n % i == 0) {
      ex++;
      n /= i;
    }
    r.push_back({i, ex});
  }
  if (n > 1) {
    r.push_back({n, 1});
  }
  return r;
}

int main() {
  ll n, m;
  cin >> n >> m;
  auto res = primeFactorize(m);
  ll v = 1;
	combinationInit();
  for (int i = 0; i < res.size(); i++) {
    v *= combination(res[i].second + n - 1, n - 1);
    v %= MOD;
  }

  cout << v << endl;
}


Measured memory_bytes: 15596
use std::io;

fn main() {
    let mut num = String::new();//String;
    let mut s = String::new();
    let mut t = String::new();
    io::stdin().read_line(&mut num);
    io::stdin().read_line(&mut s);
    io::stdin().read_line(&mut t);

    let num = num.trim();
    let s = s.trim();
    let t = t.trim();

    for i in 0..num.parse::<i32>().unwrap() {
        if s[i as usize..s.len()] == t[0..(s.len() - i as usize ) as usize] {
            print!("{}", s.len() + i as usize);
            return;
        }
    }
    print!("{}", s.len() * 2);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ul unsigned long long
#define ll long long
#define ld long double

int main()
{
  ll x;
  cin>>x;

  ll a,b;
  a=x/500;
  x-=a*500;
  b=x/5;
  cout<<(a*1000+b*5)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int n;
  string a,b;
  cin>>n>>a>>b;
  if(a.size()<b.size()) a=string(b.size()-a.size(),'0')+a;
  if(a.size()>b.size()) b=string(a.size()-b.size(),'0')+b;

  const Int l=a.size();

  
  const Int BS = 600;
  vector<Int> cnt(l/BS+1,0),sft(l/BS+1,0);
  auto calc=[&](Int x){
    Int y=x*BS;
    cnt[x]=0;
    sft[x]=-l*2;
    for(Int i=0;i<BS;i++){
      if(y+i>=l) break;
      if(b[y+i]=='1') chmax(sft[x],cnt[x]+(a[y+i]=='1')+l-(y+i+1));
      cnt[x]+=a[y+i]=='1'||b[y+i]=='1';
    }
    //cout<<x<<":"<<cnt[x]<<" "<<sft[x]<<endl;
  };
  
  for(Int i=0;i<l;i+=BS) calc(i/BS);
  
  Int ans=0;
  auto recalc=[&](){
    ans=0;
    Int tmp=0;
    for(Int i=0;i<l;i+=BS){
      Int x=i/BS;
      chmax(ans,tmp+sft[x]);
      tmp+=cnt[x];
    }
  };
  
  for(Int i=0;i<n;i++){
    char c;
    cin>>c;
    if(c=='Q'){
      recalc();
      cout<<ans<<endl;
      continue;
    }
    Int p;
    cin>>p;
    p++;
    if(c=='A') a[l-p]=!(a[l-p]-'0')+'0';
    if(c=='B') b[l-p]=!(b[l-p]-'0')+'0';

    calc((l-p)/BS);
  }
  
  return 0;
}



Measured memory_bytes: 3892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
ll dp[101][445];
ll solve(int N, int n, int last3){
    if(n == 0)
    return 1;
    if(dp[n][last3] != -1)
    return dp[n][last3];
    ll so = 0;
    for(int i = 1; i <= 4; i++){
        if(i == 2){
            if(last3 % 100 != 13){
                int temp =  last3 % 100;
                temp = temp * 10 + 2;
                so += solve(N, n-1, temp);
            }
        }
        else if(i == 3){
            if(last3 % 100 != 21 && last3 % 100 != 12 && last3 != 112 && last3 != 122 && last3 != 132 && last3 != 142 && last3 != 121 && last3 != 122 && last3 != 123 && last3 != 124){
                int temp =  last3 % 100;
                temp = temp * 10 + 3;
                so += solve(N, n-1, temp);
            }
        }
        else{
                int temp =  last3 % 100;
                temp = temp * 10 + i;
                so += solve(N, n-1, temp);
        }
        so %= mod;
    }
    return dp[n][last3] = so;
}
int main() {
    ll n;
    cin >> n;
    ll so = 0;
    int last = 0;
    memset(dp, -1, sizeof(dp));
    for(int i = 1; i <= 4; i++){
        last = i;
        so += solve(n, n-1, last);
        so %= mod;
    }
    cout << so << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include <string>
typedef long long int ll;
using namespace std;

int main(){
	int sx,sy,gx,gy;
	cin>>sx>>sy>>gx>>gy;
	int dx=gx-sx;
	int dy=gy-sy;
	for(int i=0;i<dx;i++){
		cout << "R";
	}
	for(int i=0;i<dy;i++){
		cout << "U";
	}
	for(int i=0;i<dx;i++){
		cout << "L";
	}
	for(int i=0;i<dy;i++){
		cout << "D";
	}
	cout << "D";
	for(int i=0;i<dx+1;i++){
		cout << "R";
	}
	for(int i=0;i<dy+1;i++){
		cout << "U";
	}
	cout << "LU";
	for(int i=0;i<dx+1;i++){
		cout << "L";
	}
	for(int i=0;i<dy+1;i++){
		cout << "D";
	}
	cout <<"R";
	cout <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

class RAQ{
	public:
	int n;
	vector<ll> dat, dat2;
	RAQ(){}
	RAQ(int size){
		n = 1;
		while(n < size) n *= 2;
		dat.resize(2 * n - 1, 0);
		dat2.resize(2 * n - 1, 0);
	}
	void add(int l, int r, ll x){
		rangeAdd(l, r + 1, x, 0, 0, n);
	}
	void rangeAdd(int a, int b, ll x, int k, int l, int r){
		if(a <= l && r <= b){
			dat[k] += x;
		}else if(l < b && a < r){
			dat2[k] += (min(b, r) - max(a, l)) * x;
			rangeAdd(a, b, x, 2 * k + 1, l, (l + r) / 2);
			rangeAdd(a, b, x, 2 * k + 2, (l + r) / 2, r);
		}
	}
	ll getSum(int s, int t){
		return query(s, t + 1, 0, 0, n);
	}
	ll query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return 0;
		if(a <= l && r <= b) return dat[k] * (r - l) + dat2[k];
		else{
			ll ret = (min(b, r) - max(a, l)) * dat[k];
			ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
			ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
			return ret + vl + vr;
		}
	}
};

int main(){
	int n, q;
	cin >> n >> q;
	RAQ raqa(n);
	for(int i = 0; i < q; i++){
		int com;
		cin >> com;
		if(com == 0){
			int x, y; ll a;
			cin >> x >> y >> a;
			x--; y--;
			raqa.add(x, y, a);
		}else if(com == 1){
			int x, y;
			cin >> x >> y;
			x--; y--;
			cout << raqa.getSum(x, y) << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 7020
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <sstream>
#include <algorithm>

using namespace std;

int main() {
	string S;
	cin >> S;
	int size = S.size();
	for (int i = 0; i < size/2; i++) {
		S.pop_back(); S.pop_back();
		string left = S.substr(0, S.size() / 2);
		string right = S.substr(S.size() / 2, S.size() / 2);
		if (left == right) {
			cout << (int)S.size() << endl;
			break;
		}
	}
	return 0;
}

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

int main(void) {
  int N;
  string S, T;
  cin >> N >> S >> T;
  string ans;
  
  for(int i=0; i<N; i++){
    ans += S[i];
    ans += T[i];
  }
  
  cout << ans << endl;
  
  return 0;
}

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


int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    long long ans=0;
    for(int b=k+1;b<=n;b++)
    {
        int c1=n/b*(b-k);
        int c2=max(0,n%b-k+1);
        ans+=c1+c2;
        if(k==0)
            ans--;
    }
    printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 256
import copy
n,m=map(int,input().split())
h=list(map(int,input().split()))
hh=copy.copy(h)
for i in range(m):
  a,b=map(int,input().split())
  if hh[a-1]>hh[b-1]:
    h[b-1]=0
  elif hh[a-1]<hh[b-1]:
    h[a-1]=0
  else:
    h[a-1]=0
    h[b-1]=0
cnt=0
for j in range(n):
  if h[j]==hh[j]:
    cnt+=1
print(cnt)

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

int SumOfDegits(int X)
{
    int sum = 0;
    while (X > 0)
    {
        sum += X % 10;
        X /= 10;
    }

    return sum;
}

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

    int sum = SumOfDegits(N);
    if (N % sum == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;
int main()
{

    int t,n,i,arra[1000];
    string s;
        cin>>n;
        if(n%1000==0)
        cout<<"0"<<endl;
        else
        {
            t=n/1000;
            i=t*1000+1000-n;
            cout<<i<<endl;
        }

    return 0;
}



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

int main(void) {
  char S[3];
  scanf("%s", S);
  if (!strcmp(S, "SUN")) {
    printf("7\n");
  } else if (!strcmp(S, "MON")) {
    printf("6\n");
  } else if (!strcmp(S, "TUE")) {
    printf("5\n");
  } else if (!strcmp(S, "WED")) {
    printf("4\n");
  } else if (!strcmp(S, "THU")) {
    printf("3\n");
  } else if (!strcmp(S, "FRI")) {
    printf("2\n");
  } else if (!strcmp(S, "SAT")) {
    printf("1\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include <iostream>
#include <vector>
using namespace std;

bool CanMakeNum(vector<int> &vNum, int index, int checkNum)
{
	if (checkNum == 0)
	{
		return true;
	}
	else if (checkNum < 0)
	{
		return false;
	}
	if (index >= vNum.size())
	{
		return false;
	}
	bool result = CanMakeNum(vNum, index + 1, checkNum - vNum[index]) || CanMakeNum(vNum, index + 1, checkNum);
	return result;
}

int main()
{
	int n, q;
	cin >> n;
	vector<int> vNum(n, 0);
	for (int i = 0; i < n; i++)
	{
		cin >> vNum[i];
	}
	cin >> q;
	vector<int> vCheckNum(q, 0);
	for (int i = 0; i < q; i++)
	{
		cin >> vCheckNum[i];
	}


	// チェック開始
	for (int i = 0; i < vCheckNum.size(); i++)
	{
		int checkNum = vCheckNum[i];
		if (CanMakeNum(vNum, 0, checkNum))
		{
			cout << "yes";
		}
		else
		{
			cout << "no";
		}

		//if (i != vCheckNum.size() - 1)
		{
			cout << endl;
		}
	}

	return 0;
}












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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;



int main()
{
    int A,B;
    cin >>A >>B;
    int c,d;
    c=A/100;
    d=B/100;
    int e,f;
    int res;
    res=d-c-1;
    
      e = c*100+c/100+(c/10%10)*10;
      f = d*100+d/100+(d/10%10)*10;
      if(e>=A)res++;
      if(f<=B)res++;
    cout << res <<endl;
}  


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

using namespace std;

int main(void)
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a == 5 && b == 5 && c == 7) cout<<"YES"<<endl;
	else if(a == 5 && b == 7 && c == 5) cout<<"YES"<<endl;
	else if(a == 7 && b == 5 && c == 5) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
    string S; cin >> S;
    int Q; cin >> Q;

    bool original_order = true;
    // 元の順序か(true)、反転した順序か(false)

    stack<char> st_T, st_F;
    queue<char> que_T, que_F;

    rep(i, Q) {
        int T; cin >> T;
        if (T == 1) original_order = !original_order;
        else {
            int F; cin >> F;
            char C; cin >> C;
            if (F == 1 && original_order) {
                st_T.push(C); que_F.push(C);
            } else if (F == 1 && !original_order) {
                que_T.push(C); st_F.push(C);
            } else if (F == 2 && original_order) {
                que_T.push(C); st_F.push(C);
            } else {
                st_T.push(C); que_F.push(C);
            }
        }
    }

    if (original_order) {
        while (st_T.size()) {
            cout << st_T.top();
            st_T.pop();
        }
        cout << S;
        while (que_T.size()) {
            cout << que_T.front();
            que_T.pop();
        }
    } else {
        while (st_F.size()) {
            cout << st_F.top();
            st_F.pop();
        }
        for (int i = S.size() - 1; i >= 0; i--) {
            cout << S[i];
        }
        while (que_F.size()) {
            cout << que_F.front();
            que_F.pop();
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
// D

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  string s,n;
  cin>>n>>s;
  ll cnt(0);
  for (int i(0);i<1000;i++){
    ostringstream sout;
    sout << setfill('0') << setw(3) << i;
    string x = sout.str();
    int cnti(0);
    for (int j(0);j<s.size();j++){
      if (x[cnti] == s[j]) cnti++;
      if (cnti == 3) break;
    }
    if (cnti == 3) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s,t; cin >> s >> t;
    int res=0;
    rep(i,3) if(s[i]==t[i]) res++;
    cout<<res<<endl;
}

Measured memory_bytes: 3652
import java.util.* ;
class Main {
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
  int a = scan.nextInt();
    
    if(a<1000){
      System.out.println("ABC");
    }else{
      System.out.println("ABD");
    }
  }
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
 #define rep(i,n) for(int i=0;i<n;i++)
 using namespace std;
  int main(){
      string s,t;
      cin >> s >> t;
      sort(s.begin(),s.end());
      sort(t.begin(),t.end(),greater<>());
      int size=min(s.size(),t.size());

   rep(i,size){
       if(s[i]<t[i]){
           cout << "Yes" << endl;
         //  cout << " " << s << " " << t << endl;
           break;
       }
       if(s[i]>t[i]){
           cout << "No" << endl;
           break;
       }
           if(i+1==size && s.size()>t.size()){
               cout << "No" << endl;
           }
          if(i+1==size && s.size()<t.size()){
               cout << "Yes" << endl;
           }
         if(i+1==size && s.size()==t.size()){
               cout << "No" << endl;
           }
   }
   
    }

Measured memory_bytes: 3592
fun main(array: Array<String>){
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }.sorted().toIntArray()

    val n = A.last()
    var min = Double.MAX_VALUE / 10
    var r = 0
    for(i in 0 until N - 1){
        if(Math.abs(A[i] - n / 2) < min){
            min = Math.abs(A[i] - n.toDouble() / 2)
            r = A[i]
        }
    }
    println("$n $r")
}

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

long long n;

int main(){

	cin>>n;
	
	int lastx=0,lasty=0,lastt=0,t,x,y;
	bool ok=true;
	
	for(int i=0;i<n;i++){
    cin>>t>>x>>y;
    
    if(abs(lastx-x)+abs(lasty-y)>t-lastt || ((abs(lastx-x)+abs(lasty-y))%2) != ((t-lastt)%2)){
    
    //cout<<abs(lastx-x)+abs(lasty-y)<<" "<<t-lastt<<endl;
    
    ok=false;
    break;
    }
    
    lastx=x;
    lasty=y;
    lastt=t;
    }
	
	if(ok)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;

return 0;
}


Measured memory_bytes: 256
n = int(input())
x = input().split()
x = [int(xx) for xx in x]
y = sorted(x)
m = y[int(n/2)]
for i in range(n):
    if x[i] >= m:
        print(y[int(n/2) - 1])
    else:
        print(y[int(n/2)])

Measured memory_bytes: 25620
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,k;
  cin >> n >> k;
  int r,s,p;
  cin >> r >> s >> p;
  string t;
  cin >> t;

  vector<char> ss(n);
  rep(i,n){
    if(t[i]=='r'){
      ss[i] = 'p';
    }
    else if(t[i]=='s'){
      ss[i] = 'r';
    }
    else{
      ss[i] = 's';
    }
  }

  map<char,int> mp;
  mp['r'] = r;
  mp['s'] = s;
  mp['p'] = p;
  int res = 0;
  rep(i,n){
    if(i-k>=0){
      if(ss[i]!=ss[i-k]){
	res += mp[ss[i]];
      }
      else{
	ss[i] = '.';
      }
    }
    else{
      res += mp[ss[i]];
    }
  }
  cout << res << "\n";
  return 0;
}


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

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

    bool is_prime[100001];
    is_prime[0] = is_prime[1] = false;

    for (int a=2; a<100001; a++) {
        is_prime[a]=true;
    }

    for (int a=2; a<100001; a++) {
        if(is_prime[a]) {
            for(int b=2; b*a<100001; b++) {
                is_prime[b*a] = false;
            }
        }
    }

    vector<int> like;
    int counter = 0;
    like.push_back(0);
    like.push_back(0);
    like.push_back(0);
    for (int a=3; a<100001; a++) {
        if(a%2==1) {
            if(is_prime[a]) {
                int x = (a+1)/2;
                if(is_prime[x])
                    counter++;
            }
        }

        like.push_back(counter);
    }


    int n;
    cin >> n;

    for (int i=1; i<=n; i++) {
        int L, R;
        cin >> L >> R;

        int ai = like[R] - like[L-1];

        cout << ai << endl;
    }

}


Measured memory_bytes: 1272
n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(1, n - 1):
    if (p[i - 1] > p[i] and p[i] > p[i + 1]) or (p[i - 1] < p[i] and p[i] < p[i + 1]):
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
int read( ){
	int x=0,y=1;char ch=' ';
	for(;(ch!='-' && (ch>'9' || ch<'0'));ch=getchar( ));
	if(ch=='-')y=-1,ch=getchar( );
	for(;ch>='0' && ch<='9';ch=getchar( ))x=x*10+ch-48;
	return x*y;
}
const int N=310,mod=1e9+7;
int f[N][N][N],c[3];
int n,m;
vector<pair<int,int> > v[N];
const int d[6][3]={{0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,0,1},{2,1,0}};
int chk(int x,int y,int z){
	int R=max(x,max(y,z)),sum;
	for(register int i=0;i<v[R].size( );++i){
		int L=v[R][i].fr;sum=0;
		if(x>=L)++sum;if(y>=L)++sum;if(z>=L)++sum;
		if(sum!=v[R][i].sc)return 0;
	}
	return 1;
}

int main( ){
	int x,y,z,k;
	n=read( );m=read( );
	for(register int i=1;i<=m;++i){
		x=read( );y=read( );z=read( );
		v[y].push_back(make_pair(x,z));
	}
	f[0][0][0]=1;
	
	for(c[0]=0;c[0]<=n;++c[0])
		for(c[1]=0;c[1]<=c[0];++c[1])
			for(c[2]=0;c[2]<=c[1];++c[2])
				for(register int i=0;i<6;++i){
					//printf("%d %d %d\n",c[0],c[1],c[2]);
					if(c[0]==c[1] && c[0] || c[1]==c[2] && c[1] || 
					c[0]==c[2] && c[2])break;
					if(i==1 && !c[0] && !c[1] && !c[2])break;
					//printf("%d %d %d\n",c[0],c[1],c[2]);
					x=c[d[i][0]];y=c[d[i][1]];z=c[d[i][2]];
				//	printf("%d %d %d %d\n",x,y,z,f[x][y][z]);
					if(!chk(x,y,z)){
						f[x][y][z]=0;continue;
					}
					k=max(x,max(y,z));
					f[k+1][y][z]=(f[k+1][y][z]+f[x][y][z])%mod;
					f[x][k+1][z]=(f[x][k+1][z]+f[x][y][z])%mod;
					f[x][y][k+1]=(f[x][y][k+1]+f[x][y][z])%mod;
					if(x!=n && y!=n && z!=n)f[x][y][z]=0;
				}
	int ans=0;
	for(register int i=0;i<n;++i)
		for(register int j=0;j<n;++j)
			if(i!=j || i==0 && j==0)
				ans=((ans+f[n][i][j])%mod+(f[i][n][j]+f[i][j][n])%mod)%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 114944
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, Ma, Mb, a[50], b[50], c[50];
	static int DP[50][500][500], INF = pow(10, 9);
	cin >> N >> Ma >> Mb;
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j < 500; j++) {
			for (int k = 0; k < 500; k++) {
				DP[i][j][k] = INF;
			}
		}
	}
	DP[0][0][0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 500; j++) {
			for (int k = 0; k < 500; k++) {
				if (j < a[i] || k < b[i]) DP[i + 1][j][k] = DP[i][j][k];
				else DP[i + 1][j][k] = min(DP[i][j][k], DP[i][j - a[i]][k - b[i]] + c[i]);
			}
		}
	}
	int ans = INF;
	for (int i = 1; i < min(500 / Ma, 500 / Mb); i++) {
		ans = min(ans, DP[N][Ma * i][Mb * i]);
	}
	if (ans == INF) cout << -1;
	else cout << ans;
}

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

int main() {
    int n;
    cin >> n;
    int arr[100];
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for(int i = 0; i < n-1; i++) {
        cout << arr[n-i-1] << " ";
    }
    cout << arr[0] << endl;
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
using namespace std;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<pair<int, int>>;
using VTIII = vector<tuple<int, int, int>>;
using Complex = complex<double>;
using LD = long double;
template<typename T> inline bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a==b)){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a==b)){ a=b; return true; } return false; }
template<typename T> inline bool isin(const T& x, const T& l, const T& r){ return l <= x and x < r; }
inline ostream& fcout(int n = 10){ return cout << fixed << setprecision(n); }
inline ostream& rcout(int n = 2){ return cout << right << setw(n); }
constexpr int64_t INF = numeric_limits<int64_t>::max();
constexpr int32_t INF32 = numeric_limits<int32_t>::max();
constexpr int64_t MOD = 1000000007LL;
constexpr long double PI = 3.14159265358979323846264338327950288;
constexpr double EPS = 1e-10;


int N;


int32_t main(){
    cin >> N;

    vector<PII> v, u;
    rep(i, 0, N){
        string s;
        cin >> s;
        int a = 0, b = 0;
        for(char c : s){
            if(c == '(') a++;
            else a--;
            chmin(b, a);
        }
        if(a > 0) v.emplace_back(b, a);
        else u.emplace_back(b-a, a);
    }

    sort(ALL(v), greater<PII>());
    sort(ALL(u));

    int a = 0, b = 0;
    for(auto p : v){
        chmin(b, a+p.first);
        a += p.second;
    }
    for(auto p : u){
        chmin(b, a+p.second+p.first);
        a += p.second;
    }

    if(a == 0 and b >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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



int main(){
    ll n;cin>>n;
    ll a[100010],an=0;
    rep(i,0,n)cin>>a[i];
    a[n]=0;
    rep(i,0,n){
        an+=a[i]/2;
        if(a[i]%2==1&&a[i+1]!=0){an++;a[i+1]--;}
    }
    cout<<an<<endl;
}







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

using namespace std;

int main() {
  string N;
  cin >> N;
  for (int i = 0; i < 2; ++i) {
    if (N[i] == '9') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};

int k[110];
int res[110];

int main() {
	int n;
	int a,b,c,d;
	cin>>n;
	rep(i,n*(n-1)/2){
		cin>>a>>b>>c>>d;
		--a,--b;
		if(c>d)k[a]+=3;
		else if(c<d)k[b]+=3;
		else ++k[a],++k[b];
	}
//rep(i,n)cout<<k[i]<<endl;
	vpint v;
	rep(i,n)v.PB(MP(-k[i],i));
	sort(all(v));
	int j=0;
	rep(i,n){
		if(i==0||v[i-1].first!=v[i].first)j=i;
		res[v[i].second]=j+1;
	}
	rep(i,n)cout<<res[i]<<endl;
	return 0;
}

Measured memory_bytes: 0
N,M = map(int,input().split())
A = list(map(int,input().split()))
cums = [0]
for a in A:
    cums.append(cums[-1] + a)

cump = [c%M for c in cums]
from collections import Counter
ctr = Counter(cump)

ans = 0
for v in ctr.values():
    ans += v*(v-1)//2
print(ans)

Measured memory_bytes: 25636
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp(a,b) make_pair(a,b)
const long long mod = 1000000007;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<int ,P> PP;
struct edge { int to; int to2; int cost; };
string s[2005];
int rn[4][2005][2005];
signed main() {
	int h, w; cin >> h >> w;
	rep(i, h)cin >> s[i];
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] != '#') {
				rn[0][i + 1][j + 1] = rn[0][i + 1][j] + 1;
				rn[1][i + 1][j + 1] = rn[1][i][j + 1] + 1;
			}
		}
	}
	rep(i, h) {
		for (int j = w - 1; j >= 0; j--) {
			if (s[i][j] != '#')rn[2][i + 1][j + 1] = rn[2][i + 1][j + 2] + 1;
		}
	}
	for (int i = h - 1; i >= 0; i--) {
		rep(j, w) {
			if (s[i][j] != '#')rn[3][i + 1][j + 1] = rn[3][i + 2][j + 1] + 1;
		}
	}
	int ans = 0;
	rep(i, h)rep(j, w)ans = max(ans, rn[0][i + 1][j + 1] + rn[1][i + 1][j + 1] + rn[2][i + 1][j + 1] + rn[3][i + 1][j + 1] - 3);
	cout << ans << endl;
}

Measured memory_bytes: 129920
import math
a,b = map(int,input().split())
c = b - a
if c < 0:
    print(-1)
    exit()
d = math.floor(c / 2 * 100)
for i in range(max(0, d - 10000), d + 10000):
    if math.floor(i * 1.08) - i == a and math.floor(i * 1.1) - i == b:
        print(i)
        exit()
print(-1)


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

class Program{
  public static void Main(){

    var input = Console.ReadLine().Split();
    int a = int.Parse(input[0]);
    int b = int.Parse(input[1]);
    int c = int.Parse(input[2]);
    
    if(b-a==c-b){
      Console.WriteLine("YES");
    }
    else{
      Console.WriteLine("NO");
    }
  }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
	int n;
	double v, t;
	
	while (scanf("%lf", &v) != EOF){
		t = v / 9.8;
		
		for (n = 1; 5 * n - 5 <= 4.9 * t * t; n++){
		}
		printf("%d\n", n);
	}
	return (0);
}

Measured memory_bytes: 628
//AOJ 1188 Hierarchical Democracy
#include <bits/stdc++.h>
using namespace std;

typedef string::const_iterator State;

int numeral(State &s){
	int n = 0;
	while(isdigit(*s)){
		n *= 10;
		n += *s - '0';
		++s;
	}
	
	return n;
}

int parse(State &s){
	vector<int> res;
	for(;;){
		if(*s == '['){
			++s;
			res.emplace_back(parse(s));
			++s;
		}
		else if(*s == ']'){
			int n = res.size() / 2;
			sort(res.begin(), res.end());
			return accumulate(res.begin(), res.begin() + n + 1, 0);
		}
		else {
			if(isdigit(*s)) {
				int n = numeral(s);
				res.emplace_back(n / 2 + 1);
			}
			else break;
		}
	}

	sort(res.begin(), res.end());
	return *res.begin();
}

int main(){
	int n;
	string s;
	
	cin >> n;
	for(int i = 0;i < n;++i){
		cin >> s;
		State begin = s.begin();
		cout << parse(begin) << endl;
	}
	return 0;
}

Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 2e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;

int n;
char niz[maxn];

int main() {
	scanf("%s", niz); n = strlen(niz);
	
	if ((n + (niz[0] == niz[n - 1])) % 2 == 1) printf("First");
	else printf("Second"); 
	return 0;
}

Measured memory_bytes: 3876
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
struct Point{
    int x;
    int y;
    vector<Point> next;
    void get_next(vector<vector<int>> map){
        int py=y+1;int px=x;
        if(map[py][px]!=inf){
            Point buf;
            buf.x=px;buf.y=py;
            next.push_back(buf);
        }
        py=y-1;px=x;
        if(map[py][px]!=inf){
            Point buf;
            buf.x=px;buf.y=py;
            //next.push_back(buf);
        }
        py=y;px=x+1;
        if(map[py][px]!=inf){
            Point buf;
            buf.x=px;buf.y=py;
            next.push_back(buf);
        }
        py=y;px=x-1;
        if(map[py][px]!=inf){
            Point buf;
            buf.x=px;buf.y=py;
            //next.push_back(buf);
        }
    }
};
struct Map{
int h;
int w;
char road='.';//道を表す文字
char wall='#';//壁を表す文字
vector<vector<int>> map;
void mkmap(int in_h,int in_w,vector<vector<int>> const& input){
    h=in_h;w=in_w;
    for(int i=0;i<=h+1;i++){
        map.push_back(vector<int>(w+2,inf));
    }
    //道ならinf-1にする処理
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(input[i][j]==road){
                map[i+1][j+1]--;
            }
            map[i+1][j+1]=input[i][j];
        }
    }
}
void output(){
    for(int i=0;i<=h+1;i++){
        for(int j=0;j<=w+1;j++){
            if(this->map[i][j]==inf)cout<<wall;
            else cout<<map[i][j];
        }
        cout<<endl;
    }
}
void BFS(){
Point s;
s.x=1;s.y=1;
queue<Point> que;
vector<vector<int>> memo(h+2,vector<int> (w+2,0));
que.push(s);
this->map[s.y][s.x]=0;
memo[s.y][s.x]=0;
while(!que.empty()){
    Point buf;
    buf=que.front();
    que.pop();
    buf.get_next(map);
    int num=buf.next.size();
    for(int i=0;i<num;i++){
        if(memo[buf.next[i].y][buf.next[i].x]<memo[buf.y][buf.x]+map[buf.next[i].y][buf.next[i].x]){
            que.push(buf.next[i]);
            memo[buf.next[i].y][buf.next[i].x]=memo[buf.y][buf.x]+map[buf.next[i].y][buf.next[i].x];
        }
    }
}
for(int i=0;i<=h+1;i++){
  for(int j=0;j<=w+1;j++){
    map[i][j]=memo[i][j];
  }
}
}
int map_max(){
    int max=0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(map[i][j]!=inf){
                if(map[i][j]>max)max=map[i][j];
            }
        }
    }
    return max;
}
int dist(int y,int x){
    return map[y][x];
}
};

signed main(){
  int n;cin>>n;
  vector<vector<int>> input(2,vector<int>(n,0));
  rep(i,n){
    cin>>input[0][i];
  }
  rep(i,n)cin>>input[1][i];
  Map rab;
  rab.mkmap(2,n,input);
  rab.BFS();
  //rab.output();
  cout<<rab.dist(2,n)+input[0][0]<<endl;
  return 0;
}


Measured memory_bytes: 256
N = gets.to_i

@ans = Array.new(N){Array.new}

def decide(rooms, lv)
	if rooms.size == 1
		return
	end
	if rooms.size == 2
		i, j = rooms
		@ans[i][j] = lv
	end
	rooms1 = Array.new
	rooms2 = Array.new
	rooms.each_with_index do |room, i|
		if i % 2 == 0
			rooms1.push(room)
		else
			rooms2.push(room)
		end
	end
	rooms1.each do |i|
		rooms2.each do |j|
			if i < j
				@ans[i][j] = lv
			else
				@ans[j][i] = lv
			end
		end
	end
	decide(rooms1, lv + 1)
	decide(rooms2, lv + 1)
end
decide((0..(N - 1)).to_a, 1)
puts @ans.collect{|line| line.compact.join(' ')}

Measured memory_bytes: 6268
let n = Scanf.scanf "%d" ((+) 0)
let v = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0))
let c = Array.init 2 (fun _ -> Array.init 101010 (fun i -> (0, i)))
let upd (x, i) = (x-1, i)

let () = Printf.printf "%d\n" @@ begin
  for i = 0 to n/2 - 1 do
    c.(0).(v.(2*i)) <- upd c.(0).(v.(2*i));
    c.(1).(v.(2*i+1)) <- upd c.(1).(v.(2*i+1));
  done;
  Array.sort compare c.(0);
  Array.sort compare c.(1);
  let v00, i00 = c.(0).(0) in
  let v10, i10 = c.(1).(0) in
  if i00 <> i10 then n + v00 + v10
  else min (n + v00 + fst c.(1).(1)) (n + fst c.(0).(1) + v10)
end

Measured memory_bytes: 13184
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i < n-2; i++) {
        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    bool s=false;
    for(int i=1;i<10;i++)
    {
        if((n/i<10) && (n%i==0))
        {
            s=true ;
            break;

        }
    }
    if(s)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
<?php
  $x = trim(fgets(STDIN));
  $b = 2;
  $p = 2;
  $li[0] = 1;
  while(1){
    $cal = $b**$p;
    if($cal <= $x){
      $li[] = $cal;
      $p++;
    }else{
      if($p == 2){
        break;
      }else{
        $p = 2;
        $b++;
      }
    }
  }
  echo max($li)."\n";
  

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define int long long
#define sz(x) (int)x.size()
#define mp make_pair
#define fi first
#define se second
#define io ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;



signed main()
{
	io;
	int d,t,s;
	cin >> d >> t >> s;
	int time;
	if(d%s==0)
	{
		time = d/s;
	}
	else time = d/s+1;
	if(time<=t)
	{
		cout << "Yes"<<endl;
	}
	else cout << "No" <<endl;
}
 
	
		



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

int main() 
{
    int a;
    int b;
    int i;
    int j;
    string s;
    
    cin >> a >> b;
    i = -1;
    while (++i < a + 2)
    {
        j = -1;
        if (0 < i && i <= a)
            cin >> s;
        while (++j < b + 2)
        {
            if (0 < i && i <= a && 0 < j && j <= b)
                cout << s[j - 1];
            else
                cout << '#';
        }
        cout << endl;
    }
}


Measured memory_bytes: 256