akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <stdio.h>

using namespace std;




void map_ser(int x, int y, int w, int h, int map[][30], int *cnt){
    
    if(map[y][x] == 1){
        *cnt+=1;
        map[y][x] = 2;
        if(0<=x-1 && x-1<w && 0<=y && y<h){
            map_ser(x-1, y, w, h, map, cnt);
        }
        if(0<=x+1 && x+1<w && 0<=y && y<h){
            map_ser(x+1, y, w, h, map, cnt);
        }
        if(0<=x && x<w && 0<=y-1 && y-1<h){
            map_ser(x, y-1, w, h, map, cnt);
        }
        if(0<=x && x<w && 0<=y+1 && y+1<h){
            map_ser(x, y+1, w, h, map, cnt);
        }
    }
    else if(map[y][x] != 1){
        return;
    }
}

int main(int argc, const char * argv[]) {
    // insert code here...
    
    
    /////////
    //write//
    /////////
    
    int map[30][30];
    int cnt;
    char tmp[100];
    int at_x,at_y;
    
    while(1){
        int w,h; cin >> w >> h;
        if(w==0 && h==0)break;
        cnt = 0;
        
        for(int i=0; i<h; i++){
            cin >> tmp;
            for(int j=0; j<w; j++){
                if(tmp[j] == '.')map[i][j] = 1;
                else if(tmp[j] == '#')map[i][j] = 0;
                else if(tmp[j] == '@'){
                    at_x = j;
                    at_y = i;
                    map[i][j] = 1;
                }
            }
        }
        map_ser(at_x, at_y, w, h, map, &cnt);
        cout << cnt << endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n, k; cin >> n >> k;
    cout << k * (int)pow(k-1,n-1) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl '\n'
int main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "rt", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    fast
    int n;cin>>n;
    int ans=n/2;
    if(n&1) ans++;
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

ll N;
vector<ll>path[101010];
ll flg[101010];
ll a[101010], b[101010];
map<P, ll>ans;
ll mx = 1;
int main(){

    cin >> N;
    for(ll i = 1; i < N; i++){
        cin >> a[i] >> b[i];
        path[a[i]].push_back(b[i]);
    }
    queue<ll>Q;
    Q.push(1);
    flg[1] = -1;
    while(!Q.empty()){
        ll idx = Q.front();
        Q.pop();
        ll nxt = 1;
        rep(i, path[idx].size()){
            ll to = path[idx][i];
            if(flg[to])continue;
            if(nxt == flg[idx])nxt++;
            flg[to] = nxt;
            Q.push(to);
            ans[P(idx, to)] = nxt;
            ans[P(to, idx)] = nxt;
            chmax(mx, nxt);
            nxt++;
        }
    }

    cout << mx << endl;
    for(ll i = 1; i < N; i++){
        cout << ans[P(a[i], b[i])] << endl;
    }
    

    return 0;
}

Measured memory_bytes: 19584
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
int h,w;
char s[25][25];
int si[405],sj[405],snum;
int maxstep = 0;
int x[4] = {-1,0,1,0};
int y[4] = {0,1,0,-1};
typedef struct node
{
    int x,y;
    int step;
}Node;
queue<Node> q;
int visit[25][25];

void init()
{
    int i,j;
    for(i = 0;i < h;i++)
    {
        for(j = 0;j < w;j++)
        {
            visit[i][j] = 0;
        }
    }
}

int bfs(int sx, int sy)
{
    int i;
    int newx, newy, newstep;
    Node snode, qnode, tnode;
    snode.x = sx, snode.y = sy;
    snode.step = 0;
    while(!q.empty())
    {
        q.pop();
    }

    q.push(snode);
    visit[snode.x][snode.y] = 1;
    int localmax = -1;

    while(!q.empty())
    {
        qnode = q.front();
        q.pop();

        if(localmax < qnode.step) localmax = qnode.step;

//        printf("********************\n");
//        for(int ti = 0;ti < h;ti++)
//        {
//            for(int tj = 0;tj < w;tj++)
//            {
//                printf("%d",visit[ti][tj]);
//            }
//            printf("\n");
//        }
//        printf("step: %d\n",qnode.step);
//        printf("********************\n");

        for(i = 0; i < 4; i++)
        {
            newx = qnode.x+x[i];
            newy = qnode.y+y[i];
            newstep = qnode.step + 1;
            if(newx >= 0 && newx < h && newy >= 0 && newy < w && s[newx][newy] == '.' && visit[newx][newy] == 0)
            {
                tnode.x = newx, tnode.y = newy, tnode.step = newstep;
                visit[tnode.x][tnode.y] = 1;
                q.push(tnode);
            }
        }
    }
    return localmax;
}

int main()
{
    scanf("%d%d",&h,&w);
    int i,j;

    for(i = 0;i < h;i++)
    {
        scanf("%s", s[i]);
        for(j = 0;j < w;j++)
        {
            if(s[i][j] == '.')
            {
                si[snum] = i, sj[snum] = j;
                snum++;
            }
        }
    }
    int localmax = 0;
    for(i = 0;i < snum;i++)
    {
        init();
        localmax = bfs(si[i], sj[i]);
//        printf("localmax: %d\n", localmax);
        if(localmax > maxstep) maxstep = localmax;
    }
    printf("%d\n", maxstep);

    return 0;
}


Measured memory_bytes: 256
/**
*    author:  souzai32
*    created: 13.08.2020 12:33:54
**/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {

    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    rep(i,h){
        rep(j,w) cin >> s.at(i).at(j);
    }
    vector<vector<int>> n(h,vector<int>(w));
    int num1,num2;

    for(int i=1; i<h+w-1; i++){
        for(int j=0; j<=i; j++){
            int k=i-j;
            if(j>=h || k>=w) continue;
            if(j!=0){
                num1=n.at(j-1).at(k);
                if(s.at(j-1).at(k)!=s.at(j).at(k)) num1++;
            }
            if(k!=0){
                num2=n.at(j).at(k-1);
                if(s.at(j).at(k-1)!=s.at(j).at(k)) num2++;
            }
            n.at(j).at(k)=min(num1,num2);
            num1=10000;
            num2=10000;
        }
    }
    
    int ans=n.at(h-1).at(w-1);
    ans/=2;
    if(s.at(0).at(0)=='#'||s.at(h-1).at(w-1)=='#') ans++;
    cout << ans << endl;
/*
    cout << endl;
    rep(i,h){
        rep(j,w) cout << n.at(i).at(j);
        cout << endl;
    }*/

    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int n;
  while(cin >> n, n) {
    double mi = INF;
    int res;
    REP(i,n) {
      int a;
      double h, w;
      cin >> a >> h >> w;

      double hoge = abs(22.0-10000.0*w/(h*h));
      if (mi >= hoge) {
        if (mi == hoge) {
          if (a < res)
            res = a;
        } else {
          mi = hoge;
          res = a;
        }
      }
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
	int N, X, L[100], i, cnt = 1, zahyou;

	scanf("%d %d", &N, &X);
	for (i = 0; i < N; i++) {
		scanf("%d", &L[i]);
	}

	i = 0;
	zahyou = L[0];
	for (zahyou = L[0]; zahyou <= X && i < N; zahyou += L[i]) {
		i++;
		cnt++;
	}

	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;

int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

bool equal(string s) {
  for(int i = 0,j = s.size()/2;j < s.size();i++,j++) {
    if(s[i] != s[j]) return false;
  }
  return true;
}

int main() {
  string s;
  cin>>s;
  int n = s.size();
  for(int i = 2;i < n;i+=2) {
    if(equal(s.substr(0,n-i))) {cout<<n-i; return 0;}
  } 
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;


int main(){
  int N; cin >> N;
  vector<int> A(N);
  rep(i,N) cin >> A[i];
  map<int,int> nums;
  rep(i,N){
     nums[A[i]]++;
  }
  int res = 0;
  for(auto itr = nums.begin(); itr != nums.end(); itr++){
     if(itr -> second % 2 != 0)  res++;
  }
  cout << res << endl;
}



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


int main() {
  string s;
  cin >> s;
  if     (s == "hi") cout << "Yes";
  else if(s == "hihi") cout << "Yes";
  else if(s == "hihihi") cout << "Yes";
  else if(s == "hihihihi") cout << "Yes";
  else if(s == "hihihihihi") cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
typedef signed long long ll;
#define FOR(i,to) for(i=0;i<(to);i++)

int64_t n; 
bool dp[1000000+10];
ll  cnt[1000000+10];


int main() {
	int i,j,k,l,r,x,y; string s;
    
    ll N;
    cin >> N;
    ll A[N];

    
    
    FOR(i,N){ 
        cin >> A[i]; 
        dp[A[i]]=true;
        cnt[A[i]]++;
    }

    for(i=1000000; i>=1; i--){
        for(j=2*i; j<=1000000; j+=i){
            if(dp[j]&&dp[i]) dp[j]=false;
        }
    }

    sort(A, A+N);
    ll ans=0; 

    FOR(i,N){
        if(cnt[A[i]]==1){
            if(dp[A[i]]){
                ans++; 
            }
        }
    }

    std::cout << ans;
    return 0;
}


Measured memory_bytes: 13860
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

string n;

void input()
{
    cin >> n;
}

void solve()
{
    char c = *n.rbegin();
    
    if(c == '3')
    {
        cout << "bon" << endl;
        return;
    }
    
    if (c == '0' || c == '1' || c == '6' || c == '8')
    {
        cout << "pon" << endl;
        return;
    }
    
    cout << "hon" << endl;
}

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

    input();
    solve();
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define    ll          long long int
#define    sz          200010
#define    md          1000000007
#define    py          printf("YES\n")
#define    pn          printf("NO\n")
#define    sc1(a)      scanf("%lld",&a)
#define    sc2(a,b)    scanf("%lld %lld",&a,&b)
#define    pv(a)      printf("%lld\n",a)
using namespace std;




int main()
{


    ll a,b,c,d,i,j,p;

    p=1;
    cin>>a>>b>>c>>d;

    while(1)
    {
        if(p%2==1)
        {
            c=c-b;
            p++;
            if(c<=0)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        else
        {
            a=a-d;
            p++;
            if(a<=0)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }

    return 0;
}


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


int main(){
        ll a,b,c;
        cin >> a >> b >> c;
        if(c-a-b <= 0){
                cout << "No" << endl;
                return 0;
        }
        else{
                if(4*a*b < (c-a-b) * (c-a-b)){
                        cout << "Yes" << endl;
                }else{
                        cout << "No" << endl;
                }
        }
        
        return 0;
}
                                        
                      

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  int n;
  cin >> n;
  mint ans = 1;
  rep(i,n){
    ans*=(i+1);
  }
  cout<<ans.x<<endl;
  return 0;
}

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

int main()
{
	int n, k;
	scanf("%d %d",&n,&k);
	for (long d = 0;d<(1<<n);d++) {
		int c=0;
		for(int j=0;j<n;j++) {
			if(d&(1<<j))
				c++;
		}
		if(c==k){
			printf("%d:",d);
			for(int s=0;s<n;s++) {
				if(d&(1<<s))
				    printf(" %d",s);
			}
            printf("\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2720
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

void main() {
    int N, A;
    readf("%d %d\n", &N, &A);
    int[] ary = readln.split.to!(int[]);
    long[][] dp = new long[][](N+1, A*N+1);
    dp[0][0] = 1;
    foreach(i; 0..N) {
        foreach(j; iota(1, N+1).retro) {
            foreach(k; (A*N+1).iota.retro) {
                if (k-ary[i] >= 0) dp[j][k] += dp[j-1][k-ary[i]];
            }
        }
    }
    dp.enumerate[1..$].map!(a => a.value[a.index*A]).sum.writeln;
}


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

using namespace std;

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

    set<int> a;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.insert(x);
    }
    if (a.size() == n)
        cout << "YES";
    else {
        cout << "NO";
    }
    return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

int main(){

    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];

    cout << *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end()) << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#AGC1 A

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
l = LI()
l.sort()
ans = 0
for i in range(0,2*n,2):
    ans += l[i]
print(ans)


Measured memory_bytes: 38492
#include<stdio.h>

int main(void)
{
    int a, b, d, r;

    double f;

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

    d = a / b;
    r = a % b;
    f = 1.0 * a / b;

    printf("%d %d %f\n", d, r, f);

    return 0; 
}


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

int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a,b) << " ";
    if(a+b <= n){
        cout << 0 << endl;
    }else{
        cout << a+b-n << endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){

    int x,y;
    cin>>x>>y;
    int kame = 0;
    while(true){
        if(y>=kame*4) {
            int c = y - kame * 4;
            if ((c) % 2 == 0 && c >= 0) {
                if (c / 2 == (x - kame)) {

                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
        kame++;
        if(kame>100){break;}

    }
    cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;

int ccc(int m){
	int s = 0;
	while (0 < m){
		s += m % 10;
		m /= 10;
	}
	return s;
}

int main(){
	llint n;
	cin >> n;
	int x, min = 100;
	for (int i = 1; i < n; i++){
		x = ccc(i) + ccc(n - i);
		if (x < min){
			min = x;
		}
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
typedef long long ll ;
 
int main(){
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  if(s[k-1]=='A')s[k-1]='a';
  if(s[k-1]=='B')s[k-1]='b';
  if(s[k-1]=='C')s[k-1]='c';
  cout << s << endl;
}


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

int main(){
  while(1){
    string s;
    int count=0;
    cin >> s;
    int judge[10000]={};
    for(int i=0;i<s.size();i++){
      if((s[i]=='q')||(s[i]=='w')||(s[i]=='e')||(s[i]=='r')||(s[i]=='t')||(s[i]=='a')||(s[i]=='s')||(s[i]=='d')||(s[i]=='f')||(s[i]=='g')||(s[i]=='z')||(s[i]=='x')||(s[i]=='c')||(s[i]=='v')||(s[i]=='b'))judge[i]=0;
      else judge[i]=1;
      if((1<=i)&&(judge[i-1]!=judge[i])) count++;
    }
    if(s[0]=='#')break;
    cout << count << endl;

  }
}

Measured memory_bytes: 3176
n = int(input())
h = list(map(int,input().split()))

minnum = h[n-1]
for i in range(n-1,0,-1):
  if h[i-1]<=minnum:
    minnum = min(minnum,h[i-1])
  elif h[i-1]-1<=minnum:
    minnum = min(minnum,h[i-1]-1)
  else:
    print('No')
    exit()
print('Yes')


Measured memory_bytes: 14396
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(abs(a-x)<abs(b-x)){
    cout << "A" << endl;
  }else{
    cout << "B" << endl;
  }
}

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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;

int N;
vector<int> x(N), y(N);
vector<bool> f(MAX_N, false);
double ans = 0, p = 1;

void dfs(int s, int t, double sum, int depth){
    //DEBUG3(s,t,depth);
    if(depth == N-1){
        ans += sum;
        return;
    }
    f[s] = true;
    //for(int i=0; i<N; i++) cout << f[i] <<" "; cout << endl;
    //DEBUG2(s, t);
    //DEBUG2(x[s], y[s]);
    //DEBUG2(x[t], y[t]);
    //DEBUG2(d_x,d_y);
    //ans += dist;

    for(int i=0; i<N; i++){
        if(f[i]) continue;
        //DEBUG2(i,s);
        double d_x = (x[s]-x[i])*(x[s]-x[i]);
        double d_y = (y[s]-y[i])*(y[s]-y[i]);
        double dist = sqrt(d_x + d_y);
        dfs(i, s, sum+dist, depth+1);
    }
    f[s] = false;
}

signed main(){
    cin >> N;
    x.resize(N);
    y.resize(N);
    for(int i=0; i<N; i++) cin >> x[i] >> y[i];

    for(int i=0; i<N; i++) p*=(i+1);
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++) f[j]=false;
        dfs(i, i, 0, 0);
    }

    printf("%.10f\n", ans/p);
}

Measured memory_bytes: 384
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  constexpr int32_t kFavorite = 753;
  string S;
  cin >> S;
  int32_t min_val = INT32_MAX;
  const int32_t length = static_cast<int32_t>(S.length());
  for (int32_t i = 0; i <= length - 3; ++i) {
    const int32_t value = stoi(S.substr(i, 3));
    const int32_t delta = abs(value - kFavorite);
    if (delta < min_val) {
      min_val = delta;
    }
  }
  cout << min_val << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test(n) cout << "test" << n << endl;
#define fixsp(n) fixed << setprecision(n)
#define defsp(n) defaultfloat << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define vector3D(K, N, M, DP) vector<vector<vector<ll>>> DP(K, vector<vector<ll>>(N, vector<ll>(M)));
#define vector4D(K, N, M, O, DP) vector<vector<vector<vector<ll>>>> DP(K, vector<vector<vector<ll>>>(N, vector<vector<ll>>(M, vector<ll>(O))));
#define zenbu(a) a.begin(), a.end()
#define rzenbu(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}
template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};
template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}

/* ここからコード開始 */

vector<vector<ll>> A;
ll H, W, ans{};

void saiki(set<P> hw,ll kyori){
  ans = kyori;
  set<P> hw2;
  for(auto&& i : hw){
    iikae h = i.first;
    iikae w = i.second;
    if(h+1 < H) A[h+1][w] = min(kyori+1, A[h+1][w]);
    if(h > 0) A[h-1][w] = min(kyori+1, A[h-1][w]);
    if(w+1 < W) A[h][w+1] = min(kyori+1, A[h][w+1]);
    if(w > 0) A[h][w-1] = min(kyori+1, A[h][w-1]);
    if(h+1 < H && A[h+1][w] == kyori+1) hw2.insert(P(h+1, w));
    if(h > 0 && A[h-1][w] == kyori+1) hw2.insert(P(h-1, w));
    if(w+1 < W && A[h][w+1] == kyori+1) hw2.insert(P(h, w+1));
    if(w > 0 && A[h][w-1] == kyori+1) hw2.insert(P(h, w-1));
  }
  if(1-hw2.empty()) saiki(hw2, kyori+1);
}

int main(){
  kyopro;
  cin >> H >> W;
  char a;
  A.assign(H, vector<ll>(W,MOD));
  set<P> start;
  rep(i, 0, H) rep(j, 0, W){
    cin >> a;
    if(a == '#') start.insert(P(i, j));
  }
  for(auto&& i : start){
    A[i.first][i.second] = 0;
  }
  saiki(start, 0);
  cout << ans << rt;
}

Measured memory_bytes: 133376
x = list(map(int,input().split(" ")))
n = x[0]
m = x[1]

#偶数同士の組み合わせ、奇数同士の組み合わせそれぞれの個数

n_number = 0
if n >=2:
    n_number = (n*(n-1))/2
else:
    n_number = 0

m_number = 0
if m >=2:
    m_number = (m*(m-1))/2
else:
    m_number = 0

print(int(n_number + m_number))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
using Edge = pair<int, ll>;
using Graph = vector<vector<Edge> >;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

void printvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void printvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void prints(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void printvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}



ll  d, n, r, l, k, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s, t;
ll mo = 998244353;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> s;
	vll b(n+1), w(n+1);
	rep(i, n) {
		if (s[i] == '#') b[i+1]++;
	}
	REP(i,1, n+1) b[i] += b[i - 1];
	repr(i, n) if (s[i] == '.') w[i]++;
	repr(i, n - 1) w[i] += w[i + 1];
	//printvll(b);
	//printvll(w);
	rep(i, n+1) {
		ret = min(ret, b[i] + w[i]);
	}
	cout << ret << endl;
}


Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
using namespace std;
int z[100002],f[100002];
int main(){
    int n,max1=100001,max2=100001;
    cin>>n;
    long long zheng[n/2],fan[n/2];
    for(int i=0;i<n;i++){
        if(i%2==0)cin>>zheng[i/2];
        if(i%2==1)cin>>fan[i/2];
    }
    for(int i=0;i<n/2;i++){
        z[zheng[i]]++;
        f[fan[i]]++;
    }
    for(int i=0;i<=100000;i++){
        if(z[i]>z[max1])max1=i;
        if(f[i]>f[max2])max2=i;
    }
    sort(z,z+100001);
    sort(f,f+100001);
    if(max1==max2){
        cout<<n-max(z[100000]+f[99999],z[99999]+f[100000])<<endl;
    } else cout<<n-(z[100000]+f[100000])<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
const int N=55556;
vector<int> isprime(N,1);
vector<int> prime;
void  solve(){
	rep(i,2,N){
		for(int j=2*i;j<N;j+=i) isprime[j]=0;
	}
	rep(i,2,N) if(isprime[i]) prime.pb(i);
	int n,i=0;
	cin>>n;
	while(n>0 && i<prime.size()){
		if(prime[i]%5==3) cout<<prime[i]<<" ",n--;
		i++;
	}
	cout<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3668
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int r;
    cin >> r;
    if (n >= 10)
    {
        cout << r << endl;
    }
    else
    {
        cout << (r + 100 * (10 - n)) << endl;
    }
}


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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1000000007LL
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(i=a;i<=b;i++)

#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

ll mypow(ll a, ll b) { if(b == 0) return 1; ll temp=mypow(a,b/2); temp=(temp*temp)%INF; if(b%2 == 1) temp=(a*temp)%INF; return temp; }
int mygcd(int a, int b) { if(b==0) return a; return mygcd(b,a%b); }
int cntBits(ll a) { int ret=0; while(a>0) { ret++; a/=2; } return ret; }

vi g[100010];
int visit[100010];

void dfs(int n)
{
	if(visit[n]==1) return;
	visit[n]=1;
	for(int i=0;i<g[n].size();i++) dfs(g[n][i]);
	return;
}

int main()
{
	ios::sync_with_stdio(0);
	int tt=1,tcase; 
	//cin >> tt;
	rep(tcase,1,tt)
	{
		int n,m,ans=0; cin >> n >> m;		
		for(int i=0;i<m;i++)
		{
			int x,y,z; cin >> x >> y >> z;
			g[x].pb(y);
			g[y].pb(x);
		}
		for(int i=1;i<=n;i++)
		{
			if(visit[i]==0)
			{
				dfs(i);
				ans++;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}


Measured memory_bytes: 9216
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

		//??\??????????????????????????????Scanner???????????§???????????????
		Scanner scan = new Scanner(System.in);

		//??????????????????????????????
		String str = scan.next();

		//????????°?????????????????????
		int q = scan.nextInt();

		//????????°?????°???????????????
		for(int i = 0; i < q; i++){
			//?????????????????????
			String order = scan.next();
			//????????????????????????????????????
			int num1 = scan.nextInt();
			int num2 = scan.nextInt();

			if(order.equals("replace")){
				//??\??????????????????????????????????????????
				String rep = scan.next();
				//??\????????????????????????str?????£??\?????????
				str = str.substring(0 , num1) + rep + str.substring(num2 + 1);
			} else if(order.equals("reverse")){
				//??????????????§??????????????\???????????????
				String r = textRevers(str.substring(num1, num2 + 1));
				//??????????????¨????????°?????£?¨??????????
				String temp = "";
				//reverse?????????????????????????????????????????£??\?????????
				temp += str.substring(0 , num1);
				//?????????????????????????????£????????????
				temp += r;
				//?????£?????????????????£????????????
				temp += str.substring(num2 + 1);
				//??£?????????????????????str?????£??\?????????
				str = temp;

			} else if(order.equals("print")){
				//???????????????????????£?????????
				System.out.println(str.substring(num1 , num2 + 1));
			}
		}

	}

	/**
	 * ?????????????????????????????????????????????
	 * @String r
	 */
	public static String textRevers(String r){

		//??????????????£?¨?
		String rev = "";

		//???????????£??????????????????????????????????????????????????????????????????
		for(int i = r.length()- 1; 0 <= i; i--){
			rev += r.charAt(i);
			//System.out.println(rev);
		}
		return rev;
	}

}

Measured memory_bytes: 46592
A,B,C = map(int,input().split())
sev = 0
fiv = 0

if A == 7 :
  sev += 1
elif A == 5:
  fiv += 1
if B == 7:
  sev += 1
elif B == 5:
  fiv += 1
if C == 7:
  sev += 1
elif C == 5:
  fiv += 1
if sev == 1 and fiv == 2:
  print("YES")
else:
  print("NO")




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

int main() {
  int N;
  cin >> N;
  int p, mx = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> p;
    mx = max(mx, p);
    ans += p;
  }
  cout << ans - mx / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std; using ll = long long;
using ull = unsigned long long; using P = pair<int, int>;
const int INF = 1e9; const int MOD = 1000000007;
const int dx[] = {-1,0,1,0}; const int dy[] = {0,-1,0,1};
//const int dx[] = {-1,-1,-1, 0, 0, 1, 1, 1}; const int dy[] = {-1, 0, 1,-1, 1,-1, 0, 1};
#define PI 3.14159265358979323846264338327950L //setprecision(15)
#define MAX_N 200000
int par[MAX_N];  // 親
int rnk[MAX_N];  // 木の深さ
int mem[MAX_N];  // グループの要素数
// n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i; rnk[i] = 0; mem[i] = 1;
	}
}
// 木の根を求める
int find(int x) {
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
}
// xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x); y = find(y);
	if (x == y) return;
	if (rnk[x] < rnk[y]) {
		par[x] = y; mem[y] += mem[x];
	} else {
		par[y] = x; mem[x] += mem[y];
		if (rnk[x] == rnk[y]) rnk[x]++;
	}
}
// xとyが同じ集合に属するか否か
bool same(int x, int y) {
	return find(x) == find(y);
}
// グループのサイズ
int size(int x) {
	return mem[find(x)];
}

int main() {
	int N, M; cin >> N >> M;
	vector<int> p(N);
	rep(i, N) {
		cin >> p[i]; p[i]--;
	}
	init(N);
	rep(i, M) {
		int x, y; cin >> x >> y;
		unite(x-1, y-1);
	}
	int ans = 0;
	rep(i, N) {
		if (same(p[i], i)) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4840
/*
ID: markusz1
TASK: template
PROG: template
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ul;

ll a,b;
bool positive=true;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	//freopen("template.in","r",stdin);
  //freopen("template.out","w",stdout);

	cin >> a >> b;
	if (a <= 0 && b >= 0 || a >= 0 && b <= 0) cout << "Zero" << endl;
	else if (a > 0 && b > 0) cout << "Positive" << endl;
	else if (a < 0 && b < 0) {
		if ((abs(abs(b)-abs(a))+1) % 2 == 0) cout << "Positive" << endl;
		else cout << "Negative" << endl;
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
public static void main(String[] args) {

Scanner inp = new Scanner(System.in);

int a = inp.nextInt();
int b = inp.nextInt();
int c = inp.nextInt();

int cek = 0;

for(int i = a; i<=b; i++){
if (c%i==0)cek++;
}

System.out.println(cek);

}
}


Measured memory_bytes: 26396
#include<stdio.h>
#define N 4

int main(){
  int i, j, hit, blow, a[N], b[N];
  while(scanf("%d", &a[0]) != EOF){
    for(i=1; i<N; i++)
      scanf("%d", &a[i]);
    for(i=0; i<N; i++)
      scanf("%d", &b[i]);

    hit = 0; 
    blow = 0;

    for(i=0; i<N; i++){
      for(j=0; j<N; j++){
	if(i == j && a[i] == b[j])
	  hit++;
	else if(a[i] == b[j])
	  blow++;
      }
    }

    printf("%d %d\n", hit, blow);
  }
  return 0;
}

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

long long int a[210];

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

	while (1) {
		int count = 0;
		for (int i=0; i<n; ++i) {
			int tmp = a[i] / 2;
			if (a[i] == (tmp * 2)) {
				a[i] = tmp;
				count++;
			} else {
				break;
			}
		}
		if (count == n) {
			ans++;
		} else {
			break;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
/*input
9
*/
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define sz(a) int((a).size())
#define pb push_back
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())     
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define mp make_pair
#define N 998244353
#define PI acos(-1.0)
//if (s.find('R') != std::string::npos)
//s.replace(s.find("10"), sizeof("10") - 1, "");
using namespace std;
bool comp(pair<string,ll>a,pair<string,ll>b){
  if(a.first==b.first) return a.second>b.second;
  return a.first<b.first;
}
int main()
{
  // added the two lines below 
  ios_base::sync_with_stdio (false); 
  cin.tie(NULL);
  cout.tie(0);
 
  ll a,b;
  cin>>a>>b;
  if(a>=13) cout<<b;
  else if(a<=5) cout<<0;
  else cout<<b/2;

  }

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt()
  val F = List(N/2+N/4+N/8+N/16+N/32+N/64, N/3+N/9+N/27+N/81, N/5+N/25, N/7+N/49
  ) ++ List(11,13,17,19,23,29,31,37,41,43,47).map(N/_)
  val f=Map(
     3 -> F.count(_ >=  2),  5 -> F.count(_ >=  4),
    15 -> F.count(_ >= 14), 25 -> F.count(_ >= 24),
    75 -> F.count(_ >= 74)
  )
  println( f(75) + f(25)*(f(3)-1) + f(15)*(f(5)-1) + f(5)*(f(5)-1)/2*(f(3)-2))
}


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

int main()
{
    int n,k,q;
    cin>>n>>k>>q;
    vector<int> a(q);
    int i;
    for(i=0;i<q;i++)cin>>a.at(i);
    vector<int> count(n,0);
    for(i=0;i<q;i++)count.at(a.at(i)-1)++;
    for(i=0;i<n;i++)
    {
        if(count.at(i)>q-k)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1408
/**
 *      purpose : CODE FESTIVAL 2016 qual B
 *      author  : kyomukyomupurin
 *      created : 2018-11-10 01:10:01
**/

#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, A, B; cin >> N >> A >> B;
    string S; cin >> S;
    int tA = 0; int tB = 0;

    for (int i = 0; i < N; ++i){
        if (S[i] == 'a'){
            if (tA + tB < A + B) {
                print("Yes"); ++tA;
            }
            else print("No");
        }
        else if (S[i] == 'b'){
            if (tA + tB < A + B && tB + 1 <= B) {
                print("Yes"); ++tB;
            }
            else print("No");
        }
        else {
            print("No"); 
        }
    }
    
    return 0;
}

Measured memory_bytes: 848
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int f[300000] = {};
int cnt[300000] = {};
int ff(int x){
    if(f[x] == x)return x;
    return f[x] = ff(f[x]);
}
void link(int x, int y){
    f[ff(y)] = ff(x);
}
int main(){
    int n;
    cin>>n;
    for (int j = 0; j <= n; ++j) {
        f[j] = j;
    }
    int m;
    cin>>m;
    for (int i = 0; i < m; ++i) {
        int p, q;
        scanf("%d%d", &p, &q);
        link(p, q);
    }
    for (int i = 1; i <= n; ++i) {
        cnt[ff(i)]++;
    }

    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans = max(ans, cnt[i]);
    }

    cout<<ans;
}

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

lli n;

int main(void){
	cin >> n;
	vector<lli> a(n+1);
	for(int i = 1; i <= n; i++) cin >> a[i];
	lli ans = 0;
	for(int i = 1; i <= n; i++){
		if(a[i] == i){
			if(i == n) swap(a[i], a[i-1]);
			else swap(a[i], a[i+1]);
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4040
i = input()
x = [s.strip() for s in i.split('/')]
if int(x[0])<2019:
	print('Heisei')
elif int(x[0])==2019:
	if int(x[1])<5:
		print('Heisei')
	else:
		print('TBD')
else:
	print('TBD')

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

using namespace std;

long long int n,k,odp,i,j;
map <long long int, long long int> mapa[51][51];
long long int tablica[51][51];

long long int dfs(long long int a,long long int b,long long int dlugosc){
	if(dlugosc==0){
		mapa[a][b][dlugosc]=0;
		return 0;
	}
	if(dlugosc==1){
		return tablica[a][b];
	}
	if(mapa[a][b].find(dlugosc)!=mapa[a][b].end()){
        return mapa[a][b][dlugosc];
	}
	long long int ans=0;
	for(long long int x=0;x<n;x++){
		ans = (ans+(dfs(a,x,dlugosc/2)%1000000007*dfs(x,b,(dlugosc+1)/2)%1000000007)%1000000007)%1000000007;
	}
	mapa[a][b][dlugosc]=ans;
	return ans;
}

int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);
    cin >> n >> k;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            cin>>tablica[i][j];
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            odp=(odp+dfs(i,j,k)%1000000007)%1000000007;
        }
    }
    cout << odp << "\n";
	return 0;
}


Measured memory_bytes: 18816
/* tempate
 *
 *
 */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    ll res = 1;
    if(abs(n - m) <= 1){
        if(n > m){
            for(ll i = m; i >= 2; i--){
                res = (((res * i) % MOD) * i) % MOD;
            }
            res = (res * n) % MOD;
            cout << res << endl;
            return 0;
        }
        else if(n == m){
            for(ll i = n; i >= 2; i--){
                res = (((res * i) % MOD) * i) % MOD;
            }
            res = (res * 2) % MOD;
            cout << res << endl;
            return 0;
        }
        else if(n < m){
            for(ll i = n; i >= 2; i--){
                res = (((res * i) % MOD) * i) % MOD;
            }
            res = (res * m) % MOD;
            cout << res << endl;
            return 0;
        }
    }
    else{
        res = 0;
        cout << res << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 504
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define ll long long
using namespace std;
const ll maxn = 1e6 + 5;
ll a,b,c,t,n,m;
ll num[maxn];
string str;
int main()
{
    cin >> str;
    if(str.length() % 2)
        cout << "No" << endl;
    else
    {
        for(int i = 0; i < str.size(); i += 2)
        {
            if(str[i] != 'h' || str[i + 1] != 'i')
                return 0 * puts("No");
        }
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/13/20 21:03:09
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  struct Data {
    int v=0,w=0;
  };
  vector<Data> ds(n+1);
  for (int i = 0; i < n; i++) {
    int v,w; cin>>v>>w;
    ds[i+1] = {v,w};
  }
  int m = min(1<<10, n);
  vector<vector<int>> dp(m+1, vector<int>(1e5+1, -1));
  dp[0][0]= 0;
  for (int t = 1; t <= m; t++) {
    dp[t] = dp[t/2];
    for (int s = 1e5; s >= ds[t].w; s--) {
      if (dp[t/2][s-ds[t].w] == -1) continue;
      dp[t][s] = max(dp[t][s], dp[t/2][s-ds[t].w]+ds[t].v);
    }
  }
  for (int t = 1; t <= m; t++) {
    for (int s = 1; s <= 1e5; s++) {
      dp[t][s] = max(dp[t][s], dp[t][s-1]);
    }
  }

  auto query = [&](auto& query, int v, int l) -> int {
    if (v <= m) {
      return dp[v][l];
    }
    int res = query(query, v/2, l);
    if (l >= ds[v].w) {
      res = max(res, query(query, v/2, l-ds[v].w)+ds[v].v);
    }
    return res;
  };

  int q; cin>>q;
  for (int i = 0; i < q; i++) {
    int v,l; cin>>v>>l;
    auto ans = query(query, v,l);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 407360