akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    REP(i, n){
        int h;
        cin >> h;
        if(h >= k)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
	
  string ab;
  cin >> ab;
  
  string ba;
  cin >> ba;
  
/*  string l;
  for (int i=1; i<9; i++) {
  	cin >> n;
*/
  int sum = 0;
if( ab[0] == ba[0])
{ 
  ++sum;
}
if( ab[1] == ba[1])
{ 
  ++sum;
}
if( ab[2] == ba[2])
{ 
  ++sum;
}
  
  
  cout << sum << endl;
}

Measured memory_bytes: 256
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

n = sys.stdin.readline().rstrip()
print(n.count('2'))

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A, B(N);
    for(auto&& i : B)cin >> i;
    copy(begin(B), end(B), back_inserter(A));
    copy(begin(B), end(B), back_inserter(A));
    nth_element(begin(A), end(A) - N, end(A));
    cout << accumulate(end(A) - N, end(A), -*max_element(begin(A), end(A))) << endl;
    return 0;
}

Measured memory_bytes: 9024
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

const int inf = LLONG_MAX/2;

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int ans = (h2-h1)*60+(m2-m1)-k;
	cout << ans;
	return 0;
}


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

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

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

  cout << cnt << endl;

  return 0;

}


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

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1

class UnionFind {
public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main() {
  ll N, M, A, B;
  cin >> N >> M;
  UnionFind uf(N);

  // calculation
  REP(i, M) {
    cin >> A >> B;
    A--;
    B--;
    uf.merge(A, B);
  }

  ll ms = 0;
  ll si;
  REP(i, N) {
    si = uf.size(i);
    if(si > ms) ms = si;
  }
  cout << ms << endl;
  
  return 0;
}

Measured memory_bytes: 6376
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  sort(h.begin(), h.end(), greater <>());
  k = min(k,n);
  h.erase(h.begin(), h.begin() + k);
  ll ans = 0;
  rep(i, h.size()) ans+=h[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n,a,b,sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        sum+=b-a+1;
    }
    cout<<sum<<endl;
    return 0;
    // Here your code !
    
}


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

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

    vector<set<int>> vse(N + 1);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        vse[a].insert(b);
        vse[b].insert(a);
    }

    bool f = false;
    for (auto x : vse[1]) {
        f |= vse[x].find(N) != vse[x].end();
    }

    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;

    return 0;
}


Measured memory_bytes: 28416
N,b,r = map(int,input().split())
if(b == 0 and r == 0):
  print(0)
elif (b ==0):
  print(0)
else :
  sets = N//(b+r)
  surplus = N%(b+r)
  if(surplus - b > 0):
    residue = b
  elif(surplus - b < 0):
    residue = surplus  
  Number_of_Blue = sets * b + residue
  print(Number_of_Blue)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b; cin >> a >> b;
    OUT((a-1)*(b-1));

    return 0;
}



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

void solve(long long N){
  cout << N /100 + (N % 100) / 10 + (N % 10) << endl;
}


// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long s;
  scanf("%lld",&s);
  solve(s);
  return 0;
}


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

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n; 
    cin>>n;
    int a = 0; 
    int b = 0;
    for (int i=-150; i<=150; i++){
        int flag = 0;
        for (int j=-150; j<=150; j++){
            if (n == (1LL*i*i*i*i*i-1LL*j*j*j*j*j)){
                cout<<i<<" "<<j;
                return 0;
            }
        }
    }
    return 0;
}



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

