akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";}
template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";}
template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<double,int>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}

int main() {
  ll n,c,k; cin>>n>>c>>k;
  ll t[n];
  for(int i=0;i<n;i++) cin>>t[i];
  sort(t,t+n);
  queue<ll> que;
  for(int i=0;i<n;i++) {
    que.push(t[i]);
  }
  ll an=0;
  while(!que.empty()) {
    ll fs = que.front(); que.pop();
    ll tm = fs + k;
    // fs+kにバスを派遣
    int co=1;
    while(!que.empty() && co<c && que.front()<=tm) {
      co++;
      fs=que.front(); que.pop();
    }
    an++;
  }
  cout<<an<<endl;
}

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

string shuffle(string str,int h){
    string head = str.substr(0,h);
    string tail = str.substr(h,str.size()-h);
    return tail + head ;
}

int main(){
    string cards;
    int m,h;
    
    while(1){
        cin >> cards;
        if (cards == "-") break;
        
        cin >> m;
        for (int i=0; i<m; i++){
            cin >> h;
            cards= shuffle(cards,h);
        }
        cout << cards << endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;

int calc(ll num) {
  ll sum = 0;
  while (num % 2 == 0) {
    num /= 2;
    sum++;
  }
  return sum;
}

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

  ll a[N];
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += calc(a[i]);
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 384
N = int(input())
B = list(map(int, input().split()))

if N == 2:
        print(B[0] * 2)
        exit()

sum = 0
for i in range(len(B)+1):
        if i == len(B):
                sum += B[-1]
        elif i == 0:
                sum += B[0]
        else:
                sum += min(B[i-1], B[i])
print(sum)

Measured memory_bytes: 38384
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from sys import stdin

def gradient(x1, y1, x2, y2):
    if x1 - x2 == 0.0:
        return float('inf')
    return (y1 - y2) / (x1 - x2)

for n in xrange(int(stdin.readline())):
    p = [float(s) for s in stdin.readline().split()]
    if gradient(*p[:4]) == gradient(*p[4:]):
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 4276
/*
    Name:zhangchuanyan
    Copyright:HHTC
    Author:zhangchuanyan
    Date: 2020/8/15 20:43:59
    Description:
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
int a[110];
int main()
{
	int N;
	cin>>N;
	int ans=0;
	for(int i=1;i<=N;i++) cin>>a[i];
	for(int i=1;i<=N;i++){
		for(int j=i+1;j<=N;j++){
			for(int k=j+1;k<=N;k++){
				if((a[i]+a[j])>a[k]&&(a[i]+a[k])>a[j]&&(a[j]+a[k])>a[i]){
					if(a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k])
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3192
def fx(n):
  s = [0]*(n+1)
  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula <= n and formula > 0:
          s[formula] += 1
        if formula >= n:
          break
  return s


n = int(input())
s = fx(n)
for i in range(1,n+1):
  print(s[i])

Measured memory_bytes: 9208
import  java.util.Scanner;
//import jaava.util.InputMismatchException;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s1 = sc.next();
    String s2 = sc.next();
    int count=0,i;
    for(i=0;i<3;i++){
      if(s1.charAt(i)==s2.charAt(i))count++;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21844
function Main(input) {
  const numbers = input.split(' ').map(n => Number(n));
  const a = numbers[0];
  const b = numbers[1];
  const c = numbers[2];

  if(a <= c && c <= b) {
    console.log('Yes');
  } else {
    console.log('No')
  }
}

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

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef pair<ll, ll> P;
const int MAXN = 2e5 + 7;
const int LOG = 20;
const int INF = 0x3f3f3f3f;
int a[MAXN], cnt[MAXN], sum[MAXN], b[MAXN];
void solve() {
    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        b[i] = a[i];
        cnt[a[i]]++;
    }
    sort(b, b+n);
    int tn = unique(b, b+n) - b;
    int ans = 0;
    for(int i = 0;i < tn;i++){
        sum[b[i]] = cnt[b[i]] * (cnt[b[i]]-1) / 2;
        ans += sum[b[i]];
    }
    for(int i = 0;i < n;i++){
        ans -= sum[a[i]];
        cout << ans + (cnt[a[i]]-1)*(cnt[a[i]]-2) / 2 <<endl;
        ans += sum[a[i]];
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int T;
    T = 1;
    while(T--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 8448
'use strict'

function main(s) {

  s = s.split('\n');
  const a = Number(s[0]);
  const b = Number(s[1]);
  const c = Number(s[2]);
  const x = Number(s[3]);
  let counter = 0;

  for (let i = 0; i <= a; i++) {
    for (let j = 0; j <= b; j++) {
      for (let k = 0; k <= c; k++) {
        const sum = (500 * i) + (100 * j) + (50 * k)
        if (sum === x) counter += 1;
      }
    }
  }

  console.log(counter);
}

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


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 0;i < (N+1)/2;i++ ){
        int count = 0;
        for(int j = 1;j < N+1;j++){
            if((i*2+1)% j == 0)count++;
        }
        if(count == 8)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())

ans = list(range(A))
m = 0
rest = N - A
B -= 1
if rest < B:
  print(-1)
  exit()
if rest / A > B:
  print(-1)
  exit()

while rest > B:
  s = min(A, rest - B + 1)
  ans += list(range(m - s, m))
  m -= s
  rest -= s
  B -= 1

ans += list(range(m - B, m))[::-1]
m -= B

print(" ".join([str(x - m + 1) for x in ans]))


Measured memory_bytes: 37452
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9

int N,C;
int s[100000],t[100000],c[100000];
int sm[200002];
int tt[200002];

int main(){
    cin>>N>>C;
    for(int i=0;i<N;i++) cin>>s[i]>>t[i]>>c[i];
    
    for(int i=1;i<=C;i++){
        for(int j=0;j<200002;j++) tt[j]=0;
        for(int j=0;j<N;j++){
            if(c[j]==i){
                tt[s[j]*2-1]++,tt[t[j]*2]--;
            }
        }
        for(int j=1;j<200002;j++) tt[j]+=tt[j-1];
        for(int j=0;j<200002;j++){
            if(tt[j]>0) sm[j]++;
        }
    }
    int mx=0;
    for(int j=0;j<200002;j++) if(mx<sm[j]) mx=sm[j];
    cout<<mx<<endl;
}


Measured memory_bytes: 2944
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define rep(i,n) for(LL i=0;i<n;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;


#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL vmax(vi v, LL n) {
	int MAX = 0;
	f(i, 0, n) {
		MAX = max(MAX, v[i]);
	}
	return MAX;
}

LL vmin(vi v, LL n) {
	int MIN = LL_INF;
	f(i, 0, n) {
		MIN = min(MIN, v[i]);
	}
	return MIN;
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//エラトステネスの篩
void sieve(LL n) {
	vb s(n + 1, true);
	f(i, 2, n + 1) {
		for (int j = 2; i*j <= n; j++) {
			s[i*j] = false;
		}
	}
	cout << "2から" << n << "までの素数" << endl;
	f(i, 2, n + 1) {
		if (s[i]) {
			cout << i << " ";
		}
	}
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


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

signed main() {
	int n;
	st s;
	mcl m;
	cin >> n >> s;
	int ans = 0;
	f(i, 1, n - 1) {
		int cnt = 0;
		st fro = s.substr(0, i);
		st bac = s.substr(i, n - i);
		f(j, 0, size(fro)) {
			m[fro[j]]++;
		}
		f(j, 0, size(bac)) {
			if (m[bac[j]] > 0) {
				m[bac[j]] = 0;
				cnt++;
			}
		}
		ans = max(ans, cnt);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
//__builtin_popcountll()

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int d,t,s;
    	cin>>d>>t>>s;
    	if(s*t<d)
    	{
    		cout<<"No";
		}
		else
		{
			cout<<"Yes";
		}

    }

}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N,Q;
bool P [100001];

bool in_range(int x)
{
	return x >= 1 && x <= N;
}

int main()
{
	scanf("%d%d",&N,&Q);
	vector<int> A(N + 1);
	for(int i = 1;i <= N;i++){
		A [i] = i;
	}
	int ans = 2;
	P [1] = true;
	P [2] = true;

	FOR(i,0,Q){
		int x,y;
		scanf("%d%d",&x,&y);
		swap(A [x],A [y]);
		for(int i = -1;i <= 1;i++) if(in_range(x + i) && A [x + i] == 1){
			for(int j = -1;j <= 1;j++) if(in_range(x + i + j) && P [A [x + i + j]] == false){
				ans++;
				P [A [x + i + j]] = true;
			}
		}
		for(int i = -1;i <= 1;i++) if(in_range(y + i) && A [y + i] == 1){
			for(int j = -1;j <= 1;j++) if(in_range(y + i + j) && P [A [y + i + j]] == false){
				ans++;
				P [A [y + i + j]] = true;
			}
		}
	}

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

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int a;
  cin>>a;

  int cnt=1;
  vector<bool> p(1000005,false);
  while(1){
    if(p[a]){
      cout << cnt << endl;
      return 0;
    }
    p[a]=true;
    cnt++;
    if(a%2==0) a/=2;
    else a=a*3+1;
  }

}

Measured memory_bytes: 3768
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F0(i, n) for (int i = 0; i < n; i++)
#define F1(i, n) for (int i = 1; i < n; i++)
#define Fi(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

template<class T>
T gcd(T a, T b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a = gi();
    printf("%d\n", a + a*a + a*a*a);

    return 0;
}


Measured memory_bytes: 3816
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない


int main() {

	int n;
	int nh = 0;
	int ans = 0;
	int h[100];

	cin >> n;

	rep(i, 0, n) {
		cin >> h[i];
	}

	rep(i, 0, n) {
		if (nh < h[i]) {
			ans += h[i] - nh;
		}
		nh = h[i];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n, m, w[110], v[110];
long long s[110][110];
vector <int> a[5];

bool cmp(int a, int b) {
	return a > b;
}

int main()
{
	cin >> n >> m >> w[1] >> v[1];
	a[1].push_back(v[1]);
	long long ans = 0;
	for(int i = 2; i <= n; i++) {
		cin >> w[i] >> v[i];
		a[w[i] - w[1] + 1].push_back(v[i]);
	}
	for(int i = 1; i <= 4; i++) sort(a[i].begin(), a[i].end(), cmp);
	for(int i = 1; i <= 4; i++) 
		for(int j = 0; j < a[i].size(); j++)
			s[i][j + 1] = s[i][j] + a[i][j];
	for(int i = 1; i <= 4; i++) a[i].push_back(0);
	for(int s1 = 0; s1 < a[1].size(); s1++)
		for(int s2 = 0; s2 < a[2].size(); s2++)
			for(int s3 = 0; s3 < a[3].size(); s3++)
				for(int s4 = 0; s4 < a[4].size(); s4++)
					if(1ll * s1 * w[1] + 1ll * s2 * (w[1] + 1) + 1ll * s3 * (w[1] + 2) + 1ll * s4 * (w[1] + 3) <= m) {
						ans = max(ans, s[1][s1] + s[2][s2] + s[3][s3] + s[4][s4]);
						//cout << s1 << " " << s2 << " " << s3 << " " << s4 << " " << ans << endl;
					}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}



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




namespace ConsoleApplication1 {

    

    class ClassMain {




        public static bool[] primes = Enumerable.Repeat(true, 1000000 + 1).ToArray();

        public static void sieve() {
            primes[0] = false; primes[1] = false;
            for (int i = 2; i < primes.Length / 2 + 1; i++) {
                if (primes[i]) {
                    for (int j = 2; j * i < primes.Length; j++) {
                        primes[i * j] = false;
                    }
                }
            }
        }



        public static void Main(String[] args) {
            sieve();
            string line;
            while ((line = Console.ReadLine()) != null) {
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int n = ints[0];
                //int n = int.Parse(line);                
                if (n == -1) { break; }
                int a = ints[1];
                int[] greaterPrimes = new int[30];
                int primecnt=0;
                for (int i = n + 1; primecnt < 30; i++) {
                    if (primes[i]) { greaterPrimes[primecnt] = i;
                    primecnt++;
                    }
                }
                //Console.WriteLine(string.Join(",", greaterPrimes));
                List<int> combis = new List<int>();
                for (int i = 0; i < 30; i++) {
                    for (int j = i; j < 30; j++) {
                        combis.Add(greaterPrimes[i] + greaterPrimes[j]);
                    }
                }
                combis.Sort();
                //Console.WriteLine(string.Join(",", combis.ToArray()));
                
                Console.WriteLine(combis.ElementAt(a-1));
                    
                



            }
        }
    }
}

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

int main() {
    int N;
    cin >> N;
    if (N % 10 == 9 || N/10 == 9) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
def binarySearch(t):
	left,right = 0,n
	while right > left+1:
		mid = (left+right) // 2
		if S[mid] == t:
			return True
		elif S[mid] > t:
			right = mid
		else:
			left = mid
	return False

n = int(input())
S = [int(s) for s in input().split()]
q = int(input())
T = [int(s) for s in input().split()]

print(sum([binarySearch(t) for t in T]))

Measured memory_bytes: 18656
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}



int n,p;

int a[110];
int dp[110][5200];

main(){
  cin>>n>>p;
  rep(i,n){
    cin>>a[i];
  }

  dp[0][0]++;

  FOR(i,1,n+1){
    FOR(j,0,5200){
      dp[i][j]+=dp[i-1][j];
      if(j-a[i-1]>=0)
      dp[i][j]+=dp[i-1][j-a[i-1]];
      //cout<<dp[i][j]<<' ';
    }
    //cout<<endl;
  }

  int ans=0;
  rep(i,5050){
    if(i%2==p&&dp[n][i]){
      ans+=dp[n][i];
    }
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h> 
using namespace std;
/* * * *   * * *   	* * * */
#define ll  long long
#define ld long double
#define ms(a,v) memset(a,v,sizeof a)
#define pii pair<int, int>
/* * * *   * * *   	* * * */
/* *
 *
 * Author: Hamkor
 *
 * */
int main(){
	int n; scanf("%d", &n);
	int a[n];
	for (int i=0;i<n; ++i)scanf("%d", a+i);
	int ans=0;
	for (int i=1; i<n-1; ++i){
		int b[3];
		b[0]=a[i-1]; b[1]=a[i]; b[2]=a[i+1];
		sort(b, b+3);
		if(b[1]==a[i])ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K, Q;
    cin >> N >> K >> Q;
    int score[100010];
    rep(i, N) score[i] = K - Q;
    rep(i, Q) {
        int A; cin >> A;
        A--;
        score[A]++;
    }
    rep(i, N) {
        if (score[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;
typedef long long ll;

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

	ll a, b, c;
	cin >> a >> b >> c;
	c = min(c, a + b + 1);
	cout <<c + b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

int divisor(int num){
    int ret = 0;

    rep1(i, num+1){
        if(num%i==0) ++ret;
    }

    return ret;
}

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

    int n;
    cin >> n;

    if(n <= 105){
        if(n == 105) cout << 1 << endl;
        else cout << 0 << endl;
        return 0;
    }

    int res = 1;
    for(int num = 106; num <= n; ++num){
        if(divisor(num)==8 && num%2==1) ++res;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()
C = []
p = S[0]
cur = 0
for c in S:
    if c == p:
        cur += 1
    else:
        C.append(cur)
        cur = 1
        p = c
if cur:
    C.append(cur)
ans = sum(e-1 for e in C)
l = len(C) // 2
if len(C) % 2:
    ans += min(K, l) * 2
else:
    if K >= l:
        ans = N-1
    else:
        ans += min(K, l) * 2
print(ans)

Measured memory_bytes: 3956
#include<cstdio>
using namespace std;
int field[1001][1001];
int main(void){
    int w;
    int ans_e,ans_w;
    int c = 0;
    while(scanf("%d",&w),w){
        ans_e = 0;
        ans_w = 0;
        c++;
        int i_exp[1001];
        int i_cos[1001];
        int n;
        scanf("%d",&n);
        for(int i = 1;i <= n;i++){
            scanf("%d,%d",&i_exp[i],&i_cos[i]);
        }
        for(int i = 1;i <= n;i++){
            for(int j = 0;j <= w;j++){
                field[i][j] = field[i-1][j];
                if(j - i_cos[i] >= 0 && field[i][j] <= field[i-1][j-i_cos[i]]+i_exp[i]) field[i][j] = field[i-1][j-i_cos[i]]+i_exp[i];
            }
        }
        ans_e = field[n][w];
        for(int i = w;i >= 0;i--){
            if(ans_e != field[n][i]){
                ans_w = i+1;
                break;
            }
        }
        printf("Case %d:\n%d\n%d\n",c,ans_e,ans_w);
    }
    return 0;
}

Measured memory_bytes: 4948
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
struct lll
{
    int x,y;
}a[110000];
int cmp(lll s1,lll s2)
{
    return s1.y>s2.y;
}
int main()
{
    int n,m;
    cin>>n>>m;
    int sum=0;
    int add=0;
    int max1=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].x>>a[i].y;
        max1=max(max1,a[i].x);
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
    {
        if(a[i].y<max1)
            break;
        sum+=a[i].y;
        add++;
        if(sum>=m)
        {
            cout<<add<<endl;
            return 0;
        }
    }
    int t;
    if((m-sum)%max1==0)
        t=(m-sum)/max1;
    else
        t=(m-sum)/max1+1;
    cout<<add+t<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

void print_a(VI v)
{
    if(v.size()) cout<<v[0];
    loop(i,1,v.size()) cout<<' '<<v[i];
    cout<<'\n';
}

VVI init_vvi(int n, int m, int val)
{
    return VVI(n,VI(m,val));
}

VVL init_vvl(int n, int m, LL val)
{
    return VVL(n,VL(m,val));
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n,m;
    cin>>n>>m;
    int u,v;

    VI g[n+1];
    loop(i,0,m)
    {
        cin>>u>>v;
        g[u].PB(v);
    }

    int f = 0;
    for(int u1 : g[1])
    {
        if(binary_search(all(g[u1]),n)) {f = 1; break;}
    }

    if(f) cout<<"POSSIBLE\n";
    else cout<<"IMPOSSIBLE\n";

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


Measured memory_bytes: 11860
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def sum_applepie(list1, l):
    r = [i+l-1 for i in list1]
    return sum(r)


def main():
    n, l = Input()
    applepie = sum_applepie(list(range(1, n+1)), l)
    list2 = []
    for i in range(1, n+1):
        temp = []
        for j in range(1, n+1):
            if i == j:continue
            temp.append(j)
        k = sum_applepie(temp, l)
        list2.append((abs(applepie - k), k))
    print(sorted(list2, key=lambda x:x[0])[0][1])


main()

Measured memory_bytes: 9132
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    cout << (ll)sqrt(n) * (ll)sqrt(n) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cctype>
#include <cassert>
#include <vector>
#include <algorithm>
#include <string>
#include <stdexcept>

intmax_t apply(intmax_t lhs, char op, intmax_t rhs, intmax_t p) {
  switch (op) {
  case '+': return (lhs+rhs) % p;
  case '-':
    lhs -= rhs;
    if (lhs < 0) lhs += p;
    return lhs;
  case '*': return (lhs*rhs) % p;
  case '/': {
    if (rhs == 0) throw std::range_error("division by zero");
    intmax_t iexp=p-2;
    intmax_t inv=1;
    for (intmax_t dbl=rhs; iexp; iexp>>=1) {
      if (iexp & 1) inv = (inv*dbl) % p;
      dbl = (dbl*dbl) % p;
    }
    return (lhs*inv) % p;
  }
  default: assert(false);
  }
}

void preprocess(const std::string &s, std::string &t) {
  t.clear();
  for (char ch: s)
    if (!isspace(ch)) t += ch;
}

intmax_t parse(const std::string &s, size_t &i, intmax_t p, size_t preced=0) {
  const std::vector<std::string> &ops={"+-", "*/"};

  if (preced == ops.size()) {
    if (s[i] == '(') {
      intmax_t res=parse(s, ++i, p, 0);
      assert(s[i] == ')');
      ++i;
      return res;
    }
    if (isdigit(s[i])) {
      intmax_t res=s[i]-'0';
      while (++i < s.length() && isdigit(s[i]))
        res = res*10+s[i]-'0';
      return res;
    }
    assert(false);
  }

  intmax_t lhs=parse(s, i, p, preced+1);
  while (i < s.length()) {
    char op=s[i];
    if (!std::count(ops[preced].begin(), ops[preced].end(), op)) break;
    intmax_t rhs=parse(s, ++i, p, preced+1);
    lhs = apply(lhs, op, rhs, p);
  }
  return lhs;
}

int testcase_ends() {
  int p;
  scanf("%d: ", &p);
  if (p == 0) return 1;

  char buf[131072];
  fgets(buf, sizeof buf, stdin);
  std::string s=buf, t;
  preprocess(s, t);

  size_t i=0;
  try {
    printf("%s = %jd (mod %d)\n", t.c_str(), parse(t, i, p), p);
  } catch (std::range_error &e) {
    printf("NG\n");
  }
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 3012
package main

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

func solve() {
	n := getInt()
	if n%2 == 1 {
		fmt.Fprintln(wr, 0)
		return
	}

	ans := 0
	for d := 10; d <= n; d *= 5 {
		cnt := n / d
		ans += cnt
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

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

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

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

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
#include <cstdio>
#include <utility>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <tuple>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int ll;
using namespace std;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;

int main()
{
    ll n,a,b;
    string s;
    cin >> n >> a >> b >> s;

    ll a1 = 0;
    ll b1 = 0;

    for (ll i=0;i<n;i++){
        if(a1+b1 >= n ){cout<< "No" << endl;}
        else
        {
            if(s[i] == 'a' && a1+b1 < a+b)
            {
                cout << "Yes" << endl;
                a1 ++;
            }
            else if(s[i] == 'b' && a1+b1<a+b && b1<b)
            {
                cout << "Yes" << endl;
                b1 ++;
            }
            else
            {
                cout << "No" << endl;
            }
        }
    }


    return 0;
}

Measured memory_bytes: 896
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int s,w; cin>>s>>w;
    cout<<(w>=s ? "unsafe" : "safe")<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int sx , sy , tx , ty;
    cin >> sx >> sy >> tx >> ty;
    for (int i = 0 ; i < ty - sy ; i++ ) cout << 'U';
    for (int i = 0 ; i < tx - sx ; i++ ) cout << 'R';
    for (int i = 0 ; i < ty - sy ; i++ ) cout << 'D';
    for (int i = 0 ; i < tx - sx ; i++ ) cout << 'L';
    cout << 'L';
    for (int i = 0 ; i < ty - sy + 1 ; i++ ) cout << 'U';
    for (int i = 0 ; i < tx - sx + 1 ; i++ ) cout << 'R';
    cout << "DR";
    for (int i = 0 ; i < ty - sy + 1 ; i++ ) cout << 'D';
    for (int i = 0 ; i < tx - sx + 1 ; i++ ) cout << 'L';
    cout << 'U';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    int gray = 0;
    int brown = 0;
    int green = 0;
    int cian = 0;
    int blue = 0;
    int yellow = 0;
    int orange = 0;
    int red = 0;
    int free = 0;
    rep(i,N){
        int rate;
        cin >> rate;
        if (0 <= rate && rate < 400) gray++;
        if (400 <= rate && rate < 800) brown++;
        if (800 <= rate && rate < 1200) green++;
        if (1200 <= rate && rate < 1600) cian++;
        if (1600 <= rate && rate < 2000) blue++;
        if (2000 <= rate && rate < 2400) yellow++;
        if (2400 <= rate && rate < 2800) orange++;
        if (2800 <= rate && rate < 3200) red++;
        if (3200 <= rate) free++;
    }
    int ans = 0;
    if (gray >= 1) ans++;
    if (brown >= 1) ans++;
    if (green >= 1) ans++;
    if (cian >= 1) ans++;
    if (blue >= 1) ans++;
    if (yellow >= 1) ans++;
    if (orange >= 1) ans++;
    if (red >= 1) ans++;
    if (ans == 0) cout << 1 << " " << free << endl;
    else cout << ans << " " << ans + free << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int H,W,i,j;
    for(;;){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0) break;
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
typedef long long ll;
const ll INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using pint = pair<int, int>;
using pstring = pair<int, string>;

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

    if( 400 <= N and N <= 599) cout << 8;
    else if( 600 <= N and N <= 799) cout << 7;
    else if( 800 <= N and N <= 999) cout << 6;
    else if( 1000 <= N and N <= 1199) cout << 5;
    else if( 1200 <= N and N <= 1399) cout << 4;
    else if( 1400 <= N and N <= 1599) cout << 3;
    else if( 1600 <= N and N <= 1799) cout << 2;
    else if( 1800 <= N and N <= 1999) cout << 1;
    cout << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#define N 30
#define D 10
#define Y 365

int main(){
  int i, n, ans_, ans;
  int dp[N];

  dp[0] = 1;
  dp[1] = 2;
  dp[2] = 4;
  for(i=3; i<N; ++i)
    dp[i] = dp[i-1] + dp[i-2] + dp[i-3];

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    --n;
    ans_ = dp[n]/D;
    if(dp[n]%D != 0) ++ans_;
    ans = ans_/Y;
    if(ans_%Y != 0) ++ans;

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

Measured memory_bytes: 600
//
// Created by yamunaku on 2020/05/03.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    ll a;
    cin >> a;
    rep(i, 401){
        rep(j, 401){
            ll x = i - 200;
            ll y = j - 200;
            ll xx = x * x * x * x * x;
            ll yy = y * y * y * y * y;
            if(xx - yy == a){
                cout << x SP y << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
#include <climits>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
        // setw(6) << setfill('0')
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << "(" << v.first << ", " << v.second << ")";
    return ostr;
}

int64 powmod(int64 n, int64 count, int64 mod) {
    if (count == 0) return 1;
    if (count % 2 == 0) {
        int64 t = powmod(n, count / 2, mod);
        return t * t % mod;
    }
    return n * powmod(n, count - 1, mod) % mod;
}

int64 ncr(int64 n, int64 r, int64 mod) {
    int64 a;
    if (n < r) a = min(n, r - n);
    else a = min(n - r, r);

    int64 res = 1;
    rep(i, a) {
        res = res * (n - i) % mod;
        res = res * powmod(i + 1, mod - 2, mod) % mod;
    }

    return res;
}

int main() {
    string s, t; cin >> s >> t;
    cout << t << s << endl;
}


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

using namespace std;
typedef long long int lld;

int arr[13][13];
int val[13],ans=1e9;
int main(void){
	int n,m,x;
	scanf("%d%d%d",&n,&m,&x);
	for(int e=0;e<n;e++){
		scanf("%d",&val[e]);
		for(int p=0;p<m;p++) scanf("%d",&arr[e][p]);
	}
	for(int e=0;e<(1<<n);e++){
		int mm[13],val2=0;
		memset(mm,0,sizeof(mm));
		for(int p=0;p<n;p++){
			if(e&(1<<p)){
				for(int q=0;q<m;q++) mm[q] += arr[p][q];
				val2 += val[p];
			}
		}
		int err = 0;
		for(int p=0;p<m;p++) if(mm[p]<x) err++;
		if(err==0){
			ans = min(ans,val2);
		}
	}
	if(ans==1e9) ans = -1;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 3824
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int N;
    //生徒の人数Nを読み込み
    cin>>N;
    vector<int> A(N);
    //登校時の生徒人数A[i]を読み込み
    for(int i=0;i<N;i++) cin>>A[i];
    vector<int> rev(N);
    for(int i=0;i<N;i++) rev[A[i]-1]=i+1;
    for(int i=0;i<N;i++) cout<<rev[i]<<endl;

  
    return 0; 
}

Measured memory_bytes: 1664
import sys
from collections import Counter


# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def solve():
    n, m = read_int_list()
    c = Counter()
    for i in range(m):
        a, b = read_int_list()
        if a == 1:
            c[b] += 1
        if b == n:
            c[a] += 1

    if 2 in c.values():
        return 'POSSIBLE'
    return 'IMPOSSIBLE'


res = solve()
print(res)


Measured memory_bytes: 27448
#include <iostream>    
#include<cstring>
#include<cstdio>
using namespace std;    
#define min(A,B) ((A)<(B)?(A):(B))    
int dp[2000][2000];    
int EditDistance(char *s,char *t)    
{    
   int i,j,cost;    
   int slength=strlen(s);    
   int tlength=strlen(t);    
   dp[0][0]=0;    
   for(i=1;i<=slength;i++)    
   dp[i][0]=i;    
   for(j=1;j<=tlength;j++)    
   dp[0][j]=j;    
   for(i=1;i<=slength;i++)    
   {    
       for(j=1;j<=tlength;j++)    
       {    
           if(s[i-1]==t[j-1])    
           cost=0;    
           else    
           cost=1;    
           dp[i][j] = min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]+cost);    
       }    
   }    
      return dp[slength][tlength];    
}    
int main()    
{    
    char s[1025],t[1025];    
     while(cin>>s>>t)    
     {    
         int minx;    
         minx=EditDistance(s,t);    
         cout<<minx<<endl;    
     }    
 return 0;    
}  


Measured memory_bytes: 10920
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int h,w;
  cin>>h>>w;
  string s[h];
  rep(i,h){
    cin>>s[i];
  }
  rep(i,w+2){
    cout<<"#";
  }
  cout<<endl;
  rep(i,h){
    cout<<"#"<<s[i]<<"#"<<endl;
  }
  rep(i,w+2){
    cout<<"#";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
import fractions as math

def lcm(x,y):
    return (x * y) // math.gcd(x,y)

def main():
    (n,m) = map(int, input().split())
    s = input()
    t = input()

    nmlcm = lcm(n,m)
    nn = nmlcm // n
    mm = nmlcm // m
    nnmmlcm = lcm(nn,mm)

    for i in range(nmlcm // nnmmlcm):
        #print(nnmmlcm*i)
        if s[nnmmlcm*i//nn] != t[nnmmlcm*i//mm]:
            print(-1)
            return
    print(nmlcm)

if __name__ == "__main__":
    main()


Measured memory_bytes: 5340
num=STDIN.gets.to_i
member=["1","2","3","4","5","6","7","8","9","10","11","12","13"]
S=Array.new(member)
H=Array.new(member)
C=Array.new(member)
D=Array.new(member)
i=0
while str=STDIN.gets
    i=i+1
    op1,op2=str.chomp.split.map{|v|v.to_s}
    if op1=="S" then S.delete(op2) end
    if op1=="H" then H.delete(op2) end
    if op1=="C" then C.delete(op2) end
    if op1=="D" then D.delete(op2) end
    break if i==num
end

S.each do |elm|
print "S ",elm,"\n"
end
H.each do |elm|
print "H ",elm,"\n"
end
C.each do |elm|
print "C ",elm,"\n"
end
D.each do |elm|
print "D ",elm,"\n"
end

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

int main(){
    ll n, l;
    cin >> n >> l;
    vector<string> sv(n);
    rep(i, n) {
        string tmp_s;
        cin >> tmp_s;
        sv[i] = tmp_s;
    }
    sort(sv.begin(), sv.end());
    rep(i, n) {
        cout << sv[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
using namespace std;
#define FL(i,a,b) for(int i = a;i<b;i++)
typedef vector<int> vi;
typedef long long int lli;
typedef long int li;
const int inf = numeric_limits<int>::max();



int main(){
    int n;
    scanf("%d",&n);
    string s;
    cin>>s;
    int m = s.size();
    if(m<=n){
        cout<<s;
    }
    else{
        s = s.substr(0,n);
        s = s + "...";
        cout<<s;
    } 
    
}



Measured memory_bytes: 3696
package main

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

func main() {
	sc := NewScanner()

	k := sc.ReadInt()
	if k < 10 {
		fmt.Println(k)
		return
	}

	dpTable := make([][]int, 1)
	dpTable0 := make([]int, 12)
	dpTable[0] = dpTable0
	for i := 1; i <= 10; i++ {
		dpTable0[i] = 1
	}

	lunlunCount := 9
	rowI := 0
	colI := 1
	for lunlunCount < k {
		rowI++
		dpPrevRow := dpTable[rowI-1]
		dpRow := make([]int, 12)
		dpTable = append(dpTable, dpRow)
		for colI = 1; colI <= 10; colI++ {
			dpRowI := dpPrevRow[colI-1] + dpPrevRow[colI] + dpPrevRow[colI+1]
			dpRow[colI] = dpRowI
			if colI > 1 {
				lunlunCount += dpRowI
				if lunlunCount >= k {
					break
				}
			}
		}
	}
	restLunlunCount := k - (lunlunCount - dpTable[rowI][colI])

	answer := int64(colI - 1)
	for rowI > 0 {
		rowI--
		colI--
		checkedLunlunCount := 0
		for i := 0; i < 3; i++ {
			next := dpTable[rowI][colI]
			if checkedLunlunCount+next >= restLunlunCount {
				answer = answer*10 + int64(colI-1)
				restLunlunCount -= checkedLunlunCount
				break
			}
			checkedLunlunCount += next
			colI++
		}
	}

	fmt.Println(answer)
}

// util
// * math

func AbsInt(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func MinInt(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

// * io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int main(){
  int a,b;
  cin >> a >> b;
  string s;
  cin >> s;
  int n = s.size();
  rep(i,n){
    if((i == a)^(s[i] =='-')){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256