akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int n;
vector<int> d;
vector<vector<int>> graph;
vector<bool> bfsflg(n, 0);
void bfs(int z){
    queue<int> q;
    bfsflg[z] = 1;
    d[1]=0;
    q.push(z);

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

        for(int i : graph[v]){
            if(!bfsflg[i]){
                bfsflg[i] = 1;
                d[i]=d[v]+1;
                q.push(i);
            }
        }
    }
}

int main() {
    cin >> n;
    d.assign(n+1, -1);
    graph.assign(n+1, {});
    bfsflg.assign(n+1, 0);
    int u, k, tmp;
    for(int i=1; i<=n; i++){
        cin >> u >> k;
        for(int j=0; j<k; j++){
            cin >> tmp;
            graph[i].push_back(tmp);
        }
    }
    
    bfs(1);

    for(int i=1; i<=n; i++){
        cout << i << " " << d[i] << endl;
    }
}


Measured memory_bytes: 3160
def mst ms, n
  colors = Array.new(n){1} # 1:white, 2:gray, 3:black
  costs = Array.new(n){Float::INFINITY}
  sums = 0

  colors[0] = 2
  costs[0] = 0

  while true do
    min_cost = Float::INFINITY
    min_cost_i = nil
    costs.each_with_index do |cost, i|
      if colors[i] == 2 && cost < min_cost
        min_cost = cost
        min_cost_i = i
      end
    end

    break if min_cost_i.nil?

    colors[min_cost_i] = 3
    sums += min_cost

    colors.each_with_index do |color, i|
      if color == 3
        ms[i].each_with_index do |m, j|
          if colors[j] != 3 && m < costs[j]
            costs[j] = m
            colors[j] = 2
          end
        end
      end
    end
  end

  sums
end

n = gets.chomp.to_i
ms = Array.new(n)
n.times do |i|
  ms[i] = gets.chomp.strip.split(' ').map(&:to_i).map{|x| x == -1 ? Float::INFINITY : x}
end
puts mst(ms, n)


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

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1001001001;
const double PI = acos(-1);

#define rep(i, n)  for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int main() {
    ll n;
    cin >> n;
    n-=1;
    string ans = "";
    while(n >= 0) {
        ll a = n % 26;
        ans = char(int(a) + int('a')) + ans;
        n /= 26;
        n -= 1;
    }

    cout << ans << endl;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    string s;
    cin >> n >> s;
    rep(i, s.size()) {
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s << endl;
    return 0;
}


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

int main() {
	long N;
	scanf("%ld", &N);

	for (long i = N; i >= 0; i--) {
		double tmp = sqrt(i);
		int temp = tmp;
		if (tmp == temp) {
			printf("%ld\n", i);
			break;
		}
	}
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________


	int n;
	cin >> n;
	int a[n];
	int N = 1000000;
	//int h[N] = {0};
	um<int, int>h;
	zip(i, 0, n)
	{
		cin >> a[i];
		h[a[i]]++;
	}
	int cnt = 0;
	zip(i, 0, n)
	{
		int x = a[i];
		int flag = 0;
		int ran = sqrt(x);
		h[x]--;
		for (int j = 1; j <= ran; j++)
		{
			if (x % j ==  0)
			{
				int p = j;
				int q = x / j;
				if (h[p] > 0 || h[q] > 0 )
				{
					flag = 1;
					break;
				}
			}
		}

		if (flag == 0)
		{
			cnt++;
		}
		h[x]++;
	}
	cout <<  cnt << en;


	return 0;
}



Measured memory_bytes: 33148
using System;
class Program{
	static string s;
	static long[] h;
	static long ans=0;
	static void Main(){
		s=Console.ReadLine();
		h=new long[s.Length];
		fu(0,0,0);
		Console.WriteLine("{0}",ans);
	}
	static void fu(int a,int b,int c){
		if(b==s.Length-1){
			h[c]=long.Parse(s.Substring(a,b-a+1));
			for(int i=0;i<=c;i++){ans+=h[i];}
		}
		else{
			fu(a,b+1,c);
			h[c]=long.Parse(s.Substring(a,b-a+1));
			fu(b+1,b+1,c+1);
		}
	}
}

