akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

int main() {
	
	int S, h, m, s;

	cin >> S;

	h = S / 3600;
	m = (S - h * 3600) / 60;
	s = S % 60;

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

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

int dd(int yy, int mm, int dd){
    int ret = (yy-1)/3 * (195*2 + 200);
    if(yy%3 == 1) ret += 0;
    if(yy%3 == 2) ret += 195;
    if(yy%3 == 0) ret += 195+195;
    
    if(yy%3 == 0)
        ret += (mm-1)*20;
    else{
        ret += (mm-1)/2 * (20+19);
        if(mm%2 == 0)
            ret += 20;
    }
    ret += dd-1;
    return ret;
}

int main(){
    int y, m, d;
    int n; cin >> n;
    int d1000 = dd(1000,1,1);

    while(n--){
        cin >> y >> m >> d;
        cout << d1000 - dd(y,m,d) << endl;
    }
}

Measured memory_bytes: 1160
N = input()

Sdict = {}

for i in range((int)(N)):
    S=input()
    if S in Sdict.keys():
        Sdict[S] += 1
    else:
        Sdict[S] = 1

new_dict = sorted(Sdict.items(),key = lambda x:-x[1])

max_key_list=[]

max_num=-1

for k,v in new_dict:
    if max_num == -1:
        max_key_list.append(k)
        max_num = v
    elif v == max_num:
        max_key_list.append(k)
    else:
        break

answer_list = sorted(max_key_list)

for ans in answer_list:
    print(ans)


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

int main(){
    int x1, y1, x2, y2;
    int x3, y3, x4, y4;
    int x, y;
    cin >> x1 >> y1 >> x2 >> y2;

    if (x1 >= x2 && y1 >= y2){
        y = y1 - y2;
        x = x1 - x2;
        x3 = x2 + y;
        y3 = y2 - x;
        x4 = x3 + x;
        y4 = y3 + y;
    }
    else if (x1 <= x2 && y1 >= y2){
        x = x2 - x1;
        y = y1 - y2;
        x3 = x2 + y;
        y3 = y2 + x;
        x4 = x3 - x;
        y4 = y3 + y;
    }
    else if (x1 >= x2 && y1 <= y2){
        x = x1 - x2;
        y = y2 - y1;
        x3 = x2 - y;
        y3 = y2 - x;
        x4 = x3 + x;
        y4 = y3 - y;
    }
    else if (x1 <= x2 && y1 <= y2){
        x = x2 - x1;
        y = y2 - y1;
        x3 = x2 - y;
        y3 = y2 + x;
        x4 = x3 - x;
        y4 = y3 - y;
    }
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

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

long long int H, W, b[505][505], c, N, e[505];
stringstream ss;

int main(){
    scanf("%lld%lld", &H, &W);
    for(int i = 1; i <= H; ++i){
        c = 0;
        for(int j = 1; j <= W; ++j){
            scanf("%lld", b[i] + j);
            b[i][j] &= 1;
            c ^= b[i][j];
            if(c){
                if(j == W)e[i] = c;
                else{
                    ++N;
                    ss << i << " " << j << " " << i << " " << j + 1 << endl;
                }
            }
        }
    }
    c = 0;
    for(int i = 1; i <= H; ++i){
        c ^= e[i];
        if(c && i != H){
            ++N;
            ss << i << " " << W << " " << i + 1 << " " << W << endl;
        }
    }
    cout << N << endl << ss.str();
    return 0;
}


Measured memory_bytes: 7940
#include <iostream>
#include <iomanip>

#include <vector>
#include <string>
#include <iterator>
#include <algorithm>
typedef long long ll;
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B

// using STL
void Main2() {
    int n; std::cin >> n;
    vector<int> S(n);
    rep(i, n) cin >> S[i];
    int q; std::cin >> q;
    vector<int> T(q);
    rep(i, q) cin >> T[i];

    int nbFound = 0;

    const int mins = S[0];
    const int maxs = S[n - 1];

    rep(i, q) {
        const int tgt = T[i];
        // quick check
        if (tgt > maxs) continue;
        if (tgt < mins) continue;
        auto pos = std::lower_bound(S.begin(), S.end(), tgt);
        const int idx = std::distance(S.begin(), pos);
        if (S[idx] == tgt) ++nbFound;
    }

    cout << nbFound << endl;
    return;
}


int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout << std::fixed << std::setprecision(15);
    Main2();

    return 0;
}



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


int main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 3; i <= N; i+=2) {
		int cnt = 0;
		for (int k = 1; k * k < i; k++) {
			if (i % k == 0 && k * k == i) {
				cnt++;
			}
			else if (i % k == 0) {
				cnt += 2;
			}

		}
		if (cnt == 8) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
//https://atcoder.jp/contests/abc088/tasks/abc088_d
//D - Grid Repainting
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,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;}
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in");
    //std::ifstream in("./input.txt");
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif    
    ll H,W; cin>>H>>W;
    vector<string> shw(H);
    for(auto&& s:shw){
        cin>>s;
    }

    ll ans = 0;
    vector<vector<ll>> mat(H,vector<ll>(W,INT32_MIN));
    FOR(y,0,H){
        FOR(x,0,W){
            auto c=shw.at(y).at(x);
            if(c=='#') mat.at(y).at(x)=-1;
            else ++ans;
        }
    }

    //bfs
    using pos=pair<ll,ll>; //x,y
    pos ofs[]={
        {1,0},{-1,0},{0,-1},{0,1}
    };
    auto getmat = [&](const pos& p)->ll&{
        return mat.at(p.second).at(p.first);
    };
    auto available = [&](const pos& p)->bool{
        if(p.first<0||p.first>=W) return false;
        if(p.second<0||p.second>=H) return false;
        return (getmat(p)==INT32_MIN);
    };
    queue<pos> que;
    que.push({0,0});
    getmat({0,0})=0;
    while(not que.empty()){
        auto&d = que.front();
        que.pop();
        for(const auto& o:ofs){
            auto next_p = d;
            next_p.first += o.first;
            next_p.second += o.second;
            if (available(next_p)){
                getmat(next_p) = getmat(d)+1;
                que.push(next_p);
            }
        }
    }
    ll dist = mat.at(H-1).at(W-1);
    if(dist<0) ans=-1;
    else ans -= (dist+1);
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

