akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int a[7400000];
int main(){
  while(1){
    int m,n;
    cin>>m>>n;
    if(m==0 &&n==0) break;
    lp(i,7400000){
      a[i]=0;
    }
    int i=m;
    while(n>=0){
      if(a[i]==0){
	for(int j=i;j<7400000;j+=i){
	  a[j]=1;
	}
	n--;
      }
      i++;
    }
    cout<<i-1<<endl;
  }
  return 0;
}


Measured memory_bytes: 31952
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
using namespace std;
#define _GLIBCXX_DEBUG
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vit vector<lint>::iterator
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define mod 1000000007
#define graph_set(n) struct edge{int to,int cost;} vector<edge> G((n))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define range(x,y) ((x) >= 0 && (x) < h && (y) >= 0 && (y) < w)
#define pyes cout << "Yes" << endl
#define pno cout << "No" << endl
#define fin return 0
typedef vector<long long> vi;
typedef vector<pair<long long, long long>> vp;
typedef vector<vector<long long>> vvi;
typedef pair<long long, long long> pi;
typedef long long lint;
typedef long long ll;
lint qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
lint qp(ll a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
lint gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
long long INF = 1000000000000000;

int r[100], l[100];
int a, b;

#define MAX 9223372036854775807
/*********************** */

int main() {
	string s;cin >> s;
	int n = s.size();
	vector<pair<int,int>> b;
	vector<int> a(n,0);
	b.pb(mp(-2,-1));
	for(int i = 1;i < n;i++){
		if(s[i] == 'L'&& s[i-1] == 'R'){
			b.pb(mp(i-1,i));
		}
	}
	b.pb(mp(n,n+1));
	for(int i = 1;i < b.size()-1;i++){
		int l = b[i].first;
		int r = b[i].second;
		//cout << l << " ";
		int cl = 0;
		int cr = 0;
		int odd = -1;
		while(l != -1){
			if(s[l] == 'L') break;
			if(odd == 1){
				odd*=-1;
				cr++;
			}else{
				odd *= -1;
				cl++;
			}
			l--;
		}
		odd = -1;
		while(r != n){
			if(s[r] == 'R') break;
			if(odd == 1){
				odd*=-1;
				cl++;
			}else{
				odd *= -1;
				cr++;
			}
			r++;
		}
		//cout << cl << " " << cr << endl;
		a[b[i].first] += cl;
		a[b[i].second] += cr;
	}
	for(int i = 0;i < n;i++)cout << a[i] << " ";
	cout << endl;
	return 0;
}
/*
vector<int> b; b.pb(-1);
	for(int i = 0;i < n;i++){
		if(r == 1){
			if(s[i] == 'L'){
				r*=-1;
				b.pb(i);
			}
		}else{
			if(s[i] == 'R'){
				r*= -1;
				b.pb(i);
			}
		}
	}
	b.pb(n);
	//for(auto i:b)cout << i << endl;
	
	for(int i = 1;i < b.size()-1;i++){
		if(i %2 == 1){
			int left = b[i] - 1; a[left]++;
			int right = b[i]; a[right]++;
			int distance_left = left - b[i-1] - 1;
			int distance_right = b[i+1] - b[i] - 1;
			a[left] = distance_left/2 + (distance_right + 1)/2;
			a[right] = distance_right/2 + (distance_left + 1)/2;
		}
	}
	//a[b[1]-1]++;
	for(int i = 0;i < n;i++){
		cout << a[i] << " ";
	}
	return 0;*/

Measured memory_bytes: 1528
n, m = map(int, input().split())
WV = [tuple(map(int, input().split())) for i in range(n)]
W = [w for w, v in WV]
V = [v for w, v in WV]
inf = 10**10
sumV = sum(V)
DP = [[inf for j in range(sumV+1)] for i in range(n+1)]
DP[0][0] = 0
for i in range(1, n+1):
    for j in range(V[i-1]):
        DP[i][j] = DP[i-1][j]
    for j in range(V[i-1], sumV+1):
        DP[i][j] = min(DP[i-1][j], DP[i-1][j-V[i-1]]+W[i-1])
for j in range(sumV, 0, -1):
    if DP[n][j] <= m:
        print(j)
        exit()


Measured memory_bytes: 171120
import math

N = int(input())

P = list(map(int, input().split()))
Q = list(map(int, input().split()))

def param(x):
  N = len(x)
  if N == 1:
    return 0
  
  p = x[0]
  y = x[1:N]
  for i in range(N-1):
    if y[i] > p:
      y[i] -= 1
  
  s = param(y)
  return s + int(math.factorial(N-1))*(p-1)

print(abs(param(P)-param(Q)))
  

Measured memory_bytes: 9100
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>
#include <stdlib.h>


int main()
{
    int n, i;
    scanf("%d",&n);
    char ch[n];
    scanf("%s",ch);
    if(n%2!=0)
    {
        printf("No");
        exit(0);
    }
    else
    {
        for(i=0;i<(n/2);i++)
        {if(ch[i]==ch[(n/2)+i])
        {}
        else
        {
            printf("No");
            exit(0);
        }}
        printf("Yes");
    }
}


Measured memory_bytes: 128
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	aa := make(Animals, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt64(scanner)
	}
	sort.Sort(aa)
	sums := make([]int64, n+1)

	for i := 0; i < n; i++ {
		sums[i+1] = sums[i] + aa[i]
	}
	ans := 1
	for i := n - 1; i > 0 && aa[i] <= sums[i]*2; i-- {
		ans++
	}
	fmt.Fprintln(writer, ans)

	writer.Flush()
}

