akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
typedef long long ll;
using namespace std;
int main(){
    int n; 
    cin>>n;
    vector<ll>inp(n);
    ll rst=1;;
    for(int i=0;i<n;i++){
        cin>>inp[i];
        if(inp[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    for(int i=0; i<n; i++){
        if(inp[i]<=1000000000000000000/rst)rst*=inp[i];
        else{ 
        cout<<-1<<endl;
        return 0;
        }
    }
        cout<<rst<<endl; 
        return 0;
}


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

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


signed main(){
    string s;
    vector<string> t{
        "SUN",
        "MON",
        "TUE",
        "WED",
        "THU",
        "FRI",
        "SAT"
    };
    cin >> s;
    cout << -1 * distance(t.end(), find(t.begin(), t.end(), s)) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    h, w, k = LI()
    s = SR(h)
    bit_length = [0] 
    for i in range((h-1)): 
        bit_length += [x + 1 for x in bit_length]
    ans = inf
    for i in range(1 << (h - 1)):
        tmp = [0] * (bit_length[i] + 1)
        num = 0
        for x in range(w):
            t = 0
            f = 0
            tmp1 = [0] * (bit_length[i]+1)
            for y in range(h):
                # print(t)
                tmp[t] += int(s[y][x])
                tmp1[t] += int(s[y][x])
                if tmp[t] > k:
                    f = 1
                if tmp1[t] > k:
                    break
                t += 1 & (i >> y) 

            else:
                if f:
                    num += 1
                    # print(tmp)
                    tmp = tmp1[::1]
                continue
            break
        else:
            # print(tmp,tmp1,bin(i),num)
            ans = min(ans, bit_length[i] + num)
    print(ans)


        
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 43740
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

unsigned long xor128(){
    static unsigned long x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned long t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

class Dice
{
public:
    vector<int> pip; // 東南西北上下の目
    Dice(){
        int a[] = {5, 3, 2, 4, 1, 6};
        pip.resize(6);
        for(int i=0; i<6; ++i)
            pip[i] = a[i];
    }
    void roll(int d){ // 東南西北右左に回転
        int dir[][4] = {{4,2,5,0},{4,3,5,1},{4,0,5,2},{4,1,5,3},{0,3,2,1},{0,1,2,3}};
        int tmp = pip[dir[d][0]];
        for(int i=0; i<3; ++i)
            pip[dir[d][i]] = pip[dir[d][i+1]];
        pip[dir[d][3]] = tmp;
    }
    bool operator==(const Dice& d) const{
        return pip == d.pip;
    }
};

int dy[] = {0, 1, 0, -1};
int dx[] = {1, 0, -1, 0};

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<vector<int> > h(2*n+1, vector<int>(2*n+1, 0));
        vector<vector<int> > num(2*n+1, vector<int>(2*n+1, 0));

        for(int i=0; i<n; ++i){
            int t, f;
            cin >> t >> f;
            Dice d;
            while(d.pip[4] != t || d.pip[1] != f)
                d.roll(xor128() % 6);

            int y = n;
            int x = n;
            ++ h[y][x];
            for(;;){
                bool ng = true;
                for(int j=6; j>=4; --j){
                    int k = find(d.pip.begin(), d.pip.begin()+4, j) - d.pip.begin();
                    if(k == 4)
                        continue;
                    int y2 = y + dy[k];
                    int x2 = x + dx[k];
                    if(h[y2][x2] < h[y][x] - 1){
                        -- h[y][x];
                        ++ h[y2][x2];
                        y = y2;
                        x = x2;
                        d.roll(k);
                        ng = false;
                        break;
                    }
                }
                if(ng)
                    break;
            }

            num[y][x] = d.pip[4];
        }

        vector<int> ret(7, 0);
        for(int i=0; i<2*n+1; ++i){
            for(int j=0; j<2*n+1; ++j){
                ++ ret[num[i][j]];
            }
        }

        cout << ret[1];
        for(int i=2; i<=6; ++i)
            cout << ' ' << ret[i];
        cout << endl;
    }
}

Measured memory_bytes: 0
import java.util.*;
 
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        int cnt = 0;
        String str = "";


        String s1 = sc.next();
        char[] c1 = s1.toCharArray();
        char c;
        int[] test  = new int[1000];
        for( int k=0; k<s1.length(); k++){

                c = c1[k];
                test[c]++;
         
        }
        int flag = 0;
        for( int k=0; k<1000; k++){

                
                if(test[k] % 2 == 1) flag++;
         
        }
        


        if(flag==0)System.out.print("Yes");
        else    System.out.print("No");
        System.out.println();
    }

}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a%3!=0&&b%3!=0&&(a+b)%3!=0){
    cout << "Impossible" << endl;
  }else{
    cout << "Possible" << endl;
  }
}

