akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;
const int MAX_V=10010;
const long long INF=10000000;
struct edge{int to,cap,rev;};
vector<edge> G[MAX_V];
int used[MAX_V];

void add_edge(int from, int to, int cap){
	G[from].push_back((edge){to,cap,(int)G[to].size()});
	G[to].push_back((edge){from,0,(int)G[from].size()-1});
	G[to].push_back((edge){from,cap,(int)G[from].size()});
	G[from].push_back((edge){to,0,(int)G[to].size()-1});
}

int dfs(int v, int t, int f){
	if(v==t) return f;
	used[v] = true;
	for(int i=0;i<G[v].size();i++){
		edge &e = G[v][i];
		if(!used[e.to] && e.cap>0){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,INF);
		if(f==0) return flow;
		flow += f;
	}
}

int main(){
	int i,j,h,w,s,t;
	char a[10010];
	cin >> h >> w;
	for(i=0;i<h*w;i++){
		cin >> a[i];
		if(a[i]=='S') s = i;
		if(a[i]=='T') t = i;
	}
	if(s%w==t%w || s/w == t/w){
		cout << -1 << endl;
		return 0;
	}
	for(i=0;i<h*w;i++){
		if(a[i]=='S'){
			add_edge(1000,i/w,INF); add_edge(1000,i%w+200,INF);
		}
		if(a[i]=='T'){
			add_edge(i/w,2000,INF); add_edge(i%w+200,2000,INF);
		}
		if(a[i]=='o'){
			add_edge(i/w,i%w+200,1);
		}
	}
	
	cout << max_flow(1000,2000) << endl;
}


Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n,a[200010];
int main() {
	std::cin>>n;
	std::deque<int> deq;
	rep(i,n)std::cin>>a[i];
	rep(i,n){
		if(i%2==0)deq.push_back(a[i]);
		else deq.push_front(a[i]);
	}
	if(n%2)std::reverse(all(deq));
	printArray(all(deq));
	return 0;
}

Measured memory_bytes: 5184
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-09-28
#

