akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll X;
    cin >> X;

    ll res = 0;
    ll T = 100;
    while(1){
        T = (T * 1.01);
        //dump(T)
        res++;
        if(T>=X) break;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3656
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  priority_queue<string, vector<string>, greater<string>> q;
  REP(i, N) {
    string Si;
    cin >> Si;
    q.emplace(Si);
  }
  while (!q.empty()) {
    cout << q.top();
    q.pop();
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
mod = 10 ** 9 + 7

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

def calc(x, y):
	a = 2 * y - x
	
	if a < 0 or a % 3 != 0:
		return 0
	
	a //= 3
	b   = y - 2 * a
	
	if b < 0:
		return 0
		
	for i in range( 2, a + b + 1 ):
		g1.append( ( g1[-1] * i ) % mod )
		inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
		g2.append( (g2[-1] * inverse[-1]) % mod )
		
	
		
	return cmb(a + b, a, mod)

x, y = [int(x) for x in input().split()]

print(calc(x, y) % mod)


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

int main(){
	
	int N, M, K;
	cin >> N >> M >> K;
	
	bool flag = false;
	
	for(int i = 0; i <= N; i++){
		for(int j = 0; j <= M; j++){
			if(K == i * M + j * N - 2 * i * j){
				flag = true;
			}
		}
	}
	
	if(flag){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}

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

char a[4];
int n,k;

int main()
{
    scanf("%s",a);
    int x = (a[0]-'0')*10+(a[1]-'0');
    int y = (a[2]-'0')*10+(a[3]-'0');
    if(x > 0 && x <= 12 && y > 0 && y <= 12)
        printf("AMBIGUOUS\n");
    else if(y <= 12 && y > 0 && x >= 0 && x < 100)
        printf("YYMM\n");
    else if(x <= 12 && x > 0 && y >= 0 && y <100)
        printf("MMYY\n");
    else
        printf("NA\n");
    return 0;
}


Measured memory_bytes: 256
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<fstream>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e5+8;
static const int INF = 0x3f3f3f3f;
static const int MOD = 998244353;

int main(){

    int N;sc(N);
    int arr[con][3];
    FOR(i,0,N)
        sc(arr[i][0]),sc(arr[i][1]),sc(arr[i][2]);

    int ind[3];
    ind[0] = ind[1] = ind[2] = -1;
    FOR(i,1,N){

        FOR(j,0,3){

            if(j == 0){

                arr[i][j] += max(arr[i-1][j+1],arr[i-1][j+2]);
            }
            else if(j == 1){

                arr[i][j] += max({arr[i-1][j-1],arr[i-1][j+1]});
            }
            else{
                arr[i][j] += max(arr[i-1][j-1],arr[i-1][j-2]);
            }
        }
    }
    N--;
    cout << max({arr[N][0],arr[N][1],arr[N][2]});
}



Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };

int n, k;
int a[10000000];
int main()
{
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
	}
	cout << ((n - 1) + (k - 2)) / (k - 1) << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long A[n + 1];
	vector<long> vec;
	long sum = 0;
	for(int i = 0; i < n; i++)
	{
		scanf("%ld", &A[i]);
	}
	long ans1 = 0, ans2 = 0;
	for(int i = 0; i < n; i++)
	{
		long x = 0;
		long tmp = sum;
		tmp += A[i];
		if(i % 2 == 0 && tmp <= 0)
		{
			x = abs(tmp) + 1;
			ans1 += x;
		}
		else if(i % 2 == 1 && tmp >= 0)
		{
			x = -(tmp + 1);
			ans1 += abs(x);
		}		
		sum = tmp + x;
		//cout << sum << endl;
	}
	sum = 0;
	for(int i = 0; i < n; i++)
	{
		long x = 0;
		long tmp = sum;
		tmp += A[i];
		if(i % 2 == 1 && tmp <= 0)
		{
			x = abs(tmp) + 1;
			ans2 += x;
		}
		else if(i % 2 == 0 && tmp >= 0)
		{
			x = -(tmp + 1);
			ans2 += abs(x);
		}
		sum = tmp + x;
		//cout << sum << endl;
	}
	//cout << ans1 << " " << ans2 << endl;
	cout << min(ans1, ans2) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits//stdc++.h>
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;
typedef long long int ll;
int main() {
    ll n, m,ans = 1e18; cin >> n >> m;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    rep(i, 1 << n) {
        ll mx = 0, sum = 0, cnt = 0;
        rep(j, n) {
            if (i & (1 << j)) {
                cnt++;
                if (mx >= a[j]) sum += mx - a[j] + 1,mx++;
            }mx = max(mx, a[j]);
        }
        if (cnt >= m) ans = min(ans, sum);
    }cout << ans << endl;
}

Measured memory_bytes: 3596
//#include "pch.h"
#include <iostream>
using namespace std;
#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)

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

    int a;
    int b;
    int k;
    
    cin >> a >> b >> k;
    //cout << a << ", " << b << ", " << k <<"\n";
    
    int end = min(a, b);
    //cout << end << "\n";
    
    int count = 0;
    REF(num, end, 0){
        //cout << "\n";
        //cout << num <<", ";
        
        if(a % num == 0 && b % num == 0){
            count++;
            //cout << num << ", ";
            if (count == k){
                cout << num;
                exit(0);
            }
        }
    
        
    }
    
}

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

int main() {
  
  char a;
  cin >> a;
  if(a=='a')cout << "vowel" <<endl;
  else if(a=='i')cout << "vowel" <<endl;
  else if(a=='u')cout << "vowel" <<endl;
  else if(a=='e')cout << "vowel" <<endl;
  else if(a=='o')cout << "vowel" <<endl;
  else cout << "consonant" << endl;
      
}


Measured memory_bytes: 256
n,l=map(int,input().split())
if l<0 and l+n-1<0:
    print((2*l+n-2)*(n-1)//2)
elif l>0 and l+n-1>0:
    print((2*l+n)*(n-1)//2)
else:
    print((2*l+n-1)*n//2)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int D = Integer.parseInt(sc.next());

		int treePerP = 2 * D + 1;

		int ans = N / treePerP;
		if (N % treePerP > 0) {
			ans += 1;
		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 23764
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] ar = new int[N];
        for (int i = 0; i < N; i++) {
            int Li = sc.nextInt();
            ar[i] = Li;
        }
        long count = 0;
        for (int i = 0; i < N; i++) {
            int inow = ar[i];
            for (int j = i+1; j < N; j++) {
                int jnow = ar[j];
                if (inow == jnow) {
                    continue;
                }
                for (int k = j+1; k < N; k++) {
                    int know = ar[k];
                    if (inow == know || jnow == know) {
                        continue;
                    }
                    int max = Math.max(inow, Math.max(jnow, know));
                    int min = Math.min(inow, Math.min(jnow, know));
                    int mid = inow+jnow+know-max-min;
                    if (max < min+mid) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 36444
#include<iostream>
#include<cmath>
#include<vector>
#include<cstdio>
using namespace std;

#define X 0
#define Y 1
#define PI 3.141592653589

int main()
{
    vector<double> udv = {0,1}; // 単位方向ベクトル
    vector<double> cur_position = {0, 0};

    int step=0, angle=0;
    while(1){
        
        scanf("%d,%d", &step, &angle);
        if( !step && !angle )break;

        cur_position.at(X) += udv.at(X)*step;
        cur_position.at(Y) += udv.at(Y)*step;

        // rotation
        double x =  cos(angle*PI/180.0)*udv.at(X) + sin(angle*PI/180.0)*udv.at(Y);
        double y = -sin(angle*PI/180.0)*udv.at(X) + cos(angle*PI/180.0)*udv.at(Y);
        udv.at(X) = x / sqrt(x*x+y*y);
        udv.at(Y) = y / sqrt(x*x+y*y);
    }    
    cout << static_cast<int>(cur_position.at(X)) << endl << static_cast<int>(cur_position.at(Y)) << endl;

    return 0;
}

Measured memory_bytes: 1220
def main():
    n, a, b, *x = map(int, open(0).read().split())
    ans = 0
    it = iter(x)
    nw = it.__next__()
    for nx in it:
        ans += min(b, (nx - nw) * a)
        nw = nx

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14052
#include <iostream>
using namespace std;
int main()
{
	int N, M, i, j;
	int target[100], cnt[100], data[100][100];

	cin >> N; cin >> M;

	for (i = 0; i < M; i++)
	{
		cin >> target[i];
		--target[i];
	}

	for (i = 0; i < M; i++)
	{
		for (j = 0; j < N; j++)
		{
			cin >> data[i][j];
			--data[i][j];
			cnt[j] = 0;
		}
	}

	for (j = 0; j < N; j++)
	{
		for (i = 0; i < M; i++)
		{
			if (data[i][j] == target[i])
			{
				++cnt[j];
			}
			else
			{
				++cnt[target[i]];
			}
		}
	}

	for (j = 0; j < N; j++)
	{
		cout << cnt[j] << endl;
	}
}

Measured memory_bytes: 3140
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define MAXN 200000
#define INF 0x7fffffff
int N,A,B;

int main(){
	scanf("%d",&N);
	bool flag=0;
	long long All=0,Rest=INF;
	for(int i=1;i<=N;i++){
		scanf("%d%d",&A,&B);
		All+=B;
		flag|=A!=B;
		if(A>B)
			Rest=min(Rest,1ll*B);
	}
	printf("%lld",flag*(All-Rest));
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,dis1=0,dis2=0,m,k;
    cin>>n;
    int arra[n]={9};
    fill(arra,arra+n,999999999);
    vector <int> dp(3,0);
    for(int day=0;day<n;day++){
    vector<int> vec;
    vector<int> new_dp(3,0);
    for(int i=0;i<3;i++){
            cin>>m;
    vec.push_back(m);
    }
    //cout<<vec[0]<<endl;
    for(int i=0;i<3;i++)
    {

        for(int j=0;j<3;j++)
        {
            if(i!=j)
            new_dp[j]=max(new_dp[j],(dp[i]+vec[j]));
            //cout<<"newdp"<<new_dp[j]<<"dp i= "<<dp[i]<<"vec j= "<<vec[j]<<endl;
        }
    }
    dp=new_dp;
    }
    //cout<<dp[0]<<endl;

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


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    string s;
    cin >> s;
    int N=0,S=0,E=0,W=0;
    REP(i,s.length()){
        if(s.at(i) == 'N')N=1;
        if(s.at(i) == 'S')S=1;
        if(s.at(i) == 'E')E=1;
        if(s.at(i) == 'W')W=1;
    }
    
    if(N==S&&E==W){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int n;
  cin>>n;
  rep(i,n){
    int k,p;
    cin>>k>>p;
    k--;
    cout<<k%p+1<<endl;
  }
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 103005, SQ = 600;
int n, A[N];
ll S[N], P[SQ][N];
vector < int > D[N];
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &A[i]);
    for (int i = 1; i <= n; i ++)
        for (int j = i; j <= n; j += i)
            D[j].push_back(i), S[i] += A[j];
    for (int i = 1; i < SQ; i++)
        for (int j = n - 1; ~ j; j--)
            P[i][j] = P[i][j + i] + A[j];
    ll Mx = 0;
    for (int a = 1; a < n; a ++)
    {
        for (int &d : D[n - a])
            S[d] -= A[n - a];
        for (int d : D[n - 1 - a])
        {
            if (d >= a)
                break;
            if (a % d == 0 && a + a - d < n - 1)
                continue;
            if (d >= SQ)
            {
                ll sum = 0;
                for (int i = a; i < n - a; i += d)
                    sum += A[i];
                Mx = max(Mx, sum + S[d]);
            }
            else
                Mx = max(Mx, P[d][a] + S[d]);
        }
    }
    return !printf("%lld\n", Mx);
}

Measured memory_bytes: 494848
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n=I()
h=IL()
c=0
while True:
    for i in range(n):
        if h[i]!=0:
            s=i
            break
    else:
        print(c)
        break
    
    for i in range(i,n):
        if h[i]==0:
            e=i
            break
    else:
        e=n
    
    for i in range(s,e):
        h[i]-=1
    c+=1

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
 
int main() {
	int a,n;
	int i;
	int sum=0;

	cin >> a;
	n = a;
	for (i = 100000000; i > 0; i /= 10)
	{
		sum += n / i;
		n -= n / i * i;
	}
	if (a % sum == 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3604
#include<stdio.h>
#define NIL -1
#define MAX 100000

struct Node{
  int p;
  int l;
  int r;
};

struct Node T[MAX];
int depth[MAX];

void print(int u){
  int i,c;
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].p);
  printf("depth = %d, ", depth[u]);
  
  if(T[u].p == NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
 else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l; c !=NIL; i++,c=T[c].r){
    if(i)printf(", ");
  printf("%d", c);
 }
printf("]\n");
}

void rec(int u, int p){
  depth[u]=p;
  if(T[u].r != NIL)rec(T[u].r, p);
  if(T[u].l != NIL)rec(T[u].l, p+1);
}

int main(){
  int i,j,e,v;
  int n,c,l,r;
  scanf("%d", &n);
  
  for(i=0;i<n;i++){
    T[i].r=NIL;
    T[i].l=T[i].r;
    T[i].p=T[i].l;}
  for(i=0;i<n;i++){scanf("%d %d", &v, &e);
   for(j=0;j<e;j++){
     scanf("%d", &c);
     if(j==0)T[v].l=c;
     else T[l].r=c;
     l=c;
     T[c].p=v;
   }
  }
 for(i=0;i<n;i++){
    if(T[i].p==NIL)r=i;
}

  rec(r,0);
  for(i=0;i<n;i++){print(i);}
  return 0;
}



Measured memory_bytes: 6384
def main():
    W, H, N = map(int, input().split())
    area = [[0 for w in range(W)] for h in range(H) ]

    for n in range(N):
        x, y, a = map(int, input().split())
        
        if a == 1 :
            for i in range(H):
                for j in range(x):
                    area[i][j] = 1
        elif a == 2:
            for i in range(H):
                for j in range(x, W):
                    area[i][j] = 1
        elif a == 3:
            for i in range(H - y, H):
                for j in range(W):
                    area[i][j] = 1
        elif a == 4:
            for i in range(H - y):
                for j in range(W):
                    area[i][j] = 1
    count = 0
    
    for i in range(H):
        for j in range(W):
            if area[i][j] == 0:
                count += 1
    print(count)

main()

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

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;


signed main(){
    i64 n;
    cin >> n;
    vector<i64> a(n + 1);
    vector<i64> b(n);
    for(auto& x : a)
        cin >> x;
    for(auto& x : b)
        cin >> x;
    i64 ans = 0;
    for(i64 i = 0; i < n; ++i){
        i64 di = min(b[i], a[i]);
        ans += di;
        b[i] -= di;
        a[i] -= di;
        di = min(b[i], a[i + 1]);
        ans += di;
        b[i] -= di;
        a[1 + i] -= di;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
    // Your code here!
    
    
    int n,t;
    scanf("%d %d",&n,&t);
    
    int c1[n+1],c2[n+1],i;
    
    for(i=0;i<n;i++){
        scanf("%d %d",&c1[i],&c2[i]);
    }
    
    int c1min=1001;
    for(i=0;i<n;i++){
        if(c2[i]<=t && c1[i]<=c1min ){
            c1min = c1[i];
        }
    }
    
    if(c1min == 1001)
    printf("TLE");
    
    else 
    printf("%d",c1min);
    
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)
 
 
int main()
{
    int n;cin>>n;
    vector<int> a(201,0);
    a[105]++;a[135]++;a[165]++;a[189]++;a[195]++;
    int sum = 0;
    for(int i = 0; i <= n; i++){
        sum += a[i];
    }
    cout << sum << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
int main() {
    int n,k;
    cin >> n >> k;
    ll ans=pow(n/k,3);
    if (k%2==0) ans+=pow(n/(k/2)-n/k,3);
    
    cout << ans << endl;
}

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

const int N = 105;

string s;
int  a[N];
long long ans, x, k, d;
int main()
{
	cin >> x >> k >> d;
	if(x < 0) x = -x;
	if(k < x / d) ans = x - k * d;
	else
	{
		k -= x / d;
		x %= d;
		ans = k & 1 ? d - x : x;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,A[100]={},count=0,k;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    for(int i=0;i<n;i++){
        int minj=i;
        for(int j=i;j<=n-1;j++){
            if(A[j]<A[minj]){
                minj=j;
            } 
        }
        if(A[i]>A[minj]){
            int tmp=A[i];
            A[i]=A[minj];
            A[minj]=tmp;
            count+=1;   
        }
        
    }
    for(int i=0;i<n;i++){
        if(i>0) cout<<" ";
        cout<<A[i];
    }cout<<endl;
    cout<<count<<endl;
    return 0;
}
    

    
    



Measured memory_bytes: 3100
#include <iostream>
using namespace std;
 
int main() {
    int n, d = 100000;
	cin >> n;
    for (int i = 0; i < n; i++) {
        d = d * 1.05;
        if (d % 1000 > 0) {
            d = d - (d % 1000) + 1000;
        }
    }
    cout << d << '\n';
    return 0;
}


Measured memory_bytes: 3020
#include <stdio.h>
struct Node{
  int key;
  struct Node *left;
  struct Node *right;  
  struct Node *p;
};
typedef struct Node *node; 

void insert(node);
void inorder(node);
void preorder(node);
node treeSearch(node , int );
node root=NULL,n[500000];
int main()
{
  int i,num,a; 
  char s[10];
  root= (node)malloc(sizeof(struct Node));
  scanf("%d",&num);
  for(i=0;i<num;i++){        
    n[i] = (node)malloc(sizeof(struct Node));

scanf("%s",s);    
if(s[0]=='i'){	

scanf("%d",&n[i]->key);		
 n[i]->right=NULL;
      n[i]->left=NULL;

insert(n[i]);

    }
     
 else if(s[0]=='p'){

   inorder(n[0]);
   printf("\n");
   preorder(n[0]);
 printf("\n");
}  
 else {
scanf("%d",&a);	
 if(treeSearch(n[0], a)==NULL)
   printf("no\n");
 else  printf("yes\n");
}

}

  return 0; 
}

void insert(node z){
 
 node x,y;     
  y = NULL; 
  x =root;
  

while (x!=NULL){
    y = x ;
    if (z->key < x->key)
      x = x->left; 
    else 
      x = x->right;
  } 
  z->p = y;
  if (y ==NULL) 
    root = z;
  else if (z->key < y->key)
    y->left = z ;
  else 
    y->right = z ;
}

void inorder(node u){
  if (u == NULL)
    return;
  inorder(u->left);
  printf(" %d",u->key);

inorder(u->right);


}

void preorder(node u){
  if (u == NULL)
    return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);

}

node treeSearch(node x, int k){
  if (x == NULL || k == x->key)
	  return x;
  if (k < x->key)
    return treeSearch(x->left, k);
else
  return treeSearch(x->right, k);


}

Measured memory_bytes: 27956
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var p = Enumerable.Repeat(true, 55000).ToArray();
			p[0] = p[1] = false;
			for (int i = 2; i < Math.Sqrt(p.Length); i++)
				if (p[i])
					for (int j = i * 2; j < p.Length; j++)
						if (j % i == 0)
							p[j] = false;

			string s = "";
			while ((s = Console.ReadLine()) != null)
			{
				var n = int.Parse(s);
				int max = 0, min = 0;
				for (int i = n - 1; i > 0; i--)
				{
					if (p[i])
					{
						max = i;
						break;
					}
				}
				for (int i = n + 1; i < p.Length; i++)
				{
					if (p[i])
					{
						min = i;
						break;
					}
				}
				Console.WriteLine("{0} {1}", max, min);
			}
		}
	}
}

Measured memory_bytes: 6060
#import <Foundation/Foundation.h>
#include <stdio.h>

int buf;
NSInteger intinput(void){
    scanf("%d",&buf);
    NSInteger ret = buf;
    return ret;
}

void output(NSString *s,NSString *sep){
    NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
    [fileHandle writeData:[s dataUsingEncoding:NSUTF8StringEncoding]];
    [fileHandle writeData:[sep dataUsingEncoding:NSUTF8StringEncoding]];
    [fileHandle closeFile];
}

NSMutableArray* to_numarray(NSString *s){
    NSMutableArray *l = [NSMutableArray arrayWithArray:[s componentsSeparatedByString:@" "]];
    NSInteger buf = 0;
    for(int i=0;i<[l count];i++){
        buf = [[l objectAtIndex:i] integerValue];
        [l replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:buf]];
    }
    return l;
}

int main(int argc, const char * argv[]) {
    NSInteger N = intinput();
    NSInteger A = intinput();
    NSString *result = @"No";
    N-=500*(N/500);
    if(N<=A){result=@"Yes";}
    output(result,@"\n");
    return 0;
}


Measured memory_bytes: 3380
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();

    if (N % K == 0) {
      System.out.println(0);
    } else {
      System.out.println(1);
    }

  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    string s,st,sr;
    int a=0,i;
    cin>>s>>st;
    sr=s+st;
    for(i=0;i<sr.length();i++)
    a=a*10+sr[i]-49+1;
    if(sqrt(a)==float(sqrt(a))) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main()
{
    long long int x;
    long long int ans;
    
    cin >> x;
    
    ans = x * 2 / 11;
    
    if((x * 2 % 11 != 0) && (x % 11 != 6)) {
        ans += 1;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}


int main() {
  string s;
  cin>>s;
  s[5]=' ';
  s[13]=' ';
  s[19]=' ';
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3600
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	int ans=1e9;
	int cnt=0;
	for(int i=0;i<=100;i++)
	{
		for(int j=0;j<n;j++)
		{
			cnt+=(max(i,a[j])-min(i,a[j]))*(max(i,a[j])-min(i,a[j]));
		}
		ans=min(ans,cnt);
		cnt=0;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, ma, mb, dp[45][405][405];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> ma >> mb;
	FOR(i, 45) {
		FOR(j, 405) {
			FOR(k, 405) dp[i][j][k] = 1e9;
		}
	}
	dp[0][0][0] = 0;
	for (int i= 1; i <= n; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		FOR(j, 405) {
			FOR(k, 405) {
				if (j >= a && k >= b) {
					dp[i][j][k] = min(dp[i][j][k], min(dp[i-1][j][k], dp[i-1][j-a][k-b]+c));
				}
				else dp[i][j][k] = min(dp[i][j][k], dp[i-1][j][k]);
			}
		}
	}
	int mi = 1e9;
	for (int j = 1; j <= 400; j++) {
		for (int k = 1; k <= 400; k++) {
			if (k*ma == j*mb) mi = min(mi, dp[n][j][k]);
		}
	}
	cout << (mi == 1e9 ? -1 : mi) << endl;
	return 0;
}

Measured memory_bytes: 29056
#include <iostream>
#include <algorithm>
#include <vector>

long long cnt=0;

int* insertionSort(int* A, int N, int g){
  int tmp;

  for(int i=g; i<N; i++){
    tmp = A[i];
    int j = i-g;
    while (j>=0 && A[j]>tmp) {
      A[j+g]=A[j];
      j = j - g;
      cnt++;
    }
    A[j+g]=tmp;
  }
  return A;
}

void shellSort(int* A, int n){
  std::vector<int> G;
  for (int i = 0; i < n; i = 3*i+1) {
    G.push_back(i);
  }
  int m =  G.size();
  std::cout << m << '\n';
  for (int i = m-1; i >=0; i--) {
    std::cout << G[i];
    if (i!=m-1) {
      std::cout << " ";
    }else{
      std::cout << '\n';
    }
  }

  for (int i = m-1; i >=0; i--) {
    A = insertionSort(A,n,G[i]);
  }

  std::cout << cnt << '\n';

  for (size_t i = 0; i < n; i++) {
    std::cout << A[i] << '\n';
  }
}

int main(void) {
  int n;
  std::cin >> n;
  int* A = new int[n];
  for (int i = 0; i < n; i++) {
    std::cin >> A[i];
  }

  shellSort(A, n);

  return 0;
}



Measured memory_bytes: 7020
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;
  cin>>N;
  vector<vector<int>> A(N,vector<int>(0));
  for(int i=0;i<N-1;i++){
    int n,m;
    cin>>n>>m;
    A[n-1].push_back(m-1);
    A[m-1].push_back(n-1);
  }
  int ans=0,k=0;
  for(int j=0;j<N;j++){
    k+=j+1;
    for(int n:A[j])
      if(n<j)
        k-=n+1;
    ans+=k;
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main()
{    
    while(1)
    {
        int H,W;
        cin >> H >> W;

        if(H == 0 && W == 0)
        {
            return 0;
        }

        for(int i = 0;i < H;i++)
        {
            for(int j = 0;j < W;j++)
            {
                if(((i + j) % 2) == 0)
                {
                    cout << "#";
                }
                else
                {
                    cout << ".";

                }
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int H, W, K, sx, sy, tx, ty;
string c[1010101];
int mi[1010101];
bool vis[1010101];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> H >> W >> K >> sx >> sy >> tx >> ty;
	rep(y, 0, H) cin >> c[y];
	sx--; sy--; tx--; ty--;

	queue<int> que;
	rep(i, 0, 1010101) mi[i] = inf;

	que.push(sx * W + sy);
	vis[sx * W + sy] = true;
	mi[sx * W + sy] = 0;

	while (!que.empty()) {
		int q = que.front(); que.pop();

		int x = q / W;
		int y = q % W;

		if (x == tx && y == ty) {
			printf("%d\n", mi[q]);
			return;
		}

		rep(d, 0, 4) {
			int xx = x, yy = y;
			rep(k, 0, K) {
				xx += dx[d];
				yy += dy[d];

				if (xx < 0 || H <= xx || yy < 0 || W <= yy) break;
				if (c[xx][yy] == '@') break;
				
				int id = xx * W + yy;
				if (vis[id] && mi[q] + 1 != mi[id]) break;

				if (!vis[id]) {
					vis[id] = true;
					mi[id] = mi[q] + 1;
					que.push(id);
				}
			}
		}
	}

	printf("-1\n");
}







Measured memory_bytes: 41388
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
struct angka
{
    int bal, mini, o;
    string s;
};
struct angka nodeL[1000010], nodeR[1000010];
int chaeng;
bool desc(struct angka a, struct angka b)
{
    return a.mini > b.mini;
}
bool asc(struct angka a, struct angka b)
{
    return a.bal - a.mini > b.bal - b.mini;
}
int main()
{
	int n,i,j,k,x,y,ans,curr,temp,m;
	int tc;
	cin >> n;
    string s;
    chaeng = 0;
    int pos = 0, neg = 0;
    for(i=1;i<=n;i++) {
        cin >> s;
        int bal = 0;
        int mini = 0;
        int o = 0;
        for(auto x : s) {
            if(x == '(') {
                bal++;
            }
            else {
                bal--;
            }
            mini = min(mini, bal);
        }
        chaeng += bal;
        if(bal >= 0) {
            nodeL[pos].bal = bal;
            nodeL[pos].mini = mini;
            nodeL[pos].s = s;
            pos++;
        } else {
            nodeR[neg].bal = bal;
            nodeR[neg].mini = mini;
            nodeR[neg].s = s;
            neg++;
        }
    }
    if(chaeng != 0) {
        cout << "No" << endl;
        return 0;
    }
    sort(nodeL, nodeL + pos, desc);
    sort(nodeR, nodeR + neg, asc);
    for(i=0;i<pos;i++) {
        s = nodeL[i].s;
        for(auto x : s) {
            if(x == '(') chaeng++;
            else chaeng--;
            if(chaeng < 0) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for(i=0;i<neg;i++) {
        s = nodeR[i].s;
        for(auto x : s) {
            if(x == '(') chaeng++;
            else chaeng--;
            if(chaeng < 0) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 98576
import heapq
N,M = list(map(int, input().split()))
As = [-int(i) for i in input().split()]

heapq.heapify(As) 
for i in range(M):
    v = heapq.heappop(As)
    heapq.heappush(As, int(v/2))
print(sum(As) * -1)

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

int main()
{
  int tanka,ryou;
  int total=0,average=0;
  int count=0,ryoutotal=0;

  while( scanf("%d,%d",&tanka, &ryou) != EOF){
    total = total + tanka * ryou;
    count++;
    ryoutotal = ryoutotal + ryou;
  }

  average = (int) (ryoutotal/(double)count + 0.5);
  printf("%d\n%d\n", total, average);
}

Measured memory_bytes: 1184
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b;
    cin >> a; //aに読む
    cin >> b; //bに読む
    cout << a*b;
    cout << " "; //空白
    cout << 2*a+2*b;
    cout << endl; //改行
}



Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;

int n;
string s;

ll gcl(ll x,ll y){
    if(x<y) swap(x,y);
    while(y>0){
        ll t=x%y;
        x=y;
        y=t;
    }
    return x;
}

ll fac(int n){
    if(n==0||n==1) return 1;
    return n*fac(n-1);
}

int main(){
    ll N,M;cin>>N>>M;
    ll ans;
    if(N==M/2) ans=N;
    else if(N>M/2) ans=M/2;
    else ans=N+(M-N*2)/4;

    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.in","r",stdin);freopen ("myfile.out","w",stdout);
#define mod 1000000007
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;

ll n,m,ar[N],sum,mk;


int main()
{
	fast;
	cin>>n;
	fo(i,1,n)
	{
		ll a;
		cin>>a;
		mk=max(mk,a);
		if(a>=mk)
			sum++;
	}
	cout<<sum;

}

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

int main(void) {
  ll N;
  cin >> N;
  vector<pll> P(N * 2);
  REP(i, 0, N * 2) {
    char c;
    ll a;
    cin >> c >> a;
    a--;
    P[i] = pll(a, c == 'B' ? 0 : 1);
  }

  ll bpos[N], wpos[N];
  REP(i, 0, N * 2) {
    if(P[i].second == 0) bpos[P[i].first] = i;
    if(P[i].second == 1) wpos[P[i].first] = i;
  }

  ll black[N + 1][N * 2], white[N + 1][N * 2];
  REP(i, 0, N + 1) {
    ll bcnt = 0, wcnt = 0;
    REP(j, 0, N * 2) {
      black[i][j] = bcnt;
      white[i][j] = wcnt;
      if(P[j].second == 0 && P[j].first < i) bcnt++;
      if(P[j].second == 1 && P[j].first < i) wcnt++;
    }
  }

  const ll INF = 1LL << 60;
  ll dp[N + 1][N + 1];
  REP(i, 0, N + 1) REP(j, 0, N + 1) dp[i][j] = INF;
  REP(i, 0, N + 1) REP(j, 0, N + 1) {
    if(i == 0 && j == 0) dp[i][j] = 0;
    else {
      if(i - 1 >= 0) dp[i][j] = min(dp[i][j], dp[i - 1][j] + (black[N][bpos[i - 1]] - black[i][bpos[i - 1]]) + (white[N][bpos[i - 1]] - white[j][bpos[i - 1]]));
      if(j - 1 >= 0) dp[i][j] = min(dp[i][j], dp[i][j - 1] + (white[N][wpos[j - 1]] - white[j][wpos[j - 1]]) + (black[N][wpos[j - 1]] - black[i][wpos[j - 1]]));
    }
  }

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


Measured memory_bytes: 156672
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
double eps=1e-9;
int main(){
	ll W,H,L,_,a,b,c,d;
	cin>>W>>H>>L>>_>>a>>b>>c>>d;
	L*=_;
	ll ans=0;
	for(ll i=-L/W-2;i<=L/W+2;i++){
		ll x;
		if(i%2==0) x=i*W+c;
		else x=i*W+(W-c);
		if(abs(x-a)>L) continue;
		double D=sqrt(L*L-(x-a)*(x-a));
		double ub=b+D+eps;
		ll j=floor(ub/H);
		ans+=j;
		if(j%2==0){
			if(ub-j*H>=d) ans++;
		}else{
			if(ub-j*H>=H-d) ans++;
		}
		ub=b-D-eps;
		if(ub>=0){
			if(ub>d) ans--;
		}else{
			ub=-ub;
			ll j=floor(ub/H);
			ans+=j;
			if(j%2==0){
				if(ub-j*H>=d) ans++;
			}else{
				if(ub-j*H>=H-d) ans++;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1160
n,x,y = map(int,input().split())
a = [0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        dist = min(j-i, abs(i-x+1)+1+abs(j-y+1))
        a[dist-1] += 1
for ans in a:
    print(ans)

Measured memory_bytes: 3444
import java.util.*;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    boolean a = true, b = true;
 
    for(int i=0;i<s.length();i+=2){
        if(s.charAt(i) == 'L'){
            a = false;
            break;
        }
    }
    
    for(int i=1;i<s.length();i+=2){
        if (!a){break;}
        if(s.charAt(i) == 'R'){
            b = false;
            break;
        }
    }
    
    if(a&&b){System.out.println("Yes");}
    else{System.out.println("No");}
  }
}

Measured memory_bytes: 21844
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	nums := make([]int, n)
	for i:=0; i<len(nums); i++{
		fmt.Scan(&nums[i])
	}

	selectionSort(nums)
}

func selectionSort(nums []int){
	count := 0

	for i := 0; i < len(nums); i++ {
		minj := i
		for j := i; j < len(nums); j++ {
			if nums[j] < nums[minj] {
				minj = j
			}
		}
		if i != minj {
			nums[i], nums[minj] = nums[minj], nums[i]
			count++
		}
	}

	for i:=0; i<len(nums); i++{
		fmt.Print(nums[i])
		if i == len(nums) -1{
			fmt.Println("")
		}else{
			fmt.Print(" ")
		}
	}
	fmt.Println(count)
}



Measured memory_bytes: 1144
n=int(input())
a=list(map(int,input().split()))
# n=2
# a=[4,8]
minimum=10000000
for i in range(-100,101):
    cost=0
    for j in range(n):
        cost+=(i-(a[j]))**2
        if j==n-1:
            if cost<minimum:
                minimum=cost

print(minimum)




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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll N;
string S[305];
bool A[305];
bool B[305];

bool solve(ll a, ll b)
{
    ll s = std::min(a, b);
    if (a > b)
    {
        return A[a - s];
    }
    return B[b - s];
}

int main()
{
    cin >> N;
    REP(i, N)
    {
        cin >> S[i];
    }
    memset(A, 0, sizeof(A));
    memset(B, 0, sizeof(B));
    REP(a, N)
    {
        //! A=a,B=0移動したときSynmetryか
        A[a] = true;
        REP(i, N)
        {
            REP(j, N)
            {
                int h0 = (N + i - a) % N;
                int w0 = j;
                int h1 = (N + j - a) % N;
                int w1 = i;
                if (S[h0][w0] == S[h1][w1])
                    continue;
                A[a] = false;
                break;
            }
            if (!A[a])
                break;
        }
    }
    REP(b, N)
    {
        //! A=0,B=b移動したときSynmetryか
        B[b] = true;
        REP(i, N)
        {
            REP(j, N)
            {
                int h0 = i;
                int w0 = (N + j - b) % N;
                int h1 = j;
                int w1 = (N + i - b) % N;
                if (S[h0][w0] == S[h1][w1])
                    continue;
                B[b] = false;
                break;
            }
            if (!B[b])
                break;
        }
    }

    ll ans = 0;
    REP(a, N)
    {
        REP(b, N)
        {
            if (solve(a, b))
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=INF,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>m;
      pair<ll,ll> p[ohara];
      rep(i,m){
        cin>>a>>b;
        p[i]=make_pair(a,b);
      }
      sort(p,p+m);
      rep(i,m){
        cnt=min(cnt,p[i].second);
        if(p[i].first>=cnt){
          ans++;
          cnt=p[i].second;
        }
      }
      Cout(ans+1);
     

       
return 0;
}


Measured memory_bytes: 15872
k = int(input())

ans = 1

def next(n):
    nStr = list(map(int, list(str(n))))

    r = len(nStr)-1
    while r > 0:
        if nStr[r] <= nStr[r-1] and not (nStr[r-1] == 9 and nStr[r] == 9):
            break
        r -= 1

    if r == 0 and nStr[0] == 9:
        nStr = [1] + [0] * len(nStr)
    else:
        extra = len(nStr)-1-r
        nStr = nStr[:r] + [nStr[r]+1]

        for _ in range(extra):
            nStr.append(max(0, nStr[-1]-1))

    return int("".join(map(str, nStr)))

for i in range(k-1):
    ans = next(ans)

print(ans)

Measured memory_bytes: 9244
#include <bits/stdc++.h>
#define int long long

using namespace std;

int n=0,m=0;	
priority_queue<int> q;
int arr[100001];

signed main()
{
	cin >> n >> m;
	for (int i=0; i<n; i++)
	{
		cin >> arr[i];
		q.push(arr[i]);
	}
	for (int i=0; i<m; i++)
	{
		int x = q.top();	
		q.pop();
		q.push(x/2);
	}	
	int res=0;
	while (!q.empty())
	{
		res+=q.top();
		q.pop();
	}
	cout << res;
	return 0;
}


Measured memory_bytes: 1912
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  a=s[0]

  c=0
  for i in range(1,len(s)):
    if s[i]!=a:
      c+=1
      a=s[i]

  return c

print(main())


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




int main(int argc, const char* argv[]){
    int N;
    cin >> N;
    
    int count = 0;
    int num = N / 2;
    if(N % 2 == 1)num++;
    for(int i = 1; i < num; i++){
        count += N / i;
        if(N % i == 0){
            count -= 1;
        }
    }

    cout << count + N / 2 << endl;

    return 0;
}

Measured memory_bytes: 3676
#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,c,x,t=1;
    scanf("%d%d",&a,&b);
    x=b;
    while(x>0)
    {
          t=t*10;
          x=x/10;
    }
    c=a*t+b;
    if(sqrt(c)==(int)sqrt(c))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

typedef long long ll;

int N;
std::string S;
std::string colors = "RGB";
std::map<char, std::vector<int> > cnt;

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);



  std::cin >> N >> S;
  for (char c : colors)
    cnt[c] = std::vector<int>(N, 0);
  for (int i = 0; i < N; ++i)
    cnt[S[i]][i] = 1;
  for (char c : colors)
    for (int i = 1; i < N; ++i)
      cnt[c][i] += cnt[c][i-1];

  ll ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      if (S[i] == S[j]) continue;
      char c = 'R';
      if (c == S[i] or c == S[j])
        c = 'G';
      if (c == S[i] or c == S[j])
        c = 'B';

      ans += (i == 0 ? 0 : cnt[c][i-1]);
      int k = i - (j - i);
      if (k >= 0 and S[k] == c)
        ans--;
    }
  }

  std::cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3672
#include <stdio.h>
int main(){
int a=0,b=0,temp;
for(int i=0;i<4;i++){
scanf("%d",&temp);
a+=temp;
}
for(int i=0;i<4;i++){
scanf("%d",&temp);
b+=temp;
}
if(a>b)printf("%d\n",a);
else printf("%d\n",b);
}

Measured memory_bytes: 2756