akhauriyash/Code-Regression huggingface dataset:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, K = map(int, readline().split())
    if A>=K:
        A -= K
    else:
        B = max(B-(K-A),0)
        A = 0
    print(A, B)



if __name__ == '__main__':
    main()


Measured memory_bytes: 9228
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int N, buff;
ll ans = 0;
int main(){
    cin >> N;

    rep(i,N){
        cin >> buff;
        buff--;
        ans += buff;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        // string a = Console.ReadLine();
        int[] a = Read.ints();
        Console.WriteLine(a[0]%3==0||a[1]%3==0||(a[1]+a[0])%3==0?"Possible":"Impossible");
    }
 
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a * b / gcd(a, b);
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
 
        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
 
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13268
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <queue>
#include <vector>

using namespace std;

template<class T> void gc(T &x)
{
    char c;
    int s = 0;
    x = 0;

    c = getchar_unlocked();

    if (c == '-') s = 1;
    else if ('0' <= c && c <= '9')  x = c - '0';

    while (true)
    {
        c = getchar_unlocked();

        if (c < '0' || c > '9') break;
        x = x * 10 + (c - '0');
    }

    if (s) x = -x;
}

struct edge
{
    // 頂点 最短時間
    int a;
    int cost;

    edge() {};
    edge(int a, int cost)
        : a(a), cost(cost) {}

    bool operator> (const edge &edge) const
    {
        return cost > edge.cost;
    }
};

// 道情報 行き 配列
vector< vector<edge> > goList;

// 所要時間 行き 配列
vector<int> goAry;

// 行ったことある、ない
vector<bool> gone;

void bfs(int start)
{
    queue<edge> que;

    // スタート地点をキューに入れる
    que.push(edge(start, 0));

    // 距離を0にする
    goAry[start] = 0;

    // 行ったことがある
    gone[start] = true;

    while (que.size())
    {
        edge q = que.front();
        que.pop();

        for (int i = 0; i < (signed)goList[q.a].size(); i++)
        {
            edge e = goList[q.a][i];

            // 行ったことがない
            if (gone[e.a] == false)
            {
                goAry[e.a] = goAry[q.a] + e.cost;
                // push 頂点 時間
                que.push(edge(e.a, goAry[e.a]));
                // 行ったことがある
                gone[e.a] = true;
            }
        }
    }
}

int main()
{
    const char *Fennec = "Fennec";
    const char *Snuke = "Snuke";

    int N;
    if (scanf("%d", &N) < 1) return 0;

    goList.resize(N);

    for (int i = 0; i < N - 1; i++)
    {
        int a, b;

        gc(a);

        gc(b);

        // 0-indexed
        a--;
        b--;

        goList[a].push_back(edge(b, 1));
        goList[b].push_back(edge(a, 1));
    }

    goAry.resize(N);
    gone.resize(N);

    for (int i = 0; i < N; i++)
    {
        // 初期化
        goAry[i] = 0;
        // 行ったことがない
        gone[i] = false;
    }

    // 幅優先探索 Breadth-First Search
    bfs(0);

    vector<int> tmp;
    copy(goAry.begin(), goAry.end(), back_inserter(tmp));

    for (int i = 0; i < N; i++)
    {
        // 初期化
        goAry[i] = 0;
        // 行ったことがない
        gone[i] = false;
    }

    bfs(N - 1);

    int first = 0;
    int second = 0;
    for (int i = 0; i < N; i++)
    {
        if (tmp[i] <= goAry[i]) first++;
        else second++;
    }

    printf("%s\n", first <= second ? Snuke : Fennec);
    return 0;
}


Measured memory_bytes: 7232
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char *argv[]){
  map<string,int> mp;
  string S;
  vector<string> sub;
  cin>>S;
  int K; cin>>K;
  int flag=-1;
  for(int i=0; i<S.size(); i++){
    for(int j=1; j<=K; j++){
      string t=S.substr(i,j);
      //cout<<t<<endl;
      if(mp.count(t)) continue;
      else{
	
	mp[t]=1;
	
	sub.push_back(t);
	
      }
    }
  }
  
  
  
  
  
  sort(sub.begin(),sub.end());
  cout<<sub[K-1]<<endl;
  //for(int i=0; i<K; i++) cout<<sub[i]<<endl;
}



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

void calc(int r, int d, int x){
    int x_now=x,x_next;
    for(int i=0;i<10;i++){
        x_next=r*x_now-d;
        cout<<x_next<<"\n";
        x_now=x_next;
    }
}

int main(void){
    int r,D,x;
    cin>>r>>D>>x;
    calc(r,D,x);
    return 0;
}


Measured memory_bytes: 256
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

class Point {
 public:
  double x, y;

  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }

  double abs() { return sqrt(norm()); }
  double norm() {return x * x + y * y; }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

};

typedef Point Vector;

double dot(Vector a, Vector b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
  return a.x * b.y - a.y * b.x;
}

struct Segment {
  Point p1, p2;
};