int main(){
	int H,W;
	while(1){
		cin>>H>>W;
		if(H==0&&W==0){
			break;
		}
		if(H==0||W==0){
			H=W=0;
		}
		for(int i=0;i<W;i++){
			cout<<"#";
			W-=1;
			if(i==W){
				cout<<endl;
			}
			W+=1;
		}
		H-=2;
		W-=2;
		for(int i=0;i<H;i++){
			   cout<<"#";

			   for(int ii=0;ii<W;ii++){
				   cout<<".";
		       }
			   cout<<"#"<<endl;
		}
		W+=2;
		for(int i=0;i<W;i++){
			cout<<"#";
			W-=1;
			if(i==W){
				cout<<endl<<endl;;
			}
			W+=1;
		}

	}

	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define repi(i,n) for(int i=0;i<(int)(n);i++)
#define repd(i,n) for(int i=(int)(n);i>=0;i--)

int main()
{
    int H,N;
    cin >> H >> N;
    vector<int> skills(N);
    repi(i,N){
        cin >> skills[i];
    }
    int sum=0;
    repi(i,N){
        sum += skills.at(i);
    }
    if(H <= sum){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    int score = 0;
    int left=0, right=0 ,both=0;

    REP(i,N) {
        string s;
        cin >> s;
        bool isLeft = s[0]=='B';
        bool isRight = s[s.size()-1] == 'A';

        // count 'AB'
        FOR(j,1,s.size()) {
            if (s[j-1] == 'A' && s[j] == 'B') score++;
        }

        if (isLeft && isRight) both++;
        else if (isLeft) left++;
        else if (isRight) right++;

    }

    if (both == 0) {
        cout << score+min(left,right) << endl;
        return 0;
    }

    if (left >0 && right > 0 ) {
        cout << score+min(left-1,right-1)+ both+1 << endl;
        return 0;
    }

    if (max(left,right) != 0) {
        cout << score + both << endl;

        return 0;
    }

    cout << score + both-1 << endl;

    return 0;
}


Measured memory_bytes: 256
import math
A, B, C, D = map(int, input().split())
t_mon = [A, B]
a_mon = [C, D]
t_turn = math.ceil(t_mon[0] / a_mon[1])
a_turn = math.ceil(a_mon[0] / t_mon[1])

if t_turn >= a_turn:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9160
n, m = map(int, input().split())
demand = [list(map(int, input().split())) for _ in range(m)]

demand.sort(key=lambda x: x[1])

ans = 1
x = demand[0][1] - 2
for i in range(1, m):
    if x < demand[i][0] - 1:
        ans += 1
        x = demand[i][1] - 2
print(ans)


Measured memory_bytes: 29084
c=[list(map(int, input().split())) for _ in range(3)]
a=[0]*3
b=[0]*3

for i in range(3):
    b[i]=c[0][i]-a[0]
for i in range(1,3):
    a[i]=c[i][0]-b[0]
    
for i in range(3):
    for j in range(3):
        if c[i][j]!=a[i]+b[j]:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

int main()
{
	string S;
	cin >> S;
	int ans = 0;
	for (auto c : S) {
		if (c == '+')
			ans++;
		else
			ans--;
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long int ll;



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    vector<ll> a = vector<ll>(n, 0);
    ll inp;
    for(int i=0; i < n; i++) {
        cin >> inp;
        inp--;
        a[inp] = i;
    }
    ll ms = 1;
    ll cs = 0;
    ll cv = -1;
    for(int i=0; i < n; i++) {
        if(a[i] > cv) {
            cs++;
            ms = max(ms, cs);

        }
        else {
            cs = 1;
        }
        cv = a[i];
    }
    cout << n-ms << endl;
}

Measured memory_bytes: 1792
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<fstream>
#include<iostream>
#include<algorithm>
#define inf 1e9
#define re register
#define ll long long
#define lowbit(x) x&-x
#define Flj(i,a,b) for(int i=(a);i;i=(b))
#define Fze(i,a,b) for(int i=(a);i<(b);i++)
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Fer(i,a,b) for(int i=(a);i>=(b);i--)
#define Fer1(i,a,b) for(int i=(a);i>b;i--)
#define Dfor(i,a,b,k) for(double i=(a);i<(b);i+=k)
#define Qmax priority_queue
#define Qmin priority_queue<int,vector<int>,greater<int> >
using namespace std;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int mp[10],k;
int main(){
	For(i,1,4){
		k=read();
		mp[k]=1;
	}
	if(mp[1]==1&&mp[4]==1&&mp[7]==1&&mp[9]==1)printf("YES\n");
	else printf("NO\n");
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define IOS {ios :: sync_with_stdio(false); cin.tie(0);cout.tie(0); }
#define F first
#define S second
#define pb push_back
typedef long double ld;
#define deci(n) cout << fixed << setprecision(n);
typedef long long ll;

#define mem0(x)  memset(x,0,sizeof(x));
#define memm1(x) memset(x,-1,sizeof(x));
#define all(a) a.begin(), a.end()
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define fori2(n) for(ll i=1;i<=n;i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define forj2(n) for(ll j=1;j<=n;j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define fork2(n) for(ll k=1;k<=n;k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
const ll md = 1e9 + 7;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))
// const ll N = 100005;
// ll fac[N] = {1};
// #define calfac for(ll i=1  ;i<N;i++) fac[i] = (fac[i-1]*i)%md;
// ll C[N+1][M+1]; 
// void  ncr(){
//     ll n = N,k = M; 
//     for (ll i = 0; i <= n; i++) { 
//         for (ll j = 0; j <= min(i, k); j++) { 
//             if (j == 0 || j == i)  C[i][j] = 1; 
//             else C[i][j] = C[i - 1][j - 1] +  C[i - 1][j]; 
//         } 
//     } 
// } 


#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
 
ll po(ll x,ll n){
    if(n==0) return 1;
    if(n%2==1) return (x*po(x,n-1))%md;
    else {
        ll k=po(x,n/2);
        return (k*k)%md;
    }
}
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
ll modInv(ll a)
{
    return po(a,md-2);
}
 
// ll nCr(ll n,ll r)
// {
//     return (fac[n]*modInv((fac[r]*fac[n-r])%md))%md;
// }

 
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}
 
ll dp[2003];

int32_t main(){
    IOS;
    ll i,j,k,n,m;
    cin >> n;
    dp[3] = 1;
    for(i=4;i<=n;i++){
        dp[i] = 1;
        for(j=3;j<=i;j++){
            dp[i] += dp[i-j];
            dp[i] %= md;
        }
    }
    cout << (dp[n]+md)%md <<"\n";
} 

Measured memory_bytes: 3604
from collections import deque
dx=[0,1]
dy=[1,0]
def bfs(x,y):
    que=deque([(x,y)])
    while(que):
        nx,ny=que.popleft()
        seen[nx][ny]=True
        if (nx+1<H-1 and G[nx+1][ny]=='#') and (ny+1<W-1 and G[nx][ny+1]=='#'):
            return False
        elif nx+1<H and G[nx+1][ny]=='#':
            que.append((nx+1,ny))
            continue
        elif ny+1<W and G[nx][ny+1]=='#':
            que.append((nx,ny+1))
            continue
        else:
            if nx==H-1 and ny==W-1:
                return True
            else:
                return False
    return True


memo={}
H,W=map(int,input().split())
G=[list(input()) for i in range(H)]
seen=[[False]*W for i in range(H)]
isok=bfs(0,0)
for i in range(H):
    for j in range(W):
        if G[i][j]=='#' and seen[i][j]==False:
            isok=False
print("Possible" if isok else "Impossible")

Measured memory_bytes: 65312
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<climits>
#include<set>
#define ll long long
using namespace std;
int main() {
	ll n, d;
	cin >> n >> d;
	vector<vector<ll>>x(n, vector<ll>(d));
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}
	ll count = 0;
	for (ll i = 0; i < n; i++) {
		for (ll j = i+1; j < n; j++) {
			ll sum = 0;
			for(ll k=0;k<d;k++){
				sum += pow(abs(x[i][k] - x[j][k]),2);
			
			}
			//cout << sqrt(sum) << endl;
			if (sqrt(sum) - (ll)(sqrt(sum))== 0) {
				count++;
			}
			
		}

	}
	cout << count << endl;





}

Measured memory_bytes: 256
/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !


___man be to dami gharar natvanam kard
___va ehsane to ra shomar natvanam kard
####################
___gar bar tane man zaban shavad har moyee
___yek shokre to az hezar natvanam kard

*/

#include <bits/stdc++.h>

#define pb push_back
#define SALI main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define fuck(x) cout << #x << " : " << x << "  "
#define findLowVec(v,x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define findUpVec(v,x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define findLowArr(a,n,x) (lower_bound(a, a+n, x) - a)
#define findUpArr(a,n,x) (upper_bound(a, a+n, x) - a)
#define int long long

using namespace std;

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

template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p)
{return out << "(" << p.first << ", " << p.second << ")";}

template<class A> ostream& operator <<(ostream& out, const vector<A> &v)
{out << "[";for(int i = 0; i < v.size(); i++) {if(i) out << ", ";out << v[i];}return out << "]";}

template<class A,class B> ostream& operator <<(ostream& out, const set<A,B> &s)
{out << "[";for(auto i = s.begin(); i != s.end(); i++) {out << ", ";out << *i;}return out << "]";}

template<class A> ostream& operator <<(ostream& out, const set<A> &s)
{out << "[";for(auto i = s.begin(); i != s.end(); i++) {out << ", ";out << *i;}return out << "]";}

int n;
vector<ll> dp;
vector<vector<ll>> a;


int myMain()
{
    cin>>n;
    a.resize(n, vector<ll>(n));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin>>a[i][j];
        }
    }
    
    dp.resize(1<<n);
    for(int mask = 0; mask < (1<<n); mask++){
        for(int i = 0; i < n; i++){
            if(((1<<i) & mask)){
                for(int j = i+1; j < n; j++){
                    if((1<<j) & mask){
                        dp[mask] += a[i][j];
                    }
                }
            }
        }
    }
    
    for(int mask = 0; mask < (1 << n); mask++){
        for(int submask = mask; submask > 0; submask = (submask - 1) & mask){
            dp[mask] = max(dp[mask], dp[submask] + dp[submask ^ mask]);
        }
    }
    
    ll res = dp[(1 << n) - 1];
    cout<<res<<endl;
    return 0;
}


