akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	class Edge implements Comparable<Edge>{
		int from;
		int to;
		int cost;
		Edge(int from, int to, int cost){
			this.from=from;
			this.to=to;
			this.cost=cost;
		}
		@Override
		public int compareTo(Edge o) {
			return Integer.compare(this.cost, o.cost);
		}
	}

	class P{
		int id;
		int x;
		int y;
		P(int id, int x,int y){
			this.id=id;
			this.x=x;
			this.y=y;
		}
	}

	class FindSet{
		int n;
		int p[];
		int d[];
		FindSet(int n){
			this.n=n;
			p = new int[n];
			d = new int[n];
			for(int i=0; i<n; i++) {
				p[i]=i;
				d[i]=1;
			}
		}
		public int find(int x) {
			if(p[x] != x) {
				p[x] = find(p[x]);
			}
			return p[x];
		}
		public boolean same(int x, int y) {
			return find(x) == find(y);
		}
		public void join(int x,int y) {
			if(d[x] < d[y]) {
				p[x] = y;
			}else {
				p[y]=x;
				if(d[x]==d[y]) {
					d[x]++;
				}
			}
		}
		public void unite(int x, int y) {
			if(same(x,y)) return;
			join(find(x), find(y));
		}
	}
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<P> pl = new ArrayList<>();
		ArrayList<Edge> el = new ArrayList<>();
		for(int i=0; i<n; i++) {
			int id = i;
			int x = sc.nextInt();
			int y = sc.nextInt();
			pl.add(new P(id, x, y));
		}

		//x座標でソード
		pl.sort((o1, o2)->Integer.compare(o1.x, o2.x));
		for(int i=1; i<pl.size(); i++) {
			P from = pl.get(i-1);
			P to = pl.get(i);
			el.add(new Edge(from.id, to.id, to.x-from.x));
		}
		//y座標でソート
		pl.sort((o1, o2)->Integer.compare(o1.y, o2.y));
		for(int i=1; i<pl.size(); i++) {
			P from = pl.get(i-1);
			P to = pl.get(i);
			el.add(new Edge(from.id, to.id, to.y-from.y));
		}
		//costでソート
		Collections.sort(el);

		FindSet fs = new FindSet(n);
		long ans = 0;
		for(int i=0; i<el.size(); i++) {
			Edge e = el.get(i);
			if(!fs.same(e.from, e.to)) {
				fs.unite(e.from, e.to);
				ans += e.cost;
			}
		}
		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 71736
#include <iostream>
#include <string>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;


int main(void) {
    int table[3][3];
    
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> table[i][j];
        }
    }
    
    int n;
    cin >> n;
    int targets[n];
    for (int i = 0; i < n; i++) {
        cin >> targets[i];
    }
    
    int result_table[3][3] = {0};
    
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < n; k++) {
                if (targets[k] == table[i][j]) {
                    result_table[i][j] = 1;
                    break;
                }
            }
        }
    }
    
    int row_correct_couter;
    int colum_correct_counter;
    
    for (int i = 0; i < 3; i++) {
        row_correct_couter = 0;
        colum_correct_counter = 0;
        for (int j = 0; j < 3; j++) {
            if(result_table[i][j] == 1)
                row_correct_couter++;
            if (result_table[j][i] == 1)
                colum_correct_counter++;
        }
        if (row_correct_couter == 3 || colum_correct_counter == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    if (result_table[0][0] + result_table[1][1] + result_table[2][2] == 3
        || result_table[0][2] + result_table[1][1] + result_table[2][0] == 3) {
        cout << "Yes";
        return 0;
    }
    
    cout << "No";
    
    return 0;
}

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

using namespace std;

int main() {
	int n;
	int M[1000][1000];
	cin >> n;

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++){
			M[i][j] = 0;
		}
	}

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

	return 0;
}


Measured memory_bytes: 3484
#include <iostream>

using namespace std;