Measured memory_bytes: 256
def examA():
    N, M = LI()
    ans = N*(N-1)//2 + M*(M-1)//2
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 5864
#include<iostream>

using namespace std;

long long int A[201];

int N;

bool Check() {
    for(int i = 1;i <= N;i++)
        if(A[i] % 2 == 1)
            return false;

    return true;
}

int main(void) {
    cin>>N;

    for(int i = 1;i <= N;i++) {
        cin>>A[i];
    }

    int sum = 0;
    while(Check()) {
        sum++;
        for(int i = 1;i <= N;i++)
            A[i] /= 2;
    }

    cout<<sum<<endl;

    return 0;
}


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

int main() {
	// your code goes here
	int n;
	cin>>n;
	long long int arr[n];
	long long int a[n];
	long long sum=0;
	long long prev=0;
	long long int ans=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		sum=sum+arr[i];
	}
for(int i=0;i<n-1;i++){
	a[i]=(1000000007 +sum%1000000007-arr[i]%1000000007)%1000000007;
	sum=a[i];
}
	for(int i=0;i<n-1;i++){
		ans=(ans%1000000007 + (arr[i]%1000000007 *(a[i])%1000000007)%1000000007)%1000000007;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6744
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
char str[55];

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

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int a,b;
  cin >> a >> b;
  if(a+b < 10)
    cout << a+b << endl;
  else
    cout << "error" << endl;
  return 0;
}


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

int main() {
  int N,K,X,Y,sum;
  cin >> N;
  cin >> K;
  cin >> X;
  cin >> Y;
  if(N>K){
   sum = K*X + (N-K)*Y;
  }
  else{
   sum = N*X;
  }
  cout << sum << endl;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		int count = 0;
		while (true) {
			line = br.readLine().trim();
			if (line.equals("0"))
				break;
			count++;

			int W = Integer.parseInt(line);
			int N = Integer.parseInt(br.readLine().trim());
			int[] v = new int[N];
			int[] w = new int[N];
 			for (int i = 0; i < N; i++) {
				line = br.readLine();
				String[] splited = line.trim().split(",");
				v[i] = Integer.parseInt(splited[0]);
				w[i] = Integer.parseInt(splited[1]);
			}
			
			searchBestChoice(v, w, N, W, count);
		}
	}

	private static void searchBestChoice(final int[] v,final int[] w, final int N, final int weight, int count) {
		int[] dp = new int[weight + 1];
		Arrays.fill(dp, -1);
		dp[0] = 0;
		/* 価値の総和の最大値を動的計画法で求める ナップサック問題 */
		for(int i = 0; i < N; i++) {
			for(int j = weight; j >= w[i]; j--) {
				if( dp[j - w[i]] >= 0 && dp[j] < dp[j - w[i]] + v[i]) {
					dp[j] = dp[j - w[i]] + v[i];
				}
			}
		}
		
		int maxValue = 0;
		int maxWeight = 0;
		
		for(int i = 1; i <= weight; i++ ) {
			if(maxValue < dp[i]) {
				maxValue = dp[i];
				maxWeight = i;
			}
		}
		System.out.println("Case " + count + ":");
		System.out.println(maxValue);
		System.out.println(maxWeight);
	}
}

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

using namespace std;

