akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

struct Node {
  int to;
  Node() {}
  explicit Node(int _to) {
    to = _to;
  }
};

void dfs(int v, vector<int> &used, const vector<vector<Node>> &graph) {
  if (used[v]) return;
  used[v] = 1;
  for (auto &e : graph[v]) {
    dfs(e.to, used, graph);
  }
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<Node>> graph(N, vector<Node>());
  for (int i=0; i < M; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;y--;
    graph[x].push_back(Node(y));
    graph[y].push_back(Node(x));
  }
  vector<int> used(N, 0);
  int res = 0;
  for (int i=0; i < N; i++) {
    if (used[i]) continue;
    res++;
    dfs(i, used, graph);
  }
  cout << res << endl;
}


Measured memory_bytes: 10752
<?php
// 整数の入力
$strA = trim(fgets(STDIN));
$strB = trim(fgets(STDIN));

$strA = str_split($strA);
$strB = str_split($strB);

$count = 0;
for ($i=0; $i < count($strA); $i++) { 
    if ($strA[$i] != $strB[$i]) {
        $count++;
    }
}

# 出力
echo $count . "\n";
?>

Measured memory_bytes: 41260
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

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

    int n;
    cin >> n;

    vector<LL> a(n);

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

    vector<LL> table(n+1);

    table[0] = 0;

    for(int i = 1; i < n+1; i++){
        table[i] = table[i-1] + i;
    }



    int t = INF;
    bool k = false;

    LL result = 0;
    LL premax = 0;
    LL presumx = a[0];
    LL presump = a[0];
    LL sumx = a[0];
    LL sump = a[0];
    int count = 1;

    for(int j = 0; j < n; j++){
        sumx = presumx;
        sump = presump;

        LL pp = premax;

        /*cout << j << " ";
        cout << premax << " ";
        cout << sumx << " ";
        cout << sump << endl;*/
        for(int i = premax+1; i < n; i++){
            sumx = sumx^a[i];
            sump = sump+a[i];
            if(sumx == sump){
                count++;
                pp = i;
                presumx = sumx;
                presump = sump;
            }else{

                //cout << count << endl;
                if(k && premax >= j){
                    result += table[count];
                    result += (premax-j+1)*count;
                }else{
                    result += table[count];
                }
                k = true;
                //cout << result << endl;
                presumx ^= a[j];
                presump -= a[j];
                premax = pp;
                break;
            }
        }
        if(pp == n-1){
            t = j;
            break;
        }
        count = 0;
    }

    if(k && premax >= t){
        result += table[count];
        result += (premax-t+1)*count;
    }else{
        result += table[count];
    }
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;

int n,ff[15],hi;
double ans,sum; 
pii a[15];
int sqr(int x){
	return x*x;
}
int main(){
	scanf("%d",&n); hi=1;
	for (int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
		ff[i]=i;hi*=i;
	}
	while (true){
		sum=0;
		for (int i=2;i<=n;i++){
			sum+=sqrt(sqr(a[ff[i]].x-a[ff[i-1]].x)+sqr(a[ff[i]].y-a[ff[i-1]].y));
		}
		ans+=sum;
		next_permutation(ff+1,ff+1+n);
		for (int i=1;i<=n;i++){
			if (ff[i] != i)
			break;
			if (i == n){
				printf("%.10lf\n",ans/hi);
				return 0;
			}
		}
	}
//	printf("%.10lf\n",ans/hi);
	return 0;
}

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

int main(){
  long long n, ans=1;
  int flag = 0;
  cin >> n;

  rep(i, n){
    long long a;
    cin >> a;
    if(a==0||ans==0){
      cout << 0;
      return 0;
    }
    long long tmp = 1000000000000000000/a;
    if(ans > tmp){
      flag = 1;
    }
    if(flag==0)ans *= a;
  }

  if(flag==1)cout << -1;
  else cout << ans;
  return 0;
}


Measured memory_bytes: 3652
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
b = [list(map(int,input().split())) for _ in range(n)]
ans = []
for i in range(1,2**10):
    dp = [0]*n
    for j in range(10):
        if i >> j & 1:
            for k in range(n):
                dp[k] += a[k][j]
    ans.append(sum([b[x][y] for x,y in enumerate(dp)]))
print(max(ans))

Measured memory_bytes: 3444
#include <iostream>

using namespace std;