Measured memory_bytes: 13140
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  cout << a * b / 2 << "\n";
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	lint N;
	cin >> N;

	lint ans = 0;

	ans += (N / 500) * 1000;
	ans += ((lint)(N % 500 / 5)) * 5;

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<sstream>
#include<bitset>
using namespace std;
#define pii pair<int,int>
#define pdd pair<double,double>
#define mp make_pair
#define pb push_back
#define ALL(x)	x.begin(),x.end() 
#define fst first
#define sec second
#define PQ priority_queue 
typedef long long ll;
//const double PI = 4*atan(1.);
const int INF = 0x3f3f3f3f;
const int maxn = 1e6+10;
const double eps = 1e-6;
const ll mod=1e9+7;
const double pi=acos(-1.0);
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=0;
    if((b-a)%2==1)
    {
         ans=min(b-1,n-a);
        if(a-1>n-b)
        {
           ans=min(ans,n-b+1+(n-(a+n-b+1))/2);
        }
        else
        {
            ans=min(ans,a-1+1+(b-a-1)/2);
        }
        

    }
    else
    {
        ans=(b-a)/2;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    ary = [input().split() for _ in range(m)]
    ac_cnt = 0
    wa_cnt = 0
    ac_ary = [[0, 0] for i in range(n)]
    for toi_num, kekka in ary:
        num = int(toi_num) - 1
        if ac_ary[num][0] == 0:
            if kekka == 'WA':
                ac_ary[num][1] += 1
            elif kekka == 'AC':
                ac_ary[num][0] = 1
                ac_cnt += 1
                wa_cnt += ac_ary[num][1]
    print(ac_cnt, wa_cnt)

if __name__ == '__main__':
    main()


Measured memory_bytes: 42896
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		int p=(int)(n/1.08);
		if((int)(p*1.08)==n){Console.WriteLine("{0}",p);}
		else if((int)((p+1)*1.08)==n){Console.WriteLine("{0}",p+1);}
		else {Console.WriteLine(":(");}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13140
#include <stdio.h>
int main (){
	int N,yes=0;
	scanf("%d", &N);
	char S[N+1];
	scanf("%s", S);
	if (N%2==0){
	for (int i=0 ; i<N/2 ; i++){
		if (S[i]==S[i+(N/2)]){
			yes++;
		}
		else {
			continue;
		}
	}
	yes==N/2 ? printf("Yes") : printf("No");}
	if (N%2==1){
		printf("No");
	}
return 0;
}


Measured memory_bytes: 1708
#include<bits/stdc++.h>
 using namespace std;
  int main(){
       char s;
         cin >> s;
           if(s == 'T') cout << 'A' << endl;
           else if(s == 'A') cout << 'T' << endl;
           else if(s == 'G') cout << 'C' << endl;
           else if(s == 'C') cout << 'G' << endl;
  }


Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		int[] dp = new int[N];
		dp[0] = 0;
		dp[1] = Math.abs(map[1] - map[0]);
		for (int i = 2; i < N; i++) {
			dp[i] = Math.min(dp[i-2] + Math.abs(map[i-2] - map[i]), dp[i-1] + Math.abs(map[i-1] - map[i]));
		}
		
		System.out.println(dp[N-1]);
	}
}



Measured memory_bytes: 49400
import java.util.*;
public class Main{
 	public static void main(String[] args) {
 	    
		Scanner sc = new Scanner(System.in);
      	int M1 = sc.nextInt();
      	int D1 = sc.nextInt();
      	int M2 = sc.nextInt();
      	int D2 = sc.nextInt();
      	
      	if(M1<M2 && D2<D1){
      	    System.out.println("1");
      	}else{
      	    System.out.println("0");
      	}
      	
      
      	System.out.println();
    }
}


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

using namespace std;