int main(){
    int m,f,r;
    int sum = 0;
    char c;
    
    while(1){
        sum = 0;
        
        cin >> m >> f >> r;
        
        if(m == -1 && f == -1 && r == -1){
            break;
        }
        
        if(m >= 0 && f >= 0){
            sum = m + f;
            if(sum < 50 && r >= 50){
                sum = 50;
            }
        }
        
        if(m == -1 || f == -1){
            c = 'F';
        }else if(80 <= sum){
            c = 'A';
        }else if(65 <= sum){
            c = 'B';
        }else if(50 <= sum){
            c = 'C';
        }else if(30 <= sum){
            c = 'D';
        }else{
            c = 'F';
        }
        
        cout << c <<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3076
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;


int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;
		int money = 1000 - n;
		int res = 100000;
		for(int i=0;i<=2;i++){
			for(int j=0;j<=10;j++){
				for(int k=0;k<=20;k++){
					for(int l=0;l<=100;l++){
						for(int m=0;m<=200;m++){
							if(500*i+100*j+50*k+10*l+5*m > money) continue;
							else res = min(i+j+k+l+m + (money - (500*i+100*j+50*k+10*l+5*m)),res);
						}
					}
				}
			}
		}

		printf("%d\n",res);
	}

}

Measured memory_bytes: 876
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func allAtoi(num []string) []int {
	conv := make([]int, len(num))
	for i, item := range num {
		conv[i], _ = strconv.Atoi(item)
	}
	return conv
}

func main() {
	nm := allAtoi(strings.Split(nextLine(), " "))
	coins := sort.IntSlice(allAtoi(strings.Split(nextLine(), " ")))
	sort.Sort(coins)
	ans := solve(nm[0], nm[1], coins)
	fmt.Println(ans)
}

func solve(n, m int, coins []int) int {
	dp := make([]int, n+1, n+1)
	for j := 0; j < m; j++ {
		coin := coins[j]
		for i := 0; i < n; i++ {
			sum := coin + i
			if sum <= n {
				if dp[i]+1 < dp[sum] || dp[sum] == 0 {
					dp[sum] = dp[i] + 1
				}
			}
		}
	}
	return dp[n]
}



Measured memory_bytes: 1512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

  	Int K; cin >> K;
    if (K%2 == 0) cout << (K/2)*(K/2) << endl;
    else cout << (K/2)*(K/2+1) << endl;
}


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

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

