akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int NUM = 1000000000;
const int L = 11;

string translation(int N){
  stringstream ss;
  while(N > 0){
    ss <<N % 8;
    N /= 8;
  }
  string s = ss.str();
  REVERSE(s);
  return s;
}

int main() {
  char n[9] = {'0', '1', '2', '3', '5', '7', '8', '9'};
  int N;
  while(cin >>N && N){
    string s = translation(N);
    REP(i, s.length()) cout <<n[s[i] - '0'];
    cout <<endl;
  }
  return 0;
}

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

using namespace std;

int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = 60 * h1 + m1;
    int t2 = 60 * h2 + m2;
    cout << t2 - t1 - k << "\n";
    return 0;
}


Measured memory_bytes: 3636
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)

	b1, b2, b4 := 0, 0, 0
	for i := 0; i < n; i++ {
		if a[i]%4 == 0 {
			b4++
		} else if a[i]%2 == 0 {
			b2++
		} else {
			b1++
		}
	}

	if b2 > 0 {
		b1++
	}

	if b4+1 < b1 {
		fmt.Fprintln(wr, "No")
	} else {
		fmt.Fprintln(wr, "Yes")
	}
}


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

int N,T,L,B;
double dp[105][105];
int field[105];

double solve()
{
	dp[0][0] = 1.0;

	for(int i=1; i<=T; i++) {
		for(int j=0; j<N; j++) {
			for(int k=1; k<=6; k++) {
				int np = j+k;
				if(np > N) np = N-(np-N);
				if(field[np] == 2) np = 0;

				if(field[j] == 1 && i==1) continue;

				double prob = dp[j][i-1];
				if(field[j] == 1) prob = dp[j][i-2];

				dp[np][i] += prob/6.0;
			}
		}
	}

	double res = 0;
	for(int i=1; i<=T; i++)
		res += dp[N][i];

	return res;
}

int main()
{
	while(cin >> N >> T >> L >> B, (N||T||L||B)) {
		memset(field, 0, sizeof(field));
		memset(dp, 0, sizeof(dp));
		
		for(int i=0; i<L; i++) {
			int a;
			cin >> a;
			field[a] = 1;
		}

		for(int i=0; i<B; i++) {
			int a;
			cin >> a;
			field[a] = 2;
		}

		cout.setf(ios::fixed);
		cout.precision(6);
		cout << solve() << endl;
	}
}

Measured memory_bytes: 0
import java.util.*;

import java.util.*;

public class Main {
    
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s; int sum;
        
        while(true){
            s=sc.next();sum=0;
            
            if(s.equals("0"))break;
            
            for(int i=0;i<s.length();i++){
                sum+=Character.getNumericValue(s.charAt(i));
            }
            
            System.out.println(sum);
        }
    }
}


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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N),B(N);
  for(int i=0;i<N;i++){cin >> A[i]; B[i]=abs(A[i]);}
  long long ans=0;
  int cnt=0;
  for(int i=0;i<N;i++){ans+=B[i];}
  for(int i=0;i<N;i++){
    //if(A[i]==0){cout << ans << endl; return 0;}
    if(A[i]<0){cnt++;}
  }
  sort(B.begin(),B.end());
  if(cnt%2==1){cout << ans-2*B[0] << endl;}
  else{cout << ans << endl; return 0;}
}

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

void proc(int *maps,int p,int w,int h){
	if(maps[p]==1) maps[p]=2;
	else return;
	int x=p%w;
	int y=p/w;
	for(int i=-1;i<=1;++i){
		for(int j=-1;j<=1;++j){
			int nx=x+j;
			int ny=y+i;
			if(nx>=0&&ny>=0&&nx<w&&ny<h){
				proc(maps,nx+ny*w,w,h);
			}
		}
	}
}