int32_t SALI()
{

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q = 1;
    //cin >> q;
    while(q--){
        myMain();
    }
    return 0;
}


/**< WRITEN BY ALI ADELKHAH */



Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>

using namespace std;
const long long P = 1000000007;

int main() {
  int n;
  cin >> n;
  int count = 0;
  for(int i = 1; i < n; i++) {
    if(n-i != i) {
      count++;
    }
  }
  cout << count/2 << endl;
  return 0;
}


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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

bool
contains(vector<int>&sup, vector<int>&sub) {
  const
    int I = sup.size(),
        J = sub.size();
  int j = 0;
  for (int i = 0; i < I && j < J;) {
    if (sup[i] == sub[j]) ++j;
    else if (sup[i] > sub[j]) return false;
    else ++i;
  }
  return j == J;
}

int main() {

  int n;
  while (cin >> n, n) {
    vector<vector<int>> P(n);
    rep (i, n) {
      int m; cin >> m;
      P[i].resize(m);
      rep (j, m) cin >> P[i][j];
      sort(all(P[i]));
    }
    int k; cin >> k;
    vector<int> ls(k);
    rep (i, k) cin >> ls[i];
    sort(all(ls));

    vector<int> ans;
    rep (i, n) {
      if (contains(P[i], ls)) ans.push_back(i);
    }
    if (ans.size() == 1) {
      cout << -~ans[0] << endl;
    } else {
      cout << -1 << endl;
    }
  }

  return 0;
}

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

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    for (int i = 0; i < n; ++i) cin >> m[i];
    cout << n + ((x - accumulate(m.begin(), m.end(), 0)) / *min_element(m.begin(), m.end())) << endl;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