int sort(const void *a ,const void *b){
  return *(int*)a - *(int*)b;
}
int main(){

  char s[200001],t[200001];
  scanf("%s",s);
  scanf("%s",t);

  int len = strlen(s);
  int count = 0;
  for(int i = 0; i < len; ++i){
    if(s[i] != t[i]) count ++;
  }

  printf("%d",count);


  return 0;
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 素数
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// べき乗の余り
ll modpow(ll a, ll n){
    ll res = 1;
    while(n){
        if(n & 1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n = n >> 1;
    }
    return res;
}

// コンビネーション
ll MAXN = 2e5+10;
vector<ll> inv(MAXN);
ll nCk(ll n, ll k) {
	ll res = 1;
	for(ll i = 1; i <= k; i++) {
		res = res*(n-i+1) % MOD;
	}
 
	for(ll i = 1; i <= k; i++) {
		res = res*inv[i] % MOD;
	}
	return res;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll h, w, k;
    cin>>h>>w>>k;
    vector<string> s(h);
    for(ll i=0;i<h;++i){
        cin>>s[i];
    }

    vector<vector<ll>> a(h, vector<ll>(w, 0));
    vector<ll> c(h, 0);
    for(ll i=0;i<h;++i){
        for(ll j=0;j<w;++j){
            if(s[i][j] == '#'){
                c[i]++;
            }
        }
    }

    ll id = 0;
    ll num = 1;
    for(ll i=0;i<h;++i){
        if(c[i] != 0){
            id = i;
            break;
        }
    }
    for(ll i=id;i<h;++i){
        bool flag = true;
        if(c[i] == 0){
            for(ll j=0;j<w;++j){
                a[i][j] = a[i-1][j];
            }
        }else{
            for(ll j=0;j<w;++j){
                if(s[i][j] == '#' and flag){
                    flag = false;
                }else if(s[i][j] == '#'){
                    num++;
                }
                a[i][j] = num;
            }
            num++;
        }
    }
    for(ll i=id-1;i>=0;--i){
        for(ll j=0;j<w;++j){
            a[i][j] = a[i+1][j];
        }
    }

    for(ll i=0;i<h;++i){
        for(ll j=0;j<w;++j){
            if(j != 0){
                cout<<' ';
            }
            cout<<a[i][j];
        }
        cout<<endl;
    }

    return 0;
}

Measured memory_bytes: 5640
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>
#include<time.h>
#include<map>
#include<set>
#include<sstream>
#include<cassert>
#include<limits>
using namespace std;
const int INF = 0x3f3f3f3f;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;

int cntDigists(ll n){
    int digits = 1;
    while(n/10)
    {
        digits++;
        n = n/10;
    }
    return digits;
}

void p3()
{
    long long i;
    cin >>i;
    long long pri = i;
    ll si = sqrtl(i);
    for(ll a = si; a>=2; --a)
    {
        if(i%a == 0)
        {
            pri = a;
            break;
        }
    }
    long long b = i/pri;
    int m = std::max(cntDigists(pri),cntDigists(b));
    cout << m;
}

int main()
{
    //freopen("in.txt", "r", stdin);
    p3();
    return 0;
}

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

int main()
{
	int r,g,b,x;
	cin >> r;
	cin >> g;
	cin >> b;
	x=r*100+g*10+b;
	if(x%4==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n;
    cin >> n;
    
    if(n%2==0)
    cout << n/2;
    else
    cout << (n/2)+1;

	return 0;
    
}


Measured memory_bytes: 8832
import std.algorithm.comparison;
import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto x = readln.strip.to!int;
	auto result = 1;
	
	foreach( int b; 1 .. x )
	{
		foreach( int p; 2 .. x )
		{
			auto bp = b ^^ p;
			if( x < bp ) break;
			
			result = max( result, bp );
		}
	}
	
	writeln( result );
}


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

int main() {
    int d, n;
    cin >> d >> n;
    cout << (long long)pow(100, d) * n + (long long)((n == 100) * pow(100, d)) << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			if(n == 0) break;
			calc(n);
		}
	}

	public void calc(int n){
		int[][] map = new int[n][n];
		for(int i = 0; i < n; i++){
			int m = sc.nextInt();
			for(int j = 0; j < m; j++){
				int p = sc.nextInt();
				map[i][p-1] = 1;
			}
		}
		int k = sc.nextInt();
		int[] ans = new int[n];
		for(int i = 0; i < k; i++){
			int l = sc.nextInt();
			for(int j = 0; j < n; j++){
				if(map[j][l-1] == 0) ans[j] = -1;
			}
		}
		
		int answer = 0;
		for(int i = 0; i < n; i++){
			if(ans[i] == 0 && answer == 0) answer = i + 1;
			else if(ans[i] == 0 && answer != 0) {
				answer = -1;
				break;
			}
		}
		if(answer == 0) answer = -1;
		System.out.println(answer);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 64948
N,M=map(int,input().split())
acs=[0]*N
was=[0]*N
for i in range(M):
    p,s=input().split()
    if s=='AC':
        acs[int(p)-1]=1
    else:
        was[int(p)-1]+=(acs[int(p)-1]!=1)
was=[was[i] for i in range(N) if acs[i]==1]
print(sum(acs),sum(was))

Measured memory_bytes: 5528
from sys import stdin
import math
a, b, x= [int(x) for x in stdin.readline().rstrip().split()]
if a*a*b/2 < x:
    t = 2 * (a*a*b - x) / (a*a*a)
elif a*a*b/2 == x:
    t = 1
if a*a*b/2 > x:
    t = (a*b*b)/(2*x)
print("{0:.10f}".format(math.degrees(math.atan(t))))

Measured memory_bytes: 3064
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

A = list(map(lambda x: x-min(a), a))
B = list(map(lambda x: x-min(b), b))
C = list(map(lambda x: x-min(c), c))

if A==B==C:
    print('Yes')
else:
    print('No')


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

long long gcd(long long a, long long b) {

  if (b == 0) {
    return a;
  }

  return gcd(b, a % b);

}

long long lcm(long a, long b) {

  return(long long) a / gcd(a, b) * b;

}

int main() {

  long long a, b;
  cin >> a >> b;

  long long result = lcm(a, b);

  cout << result << endl;

}


Measured memory_bytes: 256
s = input()
s1, s2 = s[:2], s[2:]

f1 = (1 <= int(s1) <= 12)
f2 = (1 <= int(s2) <= 12)
ans = ""
if f1 and f2:
    ans = "AMBIGUOUS"
elif f1 and (not f2):
    ans = "MMYY"
elif (not f1) and f2:
    ans = "YYMM"
else:
    ans = "NA"

print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <queue>


using namespace std;

using ll = long long;

ll MaxN = 1e5+1;

int main() {
  ll N, M;
  cin >> N >> M;

  vector<int> L(N+1, 0), R(N+1, 0);
  for(auto i=0; i<M;i++) {
    ll l, r;
    cin >> l >> r;
    L[l]++;
    R[r]++;
  };

  ll cc = 0, tt=0;
  for(auto i=1; i<=N;i++) {
    tt += L[i];
    if (tt == M) cc++;
    tt -= R[i];
  }

  cout << cc << endl;

  return 0;
}


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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
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; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void){
    int n;cin>>n;
    vint a(n);vin(a);
    map<int,int> cnt;
    rep(i,n){
        if(cnt.find(a[i])==cnt.end()){
            cnt[a[i]]=1;
        }else{
            cnt[a[i]]++;
        }
    }
    int dec=0;
    rfor(p,cnt){
        dec+=p.second-1;
    }
    if(dec%2==1)dec++;

    cout << n-dec << endl;


    return 0;
}


Measured memory_bytes: 5376
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b + 1) != -1:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    i64 N;
    read(N);

    string ans;
    if (N == 0) {
        ans = "0";
    } else {
        while (N != 0) {
            const i64 r = !!(N % 2);
            ans += ('0' + r);
            N = (N - r) / (-2);
        }
    }

    reverse(all(ans));
    print(ans);

    return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