int main()
{
    int N, L;
    cin >> N >> L;
    vector<string> vec(N);

    for (int i = 0; i < N; i++) {
        cin >> vec[i];
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < N; i++) {
        cout << vec[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    map<int,int>m;
    m[1]=1,m[2]=3,m[3]=1,m[4]=2,m[5]=1,m[6]=2,m[7]=1,m[8]=1,m[9]=2,m[10]=1,m[11]=2,m[12]=1;
    int x,y;
    cin>>x>>y;
    if (m[x]==m[y])
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

vector<lli> G[100001]; // G[i]: node i から張られる辺の向き先が配列になっている
lli d[100001][3];
lli n;

void dijkstra(lli start) {
    REPE(i, 1, n) {
        REP(j, 0, 3) {
            d[i][j] = LLONG_MAX;
        }
    }
    d[start][0] = 0;

    // first がその時点での最短経路のコスト、second が頂点の番号とindex
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, make_pair(start, 0)));

    while (!que.empty()) {
        P p = que.top();
        que.pop();

        lli cur_v = p.second.first;
        lli cur_index = p.second.second;
        lli next_index = (cur_index + 1) % 3;
        // もっと短い経路が既に登録されていたら、このpopしたやつは無視してよい
        if (d[cur_v][cur_index] < p.first) {
            continue;
        }
        // cur_v の辺を周って、更新しつつ queue に push していく
        REP(i, 0, (lli)G[cur_v].size()) {
            lli to = G[cur_v][i];
            if (d[to][next_index] > d[cur_v][cur_index] + 1) {
                d[to][next_index] = d[cur_v][cur_index] + 1;
                que.push(P(d[to][next_index], make_pair(to, next_index)));
            }
        }
    }
}

int main() {
    lli m;
    cin >> n >> m;
    REP(i, 0, m) {
        lli u, v;
        cin >> u >> v;
        G[u].push_back(v);
    }
    lli s, t;
    cin >> s >> t;

    dijkstra(s);
    if (d[t][0] == LLONG_MAX)
        cout << -1 << endl;
    else
        cout << d[t][0]/3 << endl;
    //cout << "----- 最短距離 -----" << endl;
    //REPE(i, 1, n) {
    //    cout << "d[" << i << "]: " << d[i] << endl;
    //}
    //// 1〜n それぞれの経路を出力
    //cout << "----- 最短経路とその距離 -----" << endl;
    //REPE(i, 1, n) {
    //    lli cur = i;
    //    cout << i << " -> ";
    //    while(true) {
    //        cur = prev_v[cur];
    //        if (cur == start) {
    //            cout << start << " (" << d[i] << ")" << endl;
    //            break;
    //        }
    //        cout << cur << " -> ";
    //    }
    //}
}



Measured memory_bytes: 8384
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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(){
    int H, W, N, sr, sc;
    cin >> H >> W >> N >> sr >> sc;

    string S, T;
    cin >> S >> T;

    int r = sc;
    // 右から出る
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            r++;
        }
        if (r > W) {
            // cout << "migi" << endl;
            cout << "NO" << endl;
            return;
        }
        if (T[i] == 'L') {
            if (r > 1) {
                r--;
            }
        }
    }

    // 左から出る
    int l = sc;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'L') {
            l--;
        }
        if (l < 1) {
            // cout << "hidari" << endl;
            cout << "NO" << endl;
            return;
        }
        if (T[i] == 'R') {
            if (l < W) {
                l++;
            }
        }
    }

    // 上から出る
    int u = sr;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'U') {
            u--;
        }
        if (u < 1) {
            // cout << "ue" << endl;
            cout << "NO" << endl;
            return;
        }
        if (T[i] == 'D') {
            if (u < H) {
                u++;
            }
        }
    }


    // 下から出る
    int d = sr;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'D') {
            d++;
        }
        if (d > H) {
            // cout << "shita" << endl;
            cout << "NO" << endl;
            return;
        }
        if (T[i] == 'U') {
            if (d > 1) {
                d--;
            }
        }
    }

    cout << "YES" << endl;

    return;
}

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


Measured memory_bytes: 776
n=int(input())
a=list(map(int,input().split()))
s=sum(a)-1
ans,x=0,1

for i in range(n):
  if a[i]>x-1:
    print(-1)
    exit()
  ans+=x
  x-=a[i]
  if i<n-1 and x<=0:
    print(-1)
    exit()
  if s>=0:
    if s>=x:
      s-=x
      x=x*2
    else:
      x=(x-s)+s*2
      s=0
