akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
    int n,m;
    cin>>n>>m;

    vector<int> a(n+1,0);

    rep(i,1,a.size())
    {
        cin>>a[i];
    }

    vector< vector<int> > v(n+1);

    rep(i,0,m)
    {
        int l,r;
        cin>>l>>r;

        v[l].pb(r);
        v[r].pb(l);
    }
    int cnt = 0;
    rep(i,1,n+1)
    {
        if ( v[i].size() == 0 )
        {
            cnt++;
            continue;
        }
        int found = 0;
        rep(j,0,v[i].size())
        {
            if ( a[i] <= a[v[i][j]] )
            {
                found = 1;
                break;
            }
        }

        if( found == 0 )
        {
            cnt++;
        }
    }

    cout<<cnt<<endl;
}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

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

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

Measured memory_bytes: 9800
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    //
    String s = sc.next();
    //
    String t = sc.next();
    
    int ans = 0;
    
    for (int i = 0; i < s.length(); i++){
      String s1 = s.substring(i, i+1);
      String t1 = t.substring(i, i+1);
      
      if(!(s1.equals(t1))){
        ans++;
      }
    }
    
    System.out.println(ans);
  }
}

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

int main(){
  string S;
  cin >> S;
  if(S[0]=='7' || S[1]=='7' || S[2]=='7'){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long
inline long long in(){long long x=0;char c=getchar();bool neg=false;while(c!='-'&&('0'>c||c>'9')) c=getchar();if(c=='-') neg=true,c=getchar();while('0'<=c&&c<='9') x=10*x+c-'0',c=getchar();if(neg) x=-x;return x;}
inline void out(long long x){if(x<0) putchar('-'),x=-x;if(x>9) out(x/10);putchar(x%10+'0');}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "P"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
#define _ putchar(' ')
#define __ putchar('\n')
const int N=100010;
const int M=1e9+7;
int n,m;
int f[N][2];
vector<int> ad[N];
int F(int u,int c,int p)
{
    if(f[u][c]!=-1) return f[u][c];
    int ans=1;
    if(!c)
    {
        forv(v,ad[u]) if(v!=p) ans=(F(v,0,u)+F(v,1,u))%M*ans%M;
    }
    else
    {
        forv(v,ad[u]) if(v!=p) ans=ans*F(v,0,u)%M;
    }
    return f[u][c]=ans;
}
main()
{
    fasty;
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    cin>>n;
    forinc(i,1,n-1)
    {
        int u,v;cin>>u>>v;
        ad[u].pb(v);
        ad[v].pb(u);
    }
    reset(f,-1);
    cout<<(F(1,0,0) + F(1,1,0))%M;
}


Measured memory_bytes: 14208
a = [str(i) for i in input().split()]

class Stack:
  def __init__(self, length):
    self.stack = [0]*length
    self.top = 0
  def push(self, x):
    self.top +=1
    self.stack[self.top] = x
  def pop(self):
    self.top -=1 
    return self.stack[self.top+1]

s = Stack(1000)

for i in a:
  if i == '+':
    b = s.pop()
    a = s.pop()
    s.push(a+b)
  elif i == '-':
    b = s.pop()
    a = s.pop() 
    s.push(a-b)
  elif i == '*':
    b = s.pop()
    a = s.pop()
    s.push(a*b)
  else:
    s.push(int(i))

print(s.stack[s.top],end='\n')


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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

#define POS(i,j) ((i)*w+(j))

int func(int i,int j,char *board,int h,int w){
  int k;
  for(k=0;k<h;k++){
    if(board[POS(k,i)]!=board[POS(h-1-k,j)]) return 0;
  }
  return 1;
}

int calcCol(char *board,int h,int w){
  int flag[16];
  int i,j;
  for(i=0;i<w;i++) flag[i]=0;
  int useCenter=0;
  for(i=0;i<w;i++){
    if(flag[i]) continue;
    for(j=i+1;j<w;j++){
      if(flag[j]) continue;
      if(func(i,j,board,h,w)){
		flag[i]=1;
		flag[j]=1;
		break;
      }
    }
    if(!flag[i]){
      if(w%2==0 || useCenter) return 0;
      for(j=0;j<h-1-j;j++){
	if(board[POS(j,i)]!=board[POS(h-1-j,i)]) return 0;
      }
      useCenter=1;
      flag[i]=1;
    }
  }
  return 1;
}

void swapRow(int a,int b,char *board,int h,int w){
  int i;
  for(i=0;i<w;i++){
    char t=board[POS(a,i)];
    board[POS(a,i)]=board[POS(b,i)];
    board[POS(b,i)]=t;
  }
  return;
}

int loopRow(int d,char *board,int h,int w){
  if(d>=h-1-d) return calcCol(board,h,w);
  int i;
  for(i=d+1;i<h-d;i++){
    if(h%2==1 && i==h/2) continue;
    swapRow(i,h-1-d,board,h,w);
    if(loopRow(d+1,board,h,w)) return 1;
    swapRow(i,h-1-d,board,h,w);
  }
  return 0;
}

int calc(char *board,int h,int w){
  if(h%2==0) return loopRow(0,board,h,w);
  int center=h/2;
  int i;
  for(i=0;i<h;i++){
    swapRow(i,center,board,h,w);
    if(loopRow(0,board,h,w)) return 1;
    swapRow(i,center,board,h,w);
  }
  return 0;
}

int main(void){
  int h,w;
  scanf("%d%d",&h,&w);
  char *board=(char *)malloc(sizeof(char)*(h*w+1));
  int i;
  for(i=0;i<h;i++) scanf("%s",board+POS(i,0));
  printf("%s\n",calc(board,h,w)?"YES":"NO");
  free(board);
  return 0;
}


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,ans=0,tmp=0; cin>>n;
    string s=to_string(n);
    ans = 9*(s.size()-1) + s[0]-'1';
    rep(i,s.size()){
        tmp += s[i]-'0';
    }
    cout << max(ans,tmp) << endl;
    return 0;
}

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

int main()
{
  ll n, x, y; cin >> n >> x >> y;
  
  vector<ll> ans(n);
  for (int i=1; i<=n; i++) {
    for (int j=i+1; j<=n; j++) {
      ll dist = j-i;
      dist = min(dist, abs(x-i)+1+abs(y-j));
      ans[dist]++;
    }
  }
  for (int i=1; i<n; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}


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

using namespace std;

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

const int MAX = 500000;
Node *root;

void insert(int num)
{
    Node *newNode = (Node *)malloc(sizeof(Node));

    newNode->key = num;
    newNode->left = newNode->right = NULL;

    Node *targetParent = NULL;
    for (Node *x = root; x != NULL; )
    {
        targetParent = x;
        x = (newNode->key < x->key) ? x->left : x->right;
    }

    newNode->parent = targetParent;
    // データがまだない場合は、今回作成したノードを根にする
    if (targetParent == NULL)
        root = newNode;
    else
    {
        if (newNode->key < targetParent->key)
            targetParent->left = newNode;
        else
            targetParent->right = newNode;
    }
}

void inorder(Node *u)
{
    if (u == NULL) return;
    inorder(u->left);
    cout << " " << (u->key);
    inorder(u->right);
}
void preorder(Node *u)
{
    if (u == NULL) return;
    cout << " " << (u->key);
    preorder(u->left);
    preorder(u->right);
}

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

    // init nodes

    int n;
    cin >> n;
    cin.ignore();

    for (int i = 0; i < n; i++)
    {
        string line;
        getline(cin, line); // 改行が現れるまで読む。改行はスキップ

        const string TARGET("insert ");

        if (line.find(TARGET) != string::npos)
        {
            int num =  std::atoi(line.substr(TARGET.size()).c_str());
            insert(num);
        }
        else
        {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 26536
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		long[] a = new long[N];
		for(int i=0;i<N;i++)a[i]=Long.parseLong(sc.next());
		Arrays.sort(a);

		HashMap<Long,Integer> map=new HashMap<>();
		
		for(int i=0;i<N;i++){
			if(map.containsKey(a[i])) {
				map.put(a[i],1+map.get(a[i]));
			}else {
				map.put(a[i],1);
			}
		}

		long res = 0;
		for(int i=N-1;i>=0;i--){
			if(map.get(a[i])==0) continue;
			map.put(a[i],map.get(a[i])-1);
			long diff=2*Long.highestOneBit(a[i])-a[i];
			if(map.containsKey(diff) && map.get(diff)>0){
				res++;
				map.put(diff,map.get(diff)-1);
			}
		}
		System.out.println(res);

	}

}

Measured memory_bytes: 79388
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
	
#define int long long
#define double long double 
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = "paintbarn"; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);

using namespace std;

const int INF = 4e18 + 10;
const int INF2 = 2e18 + 10;
const int INF3 = 2e10;
const int MAXN = 305;
const int LOGN = 19;
const int MOD = 1e9 + 7;
const int EPS = 1e-9;
const int MULT = 2e5;
const int MCNST = MOD * MOD * 8;

int32_t main() {
	FAST;

	int n;
	cin >> n;
	int sq = 1;
	for (int i = 1; i <= n; i++) {
		while (i >= (sq + 1)*(sq + 1)) sq++;
		int cnt = 0;
		
		for (int x = 1; x <= sq; x++) {
			for (int y = 1; y <= sq; y++){
				if (x*x + y*y + 1 + x*y + y + x > i) break;
				for (int z = 1; z <= sq; z++) {
					int t = x*x + y*y + z*z + x*y + y*z + x*z;
					if (t == i) cnt++;
					if (t >= i) break;
				}
			}
		}
		cout << cnt << '\n';
	}
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
template <class T1, class T2>void print(T1 a[], T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " ";} cout << endl;}
template <class T1, class T2>void print(vector<T1> a, T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " "; } cout << endl;}
ll modexpo(ll a, ll b, ll m) {if (b == 0) {return 1;} else if (a == 1) {return 1;} if (b % 2 == 0) {ll t = modexpo(a, b / 2, m); t = (t * t) % m; return t;} else {ll t = modexpo(a, b / 2, m); t = (t * t) % m; t = (t * a) % m; return t;}}