void solve() {
	int r, g; cin >> r >> g;
	cout << 2*g-r;
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for _ in range(n)])
cnt = 0
t = 0
for i in ab:
    mi = min(m - cnt, i[1])
    t += i[0] * mi
    cnt += mi
    if cnt == m:
        print(t)
        exit()


Measured memory_bytes: 28648
#include<bits/stdc++.h>
typedef long long ll;
#define pair<int,int> P
#define sc(N) scanf("%lld",&N);
using namespace std;
int main()
{
    ll n;
    sc(n);
    ll ans=0;
    for(int i=1;i<10&&i<=n;i++){
        ans++;
    }
    for(int i=100;i<1000&&i<=n;i++){
        ans++;
    }
    for(int i=10000;i<100000&&i<=n;i++){
        ans++;
    }
    cout<<ans<<'\n';
}


Measured memory_bytes: 256
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
e=int(e)
k=int(k)
if k<e-a:
    print(":(")
elif k>=e-a:
    print("Yay!")

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

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define int long long
#define vi vector<int>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.resize(n,x)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()
using namespace std;
using namespace __gnu_pbds;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1e9+7;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};
template<class T>
T abst(T a)
{return a<0?-a:a;}
template<class T> using ordered_set=tree<
T,
null_type,
less_equal<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}
int ncr(int n,int r){
return (((fact[n]*inv[r])%md)*inv[n-r])%md;
}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string s;cin>>s;
if(find(all(s),'7')!=s.end())
cout<<"Yes";
else
cout<<"No";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
}


Measured memory_bytes: 3644
#include<iostream>
using namespace std;
int main(){
    int  A[120][120], B[120][120];
    long long C[120][120];
    int n, m, l;
    
    cin >> n >> m >> l;
    
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >>A[i][j];
        }
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<l; j++){
            cin >>B[i][j];
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            C[i][j]=0;
        }
    }
    
    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            for(int k=0; k<m; k++){
                C[i][j] +=A[i][k]*B[k][j];
            }
        }
    }
    
    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            cout << C[i][j];
            if(j<l-1) cout << " ";
        }
        cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3272
# coding: utf-8
# Your code here!
n = int(input())

a = [int(i) for i in input().split()]