# Usage
#
"""
import sys

def input_single_line():
    """Receive Inputs."""
    return input()

def input_two_line():
    """Receive Two Lined Inputs.
    Like this.

    N
    1 2 3 4 5
    """
    n = sys.stdin.readline()
    n = n.rstrip("\n")
    target = sys.stdin.readline()
    target = target.rstrip("\n")
    # target = target.split(" ")

    return n, target


def check_a_becombility(one_str: str) -> int:
    """Check how can this str become "a"
    >>> check_a_becombility("a")
    0
    >>> check_a_becombility("z")
    1
    >>> check_a_becombility("b")
    25
    """
    if ord(one_str) == 97:
        return 0  # Because this is "a"

    return 123 - ord(one_str)


def make_suzuki_process(target_str :str, chance: int) -> str:
    """Suzuki Process.
    >>> make_suzuki_process("xyz", 4)
    'aya'
    >>> make_suzuki_process("a", 25)
    'z'
    >>> make_suzuki_process("codefestival", 100)
    'aaaafeaaivap'
    >>> make_suzuki_process("aaaa", 1000)
    'aaam'
    >>> make_suzuki_process("a", 26)
    'a'
    """
    target_str = list(target_str)
    costs = [check_a_becombility(i) for i in target_str]

    for pos, each_cost in enumerate(costs):
        if chance - each_cost >= 0:
            chance = chance - each_cost
            target_str[pos] = "a"

    if chance > 0:
        target_str[-1] = chr(ord(target_str[-1]) + chance % 26)

    return "".join(target_str)

if __name__ == "__main__":
    import doctest
    doctest.testmod()

    inputted = input_two_line()

    print(make_suzuki_process(inputted[0], int(inputted[1])))


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

int main() {
	ios :: sync_with_stdio(0);
	int a, b; cin >> a >> b;
	if(a <= 0 && b >= 0)
		cout << "Zero\n";
	else if(b < 0 && ((b - a + 1) & 1))
		cout << "Negative\n";
	else
		cout << "Positive\n";
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    if s in ['AKIHABARA','KIHABARA','AKIHBARA','AKIHABRA','AKIHABAR',\
             'KIHBARA','KIHABRA','KIHABAR','AKIHBRA','AKIHBAR','AKIHBRA',\
             'KIHBRA','KIHBAR','KIHABR','AKIHBR','KIHBR',]:
       print('YES')
    else:
        print('NO')
resolve()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this


const ll MAXN = 101;
ll val[MAXN],weight[MAXN];
ll n,W;
ll dp[MAXN][100001];

ll rec(ll idx,ll w){
    if(idx > n) return 0;

    ll &ans = dp[idx][w];
    if(ans != -1) return ans;
    ans = 0;

    ans = max(ans,rec(idx+1,w));
    
    if(w + weight[idx] <= W) {
        ans = max(ans,rec(idx+1,w+weight[idx]) + val[idx]);
    }
    return ans;
}

void solve(){
    cin>>n>>W;

    memset(dp,-1,sizeof(dp));
    FOR(i,1,n){
        cin>>weight[i]>>val[i];
    }

    ll ans = rec(1,0);

    cout<<ans<<endl;
}

signed main(){

    FastRead;    

    ll t;
    t = 1; 
    // cin>>t;
    while(t--) solve();
    
}

Measured memory_bytes: 79232
#include<iostream>

using namespace std;

const int INF=(1LL<<31)-1;

const int N_MAX=1<<20;
const int DAT_SIZE=N_MAX*2-1;
int dat[DAT_SIZE],lazy[DAT_SIZE];
int n;

void init(int size){
  fill(begin(dat),end(dat),INF);
  n=1;
  while(n<size){
    n*=2;
  }
}

void lazy_eval(int k){
  dat[k]+=lazy[k];
  if(k<n-1){
    lazy[k*2+1]+=lazy[k];
    lazy[k*2+2]+=lazy[k];
  }
  lazy[k]=0;
}

int rangemin(int a,int b,int k,int l,int r){
  if(r<=a||b<=l)return INF;
  lazy_eval(k);
  if(a<=l&&r<=b){
    return dat[k];
  }else{
    int v1=rangemin(a,b,k*2+1,l,(l+r)/2);
    int v2=rangemin(a,b,k*2+2,(l+r)/2,r);
    return min(v1,v2);
  }
}

int rangeadd(int v,int a,int b,int k,int l,int r){
  if(r<=a||b<=l){
    lazy_eval(k);
    return dat[k];
  }else if(a<=l&&r<=b){
    lazy[k]+=v;
    lazy_eval(k);
    return dat[k];
  }else{
    lazy_eval(k);
    int v1=rangeadd(v,a,b,k*2+1,l,(l+r)/2);
    int v2=rangeadd(v,a,b,k*2+2,(l+r)/2,r);
    return dat[k]=min(v1,v2);
  }
}

void change(int x,int v,int k,int l,int r){
  lazy_eval(k);
  if(k<n-1){
    if(x<(l+r)/2){
      change(x,v,k*2+1,l,(l+r)/2);
    }else{
      change(x,v,k*2+2,(l+r)/2,r);
    }
    lazy_eval(k*2+1);
    lazy_eval(k*2+2);
    dat[k]=min(dat[k*2+1],dat[k*2+2]);
  }else{
    dat[k]=v;
  }
}

int main(){
  int n,q;
  cin>>n>>q;
  init(n);
  while(q--){
    int com,x,y;
    cin>>com>>x>>y;
    if(com){
      cout<<rangemin(x,y+1,0,0,::n)<<endl;
    }else{
      change(x,y,0,0,::n);
    }
  }
}

Measured memory_bytes: 10164
#include <iostream>

using namespace std;

int main(void){
   
    int N;
    int A[2][100];
    
    int B[2][100];

    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[0][i];
    }
    for(int i = 0; i < N; i++){
        cin >> A[1][i];
    }
    
    B[0][0] = A[0][0];
    
    for(int i = 1; i < N; i++){
        B[0][i] = B[0][i - 1] + A[0][i];
    }
    
    B[1][N - 1] = A[1][N - 1];
    
    for(int i = N - 2; i >= 0; i--){
        B[1][i] = B[1][i + 1] + A[1][i];
    }
    
    int max = B[0][0]+B[1][0];
    for(int i = 0; i < N; i++){
        if(B[0][i]+B[1][i] > max)
            max = B[0][i]+B[1][i];
    }
    
    cout << max << endl;
    
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	static boolean[] isPrime = new boolean[1000001];
	static List<Integer> prime = new ArrayList<Integer>();
	static void primeCalc()
	{
		for(int i = 0; i < isPrime.length; ++i)
		{
			isPrime[i] = true;
		}
		isPrime[0] = isPrime[1] = false;
		for(int i = 0; i < isPrime.length; ++i)
		{
			if(isPrime[i])
			{
				prime.add(i);
				for(int j = 2 * i; j < isPrime.length; j += i)
				{
					isPrime[j] = false;
				}
			}
		}
	}
	public static void main(String[] args) 
	{
		primeCalc();
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int n = stdIn.nextInt();
			if(n == 0)
			{
				break;
			}
			int count = 0;
			int pos = 0;
			while(prime.get(pos) <= n / 2)
			{
				if(isPrime[n - prime.get(pos)])
				{
					++count;
				}
				++pos;
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 15000
#define MOD 109+7
#define  endll  "\n"
#define  ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define pii pair<int,int>

#include <bits/stdc++.h>

using namespace std;
const int N = 2e5, M = 2 * N, SEGN = 2 << (32 - __builtin_clz(N));

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input", "rt", stdin);
    // freopen("output", "wt", stdout);
#endif
    int x, y;
    cin >> x >> y;
    cout << (x + y) % 24;
}

Measured memory_bytes: 3616
a = list(map(int,input().split()))
a.sort()
k=0
r1=(a[2]-a[0])//2
r2=(a[2]-a[1])//2
k += r1+r2
a[0] += r1 * 2
a[1] += r2 * 2
if a[0]==a[1] and a[0]<a[2]:
  print(k+1)
elif a[0]<a[1] and a[1]==a[2]:
  print(k+2)
elif a[0]==a[2] and a[0]>a[1]:
  print(k+2)
else:
  print(k)

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

using namespace std;

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

ll INF = (1ll << 62);

int main() {
  ll N, K;
  cin >> N >> K;
  vi x(N), y(N);
  for (ll i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
  }

  vi v1(x);
  vi v2(y);
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());

  ll ans = INF;

  for (ll i = 0; i < N; i++) {
    for (ll j = i + 1; j < N; j++) {
      for (ll k = 0; k < N; k++) {
        for (ll l = k + 1; l < N; l++) {
          ll cnt = 0;
          for (ll m = 0; m < N; m++) {
            if (v1[i] <= x[m] && x[m] <= v1[j] && v2[k] <= y[m] && y[m] <= v2[l]) {
              cnt += 1;
            }
          }
          if (cnt >= K) {
            ans = min(ans, (v1[j] - v1[i]) * (v2[l] - v2[k]));
          }
        }
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
    #include <vector>
    #include <utility>
    using namespace std;
     
    int main(){
      int n,i;
      vector<pair<int,int> > v;
      cin >> n;
      long long a[n];
      int t;
      long long mx = 0,cnt=0;
      bool ch;
      for(i=0;i<n;i++){
        cin >> a[i];
        if(abs(a[i])-abs(mx)>0){
          mx = a[i];
          t=i;
        }
      }
      if(mx>=0)ch=true;
      else ch = false;
      
      for(i=0;i<n;i++){
        
        a[i]+=mx;
        cnt++;
        v.push_back(make_pair(t+1,i+1));
      }
      if(ch){
      	for(i=1;i<n;i++){
            a[i]+=a[i-1];
            v.push_back(make_pair(i,i+1));
            cnt++;
        }
      }else{
        for(i=n-2;i>=0;i--){
            a[i]+=a[i+1];
            v.push_back(make_pair(i+2,i+1));
            cnt++;
        }
      }
      cout << cnt << endl;
      for(i=0;i<v.size();i++){
        cout << v[i].first << " " << v[i].second << endl;
      }
      /*for(i=0;i<n;i++)cout << a[i] << " ";
      cout << endl;*/
       return 0;
    }
        

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<list>
using namespace std;
using ll = long long;
const int INF = 1e8;
int N;
vector<int>c;
int main() {
	int N, K;
	int A[110000];
	cin >> N >> K;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	cout << (N - 1 + K - 2) / (K - 1) << endl;
	return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first



typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int x,y;
    cin >>x>>y;

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout << ans << endl;

    if(max(x,y) <= 8)cout << "Yay!" <<endl;
    else cout << ":(" <<endl;
    return 0;
}


Measured memory_bytes: 256
s=input()
n=len(s)
for i in range(1,len(s)):
    if s[i-1]==s[i]:
        print(i,i+1)
        break
    elif i>1 and s[i-2]==s[i]:
        print(i-1,i+1)
        break
else:
    print(-1,-1)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

vector<ll> v(3);

int main(){
    rep(i,3)cin >> v[i];
    sort(ALL(v));
    cout << v[0] + v[1] << endl;
}

Measured memory_bytes: 256
N = int(input())
hoge = input().split()
H = []
for i in range(N):
  H.append(int(hoge[i]))

piyo = True
dame = False
if N == 1:
  print("Yes")
else:
  for i in range(0,N-1):
    huga = H[i+1] - H[i]
    # print(huga)
    if huga < -1:
      dame = True
      break
    elif huga == -1:
      if piyo == True:
        H[i] = H[i] - 1
      piyo = True
    elif huga > 0:
      H[i+1] = H[i+1] - 1
      piyo = False
  # print(H)
  for i in range(0,N-1):
    huga = H[i+1] - H[i]
    # print(huga)
    if huga < 0:
      dame = True
      break
  if dame == True:
    print("No")
  else:
    print("Yes")

Measured memory_bytes: 14976
#include<bits/stdc++.h>
using namespace std;
int n,m,sum=0;
bool vis[200005];
vector<int> fr[200005];
void dfs(int a)
{
    vis[a]=true;
    sum++;
    for(int i=0;i<fr[a].size();++i)
        if(!vis[fr[a][i]])
            dfs(fr[a][i]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        int x,y;
        cin>>x>>y;
        if(find(fr[x].begin(),fr[x].end(),y)==fr[x].end())
            fr[x].push_back(y);
        if(find(fr[y].begin(),fr[y].end(),x)==fr[y].end())
            fr[y].push_back(x);
    }
    for(int i=0;i<200005;++i)
            vis[i]=false;
    int ans=-1;
    for(int i=1;i<=n;++i)
        if(!vis[i])
            {
                dfs(i);
                ans=max(ans,sum);
                sum=0;
            }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 20976
#include <stdio.h>

int main(void) {
	int a,b,c;
	scanf("%d %d",&a,&b);
	
	if(a <= 5){
	    printf("0");
	}else if(a>= 6 && a <= 12){
	    c = b / 2;
	    printf("%d",c);
	}else{
	    printf("%d",b);
	}
	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    ll N,ans=0,base=5;
    cin >> N;
    if(N%2){
        P(0);
        return 0;
    }
    N/=2;
    while(1){
        if(N/base){
            ans+=N/base;
            base*=5;
        }else{
            break;
        }
    }
    P(ans);
}

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

int main()
{
    int n, m, x, y;
    cin >> n >> m >> x >> y;

    vector<int> a(n), b(m);
    for (auto& x : a) cin >> x;
    for (auto& x : b) cin >> x;

    a.push_back(x);
    b.push_back(y);

    sort(a.rbegin(), a.rend());
    sort(b.begin(), b.end());

    cout << (a[0] >= b[0] ? "War" : "No War") << endl;

    return 0;
}


Measured memory_bytes: 256
def solve168A(n)
  last_n = n % 10
  if last_n == 3
    puts ('bon')
  elsif last_n == 2 or last_n == 4 \
    or last_n == 5 or last_n == 7 or last_n == 9
    puts ('hon')
  else
    puts ('pon')
  end
end

N = gets.to_i
solve168A(N)

Measured memory_bytes: 14368
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>

using namespace std;
using ll = long long;

int h,w,k;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin>>h>>w>>k;
	vector<vector<bool> > m(h,vector<bool>(w,0));
	vector<bool> rhs(h,0);
	vector<vector<int> > res(h,vector<int>(w,0));
	for(int y=0; y<h; ++y){
		for(int x=0; x<w; ++x){
			char c;
			cin>>c;
			m[y][x]=(c=='#');
			if(m[y][x])rhs[y]=1;
		}
	}
	int cnt=0;
	for(int y=0; y<h; ++y){
		if(rhs[y]){
			int x=0;
			++cnt;
			for(; x<w; ++x){
				res[y][x]=cnt;
				if(m[y][x])break;
			}
			++x;
			for(;x<w; ++x){
				res[y][x]=cnt;
				if(m[y][x])res[y][x]=++cnt;
			}
		}
	}
	for(int y=h-2; y>=0; --y){
		if(!rhs[y]){
			for(int x=0; x<w; ++x){
				if(!res[y][x])res[y][x]=res[y+1][x];
			}
		}
	}
	for(int y=0; y<h; ++y){
		if(!rhs[y] && y && !res[y][0]){
			for(int x=0; x<w; ++x)res[y][x]=res[y-1][x];
		}
		for(int x=0; x<w; ++x){
			cout<<res[y][x]<<' ';
		}cout<<'\n';
	}
	return 0;
}



Measured memory_bytes: 1152
import java.io.*;
import java.util.*;

/**
 * Created by Ayushi on 05 Jul 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        StringTokenizer st;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        st = new StringTokenizer(br.readLine(), " ");
        int[] a = new int[n];
        int j = 0;

        while (st.hasMoreTokens()) {
            a[j] = Integer.parseInt(st.nextToken());
            //ans += a[j];
            j++;
        }
        br.close();
        Arrays.sort(a);
        long ans = a[n-1];
        int b;
        j = n-2;
        for (int i = n-2; i > 0; i-= 2) {
            //b = n-((a[i]+1)/2);
            b = a[j];
            //System.out.println(b);
            ans += b;

            if (i > 1) {
                //System.out.println(b);
                ans += b;
            }
            j--;
        }
        //ans -= a[0];

        System.out.println(ans);
    }
}


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

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int num[10] = {0,2,5,5,4,5,6,3,7,6};

  int n,m;
  cin >> n >> m;

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

  vector<string> dp(n+10, "+");
  dp[0] = "";

  for (int i = 0; i < n; ++i) {
    if (dp[i] == "+") continue;
    
    for (auto itr : a) {
      string candidate = dp[i] + (char)('0' + itr);
      if (dp[i + num[itr]] == "+") {
        dp[i + num[itr]] = candidate;
      } else if (candidate.size() > dp[i + num[itr]].size()) {
        dp[i + num[itr]] = candidate;
      } else if (candidate.size() == dp[i + num[itr]].size()) {
        dp[i + num[itr]] = (candidate > dp[i + num[itr]]) ? candidate : dp[i + num[itr]];
      }
    }
  }

  cout << dp[n] << endl;
}


Measured memory_bytes: 43648
#include<stdio.h>

int main(){
  int n, m;
  int arr1[100][100];
  int arr2[100];
  int i, j;
  int input;
  int res[100];
  int sum;
  
  // input
  scanf("%d %d", &n, &m);
  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      scanf("%d", &input);
      arr1[i][j] = input;
    }
  }

  for(i = 0; i < m; i++){
    scanf("%d", &input);
    arr2[i] = input;
  }

  // calculation
  for(i = 0; i < n; i++){
    sum = 0;
    for(j = 0; j < m; j++){
      sum += arr1[i][j] * arr2[j];
    }
    res[i] = sum;
  }

  // output result
  for(i = 0; i < n; i++){
    printf("%d\n", res[i]);
  }
  
  return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A;
  cin >> N >> A;
  int x = N % 500;
  
  if (x <= A) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int x;cin>>x;
  if(x<1200){
    cout<<"ABC"<<endl;
  }else{
    cout<<"ARC"<<endl;
  }

  return 0;
}


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

using namespace std;

int main(int argc, char *argv[]) {
  string str;

  cin >> str;
  string::reverse_iterator itr = str.rbegin();
  while (itr != str.rend()) {
    cout << *itr;
    itr++;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int a,b,c,num[5];
  cin >> num[0] >> num[1] >> num[2];

  int cnt = 0;
  while(!(num[0] == num[1] & num[1] == num[2])) {
    sort(num,num+3);
    if(num[0] < num[1]) {
      num[0] += 2; cnt++;
    } 
    else if(num[0] == num[1]) {
      num[0]++; num[1]++; cnt++;
    }
  }  
  cout << cnt << endl;
}


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

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<vector<pair<int, int>>> a(4);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        string s;
        cin >> s;
        if (s == "U") a[0].push_back({x, y});
        if (s == "R") a[1].push_back({x, y});
        if (s == "D") a[2].push_back({x, y});
        if (s == "L") a[3].push_back({x, y});
    }

    long res = LLONG_MAX;

    for (int tt = 0; tt < 4; tt++) {

        {
            map<int, vector<pair<int, int>>> b;
            for (auto &p : a[1]) {
                b[p.second].push_back({p.first, 1});
            }
            for (auto &p : a[3]) {
                b[p.second].push_back({p.first, -1});
            }
            for (auto &e : b) {
                auto &l = e.second;
                sort(l.begin(), l.end());
                for (int i = 0; i < (int) l.size() - 1; i++) {
                    if (l[i].second == 1 && l[i + 1].second == -1) {
                        res = min(res, (long) (l[i + 1].first - l[i].first) * 5);
                    }
                }
            }
        }
        {
            map<int, vector<pair<int, int>>> b;
            for (auto &p : a[1]) {
                b[p.first + p.second].push_back({p.first, 1});
            }
            for (auto &p : a[0]) {
                b[p.first + p.second].push_back({p.first, -1});
            }
            for (auto &e : b) {
                auto &l = e.second;
                sort(l.begin(), l.end());
                for (int i = 0; i < (int) l.size() - 1; i++) {
                    if (l[i].second == 1 && l[i + 1].second == -1) {
                        res = min(res, (long) (l[i + 1].first - l[i].first) * 10);
                    }
                }
            }
        }


        for (auto &l : a) {
            for (auto &p : l) {
                swap(p.first, p.second);
                p.first = -p.first;
            }
        }
        for (int i = 0; i < 3; i++) {
            a[i].swap(a[i + 1]);
        }
    }
    
    if (res == LLONG_MAX) {
        cout << "SAFE\n";
    } else {
        cout << res << "\n";
    }

    return 0;
}

Measured memory_bytes: 26364
#include<bits/stdc++.h>
#define ri register int
using namespace std;

inline int read()
{
	char c=getchar();
	int x=0,f=1;
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
	return x*f;
}

const int maxn=3e3+5;

int a[maxn];

int main()
{
	int n,sum;
	n=read();sum=0;
	for (ri i=1;i<=n;i++) a[i]=read(),sum+=a[i];
	sum-=n;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1e9+7;

int main() {
  ll n;
  string s;
  ll k;
  cin >> n >> s >> k;
  char c=s[k-1];
  for(ll i=0;i<n;i++) {
    if(s[i]!=c) {
      s[i]='*';
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 256
import itertools
n = int(input())
li = ['M','A','R','C','H']
d = {}
for l in li:
    d[l] = 0
ans = 0

for i in range(n):
    s = input()[0]
    if s in li:
        d[s] += 1

for v in itertools.combinations(li,3):
    ans += d[v[0]] * d[v[1]] * d[v[2]]

print(ans)


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

int main(){
    char c;
    cin>>c;
    if(c=='A')c='T';
    else if(c=='T')c='A';
    else if(c=='G')c='C';
    else if(c=='C')c='G';
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

int n,m,c[20][20],f[33000][20],sum[33000],stk[33000],top;

int main()
{
    scanf("%d%d",&n,&m);
    while (m--)
    {
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        c[u-1][v-1]=c[v-1][u-1]=w;
    }
    memset(f,80,sizeof(f));
    for (int i=1; i<1<<n; i+=2)
        f[i][0]=0;
    repu(i,1,(1<<n)-1)
    {
        repu(j,0,n-1)
        {
            sum[1<<j]=0;
            repu(k,0,n-1)
                if ((i>>k)&1)
                    sum[1<<j]+=c[j][k];
        }
        top=0;
        for (int s=(1<<n)-1-i,j=s; j; j=(j-1)&s)
            stk[++top]=j;
        for (; top; --top)
        {
            int t=stk[top];
            sum[t]=sum[t&-t]+sum[t^(t&-t)];
        }
        repu(j,0,n-1)
            if (!((i>>j)&1))
            {
                int w=1<<30;
                repu(k,0,n-1)
                    if (c[j][k])
                        w=min(w,f[i][k]-c[j][k]);
                for (int s=(1<<n)-1-i-(1<<j),k=s; 1; k=(k-1)&s)
                {
                    f[i^k^(1<<j)][j]=min(f[i^k^(1<<j)][j],w+sum[k^(1<<j)]);
                    if (!k)
                        break;
                }
            }
    }
    printf("%d\n",f[(1<<n)-1][n-1]);
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

void dfs(int u, vector<vector<int>> const& g, vector<int> &dp) {
    if (dp[u] != -1) return;
    dp[u] = 0;
    for (auto v : g[u]) {
        dfs(v, g, dp);
        dp[u] = max(dp[u], dp[v]);
    }
    dp[u]++;
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
    }

    vector<int> dp(n, -1);

    int ans = 0;
    for (int i = 0; i < n; i++) {
        dfs(i, g, dp);
        ans = max(ans, dp[i]);
    }
    cout << ans - 1;
}

int main() {
    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}


Measured memory_bytes: 8832
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える


int main() {
	vector<int> x(5);
	rep(i, 5) cin >> x[i];

	rep(i, 5) {
		if (x[i] == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  vector<long long int> h(N);
  for (int i = 0; i < N; i++){
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  long long int ans = pow(10, 9);
  for (int i = 0; i < N-K+1; i++){
    ans = min(ans, h.at(i+K-1) - h.at(i));
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int k, s, cnt = 0;
  cin >> k >> s;
  int x = 0, y = 0, z = 0;
  for (x = 0; x <= k; x++) {
    for (y = 0; y <= k; y++) {
      z = s - x - y;
      if ((0 <= z) && (z <= k)) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(K: int):
    print((K // 2) * ((K + 1) // 2))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)


if __name__ == '__main__':
    main()


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

#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int n;
    cin>>n;
    vector<int>v(n);
    for(auto &c:v) cin>>c;
    sort(v.begin(),v.end());
    int l=0;
    int sum=0;
    for(int i=0;i<n-1;i++)
    {
        sum+=v[i];
        if(2*sum>=v[i+1])
            continue;
        else
            l=i+1;
    }
    cout<<n-l<<endl;
    return 0;
}

Measured memory_bytes: 3924
#include<stdio.h>

int main(){
  int a[5];
  
  int i;
  for(i = 0;i < 5;i++){
    scanf("%d",&a[i]);
    if(a[i] == 0){
      printf("%d",i+1);
      break;
    }
  }
  return 0;
  
}

Measured memory_bytes: 1736
#include <stdio.h>          // printf(), scanf()
#include <string.h>         // strlen()

#define MAX_L 1000
#define max(a, b) ((a) > (b) ? (a) : (b))

int
main(int argc, char** argv)
{
	char s[MAX_L + 1], t[MAX_L + 1];
	int dp[MAX_L + 1][MAX_L + 1];
	int n;
	int i, j, k;

	scanf("%d", &n);
	for (k = 0; k < n; ++k)
	{
		scanf("%s", s);
		scanf("%s", t);
		int u = strlen(s);
		int v = strlen(t);

		for (i = 0; i <= u; ++i)
			dp[i][0] = 0;

		for (j = 0; j <= v; ++j)
			dp[0][j] = 0;

		for (i = 0; i < u; ++i)
		{
			for (j = 0; j < v; ++j)
			{
				if (s[i] == t[j])
					dp[i + 1][j + 1] = dp[i][j] + 1;
				else
					dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
			}
		}

		printf("%d\n", dp[u][v]);
	}

	return 0;
}

Measured memory_bytes: 4516
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N, H, W; cin >> N >> H >> W;
  int ans = 0;
  REP(i, N) {
    int A, B; cin >> A >> B;
    if (A >= H && B >= W) ans++;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    int N;
    string S, T;
    cin >> N >> S >> T;
    string ans;
    Fp(i, 0, N){
        ans += S[i];
        ans += T[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int a = sc.nextInt();
     int b = sc.nextInt();
     for(int i=1; i<=3; i++)
     if(a*b*i%2 != 0) {
    	 System.out.println("Yes");
    	 break;
     } else {
    	 System.out.println("No");
    	 break;
     }     
      
    	  
      
    }
 }


Measured memory_bytes: 21844
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define PI (3.141592653589)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define MOD 1000000007

long long func(long long h)
{
    if(h == 1)
    {
        return 1ll;
    }
    return 1 + 2 * func(h / 2);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who forgive themselves, and are able to accept their true nature...THEY ARE THE STRONG ONES

    long long h;
    cin >> h;
    cout << func(h);
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc123c()
}

fun abc123c() {
    val n = readLine()!!.toLong()
    val capacities = (1..5).map { readLine()!!.toLong() }

    // ボトルネックだけ考えればよい
    val minCapacity = capacities.min()!!

    val answer = Math.ceil(n.toDouble() / minCapacity.toDouble()).toLong() + 4

    println(answer)
}


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

using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;
const int Maxn = 3e5+10;

int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(false); cout.tie(false);
	int M, D, ans = 0;
	cin >> M >> D;
	for(int i = 1; i <= M; ++i) {
		for(int j = 1; j <= D; ++j) {
			if(j%10 >= 2 && j/10 >= 2 && (j%10)*(j/10) == i) {
				ans++; //cout << i << " " << j << endl;	
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
    long long h;
    cin >> h;
    long long logH = log(h) / log(2);
    long long ans = 0;
    for(int i = 0; i <= logH; i++){
        ans += pow(2, i);
    }
    cout << ans << endl;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> vv;
    for (int i = 0; i < M; i++)
    {
        int k;
        cin >> k;
        vector<int> s;
        for (int j = 0; j < k; j++)
        {
            int n;
            cin >> n;
            s.push_back(n);
        }

        vv.push_back(s);
    }

    vector<int> ps(10,0);
    vector<int> pps(10,0);
    for (int i = 0; i < M; i++)
    {
        int n;
        cin >> n;
        ps.at(i) = n;
        
    }

    for (int i = 0; i < N; i++)
    {
        pps.at(i) = 1;
    }
    

    int counter = 0;

    for (int i1 = 0; i1 < pps.at(0)+1; i1++)
    {
        for (int i2 = 0; i2 < pps.at(1)+1; i2++)
        {
            for (int i3 = 0; i3 < pps.at(2)+1; i3++)
            {
                for (int i4 = 0; i4 < pps.at(3)+1; i4++)
                {
                    for (int i5 = 0; i5 < pps.at(4)+1; i5++)
                    {
                        for (int i6 = 0; i6 < pps.at(5)+1; i6++)
                        {
                            for (int i7 = 0; i7 < pps.at(6)+1; i7++)
                            {
                                for (int i8 = 0; i8 < pps.at(7)+1; i8++)
                                {
                                    for (int i9 = 0; i9 < pps.at(8)+1; i9++)
                                    {
                                        for (int i10 = 0; i10 < pps.at(9)+1; i10++)
                                        {
                                            // cout << i1 << "|" <<i2 << endl;
                                            vector<int> switches = {i1, i2, i3, i4, i5, i6, i7, i8, i9, i10};
                                            for (int i = 0; i < M; i++)
                                            {
                                                int total = 0;
                                                for (auto &&j : vv.at(i))
                                                {
                                                    total += switches.at(j-1);
                                                }
                                                
                                                
                                                if (ps.at(i) != total % 2)
                                                {
                                                    break;
                                                }

                                                if (i == M-1)
                                                {
                                                    counter ++;
                                                }
                                                
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    cout << counter << endl;
}

Measured memory_bytes: 256
p = 10**9+7
N,M = map(int,input().split())
A = [1 for _ in range(N+1)]
for i in range(2,N+1):
    A[i] = (i*A[i-1])%p
B = [1 for _ in range(M+1)]
for i in range(2,M+1):
    B[i] = (i*B[i-1])%p
if abs(N-M)>1:
    ans = 0
elif abs(N-M)==1:
    ans = (A[N]*B[M])%p
elif abs(N-M)==0:
    ans = (2*A[N]*B[M])%p
print(ans)

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

using namespace std;
using ll = long long;

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

    string s, t;

    cin >> s >> t;

    int ans = 0;

    for(int i = 0; i < s.size(); ++i) {
        if(s[i] != t[i]) ans++;
    }

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

    return 0;
}

Measured memory_bytes: 3864
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

a = na()
m = max(a)
b = [abs(i - m) for i in a]
print(sum(b) // 2 + sum(b) % 2 * 2)

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int X,Y;
ll mo=1000000007;

ll comb(ll N_, ll C_) {
	const int NUM_=1400001;
	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[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>X>>Y;
	if((X+Y)%3) return _P("0\n");
	int P=(X+Y)/3;
	if(X<P || Y<P) return _P("0\n");
	X-=P;
	Y-=P;
	cout<<comb(X+Y,X)<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 33024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];

int main(){
  int c[3][3] ;
  rep(i,3){
    rep(j,3){
      cin >> c[i][j] ;
    }
  }
  int a[3] ,b[3] ;
  a[0] = 0 ;
  rep(i,3)
    b[i] = c[0][i] ;
  a[1] = c[1][0] - b[0] ;
  a[2] = c[2][0] - b[0] ;
  rep(i,3){
    rep(j,3){
      if( c[i][j] != a[i] + b[j] ){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}
      

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	ll N; cin >> N;

	ll a[100];
	ll max_abs = 0;
	ll max_idx = -1;
	for (int i = 0;i < N;i++){
		cin >> a[i];
		if(abs(a[i]) > abs(max_abs)){
			max_abs = a[i];
			max_idx = i;
		}
	}

	vector<P> ans;

	if(max_abs < 0){
		for (int i = N-2;i >= 0;i--){
			while(a[i] > a[i+1]){
				a[i] += max_abs;
				ans.push_back(P(max_idx+1, i+1));
				if(abs(a[i]) > abs(max_abs)){
					max_abs = a[i];
					max_idx = i;
				}
			}
		}
	}else{
		for (int i = 1;i < N;i++){
			while(a[i] < a[i-1]){
				a[i] += max_abs;
				ans.push_back(P(max_idx+1, i+1));
				if(abs(a[i] > abs(max_abs))){
					max_abs = a[i];
					max_idx = i;
				}
			}
		}
	}

	cout << ans.size() << endl;

	for (int i = 0;i < ans.size(); i++){
		cout << ans[i].first << " " << ans[i].second << endl;
	}

	return 0;

}


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

#define ll long long
#define ld long double
#define ull unsigned long long
#define pw(x) (1LL << (x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

    int x, dist = 0;
    cin >> x;

    for (int i = 0;; ++i)
    {
        dist += i;
        if (dist >= x)
        {
            cout << i << '\n';
            break;
        }
    }

    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    cout << ((a + b >= c) ? "Yes" : "No") << '\n';
    return 0;
}


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

typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    map<string,int>mp;
    map<string,int>::iterator it;
    int n;
    string a;
    cin>>n;
    int cnt=0;
    while(n--)
    {
        cin>>a;
        mp[a]++;
        cnt=max(cnt,mp[a]);
    }
    vector<string>v;
    for(it=mp.begin();it!=mp.end();it++)
    {
        if(it->second==cnt)
        {
            v.push_back(it->first);
        }
    }
//    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
    {
        cout<<v[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 25584
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<stdio.h>
#include<vector>
#define rep(i,n)for(int i=0;i<n;i++)
#define aoj(i,n) for(i=0;n!=0;i++)
//printf("%.yf\n",x); xを小数点以下y桁で
using namespace std;
int main() {
    vector<int>data;
    int c = 0;
    int s=10;
    aoj(c,s) {
        cin >> s;
        data.push_back(s);
    }
    rep(i, c-1) {
        cout << "Case " << i + 1 << ": " << data[i] << endl;
    }
   return 0;
}



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

int main(void)
{
	string o, e, ans;
	cin >> o >> e;
	for (int i = 0; ; i++)
	{
		if (o.size() <= i) break;
		ans += o[i];
		if (e.size() <= i) break;
		ans += e[i];
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256