typedef Segment Line;

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(Point p0, Point p1, Point p2) {
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
  if (cross(a, b) < -EPS) return CLOCKWISE;
  if (dot(a, b) < -EPS) return ONLINE_BACK;
  if (a.norm() < b.norm()) return ONLINE_FRONT;
  return ON_SEGMENT;
}

int main() {
  Point p1, p2;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  int n;
  cin >> n;
  cout << fixed;
  for (int i = 0; i < n; i++) {
    Point p3;
    cin >> p3.x >> p3.y;
    switch (ccw(p1, p2, p3)) {
    case COUNTER_CLOCKWISE:
      cout << "COUNTER_CLOCKWISE" << endl;
      break;
    case CLOCKWISE:
      cout << "CLOCKWISE" << endl;
      break;
    case ONLINE_BACK:
      cout << "ONLINE_BACK" << endl;
      break;
    case ONLINE_FRONT:
      cout << "ONLINE_FRONT" << endl;
      break;
    default:
      cout << "ON_SEGMENT" << endl;
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 3232
MOD = 10**9+7
def resolve():
    N = int(input())
    A = list(map(lambda x: bin(int(x))[2:].zfill(60), input().split()))
    ans = 0
    for i in range(60):
        one_cnt = 0
        zero_cnt = 0
        for a in A:
            if a[i] == "1":
                one_cnt += 1
            else:
                zero_cnt += 1
        ans += (one_cnt*zero_cnt)*(2**(59-i))
        ans %= MOD
    print(ans)

    

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 74104
fun main(args: Array<String>) {
    val n = readInteger()
    val alist = readIntegerList().filter { it % 2 == 0 }
    for (a in alist) {
        if (a % 3 != 0 && a % 5 != 0) {
            println("DENIED")
            return
        }
    }

    println("APPROVED")
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 37904
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int zero = 0;
		int one = 0;
		for (char c : arr) {
			if (c == '0') {
				zero++;
			} else {
				one++;
			}
		}
		System.out.println(arr.length - (Math.max(zero, one) - Math.min(zero, one)));
	}
}


Measured memory_bytes: 27092
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

bool chk(char c){
	return c == 'A' || c == 'T' || c == 'G' || c == 'C';
}

int main(){
	
	string S;
	cin >> S;
	
	int N = S.length();
	int cnt = 0;
	int ma = 0;
	for(int i=0;i<N;i++){
		if(chk(S[i])){
			cnt++;
			ma = max(ma, cnt);
		} else {
			cnt = 0;
		}
	}
	
	cout << ma << endl;
	
	
	
    return 0;
}

Measured memory_bytes: 256
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    int N=int.Parse(Console.ReadLine());
      int ans=0;
    for (int i = 1; i <= N; i++) {
        if (i >= 10 && i <= 99) {
            continue;
        } else if (i >= 1000 && i <= 9999) {
            continue;
        } else if (i >= 100000 && i <= 999999) {
            continue;
        } 

        ans++;

    }
    Console.WriteLine(ans);
    }
  }

}

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


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

  int x;
  cin >> x;

  int y = x / 500;

  int z = (x - y * 500) / 5;

  cout << y * 1000 + z * 5 << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
    int ans=0;
    int t1=0;
    if(n<=2)ans=0;
    if(n>2){
        ans=n/3;
        t1=n%3;
           
        }
        cout<<ans;
    }

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

using ll = long long int;

const int MAX_H = (int)(1e2 + 5);
const int MAX_W = (int)(1e1 + 5);
const ll MOD = (int)(1e9 + 7);

int h, w, k;

ll dp[MAX_H][MAX_W];
ll cf[MAX_H][MAX_W][3];

