akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main() {

  long N;
  long A, B;
  long i;
  long ans;
  
  scanf("%ld", &N);
  ans = N;
  
  for(A = 1; A*A <= N; A++) {
    if(N%A == 0) {
      B = N/A;
      i = 0;
      while(B > 0) {
	B /= 10;
	i++;
      }
      if(i < ans) {
	ans = i;
      }
    }
  }

  printf("%ld\n", ans);
  
  return 0;
}


Measured memory_bytes: 128
l = list(map(int, input().split()))
s = 3
for i in range(3):
    for j in range(i + 1, 3):
        if l[i] == l[j]:
            s = s - 1
if l[0] == l[1] and l[1] == l[2]:
    s = s + 1
print(s)

Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int W, H;
int board[100][100];
bool used[100][100];

void fillboard(int x, int y) {
    if(x < 0 || x >= H || y < 0 || y >= W) return;
    if(used[x][y]) return;
    if(board[x][y] == 0) return;
    // printf("x = %lld, y = %lld\n", x, y);
    used[x][y] = true;
    rep(i,0,8) fillboard(x + dx[i], y + dy[i]);
}

signed main() {
    while(cin >> W >> H, W || H) {
        memset(used, false, sizeof(used));
        rep(i,0,H) rep(j,0,W) cin >> board[i][j];

        int ans = 0;
        rep(i,0,H) rep(j,0,W) {
            if(used[i][j] || board[i][j] == 0) continue;
            ans++;
            fillboard(i, j);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
#define   vpll   vector<pll >
#define   all(x) x.begin(),x.end()
#define   present(c,x)    ((c).find(x) != (c).end())
#define   dbg(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){
  std::cerr << name << " = " << arg1 << "\n";
}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#define   sz(a)  a.size()
#define   vll vector<int>
#define   pll pair<int,int>
#define   ff  first
#define   ss  second
#define   br  cout<<"\n";
#define   ld  long double
#define   int  long long int
const int  INF = 1e18+7;
const int  MAX = 1234567;
const int  MOD = 1000000007;


int n , q ;
vll g[200005];
map < int , int > val ;
map < int , int > ans ;
void dfs ( int u , int parent , int pushed ){
	ans[u] = val[u] + pushed ;
	for ( auto v : g[u] ){
		if ( v == parent )
			continue ;
		dfs ( v , u , ans[u] );
	}
}
void solve(){
    cin >> n >> q ;
    for ( int i = 0 ; i < n - 1; i ++ ){
    	int u , v ;
    	cin >> u >> v ;
    	g[u].push_back(v);
    	g[v].push_back(u);
    }
    while ( q-- ){
    	int a , b ;
    	cin >> a >> b ;
    	val[a] += b ;
    }
    dfs ( 1 , 1 , 0 );
    for ( int i = 1 ; i < n + 1 ; i++ )
    	cout << ans[i] << " ";
}
int32_t main(){
    int t;
    t=1;
    cin.sync_with_stdio(0), cin.tie(0);
    //cin>>t;
    while(t--){
        solve();
        br;
    }
    return 0;
}
 
 
 
 
 
 

Measured memory_bytes: 57088
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {


  int n;
  cin >> n;

  int t = 0;
  int h = 0;
  for(int i=0; i<n; i++){
    vector<string> s(2);
    cin >> s[0] >> s[1];

    string tmp = s[0];
    sort(s.begin(), s.end());
    if( s[0] == s[1] ){
      t++;
      h++;
    }else if( tmp == s[0] ) h += 3;
    else t += 3;
  }
  cout << t << " " << h << endl;

  return 0;
}

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define psb push_back
#define ppb pop_back

const int INF = 1000000000;

int main() {
    int A, B, H, M;

    cin >> A >> B >> H >> M;

    double tm = (double)M/60 * 2*M_PI;
    double th = (double)(60*H+M)/720 * 2*M_PI;
    double t = th-tm;

    double ans = sqrt(A*A + B*B - (double)2*A*B*cos(t));

    printf("%.10f\n", ans);
}


Measured memory_bytes: 4076
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

//for(i=0; i<N; i++) cin >> a[i];

ll mxl[MAX*2][2]={}; //mxl[i][0]: 最後にi-1を選択, mxl[i][1]: 最後にiを選択
ll mxr[MAX*2][2]={}; //mxr[i][0]: 最後にiを選択, mxr[i][1]: 最後にi+1を選択

int main(void) {
  ll i, j, k;
  
  ll N;
  ll a[MAX*2];
  
  cin >> N;
  for(i=1; i<=N; i++) cin >> a[i];
  
  for(i=2; i<=N; i+=2) {
    mxl[i][0]=mxl[i-2][0]+a[i-1];
    mxl[i][1]=max(mxl[i-2][0], mxl[i-2][1])+a[i];
  }
  
  for(i=N-1; i>=2; i-=2) {
    mxr[i][0]=max(mxr[i+2][0], mxr[i+2][1])+a[i];
    mxr[i][1]=mxr[i+2][1]+a[i+1];
  }
  
  if(!(N&1)) {
    pt(max(mxl[N][0], mxl[N][1]));
    return 0;
  }
  
  
  ll os[MAX*2]={};
  ll es[MAX*2]={};
  for(i=1; i<=N; i++) {
    if(i&1) {
      os[i]=os[i-1]+a[i];
      es[i]=es[i-1];
    }else {
      os[i]=os[i-1];
      es[i]=es[i-1]+a[i];
    }
  }
  
  ll ans=-INF;
  for(i=1; i<N-1; i+=2) {
    ll t= max(mxl[i-1][0], mxl[i-1][1]) + os[N]-os[i];
    chmax(ans, t);
  }
  
  for(i=2; i<N; i+=2) {
    ll t=os[i-1]+ max(mxr[i+2][0], mxr[i+2][1]);
    chmax(ans, t);
  }
  
  ll c=0;
  for(i=2; i<N; i+=2) c+=a[i];
  chmax(ans, c);
  
  pt(ans);
}
 
 




Measured memory_bytes: 12908
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
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; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));