#define nfs                      \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);

int main() {
    nfs;

    int n, W;
    cin >> n >> W;
    int w[n + 1], v[n + 1];
    for (int i = 1; i <= n; ++i) cin >> w[i] >> v[i];

    int64_t dp[n + 1][W + 1] = {};

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= W; ++j) {
            dp[i][j] = dp[i - 1][j];
            if (w[i] <= j) dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
        }
    }

    cout << dp[n][W] << "\n";
}

Measured memory_bytes: 82420
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n;
    vector<ll>v;
    cin>>n;
     ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];

    }
    sort(a,a+n);
    for(int i=0;i<n-1;i++)
    {
        if(a[i]==a[i+1])
        {
            i++;
            v.push_back(a[i]);
        }
    }
    if(v.size()<2)
        cout<<0<<endl;
    else
    {
        ll x=v.size();
        cout<<(v[x-1]*v[x-2])<<endl;
    }
}


Measured memory_bytes: 4540
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include<algorithm>
#define PI 3.14159265
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 8 && b <= 8) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}



	return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    d=defaultdict(int)
    ans = 0
    for i,a in enumerate(A):
        i+=1
        x = i-a
        ans += d[x]
        d[a+i] += 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 139936
#include <vector>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <sstream>
#include <map>
#include <unordered_map>
#include <ctime>
#include <cassert>
#include <cstring>
#include <sys/time.h>
#include <stdlib.h>
using namespace std;

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  string s;
  cin >> s;
  char c = '\0';
  for(int i=0;i<(int)s.length();i++){
    if(c==s[i]){
      n--;
    }
    c = s[i];
  }
  cout << n << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC143A()
{
	int A, B;
	cin >> A >> B;
	int x = max(0, A - 2 * B);
	cout << x << endl;
}

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


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

using Weight=double;
struct Edge{
    int to;
    Weight w;
    Edge(int t,Weight ww):to(t),w(ww){};
};
int n;
int vertex(int pre,int x,int v){
    return pre+x*n+v*n*n;
}

using Edges=vector<Edge>;
using Graph=vector<Edges>;

const Weight INF=1e15;
vector<Weight> dijkstra(int s,Graph& g){
    vector<Weight> res(g.size(),INF);
    vector<int> used(g.size(),false);
    priority_queue<pair<Weight,int>,vector<pair<Weight,int>>,greater<>> que;
    que.push(make_pair(Weight(0),s));
    while(!que.empty()){
        auto ret=que.top();
        que.pop();
        int v=ret.second;
        if(used[v]) continue;
        used[v]=true;
        res[v]=ret.first;
        for(int i=0;i<g[v].size();i++){
            que.push(make_pair(res[v]+g[v][i].w,g[v][i].to));
        }
    }
    return res;
}