type Animals []int64

func (a Animals) Len() int           { return len(a) }
func (a Animals) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Animals) Less(i, j int) bool { return a[i] < a[j] }


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		int q = scan.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			for (int j = 0; j < n; j++) {
				if (t[i] != s[j])
					continue;
				ans++;
				break;
			}
		}
		System.out.println(ans);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}



Measured memory_bytes: 39840
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if((abs(b-a)<=d&&abs(c-b)<=d)||abs(c-a)<=d)cout<<"Yes";
	else cout<<"No";

return 0;

}





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

const int N=200005;
long long a[N];
long long b[N];
int main()
{
    int n,m;
    long long k;
    scanf("%d %d %lld",&n,&m,&k);
    for(int i=1;i<=n;i++) scanf("%lld",a+i);
    for(int i=1;i<=m;i++) scanf("%lld",b+i);
    for(int i=1;i<=n;i++) a[i]+=a[i-1];
    for(int i=1;i<=m;i++) b[i]+=b[i-1];
    vector<long long>v;
    for(int i=1;i<=m;i++) v.push_back(b[i]);
    int mx=0;
    for(int i=0;i<=n;i++){
        if(k-a[i]<0) break;
        int idx=upper_bound(v.begin(),v.end(),k-a[i])-v.begin();
        mx=max(mx,i+idx);
    }
    printf("%d",mx);
    return 0;
}

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

typedef long long ll;
int ara[60];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    vector< pair <int, int> > pii;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        pii.push_back(make_pair(a,i));
    }
    sort(pii.begin(),pii.end());
    for(int i=0;i<n;i++)
    {
        cout<<pii[i].second<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1780
import numpy as np
x, n = map(int, input().split())
num_list = list(map(int,input().split()))
num_list = sorted(num_list)
num_100 = list(range(-100, 102))

if n ==0:
    print(x)
else:
 for num in num_list:
     num_100.remove(num)

 numbers1 = np.array(num_100)
 numbers2 = numbers1 - x
 numbers3 = np.abs(numbers2)
 min_index = numbers3.argmin()
 print(numbers1[min_index])

Measured memory_bytes: 27184
N = int(input())
B = list(map(int, input().split(' ')))
A = [ [] for i in range(N) ]
A[0] = B[0]
A[-1] = B[-1]
for i in range(N - 2):
    A[i + 1] = min(B[i], B[i + 1])
print(sum(A))

Measured memory_bytes: 9080
from heapq import heappush, heappop
N = 3
M = []
for i in range(N):
    M.append(list(map(int, input().split())))

A = (1, 2, 3, 4, 5, 6, 7, 8, 0)
def h(M):
    c = 0
    it = iter(A).__next__
    for i in range(N):
        for v in M[i]:
            if v != it():
                c += 1
    return c
def f(M):
    M0 = []
    for m in M:
        M0.extend(m)
    return tuple(M0)


dd = ((-1, 0), (0, -1), (1, 0), (0, 1))
ci = cj = -1
for i in range(N):
    for j in range(N):
        if M[i][j] == 0:
            ci = i; cj = j
que = [(h(M), 0, ci, cj, M)]
U = set(f(M))
while que:
    hc, c, cr, cc, M = heappop(que)
    if hc == c:
        print(c)
        break
    for dr, dc in dd:
        nr = cr+dr; nc = cc+dc
        if not 0 <= nr < N or not 0 <= nc < N:
            continue
        MM = [m[:] for m in M]
        MM[cr][cc] = MM[nr][nc]
        MM[nr][nc] = 0
        s = f(MM)
        if s in U:
            continue

        U.add(s)
        heappush(que, (h(MM)+c+1, c+1, nr, nc, MM))



Measured memory_bytes: 40412
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//////////////////#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N;
    cin >> N;
    vector<LL> A(N), B(N);
    vector<pair<LL,LL>> S(N);
    REP(i,N)
    {
        LL a,b;
        cin >> a >> b;
        A[i] = a;
        B[i] = b;
        S[i].first = a + b;
        S[i].second = i;
    }
    sort(S.begin(), S.end());
    reverse(S.begin(), S.end());
    LL ans = 0;
    REP(i,N)
    {
        if(i % 2 == 0) //taka turn
        {
            ans += A[S[i].second];
        }
        else
        {
            ans -= B[S[i].second];
        }
    }
    cout << ans << endl;




}


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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