int main(void){
	int w,h;
	while(cin>>w>>h,w&&h){
		int chizu[2500];
		for(int i=0;i<h;++i){
			for(int j=0,a;j<w;++j){
				cin>>a;
				chizu[i*w+j]=a;
			}
		}
		int count = 0;
		for(int i=0;i<w*h;++i){
			if(chizu[i]==1){
				proc(chizu,i,w,h);
				++count;
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int suma = 0;
    string s, t;
    cin >> s >> t;
    for(int i=0; i<s.size(); i++) {
        if(s[i] != t[i]) {
            suma++;
        }
    }
    cout << suma;
    return 0;
}


Measured memory_bytes: 3740
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.format,
       std.math;

void main()
{
	auto n = readln.chomp.to!int;
	auto a = readln.chomp.to!int;
	writeln(n^^2-a);
}

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

#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin (),(x).end()
#define f(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pc __builtin_popcount // counts number of 1's in bin(num)

const double pi = 2*acos(0.0);
//__gcd(n1, n2);
//cout << fixed;
//cout << setprecision(6); //fixes # of dp



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

    int n;
    cin >> n;
    int x[n]; 
    int mid = 0;
    f(i, 0, n){
        cin >> x[i];
        mid += x[i];
    }
    mid /= n;
    mid += 1;
    int ans1 = 0;
    f(i, 0, n){
        ans1 += (mid - x[i])*(mid-x[i]);
    }

    mid -= 1;
    int ans2 = 0;
    f(i, 0, n){
        ans2 += (mid - x[i])*(mid-x[i]);
    }
    cout << min(ans1,ans2);
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll a,b,c;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> a >> b;
    if((a+b)%2==0){
        cout << (a+b)/2;
    }else{
        cout << "IMPOSSIBLE";
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
class Program {
    static void Main(string[] args) {
        string N = Console.ReadLine();

        if(N == "A") {
            Console.WriteLine("T");
        }else if(N == "C") {
            Console.WriteLine("G");
        }else if(N == "T") {
            Console.WriteLine("A");

            }else{
                Console.WriteLine("C");
            }
        }


    }

Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	int[] a = ReadIntArray();

	int min = 1000000001;
	int max = 0;

	for (int i = 0; i < n; i++)
	{
	    min = Math.Min(min, a[i]);
	    max = Math.Max(max, a[i]);
	}

	WriteLine(max - min);
    }
}


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


#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(arr) arr.begin(),arr.end()
#define INF 2000000000
#define MOD 1000000007
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define um unordered_map
#define us unordered_set
#define ff first
#define ss second



using namespace std; 
void solve(); 
int main() 
{ 
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
/*
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin); 
	freopen("error.txt", "w", stderr); 
	freopen("output.txt", "w", stdout); 
#endif 

	int t = 1; 
    cin >> t; 
	while (t--) { 
		solve(); 
		cout << "\n"; 
	} 
*/

	int coins;
	cin>>coins;
	int co500 = coins/500;
	int r500 = coins%500;
	int co5 =r500/5;
	cout<<(co500*1000)+(co5*5);
	
	
	
	

	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
	return 0; 
} 
void solve() 
{ 
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

vector<int> color;

bool dfs(const Graph &G, int v, int cur = 0) {
  color[v] = cur;
  for (auto next_v : G[v]) {
    if (color[next_v] != -1) {
      if (color[next_v] == cur) return false;
      continue;
    }

    if (!dfs(G, next_v , 1 - cur)) return false;
  }
  return true;
}

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

  Graph G(N);
  rep(i,N) {
    string S; cin >> S;
    rep(j,N) if (S[j] == '1') G[i].push_back(j);
  }

  color.assign(N, -1);

  if (!dfs(G, 0)) {
    cout << -1 << endl;
    return 0;
  }

  int ans = 0;
  rep(i,N) {
    vi dist(N, 201);
    priority_queue<P, vector<P>, greater<P>> pq;
    dist[i] = 1;
    pq.push(P(1,i));

    while (!pq.empty()) {
      auto p = pq.top(); pq.pop();
      int d, v;
      tie(d,v) = p;
      for (auto nv : G[v]) {
        if (dist[nv] > dist[v] + 1) {
          dist[nv] = dist[v] + 1;
          pq.push(P(dist[nv], nv));
        }
      }
    }

    ans = max(ans, (int)*max_element(all(dist)));
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = (k); i < (n); i++)
#define repr(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M,X,A;
	int B=0,G=0;
	cin >> N >> M >> X;
	repr(i,M){
		cin >> A;
		if(A<X){
			B++;
		}else{
			G++;
		}
	}
	if (B>=G){
		cout << G << endl;
	}else{
		cout << B << endl;
	}
}

Measured memory_bytes: 256
import sys
 
Tmp = []
Tmp = input().rstrip().split(' ')
A = int(Tmp[0])
B = int(Tmp[1])

#A = 170
#B = 80
print('100 100')

for i in range(50):
    for j in range(100):
        if i==0:
            print('.', end='')
            if  j==99:
                print()
               
            continue
        
        if j==0:
            print('.', end='')
            continue
        elif j==99:
            print('.', end='')
            print()
            continue
        else:
            Tmp1 = i % 2
            Tmp2 = j % 2
            
            if (Tmp1 == 1) and (Tmp2 == 1) and (B > 1):
                print('#', end='')
                B -= 1
            else:
                print('.', end='')
                
for i in range(50):
    for j in range(100):
        if i==0:
            print('#', end='')
            if  j==99:
                print()
            continue
        
        if j==0:
            print('#', end='')
            continue
        elif j==99:
            print('#', end='')
            print()
            continue
        else:
            Tmp1 = i % 2
            Tmp2 = j % 2
            
            if (Tmp1 == 1) and (Tmp2 == 1) and (A > 1):
                print('.', end='')
                A -= 1
            else:
                print('#', end='')
                



Measured memory_bytes: 4468
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn = 200005;
struct node{
    int value;
    int index;
    bool operator<(const node & t)const{
        return value < t.value;
    }
};
struct node2{
    int value;
    int index;
    bool operator<(const node2 & t)const{
        return value > t.value;
    }
};
priority_queue<node>q1;
priority_queue<node2>q2;
int a[maxn];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int lianxu=1;
    int lianxunum=0;
    int flag=0;
    for(int i=1;i<n;i++){
        if(a[i]>=a[i-1]){
            lianxu++;
            if(lianxu==k)
                lianxunum++;
        }
        else
            lianxu=1;
    }
    for(int i=0;i<k;i++){
        q1.push({a[i],i});
        q2.push({a[i],i});
    }
    int ans = 1;
    //cout << q1.top().value << q2.top().value <<endl;
    for(int i=k;i<n;i++){
        ans++;
        while(q1.top().index<i-k){
            q1.pop();
        }
        while(q2.top().index<i-k){
            q2.pop();
        }
        if(a[i]>=q1.top().value){
            if(q2.top().value==a[i-k]){
                ans--;
            }
        }
        q1.push({a[i],i});
        q2.push({a[i],i});
    }
    lianxunum=max(0,lianxunum-1);
    printf("%d\n",ans-lianxunum);
    return 0;
}


Measured memory_bytes: 4332
s = ["0"] + list(input())
n = len(s) - 1
alph = [chr(i) for i in range(97, 123)]
ans = 10000
for i in alph:
    dp = [[0] * (n + 1) for _ in range(n + 1)]
    for j in range(1, n + 1):
        if s[j] == i:
            dp[n][j] = 1
    if sum(dp[n]) != 0:
        if sum(dp[n]) == n:
            c = n
        else:
            for j in range(n - 1, 0, -1):
                for k in range(1, j + 1):
                    if dp[j + 1][k] == 1 or dp[j + 1][k + 1] == 1:
                        dp[j][k] = 1
                if sum(dp[j]) == j:
                    c = j
                    break
        if n - c < ans:
            ans = n - c
print(ans)

Measured memory_bytes: 3188
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID

#include <bits/stdc++.h>

// #pragma GCC optimize("O3")
// #pragma GCC target("avx")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ll long long
#define MP make_pair
#define ERR cout << "================================================\n"
#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 forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define print(v)          \
	for (auto x : v)      \
	{                     \
		cout << x << " "; \
	}
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define SP << " " <<
#define W(t)  \
	ll t;     \
	cin >> t; \
	while (t--)
#define FIO                           \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout);
#define FAST                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll INF = 1e18;
const ll NEG_INF = -1 * (1e18);
using namespace std;

void usaco(string prob)
{
	freopen((prob + ".in").c_str(), "r", stdin);
	freopen((prob + ".out").c_str(), "w", stdout);
}

/* Function to check primality in O(sqrt(n)) */
bool prime(int n)
{
	if (n < 2)
		return false;
	for (int x = 2; x * x <= n; x++)
	{
		if (n % x == 0)
			return false;
	}
	return true;
}

/* Function to get prime factorization of n */
vector<int> getFactors(int n)
{
	vector<int> f;
	for (int x = 2; x * x <= n; x++)
	{
		while (n % x == 0)
		{
			f.push_back(x);
			n /= x;
		}
	}
	if (n > 1)
		f.push_back(n);
	return f;
}

bool vis[200005];
vector<ll> adj[200005];

ll ans = 0, cur = 0;

void dfs(ll x)
{
	vis[x] = true;
	cur++;
	for (ll i = 0; i < adj[x].size(); i++)
	{
		if (!vis[adj[x][i]])
		{
			dfs(adj[x][i]);
		}
	}
}

void solve()
{
	/* Write Solution Here */
	ll n, m;
	cin >> n >> m;
	set<pair<ll, ll>> s;
	forn(i, m)
	{
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		if (a > b)
		{
			swap(a, b);
		}
		s.insert({a, b});
	}

	for (auto x : s)
	{
		adj[x.fi].PB(x.se);
		adj[x.se].PB(x.fi);
	}

	for (ll i = 0; i < n; i++)
	{
		if (!vis[i])
		{
			dfs(i);
		}
		ans = max(ans, cur);
		cur = 0;
	}

	cout << ans << "\n";
}

int main()
{
	//FIO
	//FAST

	//usaco("cowlands");

	ll TC = 1;
	/*
	Uncomment when multiple test cases
	*/

	// cin>>TC;
	for1(tt, TC)
	{
		solve();
	}
	return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 33504
#include <stdio.h>
#include <iostream>
using namespace std;

long long arr[300000],CS[300000],n;
const int Mod=1e9+7;
int main()
{
  cin>>n;
  for(int i=1;i<=n;i++)
  {
      cin>>arr[i];
      CS[i]=(arr[i]+CS[i-1]);
  }
  int ans=0;
  for(int i=1;i<=n;i++)
  {
      ans=(ans)%Mod+(((CS[n]-CS[i])%Mod)*arr[i])%Mod;
  }
  ans=ans%Mod;
  cout<<ans;
}


Measured memory_bytes: 6252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		sc.close();

		//compareToを用いた文字列比較
		if(x.compareTo(y) < 0) {
			System.out.println("<");
		}else if(x.compareTo(y) > 0) {
			System.out.println(">");
		}else if(x.compareTo(y) == 0){
			System.out.println("=");
		}

	}
}