void solve(int s,int g,Graph& graph){
    vector<Weight> d=dijkstra(s,graph);
    Weight res=INF;
    for(int i=0;i<n;i++){
        res=min(res,d[vertex(i,g,1)]);
    }
    if(res>=INF/2){
        cout<<"unreachable"<<endl;
    }
    else{
        cout<<fixed<<setprecision(10);
        cout<<res<<endl;
    }
    return;
}

int main(){
    int m;
    while(cin>>n>>m,n){
        Graph graph(n*n*32);
        int s,g;
        cin>>s>>g;
        s--,g--;
        for(int i=0;i<m;i++){
            int x,y,c;
            Weight d;
            cin>>x>>y>>d>>c;
            x--,y--;
            for(int i=0;i<=min(31,c+1);i++){
                for(int j=-1;j<=1;j++){
                    if(0<i+j && i+j<=c){
                        for(int k=0;k<n;k++){
                            if(k!=y && (i!=0 || x==s)) graph[vertex(k,x,i)].emplace_back(vertex(x,y,i+j),d/(i+j));
                            if(k!=x && (i!=0 || y==s)) graph[vertex(k,y,i)].emplace_back(vertex(y,x,i+j),d/(i+j));
                        }
                    }
                }
            }
        }
        solve(vertex(s,s,0),g,graph);
    }
    return 0;
}


Measured memory_bytes: 68120
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int n,a[110000];
signed main(){
  cin>>n;
  rep(i,n){
    int aa;cin>>aa;
    a[aa-1]++;
    a[aa]++;
    a[aa+1]++;
  }
  sort(a, a+110000, greater<int>());
  cout << a[0] << endl;
}