#pragma region Debug
void debug_out() { cout << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cout << H << " ";
	debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
#pragma endregion

// コンパイル時、エイリアス「debug」を使用 --> マクロが使えるように

// グラフ実装
const int inf = 1e9 + 7;
const ll infl = 1LL << 60;
struct edge{
	int to, ind;
};
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

// ダイクストラ法実装

void solve(){
	// #define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル

	// 入力
	ll N, M, S;
	cin >> N >> M >> S;

	vector<vector<edge>> G(N);
	vector<ll> mv_cost;
	vector<ll> mv_time;
	ll A, B, U, V;
	ll max_cost = 0;
	rep(i,M){
		cin >> U >> V >> A >> B;
		U--; // 0-indexed
		V--; // 0-indexed
		edge temp = {V, i};
		G[U].pb(temp);
		temp = {U, i};
		G[V].pb(temp);
		chmax(max_cost, A);
		mv_cost.eb(A);
		mv_time.eb(B);
	}

	vector<ll> exch_cost;
	vector<ll> exch_time;
	ll C, D;
	rep(i,N){
		cin >> C >> D;
		exch_cost.eb(C);
		exch_time.eb(D);
	}

	// これ以上銀貨を持っていても仕方ない
	ll s_max = max_cost * (N-1);
	chmin(S,s_max);

	// グラフ構築
	// 状態は(頂点番号, 持っている銀貨の枚数)
	vector<vector<ll>> dist(N, vector<ll>(s_max + 1, infl));
	vector<vector<bool>> vis(N, vector<bool>(s_max + 1, false));
	vector<ll> ans(N,infl);

	// {スタートからの道の長さ, 現在頂点, 保有銀貨}
	min_priority_queue< tuple<ll, int, int> > Q;
	// スタート地点
	dist[0][S] = 0;
	Q.push({0, 0, S});

	// ダイクストラ
	while(!Q.empty()){
		auto now = Q.top();
		Q.pop();

		ll current_time = get<0>(now);
		ll current_from = get<1>(now);
		ll current_s = get<2>(now);

		if(vis[current_from][current_s]) continue;
		vis[current_from][current_s] = true;

		chmin(ans[current_from], current_time);

		for(auto p : G[current_from]){
			int to = p.to;
			int i = p.ind;
			if(current_s < mv_cost[i]) continue;

			ll next_time = current_time + mv_time[i];
			chmin(dist[to][current_s - mv_cost[i]], next_time);
			if(dist[to][current_s - mv_cost[i]] == next_time){
				Q.push({dist[to][current_s - mv_cost[i]], to, current_s - mv_cost[i]});
			}
		}

		ll next_time = current_time + exch_time[current_from];
		ll next_s = min(s_max, current_s + exch_cost[current_from]);
		chmin(dist[current_from][next_s], next_time);
		if(dist[current_from][next_s] == next_time){
			Q.push({dist[current_from][next_s], current_from, next_s});
		}
	}

	FOR(i,1,N){
		cout << ans[i] << endl;
	}

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 6172
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 && a == b && b == c) {
		cout << -1 << endl;
		return 0;
	}

	int sum = a + b + c;
	int cnt = 0;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		a = (sum - a) / 2;
		b = (sum - b) / 2;
		c = (sum - c) / 2;

		cnt++;

		if (a == b && b == c) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << cnt << endl;
	
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a) 
#define  fi first
#define  se second 
using namespace std;
using li = long long;
using ul = unsigned long long;
using vi = vector<li>;
using vs = vector<string>;
inline ul gcd(ul a,ul b) { return b?gcd(b,a%b):a; }
const int INF=1e9+9;


int main()
{
    int a;
    cin>>a;
    cout<<((int)floor(sqrt(a)))*((int)floor(sqrt(a)))<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int x,y,z;cin>>x>>y>>z;
  int k;cin>>k;
  std::vector<int> a(x),b(y),c(z);
  for(int i=0;i<x;i++)cin>>a[i];
  for(int i=0;i<y;i++)cin>>b[i];
  for(int i=0;i<z;i++)cin>>c[i];
  std::vector<int> ab(1234567,0);
  for(int i=0;i<x*y;i++)ab[i]=a[i%x]+b[i/x];
  sort(ab.rbegin(),ab.rend());
  std::vector<int> abc(3123456,0);
  for(int i=0;i<3000*z;i++)abc[i]=ab[i/z]+c[i%z];
  sort(abc.rbegin(),abc.rend());
  for(int i=0;i<k;i++)cout<<abc[i]<<endl;
}