int main() {

	int a = 0;
	int b = 0;
	int c = 0;

	cin >> a >> b >> c;

	if (a > b) {

		if (a < c) {

			cout << b << " " << a << " " << c << endl;

		}
		else if (b > c) {

			cout << c << " " << b << " " << a << endl;

		}
		else {

			cout << b << " " << c << " " << a << endl;

		}

	}
	else if(a < b){

		if (b < c) {

			cout << a << " " << b << " " << c << endl;

		}
		else if (a > c) {

			cout << c << " " << a << " " << b << endl;

		}
		else {

			cout << a << " " << c << " " << b << endl;

		}

	}

	return 0;

}

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long long n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    cout << max({(n-1)/a,(n-1)/b,(n-1)/c,(n-1)/d,(n-1)/e})+5 << endl;
    
 }    


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N;
int A[210];
int main() {
	cin >> N;
	int p, q;
	for(p=0; p<N; p=p+1)
	{
	    cin >> A[p];
	}
	int output=50;
	for(p=0; p<N; p=p+1)
	{
	    for(q=0; A[p]%2==0; q=q+1)
	    {
	        A[p]=A[p]/2;
	    }
	if(output>q) output=q;
	}
	cout << output <<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

H, W = map(int, input().split())
field = []
q = deque()
for i in range(H):
    line = []
    A = input()
    for j in range(W):
        if A[j] == ".":
            line.append(True)
        else:
            line.append(False)
            q.append(((j, i), 0))
    field.append(line)

dirs = [(1, 0), (0, 1), (-1, 0), (0, -1)]

ans = 0

while len(q) != 0:
    (x, y), d = q.popleft()
    ans = max(d, ans)
    for dir in dirs:
        nx = x + dir[0]
        ny = y + dir[1]
        if 0 <= nx <= W - 1 and 0 <= ny <= H - 1 and field[ny][nx]:
            field[ny][nx] = False
            q.append(((nx, ny), d+1))

print(ans)


Measured memory_bytes: 134616
#include<iostream>
using namespace std;
static const int N = 100;

int main(){
    int M[N][N];
    int n, u, k, v;
    
    cin>>n;
    
    for(int i = 0;i<n;i++){
        for(int j = 0;j<n;j++) M[i][j]=0;
    }
    
    for(int i = 0;i<n;i++){
        cin>>u>>k;
        u--;
        for(int j = 0;j<k;j++){
            cin>>v;
            v--;
            M[u][v]=1;
        }
    }
    
    for(int i = 0;i<n;i++){
        for(int j = 0;j<n;j++){
            if(j) cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define REP(i,N) for(int i=0;i<N;i++)
#define print(S) cout<<S<<endl;
using namespace std;
long long int hist[1001]={0};
long long int kosu;
void soiusu(int N){
	for(int i=2;i<=N;i++){
		if(N%i==0){
			hist[i]++;
			N/=i;
			i--;
		}
	}
}
int main() {
	int N;
	kosu=1;
	long long int a,waru= 1000000007;
	cin>>N;
	for(int i=2;i<=N;i++){
		soiusu(i);
	}
	for(int i=2;i<=N;i++){
		kosu*=(hist[i]+1);
		kosu%=waru;
	}
	print(kosu);
	return 0;
}

Measured memory_bytes: 256
n,k,q=map(int,input().split())
l=[0 for i in range(n)]
for i in range(q):
    a = int(input())
    l[a-1] = l[a-1] + 1
for x in l:
    if x <= q-k:
        print('No')
    else:
        print('Yes') 

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N, A; cin >> N >> A;
	VL x(N);
	FOR(i, 0, N) {
		cin >> x[i];
		x[i] -= A;
	}

	map<int, LL>dp;
	dp[0] = 1;
	FOR(i, 0, N) {
		map<int, LL>nx;
		for (auto it : dp) {
			nx[it.first + x[i]] += it.second;
			nx[it.first] += it.second;
		}

		nx.swap(dp);
	}

	ans = dp[0]-1;

	cout << ans << "\n";

	return 0;
}

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

#define ll long long int

ll dp[101][100001];

struct knp{
	ll ww, vv;
};

ll knapsack(ll w, ll n, knp ks[]){
	if(w == 0 || n == 0){
		dp[n][w] = 0;
		return 0;
	}
	if(dp[n][w] != 0)
		return dp[n][w];
	if(ks[n-1].ww > w){
		ll res = knapsack(w,n-1,ks);
		dp[n][w] = res;
		return res;
	}
	ll res = max(ks[n-1].vv + knapsack(w-ks[n-1].ww,n-1,ks), knapsack(w,n-1,ks));
	dp[n][w] = res;
	return res;
}

bool cmp(knp a, knp b){
	if(a.ww == b.ww)
		return a.vv > b.vv;
	return a.ww > b.ww;
}

int main(){
	ll n,w;
	cin>>n>>w;
	knp ks[n];
	for(int i=0;i<n;i++)
		cin>>ks[i].ww>>ks[i].vv;
	ll res = knapsack(w,n,ks);
	cout<<res;
	return 0;
}

Measured memory_bytes: 78080
N = int(input())
H = list(map(int, input().split()))
for i in range(N-1, 0, -1):
    if H[i-1] > H[i]:
        H[i-1] -= 1
print('Yes' if all([H[i] <= H[i+1] for i in range(N-1)]) else 'No')

Measured memory_bytes: 64228
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>

int main(void){
    char S[30];
    scanf("%s", S);
    int i;
    int hist['z'+1] = {0};
    for(i=0; i<=strlen(S)-1; i++) {
        if(hist[S[i]] > 0) {
            printf("no\n");
            return 0;
        }
        else {
            hist[S[i]]++;
        }
    }
    printf("yes\n");
    return 0;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

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

    string s; cin >> s;
    cout << (((s.size() % 2) ^ (s[0] == s[s.size() - 1])) ? "First" : "Second") << endl;

    return 0;
}

Measured memory_bytes: 512
count = [0]*26
while True:
    try:
        S = input().lower()
        for i in S:
            if 96 < ord(i) < 124:
                count[ord(i)-97] += 1
    except:
        break
for i in range(26):
    print(f"{chr(i+97)} : {count[i]}")


Measured memory_bytes: 5572
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<set>
#include<stdio.h>
#include<ctype.h>
using namespace std;
int main()
{
	long long int n;
	cin >> n;
	long long int a = n, b = 0;
	long long int x = 0, y = 0;
	int h = sqrt(n);
	for (long long int i = 1; i < h+1; i++)
	{
		if (n % i == 0)
		{
			
			b = n/i;
			if (b - i < a)
			{
				
				a = b - i;
				x = i;
				y = n / x;
			}
		}
	}
	
	cout << x + y - 2 << endl;
}


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

int power(int a, int b){
    int powered=1;
    for(int i=0; i<a; i++){
        powered *= b;
    }
    return powered;
}

int main(){
    int N, K; cin >> N >> K;
    int flag=1, digit=-1;
    while(flag){
        digit++;
        if(power(digit, K) > N){
            flag = 0;
        }
    }
    cout << digit << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays; //追加

class Main{
    public static void main(String[] args){
	//標準入力
	Scanner scanner = new Scanner(System.in);
	int N = scanner.nextInt();
	int A[] = new int[N];

	String ans; //答え表示用の変数の追加	

	for(int i = 0;i < N; i++){
	    A[i] = scanner.nextInt();
	    
	}
        
	for(int i = 0;i < A.length;i++){
	    int v = A[i];
	    int j = i-1;
	    while(j >= 0 && A[j] > v){
		A[j+1] = A[j];
		j--;
	    };
		A[j+1] = v;
		
		ans = Arrays.toString(A); //文字列に変換する
		ans = ans.replaceAll(",", ""); //","を消去
		ans = ans.replace("[", ""); // "["を消去
		ans = ans.replace("]", ""); // "]"を消去
	    System.out.println(ans);
	}
    }
}



Measured memory_bytes: 32220
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::input;
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};

fn main() {
    input! {
        N: usize,
    }
    let mut ans = 0;
    for a in 1..N {
        for b in a..N {
            let c = (N as isize) - ((a * b) as isize);
            if c > 0 {
                if a == b {
                    ans += 1;
                } else {
                    ans += 2;
                }
            } else {
                break;
            }
        }
    }
    println!("{}", ans);
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

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

// Problem Specific Parameter:

int num[26];

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

	rep(i,n){
		string s;
		cin >> s;
		num[s[0]-'A']++;
	}


	priority_queue<int> q;
	rep(i,26) q.push(num[i]);

	int ans=0;

	while(1){
		int ary[26];
		rep(i,k) ary[i]=q.top(),q.pop();
		bool ok=true;
		rep(i,k) if(ary[i]<=0) ok=false;
		if(ok==false) break;
		ans++;
		rep(i,k) q.push(ary[i]-1);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <numeric>
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>
#include <iomanip>

using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(ll i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
const ll MOD = 1e9 + 7;
set<char> alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };

int main() {
    int N, K;
    cin >> N >> K;
    vll x(N + 1);
    repp(i, N) cin >> x[i];
    vll ans;
    repp(i, N - K + 1) {
        int a = x[i];
        int b = x[i + K - 1];
        ans.push_back(abs(a) + abs(a - b));
        ans.push_back(abs(b) + abs(a - b));
    }
    sort(ans);
    cout << ans[0] << endl;
}


Measured memory_bytes: 2172
//written_by: Poushi
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
   int n,k,i;
   scanf("%d %d", &n, &k);
   int ara[n];
   for(i=0; i<n; i++)
    scanf("%d", &ara[i]);
    for(i=k;i<n;i++)
    {
        if(ara[i]>ara[i-k]) printf("Yes\n");
        else printf("No\n");
    }
}


Measured memory_bytes: 2436
#include<stdio.h>
#define NIL -1
#define MAX 500001
struct node{
  int left;
  int right;
  int key;
};
int count, root = NIL;
void Find(struct node*, int);
void Insert(struct node*, int);
void Delete(struct node*, int);
void Dispm(struct node*, int);
void Dispp(struct node*, int);
int main(void)
{
  struct node table[MAX];
  int i, n, data;
  char command[8];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%*c%s", command);
    if (command[0] == 'f') {
      scanf("%d", &data);
      Find(table, data);
    } else if (command[0] == 'i') {
      scanf("%d", &data);
      Insert(table, data);
    } else if (command[0] == 'd') {
      scanf("%d", &data);
      Delete(table, data);
    }else if (command[0] == 'p') {
      Dispp(table, root);
      putchar('\n');
      Dispm(table, root);
      putchar('\n');
    }
  }
  return 0;
}
void Find(struct node *table, int key)
{
  int u = root;
  while (u != NIL) {
    if (table[u].key == key) {
      printf("yes\n");
      return;
    } else if (table[u].key > key) {
      u = table[u].left;
    } else {
      u = table[u].right;
    }
  }
  printf("no\n");
}
void Insert(struct node *table, int key)
{
  int parent = NIL, u = root;
  while (u != NIL) {
    parent = u;
    if(table[u].key == key) return;
    else if (table[u].key > key) {
      u = table[u].left;
    }else {
      u = table[u].right;
    }
  }
  table[count].key = key;
  table[count].left = table[count].right = NIL;
  if (parent == NIL) {
    root = count++;
  } else if(table[parent].key > key) {
    table[parent].left = count++;
  } else {
    table[parent].right = count++;
  }
}
void Delete(struct node *table, int key)
{
  int u = root, del, parent = NIL;
  while (u != NIL && table[u].key != key) {
    parent = u;
    if (table[u].key > key) {
      u = table[u].left;
    } else {
      u = table[u].right;
    }
  }
  if (u == NIL) return;
  if (parent == NIL) {
    root = NIL;
    return;
  }else {
    while (1){
      if (table[u].left == NIL) {
        if (table[parent].left == u) table[parent].left = table[u].right;
        else table[parent].right = table[u].right;
        break;
      } else if (table[u].right == NIL) {
        if (table[parent].left == u) table[parent].left = table[u].left;
        else table[parent].right = table[u].left;
        break;
      } else {
        int temp = table[u].right;
        parent = u;
        while (table[temp].left != NIL) {
          parent = temp;
          temp = table[temp].left;
        }
        table[u].key = table[temp].key;
        u = temp;
      }
    }
  }
}
void Dispm(struct node *table, int u)
{
  if (u == NIL) return;
  printf(" %d", table[u].key);
  Dispm(table, table[u].left);
  Dispm(table, table[u].right);
}
void Dispp(struct node *table, int u)
{
  if (u == NIL) return;
  Dispp(table, table[u].left);
  printf(" %d", table[u].key);
  Dispp(table, table[u].right);
}


Measured memory_bytes: 6464
def main():
    n,m=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*m]
    if n==1:
        for a,b in ab:
            print(min(a,b))
        return
    for a,b in ab:
        while a!=b:
            a,b=min(a,b),max(a,b)
            b=(b+n-2)//n
        print(a)
    
main()

Measured memory_bytes: 67928
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Pair = Tuple!(int, "a", int, "b");

void main() {
    int N;
    scan(N);
    auto ans = (N + 110) / 111 * 111;
    writeln(ans);
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
  int n;
  scanf("%d",&n);
  unsigned long long i,j,k,l,d[n];
  unsigned long long t[n],a,b,ans,r;
  for(i=0;i<n;i++){
    scanf("%lld",&t[i]);
  }
  ans=1;
  for(i=1;i<n;i++){
    ans*=t[i-1];
    if(ans>t[i]){
      a=ans;
      b=t[i];
    }
    else{
      a=t[i];
      b=ans;
    }
    r=a%b;
    while(r!=0){
      a=b;
      b=r;
      r=a%b;
    }
    ans/=b;
  }
  ans*=t[n-1];
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#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 <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n; cin >> n;
  lint ans = 0;

  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0) continue;
    if (i % 5 == 0) continue;
    ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define PI 3.141592653589793
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  cin >> s >> t;
  vvll a(26, vll(0));
  int ssize = s.size(), tsize = t.size();
  for(int i = 0; i < ssize; i++){
    a.at(s.at(i) - 'a').push_back(i);
  }
  ll ans = 0LL;
  int now = -1;
  for(int i = 0; i < tsize; i++){
    int c = t.at(i) - 'a';

    if(!a.at(c).size()){
      cout << -1 << endl;
      return 0;
    }

    auto ite = upper_bound(ALL(a.at(c)), now);
    if(ite != a.at(c).end()){
      ans += (*ite - now);
      now = *ite;
    }
    else{
      ans += ssize - now - 1;
      ans += a.at(c).at(0) + 1;
      now = a.at(c).at(0);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using Point = complex<ld>;

int main()
{
	int n;
	cin >> n;
	vector<Point> p(n);
	for (int i = 0, x, y; i < n; i++) {
		cin >> x >> y;
		p[i] = Point(x, y);
		if (i) p[i] -= p[0];
	}
	ld res = 0;
	for (int i = 1; i + 1 < n; i++) {
		res += p[i].real() * p[i + 1].imag() - p[i].imag() * p[i + 1].real();
	}
	cout << fixed << setprecision(1) << res / 2 << endl;
	return 0;
}

Measured memory_bytes: 3232
#include <stdio.h>

/*int isPrime(int x){
  int i;
  if(x<2) return 0;
  else if(x==2) return 1;
  if(x%2==0) return 0;
  for(i=3; i*i<=x; i+=2){
    if(x%i==0) return 0;
  }
  return 1;
}

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

int main(){
  int n, i, j, x, count=0, dis=0;

  scanf("%d", &n);
  //for(i=0; i<n; i++) scanf("%d", &A[i]);
  for(i=0; i<n; i++){
    scanf("%d", &x);
    if(x<2) dis++;
    else if(x==2){
      count++;
      continue;
    }
    else if(x==3){
      count++;
      continue;
    }
    else if(x%2==0) dis++;
    else if(dis==0){
      for(j=3; j*j<=x; j+=2){
        if(x%j==0) dis++;
      }
    }
    if(dis==0) count++;
    dis = 0;
  }

  printf("%d\n", count);

  return 0;
}



Measured memory_bytes: 2044
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'

//DP法
//a より b の方が小さかったら、a を b に置き換える (true)、そうでなかったら、何もしない(false)
template <class T>
inline bool chmin(T &a, T b) //change minimum
{
        if (a > b)
        {
                a = b;
                return true;
        }
        return false;
}

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

typedef long long ll; //64bit型
using namespace std;
// const long long INF = 1LL << 60; //無限大の値
const ll INF = 10000000000;

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

        ll a[100010][3];
        ll dp[100010][3];

        rep(i, 100010) { rep(j, 3) cin >> a[i][j]; }
        rep(i, 100010) { rep(j, 3) dp[i][j] = 0; }

        rep(i, N)
        {
                rep(j, 3)
                {
                        rep(k, 3)
                        {
                                if (k == j)
                                        continue;
                                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
                        }
                }
        }
        ll res = 0;
        rep(i, 3) { chmax(res, dp[N][i]); }
        cout << res << endl;

        return 0;
}

Measured memory_bytes: 4992
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

b1 = [a1[0]]
for i in range(1, n):
    b1.append(b1[i-1]+a1[i])

b2 = [a1[0]+a2[0]]
for i in range(1, n):
    tmp = max(b1[i]+a2[i], b2[i-1]+a2[i])
    b2.append(tmp)

print(b2[-1])


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

using namespace std;

int main() {
    int h, n;
    cin >> h >> n;
    long long dp[h + 1];
    for (int i = 0; i < h + 1; i++) dp[i] = 1000000000000000;
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        int a, b;
        cin >> a >> b;
        for (int j = 0; j <= h; j++) {
            int index = j - a < 0 ? 0 : j - a;
            dp[j] = min(dp[j], dp[index] + b);
        }
    }
    cout << dp[h] << endl;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int color[] = new int[num];
		for(int i = 0; i < num; i ++) {
			color[i] = sc.nextInt();
		}

		int index[] = new int[2 * (int) Math.pow(10, 5) + 10];
		int same[] = new int[num];
		for(int i = 0; i < num; i ++) {
			same[i] = index[color[i]] - 1;
			index[color[i]] = i + 1;
		}
		long dp[] = new long[num];
		dp[0] = 1;
		for(int i = 1; i < num; i ++) {
			if(color[i - 1] == color[i] || same[i] < 0) {
				dp[i] = dp[i - 1];
			}else {
				dp[i] = mod(dp[i - 1] + dp[same[i]]);
			}
		}
		System.out.println(dp[num - 1]);
	}

	static long divisor = (long)Math.pow(10, 9) + 7;
	public static long mod(long i) {
		return i % divisor + ((i % divisor) < 0 ? divisor : 0);
	}
}

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

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

    rep(i, 7) {
        if (s.substr(0, i) + s.substr(s.size() - 7 + i) == "keyence") {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(void)
{
	int number,i,j,k,l,count=0;

	while(scanf("%d",&number) != EOF)
	{
		for(i=0;i<10;i++)
		{
			for(j=0;j<10;j++)
			{
				for(k=0;k<10;k++)
				{
					for(l=0;l<10;l++)
					{
						if(i + j + k + l == number) count++;
					}
				}
			}
		}
		printf("%d\n",count);
		count = 0;
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int act[n][3];
    for (int i = 0; i < n; i++)
    {
        cin >> act[i][0] >> act[i][1] >> act[i][2];
    }

    int dp[n][3];
    dp[0][0] = act[0][0];
    dp[0][1] = act[0][1];
    dp[0][2] = act[0][2];

    for (int i = 1; i < n; i++)
    {
        dp[i][0] = act[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = act[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = act[i][2] + max(dp[i - 1][1], dp[i - 1][0]);
    }

    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));
}

Measured memory_bytes: 5896
#include <bits/stdc++.h>
// #pragma GCC optimization ("O3,unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
using namespace std;

#define _ << ": " <<
#define watch1(var1) (cerr << (#var1) _ var1 << '\n')
#define watch2(var1, var2) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << '\n';
#define watch3(var1, var2, var3) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << ", " << (#var3) _ var3 << '\n';
#define wloop(size, arr) cerr << (#arr) << ": "; for (int i = 0; i < size; i++) cerr << arr[i] << " \n"[i+1 == size];

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ints(a...) int a; read(a)
#define longs(a...) int64_t a; read(a)

void solve() {
    longs(n);
    deque<char> dq;
    while (n) {
        n--;
        dq.emplace_front(n % 26 + 'a');
        n /= 26;
    }
    while (!dq.empty()) {
        cout << dq.front();
        dq.pop_front();
    }
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1; 
    // cin >> T;
    while (T--) solve();
    return 0;
}

Measured memory_bytes: 3596
'use strict'

function main(s) {

  s = s.split('\n')
  const str = s[0];
  const len = str.length;
  const k = Number(s[1]);
  const chars = [...new Set(str.split(''))].sort();
  const dic = new Set();

  let charIndex = 0;
  while (dic.size < k) {

    for (let i = 0; i < len; i++) {
      let j = 1;
      if (str.slice(i, i + j) !== chars[charIndex]) continue;

      while (i + j <= len && j <= 5) {
        dic.add(str.slice(i, i + j));
        j += 1;
      }
    }

    charIndex += 1;
  }

  const ans = [...dic].sort()[k - 1];
  console.log(ans);
}

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


Measured memory_bytes: 8088
#include <iostream>

using namespace std;
long long a[1000010];
int main(){
    long long i,n,m;
    cin >> n >> m;
    for(i=0;i<m;i++){
        cin >> a[i];
        n -= a[i];
    }
    if(n>=0) cout << n << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 3656
# include <iostream>
# include <vector>
# include <string>
# include <algorithm>

using namespace std;

int main()
{
    int n, L;
    cin >> n >> L;
    vector<string> v;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        v.push_back(s);
    }

    sort(v.begin(), v.end());
    for(int i = 0; i < n; i++) {
        cout << v[i];
    }

    return 0;

}


Measured memory_bytes: 256
n = gets.chomp.to_i
lines = gets.chomp.split(' ').map(&:to_i).sort.reverse
num = 0

(n-2).times do |i|
  j = i + 1
  k = n - 1
  while j < k do
    if lines[i] < lines[j] + lines[k]
      num += k - j
      j += 1
    else
      k -= 1
    end
  end
end

print(num)


Measured memory_bytes: 1912
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
b = [list(map(int, input().split())) for _ in range(h)]
c = [[abs(a[i][j] - b[i][j]) for j in range(w)] for i in range(h)]
dp = [[0] * (13000 * (w + 1)) for _ in range(h + 1)]
dp[1][0] = 1
dp[0][13000] = 1
for i in range(1, h + 1):
    for j in range(1, w + 1):
        x = c[i - 1][j - 1]
        for k in range(13000):
            y = 0
            if k + x <= 12999:
                dp[i][13000 * j + k] |= (dp[i - 1][13000 * j + k + x] | dp[i][13000 * (j - 1) + k + x])
            dp[i][13000 * j + k] |= (dp[i - 1][13000 * j + abs(k - x)] | dp[i][13000 * (j - 1) + abs(k - x)])
for i in range(13000):
    if dp[h][13000 * w + i]:
        ans = i
        print(ans)
        exit()

Measured memory_bytes: 741120
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil
(defun main ()
  (declare #.OPT
           (inline set-difference))
  (let* ((n (read))
         (x (read))
         (end (- (* 2 n) 1))
         (seq (loop for i from 1 to end collect i))
         (res (make-array end :element-type 'uint32))
         (out (make-string-output-stream :element-type 'base-char)))
    (declare (uint32 n x))
    (cond ((or (= x 1) (= x end))
           (println "No"))
          ((= n 2)
           (format t "Yes~%1~%2~%3~%"))
          (t
           (let ((fixed (if (> x 2)
                            (list (- x 2) x (+ x 1) (- x 1))
                            (list (+ x 2) x (- x 1) (+ x 1)))))
             (setf (aref res (- n 2)) (elt fixed 0)
                   (aref res (- n 1)) (elt fixed 1)
                   (aref res n) (elt fixed 2)
                   (aref res (+ n 1)) (elt fixed 3))
             (setf seq (set-difference seq fixed
                                       :test (lambda (x y)
                                               (declare (uint32 x y))
                                               (= x y))))
             (loop for i from 0 below (- n 2)
                   for a = (pop seq)
                   do (setf (aref res i) a))
             (loop for i from (+ n 2) below end
                   for a = (pop seq)
                   do (setf (aref res i) a))
             (println "Yes")
             (loop for a across res
                   do (println a out)
                   finally (write-string (get-output-stream-string out))))))))

#-swank(main)


Measured memory_bytes: 28392
n=int(input())
list=[]

for i in range(n):
    s,p=map(str,input().split())
    list.append([s,int(p),i])

list=sorted(list)
del_list=[]

while len(list)!=0:
    j=0
    list_same_s=[]
    city=list[0][0]
    list_same_s.append([list[0][1],list[0][2]])
    list.pop(0)
    for i in range(len(list)):
        if list[i][0]==city:
            list_same_s.append([list[i][1],list[i][2]])
            j=j+1
    while j!=0:
        list.pop(0)
        j=j-1
    list_same_s=sorted(list_same_s)
    for i in range(len(list_same_s)):
        print(list_same_s[len(list_same_s)-i-1][1]+1)


Measured memory_bytes: 3064
import java.util.Scanner;

fun main (args : Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    var H = input.nextLong()
    var attackCount = 0L
    
    while (H > 0) {
      attackCount = (attackCount shl 1) or 1
      H = (H shr 1)
    }
    
    println(attackCount)
  }
}

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

int main(){
    long long int n;
    cin >> n;
    long long int a[n];
    long long int s[n];
    long long int ss = 0, count = 0;
    for(long long int i = 0; i < n; i++){
        cin >> a[i];
        ss += a[i];
        s[i] = ss;
        if(ss == 0) count++;
    }
    sort(s, s+n);
    long long int t = 0;
    for(long long int i = 0; i < n-1; i++){
        if(s[i] == s[i+1]){
            t++;
        }
        else{
            count += t*(t+1)/2;
            t = 0;
        }
        if(i == n-2) count += t*(t+1)/2;
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3328
// Problem : A - Lucky 7
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	string s = to_string(n);
	REP(i, 3) {
		if (s[i] == '7') { cout << "Yes\n"; return 0; }
	}
	cout << "No\n";
	return 0;
}
 


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

int main(){
  string s;
  cin >> s;
  int size = s.size();
  string result;
  if (size <= 2){
    result = s;
  }else{
    string size_string = to_string(size-2);
  	result = s[0] + size_string + s[size-1];
  }
  
  cout << result << endl;
}


Measured memory_bytes: 888
import math

a,b,x = map(int, input().split())

if x >= a*a*b / 2:
  tan = ((a*a*b - x) * 2) / a**3
  print(math.degrees(math.atan(tan)))

else:
  tan = 2*x / (a*b*b)
  print(90 - math.degrees(math.atan(tan)))

Measured memory_bytes: 9264
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#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 (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    unordered_map<string,int> m;
    int n;
    cin>>n;
    int maxi=0;
    while(n--){
        string a;
        cin>>a;
        m[a]++;
    }
    int l;
    cin>>l;
    while(l--){
        string a;
        cin>>a;
        m[a]--;
    }
    for(pair<string,int> i:m){
        maxi = max(maxi,i.se);
    }
    cout<<maxi<<endl;
    return 0;
}



Measured memory_bytes: 3640
n=int(input())
a=[]
b=[]
for i in range(n):
    num=int(input())
    a.append(num)
    b.append(num)
b.sort(reverse=True)
x=a.count(b[0])
for i in range(n):
    if(a[i]==b[0]):
        if(x==1):
            print(b[1])
        else:
            print(b[0])
    else:
        print(b[0])


Measured memory_bytes: 14120
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define vec vector<int>a(n)
#define soot(a) sort(a.begin(),a.end())
/*int n;
cin >> n;
vector<int>a(n);
rep0(i, n - 1)cin >> a[i];*/
using namespace std;
int main() {
	int a;
	cin >> a;
	int count = 0;
	rep0(i, 25) {
		rep0(j, 15) {
			if (i * 4 + j * 7 == a)++count;
		}
	}
	if (count == 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}

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

#define MAX_N 100

int N;
int L[MAX_N];

int main() {
    std::cin >> N;
    for (int i=0; i<N; ++i) std::cin >> L[i];
    std::sort(L, L+N, std::greater<int>());
    int tmp=0;
    for (int i=1; i<N; ++i) tmp += L[i];
    std::string res = (L[0] < tmp) ? "Yes":"No";
    std::cout << res << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
int main(){
  llint n;cin>>n;vint keta(32);int i;llint ju=-2;
  if(n==0){cout<<0<<endl;
          }else{
  for(i=0;i<=31;i++){//11=11101 1
    if((n+ju)==0){
      keta[i]=0;keta[i+1]=1;keta[i+2]=1;i=31;
    }else if(n==ju){
      keta[i]=0; keta[i+1]=1;i=31;
    }else if(n%ju){
      keta[i]=1;n+=(ju/2);
    }else{
      keta[i]=0;
    }
    ju=ju*(-2);
  }
  int fl=0;
  for(i=31;i>=0;i--){
    if(fl==0){
      if(keta[i]==1){
        fl=1;cout<<keta[i];
      }
    }else{
      cout<<keta[i]; 
    }
  }
  cout<<endl;
  }
}


Measured memory_bytes: 256
<?php
$n = int();
$A = ints();
echo count(array_unique($A)) - (count(array_unique($A)) % 2 == 0);

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}

Measured memory_bytes: 20852
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 100000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	return sc
}()

func scanIntNums() (nums []int) {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	nums = make([]int, len(numString))
	var err error

	for i := 0; i < len(nums); i++ {
		nums[i], err = strconv.Atoi(numString[i])
		if err != nil {
			panic(err)
		}
	}
	return nums
}

func main() {
	inputs := scanIntNums()
	N := inputs[0]
	K := inputs[1]
	dist := scanIntNums()

	tmp := 1
	loopMap := make(map[int]int, N)
	for i := 0; i < N; i++ {
		loopMap[i] = -1
	}
	path := make([]int, 0, N)
	path = append(path, 1)

	var offset int
	loopSize := 1
	for i := 0; i <= K; i++ {
		if loopMap[tmp-1] != -1 {
			loopSize = i - loopMap[tmp-1]
			offset = loopMap[tmp-1]
			path = path[:len(path)-1]
			break
		}
		loopMap[tmp-1] = i
		path = append(path, dist[tmp-1])
		tmp = dist[tmp-1]
	}
	loop := path[offset:len(path)]
	//fmt.Println("loopMap", loopMap)
	//fmt.Println("loopSize:", loopSize)
	//fmt.Println("offset:", offset)
	//fmt.Println("path:", path)
	//fmt.Println("loop:", loop)

	var step int
	if K < len(path) {
		step = K
		fmt.Println(path[step])
	} else {
		step = ((K - len(path)) % loopSize)
		fmt.Println(loop[step])
	}

	//fmt.Println("step:", step)

}


Measured memory_bytes: 18440
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N,A,B;cin>>N>>A>>B;
    cout<<min(N*A,B)<<endl;
}

Measured memory_bytes: 3540