int main(){
    ull X, Y;
    cin >> X >> Y;
    ull a;
    ull count = 0;
    for(a = X; a <= Y; a *= 2){
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3584
import sys
X, N = map(int, input().split())
if(N == 0):
    print(X)
    sys.exit()
p_list = list(map(int, input().split()))
p_list.sort()

if(not X in p_list):
    print(X)
else:
    for i in range(100):
        if(not X-i in p_list):
            print(X-i)
            break
        elif(not X+i in p_list):
            print(X+i)
            break


Measured memory_bytes: 9196
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]


n,a,b = li()
ans = 0
ans = n//(a + b)
n -= ans*(a + b)
ans *= a
ans += min(a,n)
print(ans)

Measured memory_bytes: 3700
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int m,n,o,p,q;
	scanf("%d %d %d %d %d", &m, &n, &o, &p, &q);
	for (int i = 1; i <= 5; i++)
	{
		switch (i)
		{
		case 1:
			if (m == 0)printf("%d", i); break;
		case 2:
			if (n == 0)printf("%d", i); break;
		case 3:
			if (o == 0)printf("%d", i); break;
		case 4:
			if (p == 0)printf("%d", i); break;
		case 5:
			if (q == 0)printf("%d", i); break;
		}
	}
}

Measured memory_bytes: 1728
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;


