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

void solveA(){
  int x;
  cin >> x;

  if(x==7 || (x==5 || x==3)) cout << "YES" << endl;
  else cout << "NO" << endl;
}
void solveB(){
  string s;
  cin >> s;
  int ans = 1000;
  for(int i=0;i<s.size()-2;i++){
    int n = (s[i]-'0')*100 + (s[i+1]-'0')*10 + s[i+2]-'0';
    ans = min(ans,abs(n-753));
  }
  cout << ans << endl;
  
}
long n,ans=0;
void func(long a,int b){
  if (a>n) return;
  if (b == 7) ans++;
  func(a*10+3,b|1);
  func(a*10+5,b|2);
  func(a*10+7,b|4);  
}
void solveC(){
  cin >> n;
  func(0,0);
  cout << ans << endl;
}
void solveD(){
  int n;
  cin >> n;
  int cnt[101]={0};

  for(int i=2;i<=n;i++){
    int ii = i;
    for(int j=2;j<=n;j++){
      while(ii%j==0){
	ii/=j;
	cnt[j]++;
      }
    }
  }

  int cnt2=0,cnt4=0,cnt14=0,cnt24=0,cnt74=0;
  for(int i=2;i<=n;i++){
    if(cnt[i]>=2) cnt2++;
    if(cnt[i]>=4) cnt4++;
    if(cnt[i]>=14) cnt14++;
    if(cnt[i]>=24) cnt24++;
    if(cnt[i]>=74) cnt74++;
  }
  int ans = cnt74 + cnt24*(cnt2-1) + cnt14*(cnt4-1) + cnt4*(cnt4-1)*(cnt2-2)/2;
  cout << ans << endl;
}

int main(){
  solveD();
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define MAX 2000001
#define MIN 10000

int main()

{
 unsigned short *R,*L;
 
 int num[MIN+1];
 int i,j,k;
 scanf("%d",&i);
 
 R=malloc(sizeof(short)*i+1);
 L=malloc(sizeof(short)*i+1);
 
 for(j=0;j<=MIN;j++)
 {
     num[j]=0;
 }
 for(j=0;j<i;j++)
 {
     scanf("%hu",&R[j+1]);
     num[R[j+1]]++;
 }
 for(j=1;j<=MIN;j++)
 {
     num[j]+=num[j-1];
 }
 for(k=1;k<=i;k++)
 {
     L[num[R[k]]]=R[k];
     num[R[k]]--;
 
 }
 
 for(j=1;j<=i;j++)
 {
     if(j>1)printf(" ");
     printf("%d",L[j]);
 }
 
 printf("\n");
    
    return 0;
}



Measured memory_bytes: 9596
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int x){
if(x==1)
  return false;
  else if(x==2)
    return true;
  else{
    bool a=true;
  int y=pow(x,0.5);
    for(int i=2;i<=y;i++)
      if(x%i==0){a=false; break;}
      return a;
  }

}
int main(){
vector<int>A(100001);
  A.at(0)=0;
  A.at(1)=0;
  A.at(2)=0;
  for(int i=3;i<=100000;i++){
  if(i%2==0)
    A.at(i)=A.at(i-1);
    else{
      A.at(i)=A.at(i-1);
     if(isPrime(i)){
     if(isPrime((i+1)/2))
       A.at(i)++;
     }
    }
  }int Q;
  cin>>Q;
  for(int i=0;i<Q;i++){
  int l,r;
    cin>>l>>r;
    cout<<A.at(r)-A.at(l-1)<<endl;
  
  
  }
   return 0;
}

Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>


int prime(int);

int p[50001] = {0};