Measured memory_bytes: 1152
#include <stdio.h>
int main() {
  int n, a, b, max, min;
  scanf("%d %d %d\n", &n, &a, &b);
  if(a+b < n) {
    min = 0;
    if(a < b) max = a;
    else max = b;
  }else{
    min = (a+b)-n;
    if(a < b) max = a;
    else max = b;
  }
  printf("%d %d\n", max, min);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int a[2005];
int main() {
    int n, z, w;
    scanf("%d%d%d", &n, &z, &w);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    if (n == 1) printf("%d\n", abs(a[1] - w));
    else printf("%d\n", max(abs(a[n] - w), abs(a[n - 1] - a[n])));
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int i=0;
  
  int ans = 100000000;
  
  for(;i<n;++i){
    int a;
    scanf("%d",&a);
    
    int r = 0;
    while(a%2==0){
      a /= 2;
      ++r;
    }
    if(ans>r) ans = r;
  }
  
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 
//Available in Snips
#define fi(i, x, y)   for (__typeof(x) i = x; i < y; i ++)
#define fir(i, x, y)  for (__typeof(x) i = x; i > y; i --)
#define fv(x)   for (auto itr = x.begin(); itr != x.end(); itr ++)
#define fvr(x)  for (auto itr = x.end() - 1; itr != x.begin() - 1; itr --)
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//codell here
	int n;cin >> n;
	cout << (int) (n+1)/2;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/
int main(){
    ll n, k; cin >> n >> k;
    vector<pair<ll,ll>> a(n);
    rep(i, n) cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end());
    ll sum = 0;
    rep(i, n){
        sum += a[i].second;
        if(sum >= k){
            cout << a[i].first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n],c[n],a1[n],b1[n],c1[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    a1[0]=a[0];
    b1[0]=b[0];
    c1[0]=c[0];
    for(int i=1;i<n;i++){
        a1[i]=a[i]+(b1[i-1]>c1[i-1]?b1[i-1]:c1[i-1]);
        b1[i]=b[i]+(a1[i-1]>c1[i-1]?a1[i-1]:c1[i-1]);
        c1[i]=c[i]+(b1[i-1]>a1[i-1]?b1[i-1]:a1[i-1]);
    }
    int m=a1[n-1]>b1[n-1]?a1[n-1]:b1[n-1];
    m=m>c1[n-1]?m:c1[n-1];
    cout<<m<<endl;
}


Measured memory_bytes: 2560
#define _GLIBCXX_DEBUG
#include"bits/stdc++.h"

using namespace std;

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back
#define transform_all(exp) transform(ALL(nums), nums.begin(), exp)

//pair
#define fir first
#define sec second

//types
#define ll long long
#define vec vector
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T>
T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()
template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

template <class T = int>
void print(vec<T> v){ for (T item: v) { cout << item << " "; } cout << endl; }

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"Yes":"N1010o"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, string before = "", int nest = 0) { cout << string("          ", nest) << before <<  ": "; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__
#define next next__
#define prev prev__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//variables
int n;
string s,str;
vec<int> nums;

void Main() {
    //code here
    n = gi;
    nums = gim(n);
    int count = 0;
    while (count_if(ALL(nums), isOdd) == 0) {
        transform_all(lamb(i/2));
        count += 1;
    }
    print(count);
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Main();
}

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

l = []
for a in range(10):
    for b in range(10):
        if a*b==N :
            p='Yes'
            l.append(p)
            
        else:
            q='No'
            l.append(q)
if 'Yes' in l:
    print(p)
else:
    print(q)

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

#define rep(i,start,n) for(int i=start;i<(int)(n);i++)
#define rrep(i,n,end) for(int i=n-1;i>=end;i--)
#define each(it,v) for(auto it : v)
#define all(v) (v).begin(),(v).end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using vpii = vector<Pii>;
using vpll = vector<Pll>;

const ll mod=1e9+7;
const int intINF=INT_MAX;
const ll  longINF=LONG_LONG_MAX;

main()
{
        int n,q; cin>>n>>q;
        string s; cin>>s;
        vpii v(n);
        rep(i,0,q)cin>>v[i].first>>v[i].second;

        vi w(n,0);
        bool f=false;
        rep(i,0,n)
        {
                if(s[i]=='A')
                {
                        f=true;
                }
                if(f&&s[i]=='C')
                {
                        w[i]++;
                        f=false;
                }
                if(s[i]!='A')f=false;
        }

        rep(i,0,n-1)w[i+1]+=w[i];

        rep(i,0,q)
        {
                cout<<w[v[i].second-1]-w[v[i].first-1]<<endl;
        }
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main() {
  ll n; cin >> n;
  ll weights[n];
  unordered_map<ll, ll> left_mp, right_mp;
  for(ll i = 0; i < n; ++i) {
    cin >> weights[i];
    ++left_mp[i - weights[i]];
    ++right_mp[i + weights[i]];
  }
  ll ans = 0;
  for(auto& right : right_mp) ans += right.second * left_mp[right.first];
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 27912
#include <iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[25]={ };
	for(int i=1;i<=n;++i){
		cin>>a[i];
	} 
	int ans=0;
	for(int i=2;i<n;++i){
		if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1])){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ll>
#define pri pair<int,int>
#define mpi map<int,int>
#define prl pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define umpl unordered_map<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 2e18
#define EPS 1e-3
#define PI 3.1415926535897932385
const double h = 1e-6;
const int MAX_  = 100005;
#define display(v) f(v.size())cout << v[i] << " "
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   ll n;  cin>>n;
   ll xx = n/500;
   ll ans = xx*1000;
   ll tt = n%500;
   tt = tt/5;
   ans = ans + tt*5;cout << ans; 

   return 0;
}     

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int N,L;
	cin >> N >> L;
	int sum = 0;
	int mini = 100000000;
	rep(i,0,N){
		sum += L+i;
		if(abs(mini)>abs(L+i)){
			mini = L+i;
		}
	}
	sum -= mini;
	cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

using ll = long long;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() int t; cin>>t; while(t--)
#define print(n) cout<<n<<"\n"
#define inp(n) int n; cin>>n
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define maxn 1000010
#define mod 1e9+7
#define ff  first
#define ss  second
#define fora(var, start, end) for(int var = start; var < end; var++)
int main()
{
    fast();
    int n,m;
    cin>>n>>m;
    print(((n*(n-1))/2) +((m*(m-1))/2));
    return 0;
}

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

int main(){
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int a=0;a<=A;++a){
    for (int b=0;b<=B;++b){
      for (int c=0;c<=C;++c){
        int total = 500*a+100*b+50*c;
        if (total==X) ++res;
      }
    }
  }
  cout << res << endl;
}

  

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
    int n,k,s,t;
    int a[10];
    cin >> n >> k;
    memset(a, 0, sizeof(a));
    for(int i = 0; i < k; i++) {
        cin >> t;
        a[t] = 1;
    }
    for(int i = n; ; i++) {
        int b, flag = 1;
        int m = i;
        while(m) {
            b = m % 10;
            if(a[b]) {
                flag = 0;
                break;
            }
            m /= 10;
        }
        if(flag) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; ++i)
const int N = (int) 0, mod = (int) 0;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string x;
    cin >> x;
    for (int i = 0; i < (int) x.size(); ++i)
        x[i] -= 'a';
    int k;
    cin >> k;
    for (int i = 0; i < (int) x.size(); ++i) {
        if (i == x.size() - 1) {
            x[i] = (x[i] + k) % 26;
        } else {
            if (x[i] == 0) continue;
            if (26 - x[i] <= k) {
                k -= 26 - x[i];
                x[i] = 0;
            }
        }
    }
    for (int i = 0; i < (int) x.size(); ++i)
        cout << char(x[i] + 'a');
    cout << endl;


}


Measured memory_bytes: 592
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

int main(int, const char**)
{
    int n;
    cin >> n;
    int ans = 0;
    rep(i, n)
    {
        int a;
        cin >> a;
        if(i % 2 == 0 && a % 2 == 1)
        {
            ans++;
        } 
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double acc = 1e-6;
#define M 100005 
ll ln[M] = {0};

void build(){
    queue<ll> num;
    for(int i=0;i<9;i++){
        num.push(i+1) ;
        ln[i] = i+1;
    } 
    int count = 9;
    while(count <= M && !num.empty() ){
        ll top = num.front() ;
        num.pop();

        for(int i=-1;i<=1;i++){
            ll number = top%10+i;
            if( number  >= 0 && number  <= 9){
                num.push( top*10+number );
                ln[count++] = top*10+number;
            }
        }
    }

    return ;
}
//#define brudeforce 1;
main(){
   build();
   int k;
   cin >> k;

   cout << ln[k-1] ;
}
  
  

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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;
}

class Dijkstra {
  private:
    struct Graph {
        int to, cost;
    };
    const long long INF = 4'000'000'000'000'000'000;
    using P             = pair<long long, int>;
    int V;
    vector<vector<Graph>> G;
    vector<long long> dist;

  public:
    Dijkstra(int vertex) {
        V = vertex;
        G.resize(vertex);
        dist.resize(vertex, INF);
    }
    // 無向グラフの構築
    void undirected_update(int x, int y, int cost) {
        G[x].push_back({y, cost});
        G[y].push_back({x, cost});
    }
    // 有向グラフの構築
    void directed_update(int from, int to, int cost) {
        G[from].push_back({to, cost});
    }

    // start からの最短経路計算
    void calc(int start) {
        priority_queue<P, vector<P>, greater<P>> que;
        dist[start] = 0;
        que.push({0, start});

        while (!que.empty()) {
            auto p = que.top();
            que.pop();
            int v = p.second;
            if (dist[v] < p.first)
                continue;
            for (int i = 0; i < G[v].size(); i++) {
                auto e = G[v][i];
                if (dist[v] + e.cost < dist[e.to]) {
                    dist[e.to] = dist[v] + e.cost;
                    que.push({dist[e.to], e.to});
                }
            }
        }
    }

    // calc で渡した start からの最短経路を返す
    // 最短経路が存在しないとき -1 を返す
    long long min_dist(int to) { return dist[to] != INF ? dist[to] : -1; }
};

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

    int N, M;
    cin >> N >> M;

    auto dj = Dijkstra(3 * N);

    REP(i, M) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        dj.directed_update(u, v + N, 1);
        dj.directed_update(u + N, v + 2 * N, 1);
        dj.directed_update(u + 2 * N, v, 1);
    }
    int S, T;
    cin >> S >> T;
    S--;
    T--;
    dj.calc(S);

    vector<int> ans(3);
    ans[0] = dj.min_dist(T);
    ans[1] = dj.min_dist(T + N);
    ans[2] = dj.min_dist(T + 2 * N);
    SORT(ans);
    REP(i, 3) if (ans[i] % 3 == 0) {
        std::cout << ans[i] / 3 << '\n';
        return 0;
    }
    std::cout << -1 << '\n';

    return 0;
}

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

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

    int cntZero = 0, cntOne = 0;
    for(int i=0;i<s.size();i++){
        if(s.at(i) == '0') cntZero++;
        else cntOne++;
    }
    cout << 2 * min(cntZero, cntOne) << endl;
}