int main() {
  int N; 
  cin >> N;
  
  int cnt=0;
  rep(i,N){
    ll a; cin >> a;
    while(a%2 == 0){
      a /= 2;
      cnt++;
    }
  }
  
  cout << cnt << endl;
}
  



Measured memory_bytes: 256
from collections import deque
H, W = map(int, input().split())
start = list(map(int, input().split()))
goal = list(map(int, input().split()))
L = [list(input()) for _ in range(H)]
result = {}
def part(x, y, i, mem):
  if not (0<=x<H) or not (0<=y<W) or L[x][y]!=".":
    return
  L[x][y]=i
  mem.append((x,y))
  part(x-1, y, i, mem)
  part(x+1, y, i, mem)
  part(x, y-1, i, mem)
  part(x, y+1, i, mem)
mark = 0
for h in range(H):
  for w in range(W):
    if L[h][w]==".":
      mem = []
      part(h, w, mark, mem)
      result[mark]=mem
      mark += 1
dic = {i:-1 for i in range(mark)}
s = L[start[0]-1][start[1]-1]
dic[0]=0
g = L[goal[0]-1][goal[1]-1]
queue = deque([s])
while queue:
    now = queue.popleft()
    if now==g:
        print(dic[now])
        exit()
    for (x,y) in result[now]:
        for i in range(max(x-2, 0), min(x+3, H)):
            for j in range(max(y-2, 0), min(y+3, W)):
              key = L[i][j]
              if str(key)=="#":
                continue
              if dic[key] == -1:
                dic[key]= dic[now]+1
                queue.append(key)             
print("-1")

Measured memory_bytes: 202988
#include <bits/stdc++.h>
#include <time.h>
#include <assert.h>


using namespace std;



#define For(i,x,n)  for(long long i=x;i<n;i++)
#define rFor(i,x,n) for(long long i=x;i>=n;i--)
#define itFor(it,st)   for(auto it=st.begin() ; it!=st.end() ; it++)
#define MOD 1000000007
#define PI 3.141592653589793
#define INF 999999999999999999
#define N 1000005
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sp " "
#define cont continue
#define brk break