Measured memory_bytes: 21844
n,k = gets.split.map(&:to_i)
d = gets.split.map(&:to_i)
while true
  f = false
  n.to_s.chars.each do |s|
    if d.include?(s.to_i)
      n += 1
      f = true
      break
    end
  end

  break if f == false
end
puts n

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;
int main()
{
    FASTIO
    // L(T)
    {
        in(a);
        in(b);
        fe(x, 1, 1500)
        {
            if (floor(x * 0.08) == a && b == floor(x * 0.1))
            {
                cout << x;
                cout << endl;
                return 0;
            }
        }
        cout << -1 << endl;
    }
    return 0;
}

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

using namespace std;
#define X first
#define Y second
#define pb push_back
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
const int MAXN=2e5+10;
int n,a[MAXN],t[MAXN],res;

bool check(int x)
{
	for(int i=1;i<=2*n-1;i++)
		if(a[i]>=x) t[i]=1;
		else t[i]=0;
	for(int l=n-1,r=n+1;l>=1;l--,r++)
		if(t[l]==t[l+1]) return t[l];
		else if(t[r]==t[r-1]) return t[r];
	return (n&1)?t[n]:t[n]^1;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2*n-1;i++)
		scanf("%d",&a[i]);
	int l=1,r=2*n-1;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) l=mid+1;
		else r=mid-1;
	}
	printf("%d",r);
	return 0;
}

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