int main(void) {
  // Here your code !
  scanf("%d %d %d\n", &h, &w, &k);

  if (w == 1) {
    printf("%lld\n", 1);
    return 0;
  }

  for (int i = 0; i < h; ++i) {
    for (int bit = 0; bit < (1 << w - 1); ++bit) {
      if ((bit & (bit << 1)) != 0) continue;

      if (bit & (1 << 1 - 1)) {
        cf[i][1][2] += 1;
      }
      else cf[i][1][1] += 1;

      for (int j = 2; j <= w - 1; ++j) {
        if (bit & (1 << j - 1)) {
          cf[i][j][2] += 1;
        }
        else if (bit & (1 << j - 1 - 1)) {
          cf[i][j][0] += 1;
        }
        else cf[i][j][1] += 1;
      }

      if (bit & (1 << w - 1 - 1)) {
        cf[i][w][0] += 1;
      }
      else cf[i][w][1] += 1;
    }
  }

  dp[0][1] = 1;

  for (int i = 0; i < h; ++i) {
    dp[i + 1][1 + 1] += (cf[i][1][2] * dp[i][1]) % MOD;
    dp[i + 1][1 + 1] %= MOD;
    dp[i + 1][1 + 0] += (cf[i][1][1] * dp[i][1]) % MOD;
    dp[i + 1][1 + 0] %= MOD;

    for (int j = 2; j <= w - 1; ++j) {
      dp[i + 1][j + 1] += (cf[i][j][2] * dp[i][j]) % MOD;
      dp[i + 1][j + 0] += (cf[i][j][1] * dp[i][j]) % MOD;
      dp[i + 1][j + -1] += (cf[i][j][0] * dp[i][j]) % MOD;

      dp[i + 1][j + 1] %= MOD;
      dp[i + 1][j + 0] %= MOD;
      dp[i + 1][j + -1] %= MOD;
    }

    dp[i + 1][w + 0] += (cf[i][w][1] * dp[i][w]) % MOD;
    dp[i + 1][w + 0] %= MOD;
    dp[i + 1][w + -1] += (cf[i][w][0] * dp[i][w]) % MOD;
    dp[i + 1][w + -1] %= MOD;
  }

  printf("%lld\n", dp[h][k]);

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define loop(i,a,b) for(int i=a; i<b; i++)
#define INF 10000000000099ll
#define mod 1000000007
#define prDouble(x) cout<<fixed<<setprecision(10)<<x

ll solve(vector<int>& v, int n, int k)
{
    ll dp[n+2][k+2];
    for(int i=0; i<=k; i++)
        dp[1][i]= (i>v[1]) ? 0 : 1;
    for(int i=2; i<=n; i++){
        for(int j=0; j<=k; j++){
            if(j==0)
                dp[i][j]= dp[i-1][j];
            else dp[i][j]= (mod + dp[i][j-1] + dp[i-1][j] - ((j-v[i]-1 >=0) ? dp[i-1][j-v[i]-1] : 0))%mod;
        }
    }
    return dp[n][k]%mod;
}

int main()
{
    FASTIO;
    int n,k;
    cin>>n>>k;
    vector<int> v(n+1);
    loop(i,1,n+1) cin>>v[i];
    cout<<solve(v, n, k);
    return 0;
}



Measured memory_bytes: 81628
n = int(input())
ls = list(map(int, input().split()))
menber = list(range(1, n+1))

dict1 = dict(zip(ls, menber))
dict1 = sorted(dict1.items(), key=lambda x: x[0])

for i in range(len(dict1)):
    print(dict1[i][1], end=' ')


Measured memory_bytes: 25564
import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
edges = [[] for i in range(200000)]
for i in range(n):
    x, y = map(int, input().split())
    edges[x - 1].append(y + 99999)
    edges[y + 99999].append(x - 1)
ans = 0
visited = [0] * (200000)
cntx, cnty = 0, 0
def dfs(u):
    global cntx, cnty
    visited[u] = 1
    if u // 100000 >= 1:
        cnty += 1
    else:
        cntx += 1
    for i in edges[u]:
        if visited[i] == 0:
            dfs(i)
ans = -1 * n
for i in range(100000):
    if visited[i] == 0:
        cntx, cnty = 0, 0
        dfs(i)
        ans += cntx * cnty
print(ans)

Measured memory_bytes: 86432
splitNotZero :: [Int] -> [[Int]]
splitNotZero [] = []
splitNotZero xs
  | null others = [notZeros]
  | otherwise   = ([notZeros] ++) $ splitNotZero $ tail others
  where (notZeros, others) = break (== 0) xs

solve :: [Int] -> Int
solve []  = 0
solve xs
  | min == 0  = sum $ map solve $ splitNotZero xs
  | otherwise = (+ min) $ solve $ map (subtract min) xs
  where min = minimum xs

main :: IO ()
main = do
  _ <- getLine
  heights <- map read . words <$> getLine
  print $ solve heights

Measured memory_bytes: 1020
c = [[int(i) for i in input().split()] for j in range(3)]

if c[0][1] - c[0][0] != c[1][1] - c[1][0] or c[0][1] - c[0][0] != c[2][1] - c[2][0]:
    print('No')
    exit()

if c[0][2] - c[0][0] != c[1][2] - c[1][0] or c[0][2] - c[0][0] != c[2][2] - c[2][0]:
    print('No')
    exit()
    
if c[0][2] - c[0][1] != c[1][2] - c[1][1] or c[0][2] - c[0][1] != c[2][2] - c[2][1]:
    print('No')
    exit()
    

if c[2][0] - c[1][0] != c[2][1] - c[1][1] or c[2][0] - c[1][0] != c[2][2] - c[1][2]:
    print('No')
    exit()
    
if c[2][0] - c[0][0] != c[2][1] - c[0][1] or c[2][0] - c[0][0] != c[2][2] - c[0][2]:
    print('No')
    exit()
    
if c[0][0] - c[1][0] != c[0][1] - c[1][1] or c[0][0] - c[1][0] != c[0][2] - c[1][2]:
    print('No')
    exit()

print('Yes')

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

using namespace std;
 
#define debug(s) cerr << #s << " = " << s << '\n'
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define ff first
#define ss second
typedef long long ll;

const int N = 200010;
int n, a[N], b[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i] >> b[i];
  int ml, mr;
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + n);
  int ans;
  if (n & 1) {
    ml = a[n/2 + 1], mr = b[n/2 + 1];
    ans = max(0, (int)(mr - ml + 1));
  }
  else {
    ml = (a[n/2] + a[n/2 + 1]);
    mr = (b[n/2] + b[n/2 + 1]);
    ans = max(0, (int)(mr - ml + 1));
  }
  cout << ans << '\n';
}