#define deb1(x)                cout<<#x<<": "<<x<<endl
#define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

using namespace std;

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed;
    cout<<setprecision(3);
    srand(time(NULL));

    char c;
    cin>>c;
    if(c>='A' and c<='Z')
    	cout<<"A";
    else
    	cout<<"a";
    
    //cout<<"\nTime used = "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl;  // - for checking time used for a test case
    return 0;
}

//s1.substr(1,3) - return 3 characters starting from position 1 as substring of string sz1. eg sz1="shreynumh" sz1.substr(2,5)="reyan"
//num = atoi(s.c_str()); //convert string s to integer num
//n.erase(i,std::string::npos); //erase i th position in string n , decreasing string size
//s.find(b)!= std::string::npos - finds string b in string a - true if found
//cout<<"Time used = "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl;  // - for checking time used for a test case                


Measured memory_bytes: 3612
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

int n;
int price[100];
vi recipe[100];
int memo[100];
int search(int id)
{
	if(memo[id] >= 0)
		return memo[id];
	if(memo[id] == -2)
		return price[id];
	if(recipe[id].empty())
		return memo[id] = price[id];
	
	memo[id] = -2;
	int sum = 0;
	rep(i, recipe[id].size()){
		sum += search(recipe[id][i]);
	}
	return memo[id] = min(price[id], sum);
}

int main()
{
	int n;
	while(scanf("%d", &n), n){
		fill(memo, memo+n, -1);
		rep(i, n)
			recipe[i].clear();
		
		map<string, int> dict;
		rep(i, n){
			char tmp[128];
			scanf("%s%d", tmp, &price[i]);
			dict[tmp] = i;
		}
		
		int m;
		scanf("%d", &m);
		rep(i, m){
			char tmp[128];
			scanf("%s", tmp);
			int id = dict[tmp];
			int k;
			scanf("%d", &k);
			rep(j, k){
				scanf("%s", tmp);
				recipe[id].push_back(dict[tmp]);
			}
		}
		
		char tmp[128];
		scanf("%s", tmp);
		printf("%d\n", search(dict[tmp]));
	}
	return 0;
}

Measured memory_bytes: 1112
A,B,C,D = input('')
for i in range(2**3):
  op = [0] * 3
  for j in range(3):
    if (i >> j) & 1:
      op[j]='+'
    else:
      op[j]='-'
  if eval(A+op[0]+B+op[1]+C+op[2]+D)==7:
    print(A+op[0]+B+op[1]+C+op[2]+D+'=7')
    exit()
    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;

  cin>>n;

  char s[101];
  int a[4]={ };


  for(int i=0;i<n;i++){
    cin>>s[i];
    if(s[i]=='P'){
      a[0]=1;
    }
    else if(s[i]=='W'){
      a[1]=1;
    }
    else if(s[i]=='G'){
      a[2]=1;
    }
    else if(s[i]=='Y'){
      a[3]=1;
    }
  }

  int cnt=0;

  for(int i=0;i<4;i++){
  
    if(a[i]==1){
      cnt++;
    }
  }


  
  if(cnt==3){
    cout<<"Three"<<endl;
  }
  else if(cnt==4){
    cout<<"Four"<<endl;
  }

  

  return 0;

}

  


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

#define mx 100005
#define ll long double

int ar[mx];
char ch[mx];

int n,k,ii;


void solve()
{
	ll m;
	cin>>n>>m;
	while(n--)
	{
		ll x,y;
		cin>>x>>y;
		ll val=x*x+y*y;
		val=sqrt(val);
		if(val<=m)k++;
	}
	cout<<k<<endl;
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif

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

Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;




int main(){
    int N;
    cin>>N;
    vvi C(10,vi(10,0));
    FOR(k,1,N+1){
        int i=k%10;
        int j=0;
        int temp=k;
        while(temp>0){
            j=temp%10;
            temp=temp/10;
        } 
        C[i][j]++;
    }
    ll count=0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            count+=(C[i][j]*C[j][i]);
        }
    }
    out(count);
    return 0;
}


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

typedef long long ll;
typedef map<ll, bool> lmap;

#define INF 10e10
#define REP(i,n) for(int i=0; i<n; i++)
#define REP_R(i,n,m) for(int i=m; i<n; i++)
#define MAX 100

