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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
    else {cout << "consonant" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x, y;
  	cin>>x>>y;
  	
 	if(y%2!=0){
      	cout<<"No"<<endl;
      	return 0;
    }
  	if(2*x<=y && y<=4*x){
      	cout<<"Yes"<<endl;
      	return 0;
    }else{
      	cout<<"No"<<endl;
      	return 0;
    }
  	return 0;
}

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

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    int string[s.size()];

    for(int i = 0; i < s.size(); i++){
        string[i] = s[i] - 'a';
    }

    int alp[26] = {0};

    for(int i = 0; i < s.size(); i++){
        alp[string[i]]++;
    }

    int index = -1;

    for(int i = 0; i < 26; i++){
        if(alp[i]==0){
            index = i;
            break;
        }
    }

    char ans = 'a' + index;

    if(index!=-1) cout << ans << endl;
    else cout << "None" << endl;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int N;
vi A;

signed main() {
    cin >> N;
    A = vi(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(ALL(A));

    int len = 0;
    ll side1 = 0;
    ll side2 = 0;
    for (int i = N - 1; i >= 0; --i) {
        if (len != A[i]) {
            len = A[i];
        } else {
            if (side1 == 0) {
                side1 = len;
                len = 0;
            } else {
                side2 = len;
                break;
            }
        }
    }

    ll ans = side1 * side2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define printvector(v,n) for(int i=1;i<=n;i++) cout<<v[i]<<" "; cout<<ln;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for int64)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define RFOR(i,b,a) for(int i=b; i>=a; i--)
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define setPresent(x,s) (s.find(x)!=s.end())
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
typedef map<ll,ll> m64;
#pragma GCC optimize ("-O2")
template<class T> using min_heap = priority_queue<T, std::vector<T>, std::greater<T> >; 
string s;

int main()
{    
    ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>s;
	int n=s.length();
	FOR(i,-1,n-1){
		FOR(j,i+1,n-1){
			vector<char> v;
			FOR(k,0,i) v.pb(s[k]);
			FOR(k,j,n-1) v.pb(s[k]);
			if(int(v.size())==7&&v[0]=='k'&&v[1]=='e'&&v[2]=='y'&&v[3]=='e'&&v[4]=='n'&&v[5]=='c'&&v[6]=='e'){
				cout<<"YES\n"; return 0;
			}
		}
	}
	cout<<"NO\n";
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a = inpll(3)
    n = inp()
    b = inplm(n)
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                a[i][j] = 0
    for i in range(3):
        flag = True
        for j in range(3):
            if a[i][j] != 0:
                flag = False
        if flag:
            print('Yes')
            return
    for i in range(3):
        flag = True
        for j in range(3):
            if a[j][i] != 0:
                flag = False
        if flag:
            print('Yes')
            return
    flag = True
    for i in range(3):
        if a[i][i] != 0:
            flag = False
    if flag:
        print('Yes')
        return
    flag = True
    for i in range(3):
        if a[i][2-i] != 0:
            flag = False
    if flag:
        print('Yes')
        return
    print('No')
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 39020
import collections,sys
def LI(): return list(map(int,sys.stdin.readline().split()))
N,Q = LI()
ab = [LI() for _ in range(N-1)]
px = [LI() for _ in range(Q)]
ans = {i:0 for i in range(1,N+1)} #1_index
graph = {i:collections.deque() for i in range(1,N+1)} #1_index
for a,b in ab:
        graph[a].append(b)
        graph[b].append(a)
for p,x in px:
    ans[p] += x
seen = {i:-1 for i in range(1,N+1)} #1_index
stack = []
def dfs():
    seen[1] = 1
    stack.append(1)
    while stack:
        s = stack.pop()
        if not graph[s]:
            continue
        for j in range(len(graph[s])):
            g_NO = graph[s].popleft()
            if seen[g_NO]!=-1:
                continue
            seen[g_NO] = 1
            stack.append(g_NO)
            ans[g_NO] += ans[s]
dfs()
print(*[a for a in ans.values()])


Measured memory_bytes: 299224
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  long long k, a, b;
  cin >> k >> a >> b;
  if (a >= k) {
    cout << 1 << endl;
  } else {
    long long c = a - b;
    if (c <= 0) {
      cout << -1 << endl;
    } else {
      k -= a;
      cout << ((k + c - 1) / c) * 2 + 1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
money=list(map(int,input().split()))
N=int(input())
best_over2=int(min(8*money[0],4*money[1],2*money[2],money[3]))
best_under1=int(min(4*money[0],2*money[1],money[2]))
if(N==1):
    print(best_under1)
elif(N%2==0):
    print((N//2)*best_over2)
elif(N%2!=0):
    print((N//2)*best_over2+best_under1)


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

enum Command
{
    insert=0, 
    get=1,
};

using namespace std;

int main()
{
    map<string, int> Map;
    
    int N;
    
    cin >> N;
    
    for(int i = 0; i < N; ++i)
    {
        int c; cin >> c;
        string color; cin >> color;
        
        if(c == insert)
        {
            int Val; cin >> Val;
            Map[color] = Val;
        }
        else if(c == get)
            cout << Map[color] << endl;
        
    }
 
    return 0;
    
}


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

int main()
{
    int a , b;
    cin>> a >> b;
    if (a>=13) {
        cout<< b;
    }
    else {
        if(a<=12) {
            if (a>=6) {
                cout<< b/2;
            }
            else{
                cout<< 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3568
C = []
result = [[0]*3 for i in range(3)]
ans = "No"
for i in range(3):
    a = list(map(int, input().split()))
    C.append(a)

def check():
    b = int(input())
    for i in range(3):
        for j in range(3):
            a = C[i][j]
            if b == a:
                result[i][j] = 1

def column():
    for j in range(3):
        for i in range(3):
            if result[i][j] == 0:
                break
        else:
            global ans
            ans = "Yes"

def row():
    for i in range(3):
        for j in range(3):
            if result[i][j] == 0:
                break
        else:
            global ans
            ans = "Yes"

def naname():
    global ans
    for j in range(3):
        if result[j][j] == 0:
            break
    else:
        ans = "Yes"
    for j in range(3):
        if result[j][2-j] == 0:
            break
    else:
        ans = "Yes"

N = int(input())
for i in range(N):
    check()
    column()
    row()
    naname()

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define full(c) c.begin(), c.end()
#define vector2d(name, type, h, w, init) vector<vector<type>> name(h, vector<type>(w, init))
typedef signed long long int ll;
typedef unsigned long long int ull;
const int PRIME=1000000007;
using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b==c) cout<<1<<endl;
  else if(a==b || b==c || c==a) cout<<2<<endl;
  else cout<<3<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <ctime>
const int MAXN = (int)1e6+5;
const int MODN = (int)1e9+7;
typedef long long ll;
int inf=0x3f3f3f3f;
using namespace std;

char str[MAXN];
ll  num[MAXN];


int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c)!=EOF){
		if(a+b>=c){
			printf("Yes");
		}else{
			printf("No");
		}
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
string vote[2000000],temp;
int cot[2000000];
int sol[2000000];
string ans[2000000];
int main()
{
    int n,i,j,k,ma;
    cin>>n;
        for(i=0;i<n;i++) cot[i]=1;
        for(i=0;i<n;i++)
        {
            cin>>vote[i];
        }
        sort(vote,vote+i);
        j=0;
        for(i=0;i<n;i++)
        {
            while(vote[i+1]==vote[i]){cot[j]++;i++;}
            if(cot[j]>1)sol[j]=i-1;else sol[j]=i;j++;
        }
        ma=cot[0];
        for(i=0;i<n;i++)
        {
            ma=max(cot[i],ma);
        }
        j=0;
        for(i=0;i<n;i++)
        {
            if(cot[i]==ma) {ans[j]=vote[sol[i]];j++;}
        }
        sort(ans,ans+j);
        for(i=0;i<j;i++) cout<<ans[i]<<endl;

}


Measured memory_bytes: 49280
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    vector<int64_t> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    vector<int64_t> cumsum(n + 1);
    cumsum[0] = 0;
    for (int i = 0; i < n; i++) {
        cumsum[i + 1] = cumsum[i] + a[i];
    }
    
    map<int64_t, int64_t> cnt;
    for (int i = 0; i < n + 1; i++) cnt[cumsum[i]]++;
    
    int64_t ans = 0;
    for (auto &iter : cnt) {
        ans += (iter.second * (iter.second - 1)) / 2;
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,sz1,sz2,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX; string str,ttr,ntr;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct,tct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr,mp1,mp2;

        scanf("%lld %lld",&n,&m);
        for(i=1;i<=n;i++)
        {
            scanf("%lld",&a);  mp[i]=a;

        }

        ans=n;

        for(i=1;i<=m;i++)
        {

            scanf("%lld %lld",&a,&b);

            if(mp[a]<=mp[b])
            {
                if(nq[a]==0){ ans--;  nq[a]=1;  }
            }
            if(mp[b]<=mp[a])
            {
                if(nq[b]==0){ ans--;  nq[b]=1;  }
            }

        }



        printf("%lld\n",ans);





    return 0;
}





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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define mset(a,x) memset(a,x,sizeof(a))


int main() {
    string s;
    cin >> s;
    bool c = 0, f = 0;
    for(auto& cc : s) {
        if(cc == 'C') {
            c = true;
        }
        else if(cc == 'F' && c) {
            f = true;
        }
    }

    cout << (c && f ? "Yes" : "No") << endl;

    return 0;
}

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

int main() {
  int K;
  string S,T;
  cin>>K>>S;
  if(S.size()<=K){
    cout << S << endl;
  }
  else{
    
    for(int i=0;i<K;i++){
      T += S[i];
    }
    
    cout << T << "..." << endl;
  }
      
  
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1.0)
using namespace std;

const int lim = 1e5 + 5;

int main(int argc, char const *argv[])
{
		double a, n; cin >> n;
a = 2*PI*n;
		cout << a << endl;

	return 0;
}

Measured memory_bytes: 3808
S = input()
T = input()

tdic = dict()
sdic = dict()
for i in range(len(S)):
    if T[i] in tdic:
        if tdic[T[i]] != S[i]:
            print("No")
            break
    else:
        tdic[T[i]] = S[i]

    if S[i] in sdic:
        if sdic[S[i]] != T[i]:
            print("No")
            break
    else:
        sdic[S[i]] = T[i]
else:
    print("Yes")

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

int main() {
    int n, m, t, p, d, c, x, y;
    while (cin >> n >> m >> t >> p) {
        if (n == 0) break;

        int h = m, w = n;
        vector<vector<int>> ov(h, vector<int>(w, 1));
        for (int i=0; i<t; ++i) {
            cin >> d >> c;
            if (d == 1) {
                int w2 = max(c, w-c);
                vector<vector<int>> ov2(h, vector<int>(w2, 0));
                // left part
                for (int j=0; j<h; ++j)
                    for (int k=0; k<c; ++k)
                        ov2[j][c-1-k] += ov[j][k];
                // right part
                for (int j=0; j<h; ++j)
                    for (int k=c; k<w; ++k)
                        ov2[j][k-c] += ov[j][k];
                ov = ov2;
                w = w2;
            } else {
                int h2 = max(c, h-c);
                vector<vector<int>> ov2(h2, vector<int>(w, 0));
                // bottom part
                for (int j=0; j<c; ++j) 
                    for (int k=0; k<w; ++k) 
                        ov2[c-1-j][k] += ov[j][k];
                // up part
                for (int j=c; j<h; ++j) 
                    for (int k=0; k<w; ++k) 
                        ov2[j-c][k] += ov[j][k];
                ov = ov2;
                h = h2;
            }
        }
        for (int i=0; i<p; ++i) {
            cin >> x >> y;
            cout << ov[y][x] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3080
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

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

signed main() {
    SS(ll,n);
    SV(ll,a,n);
    ll ans=0;
    rep(i,n-2){
        if(a[i]<=a[i+1]&&a[i+1]<=a[i+2])ans++;
        if(a[i]>=a[i+1]&&a[i+1]>=a[i+2])ans++;
    }
    p(ans);
}

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

using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; ++i) {
        cin >> a[i];
    }
    vector<int> cnt(N, -1);
    vector<int> id(N, -1);
    int res = 0;
    for(int i=0; i<N; ++i) {
        if(cnt[i] == -1) {
            int sum = 0;
            int now = i;
            while(cnt[now] == -1) {
                cnt[now] = sum++;
                id[now] = i;
                (now += a[now]) %= N;
            }
            if(id[now] == i) {
                res += sum - cnt[now];
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3876
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

string rotate(string &in){
  string ret=in.substr(1);
  return ret+in[0];
}

bool isc(string tar,string a){
  rep(i,a.size()){
    if (search(a.begin(),a.end(),tar.begin(),tar.end()) != a.end())return true;
    a=rotate(a);
  }
  return false;
}

main(){

  string tar;
  while(cin>>tar){
    int ret=0;
    int n;
    cin>>n;
    rep(i,n){
      string tmp;
      cin>>tmp;
      if (isc(tar,tmp))ret++;
    }
    cout << ret << endl;
  }
  
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    long long int n,a,b;
    cin>>n>>a>>b;
    long long int ans=a*(n/(a+b));
    long long int rem=n%(a+b);
    ans+=min(a,rem);
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+5;
const int MOD=1e9+7;
template <class T>
bool sf(T &ret){ //Faster Input

    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}

int a[N];
struct node{
    int l,r;
}p[N];
int tot;
bool cmp(node a ,node b){
    if(a.r==b.r)    return a.l>b.l;
    return a.r<b.r;
}
int main(void){
    int n,q;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=q;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        p[++tot].l=u;
        p[tot].r=v-1;
    }
    sort(p+1,p+1+tot,cmp);
    int ans=1;
    int t=p[1].r;
    for(int i=2;i<=tot;i++){
        if(t<p[i].l){
            ans++;
            t=p[i].r;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
	    int n;
		n = sc.nextInt();
		int ans=0;
		for(int i=0; i<n; i++){
			int a;
			a = sc.nextInt();
			while(a%2==0){
				ans++;
				a/=2;
			}
		}
	System.out.println(ans);
    }
}


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

int main(){
	int N,d;
	cin >> N >> d;
	vector< array<int,3> > star;
	for(int i = 0 ; i < N ; i++){
		int x,y,b;
		cin >> x >> y >> b;
		star.push_back(array<int,3>{b,x,y});
	}	
	sort(star.begin(),star.end());
	int l = 0 , r = 0;
	multiset<int> X,Y;
	long long ans = 0;
	while( r != N){
		X.insert(star[r][1]);
		Y.insert(star[r][2]);
		r++;
		while( star[r-1][0] - star[l][0] > d ){
			X.erase(X.find(star[l][1]));
			Y.erase(Y.find(star[l][2]));
			l++;
		}
		ans = max((long long)((*X.rbegin())-(*X.begin())) * ((*Y.rbegin())-(*Y.begin())),ans);
		//cout << (*X.rbegin())-(*X.begin()) << " " << ((*Y.rbegin())-(*Y.begin())) << "|" << star[r-1][0] - star[l][0] << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 22524
import Control.Monad (replicateM)
import Data.ByteString.Char8 as C (readInteger, getLine)
import Data.Maybe

getNIntegers :: Int -> IO [Integer]
getNIntegers n = map (fst . fromJust . readInteger) <$> replicateM n C.getLine

f :: [Integer] -> Maybe Integer
f [_] = Just 0
f (a:b:bs) =
  case compare (a + 1) b of
    LT -> Nothing
    EQ -> fmap (+ 1) (f (b:bs))
    GT -> fmap (+ b) (f (b:bs))

f' :: [Integer] -> Maybe Integer
f' a =
  if head a == 0
    then f a
    else Nothing

main = do
  n <- readLn :: IO Int
  a <- getNIntegers n :: IO [Integer]
  print $ case f' a of
            Just i  -> i
            Nothing -> -1

Measured memory_bytes: 50812
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mod 1000000007
int main() {
    ll x;
    cin >> x;
    ll p = 100;
    if (p == x) {
        cout << "0" << endl;
        return 0;
    }
    else {
        for (ll i = 1; i <= 1000000000; i++) {
            ll z = p / 100;
            p += z;
            if (p >= x) {
                cout << i;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3636
#include <cstdio>
#include <vector>
#include <unordered_map>

using namespace std;

const int mod = 1000000007;

vector<int> findPrimes() {
    vector<int> primes;
    vector<bool> vis(1000, false);
    for (int i = 2; i < 1000; i += 1) {
        if (vis[i] == false) {
            primes.push_back(i);
            for (int j = i * i; j < 1000; j += i) {
                vis[j] = true;
            }
        }
    }
    return primes;
}

unordered_map<int, int> countPrimes(int v, const vector<int>& primes) {
    int num_primes = primes.size();
    unordered_map<int, int> factors;
    
    int idx = 0;
    while (idx < num_primes)
    {
        if (v % primes[idx] == 0) {
            v /= primes[idx];
            factors[primes[idx]] += 1;
        } else {
            idx += 1;
        }
    }
    
    if (v != 1) {
        factors[v] += 1;
    }
    return factors;
}

int findReversedMultiplier(int v) {
    int deg = mod - 2;
    long long mul = v;
    long long ret = 1;
    for (int i = 0; i < 32; i++) {
        if (deg % 2 == 1) {
            ret = ret * mul % mod;
        }
        mul = mul * mul % mod;
        deg /= 2;
    }
    return ret;
}

int main() {
    int n;
    scanf("%d", &n);

    vector<int> primes = findPrimes();
    unordered_map<int, int> global_um;

    vector<int> arr(n, 0);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
        unordered_map<int, int> um = countPrimes(arr[i], primes);
        for (auto &p : um) {
            global_um[p.first] = max(global_um[p.first], p.second);
        }
    }

    long long lcm = 1;
    for (auto &p : global_um) {
        for (int i = 0; i < p.second; i++) {
            lcm = (lcm * p.first) % mod;
        }
    }

    long long res = 0;
    for (int i = 0; i < n; i++)
    {
        int rev = findReversedMultiplier(arr[i]);
        res = (res + lcm * rev % mod) % mod;
    }
    printf("%lld\n", res);
}

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

const int MAXN = 500 + 3;
int H[MAXN][MAXN];
bool occupy[MAXN][MAXN];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

void dfs(int x, int y) {
    int z = H[x][y] + occupy[x][y];
    for (int t = 0; t < 4; t++) {
        int x1 = x + dx[t], y1 = y + dy[t];
        if (H[x1][y1] > z) {
            H[x1][y1] = z;
            dfs(x1, y1);
        }
    }
}

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

    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= N; j++) {
            H[i][j] = min({i, N + 1 - i, j, N + 1 - j}) - 1;
            occupy[i][j] = true;
        }

    int res = 0;
    for (int it = 0; it < N * N; it++) {
        int id;
        cin >> id;
        int x = (id + N - 1) / N;
        int y = id % N;
        if (y == 0) y += N;
        res += H[x][y];
        occupy[x][y] = false;
        dfs(x, y);
    }
    cout << res << "\n";
}


Measured memory_bytes: 20168
#include<iostream>
#include<string.h>
using namespace std;

int main(){
  string red,green,down;
  char tmp;
  int ri,gi,downi;
  int lenr,leng;

  while(1){
    cin >> red;
    cin >> green;
    cin >> down;
    if(red=="-")break;

    lenr = red.length();
    leng = green.length();
    tmp = green[0];
    ri = 0;
    gi = 1;
    downi = 0;
    while(ri < lenr || gi < leng + 1){
      if(tmp == down[downi]){
	tmp = red[ri];
	ri++;
	downi++;
      }else{
	cout << tmp;
	tmp = green[gi];
	gi++;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define MAX(a, b) (a > b) ? a : b;
#define MIN(a, b) (a < b) ? a : b;
#define IsInteger(a) (fabs(a-round(a))<0.00001)
#define swap(a, b) \
    {              \
        a = a + b; \
        b = a - b; \
        a = a - b; \
    }

int main()
{
    LL n;
    cin>>n;
    if(n%2==0)
    {
        cout<<"0.5000000000"<<endl;
    }
    else
    {
        long double ans=(long double)(n+1)/(2*n);
        cout<<ans<<endl;
    }
    


    return 0;
}

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

int main(){
    ll x;
    cin >> x;
    rep(a, -1000, 1000){
        rep(b, -1000, 1000){
            if (pow(a, 5) - pow(b, 5) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4088
<?php
  
  fscanf(STDIN,"%d %d",$n,$k);

$m = array();
for($i=0;$i<$n;$i++){
	$m[] = trim(fgets(STDIN));
}
$sum_kind = array_sum($m);



$nokori =  $k-$sum_kind;

$kosu = (int)($nokori/min($m))+count($m);

echo $kosu."\n";



Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
#define MAX 100000
int A[MAX],n;
int partition(int p,int r)
{
	int x,i,j,t;
	x = A[r];
	i = p - 1;
	for(j = p;j < r;j++)
	{
		if(A[j] <= x)
		{
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
	t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
	return i + 1;
}
int main(int argc, char const *argv[])
{
	int i,q;
	scanf("%d",&n);
	for(i = 0;i < n;i++)
	{
		scanf("%d",&A[i]);
	}
	q = partition(0,n - 1);
	for(i = 0; i < n;i++)
	{
		if(i) printf(" ");
		if(i == q) 
			{
				printf("[");
			}
				printf("%d",A[i] );
			
		if(i == q) printf("]");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 3508
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 1
temp = a[0]
for i in range(n - 1):
    if a[i + 1] <= temp * 2:
        temp += a[i + 1]
        ans += 1
    else:
        ans = 1
        temp += a[i + 1]
print(ans)

Measured memory_bytes: 14308
# -*- coding: utf-8 -*-
d, n = map(int,input().split())

if d == 0:
    if n <= 99:
        print(n)
    else:
        print(101)
if d == 1:
    if n <= 99:
        print(n * 100)
    else:
        print(10100)
if d == 2:
    if n <= 99:
        print(n * 10000)
    else:
        print(1010000)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

ll n, a[100100][3];
ll dp[100100][3];

int main() {
    cin >> n;
    for(int i = 0; i < n; i++) for(int j = 0; j < 3; j++) cin >> a[i][j];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j==k) continue;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    ll res = 0;
    for(int i = 0; i < 3; i++) res = max(res, dp[n][i]);
    cout << res << endl;
}

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

const ll INF = 1e+18 + 100;

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

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

    ll dp[N + 200];
    fill_n(dp, N + 200, INF);

    dp[0] = 0;
    for (int i = 0; i < N - 1; i++)
    {
        for (int k = 1; k <= K; k++)
        {
            if (i + k >= N)
                continue;
            dp[i + k] = min(dp[i + k], dp[i] + abs(H[i] - H[i + k]));
        }
    }

    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1408
import Control.Applicative
import Control.Monad.State
import Data.Array.IO

main = do
  n <- getLine
  list <- map read.words<$>getLine :: IO [Int]
  let (res,swaps) = bubbleSort list
  putStrLn.unwords.map show $ res
  print swaps

bubbleSort :: Ord a => [a] -> ([a], Int)
bubbleSort xs = runState (bubbles xs) 0

bubbles [] = return []
bubbles xs = do
        (y:ys) <- bswap xs
        ys' <- bubbles ys
        return (y:ys')

bswap :: (Ord a) => [a] -> State Int [a]
bswap [x] = return [x]
bswap (x:xs) = do
        (y:ys) <- bswap xs
        if x > y
            then do
                modify (+1)
                return $ y:x:ys
            else return $ x:y:ys


Measured memory_bytes: 4916
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <algorithm>
#include <array>
#include <string.h>
#include <vector>



int main() {
	int A,B,X;
	scanf("%d %d %d", &A,&B,&X);

	if (X < A  || X > A + B) {
		printf("NO");
	}
	else {
		printf("YES");
	}


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
 
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String input = scan.nextLine();
    scan.close();

    if (input.equals("A")) {
      System.out.println("T");
    } else if (input.equals("T")) {
      System.out.println("A");
    } else if (input.equals("C")) {
      System.out.println("G");
    } else {
      System.out.println("C");
    }
  }
}

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

class SegTree{
private:
  int n;
  // 1-index (tree[0] is dummy), leaves are tree[n]-tree[2n-1]
  vector<int> tree;
  const int defVal = 2147483647;
public:
  SegTree(int _n){
    int t;
    t = 1;
    while (t<_n) t*=2;
    n = t;
    tree = vector<int>(2*n, defVal);
    //cerr << "finish init" << endl;
    //cerr << "tree size is " << 2*n << endl;
  }
  void update(int k, int a){
    k += n;
    //cerr << "update:  [" << k << "] = " << a << endl;
    tree[k] = a;
    while (k>1){
      k /= 2;
      tree[k] = tree[k*2]<tree[k*2+1]? tree[k*2]:tree[k*2+1];
    }
  }
  // stab function
  int query(int l, int r){ return _query(l,r,1,0,n);}
  // k:注目してるノード,対応する範囲がkl-kr
  int _query(int l, int r, int k, int kl, int kr){
    // それ以上潜らなくていいパターン
    if (kr<=l || r<=kl) return defVal;
    else if (l<=kl && kr<=r) return tree[k];
    else {
      int vl, vr;
      vl = _query(l,r, k*2, kl, (kl+kr)/2);
      vr = _query(l,r, k*2+1, (kl+kr)/2,kr);
      return vl<vr? vl:vr;
    }
  }
};

int main(void){
  int n,q;
  SegTree *st;
  
  cin >> n >> q;
  st = new SegTree(n);
  for (int i=0; i<q; i++){
    int c,x,y;
    cin >> c >> x >> y;
    if (c==0) st->update(x,y);
    else if (c==1) cout << st->query(x,y+1) << endl;
    else cout << "illegal command" << endl;
  }
  return 0;
}


Measured memory_bytes: 4928
import sys

ball = list(map(int, input().split()))

if ball[1] == 0:
    print(0)
    sys.exit()

if ball[2] ==0:
    print(ball[0])
    sys.exit()

number = ball[0]%(ball[1]+ball[2])

if number > ball[1]:
    number = ball[1]

print((ball[0]//(ball[1]+ball[2]))*ball[1]+number)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N,W, n,m , M, K,a;

vector<ll> v;
int main(){
    cin >> N >> W;
    vector<vector<ll>> dp(N+1, vector<ll> (W+1,0));
    vector<ll> w(N+1);
  	vector<ll> v(N+1);
      ll we, va;
    for(int i = 1; i <= N ; ++i){
        cin>> we >> va;
        w[i] = we; v[i] = va;
    }
    for(int i = 1; i <= W; ++i){
        for(int j = 1; j <= N; ++j){
            if(i >= w[j]) dp[j][i] = max(dp[j-1][i-w[j]] + v[j], dp[j-1][i]);
            else dp[j][i] = dp[j-1][i];
        }
    }
    cout << dp[N][W];
    return 0;
}



Measured memory_bytes: 80256
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;

bool table[10001];
vector<int> primes;

int main() {
  table[2] = true;
  for (int i = 3; i <= 10000; i += 2)
    table[i] = true;
  for (int i = 3; i <= 100; i += 2)
    if (table[i])
      for (int j = 3 * i; j <= 10000; j += 2 * i)
        table[j] = false;
  primes.push_back(2);
  for (int i = 3; i <= 10000; i += 2)
    if (table[i])
      primes.push_back(i);
  int N;
  while (scanf("%d", &N) == 1) {
    int c = 0;
    for (int i = 0; i < primes.size() && primes[i] <= N; i++)
      if (binary_search(primes.begin(), primes.end(), N+1-primes[i]))
        c++;
    printf("%d\n", c);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int c1 = c / b + (c % b > 0);
    int c2 = a / d + (a % d > 0);
    cout << (c1 <= c2 ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include<vector>
using namespace std;
vector<long long>a;
int main()
{
    int T,x,p;
    cin>>T;
    while(T--)
    {
        int flag;
        cin>>flag;
        if(flag==0)
        {
            cin>>x;
            a.push_back(x);
        }
        else if(flag==1)
        {
            cin>>p;
            cout<<a[p]<<endl;
        }
        else
        {
            a.pop_back();
        }

    }

    return 0;
}



Measured memory_bytes: 4888
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで


using namespace std;
int n,m;
int a[200005];
int b[200005];
int c[200005];
int d[200005];


int main(){
  cin >> n >> m;
  string ans = "IMPOSSIBLE";
  REP(i,m){
    cin >> a[i] >> b[i];
    if(a[i]==1) c[b[i]]++;
    if(b[i]==1) c[a[i]]++;
    if(a[i]==n) d[b[i]]++;
    if(b[i]==n) d[a[i]]++;
  }
  REP(i,n+1){
    if(c[i]>0){
      if(d[i]>0){
        ans = "POSSIBLE";
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

void chmax(ll &a, ll b) { a = min(a, b); }
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c, d, n;
    cin >> a >> b >> c >> d >> n;
    n *= 4;
    chmax(b, a * 2);
    chmax(c, b * 2);
    chmax(d, c * 2);
    ll ans = d * (n / 8);
    n %= 8;
    ans += c * (n / 4);
    n %= 4;
    ans += b * (n / 2);
    n %= 2;
    ans += a * n;
    cout << ans << endl; 
    return 0;
}


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

int N;
int a[100000]; 
int b[100000];
int c[100000];
int memo[100000][3];

int sum(int i, int j) {
    if(i == N) return 0;
    if(memo[i][j] > 0) return memo[i][j];
    if(j == 0) {
        return memo[i][j] = std::max(sum(i + 1, 1) + a[i], sum(i + 1, 2) + a[i]);
    }
    else if(j == 1) {
        return memo[i][j] = std::max(sum(i + 1, 0) + b[i], sum(i + 1, 2) + b[i]);
    }
    else {
        return memo[i][j] = std::max(sum(i + 1, 0) + c[i], sum(i + 1, 1) + c[i]); 
    }
}

int main() {
    std::cin >> N;
    for(int i = 0; i < N; i++) {
        std::cin >> a[i] >> b[i] >> c[i];
    }
    std::cout << std::max(sum(0,0),std::max(sum(0,1),sum(0,2))) << std::endl;
}

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

typedef long long ll;
ll A[200005], psum[200005];
int main(){
	int N; scanf("%d",&N);
	for(int i=1;i<=N;i++){
		scanf("%lld",A+i);
		psum[i]=psum[i-1]+A[i];
	}
	ll ans=1e18,l,r;
	for(int i=2;i<N-1;i++){
		l=0,r=i;
		while(l+1<r){
			ll mid=l+r>>1;
			if(psum[mid] < psum[i]-psum[mid]) l=mid;
			else r=mid;
		}
		pair<ll,ll> a[2]={{psum[l],psum[i]-psum[l]},{psum[r],psum[i]-psum[r]}};
		for(int j=0;j<2;j++){
			if(a[j].first>a[j].second) swap(a[j].first,a[j].second);
		}
		l=i,r=N;
		while(l+1<r){
			ll mid=l+r>>1;
			if(psum[mid]-psum[i] < psum[N]-psum[mid]) l=mid;
			else r=mid;
		}
		pair<ll,ll> b[2]={{psum[l]-psum[i],psum[N]-psum[l]},{psum[r]-psum[i],psum[N]-psum[r]}};
		for(int j=0;j<2;j++){
			if(b[j].first>b[j].second) swap(b[j].first,b[j].second);
		}
		for(int j=0;j<2;j++){
			for(int k=0;k<2;k++){
				ans=min(ans,max(a[j].second,b[k].second) - min(a[j].first,b[k].first));
			}
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n; cin>>n; int a[n];
	for(int i=0;i<n;++i)cin>>a[i];
		int f=0;
	for(int i=0;i<n;++i)
	{
		if(a[i]%2)continue;
		if(a[i]%3!=0&&a[i]%5!=0)f=1;
	}
	if(f)cout<<"DENIED";
	else cout<<"APPROVED";
}

Measured memory_bytes: 256
'''
Created on 2020/08/30

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  H,W,K=map(int,pin().split())
  C=[pin()[:-1] for _ in [0]*H]
  ans=0
  for i in range(2**H):
    for j in range(2**W):
      black=0
      for k in range(H):
        for l in range(W):
          if (i>>k)&1==0 and (j>>l)&1==0 and C[k][l]=="#":
            black+=1
      if black==K:
        ans+=1
  print(ans)
  return
main()
#解説AC


Measured memory_bytes: 8932
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const int INF=1e6;
const ll int MOD=998244353;

main(){
    string s="aeiou";
    char c;cin>>c;
    rep(i,5){
        if(s[i]==c){
            cout<<"vowel";return 0;
        }
    }
    cout<<"consonant";
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

void swapof3(int&, int&, int&);
void swap(int&, int&);

int main(){
  int i, n;
  int a, b, c, d, e;
  cin >> n;

  for(i=0; i<n; ++i){
    cin >> a >> b >> c;

    swapof3(a, b, c);
    d = a*a + b*b;
    e = c*c;

    if(d == e)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

void swapof3(int& a, int& b, int& c){
  if(a > b)
    swap(a, b);
  if(b > c)
    swap(b, c);
}

void swap(int& i, int& j){
  int k;
  k = i;
  i = j;
  j = k;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    string s[7]={"mon","tue","wed","thu","fri","sat","sun"};
    int a;cin>>a;
    cout<<s[(a+3)%7]<<endl;
    return 0;
}



Measured memory_bytes: 3172
let n, a, b, s = Scanf.scanf " %d %d %d %s" @@ fun a b c d -> a, b, c, d
let p, r = ref 0, ref 0
let f b = print_endline @@ if b then (incr p; "Yes") else "No"
let _ = String.iter (function 'a' -> f (!p < a + b) | 'b' -> incr r; f (!p < a + b && !r <= b) | _ -> f false) s

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

const int mod=1000000007;

int modPow(int a, int n) {
    if(n==1)return a%mod;
    if (n%2==1)return(a*modPow(a,n-1))%mod;
    int t=modPow(a,n/2);
    return (t*t)%mod;
}

int N,K;
int f[100005];


signed main(){
    cin>>N>>K;
    for(int i=K;i>=1;--i){
        f[i]=modPow(K/i,N);
        for(int j=2;j<=K;++j){
            if(i*j>K)break;
            f[i]-=f[i*j];
            f[i]=(f[i]+mod)%mod;
        }
    }
    int ans=0;
    for(int i=1;i<=K;++i){
        ans+=i*f[i];
        ans%=mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4356
#include<bits/stdc++.h>
#include <array>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;

void Solve(){
    UL ans = 0;
    rep(i, 4){
        UL a; cin >> a;
        ans += a;
    }
    cout << ans << endl;
}

int main(){
    Solve();
    return 0;
}



Measured memory_bytes: 3108
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import bisect


MAX_PRIME = 1299709


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    is_prime = array.array("B", (True for i in range(end)))
    is_prime[0] = False
    is_prime[1] = False
    primes = array.array(typecode)
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def main():
    primes = sieve_of_eratosthenes(MAX_PRIME + 1)

    def length_of_gap_containing(n):
        index = bisect.bisect_left(primes, n)
        next_prime = primes[index]
        if next_prime == n:
            return 0
        else:
            prev_prime = primes[index - 1]
            return next_prime - prev_prime
    while True:
        n = int(input())
        if n == 0:
            break
        else:
            print(length_of_gap_containing(n))


if __name__ == '__main__':
    main()

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

int main() {
  int h;
	cin >> h;
	int w;
	cin >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
 
	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
 
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


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

#define INF 100000000



int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;

    int ans = 0;
    for(int i=a; i>=0; --i){
        for(int j=b; j>=0; --j){
            for(int k=c; k>=0; --k){
                int temp = i*500 + j*100 + k*50;
                if(temp == x) ++ans;
                else if(temp < x) break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()[::-1]

dp = [1] + [0] * 12
new_dp = [0] * 13

res = [[x * 10 ** i % 13 for x in range(10)] for i in range(6)]

mod = 10 ** 9 + 7

for idx, char in enumerate(s):
    new_dp = [0] * 13
    if char != "?":
        for i in range(13):
            new_i = (i + res[idx % 6][int(char)]) % 13
            new_dp[new_i] += dp[i]
        dp = new_dp
    else:
        for i in range(13):
            for j in range(10):
                new_i = (i + res[idx % 6][j]) % 13
                new_dp[new_i] += dp[i]
        dp = [x % mod for x in new_dp]

print(dp[5])


Measured memory_bytes: 43372
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
const int MAX=1e5+10;
const int INF=1e9+10;
const int MAXV=1e5+10;
int n,mw;
int w,v;
ll ans,dp[MAXV+5];
int main(){
	cin>>n>>mw;
	for(int i=0;i<=MAXV;i++) dp[i]=INF;
	dp[0]=0;
	for(int i=0;i<n;i++){
		cin>>w>>v;
		for(int j=MAXV-v;j>=0;j--){
			dp[j+v]=min(dp[j+v],dp[j]+w);
		}
	}
	for(int i=MAXV;i>=0;i--){
		if(dp[i]<=mw){
			ans=i;
			break;
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();

			/*String yes="Yes";
			String no="No";*/

			if(n==m) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}


Measured memory_bytes: 21972