if x!=a[-1] or x<=0:
  print(-1)
  exit()
ans+=x
print(ans)

Measured memory_bytes: 20136
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// ÉÏ ×ó ÏÂ ÓÒ
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
string s,t,fail;
int main(){
	fail="UNRESTORABLE";
	cin>>s>>t;
	for(int i=s.size()-t.size();i>=0;i--)
	{
		bool ok=true;
		for(int j=i;j<=i+t.size()-1;j++)
		{
			if(s[j]=='?')
				continue;
			ok&=(s[j]==t[j-i]);
		}
		if(ok)
		{
			for(int j=i;j<=i+t.size()-1;j++)
				s[j]=t[j-i];
			for(int j=0;j<s.size();j++)
				if(s[j]=='?')
					s[j]='a';
			cout<<s;
			return 0;
		}
	}
	cout<<fail;
	return 0;
}


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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,m,q;
    cin >> n >> m >> q;
    vector<vector<int>> s(n,vector<int>(m));
    for (int i = 0;i < n;++i) {
        char c;
        scanf("%c",&c);
        for (int j = 0;j < m;++j) {
            scanf("%c",&c);
            s[i][j] = c-'0';
        }
    }
    vector<vector<int>> a(n+1,vector<int>(m+1,0)),b(n+1,vector<int>(m+1,0)),c(n+1,vector<int>(m+1,0));
    for (int i = 1;i < n;++i) for (int j = 0;j < m;++j) if (s[i-1][j] && s[i][j]) a[i+1][j+1]++;
    for (int i = 0;i < n;++i) for (int j = 1;j < m;++j) if (s[i][j-1] && s[i][j]) b[i+1][j+1]++;
    for (int i = 0;i < n;++i) for (int j = 0;j < m;++j) if (s[i][j]) c[i+1][j+1]++;
    for (int i = 0;i < n;++i) for (int j = 0;j < m;++j) {
        a[i+1][j+1] += a[i][j+1];
        b[i+1][j+1] += b[i][j+1];
        c[i+1][j+1] += c[i][j+1];
    }
    for (int i = 0;i < n;++i) for (int j = 0;j < m;++j) {
        a[i+1][j+1] += a[i+1][j];
        b[i+1][j+1] += b[i+1][j];
        c[i+1][j+1] += c[i+1][j];
    }
    for (int i = 0;i < q;++i) {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        int ans = c[x2][y2]+c[x1-1][y1-1]-c[x2][y1-1]-c[x1-1][y2];
        ans -= a[x2][y2]+a[x1][y1-1]-a[x2][y1-1]-a[x1][y2];
        ans -= b[x2][y2]+b[x1-1][y1]-b[x2][y1]-b[x1-1][y2];
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 64640
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d;
int gcd(int x,int y){
	if(y==0)return x;
	return gcd(y,x%y);
}
int main(){
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	long long ans=b-a+1;
	ans-=b/c-(a-1)/c;
	ans-=b/d-(a-1)/d;
	int w=gcd(c,d);long long x=1ll*c/w*d;
	ans+=b/x-(a-1)/x;
	printf("%lld",ans);
}

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


using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;
	n = n % 10;
	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
		cout << "hon" << endl;
	else if (n == 3)
		cout << "bon" << endl;
	else
		cout << "pon" << endl;
}



Measured memory_bytes: 3648
#【註】N 個のボールと K 種類の整数
N, K = map(int, input().split())

#【註】ボールに書かれている数 A_1...A_N
A = list(map(int, input().split()))

#【註】何種類あるか？を set で取得
C = list(set(A))

# 数字の種類数
B = len(C) 
# 元々の種類と目的の種類の差
x = B - K

#-----
#【註】「文字：回数」という辞書を使って、ループを最小限にします。
d = {}

#【解説】A のそれぞれの要素について
for i in A:
    #【解説】もし辞書に既に登録されていれば、その値（出現回数）に 1 を足す
    if i in d:
        d[i] += 1
    #【解説】そうでなければ、辞書にキーを登録して値（出現回数）を 1 にする
    else:
        d[i] = 1

#【解説】辞書を値でソートすると、出現回数が小さい順に並ぶ
d = sorted(d.items(), key=lambda x:x[1])