Measured memory_bytes: 5168
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin

int m;
int mult(int a, int b) {
	return a * (long long)(b) % m;
}

vector<vector<int>> graph;
vector<int> subtreeDP; // dp[v] = number of ways to color subtree of v such that v is black

void DFS(int v = 0, int p = -1) {
	subtreeDP[v] = 1;

	for(int u : graph[v])
		if(u != p) {
			DFS(u, v);
			subtreeDP[v] = mult(subtreeDP[v], subtreeDP[u] + 1);
		}
}

vector<int> upDP; // number of ways to color v & "up" of v (subgraph when going to parent)

void upDFS(int v = 0, int p = -1) {
	vector<int> sons;
	for(int u : graph[v])
		if(u != p)
			sons.emplace_back(u);
	int n = int(sons.size());

	vector<int> prefix(n), suffix(n);

	for(int i = 0; i < n; ++i) {
		prefix[i] = subtreeDP[sons[i]] + 1;
		if(i != 0)
			prefix[i] = mult(prefix[i], prefix[i - 1]);
	}
	for(int i = n - 1; i >= 0; --i) {
		suffix[i] = subtreeDP[sons[i]] + 1;
		if(i != n - 1)
			suffix[i] = mult(suffix[i], suffix[i + 1]);
	}
	for(int i = 0; i < n; ++i) {
		int u = sons[i];
		upDP[u] = upDP[v];
		if(i != 0)
			upDP[u] = mult(upDP[u], prefix[i - 1]);
		if(i != n - 1)
			upDP[u] = mult(upDP[u], suffix[i + 1]);
		upDP[u] = (upDP[u] + 1) % m;
		upDFS(u, v);
	}
}

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

	int n;
	cin >> n >> m;
	graph.resize(n);
	for(int edge = 0; edge < n - 1; ++edge) {
		int v, u;
		cin >> v >> u;
		--v, --u;
		graph[v].emplace_back(u);
		graph[u].emplace_back(v);
	}

	subtreeDP.resize(n);
	DFS();
	upDP.resize(n, 1);
	upDFS();

	for(int v = 0; v < n; ++v)
		cout << mult(subtreeDP[v], upDP[v]) << '\n';
}


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

int main()
{
	int paper[10][10] = {{0}};
	int vecx[] = {0, 1, 0, -1};
	int vecy[] = {-1, 0, 1, 0};
	
	int x, y, size;
	while( scanf("%d, %d, %d", &x, &y, &size) != EOF ){
		switch( size ){
			case 1:
				paper[x][y]++;
				for(int i=0;i<4;i++){
					int nx = x + vecx[i];
					int ny = y + vecy[i];
					
					if(nx >= 0 && nx < 10 && ny >=0 && ny <10){
						paper[nx][ny]++;
					}
				}
				break;
				
			case 2:
				for(int i=-1;i<=1;i++){
					for(int j=-1;j<=1;j++){
						int nx = x + i;
						int ny = y + j;
						
						if(nx >= 0 && nx <10 && ny >= 0 && ny <10){
							paper[nx][ny]++;
						}
						
					}
				}
				break;
				
			case 3:
				for(int i=-1;i<=1;i++){
					for(int j=-1;j<=1;j++){
						int nx = x + i;
						int ny = y + j;
						
						if(nx >= 0 && nx < 10 && ny >= 0 && ny < 10){
							paper[nx][ny]++;
						}
					}
				}
				for(int i=0;i<4;i++){
					int nx = x + vecx[i]*2;
					int ny = y + vecy[i]*2;
					
					if(nx >= 0 && nx < 10 && ny >= 0 && ny < 10){
						paper[nx][ny]++;
					}
				}
				break;
			}
		
	}
	
	int plain = 0, max_c = 0;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if( !paper[i][j]){
				plain++;
			}
			max_c = max( max_c, paper[i][j]);
		}
	}
	cout<<plain<<endl;
	cout<<max_c<<endl;
	
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
namespace rng {
    using namespace boost;
    using namespace boost::range;
    using namespace boost::adaptors;
}

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    ll ans = b / x - a / x;
    if (a % x == 0) ans += 1;
    cout << ans << nl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long
#define endl "\n"
signed main()
{
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		cout.tie(NULL);
		int n,k;
		cin>>n>>k;
		int ar[n];
		for(int i=0;i<n;++i)
				cin>>ar[i];
		long double ans=0;
		for(int i=0;i<k;++i)
				ans+=log2(ar[i]);
		long double pre=ans;
		for(int i=k;i<n;++i)
		{
				pre=ans;
				ans-=log2(ar[i-k]);
				ans+=log2(ar[i]);
				if(ans>pre)
						cout<<"Yes";
				else
						cout<<"No";
				cout<<endl;


		}
				 








		return 0;	
}


Measured memory_bytes: 5388
from collections import defaultdict
N = int(input())
B = [[0, 0] for i in range(N)]
D = [[[0, 0] for j in range(N)] for i in range(N)]
G = defaultdict(int)
for i in range(N):
  B[i] = [int(x) for x in input().split()]