Measured memory_bytes: 34304
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstring>
#include<string>
#include<map>
#include<set>
#include<unordered_map>
#define db double
#define ui unsigned int
#define ll long long
#define ull unsiged ll
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1e9+7
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define inf  INT_MAX
#define lnf LLONG_MAX
#define mii map<int,int>
#define mll map<ll,ll>
#define mil map<int,ll>
#define umii unordered_map<int,int>
#define umll unordered_map<ll,ll>
#define umcc unordered_map<char,ll>
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sz size()
using namespace std;
const int MX = 2e5 + 7;
ll modulo(ll num, ll MOD = mod) { return ((num%MOD) + MOD) % MOD; }
ll power(ll b, ll e, ll MOD = mod) { ll ans = 1; while (e) { if (e % 2) ans = (ans*b) % MOD; b = (b*b) % MOD; e /= 2; } return ans; }
ll inv(ll num, ll MOD = mod) { return power(modulo(num), MOD - 2, MOD); }
ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a%b)); }
int root[MX];
vll g[26];
int tow(int m,int t,int a)
{
	int n = 0;
	int gt=m;
	while (n <= m)
	{
		//cout << n <<"m="<<m<< endl;
		int mi = (n + m) / 2;
		if (g[a][mi] > t)
		{
			m = mi-1;
			if (gt > mi)
				gt = mi;
		}
		else n = mi + 1;
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n, m;
	string s, s1;
	cin >> s >> s1;
	n = s.sz;
	rep(i, 0, n-1)
	{
		int a = s[i] - 'a';
		g[a].pb(i+1);
	}
	ll sum = 0;
	m = s1.sz;
	int t=0;
	int a, b;
	rep(i, 0, m - 1)
	{
		a = s1[i]-'a';
		b = g[a].sz-1;
		if (b<0) {
			cout << "-1" << endl;
			return 0;
		}
		if (t >= g[a][b])
		{
			//cout <<"t="<< t << endl;
			sum += g[a][0] + n - t;
			t = g[a][0];
		}
		else {
			int h = tow(b, t, a);
			sum += g[a][h]-t;
			t =g[a][ h];
		//	cout << "t=" << t << endl;
		}
		//cout << sum << endl;
	}
	cout << sum << endl;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int i=1;
bool ans =true;
while(1){
    int z =pow(10,i);
    if(z==n){
        cout << 10 << endl;
        ans =false;
    } 
    if(z>n)break;
    i++;
}
int che =0;
if(ans){
    while(n>0){
        che+=n%10;
        n/=10;
    }
    cout << che << endl;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int a,b,h,m;cin>>a>>b>>h>>m;
  double A=M_PI*m/30;
  double B=M_PI*h/6+M_PI*m/360;
  double a_b=abs(A-B);
  if(a_b>M_PI){
    a_b=2*M_PI-a_b;
  }
  double ans=sqrt(b*b-2*a*b*cos(a_b)+a*a);
  cout<<setprecision(20)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4232
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int N;
int n;
string ans;
int main(void) {
	cin >> N;
	n = N;
	int sum = 0;
	while (N > 0) {
		sum += N % 10;
		N /= 10;
	}
	ans = n % sum == 0 ? "Yes" : "No";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    from collections import deque
    n, m, *ab = map(int, open(0).read().split())

    l = {i: [] for i in range(n + 1)}
    for i, j in zip(*[iter(ab)] * 2):
        l[i].append(j)
        l[j].append(i)

    ll = [None] * (n + 1)
    vis = [False] * (n + 1)
    que = deque([1])
    vis[1] = True
    while que:
        now = que.popleft()
        nx = l[now]
        for i in nx:
            if vis[i]:
                continue
            vis[i] = True
            ll[i] = now
            que.append(i)
    if all(vis[1:]):
        print("Yes")
        s = "\n".join(map(str, ll[2:]))
        print(s)
    else:
        print("No")


if __name__ == '__main__':
    main()


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define esort(s) sort((s).begin(),(s).end())

typedef long long ll;
typedef pair<int,int> ipair;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000;
const double PI = acos(-1.0);
const double EPS = 1e-10;

int r;
void solve(){
    cin>>r;
    cout<<(r*r)<<"\n";
}

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

    solve();

    return 0;
}

Measured memory_bytes: 256
l,r = map(int,input().split())
r=min(r,l+2019)
s = 2019
for k in range(l,r):
    i = k
    for l in range(i+1,r+1):
        j = l
        mo = (i*j)%2019
        if s > mo:
            s = mo
print(s)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 fs first
#define sc second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

void solve(){
  int n;
  cin>>n;
  cout<<pow(n,2);
}

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

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

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

	cin>>a>>b;
	if((a*b) % 2 == 0)
		cout<<"Even";
	else
		cout<<"Odd";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const ll INFL = (1LL << 62);
const ll MOD = 1000000007;
template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T>
ll mod_pow(ll a, ll n, T mod) {
    mod = (ll)mod;
    ll res = 1, p = a % mod;
    while (n) {
        if (n & 1) res = res * p % mod;
        p = p * p % mod;
        n >>= 1;
    }
    return res;
}

struct UnionFind {
    vector<int> data;
    UnionFind(int size) { data.assign(size, -1); }
    int find(int k) {
        if (data[k] < 0) return k;
        return (data[k] = find(data[k]));
    }
    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    int size(int k) { return (-data[find(k)]); }
    bool same(int x, int y) { return find(x) == find(y); }
};

struct edge {
    int from, to, cost;
};
struct city {
    int x, y, num;
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<city> cities(N);
    rep(i, N) {
        cin >> cities[i].x >> cities[i].y;
        cities[i].num = i;
    }
    vector<edge> edges;
    sort(all(cities), [](const city &a, const city &b) { return a.x < b.x; });
    rep(i, N - 1) {
        edge e;
        e.cost = min(abs(cities[i + 1].x - cities[i].x),
                     abs(cities[i + 1].y - cities[i].y));
        e.from = cities[i].num;
        e.to = cities[i + 1].num;
        edges.push_back(e);
    }
    sort(all(cities), [](const city &a, const city &b) { return a.y < b.y; });
    rep(i, N - 1) {
        edge e;
        e.cost = min(abs(cities[i + 1].x - cities[i].x),
                     abs(cities[i + 1].y - cities[i].y));
        e.from = cities[i].num;
        e.to = cities[i + 1].num;
        edges.push_back(e);
    }
    sort(all(edges), [](edge a, edge b) { return a.cost < b.cost; });
    UnionFind uf(N);
    int res = 0;
    rep(i, edges.size()) {
        edge e = edges[i];
        if (uf.unite(e.from, e.to)) {
            res += e.cost;
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 6132
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
    long double a, b, x;
    long double ans,h=180.000000;

    scanf("%Lf %Lf %Lf", &a, &b, &x);
    if (x >= a * a * b / 2)
        ans = (long double)2 * (a * a * b - x) / (a * a * a);
    else
        ans = (long double)a * b * b / (2 * x);
   // printf("%.10Lf\n", ans);
    ans = (long double)(atanl(ans)*h/M_PI);
    printf("%.10Lf", ans);
   // printf("\n%.10Lf", M_PI);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _                             \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define ideb \
    int _p_; \
    cin >> _p_;
#define mod 1000000007ll
typedef long long int ll;
typedef unsigned long long int ull;

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

    double a[n];

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

    // dp[index][number of heads]

    double dp[n + 2][n + 2];
    memset(dp, 0, sizeof(dp));

    dp[0][0] = 1 - a[0];
    dp[0][1] = a[0];

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = 0; j <= i + 1; j++)
        {
            dp[i + 1][j] += dp[i][j] * (1 - a[i + 1]);
            dp[i + 1][j + 1] += dp[i][j] * a[i + 1];
        }
    }
    double ans = 0.0;
    for (int i = n / 2 + n % 2; i <= n; i++)
    {
        ans += dp[n - 1][i];
    }
    cout << setprecision(10);
    cout << ans;
}

Measured memory_bytes: 70656
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    int a,b,c;
    cin>>a>>b>>c;
    
    if(a==b){
        cout<<c<<endl;
    }else if(b==c){
        cout<<a<<endl;
    }else{
        cout<<b<<endl;
    }
    
    
    return 0;
}







Measured memory_bytes: 256
# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
using namespace std;
const int N = 15;
char s[N][N];bool vis[N];
int mark[N],match[N],n,m,dt;
bool solve()
{
	bool mid = m & 1;
	for(int i = 1;i <= m;i++)match[i] = 0;
	for(int i = 1;i <= m;i++)if(!match[i])
	{
		for(int j = i + 1;j <= m && !match[i];j++)if(!match[j])
		{
			bool f = true;
			for(int k = 1;k <= n && f;k++)if(s[mark[k]][i] != s[mark[n - k + 1]][j])f = false;
			if(f)match[i] = j,match[j] = i;
		}
		if(!match[i] && mid)
		{
		  bool f = true;
		  for(int k = 1;k <= n && f;k++)if(s[mark[k]][i] != s[mark[n - k + 1]][i])f = false;
		  if(f)match[i] = i,mid = false;
		}
		if(!match[i])return false;
	}
	return true;
}
bool dfs(int now,int pos,bool mid)
{
	if(now > n)return solve();
	if(vis[now])return dfs(now + 1,pos,mid);
	for(int i = now + 1;i <= n;i++)if(!vis[i])
	{
		mark[pos] = i;mark[n - pos + 1] = now;
		vis[i] = vis[now] = true;
		if(dfs(now + 1,pos + 1,mid))return true;
		mark[pos] = mark[n - pos +1] = 0;
		vis[i] = vis[now] = false;
	}
	if(mid){mark[n >> 1 | 1] = now;return dfs(now + 1,pos,0);}
	return false;
}
int main()
{
  scanf("%d %d",&n,&m);
  for(int i = 1;i <= n;i++)scanf("%s",s[i] + 1);
  if(dfs(1,1,n & 1))puts("YES");else puts("NO");
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define ll long long
#define assign_max(into, compared) (into = max((into), (compared))) 

using namespace std;

int main(void){
    int N,W;
    cin >> N >> W;
    vector<ll> w(N);
    vector<ll> v(N);

    for(int i = 0;i < N;i++){
        cin >> w[i] >> v[i];
    }
    //n個目のアイテムまで調べたときのw以下の重さの価値の最大値テーブル
    vector<vector<ll>> dp (N+1, vector<ll> (W+1, 0));

    for(int i = 0;i < N;i++){
        for(int j = 0;j <= W;j++){
            dp[i+1][j] = dp[i][j];
            if(j < w[i]) continue;
            assign_max(dp[i+1][j], v[i]);
            assign_max(dp[i+1][j], dp[i][j-w[i]] + v[i]);
        }
    }

    /* for(vector<int> &temp : dp){
        for(int &value : temp){
            cout << value;
        }
        cout << endl;
    } */

    cout << dp[N][W] << endl;
}

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

public class Main {

	public static void main(String[] args)throws IOException {
		
		int i=0,j=0;
		int[] mount = new int[10];
		int[] h_mount = {0,0,0};
		String str;
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
				
		while(i<10){
			str=new String(in.readLine());
			mount[i]=Integer.parseInt(str);
			
			if(mount[i]<0 || mount[i]>10000){
				i--;
			}
			
			i++;
		}
		
		sortMethod(mount,10);
		for(i=0;i<3;i++){
			h_mount[i]=mount[i];
			System.out.println(h_mount[i]);
		}


	}
	
	public static void sortMethod(int[] array,int num){
		int tmp;
		int x,y;
		for(x=0;x<num-1;x++){
			for(y=x+1;y<num;y++){
				if(array[x]<array[y]){
					tmp = array[x];
					array[x]=array[y];
					array[y]=tmp;
				}
			}
		}
	}

}

Measured memory_bytes: 24204
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

ans = 1
for a in A:
    ans = min(ans * a, 10**18 + 1)
if ans > 10**18:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 38344
#include <iostream>
#include <string>

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

  string s;
  int n;
  cin >> s;
  cin >> n;

  int l = s.length();
  for (int i = 0; i < l; i += n) {
    cout << s[i];
  }
  cout << "\n";
}


Measured memory_bytes: 256
N = int(input())
count = 0
end = 0
for i in range(N):
    D1,D2 = map(int,input().split())
    if D1 == D2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        end = 1
        break
if end == 0:
    print('No')

Measured memory_bytes: 9176
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<stack>
#include<map>
using namespace std;
bool cmp(int x,int y){
	return x>y;
}
int main(){
    map<int,int>ma;
	map<int,int>::iterator it;
	int n,m,a[200005],sum=0,num=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		ma[a]++;
	}
	for(it=ma.begin();it!=ma.end();it++)
		a[num++]=it->second;
	    sort(a,a+num,cmp);
        for(int j=m;j<num;j++)
    sum+=a[j];
	printf("%d\n",sum);
}

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

int width,height;
int map[101][101];

int main(void) {
	int tree_num;
	int tx,ty;
	int get_width,get_height;
	int i,j;
	int result,now;
	while(1) {
		scanf("%d",&tree_num);
		if(tree_num==0)break;
		scanf("%d%d",&width,&height);
		memset(map,0,sizeof(map));
		for(i=0;i<tree_num;i++) {
			scanf("%d%d",&tx,&ty);
			map[ty][tx]=1;
		}
		scanf("%d%d",&get_width,&get_height);
		for(i=1;i<=height;i++) {
			for(j=1;j<=width;j++) {
				map[i][j]+=map[i][j-1];
			}
		}
		for(i=1;i<=width;i++) {
			for(j=1;j<=height;j++) {
				map[j][i]+=map[j-1][i];
			}
		}
		result=0;
		for(i=get_height;i<=height;i++) {
			for(j=get_width;j<=width;j++) {
				now=map[i][j]
					-map[i-get_height][j]-map[i][j-get_width]
					+map[i-get_height][j-get_width];
				if(now>result)result=now;
			}
		}
		printf("%d\n",result);
	}
	return 0;
}

Measured memory_bytes: 0
import std.stdio,std.string,std.algorithm,std.conv,std.array;

void main(){
    int[][string] dic;
    while(1){
        auto line=readln;
        if(!line.length)break;
        auto inp=line.split;
        dic[inp[0]]~=inp[1].to!int;
    }
    foreach(key;dic.keys.array.sort()){
        key.writeln;
        dic[key].array.sort().map!(to!string).join(" ").writeln;
    }
}

Measured memory_bytes: 1096
//#include <bits/stdc++.h>
#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>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

ll v[6];
ll n, idx;

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

  cin >> n;
  REP(i,5) cin >> v[i];
  ll minv = 1e16;

  REP(i,5){
    if(minv > v[i]){
      minv = v[i];
      idx = i;
    }
  }

  ll div = n/minv;
  if(n%minv != 0) div++;

  cout << 5 + div - 1 << endl;
  
  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_z

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>

using namespace std;
using ll = long long;

const ll maxH=1e6;
const ll INF=1e18;

struct Line {
  // y = ax + b
  ll a, b;

  ll at(ll x) {
    return a * x + b;
  }
};

struct LiChaoST {
  vector<Line> t;
  LiChaoST() {
    t.assign(4*maxH+10, {0, INF});
  }

  void addLine(Line li, ll root, ll l, ll r) {
    if (l > r) return;

    bool checkleft = ( li.at( l ) <= t[root].at(l) );
    bool checkright = ( li.at( r ) <= t[root].at(r) );

    if (checkleft && checkright) { // new line is better
      t[root] = li;
      return ;
    } else if (!checkleft && !checkright) return; //worse

    ll m = (l + r) / 2; //
    addLine(li, root*2, l, m);
    addLine(li, root*2+1, m+1, r);
  }

  ll minQuery(ll x, ll root, ll l, ll r) {
    if (l > r) return INF;
    if (l==r) return t[root].at(x);

    ll m = (l+r) / 2;
    if (x <= m) return min( t[root].at(x),  minQuery(x, root*2, l, m) );
    else return min( t[root].at(x), minQuery(x, root*2+1, m+1, r) );
  }
};

int main() {
  ll N, C;

  scanf("%lld %lld", &N, &C);

  vector<ll> h(N);
  for (auto i =0; i< N; i++) scanf("%lld", &h[i]);

  vector<ll> F(N, 0);

  LiChaoST tree;

  // first stone,  F[0] = 0
  // (hi - hj)^2 + C = hi^2 + hj^2 - 2hihj + C + dp[j]

  for(auto i =0; i<N; i++) {
    F[i] = tree.minQuery( h[i], 1, 0, maxH) + h[i]*h[i] + C;
    if (i==0) F[i] =0;
    tree.addLine( {-2*h[i],  h[i]*h[i] + F[i]}, 1, 0, maxH);
  }

  cout << F[N-1] << endl;

  return 0;
}

Measured memory_bytes: 65920
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
   string s;
   int n;
   bool ans=true;
   cin>>s;
   n=s.size();
   rep(i,n){
    if(i%2==0){
     if(s.at(i)=='L')
       ans=false;
    }
    else{
     if(s.at(i)=='R')
      ans=false;
    }
   }
   if(ans)
     cout<<"Yes"<<endl;
   else
     cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;
int main() {
 int H,W;
 cin>>H>>W;
 vector<vector<char>> a(H,vector<char>(W));
 for(int i=0;i<H;i++){
     for(int j=0;j<W;j++){
         cin>>a[i][j];
     }
 }
vector<bool>tate(W,false);
vector<bool>yoko(H,false);

 for(int i=0;i<H;i++){
     for(int j=0;j<W;j++){
         if(a[i][j]=='#'){yoko[i]=true;break;}
     }
 }
  for(int i=0;i<W;i++){
     for(int j=0;j<H;j++){
         if(a[j][i]=='#'){tate[i]=true;break;}
     }
  }
  for(int i=0;i<H;i++){
     for(int j=0;j<W;j++){
        if(yoko[i]&&tate[j]){cout<<a[i][j];}
     } 
    if(yoko[i]){cout<<endl;}
  }
 return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; k < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int R,G,B,N;

int main() {
  
  cin >> R >> G >> B >> N;
  int ans = 0;
  int Rlim = N / R;
  int Glim = N / G;
  int Blim = N / B;
  rep(i,Rlim+1) {
    if(R * i > N) continue;
    rep(j,Glim+1) {
      if(R * i + G * j > N) continue;
      int diff = N - (R * i + G * j);
      if(diff < 0) continue;
      if(diff % B == 0 || diff == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  vector<int> a(32);
  a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a.at(k-1) << endl;
}

Measured memory_bytes: 256
// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
void solve();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

// Main Code
void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
        --a[i];
    }
    
    vector<ll> c(3 * m, 0);
    rep(i, n - 1) {
        ll x = a[i], y = a[i + 1];
        if (x > y) y += m;
        c[x + 2] -= 1;
        c[y + 1] += 1;
        c[y + 1] += (y - x - 1);
        c[y + 2] -= (y - x - 1);
    }
    rep(i, 3 * m - 1) c[i + 1] += c[i];
    rng(i, m, 3 * m) c[i % m] += c[i];
    
    vector<ll> b(m, 0);
    rep(i, n - 1) {
        if (a[i] < a[i + 1]) b[0] += (a[i + 1] - a[i]);
        else b[0] += (a[i + 1] + 1);
    }
    rep(i, m - 1) b[i + 1] = b[i] + c[i + 1];
    
    ll ans = INF;
    rep(i, m) chmin(ans, b[i]);
    cout << ans << "\n";
    return;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

    ll minv = 1e13;

    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
            minv = min(minv, n / i + i);
    }

    OP(minv - 2);
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        int max = 0;
        for (int i = 0; i < n; i++) {
            var cou = s.Take(i).Intersect(s.Skip(i).Take(n - 1)).Distinct().Count();
            max = Math.Max(cou, max);
        }
        Console.WriteLine(max);
    }
}

Measured memory_bytes: 13396
c=input()

if c == 'a':
  print('vowel')
  
elif c == 'e':
  print('vowel')
  
elif c == 'i':
  print('vowel')
  
elif c == 'o':
  print('vowel')
  
elif c == 'u':
  print('vowel')
  
else:
  print('consonant')

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

typedef long long ll;

using namespace std;
int main(){
    int n,m;cin >> n >> m;
    int k;
    int a;
    vector<int> A(m,0);
    for(int i=0;i<n;i++){
        cin >> k;
        for(int j=0;j<k;j++){
            cin >> a;
            A[a-1]++;
        }
    }
    int cnt=0;
    for(int i=0;i<m;i++){
        if(A[i]==n){
            cnt++;
        }
    }
    cout << cnt << endl;
   
    return 0;
}

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

using namespace std;

int main(){

    bool YYMM = true;
    bool MMYY = true;
    string S;
    cin >> S;

    string num_1,num_2;
    int num1, num2;

    num_1 = S.substr(0,2);
    num_2 = S.substr(2,2);

    num1 = stoi(num_1);
    num2 = stoi(num_2);

    if(1 <= num1 && num1 <= 12){
        if(1 <= num2 && num2 <= 12)
            cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }else{
        if(1 <= num2 && num2 <= 12)
            cout << "YYMM" << endl;
        else cout << "NA"<< endl;
    }
    /*
    if(num1 == 0 || num2 == 0){
        YYMM = false;
        MMYY = false;
    }

    if(num1 > 12 && num2 > 12){
        MMYY = false;
        YYMM = false;
    }else if( num2 > 12 && num1 < 13){
        YYMM = false;
    }else if( num2 < 13 && num1 > 12){
        MMYY = false;
    }
    /* 
    if(YYMM && !MMYY){
        cout << "YYMM" << endl; 
    } else if(!YYMM && MMYY){
        cout << "MMYY" << endl;
    } else if(YYMM && MMYY){
        cout << "AMBIGUOUS" << endl;
    } else{
        cout << "NA" << endl;
    }
    */
    
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <int,int> ii;

const int mod = 1e9 + 7;
const ll INF = (1LL<<50);
const int N = 100005;
int main(){
	fastio;
	int n;
	cin>> n;
	cout << (n==0?1:0) << endl;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 2e5+10;
const int inf = 0x3f3f3f3f;
ll a[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	ll k;
	int n;
	cin>>k>>n;
	rep(i,1,n) {
		cin>>a[i];
	}
	ll Max=0;
	rep(i,2,n) Max=max(Max,a[i]-a[i-1]);
	Max=max(Max,a[1]+k-a[n]);
	cout<<k-Max<<'\n';
	return 0;
}



Measured memory_bytes: 1792
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy


while True:
    n,l = map(int,input().split())
    cnt = 0
    if n == 0 and l == 0:
        break
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if (i != j and j != k and i != k) and i + j + k == l:
                    cnt+=1
    print(cnt)


Measured memory_bytes: 6340
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>
#include<numeric>
#include<stdlib.h>

using namespace std;

int main()
{
  char c;

  cin >> c;

  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }

  return 0;
}


Measured memory_bytes: 3604