int main()
{
	int i, j, n, s, t, m, count, buf[5200] = {0}, ans;
	for(i=2; i<=50000; i++)
		p[i] = 1;
	j = 0;
	for(i=0; i<=223; i++){
		if(prime(i) == 1){
			buf[j] = i;
			j++;
		}
	}
	for(i=0; i<48; i++){
		for(j=2*buf[i]; j<=50000; j+=buf[i])
			p[j] = 0;
	}
	j = 0;
	for(i=0; i<=50000; i++){
		if(p[i] == 1){
			buf[j] = i;
			j++;
		}
	}

	while(1){
		count=0;
		ans=0;
		scanf("%d", &n);
		if(n==0)
			break;
		for(i=0; i<=n; i++)
			count += p[i];
		for(i=0; i<count; i++){
			if(buf[i] * 2 > n)
				break;
			s = i; 
			t = count-1;
			while(s<=t){
				m = (s+t)/2;
				if(buf[i] + buf[m] == n){
					ans++;
					break;
				} else if(buf[i] + buf[m] > n){
					t = m-1;
				} else if(buf[i] + buf[m] < n){
					s = m+1;
				}
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}


int prime(int n)
{
    int i;
 
    if(n < 2)
        return 0;
    else if(n == 2)
        return 1;
 
    if(n % 2 == 0)
        return 0;
 
	for(i = 3; i * i <= n; i += 2){
         if(n % i == 0)
            return 0;
	}
    return 1;
}

Measured memory_bytes: 820
#入力
S = input()
K = int(input())
#文字数のカウント用
t = 0
index = 0
#5000兆(定数)
const = 5000000000000000
flag = False

for i in range(0,len(S)):
    #s_i^constを足す、途中でKを超えれば止める
    #1ならt+=1のみ
    if int(S[i]) == 1:
        t += 1
        if K < t:
            index = i
            flag = True
        if flag:
            break
    else:
        for j in range(1,const + 1):
            t2 = int(S[i]) ** j
            if K < t+t2:
                index = i
                flag =True
            if flag:
                break
   
print(S[index])


Measured memory_bytes: 3064
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main() {
    int n,m,a;
    while(cin>>n>>m>>a){
        if(n==0 && m==0 && a==0)break;
        
        int h[2000]={},p[2000]={},q[2000]={};
        rep(i,m){
            cin>>h[i]>>p[i]>>q[i];
        }
        
        for(int i=0;i<m-1;i++){
            for(int j=i+1;j<m;j++){
                if(h[i]<h[j]){
                    swap(h[i],h[j]);
                    swap(p[i],p[j]);
                    swap(q[i],q[j]);
                }
            }
        }
        
        int now=a;
        for(int i=0;i<m;i++){
            if(p[i]==now){
                now=q[i];
            }
            else if(q[i]==now){
                now=p[i];
            }
        }
        
        cout<<now<<endl;
        
        
        
        
    }
    
    return 0;
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	vector<ll> a(n);
	REP(i, n) cin >> a[i];

	ll sum = 0;
	REP(i, n - 1) {
		if (a[i+1] < a[i]) {
			sum += a[i] - a[i+1];
			a[i+1] = a[i];
		}
	}
	cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 4756
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
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 pair<int ,int > P;
typedef long long ll;

int A,B,C,N,W,H;
string ans;
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){

}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> A >> B >> C;
	if(A+B == C || A+C == B || B+C == A){
		ans = "Yes";
	}else{
		ans = "No";
	}
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
program main
      implicit none
      integer :: k, i, j
      integer(16) :: qu(10000000)

      read *, k
      qu(:) = 0
      j = 0
      do i = 1, 9
        j = j + 1
        qu(j) = i
      end do
      do i = 1, k
        if ( mod(qu(i),10) /= 0 ) then
          j = j + 1
          qu(j) = 10 * qu(i) + mod(qu(i),10) - 1
        end if
        j = j + 1
        qu(j) = 10 * qu(i) + mod(qu(i),10)
        if ( mod(qu(i),10) /= 9 ) then
          j = j + 1
          qu(j) = 10 * qu(i) + mod(qu(i),10) + 1
        end if
      end do
      print *, qu(k)
end program


Measured memory_bytes: 156416
#include <iostream>
#include <vector>
#include <set>


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

	int R, S, P;
	std::cin >> R >> S >> P;

	std::string T;
	std::cin >> T;

	std::string Best(T);	// K回前・・・の条件を考えない時の手

	for (int i = 0; i < N; ++i) {
		switch (T[i]) {
		case 'r':
			Best[i] = 'p';
			break;

		case 's':
			Best[i] = 'r';
			break;

		case 'p':
			Best[i] = 's';
			break;
		}
	}

	int score = 0;

	// K回前・・・の条件を考えて手を直す。
	for (int i = 0; i < N; ++i) {

		if ((K <= i) && (Best[i] == Best[i - K])) {
			// K回前の手と同じなら、K回前とK回後と違う手を出す。

			if ((i + K) < N) {
				if (Best[i - K] == Best[i + K]) {
					Best[i] = T[i];
				}
				else {
					Best[i] = 'r' + 'p' + 's' - Best[i - K] - Best[i + K];
				}

			}
			else {
				Best[i] = T[i];
			}
		}
		else {
			// 勝ち
			switch (Best[i]) {
			case 'r':
				score += R;
				break;

			case 's':
				score += S;
				break;

			case 'p':
				score += P;
				break;
			}
		}
	}

	std::cout << score << std::endl;

	return 0;
}


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

struct Node
{
    long int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node *findNode(long int k)
{
    Node *x = root;
    while (x != NIL && k != x->key)
    {
        if (k < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }
    return x;
}

void insert(long int k)
{
    Node *y = NIL;
    Node *x = root;

    Node *z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL)
    {
        y = x;
        if (z->key < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }

    z->parent = y;

    if (y == NIL)
    {
        root = z;
    }
    else if (z->key < y->key)
    {
        y->left = z;
    }
    else
    {
        y->right = z;
    }
}

void inorder(Node *r)
{
    if (r == NIL)
    {
        return;
    }
    else
    {
        inorder(r->left);
        cout << " " << r->key;
        inorder(r->right);
    }
}

void preorder(Node *r)
{
    if (r == NIL)
    {
        return;
    }
    else
    {
        cout << " " << r->key;
        preorder(r->left);
        preorder(r->right);
    }
}

int main(int argc, char const *argv[])
{
    int m = 0;
    cin >> m;

    for (int i = 0; i < m; ++i)
    {
        string cmd = "";
        cin >> cmd;
        if (cmd == "insert")
        {
            int k = 0;
            cin >> k;
            insert(k);
        }
        else if (cmd == "find")
        {
            int k = 0;
            cin >> k;
            Node *res = findNode(k);
            if (res == NIL)
            {
                cout << "no" << endl;
            }
            else
            {
                cout << "yes" << endl;
            }
        }
        else if (cmd == "print")
        {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 21764
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;


int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> job(N);
    for(int i = 0; i < N; ++i) cin >> job[i].first >> job[i].second;

    sort(job.begin(), job.end());

    int ans = 0, j = 0;
    priority_queue<int> q;
    for(int i = 1; i <= M; ++i){
        while(j < N and job[j].first <= i){
            q.push(job[j].second);
            ++j;
        }
        if(!q.empty()){
            ans += q.top(); 
            q.pop();
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1660
#include<cstdio> 
#include<cstring>
#include<iostream>

using namespace std;

int main()
{
	int n,k,a = 0;
	cin >> n >> k;
	while(n != 0){
		n = n / k;
		a++;
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>

using namespace std;


int main(){
	int n = 0;
	int count;
	while(cin >> n){
		count = 0;

		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				for(int k = 0; k < 10; k++){
					for(int m = 0; m < 10; m++){
						if((i + j + k + m) == n){
							count++;
						}
					}
				}
			}
		}

		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
//Minimum Spannig Tree
#include <iostream>
#include <climits>

using namespace std;

static const int N = 100;
static const int WHITE = 0;
static const int BLACK = 1;
int n, A[N][N], colors[N], d[N], p[N];

int prim() {
    int l = 0, mincost, u;
    for(int i = 0; i < N; i++) {
        colors[i] = WHITE;
        d[i] = INT_MAX;
    }
    d[0] = 0;
    p[0] = -1;
    while(1) {
        mincost = INT_MAX;
        for(int i = 0; i < n; i++) {
            if(colors[i] == WHITE && d[i] < mincost) {
                mincost = d[i];
                u = i;
            }
        }
        if(mincost == INT_MAX) break;
        colors[u] = BLACK;
        l += mincost;
        for(int v = 0; v < n; v++) {
            if(colors[v] == WHITE && A[u][v] != -1) {
                if(A[u][v] < d[v]) {
                    d[v] = A[u][v];
                    p[v] = u;
                }
            }
        }
    }
    return l;
}

int main() {
    int a;
    cin >> n;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) A[i][j] = -1;
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++){
            cin >> a;
            A[i][j] = a;
        }
    }
    cout << prim() << endl;
}


Measured memory_bytes: 3144
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int k;
  cin >> k;

  cout << k/2 * (k-k/2) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define mod 1000000007
using namespace std;
typedef long long int ll;
ll n,k,a[100001];
ll dp[101][100001],pre[2][100001];
int main()
{
    scanf("%lld%lld",&n,&k);
    for(int i = 1; i <= n; i++)scanf("%lld",&a[i]);

    //start dp<<en
    //first row
    dp[1][0] = pre[1][0] = 1;
    for(int i = 1; i <= a[1]; i++)
    {
        dp[1][i] = 1;
        pre[1][i] = pre[1][i-1]+1;
    }
    for(int i = a[1]+1; i <= k; i++)pre[1][i] = pre[1][a[1]];


    for(int i = 2; i <= n; i++)
    {
        for(int j = 0; j<=k;j++)
        {

            dp[i][j] = pre[!(i%2)][j];
            if(j-a[i]>0)dp[i][j] -= pre[!(i%2)][j-a[i]-1];
            dp[i][j] += mod;
            dp[i][j] %= mod;
            //calculate prefix
            pre[i%2][j] = (j==0?dp[i][j]:dp[i][j]+pre[i%2][j-1])%mod;
            //cout << dp[i][j]<<endl;
        }
    }
    printf("%lld\n",dp[n][k]);
}


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

int main()
{
    std::int64_t N;
    std::cin >> N;

    if(N  % 1000 == 0)
    {
        std::cout << 0 << std::endl;
    }
    else
    {
        std::cout << (N / 1000 + 1) * 1000 - N << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3632
from collections import defaultdict
count=defaultdict(lambda:0)
N=int(input())
A=list(input().split(" "))
k=-1
for i in range(N):
    count[A[i]]+=1
if N%2==1:
    if count["0"]!=1:
        k=0
    for i in range(1,N//2+1):
        if count[str(2*i)]!=2:
            k=0
else:
    for i in range(1,N//2+1):
        if count[str(2*i-1)]!=2:
            k=0
if k!=0:
    if N%2==0:
        print(2**(len(count.keys()))%(10**9+7))
    else:
        print(2**(len(count.keys())-1)%(10**9+7))
else:
    print(0)

Measured memory_bytes: 16100
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A
"""
t,x = LI()
print(t/x)
"""

#B
n = II()
a = LI()
m = max(a)
if m >= sum(a)-m:
    print("No")
else:
    print("Yes")
#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

int main() {
	int a, b;
  	cin >> a >> b;
  
  if (a % 2 == 0 || b % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力
static char sc1Str[1024];										// 文字列
static int siLen;												// 文字列長

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 改行カット
// 戻り値：文字数
int
fCutCrLf(
	char *pcpStr				// <I> 文字列
)
{
	int i;

	for (i = 0; pcpStr[i] != '\0'; i++) {
		if (pcpStr[i] == '\n') {
			pcpStr[i] = '\0';
			break;
		}
	}

	return i;
}

// 変更回数 - 取得
int
fGetCCnt(
	int piSNo					// <I> 開始位置
	, int piENo					// <I> 終了位置
)
{
	int i;

	int liCCnt = 0;
	for (i = piSNo; i <= piENo; i++) {
		if (sc1Str[i] == sc1Str[i - 1]) {
			sc1Str[i] = 0;
			liCCnt++;
		}
	}

	return liCCnt;
}

// 実行メイン
long long
fMain(
)
{
	char lc1Buf[1024];

	// 文字列 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);
	siLen = fCutCrLf(sc1Str);
	memcpy(&sc1Str[siLen], sc1Str, siLen);
	memcpy(&sc1Str[siLen * 2], sc1Str, siLen);

	// 繰り返し回数 - 取得
	long long llRCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%lld", &llRCnt);
	llRCnt--;

	// 変更回数 - 取得
	long long llCCnt1 = fGetCCnt(1, siLen - 1);
	long long llCCnt2 = fGetCCnt(siLen, siLen * 2 - 1);
	long long llCCnt3 = fGetCCnt(siLen * 2, siLen * 3 - 1);

	if (llCCnt2 == llCCnt3) {
		llCCnt1 += llRCnt * llCCnt2;
	}
	else {
		llCCnt1 += (llRCnt + 1) / 2 * llCCnt2;
		llCCnt1 += llRCnt / 2 * llCCnt3;
	}

	return llCCnt1;
}

// １回実行
int
fOne(
)
{
	long long llRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	llRet = fMain();

	// 出力
	sprintf(lc1Buf, "%lld\n", llRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 128
s = str(input())

if 1 <= int(s[:2]) <=12 and 1 <= int(s[2:]) <=12:
    print("AMBIGUOUS")
elif 1 <= int(s[2:]) <=12:
    print("YYMM")
elif 1 <= int(s[:2]) <=12:
    print("MMYY")
else:
    print("NA")




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

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("Ofast")

using namespace std;
using ll = long long;

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

// for vector
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(ALL(x), greater<int>())
#define RSORTS(x) sort(ALL(x), greater<string>())
#define FIND(x, n) find(ALL(x), n)
#define VFOR(e, x) for (auto &e : x)

// Constant
const ll INF = 1000000000000; // 10^12:  ∞
const int MOD = 1000000007;   // 10^9+7: Congruence ceremony MOD
const int MAXR = 100000;      // 10^5:   Array Max Range
const char EL = '\n';         // newline

// alias
#define EB emplace_back // push as last element
#define PP pop_back     // pop last element
#define MP make_pair    // pair constractor
#define F first         // first element of pair
#define S second        // second element of pair

// change max/min
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;
}

// optimize in/out
#define OPTIMIZE_CIN_COUT() \
  cin.tie(0);               \
  ios::sync_with_stdio(false);

template <typename... Args>
void input(Args... args)
{
  for (int &e : {args...})
  {
    cin >> e;
  }
}
#define INPUT1(a) \
  int a = 0;      \
  cin >> a;
#define INPUT2(a, b) \
  int a = 0;         \
  int b = 0;         \
  cin >> a >> b;
#define INPUT3(a, b, c) \
  int a = 0;            \
  int b = 0;            \
  int c = 0;            \
  cin >> a >> b >> c;
#define INPUTS(s) \
  string s = "";  \
  cin >> s;

#define INPUTA(n, a) \
  int n = 0;         \
  cin >> n;          \
  vector<int> a(n);  \
  REP(i, n)          \
  {                  \
    cin >> a[i];     \
  }
#define INPUTB(y, b)                        \
  int x = 2, y = 0;                         \
  cin >> y;                                 \
  vector<vector<int>> b(y, vector<int>(x)); \
  REP(i, y)                                 \
  {                                         \
    REP(j, x)                               \
    {                                       \
      cin >> b[i][j];                       \
    }                                       \
  }

int main()
{
  OPTIMIZE_CIN_COUT();

  // INPUT2(A, B);
  // INPUT3(A, B, C);
  // INPUTS(S);
  // INPUTA(N, A);
  INPUTB(N, B);

  int c = 0;
  int C = 3;

  REP(i, N)
  {
    if (B[i][0] == B[i][1])
    {
      if (++c >= C)
      {
        cout << "Yes";
        break;
      }
    }
    else
    {
      c = 0;
    }
  }

  if (c < C)
  {
    cout << "No";
  }
}


Measured memory_bytes: 3640
/// Thank you tanakh!!!
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(n: usize, t: usize, ct: [(usize, usize); n]);
    let mut min: usize = 1000000000000;
    for i in 0..n {
        let (cc, ct) = ct[i];
        if t >= ct && min > cc {
            min = cc;
        }
    }
    if min == 1000000000000 {
        println!("TLE");
    } else {
        println!("{}", min);
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
ll num[61];

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

    ll a[n];
    rep(i, 0, n){
        cin >> a[i];
        ll tmp = a[i];
        rep(j, 0, 61){
            if(tmp % 2 == 1){
                num[j]++;
            }
            tmp /= 2;
        }
    }

    ll sum = 0;
    rep(i, 0, n){
    ll calc = 1;
    ll tmp = a[i];
        rep(j, 0, 61){
            if(tmp % 2 == 1){
                sum += calc * (n - num[j]) % 1000000007;
            }else{
                sum += calc * num[j] % 1000000007;
            }
            sum %= 1000000007;
            calc *= 2;
            calc %= 1000000007;
            tmp /= 2;
        }
    }

    cout << sum * modinv(2, 1000000007) % 1000000007 << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
const int N=1005;
const char a3[3][4]={"..b","..b","aa."};
const char a4[4][5]={"eegd","aagd","hcff","hcbb"};
const char a5[5][6]={"g.fjj","g.fb.","ee.bh","dcc.h","daaii"};
const char a6[6][7]={"jj.ccg","..l.kg","aal.k.",".hhe.f","d..e.f","d.bbii"};
const char a7[7][8]={"kaa..gg","k.ffee.","nn..l.h","....lbh","..cc.bm","...dj.m","ii.dj.."};
int n;
char grid[N][N];

int main()
{
	
	cin>>n;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
		grid[i][j]='.';
	if(n==2) puts("-1");
	if(n==3)
		for(int i=0;i<3;i++,puts(""))
		for(int j=0;j<3;j++)
			putchar(a3[i][j]);
	if(n==6)
		for(int i=0;i<6;i++,puts(""))
		for(int j=0;j<6;j++)
			putchar(a6[i][j]);
	if(n==7)
		for(int i=0;i<7;i++,puts(""))
		for(int j=0;j<7;j++)
			putchar(a7[i][j]);
	if(n==11)
	{
		for(int i=0;i<6;i++)
		for(int j=0;j<6;j++)
			grid[i][j]=a6[i][j];
		for(int i=6;i<11;i++)
		for(int j=6;j<11;j++)
			grid[i][j]=a5[i-6][j-6];
		for(int i=0;i<11;i++,puts(""))
		for(int j=0;j<11;j++)
			putchar(grid[i][j]);
	}
	if(n==2 || n==3 || n==6 || n==7 || n==11) return 0;
	
	for(int i=0,j=n/4;;i++,j=(n-i*5)/4)
	{
		if(i*5+j*4!=n) continue;
		for(int x=0;x<i*5;x+=5)
		for(int y=0;y<5;y++)
		for(int z=0;z<5;z++)
			grid[x+y][x+z]=a5[y][z];
		for(int x=i*5;x<n;x+=4)
		for(int y=0;y<4;y++)
		for(int z=0;z<4;z++)
			grid[x+y][x+z]=a4[y][z];
		for(int i=0;i<n;i++,puts(""))
		for(int j=0;j<n;j++)
			cout<<grid[i][j];
		return 0;
	}
	
	return 0;
}

Measured memory_bytes: 2176
#include <climits>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  int H, W;
  cin >> H >> W;

  vector<vector<int>> dist(10, vector<int>(10, INT_MAX));
  rep(i, 10) {
    rep(j, 10) { cin >> dist[i][j]; }
  }
  rep(k, 10) {
    rep(i, 10) {
      rep(j, 10) {
        if (dist[i][k] == INT_MAX || dist[k][j] == INT_MAX) continue;
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  vector<int> A(11, 0);
  rep(i, H) {
    rep(j, W) {
      int a;
      cin >> a;
      A[a + 1]++;
    }
  }
  int answer = 0;
  for (int i = 0; i <= 9; ++i) {
    answer += dist[i][1] * A[i + 1];
  }
  cout << answer << endl;
  return 0;
}


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

typedef long long ll;

void solve() {
    ll N, ans, i, MOD = 1e9+7;
    string S1, S2;
    cin >> N >> S1 >> S2;
    if (S1[0] == S2[0]) {
        ans = 3;
        i = 1;
    } else {
        ans = 6;
        i = 2;
    }
    while (i < N) {
        if (S1[i - 1] == S2[i - 1]) {
            ans = ans * 2 % MOD;
            if (S1[i] != S2[i]) i++;
        } else {
            if (S1[i] != S2[i]) {
                ans = ans * 3 % MOD;
                i++;
            }
        }
        i++;
    }
    cout << ans << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 256
//Win first k matches.Then, if i-k doesn't interrupt win this match as well.But if you lose a match you have 2 options. But 1 option will lead you to losing the next restricted hand.
//For this,every '?' has only an option so that the player loses only that hand without interrupting the next one.So here we see if we lose a hand then it's only because we have
//won the previous restricted hand of the same type and it's like an exchange. But if we win then it's independent of what we have played before as we had already known we were gonna play this move.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   // freopen("in.txt","r",stdin);
   
    int n,k,r,p,s,points = 0;
    vector < char > moves;
    string t;
    
    cin >> n >> k >> r >> s >> p >> t;
    
    for(int i=0;i<k;i++){
        if(t[i]=='r'){
            points += p;
            moves.push_back('p');
        }
        
        else if(t[i]=='p'){
            points += s;
            moves.push_back('s');
        }
        
        else if(t[i]=='s'){
            points += r;
            moves.push_back('r');
        }
    }
    
    for(int i=k;i<t.size();i++){
        if(t[i]=='r'){
            if(moves[i-k] != 'p'){
                points += p;
                moves.push_back('p');
            }
            else{
                moves.push_back('?');
            }
        }
    
        else if(t[i]=='p'){
            if(moves[i-k] != 's'){
                points += s;
                moves.push_back('s');
            }
            else{
                moves.push_back('?');
            }
        }
        
        else if(t[i]=='s'){
            if(moves[i-k] != 'r'){
                points += r;
                moves.push_back('r');
            }
            else{
                moves.push_back('?');
            }
        }
    }
    
    cout << points << endl;
}


Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var MIN int = 0

var sc = bufio.NewScanner(os.Stdin)

type Node struct {
	key, pri    int
	left, rigth *Node
}

func next() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i

}

func nextString() string {
	sc.Scan()
	return sc.Text()

}

func rigthRotate(t *Node) *Node {
	s := t.left
	t.left = s.rigth
	s.rigth = t
	return s
}

func leftRotate(t *Node) *Node {
	s := t.rigth
	t.rigth = s.left
	s.left = t
	return s
}

func insert(t *Node, key int, pri int) *Node {
	if t == nil {
		return &Node{key: key, pri: pri}
	}
	if key == t.key {
		return t
	}
	if key < t.key {

		t.left = insert(t.left, key, pri)
		if t.pri < t.left.pri {
			t = rigthRotate(t)
		}
	} else {
		t.rigth = insert(t.rigth, key, pri)
		if t.pri < t.rigth.pri {
			t = leftRotate(t)
		}

	}
	return t
}

func find(t *Node, key int) bool {
	if t == nil {
		return false
	}

	if t.key == key {
		return true
	}

	if t.key > key {
		return find(t.left, key)

	} else if t.key < key {
		return find(t.rigth, key)

	}
	panic("error")
}

func erase(t *Node, key int) *Node {
	if t == nil {
		return nil
	}
	if key == t.key {
		if t.left == nil && t.rigth == nil {
			return nil

		} else if t.left == nil {
			t = leftRotate(t)
		} else if t.rigth == nil {
			t = rigthRotate(t)

		} else {
			if t.left.pri > t.rigth.pri {
				t = rigthRotate(t)

			} else {

				t = leftRotate(t)

			}

		}
		return erase(t, key)

	}
	if key < t.key {
		t.left = erase(t.left, key)

	} else {
		t.rigth = erase(t.rigth, key)

	}
	return t
}

func printInOrder(t *Node) {
	if t == nil {
		return
	}

	printInOrder(t.left)
	fmt.Printf(" %d", t.key)
	printInOrder(t.rigth)

}

func printPreOrder(t *Node) {
	if t == nil {
		return
	}

	fmt.Printf(" %d", t.key)
	printPreOrder(t.left)
	printPreOrder(t.rigth)

}

func main() {
	sc.Split(bufio.ScanWords)

	var head *Node

	m := next()
	for i := 0; i < m; i++ {

		switch nextString() {

		case "insert":
			k, p := next(), next()
			head = insert(head, k, p)

		case "print":
			printInOrder(head)
			fmt.Println()
			printPreOrder(head)
			fmt.Println()
		case "find":
			k := next()
			if find(head, k) {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		case "delete":
			k := next()
			head = erase(head, k)

		}

	}
}



Measured memory_bytes: 14492
A=[]
for _ in range(3):
    A.append(list(map(int,input().split())))
    
ans=[[0]*3 for i in range(3)]

N=int(input())

for _ in range(N):
    temp=int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==temp:
                ans[i][j]=1

for i in range(3):
    if sum(ans[i])==3:
        print("Yes")
        exit()

for i in range(3):
    temp=0
    for item in ans:
        temp+=item[i]
    if temp==3:
        print("Yes")
        exit()

if ans[0][0]+ans[1][1]+ans[2][2]==3 or ans[0][2]+ans[1][1]+ans[2][0]==3:
    print("Yes")
    exit()

print("No")




Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace kp
{
    public class Program
    {
        //static long[,] cmb;
        static int MAX_INT = 1000000007;
        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            
            // 絶対値の一番小さいものを探す
            int minAbs = MAX_INT;
            // 絶対値の合計を探す
            long sum = 0;
            // 負の数がいくつあるか数える
            int numMinus = 0;
            for(int i=0; i<N; i++)
            {
                if (input[i] < 0)
                {
                    numMinus++;
                    if (minAbs > -input[i])
                        minAbs = -input[i];

                    sum -= input[i];
                }
                else
                {
                    if (minAbs > input[i])
                        minAbs = input[i];

                    sum += input[i];
                }
            }

            if(numMinus%2 == 0)
            {
                Console.WriteLine(sum + "");
            }
            else
            {
                Console.WriteLine((sum - 2*minAbs) + "");
            }
            
                
        }
    }
}


Measured memory_bytes: 31964
#include<stdio.h>
int main(){
  int n,ans=0,i;
  char s[110];
  scanf("%d\n%s\n",&n,s);
  if(n%2==1){
    ans=1;
  }
  else{
  for(i=0;i<n/2;i++){
    if(s[i]!=s[i+n/2]){
      ans=1;
      break;
    }
  }
  }
    if(ans==0){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
    return 0;
  }

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int max = 0;
  for (int i=0; i<N; i++) { //i番目までXに入っている
	int cnt = 0;
	for (char z='a'; z<='z'; z++) {
	  bool x=false;
	  bool y=false;
	  for (int j=0; j<i; j++) { 
			if(S.at(j) == z) x = true;
		}
	  for (int j=i; j<N; j++) {
			if(S.at(j) == z) y = true;
		}	  
	  if (x && y) cnt++;
	}
	if (cnt > max) max = cnt;
  }
  cout << max;
}


Measured memory_bytes: 256
n = gets.to_i

def f(a, b)
  [a.to_s.length, b.to_s.length].max
end

min = Float::INFINITY
Math.sqrt(n).round.times do |i|
  a = i + 1
  b, r = n.divmod(a)

  next unless r.zero?

  fmax = f(a, b)
  min = min > fmax ? fmax : min
end

puts min

Measured memory_bytes: 1788
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int r;
    cin >> r;
    cout << r * r << endl;
}


Measured memory_bytes: 256
using System;

class P
{
  static void Main()
  {
    for(;;) {
      var s = Console.ReadLine().Split(' ');
      if(s[1] == "?") break;
      var a = int.Parse(s[0]);
      var b = int.Parse(s[2]);
      var r = 0;
      switch (s[1]) {
        case "+": r = a + b; break;
        case "-": r = a - b; break;
        case "*": r = a * b; break;
        case "/": r = a / b; break;
      }
      Console.WriteLine(r);
    }
  }
}

Measured memory_bytes: 9244
from collections import deque
h, w = map(int, input().split())
S = [0 for i in range(h)]
for i in range(h):
    S[i] = input()

Di = [-1, 1, 0, 0] #Direction i
Dj = [0, 0, -1, 1] #Direction j
inf = 1000

def update_data(i:int, j:int, x:int):
    if Dist[i][j] == inf:
        Dist[i][j] = x
        Q.append([i, j])
    else:
        pass

ans = 0
for si in range(h):
    for sj in range(w):
        Dist = [[inf for j in range(w)] for i in range(h)]   #Distance
        if S[si][sj] == '.':
            Q = deque([])
            update_data(si, sj, 0)
            #BFS
            while len(Q) != 0:
                i, j  = Q[0][0], Q[0][1]
                Q.popleft()
                for dr in range(4):
                    ni , nj = i+Di[dr], j+Dj[dr]
                    if 0 <= ni and ni < h and 0 <= nj and nj < w:
                        if S[ni][nj] == '.':
                            update_data(ni, nj, Dist[i][j]+1)
                        else:
                            pass
                    else:
                        pass
            for i in range(h):
                for j in range(w):
                    if Dist[i][j] == inf:
                        pass
                    else:    
                        if ans < Dist[i][j]:
                            ans = Dist[i][j]
                        else:
                            pass
        else:
            pass
print(ans)

Measured memory_bytes: 3316
#include <algorithm>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  deque<char> q;
  rep(i, s.size()) {
    if (s[i] != 'B') {
      q.push_back(s[i]);
    } else {
      if (!q.empty()) {
        q.pop_back();
      }
    }
  }
  while (!q.empty()) {
    cout << q.front();
    q.pop_front();
  }
  return 0;
}


Measured memory_bytes: 3632
using System;
using System.Linq;

namespace _0093
{
    class Program
    {
        static void Main(string[] args)
        {
            bool b = true;
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x[0] == 0 && x[1] == 0)
                {
                    break;
                }
                if(b)
                {
                    b = false;
                }
                else
                {
                    Console.WriteLine();
                }
                bool a = true;
                for (int i = x[0]; i <= x[1]; i++)
                {
                    if (i % 4 == 0)
                    {
                        if (i % 100 == 0)
                        {
                            if (i % 400 == 0)
                            {
                                Console.WriteLine(i);
                                a = false;
                            }
                        }
                        else
                        {
                            Console.WriteLine(i);
                            a = false;
                        }
                    }
                }
                if (a)
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }
}

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

int main() {
  int ha, hb, ka, kb, a, b, c, d;
  cin >> ha >> hb >> ka >> kb >> a >> b >> c >> d;
  int h, k;
  h = (ha*a)+(hb*b)+((ha/10)*c)+((hb/20)*d);
  k = (ka*a)+(kb*b)+((ka/10)*c)+((kb/20)*d);
  if (h>k) {
    cout << "hiroshi" << endl;
  } else if (h<k) {
    cout << "kenjiro" << endl;
  } else {
    cout << "even" << endl;
  }
  return 0;
}



Measured memory_bytes: 3132
# -2進数の場合
N=int(input())
if N==0:
  print(0)
  exit(0)
d=-2
ans=[]
while N!=0:
    r=N%(d)
    if r<0:
        r+=2
    N=(N-r)//(d)
    ans.append(str(r))
    
print("".join(ans[::-1]))

Measured memory_bytes: 3060
<?php
[$N] = ints();
echo $N*pi()*2;

function str(){return trim(fgets(STDIN));}
function ints(){return array_map('intval',explode(' ',trim(fgets(STDIN))));}
function int(){return intval(trim(fgets(STDIN)));}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}
function popcount($x){$c=0;while($x){$x&=$x-1;++$c;}return$c;}
function o(...$val){
    if(count($val)==1)$val=array_shift($val);
    echo debug_backtrace()[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0)echo "empty array";
        elseif(!is_array(current($val)))echo "array: ",implode(" ", addIndex($val)),"\n";
        else{
            echo "array:array\n";
            if(isCleanArray($val))foreach($val as $row)echo implode(" ", addIndex($row)),"\n";
            else foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row)),"\n";
        }
    }else echo $val."\n";
}
function addIndex($val){if(!isCleanArray($val)){$val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);}return $val;}
function isCleanArray($array){$clean=true;$i = 0;foreach($array as $k=>$v){if($k != $i++)$clean = false;}return $clean;}
// 座圧対象の配列 -> [圧縮された配列,復元用のMap,圧縮用のMap]
function atsu($array){$a = array_flip($array);$fuku=array_flip($a);sort($fuku);$atsu = array_flip($fuku);foreach($array as $i=>$val)$array[$i]=$atsu[$val];return [$array, $fuku, $atsu];}
function gcdAll($array){$gcd=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$gcd=gcd($gcd,$array[$i]);}return $gcd;}
function gcd($m, $n){if(!$n)return $m;return gcd($n, $m % $n);}
function lcmAll($array){$lcm=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$lcm=lcm($lcm,$array[$i]);}return $lcm;}
function lcm($a, $b) {return $a / gcd($a, $b) * $b;}

function dfs($current, $from = -1, $d = 0){
  global $G, $distance;
  $distance[$current] = $d;
  foreach($G[$current] as $to){
    if($from != $to){
      dfs($to, $current, $d + 1);
    }
  }
}

function loadTree($N = false){
  if($N === false)$N = $GLOBALS['N'];
  return loadGraph($N, $N-1);
}
function loadGraph($N = false, $M = false, $both = true){
  if($N === false)$N = $GLOBALS['N'];
  if($M === false)$M = $GLOBALS['M'];
  $G = array_fill(1, $N, []);
  for($i = 0; $i < $M; $i++){
    $values = ints();
    if(count($values) == 2){
      list($a, $b) = $values;
      $G[$a][] = $b;
      if($both)$G[$b][] = $a;
    }else{
      list($a, $b, $d) = $values;
      $G[$a][] = [$b, $d];
      if($both)$G[$b][] = [$a, $d];
    }
  }
  return $G;
}


Measured memory_bytes: 16120
IDENTIFICATION DIVISION.
PROGRAM-ID. 172A.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A          PIC 9(02).
01 OUT        PIC ZZZ9.
*>
PROCEDURE DIVISION.
  ACCEPT A.
*>
  COMPUTE OUT = A + A ** 2 + A ** 3.
  DISPLAY FUNCTION TRIM(OUT).
*>
  STOP RUN.


Measured memory_bytes: 3944
#include <iostream>
using namespace std;
int main (){
while (1){
int map[17][17]={0},a,b,n,an,bn;
cin>>a>>b;
if (a==0&&b==0)break;
cin>>n;
for (int i=0;i<n;i++){
        cin>>an>>bn;
        map[bn][an]=-1;
}

map[1][1]=1;

for (int i=1;i<=b;i++){
        for (int j=1;j<=a;j++){

                if (map[i][j]!=-1){

                        if (map[i+1][j]!=-1&&i+1<=b){
                                map[i+1][j]+=map[i][j];
                        }
                        if (map[i][j+1]!=-1&&j+1<=a){
                                map[i][j+1]+=map[i][j];
                        }
                }
        }
}

cout<<map[b][a]<<endl;
}
return 0;
}



Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  int N,M;
  cin>>N>>M;
  vector<int> T(M);
  int ans=0;
  rep(i,N){
    int K;
    cin>>K;
    rep(j,K){
      int A;
      cin>>A;
      T[A-1]++;
    }
  }
  rep(i,M){
    if(T[i]==N){
      ans++;
    }
  }
  cout<<ans<<endl;
}   

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

int main(){
    string s;
    cin >> s;
    vector<string> ex = {"maerd", "remaerd", "esare", "resare"};
    reverse(s.begin(), s.end());
    bool can = true;
    for(int i = 0; i < s.size();){
        bool can2 = false;
        for(int j = 0; j < 4; ++j){
            string d = ex.at(j);
            if(s.substr(i, d.size()) == d){
                can2 = true;
                i += d.size();
            }
        }
        if(!can2){
            can = false;
            break;
        }
    }
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
  int N,A,c=1;
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    scanf("%d",&A);
    if(A%2==0){
      if((A%3)*(A%5)!=0) c=0;
    }
  }
  if(c==1) printf("APPROVED\n");
  else printf("DENIED\n");
  return 0;
}

Measured memory_bytes: 1640
import numpy as np
import itertools
H,W,K = map(int,input().split())
all_,choice = [],[]

lis = ['h'+str(h) for h in range(H)]
w_lis = ['w'+str(w) for w in range(W)]
lis.extend(w_lis)

for j in range(0,len(lis)+1):
  choice.extend(list(itertools.combinations(lis,j)))

for h in range(H):
  l = list(input().replace('#','1').replace('.','0'))
  all_.append(l)

all_ = np.array(all_,dtype=int)
ans = 0

for i in choice:
  A = all_.copy()
  for k in i:
    if k==None:
      pass
    elif k[0]=='h':
      A[int(k[1]),:]=0
    elif k[0]=='w':
      A[:,int(k[1])]=0
  #print(A)
  if A.sum()==int(K):
    ans+=1
      
print(ans)
  

Measured memory_bytes: 27620