ll N;
lmap lmp;
ll ans = 0LL;

int main() {
  cin >> N;

  ll target;
  ll ans = 0;
  REP(i,N) {
    scanf("%lld", &target);
    if (lmp[target]) {
      lmp[target] = false;
      ans--;
    } else {
      lmp[target] = true;
      ans++;
    }
  }

  cout << ans << endl;
}


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

typedef long long ll;

#define        optimize           ios::sync_with_stdio(0); cin.tie(0);
#define PI    acos(-1.0)
#define pb push_back
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define RESET(a, b) memset(a, b, sizeof(a))
#define pii pair <int, int>
#define pll pair <ll, ll>
#define gcd(a, b) __gcd(a, b)
#define min3(a, b, c) min(c, min(a, b))
#define max3(a, b, c) max(c, max(a, b))

#define        MX        200005

int a[MX], b[MX], c[MX];
int dp[MX][5];

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

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

    dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];

    for(int i = 1; i < n; i++){
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
    }

    cout<<max3(dp[n-1][0], dp[n-1][1], dp[n-1][2])<<endl;
}


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

int main(void)
{
	string str;

	while (cin >> str)
	{
		int num[10][10] = {};
		for (int i = 0; i < 10; i++) num[0][i] = str[i] - '0';
		for (int i = 1; i < 10; i++)
			for (int j = 0; j < 10 - i; j++)
				num[i][j] = (num[i - 1][j] + num[i - 1][j + 1]) % 10;
		cout << num[9][0] << endl;
	}
	return 0;
}


Measured memory_bytes: 3028
import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    h, w = ns()
    mat = [list(input()) for _ in range(h)]
    visited = [[False for _ in range(w)] for __ in range(h)]

    B, W = 0, 1
    for y in range(h):
        for x in range(w):
            if mat[y][x] == "#":
                mat[y][x] = B
            else:
                mat[y][x] = W

    cnt = [0, 0]
    pos = [[0, 1], [0, -1], [1, 0], [-1, 0]]

    def bfs(y, x, here):
        visited[y][x] = True
        cnt[here] += 1

        for yi, xi in pos:
            ty = y + yi
            tx = x + xi
            if 0 <= ty < h and 0 <= tx < w:
                if not visited[ty][tx] and mat[ty][tx] == here ^ 1:
                    bfs(ty, tx, here ^ 1)

    ans = 0
    for y in range(h):
        for x in range(w):
            if not visited[y][x]:
                cnt = [0, 0]
                bfs(y, x, mat[y][x])
                ans += cnt[B] * cnt[W]

    print(ans)


if __name__ == '__main__':
    main()


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

#define ll long long
#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back
#define debug(x) cout << x << endl;
#define END cout << endl;
#define sorti(x) sort(x.begin(), x.end())

int main() {
  int n; cin >> n;
  vector<pair<int, int> > red,blue;
  int t,s;
  rep(i,n) {
    cin >> t >> s;
    red.pb({t,s});
  }
  rep(i,n) {
    cin >> t >> s;
    blue.pb({t,s});
  }
  sorti(blue);
  const int mmax = 201;
  int res = 0;
  rep(i,n) {
    int mmin = mmax, reg = -1;
    int c = blue[i].first, d = blue[i].second;
    rep(j,n) {
      int a = red[j].first, b = red[j].second;
      if (a < c and b < d) {
        int sub = d - b;
        if (sub < mmin) {
          mmin = sub;
          reg = j;
        }
      }
    }

    if (reg > -1) {
      res++;
      red[reg].first = red[reg].second = mmax;
      blue[i].first = blue[i].second = mmax;
    }
  }

  cout << res << endl;
}      

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