ans = 0
count = 0

if x<=0:
    print('0')
else:
    #【解説】辞書からキーと値を取り出し
    for key, value in d:
        #【解説】取り出した玉の数に value を足す
        ans = ans + value
        #【解説】何種類取り出したか、の値に 1 を足す
        count = count + 1

        #【解説】もし x 種類取り出しが完了したら ans を出力
        if count == x:
            print(ans)
            break

Measured memory_bytes: 49716
#include<stdio.h>
#define N 44

int main(void){
  int n, i;
  int fib[N];

  scanf("%d",&n);

  for(i=0;i<=n;i++){

    if(i==0 || i==1) fib[i] = 1;

    else if(i>=2) fib[i] = fib[i-1] + fib[i-2];

  }

  printf("%d\n",fib[n]);

return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll n, m; cin >> n >> m;
  vll x(m); rep(i, m) cin >> x[i];
  sort(all(x));
  if(m == 1||n - m >=  0) fin(0);
  vll sa(m - 1);
  rep(i, m - 1)
  {
    sa[i] = x[i + 1] - x[i];
  }
  sort(all(sa));
  rep(i, n - 1)
  {
    sa.pop_back();
  }
  ll ans = accumulate(all(sa), 0);
  fin(ans);
}

//前処理
int main()
{
  ifstream in("text.txt");
  cin.rdbuf(in.rdbuf());
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;

const int maxn = 105;
const int maxw = 1e5+5;

int w[maxn], v[maxn];

int n, W;

ll dp[maxw];

int main()
{
	scanf("%d %d", &n, &W);
	for(int i = 1; i<= n; i++) scanf("%d %d", &w[i], &v[i]);
	for(int i = 1; i<= n; i++)
	{
		for(int j = W; j>= w[i]; j--)
		{
			dp[j] = max(dp[j], dp[j-w[i]]+v[i]);
		}
	}
	printf("%lld\n", dp[W]);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int k,sum=0;
int gcd(int a,int b)
{
    return b==0?a:gcd(b,a%b);
}
int main()
{
    cin>>k;
    sum=0;
    for(int i=1;i<=k;i++)
    {
        for(int j=1;j<=k;j++)
        {
            for(int l=1;l<=k;l++)
            {
                sum+=gcd(gcd(i,j),l);
            }
        }
    }
    cout<<sum<<endl;
}


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

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll INF=1e18+10;

int main()
{
    ll l,r;
    cin>>l>>r;
    ll rem=INF;
    ll n=min(r,l+2019);
    for(ll i=l;i<n;i++)
    {
        for(ll j=i+1;j<=n;j++)
            rem=min((i*j)%2019,rem);
    }
    cout<<rem;
}


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

ll gx(ll a){
  return a * (a+1) /2;
}

int main(){

  ll N;
  cin >> N;
  
  ll ans = 0;
  
  for(int i = 1; i <= N; i++){
    ans += gx(N/i) * i;
  }
  cout << ans <<endl;
  

}

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

int main() {
  string N;
  cin >> N;
  
  char a = N.at(N.size() - 1);
  if (a == '2' || a == '4' || a == '5' || a == '7' || a == '9') {
    cout << "hon" << endl;
  }
  else if (a == '0' || a == '1' || a == '6' || a == '8') {
    cout << "pon" << endl;
  }
  else if (a == '3') {
    cout << "bon" << endl;
  }
}

Measured memory_bytes: 3628
#include <cstdio>

int main() {
  int n;
  double sum = 0;

  scanf("%d\n", &n);
  for (int i = 0; i< n; i++) {
    int tmp;
    scanf("%d", &tmp);
    sum += 1.0 / tmp;
  }

  printf("%lf", 1.0 / sum);

  return 0;
}

Measured memory_bytes: 128
def main():
    a, b, c, x, y = map(int, input().split())
    res = 10**100
    for i in range(10**5+1):
        pizza_a = max(0, x-i) * a
        pizza_b = max(0, y-i) * b
        pizza_c = 2 * c * i
        cost = pizza_c + pizza_a + pizza_b
        res = min(res, cost)
    print(res)

if __name__ == "__main__":
    main()

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


class Program {

	static long mod = 1000000007;
	//static long mod =998244353;
	static int[] ans;
	static void Main(string[] args) {

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

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";


		int res = 0;


		int n = int.Parse(Console.ReadLine());
		if ( n % 2 == 0 ) { n--; }
		res = n / 2;
			Console.WriteLine(res);

		return;

	}


	//	int配列をスペース区切りの文字列に変換
	static string stringBuilderArrayInt(int[] a) {
		StringBuilder sb = new StringBuilder();

		for ( int i = 0; i < a.Length; i++ ) {
			sb.Append(a[i] + " "); 
		}
		if ( sb.Length > 1 ) {
			sb = sb.Remove(sb.Length - 1, 1);
		}
		return sb.ToString(); ;
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 11092
n, m, l = map(int, input().split())

A = []
for i in range(n):
    a = [int(a) for a in input().split()]
    A.append(a)

B = []
for i in range(m):
    b = [int(b) for b in input().split()]
    B.append(b)

C = []
for i in range(n):
    a = A[i]
    Ci = []
    for j in range(l):
        ci = 0
        for k in range(m):
            b = B[k]
            c = a[k]*b[j]
            ci += c
        Ci.append(ci)
    C.append(Ci)

for i in range(n):
    Ci = C[i]
    for j in range(l):
        if j<l-1:
            print(Ci[j],end=' ')
        if j==l-1:
            print(Ci[j])


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

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

  for (int i = 0; i  < N.size(); i++) {
    if (N[i] == '1') cout << 9;
    if (N[i] == '9') cout << 1;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

void cout_vec(vector<long long> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<string> S(N+1,"");
    vector<string> T(M+1,"");

    for(int i=1; i<=N; i++){
        cin >> S[i];
    }

    for(int i=1; i<=M; i++){
        cin >> T[i];
    }
    
    vector<long long> prev(M+1,1);
    for(int i=1; i<=N; i++){
        long long tmp=1;
        long long tmp0=1;
        for(int j=1; j<=M; j++){
            tmp0=prev[j];
            if(S[i]==T[j]){
                prev[j]=(prev[j-1]+prev[j])%MOD;
            }else{
                prev[j]=(prev[j-1]-tmp+prev[j])%MOD;
            }
            tmp=tmp0;
        }
        //cout_vec(prev);
    }

    
    cout << (prev[M]+MOD)%MOD << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main{


	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);			//文字の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		if(b <= d){
			if(c <= b){
				if(a >= c){
					System.out.println(b-a);

				}else{
					System.out.println(b-c);
				}
			}else{
				System.out.println(0);

			}
		}else{				//b>d
			if(d >= a){
				if(a <= c){
					System.out.println(d-c);
				}else{
					System.out.println(d-a);

				}

			}else{
				System.out.println(0);

			}
		}

	}
}

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

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

ll toNum(const string &s) {
    ll n = 0;
    for (int i = 0; i < s.size(); ++i) {
        n *= 10;
        n += s[i] - '0';
    }
    return n;
}

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    for (int i = 0; i < (1 << (s.size() - 1)); ++i) {
        ll sum = 0;
        int prev = 0;
        int p = i | (1 << (s.size() - 1));
        for (int j = 0; j < s.size(); ++j) {
            if (p >> j & 1) {
                sum += toNum(s.substr(prev, j - prev + 1));
                prev = j + 1;
            }
        }
        ans += sum;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//C - Together: 
//Assunto:
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    map<int, int> show;
    int n, maxi = 0, ans;
    cin >> n;
    vector<int> seq(n);
    loop(i, 0, n) cin >> seq[i];
    for(auto x : seq) {
        show[x]++;
        show[x+1]++;
        show[x-1]++;
    }
    for(auto x : show) {
        if(x.se > maxi) {
            maxi = x.se;
            ans = x.fi;
        }
    }
    cout << maxi << "\n";
}

Measured memory_bytes: 5120
#include<stdio.h>
#include<string.h>

int main(void){
	int a[1000],A=0,B=0,AB=0,O=0;
	char s[5];
	
	while(scanf("%d,%s",&a,s)!=EOF){
		if(strcmp(s,"A")==0)A++;
		else if(strcmp(s,"B")==0)B++;
		else if(strcmp(s,"O")==0)O++;
		else if(strcmp(s,"AB")==0)AB++;
	}
	
	printf("%d\n%d\n%d\n%d\n",A,B,AB,O);
	return 0;
}

Measured memory_bytes: 600
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    vec<i64> tri = {0};
    for (i64 i=1; i<100; i++) {
        tri.push_back(tri.back()+i);
    }

    i64 ans = 0;

    i64 n;
    std::cin >> n;
    auto div=[&](i64 i){
        i64 m = 0;
        for (; n%i==0; n/=i, m++);
        i64 k = std::prev(std::upper_bound(ALL(tri), m)) - tri.begin();
        ans += k;
    };
    for (i64 i=2; i*i<=n; i++) if (n%i==0) {
        div(i);
    }
    if (n!=1) div(n);
    std::cout << ans << '\n';
}


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

using namespace std;
const int kMod = 1e9 + 7;

void add(int&a , int b) {
    a += b;
    if (a >= kMod) a -= kMod;
    if (a < 0) a += kMod;
}

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

    string s; cin >> s;

    vector<int> dp(n, 1), ndp(n, 0);

    for (int i = 0; i < n - 1; ++i) {
        fill(ndp.begin(), ndp.end(), 0);

        for (int j = 0; j < n; ++j) {
            if (s[i] == '<') {
                add(ndp[0], dp[j]);
                add(ndp[j], -dp[j]);
            } else {
                add(ndp[n - i - 1], -dp[j]);
                add(ndp[j], dp[j]);
            }
        }        

        for (int i = 1; i < n; ++i)
            add(ndp[i], ndp[i - 1]);
        swap(dp, ndp);
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        add(ans, dp[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF (1LL<<60)
#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 << " " << 
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

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

  int ans = 0;
  REP(i,4){
    if(x == i) ans += 100000*(4-i);
    if(y == i) ans += 100000*(4-i);
  }

  if(x==1&&y==1) ans += 400000;

  cout << ans << endl;

  return 0;
}

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

bool solve(string s) {
	string r = s;
	reverse(r.begin(), r.end());
	for (int i=0; i<s.size(); i++) {
		if (s[i] != r[i]) return false;
	}
	return true;
}

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

	bool can = false;
	string s = S.substr(0, (S.size()-1)/2);
	string e = S.substr((S.size()+2)/2, S.size());
	if (solve(S) && solve(s) && solve(e)) can = true;

	if (can) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007

using namespace std;

int main(){
    ll X; cin >> X;
    ll cnt500 = X/500;
    ll cnt5 = (X - 500*cnt500)/5;
    cout << cnt500 * 1000 + cnt5 * 5 << endl;
}

Measured memory_bytes: 256
//============================================================================
// Name        : ku.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include<iostream>
using namespace std;
#include<cstdio>
int main(){
	int a,b,c,sum=0;
	cin>>a>>b>>c;
	for(a;a<=b;a++){
		if(c%a==0){
			sum=sum+1;}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    ll r = n % k;
    cout << min(r, k-r) << endl;

}


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

int main()
{
    string a,b;
    cin>>a>>b;
    int cnt=0;

    for(int i=0;i<a.size();i++)
    {
        if(a[i]!=b[i])
        {
            cnt++;
        }
    }

    if(cnt==0)
    {
        cout<<0<<endl;
    }
    else
    {
        cout<<cnt<<endl;
    }

    exit(0);
}


Measured memory_bytes: 4112
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

char s[1003];
int solve(char ch) {
	string S = s;
	int cnt = 0;
	while (1) {
		if (S.size() == 1) break;
		int flag = 1;
		for (char c : S) {
			if (c != ch) {
				flag = 0;
			}
		}
		if (flag) return cnt;
		cnt++;
		string T = "";
		for (int i = 1; i < S.size(); i++) {
			if (S.at(i) == ch || S.at(i - 1) == ch) {
				T.push_back(ch);
			}
			else {
				T.push_back(S.at(i));
			}
		}
		S = T;
	}
	return cnt;
}

int main()
{
	scanf("%s", s);
	int ans = 10000;
	for (int i = 'a'; i <= 'z'; i++) {
		int now = solve(i);
		ans = MIN(ans, now);
	}
	printf("%d\n", ans);
	return 0;
}


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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    if (N % 2 != 0) {
        cout << "No" << endl;
    } else {
        bool flag = true;
        for (int i = 0; i < N / 2 ; i++) {
            if (S[i] != S[i + N / 2]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, f, n) for (ll i = (f); i < (ll)(n); i++)
#define repe(i, f, n) for (ll i = (f); i <= (ll)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int MOD = 1e9 + 7;

int main() {
  int N;
  cin >> N;
  ll ans = 1;
  repe(i, 1, N) ans = (ans * i) % MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3568
def main():
    a = list(map(int, input().split()))
    count = 0
    data_list = [i for i in range(1, a[0] + 1)]
    for i in data_list[::-1]:
        if a[0] % i == 0 and a[1] % i == 0:
            count += 1
            if count == a[2]:
                print(i)
                break


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define mp make_pair
#define rep(a,b,c) for(ll a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(ll a=b;a<=c;a+=d)

const double PI=acos(-1);
const long double EPS=1e-12;
const ll MOD=1e9+7;
const int INF=1<<30;


using namespace std;

vector<ll>pr;
bool vis[30005];
void pre(){
	pr.pb(2);
	repp(i,3,30000,2){
		if(!vis[i]){
			pr.pb(i);
			repp(j,i*i,30000,i){
				vis[j]=true;
			}
		}
	}
}


int main(){
	ll a,b,x;
	pre();
	cin>>a>>b;
	if(a%b==0)cout<<-1<<endl;
	else{
		x=__gcd(a,b);
		a/=x;
		b/=x;
		int sz=pr.size();
		for(int i=0;i<sz;i++){
			if((a*pr[i])%b!=0){
				cout<<a*x*pr[i]<<endl;
				return 0;
			}
		}
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int a; cin >> a;
		int b; cin >> b;
		int c; cin >> c;
		cout << (c - (a - b) >= 0 ? c - (a - b) : 0) << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;
int main(){
	long long n,ans=1,sum;
	scanf("%lld",&n);
	for(int i=sqrt(n);i>=1;i--){
		if(n%i==0){
			sum=n/i;
			break;
		}
	}
	while(sum>=10){
		ans++;
		sum/=10;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
n,k=input().split()
n=int(n)
k = int(k)
bl=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
L = [int(x) for x in input().split()]
for i in L:
   x = int(i)
   bl[x]=1
while True:
     s = str(n)
     flag=0
     for i in s:
         if bl[int(i)]==1:
             n = n + 1
             flag = 1
             break
     if flag == 0:
         break
print(n)

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

long long MOD = 1000000007;

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

    vector<vector<long long> > C(N+1,vector<long long>(N+1,0));

    for(int i=0; i<=N; ++i) {
        C[i][0]=1;
        C[i][i]=1;
    }

    for(int i=1; i<=N; ++i) {
        for(int j=1; j<i; ++j) {
            C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;
        }
    }

    long long ans = 0;
    for (int i=1; i<=K; i++) {
        ans = (C[N-K+1][i]*C[K-1][i-1])%MOD;
        cout << ans << endl;
    }

    return 0;
}



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

int main(void) {
  int n, Y;
  cin >> n >> Y;

  for (int z = 0; z <= n; z++) {
    for (int y = 0; y <= n - z; y++) {
      int x = n - y - z;
      //cout << x << " " << y << " " << z << endl;
      if (x * 10000 + y * 5000 + z * 1000 == Y) {
        cout << x << " " << y << " " << z << endl;
        return 0;
      }
    } 
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int X, Y, T, R;
int gcd(int x, int y) {
	if(x == 0) return y;
	if(y == 0) return x; T++;
	if(x > y) return gcd(y, x % y);
	return gcd(x, y % x);
}
int main() {
	while(true) {
		scanf("%d%d", &X, &Y); T = 0;
		if(X == 0 && Y == 0) break;
		R = gcd(X, Y);
		printf("%d %d\n", R, T);
	}
	return 0;
}



Measured memory_bytes: 2564