ll dp[100001][101];

ll fn(ll wt, ll n, ll w[], ll v[] ) {
	if (n == 0 || wt == 0) {
		return 0;
	}
	if (dp[wt][n] != -1) {
		return dp[wt][n];
	}

	ll op1 = fn(wt, n - 1, w, v);
	ll op2 = 0;
	if (wt >= w[n - 1]) {
		op2 = fn(wt - w[n - 1], n - 1, w, v) + v[n - 1];
	}

	ll ans = max(op1, op2);
	dp[wt][n] = ans;
	return ans;
}

int main() {

	// taskkill /IM "cp.exe" /F
	fast
      /*
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
*/


	ll n, wt;
	cin >> n >> wt;
	ll w[n], v[n];
	for (int i = 0; i < n; i++) {
		cin >> w[i] >> v[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << fn(wt, n, w, v);

}

Measured memory_bytes: 79232
// 最小全域木(minimum spaninng tree)
//
// AOJ GRL 2 A Minimum Spanning Tree
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A&lang=ja

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class UnionFind {
public:
    vector<int> d;
    
    UnionFind(int n = 0) : d(n, -1) {}

    int find(int x) {
        if(d[x] < 0){
            return x;
        }
        return d[x] = find(d[x]); // メモ化再帰
    }
    
    bool unite(int x, int y) {
        x = find(x); 
        y = find(y);
        if(x == y){
            return false;
        }
        if(size(x) < size(y)){
            swap(x,y);
        } 
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    
    bool same(int x, int y) { 
        return find(x) == find(y);
    }
    
    int size(int x) { 
        return -d[find(x)];
    }
};

class Edge {
public:
    int from, to;
    int cost;

    Edge(int from, int to, int cost)
        : from(from), to(to), cost(cost) {}
    
    // コストの大小で順序定義
    bool operator<(const Edge& o) const {
        return cost < o.cost;
    }
};

// クラスカル法で無向最小全域木のコストの和を計算する
// グラフが非連結のときは最小全域森のコストの和となる
int kruskal(vector<Edge>& edges, int n){
    // コストが小さい順にソート
    sort(edges.begin(), edges.end());

    UnionFind uf(n);
    int min_cost = 0;
    for(const Edge e : edges){
        if(!uf.same(e.from, e.to)){
            // 辺を追加しても閉路ができないなら、その辺を採用する
            min_cost += e.cost;
            uf.unite(e.from, e.to);
        }
    }
    return min_cost;
}

int main(){
    
	int v, e;
	cin >> v >> e;
    vector<Edge> edges;
	for(int i = 0; i < e; ++i){
		int s, t, w;
		cin >> s >> t >> w;
		edges.emplace_back(s, t, w);
		edges.emplace_back(t, s, w);
	}

    cout << kruskal(edges, v) << endl;
  return 0;
}


Measured memory_bytes: 5964
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    int N;
    string S;
    cin >> N >> S;
    int x = 0, maxX = 0;
    for (const char ch : S)
    {
        if (ch == 'I') ++x;
        else --x;

        if (maxX < x) maxX = x;
    }
    cout << maxX << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define int long long

using namespace std;

int a, b, c, d, n;

main ()
{
    cin >> a >> b >> c >> d >> n;
    b = min(a + a, b);
    c = min(b + b, c);
    d = min(c + c, d);
    if (n & 1)
        cout << n / 2 * d + c << endl;
    else
        cout << n / 2 * d << endl;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	x, _ := strconv.Atoi(input())
	n, _ := strconv.Atoi(input())
	p := map[int]bool{}
	for i := 0; i < n; i++ {
		v, _ := strconv.Atoi(input())
		p[v] = true
	}
	ans := 0
	diff := x
	for i := 1; i <= 101; i++ {
		if !p[i] {
			tmp := abs(x - i)
			if tmp < diff {
				ans = i
				diff = tmp
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1788
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int N, M;

vector<bool> visited;
vector<vector<bool>> G;

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

	visited.resize(N);

	G.resize(N);
	rep(i, N) G[i].resize(N, false);

	vector<pair<int, int>> E(M);

	rep(i, M)
	{
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		E[i].first = a;
		E[i].second = b;

		G[a][b] = G[b][a] = true;
	}

	ll count = 0;

	rep(i, M)
	{
		//橋を削除
		G[E[i].first][E[i].second] = G[E[i].second][E[i].first] = false;

		//探索フラグ初期化
		rep(j, N) visited[j] = false;

		
		queue<int> q;
		q.push(0);

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

			visited[v] = true;

			rep(i, N)
			{
				if (!G[i][v]) continue;
				if (visited[i]) continue;

				q.push(i);
			}
		}

		//探索フラグチェック
		rep(j, N)
		{
			if (!visited[j])
			{
				count++;
				break;
			}
		}

		//橋を戻す
		G[E[i].first][E[i].second] = G[E[i].second][E[i].first] = true;
	}

	cout << count << endl;

	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef map<int,int> mapii;
typedef map<int,bool> mapib;
typedef map<char,int> mapci;

#define small 1e-9
#define big5 1000000005
#define big7 1000000007
#define big 100000
#define large 200001
#define pi 3.1415926

#define inp(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define cum(arr,n,cumm) cumm[0]=0;for(int i=0;i<n;i++)cumm[i+1]=cumm[i]+arr[i];
#define bsdk ios_base::sync_with_stdio(false);cin.tie(NULL);
#define disp(arr) for(auto i:arr)cout<<i<<" ";cout<<"\n"
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define m1 cout<<"-1\n"
#define nl <<endl
#define hs cout<<"#"

#define fori(a, b, c) for (a = (b); (a) <= (c); ++(a))
#define ford(a, b, c) for (a = (b); (a) >= (c); --(a))
#define rep(i,n) fori(i,0,n-1)
#define rep1(i,n) fori(i,1,n-1)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define ub upper_bound
#define lb lower_bound
#define allv(v) v.begin(), v.end()
#define sorti(v) sort(allv(v))
/*bool isprime[big+1];
vector<int> primes;
void makesieve()
{
    ll i,j;
    rep(i,1000001)
        isprime[i]=false;
    isprime[2]=true;
    for(i=3;i<=big;i+=2)
        isprime[i]=true;
    for(i=3;i<=big;i+=2)
    {
        if(isprime[i])
            for(j=i*i;j<=big;j+=i)
            isprime[j]=false;
    }
    rep(i,big+1)
    {
        if(isprime[i])
            primes.pb(i);
    }
}
ll poww(ll n,ll m){
    if(m==0)return 1;
    if(m==1)return n;
    ll ans = poww(n,m/2);
    if(m%2==1) return (ans*ans)*n;
    else return (ans*ans);
}*/
void solve()
{
   int a,b;
   cin>>a>>b;
   cout<<a*b;
}
int main()
{
    bsdk
    int t;
    //cin>>t;
    t=1;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 3596
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = Integer.parseInt(sc.nextLine());
        String S = sc.nextLine();
        StringBuilder t = new StringBuilder();
        sc.close();

        if (!(r % 2 == 0)) {
            System.out.println("No");
        } else {
            for (int i = 0; i < r / 2; i++) {
                t.append(S.charAt(i));
                String sample = S.replaceFirst(t.toString(), "");
                sample = sample.replaceFirst(t.toString(), "");
                if (sample.equals("")) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");
        }
    }

}

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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    vector<int> P(N), Q(N);
    rep(i, N) {
        cin >> P[i];
        P[i]--;
        Q[P[i]] = i;
    }
    /*
    rep(i, N) cout << P[i];
    cout << endl;
    rep(i, N) cout << Q[i];
    cout << endl;
    */
    multiset<ll> st{0, 0, N + 1, N + 1};
    ll ans = 0;
    rep(i, N) {
        ll k = Q[N - 1 - i] + 1;
        st.insert(k);
        auto itr = st.find(k);
        //cout << *itr << endl;
        --itr;
        --itr;
        ll w = *itr;
        ++itr;
        ll x = *itr;
        ++itr;
        ++itr;
        ll y = *itr;
        ++itr;
        ll z = *itr;
        ans += ((x - w) * (y - k) + (k - x) * (z - y)) * (N - i);
    }
    cout << ans << endl;
}


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

int main(){
  int N;
  vector<int> L;
  cin >> N;
  for(int i=0; i<N; i++){
    int l; cin >> l;
    L.push_back(l);
  }
  sort(L.begin(), L.end(), greater<int>());
  long count=0;
  for(int i=0; i<L.size()-2; i++){
    for(int j=i+1; j<L.size()-1; j++){
      for(int k=j+1; k<L.size(); k++){
        if(L[i]<L[j]+L[k]) count++;
        else break;
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 384
function main(input) {
  const S = input.toString().match(/.{2}/g).map(n => parseInt(n, 10));

  if (S[0] <= 12 && S[1] <= 12 && S[0] > 0 && S[1] > 0) {
    console.log('AMBIGUOUS');
  }
  else if (S[0] <= 12 && S[0] > 0) {
    console.log('MMYY');
  }
  else if (S[1] <= 12 && S[1] > 0) {
    console.log('YYMM');
  }
  else console.log('NA');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int     main() {
	vector<int> A(3);
	for (int i=0; i<3; i++) cin >>A.at(i);
	sort(A.begin(), A.end());
	cout << A.at(2)-A.at(0) <<endl;
	return 0;
};


Measured memory_bytes: 256
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <vector>
#include <algorithm>

typedef long long llong;
using namespace std;



int main() {
	int room[5][4][11] = { 0 };
	int b, f, r, v;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		room[b][f][r] += v;
	}

	for (int i = 1; i <= 4; i++) {
		for (int j = 1; j <= 3; j++) {
			for (int k = 1; k <= 10; k++) {
				cout << " " << room[i][j][k];
			}
			cout << endl;
		}
		if(i!=4)
		cout << "####################" << endl;
	}
	return 0;
}



Measured memory_bytes: 3132
#include <iostream>

int main()
{
    long X, Y;
    std::cin >> X >> Y;
    for (long i = 0; i <= X; i++) {
        if (Y == 2 * i + 4 * (X - i)) {
            std::cout << "Yes";
            return 0;
        }
    }
    std::cout << "No";
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
int a,ans,maxx=0;
int main() {
	for (int i=1; i<=5; i++) {
		cin >> a;
        int k = (ceil(a*1.0/10))*10;
        ans += k;
		if ( k-a > maxx ) maxx = k-a;
	}
	cout << ans-maxx << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            int k = cin.nextInt();
            List<int> h = new List<int>();
            for (int i = 0; i < n; i++)
            {
                h.Add(cin.nextInt());
            }

            int[] cost = new int[n];
            cost[0] = 0;
            cost[1] = Math.Abs(h[1] - h[0]);

            for (int i = 2; i < n; i++)
            {
                int x = cost[i - 1] + Math.Abs(h[i] - h[i - 1]);
                cost[i] = x;
                for (int j = 1; j < k; j++)
                {
                    if (i - j - 1 < 0)
                    {
                        break;
                    }
                    int y = cost[i - j - 1] + Math.Abs(h[i] - h[i - j - 1]);
                    cost[i] = Math.Min(cost[i], y);
                }
            }

            Console.WriteLine(cost[n - 1]);
        }


        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

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

int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    reverse(a.begin(),a.end());
    for (int i=0;i<n-1;i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}


Measured memory_bytes: 3080
n, a, b = map(int, input().split())
mod = 1000000007
def inv(y, mod):
    return pow(y, mod - 2, mod)
 
def comb(n, a, mod):
    x = 1
    y = 1
    for i in range(a):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    return (x * inv(y, mod)) % mod
    
print((pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod)

Measured memory_bytes: 38640
import java.util.Scanner;
 
class Main {
 
public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		// get a integer
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		
		int total = getAreaTriangle(num1,num2);
		
		System.out.println(total);
	}
	
	public static boolean isMaxNum(int num) {
		return num > 100 ? true : false;
	}
	
	
	public static int getAreaTriangle(int num1,int num2) {
		
		if(isMaxNum(num1) || isMaxNum(num2) ) {
			return 0;
		}
		
		return  (num2 * num1) / 2; 
	}
	
}

Measured memory_bytes: 23252
#include<stack>
#include<iostream>
using namespace std;
int main(){
	int n;
	stack < int > st;
	cin >> n;
	int cnt = 0;
	st.push(0);
	while(n--){
		int hoge;
		cin >> hoge;
		while(hoge < st.top()){
			st.pop();
			cnt++;
		}
		if(hoge != st.top()) st.push(hoge);
	}
	cout << cnt + st.size() - 1  << endl;
}

Measured memory_bytes: 1800
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

int n,b[101],a[101],ans;

void dfs(int x)
{
	if(x==n)
	{
		for(int i=1;i<=n;i++)
			if(abs(b[i]-a[i])>1)
				return;
		bool flag=false;
		for(int i=1;i<=n;i++)
			if(!(b[i]&1))
				flag=true;
		if(flag)
			ans++;
		return;
	}
	for(int i=a[x+1]-1;i<=a[x+1]+1;i++)
		b[x+1]=i,dfs(x+1);
}

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

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

using namespace std;

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

const int N = 2e5+10 , mod = 1e9+7;

vector <string> ans;

void go(int rem , string cur , int f){
   if(rem == 0){
      ans.push_back(cur);
      return;
   }
   for(int i = 0 ; i < f ; i++)
      go(rem - 1 , cur + char('a' + i) , f);
   go(rem - 1 , cur + char('a' + f) , f + 1);
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   go(n , "" , 0);
   sort(ans.begin() , ans.end());
   for(auto x : ans)
      cout << x << "\n";
   return 0;
}


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

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

int n;
vi h;

int count(int l, int r) {
  // printf("count hi=%d, l=%d, r=%d\n", hi, l, r);
  int ret = 0;
  if (l >= r) {
    return 0;
  }

  int min_h = INT_MAX;
  for (int i = l; i < r; i++) {
    min_h = min(min_h, h[i]);
  }

  if (min_h > 0) {
    for (int i = l; i < r; i++) {
      h[i] -= min_h;
    }
    ret += min_h;
  }

  int li = l;
  int ri = li;
  for (;;) {
    for (; li < r; li++) {
      if (h[li] > 0) {
        break;
      }
    }
    // printf("li=%d\n", li);

    ri = li;
    for (; ri < r; ri++) {
      if (h[ri] <= 0) {
        break;
      }
    }
    // printf("ri=%d\n", ri);

    if (li < ri) {
      ret += count(li, ri);
    }
    li = ri;
    if (li == r) {
      break;
    }
  }

  // printf("count hi=%d, l=%d, r=%d, ret=%d\n", hi, l, r, ret);

  return ret;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int h_tmp;
    cin >> h_tmp;
    h.push_back(h_tmp);
  }

  cout << count(0, n) << endl;
  return 0;
}


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

int main()
{
  string a, b;

  cin >> a >> b;
  int c = stoi(a+b);

  bool flag=false;
  for ( int i=1; i<1001; i++ ) {
    if ( i*i == c ) {
      flag=true;
      break;
    }
  }

  if ( flag ) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
 
int main(){
  int a,b,c;
  cin >> a >> b >> c;

  if(a+b+c > 21){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  int64_t sum = 0;
  for (int i = 0; i < (n - 1); i++) {
    if (a.at(i) <= a.at(i + 1)) {
      continue;
    }
    else {
      sum += (a.at(i) - a.at(i + 1));
      a.at(i + 1) = a.at(i);
    }
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 3996
// D - Line++
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int cnt[2000];

int main(){
	int N,X,Y; cin>>N>>X>>Y;
	X--,Y--;
	rp(i, 0, N){
		rp(j, i+1, N){
			int d1 = j-i;
			int d2 = abs(i-X) + abs(j-Y) + 1;
			int d3 = abs(i-Y) + abs(j-X) + 1;
			int d = min({d1, d2, d3}) - 1;
			cnt[d]++;
		}
	}
	rp(i, 0, N-1) cout<< cnt[i] <<endl;
}

Measured memory_bytes: 256
from sys import stdin
import sys
sys.setrecursionlimit(10000)

n = int(stdin.readline().rstrip())
flowers = [int(x) for x in stdin.readline().rstrip().split()]


def watering(s, count):
    index_fwd = 10 ** 9
    index_back = 0
    for k in range(len(s)):
        if s[k] > 0:
            index_fwd = k
            break
    if index_fwd == 10 ** 9:
        return count
    for l in range(index_fwd, len(s)):
        if s[l] == 0:
            break
        index_back = l
    for m in range(index_fwd, index_back + 1):
        s[m] -= 1
    count += 1
    return watering(s, count)


print(watering(flowers, 0))

Measured memory_bytes: 7156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (long long i = 0; i < N; i++)
using ll = long long;

void solve(long long H, long long W, std::vector<std::string> S) {
    vector<pair<ll, ll>> dir = {pair<ll, ll>(-1, -1), pair<ll, ll>(-1, 0), pair<ll, ll>(-1, 1), pair<ll, ll>(0, -1),
                                pair<ll, ll>(0, 1),   pair<ll, ll>(1, -1), pair<ll, ll>(1, 0),  pair<ll, ll>(1, 1)};
    rep(i, H) {
        rep(j, W) {
            if (S[i][j] == '.') {
                ll cnt = 0;
                rep(k, 8) {
                    ll tmpj = j + dir[k].second;
                    ll tmpi = i + dir[k].first;
                    if (tmpj >= 0 && tmpj < W && tmpi >= 0 && tmpi < H) {
                        if (S[tmpi][tmpj] == '#') {
                            cnt++;
                        }
                    }
                }
                cout << cnt;
            } else {
                cout << '#';
            }
        }
        cout << endl;
    }
}

int main() {
    long long H;
    scanf("%lld", &H);
    long long W;
    scanf("%lld", &W);
    std::vector<std::string> S(H);
    for (int i = 0; i < H; i++) {
        std::cin >> S[i];
    }
    solve(H, W, std::move(S));
    return 0;
}


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

int main()
{
    int N;
    string S;
    set<string> get_items;

    cin >> N;

    for(int i = 0; i < N; i++) {
        cin >> S;
        get_items.insert(S);
    }

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

    return 0;
}

Measured memory_bytes: 19204
h, w = map(int, input().split())

a = [input().rstrip() for _ in range(h)]
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
for r in range(h):
    for c in range(w):
        if a[r][c] == '.':
            for rp, cp in ((r - 1, c), (r, c - 1)):
                if not (rp < 0 or cp < 0):
                    dp[r][c] += dp[rp][cp]
print(dp[-1][-1] % (10 ** 9 + 7))


Measured memory_bytes: 157428
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> PDL;
typedef pair<LD, LD> PDD;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
void in(T& x) {
	cin >> x;
}

template<class T1,class T2>
void in(pair<T1, T2>& p) {
	in(p.first);
	in(p.second);
}

template<class T>
void in(vector<T>& v,LL st=-1,LL en=-1) {
	if (st == -1) {
		st = 0;
		en = v.size() - 1;
	}
	for (LL n = st; n <= en; n++) {
		in(v[n]);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, K;
	cin >> N >> K;
	VLL H(N);
	in(H);
	sort(H.begin(), H.end(), [](LL a, LL b) {
		return a < b;
	});
	LL sum = 0;
	for (LL n = 0; n < N - K; n++) {
		sum += H[n];
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 1792
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0


ans=0

n,m=LI()
a=str(n)*m
b=str(m)*n
if a>b:
    a=b
print(a)


Measured memory_bytes: 40812
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}    
ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}

ll vis[1000002] = {};


int main() {
    fast;
    ll k;
    cin >> k;
    if((k%2) == 0) {
        cout << -1 << endl;
        return 0;
    }
    ll curr = 0;
    
    ll f = 1;
    ll ct = 0;
    while(1) {
        curr = (curr*10 + 7)%k;
        if(vis[curr]) {
            f = 0;
            break;
        }
        vis[curr] = 1;
        ct++;
        if(curr == 0) break;
        
    }

    if(f) {
        cout << ct << endl;
    }
    else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 11424
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll N;
    cin >> N;
    pair<ll,ll> P[N];
    for(int i=0;i<N;i++){
        cin >> P[i].second >> P[i].first;
    }
    sort(P,P+N);
    reverse(P,P+N);

    ll time = P[0].first;
    for(int i=0;i<N;i++){
        if(time>P[i].first){
            time = P[i].first;
        }
        time = time - P[i].second;
        
        if(time<0){
            cout << "No" << endl;
            return 0;
        }

    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef long double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define cerr if(true)cerr

template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
    out << "(" << p.first << ", " << p.second << ")";
    return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print(const ContainerType<ValueType, Args...> &c)
{
    for (const auto &v : c)
        cout << v << ' ';
    cout << '\n';
}

void print() { cout << '\n'; }
template <typename T, typename... Args>
void print(T a, Args... args)
{
    cout << a << " ";
    print(args...);
}

lli llipower(lli x, lli y, lli p = LLONG_MAX)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}

//---------------------------------------------------------------------------------

int main()
{
    // int t,tt;
    // cin >> t;
    // tt=t;
    // while (t--)
    // {
    //     int n;
    //     cin>>n;
    //     vector<int> a(n);
    //     fori(n) cin>>a[i];
    //     vector<int> pref(n+1,0);
    //     int sumv=0;
    //     fori(n){
    //         sumv+=a[i];
    //         pref[i+1]=sumv;
    //     }
    //     vector<int> sqs;
    //     fori(10000){
    //         if(i*i<=10000099) sqs.pb(i*i);
    //     }
    //     int curr;
    //     int ans=0;
    //     for(int i=1;i<=n;i++){
    //         curr=pref[i];
    //         for(auto j:sqs){
    //             if(binarySearch(pref,0,n,pref[i]-j)!=-1 &&){
    //                 ans++;
    //                 cout<<i<<" "<<j<<endl;
    //             }
    //         }
    //     }

        
    //     cout<<"Case #"<<tt-t<<": "<<ans<<endl;
    // }
    string n;
    cin >> n;
    int a = n[n.size() - 1] - '0';
    if (a == 3)
        cout << "bon" << endl;
    else if (a == 0 || a == 1 || a == 6 || a == 8)
        cout << "pon" << endl;
    else
        cout << "hon" << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define freinput "input.txt","r",stdin
#define freoutput "output.txt","w",stdout
#define mp make_pair
#define fi first
#define sc second
#define pb push_back
#define ellapse printf("Time : %0.3lf\n",clock()*1.0/CLOCKS_PER_SEC);
typedef long long ll;
typedef unsigned long int uld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
struct comp {
       bool operator() (int a,int b) {
            return a>b;
       }
};

int main(){
//    #ifdef chris
//    freopen(freinput);
//    freopen(freoutput);
//    #endif // chris
//    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if ((a == 1 && b == 2) || (a == 2 && b == 1)){
        cout<<3<<endl;
    }
    else if((a == 1 && b == 3) || (a==3&&b==1)) {
        cout<<2<<endl;
    }
    else if((a == 2 && b == 3) || (a == 3 && b==2)){
        cout<<1<<endl;
    }
}


Measured memory_bytes: 256
from itertools import combinations_with_replacement
n,m,q=map(int,input().split())
a,b,c,d=[0]*q,[0]*q,[0]*q,[0]*q
for i in range(q):
    x,y,z,w=map(int,input().split())
    x-=1
    y-=1
    a[i],b[i],c[i],d[i]=x,y,z,w
ans=0
for v in combinations_with_replacement(range(1,m+1),n):
    res=0
    for i in range(q):
        if v[b[i]]-v[a[i]]==c[i]:
            res+=d[i]
    ans=max(ans,res)
print(ans)

Measured memory_bytes: 9120
#include<stdio.h>
#include<math.h>
#define FALSE 0
#define TRUE  1

int isPrime(int x)
{
  if (x <= 1) {
    return FALSE;
  }

  int end = sqrt(x);
  for(int i = 2; i <= end; i++) {
    if (x % i == 0)
      return FALSE;
  }
  return TRUE;
}

int main(void)
{
  int n, x, count;

  scanf("%d", &n);

  count = 0;
  for (int i=0; i<n; i++){
    scanf("%d", &x);
    if (isPrime(x) == TRUE)
      count++;
  }
  printf("%d\n", count);
  
  return 0;
}



Measured memory_bytes: 2036
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<string.h>
#include<map>

using namespace std;

#define ll long long 

ll mo = 1e9+7;

int main(){

    ll h,w;
    cin>>h>>w;
    char arr[h][w];

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>arr[i][j];
        }
    }

    ll dp[h][w];


    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1;i<w;i++) { 
        if(arr[0][i]=='.') dp[0][i] = 1; 
        else break;    
    }
    for(int i=1;i<h;i++){
        if(arr[i][0]=='.') dp[i][0] = 1;
        else break;
    }

    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(arr[i][j]=='.'){
                dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mo;
            } 
            else continue;
        }
    }

    cout<<dp[h-1][w-1];

    return 0;

}

Measured memory_bytes: 12388
n, m = map(int, input().split())
mod = 1e+9+7
dp = [0]*(n+1)
dp[0] = 1
isPass = [1]*(n+1)
for _ in range(m):
    a = int(input())
    isPass[a] = 0
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if isPass[j]:
            dp[j] += dp[i]
            dp[j] %= mod
print(int(dp[n]))

Measured memory_bytes: 6900
#include <bits/stdc++.h>
#define M 1000005
#define FI first
#define SE second
#define MP std::make_pair
#define PB push_back
typedef long long ll;
int n;
std::pair <int,int> S[M];
bool vis[M];
int read(){
	char c=getchar();int ans=0;
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') ans=ans*10+c-'0',c=getchar();
	return ans;
}
void Write(ll x){
	if (x<10) putchar(x^48);
	else Write(x/10),putchar((x%10)^48);
	return;
}
ll min(ll x,ll y){return x<y?x:y;}
bool check(){
	int flag1=0,flag2=0;
	for (int i=1;i<=n;i++)
		if (vis[i]&&vis[i+n]) return 1;
	for (int i=1;i<=n;i++)
		flag1|=vis[i],flag2|=vis[i+n];
	return flag1^flag2;
}
int main(){
	n=read();
	for (int i=1;i<=n;i++) S[i*2-1].FI=read(),S[i*2-1].SE=i,S[i*2].FI=read(),S[i*2].SE=i+n;
	std::sort(S+1,S+1+n*2);ll sum=0;
	for (int i=1;i<=n;i++) vis[S[i].SE]=1,sum+=S[i].FI;
	if (check()) return Write(sum),0;
	vis[S[n].SE]=0,vis[S[n+1].SE]=1;
	if (check()) return Write(sum-S[n].FI+S[n+1].FI),0;
	Write(min(sum-S[n-1].FI+S[n+1].FI,sum-S[n].FI+S[n+2].FI));
	return 0;
}


Measured memory_bytes: 5396
from collections import deque

n = int(input())
tree = {i:[] for i in range(1, n+1)}
for _ in range(n-1):
    u, v, w = map(int, input().split())
    tree[u].append((u, v, w))
    tree[v].append((v, u, w))

que = deque(tree[1])
dist = [-1]*(n+1)
dist[1] = 0
while len(que) > 0:
    u, v, w = que.popleft()
    dist[v] = dist[u]+w
    for un, vn, wn in tree[v]:
        if dist[vn] > 0:
            pass
        else:
            que.append((un, vn, wn))
            
for d in dist[1:]:
    print(0 if d%2 == 0 else 1)


Measured memory_bytes: 54024
#include <iostream>
#include <queue>
#include <map>
#include <climits>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int> NODE;
#define pos first
#define depth second

map< int,vector<int> > info;
int bfs(int s,int d){
	queue<NODE> Q;
	map<int,bool>done;
	
	Q.push( make_pair(s,0) );
	while( !Q.empty() ){
		/* queueツづ個静ヲツ督ェツづ個ノツーツドツづーツ訪ツ姪「ツ催渉づ敖づ可つオツづowツ陛渉青板づ可禿シツづェツ、ツキツδーツつゥツづァツ偲ヲツづィツ渉慊つュ */
		NODE now = Q.front();
		Q.pop();
		done[now.pos] = true;

		if(now.pos == d){
			return now.depth;
		}

		for(int i=0;i<info[now.pos].size();i++){
			if( !done[info[now.pos][i]] ){
				Q.push( make_pair(info[now.pos][i], now.depth+1) );
			}
		}
	}
	return INT_MAX;
}

int main(){
	int n,r,k,t,p,s,d,v;
	
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> r >> k;
		for(int j=0;j<k;j++){
			cin >> t;
			info[r].push_back(t);
		}
	}	
	
	cin >> p;
	for(int i=0;i<p;i++){
		cin >> s >> d >> v;
		 
		if(v > bfs(s,d) )cout << bfs(s,d)+1 << endl;
		else cout << "NA" << endl;
	}
}

Measured memory_bytes: 924