a.sort()
if len(a) %2 == 1:
    odd = True
    now = 0
    if a[0] != 0:
        print(0)
        exit()
    now += 2
    for i in range(1,len(a)//2 + 1 , 2):
        if a[i] != now or a[i+1] != now:
            print(0)
            exit()
        now += 2
        
else:
    odd = False
    now = 1
    for i in range(0,len(a)//2 + 1,2):
        if a[i] != now or a[i+1] != now:
            print(0)
            exit()
        now += 2

print(2**(len(a)//2) %(10**9+7))

Measured memory_bytes: 13880
// Solution to https://atcoder.jp/contests/dp/tasks/dp_n
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

const int64_t LL_INF = (int64_t) 2e18 + 5;

int N;
vector<int64_t> A, prefix_sum;
vector<vector<int64_t>> dp;
vector<vector<int16_t>> opt;

int main() {
    ios::sync_with_stdio(false);
#ifndef NEAL_DEBUG
    cin.tie(nullptr);
#endif

    cin >> N;
    A.resize(N);
    prefix_sum.assign(N + 1, 0);

    for (int i = 0; i < N; i++) {
        cin >> A[i];
        prefix_sum[i + 1] = prefix_sum[i] + A[i];
    }

    dp.assign(N + 1, vector<int64_t>(N + 1, LL_INF));
    opt.assign(N + 1, vector<int16_t>(N + 1, -1));

    for (int i = 0; i < N; i++) {
        dp[i][i + 1] = 0;
        opt[i][i + 1] = i;
    }

    // Knuth optimization: opt[i][j - 1] <= opt[i][j] <= opt[i + 1][j].
    for (int i = N - 1; i >= 0; i--)
        for (int j = i + 2; j <= N; j++)
            for (int k = opt[i][j - 1]; k <= opt[i + 1][j]; k++) {
                int64_t candidate = dp[i][k] + dp[k][j] + prefix_sum[j] - prefix_sum[i];

                if (candidate < dp[i][j]) {
                    dp[i][j] = candidate;
                    opt[i][j] = k;
                }
            }

    cout << dp[0][N] << '\n';
}


Measured memory_bytes: 1920
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef pair<int, int> pii;

char S[200005];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> S + 1;
    int n = strlen(S + 1);
    int mx = 0, pr = 0;
    llong ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (!pr) {
            if (S[i] != 'A') mx = 0;
            else ++mx;
        }
        pr = 0;
        if (i + 2 <= n && S[i + 1] == 'B' && S[i + 2] == 'C') {
            ans += mx;
            ++i;
            pr = 1;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(){
  int A, B;
  int N;
  double tmp;
  scanf("%d %d", &A, &B);
  if(A<B){
    N = B - A;
  }else{
    N = A - B;
  }
  tmp = (double)((A + B) % 2);
  if(tmp == 0) printf("%d\n", (A+B)/2);
  else if (tmp != 0) printf("IMPOSSIBLE\n");
  return 0;
}

Measured memory_bytes: 128
import numpy as np

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


N=int(input())
a=acinput()
b=acinput()

SA=np.sum(a)
res=0
for i in range(N):
    #print(a,b)
    if a[i]>=b[i]:
        a[i]-=b[i]
        b[i]=0
    else:
        b[i]-=a[i]
        a[i]=0
        

        a[i+1]-=b[i]
        if a[i+1]<0:
            a[i+1]=0

res=0
for sa in a:
    res+=sa
print(SA-res)



Measured memory_bytes: 27256
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=1;i<=n;i++)
using Graph = vector<vector<int> >;
int N,X,Y;
const int MAXN = 2001;
int node[MAXN][MAXN];
int main(){
    cin >> N >>  X >> Y;
    map<int,int> comb;
    Rep(i,N)for(int j=i+1;j<=N;j++){
        int tmp = min(j-i, abs(j-Y)+abs(i-X)+1);
        comb[tmp]++;
    }
    Rep(i,N-1)cout << comb[i] << endl;
   return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


signed main(){
    
    ll n;
    cin >> n;
    ll a[n] = {};

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

        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    ll temp = 1;
    rep(i,0,n){
        if(a[i] > (ll)1e9 && temp > (ll)1e9 || a[i] * temp < 0){
            cout << -1 << endl;
            return 0;
        }
        else if(a[i] > (ll)1e18 || temp > (ll)1e18){
            cout << -1 << endl;
            return 0;
        }

        temp *= a[i];

        if(temp > (ll)1e18){
            cout << -1 << endl;
            return 0;
        }
    }

    cout << temp << endl;
    return 0;
}


Measured memory_bytes: 4368
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val xs = readLine()!!.split(' ').map { it.toInt() }.toMutableList()
    var cnt = 0
    for (i in 0 until n) {
        var mini = i
        for (j in i until n) {
            if (xs[j] < xs[mini]) {
                mini = j
            }
        }
        if (mini > i) {
            val t = xs[i]
            xs[i] = xs[mini]
            xs[mini] = t
            cnt++
        }
    }
    println(xs.joinToString(" "))
    println(cnt)
}


Measured memory_bytes: 32144
#include <stdio.h>
#include <stdlib.h>

int main(){
  int i;
  int n,a[100002];
  int max;

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

  max = 0;
  for(i = 0;i < n;i++){
    max += abs(a[i+1] - a[i]);
  }

  for(i = 1;i < n;i++){
    printf("%d\n",max-abs(a[i+1]-a[i])-abs(a[i]-a[i-1])+abs(a[i+1]-a[i-1]));
  }
  return(0);
}

Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <random>

#include <ctime>
#include <cmath>
#include <cassert>

using namespace std;

mt19937 rng(735);

const long long INF = 4e18;
const long long inf = 1e9 + 7;

const long long P = 6666622222487;
const long long Q = 150001;

template <typename T>
T sqr(T x) {
    return x * x;
}

long long powmod(long long x, long long a, long long mod) {
    return (a <= 0) ? 1 : (((a % 2) ? (x * powmod(x, a - 1, mod)) : sqr(powmod(x, a / 2, mod))) % mod);
}

long long gcd(long long a, long long b) {
    return (b == 0) ? a : gcd(b, a % b);
}

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

    int Q;
    cin >> Q;
    for (int query = 0; query < Q; query++) {
        long long A, B;
        cin >> A >> B;
        long long place = A * B - 1;

        if (A > B) swap(A, B);

        long long ans = 2 * (A - 1);
        
        /*long long last_resort = B - 1;
        for (long long i = A; i <= B; i++) {
            last_resort = min(last_resort, place / i);
            if (last_resort <= A || i == B) {
                ans += i - A;
                break;
            }
            last_resort--;
        }*/

        // Binsearch pos
        long long l = A, r = B;
        while (l + 1 < r) {
            long long med = (l + r) / 2;
            if (place / med - A > med - A) l = med;
            else r = med;
        }

        long long last_resort = B - A;
        for (long long i = max(l - 3, A); i < min(r + 3, B); i++) {
            last_resort = min(last_resort, (place / i - A) + (i - A));
        }
        ans += last_resort;

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

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

#define M 250000

int main() {
	int n, num=0;
	int p[M], c[M];
	for(int i=0; i<=M; ++i) p[i] = 1;
	p[0] = p[1] = 0;
	c[0] = c[1] = 0;
	for(int i=2; i<=M; ++i) {
		if(p[i]) {
			if(i<=M/i) for(int j=i*i; j<=M; j+=i) p[j] = 0;
			num++;
		}
		c[i] = num;
	}
	
	while(1) {
		cin >> n;
		if(!n) break;
		cout << c[2*n] - c[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    int h[n];
    rep(i,n){
        cin>>h[i];
    }
    int dp[n+10];
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    rep(i,n-2){
        dp[i+2]=min(dp[i+1]+abs(h[i+1]-h[i+2]),
                    dp[i]+abs(h[i]-h[i+2])
                    );
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
from sys import stdin
input = stdin.readline
N = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]
min = 1000000
for i in range(-100, 101):
	sum = 0
	tmp = [i] * len(a)
	for i in range(len(a)):
		sum += (tmp[i] - a[i]) ** 2
	if sum < min:
		min = sum

print(min)

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

using namespace std;

int main(void){

    int n;
    string str;

    cin >> n >> str;

    string tmp;

    if(n % 2 == 1){
        cout << "No" << endl;
        return 0;
    }

    for(int i = 0;i < n/2;i++){
        tmp += str[i];
    }

    if(tmp+tmp == str) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	// your code goes here
    int h,m,s,x;
    
    scanf("%d",&x);
    h=x/3600;
    m=(x-h*3600)/60;
    s=x-h*3600-m*60;
    
    printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

int main()
{
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  ll C;
  scanf("%lld",&C);

  cout << max(0LL,B+C-A) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
   int a,b,x;
   cin >> a >> b >> x;
   if (a+b-1 >= x && a <= x) cout << "YES" << endl;
   else cout << "NO" << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
    int a ,b;
    cin>>a>>b;
    int d = a/b;
    int r = a%b;
    // int ff = 100000*a/(100000*b);
    double f =  double(a)/double(b);
    
    // cout.precision(5);
    cout<<d<<" "<<r<<" ";
    cout<<fixed<<setprecision(5)<<f<<endl;
    return 0;
}


Measured memory_bytes: 3220
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define int long long
#define ld long double
#define ll long long

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int k;
	cin >> k;
	set<int> st;
	vector<int> v;
	for (int i = 1; i <= 9; i++) {
		st.insert(i);
	}
	while (v.size() < k) {
		int now = *st.begin();
		st.erase(*st.begin());
		v.pb(now);
		int p = now % 10;
		now *= 10;
		if (p - 1 >= 0) {
			st.insert(now + (p - 1));
		}
		st.insert(now + p);
		if (p + 1 < 10) {
			st.insert(now + (p + 1));
		}
	}
	sort(v.begin(), v.end());
	cout << v[k - 1];
	return 0;
}


Measured memory_bytes: 9972
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int main(){
  while(true){
    int b = getInt();
    int r = getInt();
    int g = getInt();
    int c = getInt();
    int s = getInt();
    int t = getInt();

    if(b+r+g+c+s+t == 0) break;

    int ans =
      100 + b * 15 + r * 15 + g * 7 + c * 2 + s * 3 - t * 3 + b * 5 + r * 3
      + b * 15 * 5 + r * 15 * 3;
    print(ans);
  }
  return 0;
}

Measured memory_bytes: 788
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
var div = arr[0] / ( arr[1] * 2 + 1 ) 
let amari = arr[0] % ( arr[1] * 2 +  1) 
if( amari > 0 ) {
  div += 1
}
print( div )

Measured memory_bytes: 4208
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
int N, A, B;
cin >> N >> A >> B;
string S;
cin >> S;

int Acount = 0;
int Bcount = 0;

for( int i = 0; i < N; i++ ){
if( S.at(i) == 'c' ) cout << "No" << endl;
else if( S.at(i) == 'a'  && Acount+Bcount < A+B ){
Acount++;
cout << "Yes" << endl;
}else if( S.at(i) == 'b' && Acount+Bcount < A+B && Bcount < B ){
Bcount++;
cout << "Yes" << endl;
}else cout << "No" << endl;

}
 
}



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

int main()
{
  int n;
  cin>>n;
  for(;n--;)
    {
      int h,s;
      char buf;
      cin>>h>>buf>>s;
      //cout<<h<<" "<<s<<endl;
      double hr=h*(360/12.0)+s*(30/60.0);
      double sr=s*(360/60.0);
      //      cout<<hr<<" "<<sr<<endl;
      if(hr<sr)
	swap(hr,sr);
      double diff=min(hr-sr,360-hr+sr);
      //      cout<<diff<<endl;
      if(diff<30)
	cout<<"alert"<<endl;
      else if(diff>=90)
	cout<<"safe"<<endl;
      else
	cout<<"warning"<<endl;
    }

}

Measured memory_bytes: 1152
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b, c;
	cin >> a >> b >> c;
	map<int, int> mc;
	mc[a] = 1;
	mc[b] = 1;
	mc[c] = 1;
	cout << mc.size() << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define re(x) cout<<(#x)<<" is "<<(x)<<"\n"; 
#define gif(a,b) ((a)/(b)+((a)%(b)?1:0))
using namespace std;

int32_t main()
{
	IOS
	int T = 1; 
	//cin >> T;  
	for (int t = 0; t < T; ++t)
	{
		int n, d;
		cin >> n >> d;
		int ans = 0;
		for(int i = 0; i < n; ++i)
		{
			int x, y;
			cin >> x >> y;
			if((x*x + y*y) <= d*d)
				ans++;

		}
		cout << ans;
		

	}
	return 0;
}
//if not working? go ahead.


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

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

using namespace std;

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

class UnionFind {
private:
	class Node {
	public:
		int parent;

		Node(int parent) {
			this->parent = parent;
		}
	};

	int root(int x) {
		int base = x;
		while (x != node[x].parent) {
			x = node[x].parent;
		}
		node[base].parent = x;
		return x;
	}

	vector<Node> node;
public:
	UnionFind(int size) {
		for (int i = 0; i < size; i++) {
			node.push_back(Node(i));
		}
	}

	void unite(int x, int y) {
		node[root(x)].parent = root(y);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}
};

signed main() {
	int n, q;
	cin >> n >> q;

	auto uf = UnionFind(n);

	rep(i, q) {
		int com, x, y;
		cin >> com >> x >> y;

		if (com == 0) {
			uf.unite(x, y);
		} else {
			cout << (uf.same(x, y) ? 1 : 0) << endl;
		}
	}

    return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int n;
cin>>n;
int d[n];
for(int i=0;i<n;i++)
    cin>>d[i];
ll ans=0;
for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
    ans+=d[i]*d[j];
cout<<ans;
return 0;
}


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

int main() {
	// your code goes here
	int q,C,A,N;
	cin >> q;
	for(int i=0;i<q;i++){
		int team=0;
		cin >> C >> A >> N;
		int x=min(C,min(A,N));
		team+=x;
		C-=x;
		A-=x;
		N-=x;
		x=min(C/2,A);
		team+=x;
		C-=x*2;
		A-=x;
		x=C/3;
		team+=x;
		cout << team << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#include<iostream>
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~(i)))
int n;
long long ans;
int a[100010];
int main()
{
	scanf("%d",&n);
	f(i,1,n)scanf("%d",&a[i]);
	f(i,1,n)
	{
		ans+=a[i]/2;
		if((a[i]&1)&&a[i+1]>0)++ans,--a[i+1];
	}return printf("%lld\n",ans),0;
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

int n, a, b, p, x, y, z;

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

    cin >> n >> a >> b;
    rep(i, n) {
        cin >> p;
        if(p <= a)
            x++;
        else if(b < p)
            z++;
        else
            y++;
    }
    cout << min(min(x, y), z) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    char st;
    while(1){
        char num[1001];
        scanf("%s", num);
        int sum = 0;
        if( num[0] == '0' ) break;
        else {
            for(int i = 0; num[i] != '\0'; i++) {
                sum += num[i] - '0';
            }
        }
        printf("%d\n", sum);
    }
}



Measured memory_bytes: 3200
#include<stdio.h>

int main(void)
{
	int a, b,c,e;
	double d;
	
	scanf("%d%d", &a, &b);
	
	c = (a + b) / 2;
	d = (a + b) / 2.0;
	e = c;
	if (d > c)
	{
		e = c + 1;
	}
	printf("%d", e);
}

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

using namespace std;

int n;
int h[500];
int ans;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 0; i < n; i++)
    {
        int t = 1;
        for (int j = 0; j < i; j++)
        {
            if (h[j] > h[i])
                t = 0;
        }
        ans += t;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S, T; cin >> S >> T;
    const int n = 3;

    int res = 0;
    rep(i, n){
        res += (S[i] == T[i] ? 1:0);
    }
    cout << res << endl;

    return 0;
}


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

using namespace std;

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示

  int n;
  cin>>n;
  cout<<n*800-n/15*200<<endl;
}

Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    
    dp = [-1] * n
    
    for i in range(n):
        if i == 0:
            dp[0] = 1
        elif i == 1:
            dp[1] = 2
        elif i == 2:
            dp[2] = 4
        else:
            dp[i] = dp[i-1] + dp[i-2] + dp[i-3]
    ans = dp[-1] // 3650
    if dp[-1] % 3650 > 0:
        ans += 1
    print(ans)


Measured memory_bytes: 5592