using namespace std;

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

    int num = atoi(n.c_str());
    int sum = 0;

    for(int i=0; i < n.size(); i++) {
        sum += n.at(i) - '0';
    }

    if(num % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
from bisect import bisect
from itertools import accumulate
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = tuple(map(int, input().split()))

    a = tuple(accumulate(A))
    n = sum(A) // 2
    i = bisect(a, n)
    case1 = abs(sum(A[:i]) - sum(A[i:]))
    case2 = abs(sum(A[:i+1]) - sum(A[i+1:]))
    print(min(case1, case2))


main()


Measured memory_bytes: 26024
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x


using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const long long MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

struct UnionFind {
    // UnionFind u(n) 宣言
    // u.unionSet(x,y) 併合
    // u.findSet(x,y) -> {true, false}
    // u.root(x) xのroot. data[x]を参照。併合前はxそのもの、併合後は同一union
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

int main() {
    string s;cin>>s;
    int k;cin>>k;
    
    // (26 + 'a' - j)%26 回でjを'a'にできる。
    for(auto i = 0;i<s.size();i++){
//        cout<<(int)((26 + 'a' - s[i])%26)<<endl;
        if(k >= (26 + 'a' - s[i])%26){
            int d = (26 + (int)('a' - s[i]))%26;
            s[i]='a';
            k-=d;
        }
        
    }
    
    if(k>=26){
        k-= k/26 * 26;
    }
    
    for(auto i = 0;i<s.size()-1;i++){
        cout<<s[i];
    }
    cout<<(char)(s[s.size()-1]+k)<<endl;
    return 0;
}




Measured memory_bytes: 512
#include<iostream>

using namespace std;

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

    //cout << "a[2]="<< a[2] << endl;
    //cout << "n=" << n << endl;

    int d[n];
    for(int j=0;j<n-1;j++){
            d[j]=a[j+1]-a[j];
    }

    d[n-1]=(k-a[n-1])+a[0];

    //cout << "d[n]="<< d[n] << endl;

    int max=0;
    for(int k=0;k<n;k++){
      if(d[k]>max){
              max=d[k];
      }
    }
    //cout << "max=" <<max << endl;
    int sum=0;
    for(int l=0;l<n;l++){
            sum=sum+d[l];
    }
    //cout << "sum="<< sum << endl;
    sum = sum - max;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
      if(a+b == c || a+c == b || c+b ==a){
        System.out.println("Yes");
      }else{   
		// 出力
		System.out.println("No");
	}
    }
}

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

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

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int cnt;

void dfs(int i)
{
    if (i == 1)
        cnt++;
    else if (i % 2 == 0)
        dfs(i / 2);
    else if (i % 3 == 0)
        dfs(i / 3);
    else if (i % 5 == 0)
        dfs(i / 5);
}