Measured memory_bytes: 512
N,Ma,Mb = map(int,input().split())

INF = 10000

dp = [[INF for b in range(401)] for a in range(401)]

dp[0][0] = 0

for i in range(1,N+1):
    ai,bi,ci = map(int,input().split())
    for a in range(400,-1,-1):
        for b in range(400,-1,-1):
            if a-ai >= 0 and b-bi >= 0:
                dp[a][b] = min(dp[a][b],dp[a-ai][b-bi]+ci)


ans = INF
for j in range(1,401):
    if Ma*j > 400 or Mb*j > 400:
        break
    ans = min(ans,dp[Ma*j][Mb*j])
print(ans if ans != INF else -1)


Measured memory_bytes: 44908
#include <iostream>
using namespace std;
int main(){
    int k;
    cin >> k;
    int x = 7%k;
    for(int i=0; i<k+10; i++){
        if(x==0){
            cout << i+1 << endl;
            return 0;
        }
        x = (10*x+7)%k;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
 
const int inf = 1e9;
 
int n,m,g[705][705],col[705],vis[705],num[705][705],bk,f[705][705];
 
void dfs(int x){
	vis[x] = 1;
	++num[col[x]][bk];
	for(int i=1;i<=n;i++)
		if(i!=x && !g[x][i]){
			if(!vis[i]) col[i] = col[x] ^ 1, dfs(i);
			else if(col[i] == col[x]){ puts("-1"); exit(0); }
		}
}

int c(int x,int y){return (((x*(x-1))/2) + ((y*(y-1))/2));}

int main(){
	nfs_mw;
	cin>>n>>m;
	
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		g[x][y] = g[y][x] = 1;
	}
	
	for(int i=1;i<=n;i++)
		if(!vis[i])++bk, dfs(i);
	
	f[0][0] = 1;
	for(int i=0;i<bk;i++) for(int j=0;j<=n;j++)
		f[i+1][j+num[0][i+1]] |= f[i][j],
		f[i+1][j+num[1][i+1]] |= f[i][j];
	
	int ans = 700*700*700;
	for(int i=n; i>=0; i--) if(f[bk][i]) ans = min(ans,c(i,n-i));
	printf("%d\n",ans);
 
	return 0;
}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
#include <time.h>
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
typedef long long ll;
const ll MAXN=1e5+5e4+5;
const ll MAXR=60000;
const ll INF=1e18;
ll m,d;
bool ok(ll i,ll j)
{
    vector<ll>dat;
    while(j)
    {
        dat.push_back(j%10);
        j/=10;
    }
    if(dat[0]<2||dat[1]<2)
    {
        return false;
    }
    if(dat[0]*dat[1]==i)
    {
        return true;
    }
    return false;
}
void solve()
{
    ll ans=0;
    for(ll i=1;i<=m;i++)
    {
        for(ll j=22;j<=d;j++)
        {
            if(ok(i,j))
            {
                ans++;
            }
        }
    }
    printf("%lld\n",ans);
}
int main()
{
//    freopen("c://duipai//data.txt","r",stdin);
//    freopen("c://duipai//wa.txt","w",stdout);
    while(~scanf("%lld %lld",&m,&d))
    {
//        string str2;
//        cin>>str2;
//      cout<<str2<<endl
        solve();
    }
}
/*
*/


Measured memory_bytes: 256
def parent(i)
	return i / 2
end

def left(i)
	return 2 * i
end

def right(i)
	return 2 * i + 1
end

H = gets.to_i
a = gets.split.map &:to_i
a.unshift(nil)

for i in 1..H do
	print("node ", i, ": key = ", a[i], ", ")
	print("parent key = ", a[parent(i)], ", ") if parent(i) >= 1
	print("left key = ", a[left(i)], ", ") if left(i) <= H
	print("right key = ", a[right(i)], ", ") if right(i) <= H
	puts
end

Measured memory_bytes: 8720
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		String a = as.next();
		boolean b = true;
		try{
		for(int i=0;i<a.length();i++){
			if(b){
				if(String.valueOf(a.charAt(i)).equals("d")){
					i++;
					if(String.valueOf(a.charAt(i)).equals("r")){
						i++;
						if(String.valueOf(a.charAt(i)).equals("e")){
							i++;
							if(String.valueOf(a.charAt(i)).equals("a")){
								i++;
								if(String.valueOf(a.charAt(i)).equals("m")){
									if(i+1<a.length()&&String.valueOf(a.charAt(i+1)).equals("e")
											&&String.valueOf(a.charAt(i+2)).equals("r")){
										if(i+3<a.length()&&(String.valueOf(a.charAt(i+3)).equals("d")
												||String.valueOf(a.charAt(i+3)).equals("e"))){
											i+=2;
										}else if(i+3<a.length()&&String.valueOf(a.charAt(i+3)).equals("a")){
											
										}else if(i+3>=a.length()){
											i+=3;
										}
									}else if(i+1>=a.length()){
										
									}
								}else{
									b = false;
								}
							}else{
								b = false;
							}
						}else{
							b = false;
						}
					}else{
						b = false;
					}
				}else if(String.valueOf(a.charAt(i)).equals("e")){
					i++;
					if(String.valueOf(a.charAt(i)).equals("r")){
						i++;
						if(String.valueOf(a.charAt(i)).equals("a")){
							i++;
							if(String.valueOf(a.charAt(i)).equals("s")){
								i++;
								if(String.valueOf(a.charAt(i)).equals("e")){
									if(i+1<a.length()&&String.valueOf(a.charAt(i+1)).equals("r")){
										i++;
									}else if(i+1>=a.length()){
										
									}
								}else{
									b = false;
								}
							}else{
								b = false;
							}
						}else{
							b = false;
						}
					}else{
						b = false;
					}
				}else{
					b = false;
				}
			}else{
				break;
			}
		}
		}catch(Exception e){
			b = false;
		}
		if(b){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}

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

using namespace std;
const int maxn = 1e5+10;
int n,m,k;


int main(){
	string s;
	cin >> k;
	cin >> s;
	if(s.length()<=k){
		cout << s << endl;
	}
	else {
		string t = s.substr(0,k)+"...";
		cout << t << endl;
	}
	return 0;
} 

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

int main() {
  string s;
  cin >> s;
  if (s[s.length() - 1] == 's') {
    cout << s << "es" << endl;
  } else {
    cout << s << "s" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
A, B, C, D, E, F = map(int, input().split())

density = -1
s_water = -1
sugar = -1
for a in range(31):
    for b in range(31):
        for c in range(101):
            for d in range(101):
                w = (100*A)*a + (100*B)*b
                s = C*c + D*d
                if w == 0:
                    continue
                if w + s > F:
                    continue
                if w/100 * E >= s:
                    tmp = 100*s / (w + s)
                    if tmp > density:
                        density = tmp
                        s_water = max(w + s, 100*A)
                        sugar = s
print(s_water, sugar)

Measured memory_bytes: 73916
K = int(input())

cur = 7
flg = False
for i in range(10 ** 6):
    mod = cur % K
    if mod == 0:
        ans = i + 1
        flg = True
        break
    else:
        cur = mod * 10 + 7

if flg:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n, m; cin >> n >> m;
  //vector<int> a(n); rep(i,n) cin >> a[i];
  if(n==m) cout << "Yes";
  else cout << "No";
  
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
#include <numeric>
#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    string s;
    cin >> s;
    int a[2];
    a[0] = (s[0] - '0') * 10 + s[1] - '0';
    a[1] = (s[2] - '0') * 10 + s[3] - '0';
    bool yymm = false;
    bool mmyy = false;
    if(a[0] >=1 && a[0] <= 12)
    {
        mmyy = true;
    }
    if(a[1] >=1 && a[1] <= 12)
    {
        yymm = true;
    }
    if(yymm && mmyy)
    {
        cout << "AMBIGUOUS" << endl;
    }
    else if(yymm)
    {
        cout << "YYMM" << endl;
    }
    else if(mmyy)
    {
        cout << "MMYY" << endl;
    }
    else
    {
        /* code */
        cout << "NA" << endl;
    }
    
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>

int main() {
	
	int a, b;
	cin >> a >> b;
	a--;
	b--;

	cout << a*b << endl;

	return 0;

}

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


void solve()
{
	int h, w;
	cin >> h >> w;
	
	int sr, sc, er, ec;
	cin >> sr >> sc >> er >> ec;
	sr--; sc--; er--; ec--;
	
	string grid[h];
	for(int i = 0; i<h; i++) cin >> grid[i];
	
	bool ok = false;
	
	deque<pair<int, int>> dq;
	int dist[h][w];
	
	for(int i = 0; i<h; i++)
		for(int j = 0; j<w; j++)
			dist[i][j] = 1e7;
	
	dist[sr][sc] = 0;
	
	dq.push_back({sr, sc});
	while(!dq.empty())
	{
		pair<int, int> s = dq.front(); dq.pop_front();
		int r = s.first, c = s.second;
		if(r == er && c == ec)
		{
			ok = true;
			break;
		}
		for(int dx = -2; dx <= 2; dx++)
		{
			for(int dy = -2; dy<=2; dy++)
			{
				int nr = r + dx, nc = c + dy;
				if(nr == r && nc == c) continue;
				if(nr<0 || nc<0 || nr>=h || nc>=w) continue;
				if(grid[nr][nc] == '#') continue;
				int wt = 1;
				if((abs(nr-r) == 1 && abs(nc-c) == 0) || (abs(nc-c) == 1 && abs(nr-r) == 0))
					wt = 0;
				//else
					//wt = 1;
				if(dist[nr][nc] > dist[r][c]+wt)
				{
					dist[nr][nc] = dist[r][c]+wt;
					if(wt)
						dq.push_back({nr, nc});
					else
						dq.push_front({nr, nc});
				}
			}
		}
	}
	if(ok) cout << dist[er][ec];
	else cout << -1;
		
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



Measured memory_bytes: 8640
// Problem : B - Digits
// Contest : AtCoder - AtCoder Beginner Contest 156
// URL : https://atcoder.jp/contests/abc156/tasks/abc156_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n,k;
    cin>>n>>k;
    int ans = 0;
    while(n){
        n /= k;
        ans++;
    }
    cout<<ans<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long

int h,w,k;
char z;
int powi(int a, int b){
  int ans=1;
  for(int i=0;i<b;i++){
    ans*=a;}
  return ans;}

int main(){
  scanf("%d%d%d",&h,&w,&k);
  char c[7][7]={};
  char tmp[7];
  for(int i=0;i<h;i++){
    scanf("%s",tmp);
    for(int j=0;j<w;j++){
      c[i][j]=tmp[j];}}


  int ans=0;
  int last = powi(2,h+w);
  for(int l=0;l<last;l++){
    int tmp=l;
    int count=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if((tmp>>i)%2==0 && (tmp>>(h+j))%2==0 && c[i][j]=='#'){
	  //printf("%d %d\n",i,j);
	  count++;}
	}}
    if(count==k) {
      //printf("%d\n",tmp);
      ans++;}
  }
  
  
  printf("%d\n",ans);
  
  return 0;
}


Measured memory_bytes: 1688
#include<stdio.h>
#include<math.h>
int Sosu(int N){
  int i=3;
if(N==2)return 1;
if(N<2 || N%2==0)return 0;
while(i<=sqrt(N)){
  if(N%i==0)return 0;
  i=i+2;
}
return 1;
}
int main(void){
int N;
int n,i;
int S=0,c=0;
while(1){
scanf("%d",&n);
if(n>=1 && n<=10000)break;
}
for(i=0 ; i<n ; i++){
  while(1){
  scanf("%d",&N);
  if(N>=2 && N<=100000000)break;
  }
  S+=Sosu(N);
}
printf("%d\n",S);
return 0;
}



Measured memory_bytes: 2124
n = int(input())
a = list(map(int,input().split()))
asum = [0]*n
for i in range(n):
  asum[i] = asum[i-1] + a[i]
total = asum[-1]
half = total/2
ans = abs(asum[0]-half)*2
for j in range(0,n-1):
  s = abs(asum[j]-half)*2
  if s < ans:
    ans = s
print(int(ans))

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

int main() {
  string w;
  cin >> w;
  
  vector<int> v(200);
  for(int i = 0; i < w.size(); i++){
    int a = w.at(i);
    v.at(a)++;
  }
  
  bool ans = true;
  for(int i = 0; i < 200; i++){
    if(v.at(i) % 2 == 1) ans = false;
  }
  
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():  
    N,M,X = map(int,input().split())
    book = []
    for _ in range(N):
        A = list(map(int,input().split()))
        cost = A[0]
        book.append((cost,A[1:]))
    
    ans = INF
    for bit in range(1<<N):
        ret = 0
        understand = [0] * M
        for i in range(N):
            if (bit>>i)&1:
                cost,A = book[i]
                ret += cost
                for j in range(M):
                    understand[j] += A[j]
        flag = True
        for j in range(M):
            if understand[j] < X:
                flag = False
                break
        if flag:
            ans = min(ans,ret)
    print(ans if ans < INF else -1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 68680