B.sort()
for i in range(N):
  for j in range(i, N):
    if i == j:
      continue
    D[i][j] = [B[j][0] - B[i][0], B[j][1] - B[i][1]]
    D[j][i] = [-D[i][j][0], -D[i][j][1]]
for i in range(N):
  for j in range(i, N):
    if i == j:
      continue
    G[str(D[i][j])] += 1
ans = N
for p in G.keys():
  v = N - G[p]
  ans = min(ans, v)
print(ans)

Measured memory_bytes: 3948
#include <iostream>

using namespace std;
main(){
  int prime[100000];
  bool is_prime[1000001];
  int p=0;
  for(int i=0;i<=1000000;i++) is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<=1000000;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i;j<=1000000;j+=i) is_prime[j]=false;
    }
  }
  prime[p]=-1;
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    int ans=0;
    for(int i=0;i<1000000;i++){
      if(prime[i]==-1) break;
      if(prime[i]>n) break;
      int tmp=n-prime[i];
      if(tmp>=prime[i]){
	if(is_prime[n-prime[i]]) ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline void chmin(T &l,T r){l=min(l,r);}
template <typename T>inline void chmax(T &l,T r){l=max(l,r);}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
    
int main(){
    int a,b;
    cin>>a>>b;
    if(a>b)swap(a,b);
    a*=10;
    b*=10;
    int x=(a+b)/2;
    int y=(a+b+3600)/2;
    if(x-a<y-b){
        cout<<x/10;
        if(x%10)cout<<".5";
        cout<<endl;   
    }
    else{
        y%=3600;
        cout<<y/10;
       if(y%10)cout<<".5";
        cout<<endl;   

    }
    return 0;
}

Measured memory_bytes: 3200
from collections import defaultdict
N = int(input())
arr = list(map(int, input().split()))
puts = []
dd = defaultdict(int)

def make_divisors(n):
    divisors = []
    # Nの最大の約数は√N
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

for i in range(1,N+1)[::-1]:
    if N//2 < i and arr[i-1] == 1:
        puts.append(i)
        ds = make_divisors(i)
        for j in ds:
            dd[j] += 1
    else:
        # c = len([p for p in puts if p % i == 0])
        c = dd[i]
        if (c % 2 == 0 and arr[i-1] == 1) or (c % 2 == 1 and arr[i-1] == 0):
            puts.append(i)
            ds = make_divisors(i)
            for j in ds:
                dd[j] += 1

print(len(puts))
if len(puts):
    print(" ".join(map(str, sorted(puts, reverse=True))))


Measured memory_bytes: 118384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
#define pb=push_back
int INF=1e9+7;

int main() {
  int a;
  cin >> a;
  cout << a+a*a+a*a*a << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000003;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
    vector<int> dp(N,INF);
    dp[0]=0;
    rep(i,N){
        if (i+1<N) chmin(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
        if (i+2<N) chmin(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
i=0
x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
k2=0
while i<28 :
    x[i]=int(input())
    i=1+i
while k2<27 :
    k=0
    while k<27 :
        if x[k]>x[k+1] : 
            ex=x[k]
            x[k]=x[k+1]
            x[k+1]=ex
        k=k+1
    k2=k2+1
if x[0]==2 : print("1")
elif x[0]==3 : 
    print("1")
    print("2")
if x[27]==29 : print("30")
elif x[27]==28 : 
    print("29")
    print("30")
i=0
while i<27 :
    if x[i+1]-x[i]==2 :
        a=x[i]+1
        print(a)
    elif x[i+1]-x[i]==3 : 
        a=x[i]+1
        b=a+1
        print(a)
        print(b)
    i=1+i


Measured memory_bytes: 5608
N = int(input())
H = [int(a) for a in input().split()]

if (N == 1):
    print('Yes')
    exit()
hmax=H[0]
for i in range(N - 1):  
    if (hmax - H[i + 1]) > 1:
        print('No')
        exit()
    hmax = max(hmax, H[i + 1])
print('Yes')

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1000000007;

int main(void){
    string s; cin >> s;
    s = 'D' + s;
    ll dp[100005][4] = {};
    dp[0][0] = 1;

    for(int i=1; i<s.size(); i++){
        if(s[i] == 'A'){
            dp[i][0] = dp[i-1][0];
            dp[i][1] = (dp[i-1][1] + dp[i-1][0])%mod;
            dp[i][2] = dp[i-1][2];
            dp[i][3] = dp[i-1][3];
        }
        if(s[i] == 'B'){
            dp[i][0] = dp[i-1][0];
            dp[i][1] = dp[i-1][1];
            dp[i][2] = (dp[i-1][2] + dp[i-1][1])%mod;
            dp[i][3] = dp[i-1][3];
        }
        if(s[i] == 'C'){
            dp[i][0] = dp[i-1][0];
            dp[i][1] = dp[i-1][1];
            dp[i][2] = dp[i-1][2];
            dp[i][3] = (dp[i-1][3] + dp[i-1][2])%mod;
        }
        if(s[i] == '?'){ // 3をかけるのがミソ
            dp[i][0] = 3*dp[i-1][0]%mod;
            dp[i][1] = (3*dp[i-1][1] + dp[i-1][0])%mod;
            dp[i][2] = (3*dp[i-1][2] + dp[i-1][1])%mod;
            dp[i][3] = (3*dp[i-1][3] + dp[i-1][2])%mod;
        }
    }

    cout << dp[s.size()-1][3] << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    unsigned int n; cin >> n;
    unsigned int a; bool flg=true;
    for(;n>0;--n) {
        cin >> a;
        flg=flg&(a%2==0);
    }

    cout << (flg? "second": "first") << endl;

    return 0;
}


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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

long double x[2], y[2];

int main(){
	cin.tie(0);
	
	cin>>x[0]>>y[0]>>x[1]>>y[1];
	long double dx = x[1]-x[0], dy = y[1] - y[0];
	
	cout<<fixed<<setprecision(6)<<sqrt(dx*dx+dy*dy)<<endl;
	
	return 0;
}



Measured memory_bytes: 3284
mod = 998244353

def rec(n, p, m)
  if p == 0
    return 1
  elsif p % 2 == 0
    tmp = rec(n, p / 2, m)
    return tmp * tmp % m
  end
  n * rec(n, p - 1, m) % m
end

n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
if arr[0] != 0
  puts 0
  exit(0)
end
counts = Array.new(n, 0)
(0...n).each do |i|
  counts[arr[i]] += 1
end
while counts.last == 0
  counts.pop
end
prev = counts.shift
if prev != 1
  puts 0
  exit(0)
end
result = 1
counts.each do |i|
  result = (result * rec(prev, i, mod)) % mod
  prev = i
end
puts result

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> x(N + 1), s(N + 1);
    rep(i, N) {
        x[i + 1] = x[i] ^ A[i];
        s[i + 1] = s[i] + A[i];
    }

    ll ans = 0;
    rep(i, N) {
        int l = -1, r = i;
        while (r - l > 1) {
            ll mid = (l + r) / 2;
            ll X = x[i + 1] ^ x[mid];
            ll S = s[i + 1] - s[mid];
            if (X == S) r = mid;
            else l = mid;
        }
        ans += i - r + 1;
    }

    cout << ans << endl;
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

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

ll lcm(ll a, ll b){
    return a * b / gcd(a,b);
}

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    string s;
    cin >> s;

    map<char,int> mp;
    for (int i = 0; i < 4; i++) {
        mp[s[i]]++;
    }

    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
        if (iter->second != 2) {
            cout << "No" << endl;
            return;
        }
    }

    cout << "Yes" << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

using namespace std;
using LLONG = long long;

const vector<int> ToBinary(LLONG n, int len = 0)
{
    vector<int> ret;
    while (n > 0)
    {
        ret.push_back(n % 2);
        n /= 2;
    }
    while (ret.size() < len)
    {
        ret.push_back(0);
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

int main()
{
    // Aiを２進数表示したときの各桁について0/1の数を数え
    // 数が多い側と逆の数をXのその桁の数にしていく
    int N;
    LLONG K;
    cin >> N >> K;
    vector<LLONG> As(N);
    for (auto &Ai : As) cin >> Ai;
    int len = ToBinary(max(*max_element(As.begin(), As.end()), K)).size();
    vector<vector<int>> biAs(N);
    for (int i = 0; i < N; ++i)
    {
        biAs[i] = ToBinary(As[i], len);
        len = max(len, static_cast<int>(biAs[i].size()));
    }
    // Asの各数ごとに各桁の0/1の数を数えておく
    vector<int> zeroNums(len, 0);
    for (const auto &biAi : biAs)
    {
        for (int i = 0; i < len; ++i)
        {
            if (biAi[i] == 0) ++zeroNums[i];
        }
    }
    // 上の桁から順にXの値を決めていく:O(log2(K))
    LLONG ans = 0;
    LLONG digit = (1LL << len) / 2;
    bool hasDecreased = false;
    const auto biK = ToBinary(K, len);
    for (int i = 0; i < len; ++i, digit /= 2)
    {
        bool isMoreZero = zeroNums[i] > (N - zeroNums[i]);
        int Ki = biK[i];
        if (Ki == 1)
        {
            if (isMoreZero)
            {
                // X(i) = 1 とし，Ai の 0 の数だけ f(X) が増える
                ans += digit * zeroNums[i];
            }
            else
            {
                // X(i) = 0 とし，Ai の 1 の数だけ f(X) が増える
                // さらに，K が 1 のところを 0 に変えるので以降は X < K となる
                ans += digit * (N - zeroNums[i]);
                hasDecreased = true;
            }
        }
        else
        {
            if (isMoreZero)
            {
                // X(i) = 1 とし，Ai の 0 の数だけ f(X) が増える
                // ただし，K が 0 の桁なので，既に X < K のときのみ 0 -> 1 に変えられる
                if (hasDecreased) ans += digit * zeroNums[i];
                // 既に X < K でない場合は 0 -> 1 に増やせないので 0 のまま
                else ans += digit * (N - zeroNums[i]);
            }
            else
            {
                // X(i) = 0 とし，Ai の 1 の数だけ f(X) が増える
                ans += digit * (N - zeroNums[i]);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 20608
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
map<string,long long> str;
string sp;
long long int flag=0;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> sp;
		sort(sp.begin(),sp.end());
		if(str.count(sp)) flag+=str[sp];
		str[sp]++;
	}
	cout << flag<< endl;
} 

Measured memory_bytes: 11136
while True:
    H, W = map(int, input().split())
    if H==W==0:
        break
    else:
        for i in range(H):
            if i%2==0:
                for j in range(W):
                    if j % 2 == 0:
                        if j!=W-1:
                            print('#', end='')
                        else:
                            print('#')
                    elif j%2!=0:
                        if j!=W-1:
                            print('.', end='')
                        else:
                            print('.')
            else:
                for k in range(W):
                    if k % 2 == 0:
                        if k != W - 1:
                            print('.', end='')
                        else:
                            print('.')
                    elif k % 2 != 0:
                        if k != W - 1:
                            print('#', end='')
                        else:
                            print('#')
    print()



Measured memory_bytes: 7036
#include<bits/stdc++.h>
using namespace std;
int is_prime(int x)
{
    int i;
    if(x==2){
        return 1;
    }
    if(x%2==0){
        return 0;
    }
    for(i=3;i<=sqrt(x);i=i+2){
        if(x%i==0){
            return 0;
        }
    }
    return 1;
}
int main()
{
   int x;
   cin>>x;
   while(1){
    if(1==is_prime(x)){
        cout<<x<<endl;
        break;
    }
    else{
        x++;
    }
   }
   return 0;
}


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

int main()
{
    long long int n, k, m, p, minn;
    cin>>n>>k;
    m = n / k;
    minn = abs((n - m * k));
    p = n / k;
    p++;
    p = abs(n - p * k);
    if(p < minn)
        minn = p;
    cout<<minn;
    return 0;
}


Measured memory_bytes: 256
a,b,c,k = map(int,input().split())
s = k
d = k - a
k -= a
e = k - b
k -= b
f = k - c
n = 0 
if d == 0:
  print(a)
elif s < a:
  print(s)
elif e == 0 or e < 0:
  print(a)
elif f == 0 :
  print(a - c)
else:
  print(a - e)

  


Measured memory_bytes: 9152
//# pragma GCC optimize ("O2")
#include<iostream>
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<climits>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<iomanip>
#include<sstream>
#define out(i,a,now) for(int i=a.be[now],to=a.v[i];i;i=a.ne[i],to=a.v[i])
#define fo(i,a,b) for(i=a;i<=b;i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)
#define mp(a,b) make_pair(a,b)
#define qk(x) memset(x,0,sizeof(x))
#define RG register
#define gs(x) (tr[tr[x].f].son[1]==x)
#define lb(x) (x&(-x))
#define mid ((l+r)>>1)
#ifdef Mogician
#endif
using namespace std;
typedef long long LL;
typedef double DB;
template <class T> void cmax(T &a,T b)
{
    a=max(a,b);
}
template <class T> void cmin(T &a,T b)
{
    a=min(a,b);
}
template <class T> void swp(T &a,T &b)
{
	T temp=a; a=b; b=temp;
}
int main()
{
	LL a[3];
	scanf("%lld%lld%lld",&a[0],&a[1],&a[2]);
	sort(a,a+3);
	LL sum=2*a[2]-a[0]-a[1];
	if (sum&1) printf("%lld",sum/2+2);
	else printf("%lld",sum/2);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(in.readLine());
        int k=n%10;
        if(k==2 || k==4 || k==5 || k==7 || k==9)
            System.out.println("hon");
        else if(k==3)
            System.out.println("bon");
        else
            System.out.println("pon");
    }
}


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

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    string sa = "", sb = "";
    char ca = a + '0', cb = b + '0';
    for (int i = 0; i < a; i++) {
        sa += cb;
    }
    for (int i = 0; i < b; i++) {
        sb += ca;
    }
    if (sa > sb) swap(sa, sb);
    cout << sa << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){

  double r,pai,men,shu;

  pai = 3.14159265359;

  scanf("%lf",&r);

  men = r * r * pai;
  shu = 2 * r * pai;

  printf("%f %f\n",men,shu);

  return 0;
}

Measured memory_bytes: 648
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n, k; cin >> n >> k;
	vector<int> a(n), imos(n + 1);
	rep(i, n)
	{
		cin >> a[i];
		int l = max(0, i - a[i]), r = min(n - 1, i + a[i]);
		++imos[l];
		--imos[r + 1];
	}
	rep(i, n)imos[i + 1] += imos[i];
	a = imos;
	k = min(k - 1, 50);
	while (k--)
	{
		imos.assign(n + 1, 0);
		rep(i, n)
		{
			int l = max(0, i - a[i]), r = min(n - 1, i + a[i]);
			++imos[l];
			--imos[r + 1];
		}
		rep(i, n)imos[i + 1] += imos[i];
		a = imos;
	}
	rep(i, n)cout << imos[i] << endl;
}

Measured memory_bytes: 5624
#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      paulr
#
# Created:     30/04/2020
# Copyright:   (c) paulr 2020
# Licence:     <your licence>
#-------------------------------------------------------------------------------

n=int(input())
a=int(input())

N=n*n

ans=N-a

print(ans)

Measured memory_bytes: 2940
fn main() {
    let n: i32 = read();
    println!("{}", solve(n));
}

fn read<T: std::str::FromStr>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

fn solve(n: i32) -> i64 {
    let mut ans = 0;
    for i in 1..=n {
        for j in (i..=n).step_by(i as usize) {
            ans += j as i64
        }
    }

    ans
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_solve_1() {
        assert_eq!(23, solve(4));
    }

    #[test]
    fn test_solve_2() {
        assert_eq!(26879, solve(100));
    }

    #[test]
    fn test_solve_3() {
        assert_eq!(838627288460105, solve(10000000));
    }
}


Measured memory_bytes: 2100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var N = int.Parse(input[0]);
        var M = int.Parse(input[1]);
        var Q = int.Parse(input[2]);

        var a = new List<int>();
        var b = new List<int>();
        var c = new List<int>();
        var d = new List<int>();
        for (int i = 0; i < Q; i++)
        {
            var line = Console.ReadLine().Split(" ");
            a.Add(int.Parse(line[0]));
            b.Add(int.Parse(line[1]));
            c.Add(int.Parse(line[2]));
            d.Add(int.Parse(line[3]));
        }

        var comb = Combination<int>.Generate(Enumerable.Range(1, M).ToList(), N, true);

        var max = 0;
        foreach (var item in comb)
        {
            var sum = 0;
            for (int i = 0; i < Q; i++)
            {
                var num1 = item[b[i] - 1];
                var num2 = item[a[i] - 1];
                if (num1 - num2 == c[i]) sum += d[i];
            }

            max = Math.Max(sum, max);
        }

        Console.WriteLine(max);
    }

    static class Combination<T>
    {
        private static List<T> _input;
        private static List<List<T>> _comb;

        public static List<List<T>> Generate(List<T> input, int r, bool dupulication)
        {
            _input = new List<T>(input);
            _comb = new List<List<T>>();
            CalcCombination(new List<T>(), r, dupulication);
            return _comb;
        }

        private static void CalcCombination(List<T> list, int r, bool dupulication)
        {
            if (list.Count == r)
            {
                _comb.Add(new List<T>(list));
                return;
            }

            var size = _input.Count;
            var index = 0;
            if (dupulication)
            {
                index = list.Any() ? _input.IndexOf(list.Last()) : 0;
            }
            else
            {
                index = list.Any() ? _input.IndexOf(list.Last()) + 1 : 0;
            }
            for (int i = index; i < size; i++)
            {
                list.Add(_input[i]);
                CalcCombination(list, r, dupulication);
                list.Remove(_input[i]);
            }
        }
    }
}


Measured memory_bytes: 42448
s = []
gets.to_i.times do |i|
  s[i] = gets.chomp
  if i != 0 && s[i - 1][-1] != s[i][0]
    puts 'No'
    exit
  end
end

if s.length == s.uniq.length
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MX=3*1e5+100;
const long long INF = 1e18;
ll N, M, k;
ll a[MX], b[MX], c[MX];
ll canB[MX], prefB[MX];
ll w(int a, int b)
{
    if(a > b) return 0;
    if(!a) return prefB[b];
    return prefB[b]-prefB[a-1];
}
int main()
{
    scanf("%d",&N);
    for(int i=0; i<N; i++) scanf("%d", &a[i]);
    for(int i=0; i<N; i++) scanf("%d", &b[i]);
    for(int i=0; i<N; i++) scanf("%d", &c[i]);
    sort(a, a+N);
    sort(b, b+N);
    sort(c, c+N);

    int j=0, k=0;
    ll ans=0;
    for(int i=0; i<N; i++)
    {
        int it=upper_bound(c, c+N, b[i])-c;
        ///    cout<<it<<"\n";
        if(it != N)
            canB[i]=N-it;
        else canB[i]=0;
        ///  cout<<canB[i]<<" ";
        if(i)
            prefB[i]+=prefB[i-1];
        prefB[i]+=canB[i];
    }

    for(int i=0; i<N; i++)
    {
        int it=upper_bound(b, b+N, a[i])-b;
        ans+=w(it, N-1);
    }
    cout<<ans;
}


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

int main() {
    int X, A, B;
    cin >> X >> A >> B;
    cout << (X-A)%B << endl;
    return 0;
}


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

int main(){
		int n;scanf("%d",&n);
		char str[n];
		scanf("%s",str);
		int count=0;
		for(int i=0;i<=n-1-2;i++){
				if(str[i]=='A' && str[i+1]=='B' && str[i+2]=='C')count++;
			}
		printf("%d",count);	
	}


Measured memory_bytes: 1728