int main() 
{
	int n,d,ans = 0;

	cin >> n >> d;


	//��������
	vector<long long> listX(n);
	vector<long long> listY(n);
	//����
	for (int i = 0; i < n; i++)
		cin >> listX[i] >> listY[i];
	
	//����
	for (int i = 0; i < n; i++)
		if (d >= sqrt(listX[i] * listX[i] + listY[i]* listY[i]))
			ans++;

	cout << ans;
	return 0;
}


Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n; lnt s, mi = INF; bool equ = true;
int main() {
	read(n);
	while (n--) {
		lnt a, b; read(a), read(b);
		s += a, equ &= (a == b);
		if (a > b) mi = min(mi, b);
	}
	if (equ) return puts("0"), 0;
	return printf("%lld\n", s-mi), 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

std::vector<int> n_ary(int64_t decimal, int64_t base)
{
  int64_t s = decimal;
  int64_t abase = std::abs(base);

  std::vector<int> ret;
  while(std::abs(s) >= abase || s == -1) {
    int r = std::abs(s) % abase;
    s = (s - r) / base;
    ret.push_back(r);
  }
  ret.push_back(s);

  std::reverse(ret.begin(), ret.end());
  return ret;
}

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

  auto ret = n_ary(N, -2);

  std::for_each(ret.cbegin(), ret.cend(),
                [](auto &x) { std::cout << x; });
  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 3628
//#define CCF
//#define OLD

#ifndef CCF
    #pragma comment(linker, "/STACK:102400000,102400000")
    #ifdef OLD
        #pragma GCC diagnostic error "-std=c++11"
    #endif
    #pragma GCC optimize ("O3")
    #pragma GCC -mcmodle=large
#endif

#include<bits/stdc++.h>
using namespace std;

int father[100500];
int dis[100500];
int find_father(int x) {
    if(father[x]==x)return x;
    int a1=father[x];
    int a2=find_father(father[x]);
    father[x]=a2;
    dis[x]=dis[x]+dis[a1];
    return a2;
}

int find_dis(int x){
    if(father[x]==x)return 0;
    return find_dis(father[x])+dis[x];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int num,cas,L,R,D;
    cin>>num>>cas;
    for(int i=0; i<=num; i++) {
        father[i]=i;
        dis[i]=0;
    }
    while(cas--) {
        cin>>L>>R>>D;
        int fl=find_father(L);
        int fr=find_father(R);
        if(fl==fr) {
            if(dis[L]+D!=dis[R]) {
                cout<<"No"<<endl;
                return 0;
            }
        } else {
            father[fr]=fl;
            dis[fr]=find_dis(L)-find_dis(R)+D;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (n, m) = readIntList()
    val graph = Array(n + 1) { mutableListOf<Int>() }
    val reader = System.`in`.bufferedReader()
    for (i in 0 until m) {
        val (a, b) = reader.readLine()!!.split(" ").map(String::toInt)
        graph[a].add(b)
        graph[b].add(a)
    }
    val memo = Array(n + 1) { -1 }.apply { this[1] = 0 }

    val queue = ArrayDeque<Int>()
    queue.addLast(1)
    while (queue.isNotEmpty()) {
        val room = queue.first()
        queue.removeFirst()
        graph[room].forEach {
            if (memo[it] == -1) {
                memo[it] = room
                queue.addLast(it)
            }
        }
    }

    println("Yes")
    for (i in 2..n) {
        println(memo[i])
    }
}


Measured memory_bytes: 80380
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N,K = Ints()

mod = 10**9+7

One = [1,1]
R = 1

def divisor(M):
    A = []
    for i in range(1,int(M**0.5)+1):
        if M%i == 0:
            A.append(i)
            if M//i !=  i:
                A.append(M//i)
    #A.sort()
    return A

for i in range(2,K+1):
    tmp = 0
    tmp += pow(i,N,mod)
    tmp -= pow(i-1,N,mod)
    #print(divisor(i))
    for j in divisor(i):
        if j!=i:
            tmp -= One[j]
    #R += tmp%mod
    #R %= mod
    One.append(tmp%mod)
#print(One)
ans = 0
Rone = [0]
for i in range(1,K+1):
    Rone.append((Rone[-1]+One[i])%mod)

#print(Rone)
for i in range(1,K+1):
    ans += i*Rone[K//i]
    ans %= mod
print(ans)

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

using namespace std;

string s,t;

int dp[3005][3005];

string ans;

pair<int,int> p[3005][3005];

int main(){
  	cin >> s >> t;
	int n = (int)s.size(),m = (int)t.size();
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(s[i] == t[j] && dp[i + 1][j + 1] < dp[i][j] + 1){
				dp[i + 1][j + 1] = dp[i][j] + 1;
				p[i + 1][j + 1] = make_pair(i,j);
			}		
			else{
				if(dp[i][j + 1] <= dp[i + 1][j]){
					dp[i + 1][j + 1] = dp[i + 1][j];	
					p[i + 1][j + 1] = make_pair(i + 1,j);
				}
				else{
					dp[i + 1][j + 1] = dp[i][j + 1];
					p[i + 1][j + 1] = make_pair(i,j + 1);
				}
			}
		}	
	}
	for(pair<int,int> u = make_pair(n,m); u != make_pair(0,0); u = p[u.first][u.second]){
		if(p[u.first][u.second] == make_pair(u.first - 1,u.second - 1)) ans += s[u.first - 1]; 			
	}
	reverse(ans.begin(),ans.end());
	cout << ans;
	return 0;
}

Measured memory_bytes: 106112
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<char,int>;

const ll MOD = INF + 7;

//最大公約数
ll gcd(ll a, ll b){
    if(a % b == 0)return b;
    else return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
int main(){
   int n;
   cin >> n;
   ll res = 1;
   rep(i, n){
       ll t;
       cin >> t;
       res = lcm(res, t);
   }
   cout << res << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
using namespace std;


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int ma = INT_MIN;
  rep(i, n){
    int x;
    cin >> x;
    ma = max(ma, x);
    a[i] = x;
  }
  int half = ma / 2;
  int close = INT_MAX;
  for(int i = 0; i < n; ++i){
    if(abs(half - close) > abs(half - a[i]) && ma != a[i]){
      close = a[i];
    }
  }

  cout << ma << " " << close << endl;


}


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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		int R = Integer.parseInt(strArr[0]);
		int G = Integer.parseInt(strArr[1]);
		int B = Integer.parseInt(strArr[2]);
		N = Integer.parseInt(strArr[3]);
		int cnt = 0;
		for (int r = 0; r <= 3000 && r * R <= N; r++) {
			for (int g = 0; g <= 3000 && r * R + g * G <= N; g++) {
				if (r * R + g * G > N)
					continue;
				if ((N - r * R - g * G) % B == 0) {
					cnt++;
				}
			}
		}
		System.out.println(cnt);
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 20948
#include <stdio.h>

int main(void) {
	int i,j,h[10],tmp;

	for(i=0;i<10;i++) {
		scanf("%d",&h[i]);
	}
	for(i=0;i<9;i++) {
		for(j=i+1;j<10;j++) {
			if(h[i]<h[j]) {
				tmp=h[i];
				h[i]=h[j];
				h[j]=tmp;
			}
		}
	}
	for(i=0;i<3;i++) {
		printf("%d\n",h[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int HTt = A/D + (A%D==0?0:1);
  int HTa = C/B + (C%B==0?0:1);
  cout<<(HTt>=HTa?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// string q=s.insert(0,str);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	string s;
	string p;
	cin>>s>>p;
	if(s==p)
	{
		cout<<0<<endl;
	}	
	else
	{
		int cnt=0;
		for(int i=0;i<s.size;i++)
		{
			if(s[i]!=p[i])
			{
				cnt++;
			}
		}
		cout<<cnt<<endl;
	}
}

Measured memory_bytes: 3800
#include <iostream>
#include <stdio.h>
#include <string.h>
#define Max 55555
using namespace std;
int n;
bool isprime[Max];
void solve()
{
	memset(isprime,true,sizeof(isprime));
	isprime[0]=isprime[1]=false;
	for(int i=2;i<Max;i++)
	{
		if(isprime[i])
		{
			for(int j=2*i;j<Max;j+=i)
				isprime[j]=false;
		}
	}
}
int main()
{
	scanf("%d",&n);
	solve();
	int j=0,data[Max],t=n,sum=0;
	for(int i=sum+1;i<Max&&n;i++)
	{
		if(isprime[i])
			if((i-1)%5==0)
				data[j++]=i,n--;
	}
	for(int i=0;i<t-1;i++)
		printf("%d ",data[i]);
	printf("%d\n",data[t-1]);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<set>
#include<vector>
#include<cmath>
#include<complex>
#include<string>
#include<algorithm>

using namespace std;

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main(void)
{
  int a,b,c;
	int cou = 0;
	cin >> a >> b >> c;
	if((a < c) && (b > c)) cout << "Yes" << endl;
	else if((a > c)&&(b<c)) cout << "Yes" << endl;
	else cout << "No" << endl;
	
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct UnionFind {
    VI d;
    UnionFind(int n = 0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

struct mint {
  LL x; // typedef long long ll;
  mint(LL x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(LL t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x *= 2;
    return x;
}

mint choose(int n,int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main() {
    int k,a,b;
    cin >> k >> a >> b;
    for(int i = a;i <= b; i++) {
      if(i % k == 0) {
        cout << "OK" << endl;
        return 0;
      }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 5984
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, M = get_ints

puts N == M ? 'Yes' : 'No'


Measured memory_bytes: 14464
#include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <vi>
#define inf 1000000000
 
using namespace std;
 
bool comp(ll a, ll b) {
    return a > b;
}
 
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    int a, b;
    cin >> a >> b;
    cout << a * b << "\n";
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A = 1, B;
  cin >> N;
  int M = N;
 
  while (1) {
    A = N % 10;
    N = N / 10;
    B += A;
    if (A == N) {
      break;
    }
  }
  if (B != 0 && M % B == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    queue<int> BFS_border;
    BFS_border.push(0);
    while (!BFS_border.empty()) {
        int target = BFS_border.front();
        BFS_border.pop();
        if (target == S.size()) {
            cout << "YES" << endl;
            return 0;
        }

        for (string s : divide) {
            if (S.substr(target, s.size()) == s) {
                BFS_border.push(target + s.size());
            }
        }
    }

    cout << "NO" << endl;
}

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

int counter(int bits) {
  if (bits == 0) {
    return 0;
  }
  return counter(bits >> 1) + (bits & 1);
}

int main() {
  int N;
  cin >> N;
  
  int A[16];
  int x[16][16];
  int y[16][16];
  
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    
    for (int j = 1; j <= A[i]; j++) {
      cin >> x[i][j] >> y[i][j];
    }
  }
  
  int result = 0;
  
  // bitsが1となっている人は正直者と仮定し、矛盾が起きないかチェックする
  for (int bits = 1; bits < (1 << N) ; bits++) {
    bool check = true;
    
    for (int i = 1; i <= N; i++) {
      // i番目の人が不親切の場合は、矛盾は起きない
      int honest = (bits >> (i - 1)) & 1;
      if (!honest) {
        continue;
      }
      // i番目の人が正直者の場合のみ、x[i][j]とy[i][j]を調べる
      for (int j = 1; j <= A[i]; j++) {
        int honest2 = (bits >> (x[i][j] - 1)) & 1; // x[i][j]で指定している人が正直者かどうか
        int testimony = y[i][j]; // i番目の人の証言、y[i][j]
        if (honest2 ^ testimony) {
          check = false;
        }
      }
    }
    if (check) {
      result = max(result, counter(bits));
    }
  }
  
  cout << result << endl;
  return 0;
}

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

#define ll long long int
#define llu unsigned long long int
#define f(n) for(ll i=0;i<n;i++)
#define fr(n) for(ll i=n-1;i>=0;i--)
#define endl "\n"
#define mod 1000000007

using namespace std;

int main()
{
	//#ifdef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	std::ios_base::sync_with_stdio(false);

	ll a[9];
	f(9)
	{
		cin>>a[i];
	}
	ll b[3][3];
	f(3)
	{
		for(ll j=0;j<3;j++)
		{
			b[i][j]=0;
		}
	}
	ll n;
	cin>>n;
	f(n)
	{
		ll x;
		cin>>x;
		for(ll j=0;j<9;j++)
		{
			if(a[j]==x)
			{
				b[j/3][j%3]=1;
			}
		}
	}
	ll f=0;
	if((b[0][0]==1&&b[0][1]==1&&b[0][2]==1)||(b[1][0]==1&&b[1][1]==1&&b[1][2]==1)||(b[2][0]==1&&b[2][1]==1&&b[2][2]==1))
	{
		f=1;
	}
	if((b[0][0]==1&&b[1][0]==1&&b[2][0]==1)||(b[0][1]==1&&b[1][1]==1&&b[2][1]==1)||(b[0][2]==1&&b[1][2]==1&&b[2][2]==1))
	{
		f=1;
	}
	if((b[0][0]==1&&b[1][1]==1&&b[2][2]==1)||(b[0][2]==1&&b[1][1]==1&&b[2][0]==1))
	{
		f=1;
	}
	if(f==1)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n){
    Int res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}


int main(){
    cin.tie(0);
    
    int A, B, C;
    cin >> A >> B >> C;
    cout << max({A, B, C})*10+A+B+C-max({A, B, C}) << endl;
} 


Measured memory_bytes: 504
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bits                   (shiftR)
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char                   (isSpace)
import           Data.STRef
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  pys <- V.unfoldrN m parseInt2 <$> B.getContents
  putStr $ solve n m pys

solve :: Int -> Int -> V.Vector (Int, Int) -> String
solve _ m pys = unlines . map (tail . show) $ V.toList ids
  where
    ids = runST $ do
      v <- VM.new m :: ST s (VM.STVector s Int)
      cr <- newSTRef 1 :: ST s (STRef s Int)
      VM.write v (get3 (pyis V.! 0)) (encodeId (get1 (pyis V.! 0)) 1)
      forM_ [1 .. m - 1] $ \i -> do
        if get1 (pyis V.! i) /= get1 (pyis V.! (i - 1))
          then writeSTRef cr 1
          else modifySTRef cr (+ 1)
        c <- readSTRef cr
        VM.write v (get3 (pyis V.! i)) (encodeId (get1 (pyis V.! i)) c)
      V.freeze v
    pyis = sort' . V.zip pys $ V.enumFromN 0 m :: V.Vector ((Int, Int), Int)

get1 :: ((a, a), a) -> a
get1 = fst . fst

-- get2 :: ((a, a), a) -> a
-- get2 = snd . fst

get3 :: ((a, a), a) -> a
get3 = snd

encodeId :: Int -> Int -> Int
encodeId p r = 1000000000000 + p * 1000000 + r

sort' :: (Ord a, V.Unbox a) => V.Vector a -> V.Vector a
sort' = V.modify (\v -> quicksort v 0 (VM.length v))

-- https://github.com/as-capabl/haskell-qsort-pfm/blob/master/src/UV.hs
quicksort :: (Ord a, V.Unbox a) => VM.STVector s a -> Int -> Int -> ST s ()
quicksort work iStart iEnd
    | iEnd - iStart <= 1 = return ()
    | otherwise = do
        pivot <- VM.unsafeRead work (((iEnd - iStart) `shiftR` 1) + iStart)
        med <- divide pivot iStart (iEnd - 1)
        quicksort work iStart med
        quicksort work med iEnd
  where
    divide pivot iS' iE'
        | iS' > iE' = return iS'
        | otherwise = do
            lower <- shrinkLower pivot iS' iE'
            higher <- shrinkHigher pivot lower iE'
            if lower >= higher
              then do
                return lower
              else do
                swapWork lower higher
                divide pivot (lower + 1) (higher - 1)

    shrinkLower pivot iS' iE'
        | iS' > iE' = return iS'
        | otherwise = do
            x <- VM.unsafeRead work iS'
            if x >= pivot
              then
                return iS'
              else
                shrinkLower pivot (iS' + 1) iE'

    shrinkHigher pivot iS' iE'
        | iS' > iE' = return iE'
        | otherwise = do
            x <- VM.unsafeRead work iE'
            if x <= pivot
              then
                return iE'
              else
                shrinkHigher pivot iS' (iE' - 1)

    swapWork i j = VM.unsafeSwap work i j

type Parser a = B.ByteString -> Maybe (a, B.ByteString)

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
  (,) <$> StateT (B.readInt . B.dropWhile isSpace)
  <*> StateT (B.readInt . B.unsafeTail)


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

def solve(N: int, K: int, A: "List[int]"):
    from math import ceil
    return ceil((N-1)/(K-1))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, K, A))

def test():
    import doctest
    doctest.testmod()

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


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

long long INF = 1e18;

int main(){
    int a,b;
    cin>>a>>b;
    int A , B;
    for (int i = 1; i <= 1300;i++){
        A = i * 0.08;
        B = i * 0.1;
        if(a == A && b == B){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const double PI = acos(-1);
typedef long long ll;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }


typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

/* First, find earliest workdays possible.
 * For each one check if it is possible to work enough days if not
 * worked on that day.
 * Speedup use memoization.
 * ...no.
 *
 * Greedy.
 * find earliest possible workdays.
 * from last to first, try move that workday to a later day.
 * if not possible that day is bound, else not.
 *
 */
void solve() {
    cini(n);
    cini(k);
    cini(c);
    cins(s);

    vi fdays;

    /* find earliest possible workdays */
    for(int i=0; fdays.size()<k && i<n; i++) {
        if(s[i]=='o') {
            fdays.push_back(i);
            i+=c;
        }
    }
    assert(fdays.size()==k);

/*
cout<<"fdays: ";
for(int i : fdays)
    cout<<i<<" ";
cout<<endl;
*/

    vi ans;

    int latest=n-1; // latest date next workday can be placed
    for(int i=fdays.size()-1; i>=0; i--) {
        bool canMove=false;
        for(int j=latest; !canMove && j>fdays[i]; j--) {
            if(s[j]=='o') {
                canMove=true;
                latest=j-c-1;
            }
        }

        if(!canMove) {
            ans.push_back(fdays[i]);
            latest=fdays[i]-c-1;
        }
    }
    sort(ans.begin(), ans.end());
    for(int i : ans)
        cout<<i+1<<endl;
    


}

signed main() {
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
}



Measured memory_bytes: 5128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] l = new int[n];
		for (int i = 0; i < n; i++)
			l[i] = in.nextInt();
		
		int max = 0;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			max = Math.max(max, l[i]);
			sum += l[i];
		}
		
		sum -= max;
		
		if (max < sum)
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}

Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
	
	public static void printArray(int[] A){
		int n = A.length;
		for(int i=0; i<n-1; i++){
			System.out.print(A[i]+" ");
		}
		System.out.print(A[n-1]+"\n");
	}

	public static void selectionSort(int[] A){
		int minPos;
		int swapTimes = 0;
		for(int i=0; i<A.length; i++){
			minPos = i;
			for(int j=i+1;j<A.length; j++){
				if(A[j]<A[minPos]) minPos = j;
			}
			if(i!=minPos){
				swap(A, i, minPos);
				swapTimes++;
			}
		}
		printArray(A);
		System.out.println(swapTimes);
	}

	public static void swap(int[] A, int a, int b){
		int t = A[a];
		A[a] = A[b];
		A[b] = t;
	}

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] A = new int[n];
		for(int i=0; i<n; i++){
			A[i] = scan.nextInt();
		}

		scan.close();
		selectionSort(A);
	}
}


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

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

    string s;
    cin >> s;
    if ((s[0]==s[1] && s[1]==s[2]) ||
        (s[1]==s[2] && s[2]==s[3])) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
using namespace std;
const int N = 1e5+10;
main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin>>s;
    int k;cin>>k;
    set<string> st;
    int n=s.length();
    for(int i=0;i<n;i++){
        string s2;
        for(int j=i;j<min(i+5,n);j++){
            s2+=s[j];
            st.insert(s2);
        }
    }
    int cnt=0;
    for(string i:st){
        cnt++;
        if(cnt==k)
            return cout<<i,0;
    }
}



Measured memory_bytes: 1664
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
	    double [] n = Console.ReadLine().Split(' ').Select(s=>double.Parse(s)).ToArray();
	    
	    if(n[0]+n[1] > n[2]+n[3]) Console.WriteLine("Left");
	    else if(n[0]+n[1] < n[2]+n[3]) Console.WriteLine("Right");
	    else Console.WriteLine("Balanced");
	    
	} 
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long hey;
#define hi string
#define pi 3.141592653589793238
#define fi first
#define mod 1000000007
#define se second
#define pb push_back 
#define pop pop_back 
#define bs binary_search
#define mp make_pair
#define ma map< hey,hey >
#define vi vector < hey > 
#define all(v) v.begin(),v.end()
#define qu priority_queue< hey >
#define endl '\n'
#define forn(i, n) for (hey i = 0; i <hey(n); ++i)
#define yorn(i, n) for (hey i = 1; i <=hey(n); ++i)
#define vp vector< pair<hey,hey> >
// lower bound - first element equal to or greater than given value.
// upper bound - first element greater than given value.
hey frog(hey n,hey a[])
{
    
    hey dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
    }
    return dp[n-1];
}
void hellogadhi()
{
    hey n;
    cin>>n;
    hey a[n];
    forn(i,n)
    cin>>a[i];
    cout<<frog(n,a);
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)
	{
	    hellogadhi();
	}
	return 0;
}


Measured memory_bytes: 1792
import sys
from collections import defaultdict

n, m, *py = map(int, sys.stdin.read().split())
py = list(zip(*[iter(py)] * 2))

def main():
    ids = defaultdict(list)
    for p, y in py:
        ids[p].append(y)
    
    for p, ys in ids.items():
        ids[p] = dict([(y, i) for i, y in enumerate(sorted(ys), 1)])
    
    for p, y in py:
        x = ids[p][y]
        first = str(p)
        last = str(x)
        first = '0' * (6 - len(first)) + first
        last = '0' * (6 - len(last)) + last
        yield first + last
    
if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 60912
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<sstream>
#include<algorithm>
#define all(n) n.begin(),n.end()
using namespace std;

string itos(int i)
{
  stringstream ss;
  ss << i;
  return ss.str();
}

void EXAM(string N)
{
  int cnt = 0;
  while(true)
    {
      vector<int> mex,men;
      for(int i=0;i<N.size();i++)
	mex.push_back(N[i]-'0');
      sort(all(mex),greater<int>());
      men = mex;
      sort(all(men));
      
      int imex,imen;
      imex = imen = 0;
      for(int i=3;i>=0;i--)
	{
	  imex += mex[i]*pow(10,3-i);
      imen += men[i]*pow(10,3-i);
	}

      string pre = itos(imex-imen);      
      N = string(4-pre.size(),'0') + pre;
      //cout << "L = " << imex << " S = " << imen  << " L-S = " << N << endl;
      cnt++;
      if(N == "6174")
	break;
    }
  cout << cnt << endl;
}

int main()
{
  string N;
  while(true)
    {
      cin >> N;
      if(N == "0000")
	break;
      if(N == "1111" || N == "2222" || N == "3333" || N == "4444" || N == "5555" || N == "6666" || N == "7777" || N == "8888" || N == "9999")
	{
	  cout<< "NA" << endl;
	  continue;
	}
      if(N == "6174")
	{
	  cout << 0 << endl;
	  continue;
	}
      EXAM(N);

    }
  return 0;
}

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

//テストケースはあんまり見ないほうが良い。デバッグする能力が必要.
int main(){
    string s;
    int n;
    cin >> n;
    cin >> s;
    rep(i,s.size()){
        char a = s[i];
        a+=n;
        if(a>'Z'){
            a = 'A'+a -'Z'-1;
        }
        cout << a;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

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

int main(){
    int s, w;
    cin >> s >> w;
    if (w>=s) out("unsafe");
    else out("safe");
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        static List<string> lis = new List<string>();
        static long N;

        public static void Answer()
        {
            var s = ReadLine();
            var ans = s.Substring(0, 4) + " " + s.Substring(4, 8);
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 17228
function Main(input) {
	var str = input;
	str = str.split("\n");
	var s = str[0];
	var t = str[1];
	var ans = "";
		//str = str.split(" ");
   	for(var i = 0; i < s.length; i++){
	if(s.charAt(i) !== t.charAt(i)){
		 ans = "No";
		 break;
		}
   }
     if (ans !== "No"){
   	ans ="Yes";
   }
   console.log(ans);
}
 //*おまじない
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29624
#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
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * 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 h, n; cin >> h >> n;
	vector<int> a(n), b(n); rep(i, n)cin >> a[i] >> b[i];
	int INF = 1e8;
	vector<int> dp(h + 1, INF);
	dp[0] = 0;
	rep(i, h)rep(j, n)
	{
		int d = min(h, i + a[j]);
		chmin(dp[d], dp[i] + b[j]);
	}
	cout << dp[h] << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
string s;
int count_a=0,count_b=0;
cin>>s;
for(int i=0;i<s.size();i++)
{
    if(s[i]=='A')count_a++;
    else count_b++;
}
if(count_a && count_b)
cout<<"Yes"<<endl;
else cout<<"No"<<endl;


}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		int N = sc.nextInt();
		int[] a = new int[N];
		
		int xorAll = 0;
		for(int i=0; i<N; i++) {
			a[i] = sc.nextInt();
			xorAll ^= a[i];
		}
		
		for(int i=0; i<N; i++) {
			pw.print((xorAll^a[i]) + (i==N-1 ? "\n" : " "));
		}
		
		sc.close();
		pw.close();
	}
	
}


Measured memory_bytes: 49860
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
inline ll ii(){ ll x; cin >> x; return x; }
inline string is(){ string x; cin >> x; return x; }
inline ld id(){ ld x; cin >> x; return x; }
inline void oi(ll x){ cout << x; }
inline void od(ld x){ cout << fixed << setprecision(10) << x; }
inline void os(string x){ cout << x; }
inline void oe(){ cout << endl; }
inline void oie(ll x){ oi(x); oe(); }
inline void ode(ld x){ od(x); oe(); }
inline void ose(string x){ os(x); oe(); }
inline void maxin(ll &a, ll b){ a=max(a,b); }

int main(){
    ll N=ii(),X=ii(),T=ii();
    if(N%X==0){
        oie(N/X*T);
    }else{
        oie(N/X*T+T);
    } 

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  string S;
  cin >> S;
  REP(i, S.size() - 1) {
    if (S[i] == 'A' && S[i + 1] == 'C') {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}

Measured memory_bytes: 256