int main()
{
    int m, n;

    while (cin >> m, m) {
        cin >> n;
        
        cnt = 0;
        for (int i = m; i <= n; i++) 
            dfs(i);
        cout << cnt << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ans=1
cnt=[0]*(n+1)
cnt[0]=3
for i in range(n):
  if cnt[a[i]]>0:
    ans*=cnt[a[i]]%mod
    cnt[a[i]]-=1
    cnt[a[i]+1]+=1
  else:
    print(0)
    exit()
print(ans%mod)

Measured memory_bytes: 13964
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define endl '\n'
#define fastio; ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

void solve()
{
    int k,a,b;
    cin>>k>>a>>b;
    int l=a/k;
    if((a<=l*k && b>=l*k)||(a<=(l+1)*k && b>=(l+1)*k)) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

int main()
{
    fastio;
    solve();

    return 0;
}



Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str;
	while(cin>>str){
		int num[10];
		for(int i=0;i<10;i++){
			num[i] = str[i]-48;
		}
		for(int j=9;j>=0;j--){
			for(int k=0;k<j;k++){
				if(num[k]+num[k+1]>9) num[k]=num[k]+num[k+1]-10;
				else num[k]=num[k]+num[k+1];
			}
		}
		cout<<num[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1176
N = int(input())

if N ==1:
    print(1)
    exit()

d =[int(input()) for i in range(N)]

num =[0]*101

for i in range(N):
    num[d[i]] += 1

c = 0

for i in range(101):
    if num[i] !=0:
        c +=1
print(c)

Measured memory_bytes: 3060
<?php
  
	$houses = explode(" ", trim(fgets(STDIN)));
	if (($houses[0] < $houses[2] && $houses[2] < $houses[1])
    	 || ($houses[0] > $houses[2] && $houses[2] > $houses[1])) {
      echo 'Yes';
    } else {
      echo 'No';
    }

?>

Measured memory_bytes: 4728
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
#define MOD (int)1e9 + 7
int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  for(int i = 0; i < h; i++){
    string s;
    cin >> s;
    for(int j = 0; j < w; j++){
      if(s[j] == '.'){
        a[i][j] = 1;
      }else{
        a[i][j] = 0;
      }
    }
  }
  vector<vector<int>> dp(h + 1, vector<int>(w + 1, 0));
  dp[0][0] = 1;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++){
      if(a[i][j] == 1){
        dp[i + 1][j] += dp[i][j];
        dp[i][j + 1] += dp[i][j];
        dp[i + 1][j] %= MOD;
        dp[i][j + 1] %= MOD;
      }else{
        dp[i][j] = 0;
      }
    }
  }
  cout << dp[h - 1][w - 1] << '\n';
  return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128_t LL;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;

struct segment_tree_max {
    static const int N = 2e5 + 5;
    int t[2 * N + 5];
    void update(int pos, int val) {
        for (t[pos += N] = val; pos > 1; pos >>= 1) {
            t[pos >> 1] = max(t[pos], t[pos ^ 1]);
        }
    }
    int get(int l, int r) {
        int res = 0;
        for (l += N, r += N; l <= r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (!(r & 1)) res = max(res, t[r--]);
        }
        return res;
    }
} tree_max;

struct segment_tree_min {
    static const int N = 2e5 + 5;
    static const int inf = 1e9 + 10;
    int t[2 * N + 5];
    void init() {
        for (int i = 0; i < 2 * N + 5; i++) {
            t[i] = inf;
        }
    }
    void update(int pos, int val) {
        for (t[pos += N] = val; pos > 1; pos >>= 1) {
            t[pos >> 1] = min(t[pos], t[pos ^ 1]);
        }
    }
    int get(int l, int r) {
        int res = inf;
        for (l += N, r += N; l <= r; l >>= 1, r >>= 1) {
            if (l & 1) res = min(res, t[l++]);
            if (!(r & 1)) res = min(res, t[r--]);
        }
        return res;
    }
} tree_min;

const int N = 2e5 + 10;
int a[N], lef[N], rig[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        lef[i] = max(0, tree_max.get(1, a[i] - 1));
        tree_max.update(a[i], i);
    }
    tree_min.init();
    for (int i = n; i >= 1; i--) {
        rig[i] = min(n + 1, tree_min.get(1, a[i] - 1));
        tree_min.update(a[i], i);
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += 1ll * (i - lef[i]) * (rig[i] - i) * a[i];
    }
    cout << ans << "\n";

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 9084
#import numpy as np
n = int((input()))
a = list(map(int,input().split(' ')))
#print(a[0])
counter = []
#n = 3
#a = list(range(n))
for i in range(n):
  count = 0 
  #print(a)
  while a[i]%2 == 0:
      #print(a[i])
      a[i] /= 2
      count += 1
  counter.append(count)    
      
print(min(counter))      
  
  
  
  
  
 


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

int main() {
	int n, arr[100010];
	cin >> n;
	for(int i = 0; i < n; i++) cin >> arr[i];
	int dis = 0, con = 0;
	for(int i = 0; i < n; i++) {
		if(arr[i] == i+1) dis++;
		if(i > 0 && arr[i] == i+1 && arr[i-1] == i) con++, arr[i]--;
	}
	cout << dis - con << endl;
}


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

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String strIn = "";
		ArrayList<Integer> numArray = new ArrayList<Integer>();
		while (true) {
			strIn = br.readLine();
			if ("?".equals(strIn.split(" ")[1])) {
				break;
			}
			if ("+".equals(strIn.split(" ")[1])) {
				numArray.add(Integer.parseInt(strIn.split(" ")[0]) + Integer.parseInt(strIn.split(" ")[2]));
			} else if ("-".equals(strIn.split(" ")[1])) {
				numArray.add(Integer.parseInt(strIn.split(" ")[0]) - Integer.parseInt(strIn.split(" ")[2]));
			} else if ("*".equals(strIn.split(" ")[1])) {
				numArray.add(Integer.parseInt(strIn.split(" ")[0]) * Integer.parseInt(strIn.split(" ")[2]));
			} else if ("/".equals(strIn.split(" ")[1])) {
				numArray.add(Integer.parseInt(strIn.split(" ")[0]) / Integer.parseInt(strIn.split(" ")[2]));
			}
		}
		for (int i = 0; i < numArray.size(); i++) {
			System.out.println(numArray.get(i));
		}
	}
}

Measured memory_bytes: 17944
from functools import reduce
n = int(input())

div_rem = [(n / i, n % i) for i in range(1, 10)]


def reducer(acc, x):
    return acc or (x[1] == 0 and x[0] <= 9)


possible = reduce(reducer, div_rem, False)


print('Yes') if possible else print('No')


Measured memory_bytes: 3572