int main(){
    
    int n, ans = 0;
    string s;

    cin >> n;
    cin >> s;

    for(int i = 0; i < n - 2; i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  int mod=1e9+7;
  
  string t,b;
  cin>>t>>b;

  vector<int> dp(b.size()+1,0);
  dp[0]=1;
  
  for(int i=0;i<(int)t.size();i++){
    for(int j=(int)b.size()-1;j>=0;j--){
      if(t[i]==b[j]){
        dp[j+1]+=dp[j];
        dp[j+1]%=mod;
      }
    }
  }

  cout<<dp[b.size()]<<endl;
  return 0;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int d;
  int e;
  e = (b+1)/2;
  while(a > 0){
    int c;
    int f;
    cin >> c;
    f = b - c;
    if(e > c)
      d += c*2;
    else if(f > 0)
      d += f*2;
    else
      d += (-f)*2;
    a--;
  }
  cout << d << endl;
}
    
   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  int h,w;
  cin >> h >> w;
  vint eng(26);
  rep(i,h) rep(j,w){
    char s;
    cin >> s;
    eng[s-'a']++;
  }
  int count2 = 0;
  int count4 = 0;
  int countodd = 0;
  rep(i,26){
    if(eng[i] % 4 == 0) count4++;
    else if(eng[i] % 2 == 0) count2++;
    else countodd++;
  }
  if(h % 2 == 0 && w % 2 == 1){
    if(countodd == 0 && count2 <= h/2) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if(h % 2 == 0 && w % 2 == 0){
    if(count2 == 0 && countodd == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if(h % 2 == 1 && w % 2 == 1){
    if(countodd == 1 && count2 <= h/2 + w/2) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if(h % 2 == 1 && w % 2 == 0){
    if(countodd == 0 && count2 <= w/2) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

#define roundup(n,d) (((n) + ((d)-1)) / (d))
#define ll long long

using namespace std;

int main(void){
    string s;
    cin >> s;
    int count[26] = {};
    
    for(int i = 0;i < s.size();i++){
        count[s[i] - 97]++;
    }

    for(int i = 0;i < 26;i++){
        if(count[i] % 2 == 1) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char s[4];
cin >> s;
int kami,shimo;
kami = (s[0]-'0')*10+s[1]-'0';
shimo = (s[2]-'0')*10+s[3]-'0';
if(1<=kami&&kami<=12) {
  if(1<=shimo&&shimo<=12) {
    cout << "AMBIGUOUS" << endl;
  } else {
    cout << "MMYY" << endl;
  }
} else {
  if(1<=shimo&&shimo<=12) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
}
return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = [list(map(int, input().split())) for i in range(n)]
arm = [list(map(int, input().split())) for j in range(n)]  # 入力

ans = -9999999999  # 最小
for item in range(1, 1024):  # 2 ** 10 == 1024
    fund = 0
    for i in range(n):  # 店の数
        cou = 0  # かぶる数
        for x in range(10):  # 月-金(5) * 2
            if (item >> x) % 2 == 1 and arr[i][x] == 1:  # その時間で被るかどうか
                cou += 1
        fund += arm[i][cou]
    ans = max(ans, fund)  # 最大値更新

print(ans)

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

int main(){
	string s;
	cin >> s;
	vector<int> v(4);
	rep(i,4) v[i] = s[i] - '0';
	rep(is,1<<3){
		int tmp = v[0];
		rep(j,3){
			if(is>>j&1) tmp += v[j+1];
			else tmp -= v[j+1];
		}
		if(tmp == 7){
			cout << v[0];
			rep(j,3){
				if(is>>j&1) cout << '+';
				else cout << '-';
				cout << v[j+1];
			}
			cout << "=7" << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3608
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] al = new long[n];
        long[] sl = new long[n];
        for(int i = 0; i < n; i++){
            al[i] = sc.nextLong();
            sl[i] = al[i];
        }
        Arrays.sort(sl);
        long upper = sl[n/2];
        long lower = sl[n/2-1];
        for(long a : al){
            if(a >= upper){
                System.out.println(lower);
            }else{
                System.out.println(upper);
            }
        }
        
    }
    
}

Measured memory_bytes: 104132
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  ll ans = pow(n/k, 3);
  if(!(k%2))
    ans += pow((n+k/2)/k, 3);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main ()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a==b)
        printf("Draw\n");

    else if(a<b)
    {
        if(a==1)
        {
            printf("Alice\n");
        }
        else
            printf("Bob\n");
    }
    else if(a>b)
    {
        if(b==1)
            printf("Bob\n");
        else
            printf("Alice\n");
    }

    return 0;
}

Measured memory_bytes: 1620
H, W = map(int, input().split())
def f(H, W):
    if H == 1 or W == 1:
        return 1
    if H % 2 == 0:
        return H // 2 * W
    else:
        return H // 2 * W + (W+1) // 2
print(f(H, W))

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;

typedef pair<string, string> P;

bool ans[100];
vector<P> vec;
string in;

bool isVowel(char c){
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') return true;
  return false;
}

bool isVLCons(char c){
  if(c == 'k' || c == 's' || c == 't' || c == 'h' || c == 'p') return true;
  return false;
}

main(){
  while(cin >> in && in != "#"){
    vec.clear();
    char a , b, c;
    a = b = c = 0;
    for(int i=0;i<in.size();i++){
      string str;
      str += in[i];
      if(i+1 == in.size() && in[i] == 'n') vec.push_back(P("n", "#"));
      if(isVowel(in[i])){
        if(!a && !b){
          if(c == in[i]) vec.push_back(P(str, "$"));
          else vec.push_back(P("", str));
          a = 0; b = 0; c = in[i];
        }
        else if(a && !b){
          string A;
          A += a;
          vec.push_back(P(A, str));
          a = 0; b = 0; c = in[i];
        }
        else if(a && b){
          string A;
          A += a;
          A += b;
          vec.push_back(P(A, str));
          a = 0; b = 0; c = in[i];
        }
      }else{
        if(in[i] == '\'' ){
          vec.push_back(P("n\'", "#"));
          a = 0; b = 0; c = 0;
        }
        else if(!a){
          a = in[i];
        }
        else if(a && a == 'n' && in[i] != 'y'){
          vec.push_back(P("n", "#"));
          a = in[i]; b = 0; c = 0;
        }
        else if(a && a != 'y' && a != 'w' && in[i] == 'y'){
          b = in[i];
        }
        else if(a && a == in[i]){
          vec.push_back(P(str, "@"));
        }
      }
    }
    fill(ans, ans+100, false);
    for(int i=0;i<vec.size();i++){
      char c = vec[i].second[0];
      if(!(c == '@' || c == '#' || c == '$')){
        if(c == 'i' || c == 'u'){
          if(isVLCons(vec[i].first[0]) && (i+1 == vec.size() || isVLCons(vec[i+1].first[0]))) ans[i] = true;
        }
        if(i > 0 && (c == 'a' || c == 'o')){
          if(isVLCons(vec[i-1].first[0]) && isVLCons(vec[i].first[0])){
            char c2 = vec[i-1].second[0];
            if(!(c == '@' || c == '#' || c == '$') && c == c2) ans[i-1] = true;
          }
        }
      }
    }
    int p = 0;
    for(int i=1;i<vec.size();i++){
      char c = vec[i].second[0];
      if(ans[p] && ans[i]) ans[i] = false;
      if(c != '@' && c != '#' && c != '$') p = i;
    }
    for(int i=0;i<vec.size();i++){
      char c = vec[i].second[0];
      cout << vec[i].first;
      if(!(c == '@' || c == '#' || c == '$')){
        if(ans[i]) cout << "(" << vec[i].second << ")";
        else cout << vec[i].second;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 1200
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
    if (n % 10 == 9 || n / 10 == 9) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23892
package main

import (
	"fmt"
)

func main() {
  var n int
  fmt.Scanf("%d", &n)
  
  ans := "No"
  if n / 10 == 9{
    ans = "Yes"
  }
  if n % 10 == 9{
    ans = "Yes"
  }
  fmt.Printf("%s\n", ans)
}

Measured memory_bytes: 1832
#include <iostream>

// namespace
using namespace std;

// consts
int MOD = 1000000007;  // https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a

long long modpow(long long a, long long p) {
    if (p == 1) return a % MOD;
    if (p % 2 == 1) return modpow(a * a % MOD, p / 2) * a % MOD;
    else return modpow(a * a % MOD, p / 2) % MOD;
}

int main() {
    int m, n;
    cin >> m >> n;
    cout << modpow(m, n) << endl;
    return 0;
}



Measured memory_bytes: 3120
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		List<Integer> cost = new ArrayList<>();
		List<Integer> input = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			input.add(sc.nextInt());
		}

		cost.add(0);
		for (int i = 1; i < n; i++) {
			List<Integer> temp = new ArrayList<>();
			for (int j = 1; j <= k; j++) {
				int num = i - j;
				if (num < 0) {
					break;
				}
				int costk = Math.abs(input.get(num) - input.get(i)) + cost.get(num);
				temp.add(costk);
			}
			cost.add(Collections.min(temp));
		}
		System.out.println(cost.get(n - 1));
	}
}


Measured memory_bytes: 155068
import sys

def gcd(a,b):
	a,b=max(a,b),min(a,b)
	while a%b:
		a,b=b,a%b
	return b
	
def lcm(a,b):
	return a//gcd(a,b)*b
	
for i in sys.stdin:
	a,b=map(int,i.split())
	print(gcd(a,b),lcm(a,b))

Measured memory_bytes: 7668
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

struct edge {
  ll to, cost;
};
typedef pair<ll, ll> P;

ll V;
vector<edge> G[MAX]; // 頂点iのedgeを格納
ll d[MAX];

void dijkstra(ll s){
    // greater<P>を指定することでfirstが小さい順に取り出せるようにする
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, LLINF);
    d[s] = 0;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;
        for(ll i=0; i<G[v].size(); i++){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                // 更新
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }

    // dがsからの各頂点への最短距離なので
    // rep(i, V){
    //     cout << d[i] << endl;;
    // }
}


int main(int argc, const char * argv[]) {
  std::cout << std::fixed << std::setprecision(15);

  int N; cin >> N;
  V = N;
  rep(i, N-1){
    int a, b, c; cin >> a >> b >> c;
    a--; b--;
    G[a].push_back({b, c});
    G[b].push_back({a, c});
  }

  int Q, K; cin >> Q >> K;
  K--;

  dijkstra(K);

  rep(i, Q){
    ll x, y; cin >> x >> y;
    x--; y--;
    ll ans = d[x] + d[y];
    cout << ans << endl;
  }
}  


Measured memory_bytes: 11392
#include<cstdio>
#define ll long long
using namespace std;
const int N=30;
int f[N][2][2],d[N];
int n,m,D;
ll ans;
void prework(int D){
	d[0]=0;
	while (D){
		d[++d[0]]=D%10;
		D/=10;
	}
}
ll solve(int n1){
	int n=n1/2,j1,k1,tmp,sum,mid;
	ll ret=0;
	for (int i=0;i<=n;++i)
		for (int j=0;j<2;++j)
			for (int k=0;k<2;++k)
				f[i][j][k]=0;
	f[0][0][0]=1;
	for (int i=0;i<n;++i){
		for (int j=0;j<2;++j)
			for (int k=0;k<2;++k){
				if (f[i][j][k]==0) continue;
				for (int num=0;num<=9;++num){
					sum=num+d[i+1]+k;
					tmp=sum%10; k1=sum/10;
					j1=(j*10+num)-(tmp+d[n1-i]);
					if (j1<0||j1>1) continue;
					if (!i&&(!num||!tmp)) continue;
					f[i+1][j1][k1]+=f[i][j][k];
				}
			}
	}
	if (n1%2==1){
		mid=(n1+1)/2;
		for (int j=0;j<2;++j)
			for (int k=0;k<2;++k){
				if (!f[n][j][k]) continue;
				for (int num=0;num<=9;++num){
					sum=num+d[mid]+k;
					if (sum%10==num&&sum/10==j)
						ret+=f[n][j][k];
				}
			}
	}
	else
		for (int j=0;j<2;++j)
			ret+=f[n][j][j];
	return ret;
}

int main(){
	scanf("%d",&D);
	prework(D);
	for (int i=d[0];i<=d[0]*2;++i)
		ans+=solve(i);
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
#define mod 1000000007
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
#define re reverse
int abs(int a,int b){
    return max(a,b)-min(a,b);
}
//最大公約数
int gcd(int a,int b){
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}

//最小公倍数
int lcm(int a,int b){
  return (a*b)/gcd(a,b);
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b[1000000];
    int c[100000];
    cin>>a;
    for(int i=0;i<a;i++) cin>>b[i];
    c[1]=abs(b[0],b[1]);
    for(int i=2;i<a;i++){
      if(abs(b[i-1],b[i])+c[i-1]<abs(b[i-2],b[i])+c[i-2]){
	c[i]=c[i-1]+abs(b[i-1],b[i]);
      }
      else{
	c[i]=c[i-2]+abs(b[i-2],b[i]);
      }
    }
    cout<<c[a-1]<<"\n";
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int a=60*h1+m1,b=max(60*h2+m2-k,a);
	cout<<b-a;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
  IOS;
  ll n,k;
  cin>>n>>k;
  ll ans=0;
  for(ll i=k+1;i<=n;i++){
    ans+=(i-k)*(n/i);
    ll r=n%i;
    if(r!=0 && r>=k){
      ans+=r-max((ll)0,k-1);
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
n,m = map(int,input().split())
l = [1]*n
a = 0
w = 0
for i in range(m):
  p,s = map(str,input().split())
  p = int(p)
  if l[p-1]>0:
    if s == "AC":
      w+=l[p-1]-1
      l[p-1] = 0
      a+=1
    else:
      l[p-1]+=1
print(a,w)

Measured memory_bytes: 3828
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    vector<ll> sums;
    vector<int> dcnt(64);
    for (int i = 1; i <= n; ++i) {
        for (int j = i; j <= n; ++j) {
            ll sum = a[j] - a[i - 1];
            sums.push_back(sum);
            for (int l = 0; l < 64; ++l) {
                dcnt[l] += sum >> l & 1;
            }
        }
    }

    ll ans = 0;
    for (int i = 63; i >= 0; --i) {
        if (dcnt[i] >= k) {
            ans |= 1LL << i;
            for (int j = 0; j < sums.size(); ++j) {
                if ((sums[j] >> i & 1) ^ 1) {
                    for (int l = 0; l < 64; ++l) {
                        dcnt[l] -= sums[j] >> l & 1;
                    }
                    sums[j] = 0;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

const int N = 2005;
vector<int> adj[N];

int dfs(int u, int p, int dep, int k) {
    if (dep > k)    return 0;
    int ans = 1;
    for (int v: adj[u])
        if (v != p)
            ans += dfs(v, u, dep+1, k);
    return ans;
}

int solve(int s, int k) {
    int a = k/2, b = k-k/2;

    int ans = 0, mx = 0;
    for (int v: adj[s]) {
        int x = dfs(v, s, 1, a);
        int y = dfs(v, s, 1, b);
        ans += x;
        mx = max(mx, y-x);
    }
    return 1+ans+mx;
}

int main() {
    int n, k;
    cin>>n>>k;

    for (int i=1; i<n; i++) {
        int u, v;
        cin>>u>>v;

        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int ans = 0;
    for (int i=1; i<=n; i++)    ans = max(ans, solve(i, k));
    cout<<n-ans<<endl;
}


Measured memory_bytes: 3716
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

N = int(input())
A = list(map(int, input().split()))
for i in A:
    if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
        print("DENIED")
        sys.exit()
print("APPROVED")


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

int main() {
    int N , X , i , count = 0 , n = 1;
    cin >> N >> X ;
    vector<int> bound(N,0);
    for(i = 0;i<N;i++){
        cin >> bound.at(i);
    }
    for(i = 0;i<N;i++){
        count += bound.at(i);
        if(count>X){break;}
        else if (count == X){
            n++; break;
        }
    else n++;
    }
    cout << n<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n, m;
    cin >> n;
    map<ll, ll> mp1, mp2;
    rep(i, n) {
        ll a;
        cin >> a;
        mp1[a]++;
    }
    cin >> m;
    rep(i, m) {
        ll a;
        cin >> a;
        mp2[a]++;
    }
    string yes = "YES", no = "NO";
    for(auto& p : mp2) {
        if(p.se > mp1[p.fi]) {
            cout << no << endl;
            return 0;
        }
    }
    cout <<  yes << endl;
    return 0;
}

Measured memory_bytes: 25216
s = list(input())

if s[0] == s[1] and s[2] == s[3] and s[1] != s[2]:
  print("Yes")
elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
  print("Yes")
elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1]:
  print("Yes")
else:
  print("No")

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

int main() {
  int ans = 0;
  vector<int>data(3);
  for(int i = 0;i < 3;i++) cin >> data[i];
  sort(data.begin(),data.end());
  if(data[0]%2 == data[1]%2 && data[0]%2 != data[2]%2){
    data[0]++;
    data[1]++;
    ans++;
  }
  else if(data[0]%2 == data[2]%2 && data[0]%2 != data[1]%2){
    data[0]++;
    data[2]++;
    ans++;
  }
  else if(data[1]%2 == data[2]%2 && data[0]%2 != data[1]%2){
    data[1]++;
    data[2]++;
    ans++;
  }
  ans += (data[2]-data[0])/2+(data[2]-data[1])/2;
  cout << ans << endl;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  val inputs = StdIn.readLine().split(" ")
  val stack = inputs.foldLeft(new Stack()){ (acc, elem) => acc.push(elem) }
  println(stack.pop)
}

class Stack(val elems: List[String]){
  def this() = this(Nil)

  def push: (String) => Stack = {
    case "+" =>
      val (x1, x2, xs) = pop2
      new Stack((x1 + x2).toString :: xs)
    case "-" =>
      val (x1, x2, xs) = pop2
      new Stack((x2 - x1).toString :: xs)
    case "*" =>
      val (x1, x2, xs) = pop2
      new Stack((x1 * x2).toString :: xs)
    case elem =>
      new Stack(elem :: elems)
  }

  def pop: String = elems.head

  def pop2: (Int, Int, List[String]) = {
    elems match {
      case x1 :: x2 :: xs =>
        (x1.toInt, x2.toInt, xs)
      case _ => (0, 0, elems)
    }
  }
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;

struct edge{ int to,cost; };
vector<edge> G[1000];

const int INF=123456789;

int dist[13][1000];
int D=0;

void dijkstra(int start)
{
    int *d = dist[D];
    fill(d,d+1000,INF);

    priority_queue<pi,vector<pi>,greater<pi>> que;
    d[start]=0;
    que.push(pi(0,start));
    while(!que.empty()){
        pi p=que.top();
        que.pop();
        int v=p.se;
        if(d[v]<p.fi) continue;
        rep(i,G[v].size())
        {
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost)
            {
                d[e.to]=d[v]+e.cost;
                que.push(pi(d[e.to],e.to));
            }
        }
    }

    ++D;
}

int k,p;
int s[6],t[6];

int dp[64][64][13];
int dfs(int S, int T, int now)
{
    if(dp[S][T][now]>=0) return dp[S][T][now];

    int M=(1<<k)-1;
    if(S==M && T==M) return 0;

    int ret=INF;

    rep(i,k)
    {
        if(!(S>>i&1)) ret = min(ret, dfs(S|(1<<i), T, i+1)+dist[now][s[i]]);
    }
    rep(i,k)
    {
        if((S>>i&1) && !(T>>i&1)) ret = min(ret, dfs(S, T|(1<<i), 1+k+i)+dist[now][t[i]]);
    }

    return dp[S][T][now]=ret;
}

int main()
{
    int n,m;
    scanf(" %d %d %d %d", &n, &m ,&k, &p);
    --p;

    rep(i,m)
    {
        int x,y,w;
        scanf(" %d %d %d", &x, &y, &w);
        --x;
        --y;
        G[x].pb(edge{y,w});
        G[y].pb(edge{x,w});
    }

    rep(i,k)
    {
        scanf(" %d %d", &s[i], &t[i]);
        --s[i];
        --t[i];
    }

    // 0:p, 1~k: s[0]~s[k-1], k+1~2k: t[0]~t[k-1]
    dijkstra(p);
    rep(i,k) dijkstra(s[i]);
    rep(i,k) dijkstra(t[i]);

    memset(dp,-1,sizeof(dp));
    int ans = dfs(0,0,0);

    if(ans==INF) printf("Cannot deliver\n");
    else printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 3584
program candy_piles
  implicit none
  integer :: n, a(100001) = 0, i, k, c = 0
  logical :: ok = .false.
  read(*,*) n
  read(*,*) a(1:n)
  call bitonic_sort(a(1:n),.false.)
  k = 1
  do while (k+1 <= a(k+1))
    k = k+1
  end do
  if (mod(a(k)+k,2) == 0) then
    do i = k+1, n
      if (a(i) == a(k+1)) c = c+1
    end do
    ok = a(k+1) >= k .and. mod(c,2) == 1
  else
    ok = k < a(k) .or. (k > 1 .and. mod(a(k-1)+k,2) == 0)
  end if
  if (ok) then
    write(*,'(a)') "First"
  else
    write(*,'(a)') "Second"
  end if
contains
  recursive subroutine bitonic_sort(a,ascend)
    integer, intent(inout) :: a(:)
    logical, intent(in) :: ascend
    integer :: n
    n = size(a)
    if (n == 1) return
    call bitonic_sort(a(1:n/2),.not.ascend)
    call bitonic_sort(a(n/2+1:n),ascend)
    call bitonic_merge(a,ascend)
  end
  recursive subroutine bitonic_merge(a,ascend)
    integer, intent(inout) :: a(:)
    logical, intent(in) :: ascend
    integer :: n, m, i, b
    n = size(a)
    if (n == 1) return
    m = 1
    do while (2*m < n)
      m = 2*m
    end do
    do i = 1, n-m
      if ((a(i) > a(i+m)) .eqv. ascend) then
        b = a(i)
        a(i) = a(i+m)
        a(i+m) = b
      end if
    end do
    call bitonic_merge(a(1:m),ascend)
    call bitonic_merge(a(m+1:n),ascend)
  end
end program candy_piles

Measured memory_bytes: 1152
#include <stdio.h>

int main(void) {
  int L, R;
  scanf("%d %d", &L, &R);

  int Lmod = L % 2019;
  int Rmod = R % 2019;
  //printf("Lmod=%d Rmod=%d\n", Lmod, Rmod);
  if(((R-L) >= 2019) || (Rmod <= Lmod)){
    printf("0\n");
    return 0;
  }

  int min = 2019;
  for(int i = Lmod; i <= (Rmod-1); i++) {
    for(int j = i+1; j <= Rmod; j++) {
      int tmp = (i * j) % 2019;
      min = (min < tmp) ? min : tmp;
    }
  }
  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}
////////////////////////////////////////////////////////////
signed main() {
  int n,x,y;
  cin>>n>>x>>y;
  vector<int>ans(n);
  for(int s=1;s<=n-1;s++){
    for(int e=s+1;e<=n;e++){
      int t=min(e-s,abs(s-x)+abs(e-y)+1);
      ans[t]++;
    }
  }
  for(int i=1;i<n;i++){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
#include<cstring>

const int MAXN = 200001;

int n,a[MAXN],box[MAXN];
long long ans;

int main() {
    std::cin >> n;
    for(int i = 1;i <= n;i++) {
        std::scanf("%d",a + i);
        box[a[i]]++;
    }
    for(int i = 1;i < MAXN;i++) ans += 1ll * box[i] * (box[i] - 1) / 2;
    for(int i = 1;i <= n;i++) {
        std::printf("%lld\n",ans - box[a[i]] + 1);
    }
    return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/12  Problem: ABC 084 B / Link: http://abc084.contest.atcoder.jp/tasks/abc084_b  ----- */


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

	LL A, B; cin >> A >> B;
	string s; cin >> s;

	LL ans = 1;
	FOR(i, 0, A) {
		ans &= isdigit(s[i]);
	}
	ans &= s[A] == '-';
	FOR(i, A + 1, SZ(s)) {
		ans &= isdigit(s[i]);
	}
	
	
	cout << (ans?"Yes":"No") << "\n";

	return 0;
}


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

int main(){
  
  int N, i;
  string S, T;
  
  cin >> N;
  cin >> S >> T;
  
  for (i = 0; i < N; i++){
    
    cout << S.at(i) << T.at(i);
  }
  cout <<  endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;
#define int long long
int n,m;
vector<int>p(1e5+3,2);
vector<int>error(1e5+3,0);
int32_t main() {
    cin >> n >> m;
    int ac =0;
    int e=0;
    for(int i= 0;i<m;++i){
        int t;
        string v;
        cin >> t >> v;
        t--;
        if(v=="WA") {
            if (p[t] == 2)
                error[t]++;
        } else{
            if( p[t]==2) {
                ac++;
                e += error[t];
            }
            p[t]=1;
        }
    }
    cout << ac << " " << e;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define RFOR(i,a,b) for(ll i=b-1;i>=a;i--)
#define rsort(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;

stack<ll> a;
int main(void){
    stack<int> s;
    int a,b;
    string n;
    while(cin>>n){
        if(isdigit(n[0]))
            s.push(atoi(n.c_str()));
        else{
            a=s.top();
            s.pop();
            b=s.top();
            s.pop();
            if(n[0]=='+')
                b+=a;
            else if(n[0]=='-')
                b-=a;
            else if(n[0]=='*')
                b*=a;
            s.push(b);
        }
    }
    cout<<s.top()<<endl;
    return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
//const ll p = 1e9 + 7;
//const ll p = 998244353;
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

vll dijkstra(ll n, vector<vector<vll>> &nx, ll start) {
	vll ret(n * 2501, inf);
	ret[start] = 0;
	queue<ll> task;
	task.push(start);
	priority_queue<vll, vector<vll>, greater<vll>> pq;
	while (task.size()) {
		while (task.size()) {
			ll x = task.front();
			task.pop();
			for (ll i = 0; i < nx[x].size(); i++) {
				vll v = nx[x][i];
				if (ret[v[1]] < inf) continue;
				pq.push({ret[x] + v[0], v[1]});
			}
		}
		while (pq.size() && ret[pq.top()[1]] < inf) pq.pop();
		if (pq.size()) {
			vll v = pq.top();
			pq.pop();
			ret[v[1]] = v[0];
			task.push(v[1]);
		}
	}
	return ret;
}

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

	ll n, m, s;
	cin >> n >> m >> s;
	s = min(s, 2500ll);

	//頂点aで銀貨b枚所持
	auto index = [&] (ll a, ll b) {return a + b * n;};

	vector<vector<vll>> nx(n * 2501, vector<vll>(0));
	for (ll i = 0; i < m; i++) {
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		for (ll j = a; j <= 2500; j++) {
			nx[index(u, j)].push_back({b, index(v, j - a)});
			nx[index(v, j)].push_back({b, index(u, j - a)});
		}
	}

	for (ll i = 0; i < n; i++) {
		ll c, d;
		cin >> c >> d;
		for (ll j = 0; j <= 2500 - c; j++) {
			nx[index(i, j)].push_back({d, index(i, j + c)});
		}
	}

	vll ans = dijkstra(n, nx, index(0, s));
	for (ll i = 1; i < n; i++) {
		ll x = inf;
		for (ll j = 0; j <= 2500; j++) {
			x = min(x, ans[index(i, j)]);
		}
		cout << x << endl;
	}
}


Measured memory_bytes: 57500
// Math = ♥️

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define sz(c) ((ll)c.size())
#define ordered_set                            \
    tree<ll, null_type, less<ll>, rb_tree_tag, \
         tree_order_statistics_node_update>

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

    ll h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    ll count = ((h2 - h1) * 60) + (m2 - m1);
    cout << count - k << "\n";
}


Measured memory_bytes: 3616
n = list(map(int, input().split()))
a = n[0]
b = n[1]
c = n[2]
d = n[3]
while True:
    c = c - b
    if c <= 0:
        print("Yes")
        break
    else:
        a = a - d
        if a <= 0:
            print("No")
            break

Measured memory_bytes: 9184
/**
 * ACB057-C-Digits in Multiplication
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		long N = parseLong(br.readLine());

		int min = String.valueOf(N).length();

		for (int i = 1; i <= Math.sqrt(N); i++) {
			if (N % i == 0) min = Math.min(min, String.valueOf(N / i).length());
		}

		System.out.println(min);
	}
}

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

#define ll long long

int main(){
    int n,k,sum=1;
    cin >> n >> k;
    for(int i=0; i<n; i++){
        if(sum<k){
            sum*=2;
        }else{
            sum+=k;
        }
    }
    cout << sum;
}

Measured memory_bytes: 3596