akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main() {
    int n, u, v;
    scanf("%i", &n);
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += i * 1ll * (n - i + 1);
    }
    for (int i = 1; i < n; i++) {
        scanf("%i%i", &u, &v);
        if (u > v) {
            u += v;
            v = u - v;
            u -= v;
        }
        ans -= u * 1ll * (n - v + 1);
    }
    printf("%lli", ans);
}


Measured memory_bytes: 1724
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll r,g,b,n;
ll ans=0,tmp=0;

int main(void){
    string s,t;
    cin>>s>>t;
    string m[s.length()+1][2];
    ll n = s.length();
    vector<pair<char,char>>p;
    vector<char>ch;
    for(ll i=0;i<n;i++){
    	p.push_back(make_pair(t[i],s[i]));
    	ch.push_back(s[i]);
    }
    sort(p.begin(),p.end());

    /*ll cnt=0;
    for(ll i=0;i<n-1;i++){
    	if(p[i].first==p[i+1].first){
    		cnt++;
    	}
    }
    //cout<<cnt<<endl;
    if(cnt==n-1){
        cnt=0;
    	//cout<<1<<endl;
    	for(ll i=0;i<n;i++){
    		if(p[i].second!=p[i].first)cnt++;
    	}
    }
    //cout<<cnt<<endl;
    if(cnt==n){
    	cout<<"Yes"<<endl;return 0;
    }*/
    bool flag=true;
    for(ll i=0;i<n-1;i++){
    	//cout<<"p:"<p[i].first<<" "<<p[i+1].first<<"s:"<<p[i].second<<" "<<p[i].second<<endl;
    	//cout<<p[i].first<<p[i].second<<endl;
    	if(p[i].first==p[i+1].first){
    		if(p[i].second!=p[i+1].second){
    			flag=false;
    		}
    	}
    	if(p[i].second==p[i+1].second){
    	  	if(p[i].first!=p[i+1].first){
    	  		flag=false;
    	  	}
    	}
    }
    ll k = 1, k2 = 1;
    sort(ch.begin(),ch.end());
    for(ll i=0;i<n-1;i++){
    	if(p[i].first!=p[i+1].first)k++;
    	if(ch[i]!=ch[i+1])k2++;
    }
    //cout<<k<<k2<<endl;
    if(k!=k2)flag=false;
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 4608
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
#define int long long		
int a[214514];
int b[214514];
signed main(){
	ic(n) ic(k)
	if((n+k)%2==0)c((n+k)/2)
	else c("IMPOSSIBLE")
}	

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const int maxn = 200010;
const int ML = 62;
const ll INF = TEN(18) * 2;

ll ps[ML][maxn];

int main() {
	int N; ll K; cin >> N >> K;
	vi A(N); rep(i, N) cin >> A[i];

	rep(i, N) {
		A.pb(A[i]);
	}

	map<int, int> lf;

	for (int i = N * 2 - 1; i >= 0; --i) {
		if (i < N) {
			ps[0][i] = lf[A[i]] - i + 1;
		}
		lf[A[i]] = i;
	}

	rep(i, ML-1) {
		rep(j, maxn) {
			if (ps[i][j] == INF) {
				ps[i + 1][j] = INF;
			} else {
				ps[i + 1][j] = ps[i][j] + ps[i][(j + ps[i][j]) % N];
				if (ps[i + 1][j] > INF) ps[i + 1][j] = INF;
			}
		}
	}

	ll len = N * K;
	ll p = 0;

	for (int i = ML-1; i >= 0; --i) {
		if (p + ps[i][p % N] <= len) {
			p += ps[i][p % N];
		}
	}

	vi vec;
	set<int> st;

	for (; p < len; ++p) {
		int x = A[p % N];
		if (st.count(x)) {
			while (st.count(x)) {
				st.erase(vec.back());
				vec.pop_back();
			}
		} else {
			vec.pb(x);
			st.insert(x);
		}
	}

	rep(i, vec.size()) printf("%d%c", vec[i], i + 1 == vec.size() ? '\n' : ' ');

	return 0;
}


Measured memory_bytes: 119536
while True:
    n = int(input())
    if n == 0:
        break
    d = dict()
    for _ in range(n):
        a, b = input().split()
        d[a] = b
    m = int(input())

    s = ""
    for i in range(m):
        c = input()[0]
        if c in d:
            s += d[c]
        else:
            s += c
    print(s)



Measured memory_bytes: 5704
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#define endl "\n"
#define c0 ios_base :: sync_with_stdio(0); cin.tie (0);
#define s second
#define f first
#define ll long long
#define ull unsigned ll
using namespace std;

const int MaxN = 4e5 + 17;
//const ll INF = 1e9 + 17;
//const int MOD = 1e9 + 7;
//const double eps = 1e-3;
//const double pi = 3.14159265359;


int n, a[MaxN], u[MaxN], S, Sum;
int main()
{
    #ifdef DEBUG
        freopen (".in", "r", stdin);
        freopen (".out", "w", stdout);
    #endif
    scanf ("%d", &n);
    for (int i = 1; i <= n; ++ i)
    {
        scanf ("%d", a + i);
        if (a[i] >= 3200)
            ++ Sum;
        else
        {
            u[a[i] / 400] = 1;
        }
    }
    for (int i = 0; i <= 100; ++ i)
        S += u[i];
    if (S == 0)
        -- Sum, ++ S;
    cout << S << ' ' << S + Sum;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int lh, lw;
	cin >> lh >> lw;

	int sh, sw;
	cin >> sh >> sw;

	int h;
	h = ( lh - sh );
	
	int w;
	w = ( lw - sw );

	cout << ( h * w ) << endl;
	return 0;
}

Measured memory_bytes: 888
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,p = map(int,readline().split())
lst1 = list(map(int,readline().split()))

def pow(n,p): #繰り返し二乗法(nのp乗)
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2
            p //= 2
        else:
            res = res * n
            p -= 1
    return res
#二項係数(modなし) O(k)
def large_conbination(n,k): #no mod. return nCk.
    res1 = 1
    for i in range(n,n-k,-1):
        res1*=i
    res2 = 1
    for i in range(1,k+1):
        res2*= i
    return res1//res2
od = 0
ev = 0
for i in lst1:
    if even(i):
        ev += 1
    else:
        od += 1

#奇数が偶数個
if even(p):
    ans = 0
    res = pow(2,ev)
    for i in range(0,od+1,2):
        ans += res*large_conbination(od,i)
#奇数が奇数個
else:
    ans = 0
    res = pow(2,ev)
    for i in range(1,od+1,2):
        ans += res*large_conbination(od,i)

print(ans)


Measured memory_bytes: 38256
n,m = gets.chomp.split.map(&:to_i)
ds = n.times.map{gets.chomp.split.map(&:to_i)}.sort_by(&:first)
sum = 0
ds.each do |a,b|
  if m - b > 0
    sum += a*b
    m = m - b
  else
    sum += a*(m)
    break
  end
end
puts sum


Measured memory_bytes: 12664
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;

int		compare_string(const void *a, const void *b)
{
	return strcmp(*(const char **)a, *(const char **)b);
}

int main()
{
	long N;
	scanf("%ld", &N);
	char **str;
	long i = 0;

	str = (char**)malloc(sizeof(char*) * N);
	while (i < N)
	{
		str[i] = (char*)malloc(sizeof(char) * 11);
		scanf("%s", str[i]);
		i++;
	}
	long n = 0;
	qsort(str, N, sizeof *str, compare_string);

	i = 0;
	while (i < N - 1)
	{
		// printf("%s ", str[i]);
		if (strcmp(str[i], str[i + 1]) != 0)
			n++;
		i++;
	}
	free(str);
	printf("%ld", n + 1);
	return (0);
}



Measured memory_bytes: 11112
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

S = input()

day = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
index = day.index(S)

print(7 - index)


Measured memory_bytes: 43376
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
typedef long long ll;
typedef int64_t in;
using namespace std;
#define INF 1000000007


int main() {
    while(1){
        int n;
        cin >> n;
        vector<string> f(n);
        if(n==0) break;
        
        for(int i=0; i<n; i++){
            cin >> f[i];
        }
        if(n==1) {
            cout << "0" << endl;
            continue;
        }
        int count=0;
        if(n % 2 == 0){
            for(int i=0; i<n; i+=2){
                if((f[i]=="lu" && f[i+1]=="ru")
                || (f[i] == "ru" && f[i+1] == "lu")
                || (f[i] == "ld" && f[i+1] == "rd")
                || (f[i] == "rd" && f[i+1] == "ld")){
                    count++;
                }
            }
        }else{
            for(int i=0; i<n-1; i++){
                if((f[i]=="lu" && f[i+1]=="ru")
                || (f[i] == "ru" && f[i+1] == "lu")
                || (f[i] == "ld" && f[i+1] == "rd")
                || (f[i] == "rd" && f[i+1] == "ld")){
                    count++;
                }
            }
        }
        cout << count << endl;
    }
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    int cnt = 0;
    for(int i = 1; i <= N; i++) {
        if(i < 10 || (99 < i && i < 1000) || (9999 < i && i < 100000) ||
           (999999 < i && i < 10000000)) {
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 384
import sys

#TODO: Find a better DP solution
#Current is just a recursive solution
#Time complexity of recursive solutions?

class Solution(object):
	def __init__(self):
		self.n = 0
		self.p = []
		self.result = 0

	def readInput(self):
		self.n = int(sys.stdin.readline())
		a = sys.stdin.readline().split()
		for i in xrange(self.n):
			self.p.append(float(a[i]))
		#print self.p

	def coinTossRec(self, idx, tail_count, prob):
		if idx == self.n - 1:
			#last index
			self.result += (prob * self.p[idx])
			if tail_count != 0:
				#Check for head
				self.result += (prob * (1-self.p[idx]))
		else:
			self.coinTossRec(idx+1, tail_count, prob * self.p[idx])
			if tail_count != 0:
				self.coinTossRec(idx+1, tail_count-1, prob * (1-self.p[idx]))

	def coinTossIter(self):
		dp = [0] * (self.n + 1) #i is the probability of i heads so far
		dp[0] = 1
		for i in xrange(self.n):
			p_heads = self.p[i]
			for j in xrange(i+1, -1, -1):
				if j == 0:
					dp[j] = dp[j] * (1 - p_heads)
				else:
					dp[j] = dp[j-1] * p_heads + dp[j] * (1- p_heads)
		ans = 0
		for i in xrange((self.n//2) + 1, self.n+1):
			ans += dp[i]

		print ans

	def coinToss(self):
		tail_count = self.n // 2 if self.n %2 == 1 else self.n //2 - 1
		self.coinTossRec(0, tail_count, 1)
		print self. result		


if __name__ == '__main__':
	s = Solution()
	s.readInput()
	s.coinTossIter()

Measured memory_bytes: 2948
program slimes
    implicit none
    integer(4):: n,count=1
    character(:),allocatable:: s

    read*,n
    allocate(character(n):: s)
    read*,s

    block; integer(4):: i
        do i=2, n
            if (s(i-1:i-1) /= s(i:i)) count=count+1
        end do
    end block
    
    print*, count
end program slimes

Measured memory_bytes: 768
N, Y = [int(x) for x in input().split(' ')]


for i in range(N + 1):
    for j in range(N - i + 1):
        k = N - i - j
        if k >= 0 and 10000 * i + 5000 * j + 1000 * k == Y:
            print(i, j, k)
            exit()

print('-1 -1 -1')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
vi adj[100001];
vi dp[100001];
int best[100001];
int par[100001];
void dfs(int u, int p)
{
	par[u]=p;
	for(int i = 0; i < adj[u].size(); i++)
	{
		int v = adj[u][i];
		if(v==p) continue;
		dfs(v,u);
	}
	int a = -1;
	map<int,int> ma;
	for(int i = 0; i < adj[u].size(); i++)
	{
		int v = adj[u][i];
		if(v==p) continue;
		for(vit it = dp[v].begin(); it != dp[v].end(); it++)
		{
			ma[(*it)]++;
		}
	}
	for(mit it = ma.begin(); it != ma.end(); it++)
	{
		if(it->se>=2) a = it->fi;
	}
	int b = a + 1;
	while(ma[b]>0)
	{
		b++;
	}
	dp[u].pb(b);
	for(mit it = ma.begin(); it != ma.end(); it++)
	{
		if(it->fi>b) dp[u].pb(it->fi);
	}
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i = 0; i < n - 1; i++)
	{
		int u, v; cin>>u>>v;
		u--; v--;
		adj[u].pb(v); adj[v].pb(u);
	}
	dfs(0,-1);
	vit it = dp[0].end();it--;
	cout<<(*it)<<'\n';
}


Measured memory_bytes: 26752
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
#include<regex>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl; }
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;


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

	vector<int> A(N), B(N), C(N - 1);
	rep(i, N) { cin >> A[i]; A[i]--; }
	rep(i, N) cin >> B[i];
	rep(i, N - 1) cin >> C[i];

	int ans = 0;
	for (int i = 0; i < N - 1; i++) {
		ans += B[A[i]];
		if (A[i + 1] == A[i] + 1) {
			ans += C[A[i]];
		}
	}
	ans += B[A[N - 1]];

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

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	string s;
	cin >> s;
	int n = (int) s.size();
	map<char, pair<int, bool>> m;
	if (n >= 2) {
		int idx = 0;
		while (idx < n) {
			if (m[s[idx]].second) {
				if (idx - m[s[idx]].first <= 2) {
					debug() << imie(m[s[idx]]);
					cout << m[s[idx]].first  + 1 << " " << idx + 1 << "\n";
					return 0;
				}
			}
			m[s[idx]].first = idx;
			m[s[idx]].second = true;
			idx++;
		}
	}
	cout << "-1 -1\n";
	return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  if(a==b && a==c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){
    int n,vsum=0,csum=0;
    cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    for(int i=0;i<n;i++){
        cin >>v.at(i);
    }

    for(int i=0;i<n;i++){
        cin >>c.at(i);
    }

    for(int i=0;i<n;i++){
        if(v.at(i)>c.at(i)){
            vsum+=v.at(i);
            csum+=c.at(i);
        }
    }

    cout << vsum-csum << endl;
    
}

Measured memory_bytes: 256
N,M=map(int,input().split())
K=[list(map(int,input().split()))for _ in range(M)]
*P,=map(int,input().split())

ans=0
for i in range(2**N):
    ls = [1]*N
    for j in range(len(ls)):
        if (i >> j) & 1:
            ls[j] = 0
    count2=0
    count3=0
    for line in K:
        i=1
        count1=0
        while i<len(line):
            if ls[line[i]-1]==1:
                count1+=1
            i+=1
        if count1%2==P[count3]:
            count2+=1
        count3+=1
    ans+=1*(count2==M)


print(ans)

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

int main()
{
	int a, b, c , d;
	cin >> a >> b >> c >> d;
	
	while(c >= 0 && a >= 0) {
		c = c - b;
		if(c <= 0) {
			cout << "Yes" << endl;
			break;
		}
		a = a - d;
		if(a <= 0) {
			cout << "No" << endl;
			break;
		}
	}
}


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

int main() {
    int s, w;
    cin >> s >> w;

    if (s <= w)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3596
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt();
    const isprime = function (p) {
        if (p == 1) return false;
        for (let i = 2; i < p; i++) {
            if (p % i == 0) return false;
        }
        return true;
    }
    let n = N, ans = [];
    for (let i = 11; i <= 55555 && n > 0; i += 5) {
        if (isprime(i) == true) {
            ans.push(i);
            n--;
        }
    }
    console.log(ans.join(' '));
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7756
import java.util.*;
import java.math.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String  out = "";
    while (scanner.hasNext()) {
      int a1 = scanner.nextInt();
      int m1 = scanner.nextInt();
      int a2 = scanner.nextInt();
      int m2 = scanner.nextInt();
      int a3 = scanner.nextInt();
      int m3 = scanner.nextInt();
      if (a1 == 0 && m1 == 0 && a2 == 0 && m2 == 0 && a3 == 0 && m3 == 0) {
        break;
      }
      long xc = aaaa(a1, m1);
      long yc = aaaa(a2, m2);
      long zc = aaaa(a3, m3);
      long xl = lcm(xc, yc);
      long yl = lcm(yc, zc);
      long zl = lcm(xc, zc);
      for (;;) {
        if (xl == yl && yl == zl && xl == zl) {
          out += xl + "\n";
          break;
        }
        long xw = lcm(xl, yl);
        long yw = lcm(yl, zl);
        long zw = lcm(xl, zl);
        xl = xw;
        yl = yw;
        zl = zw;
      }
    }
    System.out.print(out);
  }

  private static long aaaa (int a, int m) {
    int x = 1;
    for (int c = 0; ; c++) {
      if (c != 0 && x == 1) {
        return c;
      }
      x = a * x % m;
    }
  }

  private static long lcm (long aa, long bb) {
    BigInteger a = new BigInteger(String.format("%d", aa));
    BigInteger b = new BigInteger(String.format("%d", bb));
    long gcd = a.gcd(b).intValue();
    return aa * bb / gcd;
  }

}

Measured memory_bytes: 22836
import java.util.*;
class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	String s = scan.next();
        int length = s.length();
        int sublength =1;
      	int check = 0; 
        int ans = 0;
      	for(int i=0;i<length-1;i++){
        	if(s.substring(i,i+1).equals(s.substring(i+1,i+2))){
              if(check == 0){
              	ans += sublength;
                check =1;
              } else {
              	check = 0;
              }
              sublength =1;
            } else {
            	sublength++;
            }
        }
        if(check ==0){
        	ans+=sublength;
        }
        if(ans < (double)length/2){
        	System.out.println(ans);
        } else {
        	System.out.println(length - ans);
        }
    }
}

Measured memory_bytes: 35180
#include<iostream>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

 
int main() {
	int N;
	cin >> N;
	ll ans = 1LL;
	ll T[110];
	for (int i = 0; i < N; ++i) {
		cin >> T[i];
		ans =lcm(ans, T[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
for j in range(N):
    S_ = []
    for i in S:
        if ord(i) == 90:
            mozi = chr(65)
        else:
            mozi = chr(ord(i)+1)

        S_.append(mozi)
    S = S_
for i in S:
    print(i,end="")


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;


int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    map<ll,int>mp;
    rep(i,n){
        mp[a[i]]^=1;
    }
    ll ans = 0;
    for(auto it=mp.begin();it!=mp.end();it++){
        auto p = *it;
        if(p.second==1)ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10344
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
lli modexp(lli x, lli y)
{
	lli res = 1ll;
	while (y > 0ll)
	{
		if (y & 1ll)
			res = (res * x) % MOD;
		x = (x * x) % MOD;
		y >>= 1ll;
	}
	return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli n = 0ll, res = 0ll;
	cin >> n;
	res = (res + modexp(10, n)) % MOD; res = (res - 2ll * modexp(9, n)) % MOD;
	res = (res + modexp(8, n)) % MOD;
	if (res < 0ll)
		res += MOD;
	cout << res << endl;
}

Measured memory_bytes: 3620
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let sum = (a + b + 1) / 2;
    println!("{}", sum);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll ans = 0;
    ans = (n / 500) * (1000);
    n = n % 500;
    ans += (n / 5) * 5;
    cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;

int main(){
	int i,j,k,l,a,b,c,d;
	scanf("%d%d",&a,&b);
    if(a<=b) printf("unsafe");
    else printf("safe");
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */


Measured memory_bytes: 3824
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

var dp [100001][2]int

func loop(k, j int, a []int) int {
	if dp[k][j] != -1 {
		return dp[k][j]
	}
	ret := 0
	for _, v := range a {
		if k-v >= 0 {
			if loop(k-v, (j+1)%2, a) == 0 {
				ret = 1
			}
		}
	}
	dp[k][j] = ret
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	N, K := getInt(), getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}

	for i := 0; i <= 100000; i++ {
		dp[i][0] = -1
		dp[i][1] = -1
	}

	ret := loop(K, 0, a)

	ans := "First"
	if ret == 0 {
		ans = "Second"
	}

	out(ans)
}


Measured memory_bytes: 31360
S = list(input())
w = int(input())
counter = 1
res = ''
if w == 1:
    print(''.join(S))
else:
    for i in S:
        if counter == 1:
            res = res + i
            counter += 1
        elif counter == w:
            counter = 1
        else:
            counter += 1
    print(res)

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

int main(){
  long long a,b,c,d;
  cin >> a >> b >> c;
  d = c-a-b;
  if(d<1){
    cout << "No" << endl;
    return 0;
  }
  if(4*a*b < d*d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}


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

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    int a,b;
    cin>>a>>b;

    if(a<b){
        rep(i,b){
            cout<<a;
        }
        cout<<endl;
        return 0;
    }
    rep(i,a){
        cout<<b;
    }
    cout<<endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int t[300000];

int solve(){
  int l=0;
  for(int i=0;i<n;i++){
    if(l<i*10)return 0;
    l=max(l,i*10+t[i]);
  }
  return 1;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>t[i];
  int a=solve();
  reverse(t,t+n);
  int b=solve();
  if(a==1&&b==1)cout<<"yes"<<endl;
  else cout<<"no"<<endl;
  return 0;
}


Measured memory_bytes: 4248
def non_minus(n):
    if n < 0:
        return (-1) * n
    else:
        return n

def kyori(n1, n2):
    n1 = non_minus(n1)
    n2 = non_minus(n2)
    n3 = non_minus(n1 - n2)
    return n3

def minkov(x: list, y: list, p: int):
    len_x = len(x)
    dm = 0
    for i in range(len_x):
        dm += kyori(x[i], y[i])**p
    dxy = dm**(1/p)
    return dxy

def chebyshev(x: list, y: list):
    d_ary = []
    len_x = len(x)
    for i in range(len_x):
        d_ary.append(kyori(x[i], y[i]))
    
    return max(d_ary)

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

print(minkov(x,y,1))
print(minkov(x,y,2))
print(minkov(x,y,3))
print(float(chebyshev(x,y)))






Measured memory_bytes: 5652
#include <bits/stdc++.h>
#include<limits.h>
#include<stdio.h>
#include<cstring>
#include<string>
using namespace  std;
typedef long long ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
// #define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
typedef map<ll,ll> m64;
const int LIM = 1e5+5, MOD =  1e9;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a % b); }
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
// void SieveOfEratosthenes(ll n)
// // { memset(seive, true, sizeof(seive)); for (ll p=2; p*p<=n; p++) if (seive[p] == true) for (ll i=p*p; i<=n; i += p) seive[i] = false; }
// // ll a[11*LIM]={0},b[11*LIM]={0};
// // vp64 v[LIM];
// typedef struct 
// {
// 	ll one,two,three;
// }data;


ll dis (ll x,ll y)
{
	return (x-y)*(x-y);
}
ll mod=1e9+7;
ll fact[100004];
ll n,k;
ll ans=1;
v64 v[100004];
void dfs (ll i,ll p)
{
	if (i==1)
	{
		ans=ans*fact[k]/((fact[k-v[i].size()-1]));
		for (auto x:v[i])
		{
			if (x!=p)
				dfs(x,i);
		}
	}
	else
	{
		ans=ans*fact[k-2]/((fact[k-1-v[i].size()]));
		for (auto x:v[i])
		{
			if (x!=p)
				dfs(x,i);
		}
	}
}

bool compare (string s1,string s2)
{
	return s1.length()<s2.length();
}
int main()
{
	fast;
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	s[k-1]=s[k-1]-'A'+'a';
	cout<<s;
	

}

Measured memory_bytes: 2560
#include<stdio.h>
const int maxn = 1e5+5;

int a[maxn];
int can[maxn];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) {scanf("%d",&a[i]);can[i]=1;}

    for(int i=1;i<=m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        if(a[u]>=a[v]) can[v] = 0;
        if(a[v]>=a[u]) can[u] = 0;
    }
    int ans = 0;
    for(int i=1;i<=n;i++) if(can[i]) ans++;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2464
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL INF=1e18;
const int MAX=200010;
int n,m;
int a[MAX];
char s[MAX];
int check(int l,int r)
{
    if((a[l]!=a[r]&&(r-l+1)%2==1)||(a[l]==a[r]&&(r-l+1)%2==0))
        return 1;//UP
    return 0;//DOWN
}
int f(int x)
{
    printf("%d\n",x);
    fflush(stdout);
    scanf("%s",s);
    if(s[0]=='V')
        return 1;
    if(s[0]=='M')
        a[x]=1;
    else
        a[x]=0;
    return 0;
}
int main()
{
    int i,j,k,t;
    while(~scanf("%d",&n))
    {
        int base=2;
        int now=0;
        int next;
        int l=0,r=n/2;
        if(f(l))
            continue;
        if(f(r))
            continue;
//        printf("*");
        if(check(l,r))
        {
        }
        else
        {
            l=r;
            r=n;
            a[n]=a[0];
        }
            for(i=0; i<18; i++)
            {
                int mid=(l+r)/2;
                if(f(mid))
                    break;
                if(check(l,mid))
                    r=mid;
                else
                    l=mid;
            }
    }
    return 0;
}
 
//fflush(stdout);

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

int main(void){
    int n;
    cin >> n;
    vector<pair<int,int>> p;
    for(int i=1;i<=n;i++){
        int t;
        cin >> t;
        p.push_back(make_pair(t,i));
    }
    sort(p.begin(),p.end());
    for(int i=0;i<n;i++){
        if(i!=n-1) cout << p[i].second << " ";
        else cout << p[i].second << endl;
    }
}

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

struct UnionFind {
    // comment: https://youtu.be/TdR816rqc3s?t=6822 (AtCoder)
    // each element represent a node where value points to their group representative
    vector<int> d;
    // initialize
    UnionFind(int n=0): d(n, -1) {}
    // find the root node for x (the root of the group where x belongs to)
    int findRoot(int x) {
        if (d[x] < 0) return x; // root has value < 0 (- size of group)
        return d[x] = findRoot(d[x]); // find root recursively (also update values of intermediate node)
    }
    // combine group X (x belongs) and group Y (y belongs) into one big group
    bool uniteTwoNodes(int x, int y) {
        // find the root of X and Y
        x = findRoot(x); y = findRoot(y);
        // x and y in the same group already
        if (x == y) return false; // can't join
        // combine 2 groups by joining the smaller group to the bigger one
        // size of group = - (value of root node)
        // want to join Y into X (so X need to be the bigger one)
        // if X is the smaller one (-d[x] < -d[y])
        if (d[x] > d[y]) swap(x, y); // swap X to be the bigger group
        d[x] += d[y]; // update the size of new X (sum of sizes of X and Y)
        d[y] = x;
        return true; // successfully joint
    }

    // check if 2 nodes are in the same group
    bool inSameGroup(int x, int y) { return findRoot(x) == findRoot(y); }
    // size of Group where x belongs to
    int sizeOfGroup(int x) { return -d[findRoot(x)]; }
};

int main() {
    int n, m;
    cin >> n >> m;
    
    // initialize a unionFindStructure with n nodes
    UnionFind uf(n);
    
    // generate UnionFind based on inputs
    for (int i=0; i<m; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b; // index starts at 0
        uf.uniteTwoNodes(a, b);
    }

    // find group with largest size
    int ans = 0;
    for (int i=0; i<n; ++i) {
        ans = max(ans, uf.sizeOfGroup(i));
    }

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

Measured memory_bytes: 4056
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {     
    int n;
    cin >> n;
    long long int a, b;
    cin >> a >> b;
    vector<int> v(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    long long int res = 0;
    for (int i = 1; i < n; i++) {
        res += min(b, a * (v[i] - v[i - 1]));
    }
    cout << res << endl;
}




Measured memory_bytes: 3792
# include <iostream>

using namespace std;

const int N = 1e5 + 100;

long long n, mn = 1;
long long a[N];
long long b[N];

int main()
{
    ios_base::sync_with_stdio( false );
    cin >> n;
    for( int i = 1; i <= n; i ++ )
        cin >> a[i];

    for( int i = 1; i <= n; i ++ )
        if( a[mn] > a[i] )
            mn = i;
    b[mn] = a[mn] * 2;

    for( int i = mn+1; i <= n; i ++ ){
        b[i] = (a[i-1] - b[i-1]/2) * 2;
    }
    for ( int i = 1; i < mn; i ++ ){
        if( i == 1 ){
            b[i] = ( a[n] - b[n]/2 ) * 2;
        }else{
            b[i] = ( a[i-1] - b[i - 1]/2 ) * 2;
        }
    }
    long long cnt = 0;
    long long  mn2 = mn - 1;
    if( mn2 == 0 ) mn2 = n;
    cnt = (b[mn2] + b[mn] - a[mn2]* 2 ) /2;


    for( int i = mn; i <= n; i ++ ){
        if( (i - mn) % 2 == 0 )b[i] -= cnt;
        else b[i] += cnt;
    }
    for( int i = mn-1; i >= 1; i -- ){
        if( (mn-1-i) % 2 == 0 )b[i] -= cnt;
        else b[i] += cnt;
    }
    for( int i = 1; i <= n; i ++ ){
        cout << b[i] << ' ' ;
    }
    return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int[] m = new int[n];
		int min = 0;
		int sum = 0;
		m[0] = sc.nextInt();
		min = m[0];
		sum = m[0];
		for(int i=1; i<n; i++) {
			m[i] = sc.nextInt();
			min = min<m[i]?min:m[i];
			sum = sum + m[i];
		}
		
		int sub = x - sum;
		int count = sub/min;
		System.out.println(count + n);
		
		
	}

}


Measured memory_bytes: 21716
using System;
class hogehoge
{
	static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		if (n == 1) Console.WriteLine("Hello World");
		else if (n == 2)
		{
			int a = int.Parse(Console.ReadLine());
			int b = int.Parse(Console.ReadLine());
			Console.WriteLine((a + b));
		}
	}
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <math.h>

int main( int argc, char *argv[] )
{
    int a, b, h, m;
    double th1, th2;
    double x1, y1, x2, y2;
    double l;

    scanf( "%d %d %d %d", &a, &b, &h, &m );

    th1 = (h*60.+m) / 60. * 30. * 3.14159265359 / 180.;
    th2 = m * 6. * 3.14159265359 / 180.;

    x1 = (double)a * sin( th1 );
    x2 = (double)b * sin( th2 );
    y1 = (double)a * cos( th1 );
    y2 = (double)b * cos( th2 );

    l = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
    printf( "%20.15lf\n", l );
}


Measured memory_bytes: 2476
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORq(i, m, n) for(int i = (m); i < (n); i++)
#define FORr(i, n) for (int i = (n); i >= 0; i++)

int main() {
	int x, y;
	cin >> x >> y;
	cout << x + (y / 2) << endl;
}

Measured memory_bytes: 256
from collections import Counter

def main():
    N = int(input())
    S = []
    for i in range(N):
        S.append(input())
    c = Counter(S)

    result_strs = ['AC', 'WA', 'TLE', 'RE']
    for r in result_strs:
        print(f'{r} x {c[r]}')

if __name__ == '__main__':
    main()

Measured memory_bytes: 16612
import numpy as np
N = int(input())
A = np.array(input().split(), dtype=int)
B = np.array(input().split(), dtype=int)

ans = 0
mod = 1
for k in range(30):
    T = mod
    mod *= 2
    c = 0
    b = np.sort(B % mod)
    a = A % mod
    L1, R1, L2, R2 = (np.searchsorted(b, x - a).sum() for x in (T, 2*T, 3*T, 4*T))
    c += R1 - L1
    c += R2 - L2

    if c % 2:
        ans += T

print(ans)


Measured memory_bytes: 57672
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,x;
  bool check=true;
  cin>>N;
  for(int i=0;i<N;i++){cin>>x;if(x%2==0){if(x%3!=0&&x%5!=0)check=false;}}
  check==true?cout<<"APPROVED"<<endl:cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;

int n;
vector<int>h;
int res=0;
void solve(int l,int r)
{
  //cout<<l<<" "<<r<<endl;
  //rep(i,n)cout<<h[i];  cout<<endl;
  int min=1e9+7;
  repi(i,l,r)
  {
    chmin(min,h[i]);
  }
  repi(i,l,r)
  {
    h[i]-=min;
  }
  res+=min;
  int nl=0;
  bool f=0;
  repi(i,l,r)
  {
    if(f&&h[i]==0){f=0;solve(nl,i);}
    if(!f&&h[i]>0)
    {
      nl=i;
      f=1;
    }

  }
  if(f)solve(nl,r);
  //rep(i,n)cout<<h[i];  cout<<endl;

}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n;
  h.resize(n);
  rep(i,n)cin>>h[i];
  solve(0,n);
  cout<<res<<endl;


  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 2000000

int id[MAX];

int left(int i){
  return 2 * i;
}
 
int right(int i){
  return 2 * i + 1;
}

void maxHeapify(int n,int i){
	int l,r,bigger,temp;
	l = left(i);
	r = right(i);

	if(l <= n && id[l] > id[i]){
		bigger = l;
	}else bigger = i;

	if(r <= n && id[r] > id[bigger]){
		bigger = r;
	}

	if(bigger != i){
		temp = id[i];
		id[i] = id[bigger];
		id[bigger] = temp;
		maxHeapify(n,bigger);
	}
}

int main(){
	int i,n;

	scanf("%d",&n); /*回数*/

	for(i=1;i<=n;i++){
		scanf("%d",&id[i]);
	}

	for(i=n/2;i>=1;i--){
		maxHeapify(n,i);
	}

	for(i=1;i<=n;i++){
		printf(" %d",id[i]);
	}

	printf("\n");

	return 0;
}


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

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

    int AB, BC, CA; cin >> AB >> BC >> CA;
    if (AB > CA) swap(AB, CA);
    if (BC > CA) swap(BC, CA);
    cout << AB * BC / 2 << "\n";
}

Measured memory_bytes: 256
from math import sqrt
from bisect import bisect
n,m = (int(i) for i in input().split())
x = []
for i in range(1,int(sqrt(m))+1):
	if m%i==0:
		x.append(i)
		x.append(m//i)
x.sort()
print(x[bisect(x,m//n)-1])

Measured memory_bytes: 3188
#include <iostream>

int main() {
    using namespace std;
    long long n, a, b;
    cin >> n  >> a >> b;
    long long sets, imp;
    // cout << "a: " << a << endl;
    sets = n / (a + b);
    // cout << "sets: " << sets << endl;
    imp = n % (a + b);
    // cout << "imp: " << imp << endl;
    // cout << "sets b : " << sets * b << endl;
    // cout << "imp -a :" << imp - a << endl;
    if (imp <= a){
        cout << (sets * a) + imp;
    } else {
        cout << (( sets + 1) * a);
    }
}

Measured memory_bytes: 3624
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var input = Reads();
            var a = input[0];
            var b = input[1];
            long answer = 0;
            bool f = false;
            for (int i = 0; i <= 1250; i++)
            {
                var n =(long) Math.Truncate(i * 0.08);
                var m = (long)Math.Truncate(i * 0.1);
                if (n == a && m == b)
                {
                    answer = i;
                    f = true;
                    break;
                }
            }
            if (f)
                Console.WriteLine(answer);
            else
                Console.WriteLine(-1);



            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13396