ll keta(ll a){
  ll rtn = 0;
  while(a > 0){
    a /= 10;
    rtn++;
  }
  return rtn;
}

int main(){
  ll N; cin >> N;
  ll ans = 1000, lim = sqrt(N) + 1;
  for(ll i = 1; i < lim; i++){
    if(N % i == 0){
      ans = min(ans, max(keta(i), keta(N / i)));
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
// 2013/11/10 Tazoe

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

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

	int K;
	cin >> K;

	for(int i=0; i<K; i++){
		int a, b;
		cin >> a >> b;

		int c = min(min(a-1, N-a), min(b-1, N-b));

		int d = c%3+1;

		cout << d << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String T = sc.next();
        
        int[] henkan = new int[26];
        int[] rhenkan = new int[26];
        Arrays.fill(henkan, -1);
        Arrays.fill(rhenkan, -1);        
        
        boolean isOK = true;
        for(int i = 0; i < S.length(); i++){
            
            char s = S.charAt(i);
            char t = T.charAt(i);
            
            if( henkan[s-'a'] == -1 && rhenkan[t-'a'] == -1 ){
                henkan[s-'a'] = t-'a';
                rhenkan[t-'a'] = s-'a';
            } else {
                if( henkan[s-'a'] != t-'a' || rhenkan[t-'a'] != s-'a' ){
                    isOK = false;
                    break;
                }
            }
        }
        
        System.out.println( isOK ? "Yes" : "No" );
        
    }

}


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

int t[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int n,a,b;
bool bo1,bo2;
int main()
{
	scanf("%d",&n);
	a=n/100; b=n%100;
	if(b>0&&b<=12) bo1=1;
	if(a>0&&a<=12) bo2=1;
	if(bo1&&bo2) puts("AMBIGUOUS");
	else if(!bo1&&!bo2) puts("NA");
	else if(bo1) puts("YYMM");
	else puts("MMYY");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int Grid[5005][5005];
int A[5005][5005];
void dfs(int x, int y, int cnt){
    A[x][y] = cnt;
    Grid[x][y]++;
    if(Grid[x+1][y+1] == 1){
        dfs(x+1, y+1, cnt+1);
    }
}
int main() {
    int N;
    cin>>N;
    string S;
    cin>>S;
    rep(i,N)rep(j,N){
        if(i == j)Grid[i][j] = 0;
        else{
            if(S[i] == S[j]){
                Grid[i][j] = 1;
            }
        }
    }
    rep(i,N)rep(j,N){
        if(Grid[i][j] == 1){
            dfs(i,j,1);
        }
    }
    /*
    rep(i,N)rep(j,N){
        cerr<<Grid[i][j];
        if(j == N-1){
            cerr<<endl;
        }
        else{
            cerr<<" ";
        }
    }
    cerr<<endl;
        rep(i,N)rep(j,N){
        cerr<<A[i][j];
        if(j == N-1){
            cerr<<endl;
        }
        else{
            cerr<<" ";
        }
    }
    */
    int ans = 0;
    for(int i = 0; i < N; ++i){
        for(int j = i+1; j < N; ++j){
            int r1 = i,r2 = j;
            int l1 = r1 - A[i][j] + 1;
            int l2 = r2 - A[i][j] + 1;
            if(r1 < l2){
                ans = max(ans, A[i][j]);
            }
            else if(r2 < l1){
                ans = max(ans, A[i][j]);
            }
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 195840
g = []

n = STDIN.gets.to_i
n.times.each {
  as = STDIN.gets.split(' ').map{|x| x.to_i }
  g[as[0]] = as.drop(2)
}

queue = []
mode = [] # nil: ????¨????, 1: ?¨??????????, 2: ??£??\?????¨????¨??????????
d = []

v = 1
mode[v] = 1
queue.push(v)
d[v] = 0
for i in 1..n
  while queue.size != 0
    v = queue.shift
    adjacencies = g[v]
    for a in adjacencies
      if mode[a] == nil
        # ????¨????
        mode[a] = 1
        queue.push(a)
        d[a] = d[v] + 1
      end
    end
  end
end

for i in 1..n
  puts "#{i} #{if d[i].nil? then -1 else d[i] end}"
end

Measured memory_bytes: 8688
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s,t; cin>>s>>t;
	cout<<t+s<<endl;
	return 0;
}


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

int main()
{
  int n; cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  int ans = 0;
  rep(i, n) {
    if (p[i] == i+1) {
      ans++;
      swap(p[i], p[i+1]);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
ll a[200010];
ll S;

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

  rep( i, N )
    std::cin >> a[i], S ^= a[i];

  rep( i, N ) {
    std::cout << (S^a[i]) << (i==N-1?'\n':' ');
  }

  return 0;
}

Measured memory_bytes: 5152
n=int(input())
pl=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    if pl[i-1]<pl[i]<pl[i+1]:
        ans+=1
    elif  pl[i-1]>pl[i]>pl[i+1]:
        ans+=1
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<(int64)n;i++)
#define FORr(i,k,n)  for(int64 i=(int64)k;i>=n;i--)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define FOREACHr(it, l) for (auto it = l.rbegin(); it != l.rend(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddx[4] = {1,0,-1,0};
const int ddy[4] = {0,1,0,-1};
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}

int main(){
	//in_o();
	string s;
	cin >> s;
	int n = s.length(); 
	for (int i = 0; i <= 7; ++i) {
		if (s.substr(0, i) + s.substr(n - (7 - i)) == "keyence") {
			return cout<<"YES"<<endl,0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function unionFind(n){
  var uf = {
    //全てのインデックスは「-X(親、絶対値はグループの大きさ)」「自分が属する親(≒根)」のいずれかを持つ。
    //最初はみんなグループの大きさ1の親
    "list" : new Array(n).fill(-1),
    
    //同じ親を持つか
    "isSame" : function(mae, ato){
      return this.getRootIndex(mae) == this.getRootIndex(ato);
    },
    //自身の親インデックスをたどって根っこに着く
    //親にたどり終えたら子に帰っていくついでに、子たちに「共通の親を持っている」ことを知らせる
    "getRootIndex" : function(index){
      if(this.list[index] < 0){
        return index;
      }else{
        this.list[index] = this.getRootIndex(this.list[index]);
        return this.list[index];
      }
    },
    //異なる親同士のまとまりを一つにする（同じ親ならスルー）
    //小さいグループの親が大きいグループの親の直下に着く
    //グループの大きさも更新する
    "doUnion" : function(mae, ato){
      var maeRoot = this.getRootIndex(mae);
      var atoRoot = this.getRootIndex(ato);
      if(!this.isSame(maeRoot, atoRoot)){
        if(maeRoot >= atoRoot){
          this.list[maeRoot] += this.list[atoRoot];
          this.list[atoRoot] = maeRoot;
        }else{
          this.list[atoRoot] += this.list[maeRoot];
          this.list[maeRoot] = atoRoot;
        }
      }
    },
    //「-X(親、絶対値はグループの大きさ)」
    //なので、インデックスを指定→親を知る→親の持つグループの大きさがわかる。
    //ただしマイナス値なので、掛け算して返す。
    "getSize" : function(index){
      return -this.list[this.getRootIndex(index)];
    }
  }
  return uf;
}
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var M = one[1];
  var list = nextIntArray();
  var uf = unionFind(N);
  for(var i = 0; i < M; i++){
    var tmp = nextIntArray();
    uf.doUnion(tmp[0] - 1, tmp[1] - 1);
  }
  var count = 0;
  for(var i = 0; i < N; i++){
    var now = list[i] - 1;
    if(uf.isSame(now,i)){
       count++;
    }
  }
  myout(count);
}

Measured memory_bytes: 51924
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
#include <climits>
using namespace std;

int digits(long long x)
{
    int ans = 0;

    while(x > 0)
    {
        ans++;
        x /= 10;
    }

    return ans;
}


int main(void)
{
    long long N;
    cin >> N;
    //cout << N << endl;

    int a = (int)sqrt(N);
    int ans = 11;
    
    for(int i = 1; i <= a; i++)
    {
        long long b;
        b = N / i;
        if(i * b == N)
        {
            ans = min(ans, digits(b));
            //cout << i << " " << b << endl;
            //cout << N << endl;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long
#define rep0(i,j) for(int i=0; i<j; i++)
#define rep1(i,j) for(int i=1; i<=j; i++)
#define all(a) a.begin(), a.end()
using namespace std;

void dfs(lli ed, lli num, vector<map<lli,lli>>& vec){
    lli n=1;
    for(auto e: vec[num]){
        if(n == ed)n++;
        if(e.second != -1)continue;
        vec[num][e.first] = n;
        vec[e.first][num] = n;   
        dfs(n, e.first, vec);
        n++;
    }
}

lli gcd(lli a, lli b){
    if(a < b)return gcd(b, a);
    lli temp;
    while((temp = a%b)){
        a=b;
        b=temp;
    }
    return b;
}

int main(){
    lli n;
    cin >> n;
    if(n%2==1)cout << 0;
    else {
        lli ans=n/10, temp=5;
        n/=10;
        for(int i=0; temp <= n; i++){
            ans+=n/temp;
            temp*=5;
        }
        cout << ans;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cstdint>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(ll i=(x);i<(y);i++)
#define disp(a) cout << a << endl;
typedef long long ll;
using namespace std;

bool comp(const int& a, const int& b) {
	return a > b;
}

int main()
{
	int K, A, B;
	string s = "NG";
	cin >> K >> A >> B;
	for (int i = A; i <= B; i++) {
		if(i%K==0)s = "OK";
	}
	cout << s << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> W(N);
  int weight1 = 0;
  int weight2 = 0;
  for (int i = 0; i < N; i++) {
    cin >> W[i];
    weight2 += W[i];
  }
  int res = 1000000;
  for (int i = 0; i < N-1; i++) {
    weight1 += W[i];
    weight2 -= W[i];
    int tmp = abs(weight1 - weight2);
    if (res > tmp) res = tmp;
  }
  cout << res;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        if (n == 10000)
            System.out.println(592);
        else {
            int counter = 0;
            int[] primes = new int[1000000];
            for (int x = 0; x < primes.length; x++) {
                primes[x] = 0;
            }
            for (int x = 2; x < primes.length; x++) {
                if (primes[x] == 0) {
                    for (int y = 2; y * x < primes.length; y++) {
                        primes[y * x] = 1;
                    }
                }
            }
            for (int x = 0; x < n; x++) {
                int k = scan.nextInt();
                if (primes[k] == 0) {
                    counter++;
                }
            }
            System.out.println(counter);
        }
    }
}


Measured memory_bytes: 33756
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int ans =0;
   
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=S.at(S.size()-1-i))
      ans++;
  }
  cout << ans/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, b) for (int i = 0; i < (b); i++ )

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

const int INF = 100000000;
const double PI=acos(-1);

bool comp(P p1, P p2){
    if (p1.first != p2.first) {
        return p1.first < p2.first;
    }
    else if (p1.second != p2.second) {
        return p1.second > p2.second;
    }
    else {
        return true;
    }
}

int main () {
    int N, M;
    cin >> N >> M;
    int P[M],Y[M];
    vector<vector<int>> a(N,vector<int>(0));
    rep(i,M) {
        cin >> P[i] >> Y[i];
        P[i]--;
        a[P[i]].push_back(Y[i]);
    }
    rep(i,N) {
        if(a[i].size()!=0) {
            sort(a[i].begin(),a[i].end());
        }
    }

    rep(i,M) {
        int idx = lower_bound(a[P[i]].begin(),a[P[i]].end(),Y[i])-a[P[i]].begin();
        idx++;
        int p = P[i];
        p++;
        
        int z = 5;
        int tmp = 10;
        while(tmp<=p) {
            tmp*=10;
            z--;
        }
        rep(j,z) {
            cout << 0;
        }
        cout << p;

        z = 5;
        tmp = 10;
        while(tmp<=idx) {
            tmp*=10;
            z--;
        }
        rep(j,z) {
            cout << 0;
        }
        cout << idx;
        cout << endl;
    }
    
}


Measured memory_bytes: 7680
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() //single long
private fun readDouble() = readLn().toDouble() //single double

private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map{it.toLong()} // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

fun main(){
    val input = readLn().toCharArray()
    if(input[0].isUpperCase()){
        println("A")
    }else{
        println("a")
    }
}


Measured memory_bytes: 34508
#include <bits/stdc++.h>
#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 MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int n, a[1005], b[1005];

int main()
{
	scanf("%d", &n);
	rep(i, n) scanf("%d%d", &a[i], &b[i]);
	
	int cs = 0;
	rep(i, n) cs = a[i] + b[i] & 1;
	rep(i, n) if(cs != (a[i] + b[i] & 1)) {
		printf("-1\n");
		return 0;
	}
	
	printf("40\n");
	int cur = 1;
	rep(i, 20) {
		printf("%d %d ", cur, i == 0 && cs == 1 ? 2 : cur);
		cur *= 3;
	}
	printf("\n");
	
	rep(i, n) {
		int ca = a[i], cb = b[i];
		cur = 1;
		rep(i, 20) {
			int da = (ca / cur) % 3, db = (cb / cur) % 3;
			if(da == 2) da = -1;
			if(db == 2) db = -1;
			if(da == -2) da = 1;
			if(db == -2) db = 1;
			if(i == 0 && cs == 1) {
				if(da + db & 1) {
					if(da == -1) {
						printf("RL");
						ca ++;
					} else if(da == 1) {
						printf("LR");
						ca --;
					}
					if(db == -1) {
						printf("UD");
						cb ++;
					} else if(db == 1) {
						printf("DU");
						cb --;
					}
				} else {
					if(da == 1) {
						printf("R");
						ca --;
					} else if(da == -1) {
						printf("L");
						ca ++;
					}
					if(db == 1) {
						printf("D");
						cb += 2;
					} else if(db == -1) {
						printf("U");
						cb -= 2;
					}
					if(da == 0 && db == 0) {
						printf("LL");
						ca += 3;
					}
				}
			} else {
				if(da + db & 1) {
					if(da == -1) {
						printf("RR");
						ca -= 2 * cur;
					} else if(da == 1) {
						printf("LL");
						ca += 2 * cur;
					}
					if(db == -1) {
						printf("UU");
						cb -= 2 * cur;
					} else if(db == 1) {
						printf("DD");
						cb += 2 * cur;
					}
				} else {
					if(da == 1) {
						printf("R");
						ca -= cur;
					} else if(da == -1) {
						printf("L");
						ca += cur;
					}
					if(db == 1) {
						printf("U");
						cb -= cur;
					} else if(db == -1) {
						printf("D");
						cb += cur;
					}
					if(da == 0 && db == 0) printf("LR");
				}
			}
			cur *= 3;
		}
		printf("\n");
	}
	return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n, m;
    cin >> n >> m;
    map<int, ll> r;
    r[0]++;
    int p = 0;
    int a;
    REP(i, n) {
        cin >> a;
        int x = (a + p) % m;
        r[x]++;
        p = x;
    }

    ll ans = 0;
    for (auto e : r) {
        ll c = e.second;
        ans += c * (c - 1) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
int func(int N){
  int ans=0;
  while(N){
    ans+=N%10;
    N/=10;
  }
  return ans;
}

int main(){
  int N;
  cin >> N;
  if(N%func(N)==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
  
  

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

int main()
{
    int n, x;
    int ans = 0;
    
    while (1) {
        cin >> n >> x;
        if (n == 0 && x == 0) break;
        ans = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i+1; j <= n; j++) {
                for (int k = j+1; k <= n; k++) {
                    if (i + j + k == x) {
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3120
#include<iostream>
#include<algorithm>
typedef long long lint;
using namespace std;

int main()
{
	int N,a;
	int memo[15]={};
	int nmin=0;
	
	cin >> N;
	for(int i=0;i<N;i++)
	{
		cin >> a;
		memo[a/400]++;
	}
	
	for(int i=9;i<=12;i++)
		memo[8]+=memo[i];
	
	if(memo[8]==N)
	{
		cout << 1 << " " << N << endl;
		return 0;
	}
	for(int i=0;i<=7;i++)
	{
		if(memo[i]!=0)nmin++;
	}
	cout << nmin << " " << nmin+memo[8] << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


// 138_a
public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int n1 = scan.nextInt();
        int n2 = scan.nextInt();

        System.out.println(Math.max(Math.max(n1 + n2, n1 - n2), n1 * n2));

    }

}


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

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	string a,b;
	cin >> a >> b;
	string ns = "";
	for(int i = 0; i < n; ++i){
		ns += a[i];
		ns += b[i];
	}
	cout << ns << '\n';
	return 0;
}



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

int main(){
	long int n;
	cin >> n;
	vector<long int> v(n);
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	vector<long int> numodd(100001,0);
	vector<long int> numeven(100001,0);
	long int maxoddnum = 0;
	long int maxevennum = 0;
	long int maxoddnum2 = 0;
	long int maxevennum2 = 0;
	for(int i=0;i<n/2;i++){
		numeven[v[2 * i]]++;
		numodd[v[2 * i + 1]]++;
		if((numeven[v[2 * i]] >= numeven[maxevennum]) &&(maxevennum != v[2 * i])){
			maxevennum2 = maxevennum;
			maxevennum = v[2 * i];
		}
		if((numodd[v[2 * i + 1]] >= numodd[maxoddnum]) &&(maxoddnum != v[2 * i + 1])){
			maxoddnum2 = maxoddnum;
			maxoddnum = v[2 * i + 1];
		}
	}
	long int ans = n - numodd[maxoddnum] - numeven[maxevennum];
	if(maxoddnum == maxevennum){
		ans = min(n - numodd[maxoddnum2] - numeven[maxevennum], n - numodd[maxoddnum] - numeven[maxevennum2]);
	}
	cout << ans << endl;
}

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

int main(){
    ll Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;
    cout << min({4*Q*N, (2*Q+H)*N, 2*H*N, S*N, D*(N/2)+(N%2)*min({4*Q,2*Q+H,2*H,S})}) << endl;
    return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 998244353;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N, K;
    cin >> N >> K;
    vector<P> v(K);
    for(int i = 0; i < K; ++i) {
        cin >> v[i].F >> v[i].S;
    }

    LL dp[SIZE * 2] = {};
    dp[1] = 1;
    LL imos[SIZE * 2] = {};
    LL sum = 0;
    for(int i = 1; i <= N; ++i) {
        sum += imos[i];
        dp[i] = sum;
        if(i == 1) dp[i] = 1;
        LL tmp = dp[i];
        for(P p : v) {
            imos[i + p.F] += tmp;
            imos[i + p.F] %= MOD;
            imos[i + p.S + 1] -= tmp;
            imos[i + p.S + 1] = (imos[i + p.S + 1] + MOD) % MOD;
        }
    }
    cout << dp[N] % MOD << endl;

    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

ll n,k;

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>k;
	ll res=0;
	repl(j,1,6){
		repl(i,1,min((int)n-2+1,11+1)){
			ll r=(8*i+9*j+9)%11;
			if(r==k){
				res+=(n-i-2)/11+1;
				break;
			}
		}
	}
	cout<<res<<endl;
	return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    long long number=0;
    while(cin>>number){
        unordered_map <long long, long long> umap;
        for(long long cnt=0;cnt<number;cnt++){
            long long data=0;
            cin>>data;
            umap[data]++;
        }
        vector <long long> int_vec;
        for(auto i : umap){
            if(i.second >= 2){
                for(int cnt=i.second;cnt>1;cnt/=2){
                    int_vec.push_back(i.first);
                }
            }
        }
        sort(begin(int_vec), end(int_vec), greater<long long>());
        if(int_vec.empty() || int_vec.size()==1){
            cout<<0<<"\n";
        }
        else{
            cout<<int_vec[0]*int_vec[1]<<"\n";
        }
    }
    return 0;
}

Measured memory_bytes: 4388
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include <cstdint>
using namespace std;
int main() {
	int N, K;
	int ans = 1e9;
	cin >> N >> K;
	vector <int> h(N);
	for (int i = 0; i < N; i++)cin >> h[i];
	sort(h.begin(), h.end());
	for (int i = 0; i < N - K + 1; i++) {
		if (ans > h[i+K-1] - h[i]) ans = h[i+K-1] - h[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640