akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pii pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define traceloop(x,a) {for(ll i=0;i<x;i++) cerr<<a[i]<<" "; cerr<<endl;}
ll ab(ll x) {return x>0LL?x:-x;}

  

int comp(const void* a, const void* b)  
{ return *(int*)a > *(int*)b ; }  

//Code from GFG
//https://www.geeksforgeeks.org/find-number-of-triangles-possible/
int findNumberOfTriangles(int arr[], int n)  
{  
 
    qsort(arr, n, sizeof( arr[0] ), comp);  
  
    int count = 0;  
  
    // Fix the first element. We need to run till n-3  
    // as the other two elements are selected from  
    // arr[i+1...n-1]  
    for (int i = 0; i < n - 2; ++i)  
    {  
        // Initialize index of the rightmost third  
        // element  
        int k = i + 2;  
  
        // Fix the second element  
        for (int j = i + 1; j < n; ++j)  
        {  
            // Find the rightmost element which is  
            // smaller than the sum of two fixed elements  
            // The important thing to note here is, we  
            // use the previous value of k. If value of  
            // arr[i] + arr[j-1] was greater than arr[k],  
            // then arr[i] + arr[j] must be greater than k,  
            // because the array is sorted.  
            while (k < n && arr[i] + arr[j] > arr[k])  
            ++k;   
            if(k > j)  
            count += k - j - 1;  
        }  
    }  
  
    return count;  
}  
  
// Driver code  
int main()  
{   
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
  
    cout<<findNumberOfTriangles(a,n);  
  
    return 0;  
}  


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

int solve(){
  int k, x; cin >> k >> x;
  cout << (k*500 >= x ? "Yes" : "No") << endl;
  return 0;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int L = sc.next().length();
    int mod = 1_000_000_007;
    long[][] dp = new long[N+1][N+1];
    
    dp[0][0] = 1;
    for (int i=0;i<N;i++){
      for (int j=0;j<N;j++){
        dp[i+1][j+1] += 2*dp[i][j];
        dp[i+1][j+1] %= mod;
        //dakensinai
        dp[i+1][Math.max(0,j-1)] += dp[i][j];
        dp[i+1][Math.max(0,j-1)] %= mod;
      }
    }
    long ret = dp[N][L];
    for(int i=0;i<L;i++){
      ret = (ret*(mod+1)/2) %mod;
    }
    System.out.println(ret);
  }
}

Measured memory_bytes: 243536
#include <stdio.h>

int main(){
	int h1, m1, h2, m2, k;
	scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
	int hour = (h2 - h1) * 60;
	int minute = m2 - m1;
	int time = (hour + minute) - k;
	printf("%d", time);
	return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define ll              long long 
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define Mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define gcd(m,n)        __gcd(m,n)   
#define matrixprint(arr,a,b,c,d) for(int i=a;i<=c;i++){for(int j=b;j<=d;j++){cout<<arr[i][j]<<" ";}cout<<"\n";}


template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {
  }
};


#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define deb(...)
#endif

void fast()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
}
 
//////////////////////////////code//////////////////////////////

int32_t main()
{
  fast();
  
  int n;
  cin>>n;
  
  map<string,int>m;
  for(int i=0;i<n;i++)
  {
  	string s;
  	cin>>s;
  	m[s]++;
  }
 cout<<m.size();
}

Measured memory_bytes: 19204
package main

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

func main() {
	x := ReadInt()
	if x == 0 {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();

		boolean[] flags = new boolean[8];
		int free = 0;
		for(int i=0;i<n;i++){
			int a = scn.nextInt();
			int code = colorCode(a);
			if(code == 8){
				free++;
			}else{
				flags[code] = true;
			}
		}

		int c = 0;
		for(int i=0;i<flags.length;i++){
			if(flags[i]){
				c++;
			}
		}

		int min = 0;
		if(n == free){
			min = 1;
		}else{
			min = c;
		}

		int max = c + free;

		System.out.println(min + " " + max);
	}

	private static int colorCode(int n){
		int[] rate = {1,400,800,1200,1600,2000,2400,2800,3200};
		int i;
		for(i=0;i<rate.length;i++){
			if(rate[i] <= n){
				continue;
			}else{
				break;
			}
		}
		return i-1;
	}
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define Endl endl
#define mod  1000000007
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
#define maxi 500111

ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
ll intpoint(ll x1, ll y1, ll x2, ll y2) { return ( __gcd(abs(x1-x2),abs(y1-y2))+1); }
bool isvalid(ll x,ll y,ll n,ll m) { return (x>=0&&x<n&&y>=0&&y<m); }
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int pp = uniform_int_distribution<int>(0, kk-1)(rng);
// ---------------------///////////////---------------------------------
// ---------------------///////////////----------------------------------
// -------------/////////////////---------------------------------///////

struct gg{
  ll first;
  ll second;
};

gg dp[3011][3011];


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

    ll n;

    cin>>n;

    ll ap[n+11];

    for(ll i=0;i<n;i++){
      cin>>ap[i];
    }

    for(ll i=0;i<n;i++){
      dp[i][i].first = ap[i];
      dp[i][i].second = 0;
    }

    for(ll i=1;i<n;i++){
      for(ll j = i-1;j>=0;j--){
        ll sum = dp[j][i-1].first + dp[j][i-1].second + ap[i];
        dp[j][i].first = max(dp[j][i-1].second + ap[i],dp[j+1][i].second + ap[j]);
        dp[j][i].second = sum - dp[j][i].first;
      }
    }

    for(ll i=0;i<n;i++){
      for(ll j=0;j<n;j++){
        // cout<<dp[i][j].first<<" "<<dp[i][j].second<<" ";
      }
      // cout<<"\n";
    }

    cout<<(dp[0][n-1].first-dp[0][n-1].second);

    return 0;
}

Measured memory_bytes: 141568
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        n: usize,
        x: usize,
        t: usize,
    }
    println!("{}", t * ((n + x - 1) / x));
}


Measured memory_bytes: 2140
#include <stdio.h>

int main(void){
    int m,d;
    int day;
    
    for(;;){
        scanf("%d %d",&m,&d);
        if(m==0) break;
        if(m==3||m==11) day=1;
        else if(m==6) day=2;
        else if(m==9||m==12) day=3;
        else if(m==1||m==4||m==7) day=4;
        else if(m==10) day=5;
        else if(m==5) day=6;
        else day=7;
        
        if(d%7-1+day==0) day+=6;
        else if(d%7-1+day>7) day=day+(d%7-1)-7;
        else day+=d%7-1;
        
        if(day==1) printf("Monday\n");
        else if(day==2) printf("Tuesday\n");
        else if(day==3) printf("Wednesday\n");
        else if(day==4) printf("Thursday\n");
        else if(day==5) printf("Friday\n");
        else if(day==6) printf("Saturday\n");
        else printf("Sunday\n");
    }
    
    return 0;
}


Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
int n,l;
string s[1035];
int main()
{
	cin>>n>>l;
	    for(int i=1;i<=n;i++)
	    {
	    	cin>>s[i];
		}
		sort(s+1,s+n+1);
		for(int i=1;i<=n;i++)
		{
			cout<<s[i];
		}
		
    return 0;
}

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

int main() {
    int a,b;
	scanf("%d%d",&a,&b);
	if(a<b){
		for(int i=0;i<b;i++)printf("%d",a);
	}else{
		for(int i=0;i<a;i++)printf("%d",b);
	}
}

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

  int in;
  while(cin >> in,in){
    int co=0;
    for(int i=1;i<=in;i++){
      int tmp=i;
      while(tmp%5==0){
	co++;
	tmp/=5;
      }
    }
    cout << co << endl;
  }
}

Measured memory_bytes: 1160
s=input()
l=len(s)
ans=int(s)
for i in range(1,2**(l-1)):
  f=format(i,'b')
  if len(f)<l:
    f='0'*(l-1-len(f))+f
  pos=[]
  for j in range(len(f)):
    if f[j]=='1':
      pos.append(j+1)
  n=[]
  if len(pos)==1:
    n.append(int(''.join(map(str,s[:pos[0]]))))
    n.append(int(''.join(map(str,s[pos[0]:]))))
  else:
    n.append(int(''.join(map(str,s[:pos[0]]))))
    for j in range(1,len(pos)):
      n.append(int(''.join(map(str,s[pos[j-1]:pos[j]]))))
    n.append(int(''.join(map(str,s[pos[len(pos)-1]:]))))
  ans+=sum(n)
print(ans)

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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        double W = double.Parse(input[0]);
        double H = double.Parse(input[1]);
        double x = double.Parse(input[2]);
        double y = double.Parse(input[3]);
        if (x==W/2&&y==H/2) { Console.WriteLine((W * H / 2).ToString("F") + " " + 1); }
        else { Console.WriteLine((W * H / 2).ToString("F") + " " + 0); }
    }
}


Measured memory_bytes: 11220
#include<iostream>
#include<string>
using namespace std;
int main(){
	string str,o;
	int ans=0,m,a;
	for(;;){
		cin>>str;
		if(str=="-"){
			break;
		}
		o=str;
		cin>>m;
		str+=str;
		for(int i=0;i<m;i++){
			cin>>a;
			ans+=a;
		}
		ans=ans%o.size();
		for(int i=ans;i<(o.size()+ans);i++){
			cout<<str[i];
		}
		cout<<endl;
		ans=0;
	}
	return 0;
}


Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();
		
		double dis = Math.sqrt(Math.pow(Math.abs(x1-x2), 2) + Math.pow(Math.abs(y1-y2), 2));
		System.out.println(dis);
	}
}

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

unsigned GetDigit(unsigned num)
{
    unsigned digit = 0;
    while (num != 0)
    {
        num /= 10;
        digit++;
    }
    return digit;
}

int main()
{
    ll n;
    cin >> n;
    ll rn = sqrt(n);
    ll yaku = 1;
    for (ll i = rn; rn > 0; i--)
    {
        if (n % i == 0)
        {
            yaku = i;
            break;
        }
    }
    cout << GetDigit(n / yaku) << endl;
}

Measured memory_bytes: 256
a_card = list(input())
b_card = list(input())
c_card = list(input())

turn = 'a'
while True:
    if turn == 'a':
        if len(a_card) == 0:
            print('A')
            exit()
        turn = a_card.pop(0)

    elif turn == 'b':
        if len(b_card) == 0:
            print('B')
            exit()
        turn = b_card.pop(0)

    else:
        if len(c_card) == 0:
            print('C')
            exit()
        turn = c_card.pop(0)


Measured memory_bytes: 3064
def main():
    n, x = map(int, input().split())
    A = list(map(int, input().split()))

    A_sorted = sorted(A)

    res = 0

    for kids in A_sorted:
        x = x - kids
        
        if x >= 0:
            res += 1
    
    if x > 0:
        print(res - 1)
    else:
        print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int n,k,s;
    
    cin >> n >> k >> s;
    
    if (s == 1){
        for (int i = 0;i < k;i++){
            putchar('1');
            printf(" ");
        }
        for (int i = 0;i < n-k;i++){
            putchar('2');
            printf(" ");
        }
        printf("\n");
    }
    
    else if (s == 2){
        for (int i = 0;i < k;i++){
            putchar('2');
            printf(" ");
        }
        for (int i = 0;i < n-k;i++){
            putchar('4');
            printf(" ");
        }
        printf("\n");
    }
    
    else {
        for (int i = 0;i < k;i++){
            printf("%d ",s);
        }
        for (int i = 0;i < n-k;i++){
            printf("%d ",s-1);
        }
        printf("\n");
    }
}


Measured memory_bytes: 1280
#include <iostream>
#define ll long long
using namespace std;

int main() {
	ll int n;
	cin>>n;
	int a[n][3];
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++)cin>>a[i][j];
	}
	ll int dp[n][3];
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(int i=1;i<n;i++){
		dp[i][0]=max(dp[i-1][1]+a[i][0],dp[i-1][2]+a[i][0]);
		dp[i][1]=max(dp[i-1][0]+a[i][1],dp[i-1][2]+a[i][1]);
		dp[i][2]=max(dp[i-1][0]+a[i][2],dp[i-1][1]+a[i][2]);
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ll n;cin>>n;
    ll dp[n];
    dp[n-1]=n;
    ll sum=n;
    rrep(i,n-2,0){
        ll t=sum;
        if(i<n-2)(t=t-dp[i+2]+mod)%=mod;
        dp[i]=t;
        ll zan=i+2;
        if(i==n-2)zan=i+1;
        (dp[i]+=zan)%=mod;
        ll u=(n-1)*(n-1);
        u%=mod;
        dp[i]+=u;
        dp[i]%=mod;
        sum+=dp[i];
        sum%=mod;
        
    }
    cout<<dp[0]<<endl;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }

vector<int> di = {0, 1, 0, -1};
vector<int> dj = {1, 0, -1, 0};

int H,W;

struct Point {
  int i; int j;
  Point(int y,int x) : i(y), j(x) {}
};

bool notin(int i, int j){
  if (i < 0 || i >= H || j < 0 || j >= W) return true;
  return false;
}

int main() {
  cin >>H >>W;
  vector<string> field(H);
  rep(i, H) cin >>field[i];
  int res = 0;
  vector<vector<int>> steps(H, vector<int>(W, 999999));
  vector<vector<bool>> seen(H, vector<bool>(W, false));
  rep(i, H) rep(j, W) if (field[i][j] == '#') steps[i][j] = 0, seen[i][j] = true;
  
  queue<Point> que;
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      if (field[i][j] == '#') continue;
      bool quein = false; // 白色マスのうち1個でも黒色マスに隣接しているものを突っ込む
      for (int k=0; k<di.size(); k++){
        int ni = i + di[k];
        int nj = j + dj[k];
        if (notin(ni,nj)) continue;
        if (field[ni][nj] == '#') quein = true;
      }
      if (quein) que.push(Point(i,j)), seen[i][j] = true;
    }
  }

  while (!que.empty()){
    Point v = que.front(); que.pop();
    field[v.i][v.j] = '#';
    for (int k=0; k<di.size(); k++){
      int ni = v.i + di[k];
      int nj = v.j + dj[k];
      if (notin(ni,nj)) continue;
      chmin(steps[v.i][v.j], steps[ni][nj] + 1); // stepsの更新は黒ますになってから行う
      if (seen[ni][nj]) continue; // 隣接のうち黒ますや既にチェックした城ますならqueに突っ込まない
      seen[ni][nj] = true;
      que.push(Point(ni, nj));
    }
  }

  rep(i, H) rep(j, W) chmax(res, steps[i][j]);

  cout <<res <<endl;
  
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll=long long;

int main(){
    string a,b,c,now="a";
    int i=0,j=0,k=0,la,lb,lc;
    cin>>a>>b>>c;
    la=a.length();
    lb=b.length();
    lc=c.length();
    while(1){
        if(now=="a"){
            if(i==la){
                cout<<"A";
                return 0;
            }else{
                now=a[i];
                i++;
            }
        }else if(now=="b"){
            if(j==lb){
                cout<<"B";
                return 0;
            }else{
                now=b[j];
                j++;
            }
        }else{
            if(k==lc){
                cout<<"C";
                return 0;
            }else{
                now=c[k];
                k++;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
A, B, K = [int(_) for _ in input().split()]

a_divisors = set()
b_divisors = set()

for i in range(1, 101):
    if A % i == 0: a_divisors.add(i)
    if B % i == 0: b_divisors.add(i)

common_divisors = a_divisors & b_divisors

print(sorted(list(common_divisors))[-K])


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

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; }

using ll = long long;
using P = pair<int,int>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    ll N,K;
    cin>>N>>K;
    vector<ll> P(N),C(N);
    rep(i,N) cin>>P[i];
  	rep(i,N) P[i]--;
    rep(i,N) cin>>C[i];
    vector<vector<ll>> g;
    vector<bool> seen(N,false);
    rep(i,N){
        if(seen[i])continue;
        seen[i] = true;
        vector<ll> cy;
        cy.push_back(i);
        int t = i;
        while(P[t]!=i){
            t = P[t];
            seen[t] = true;
            cy.push_back(t);
        }
        g.push_back(cy);
    }
    vector<vector<ll>> point;
    for(auto x:g){
        vector<ll> P(x.size());
        rep(i,x.size()) P[i] = C[x[i]];
        point.push_back(P);
    }
    for(auto &x:point){
        rep(i,x.size()-1) x[i+1]+=x[i]; 
    }
    ll ans = -INF;
    for(auto x:point){
        ll l = x.size();
        ll cnt = 0;
        if(x[l-1]>=0&&K>=l){
            cnt += x[l-1]*(K/l);
            ll rest = K % l;
            ll pl = 0;
            if(rest!=0){
                for(int j = 1; j <= rest; j++){
                    rep(i,l){
                        if(i == 0) chmax(pl,x[j-1]);
                        else if(i+j-1<=l-1) chmax(pl,x[i+j-1]-x[i-1]);
                        else{
                            chmax(pl,x[l-1]-x[i-1]+x[(i+j-1)-l]);
                        }
                    }
                }
            }
            cnt += pl;
            chmax(ans,cnt);
            cnt-=x[l-1]+pl;
            pl=0LL;
            for(int j = 1; j < l; j++){
                    rep(i,l){
                        if(i == 0) chmax(pl,x[j-1]);
                        else if(i+j-1<=l-1) chmax(pl,x[i+j-1]-x[i-1]);
                        else{
                            chmax(pl,x[l-1]-x[i-1]+x[(i+j-1)-l]);
                        }
                    }
            }
            chmax(ans,cnt+pl);
        }
        else{
            ll pl = -INF;
            for(int j = 1; j <= min(K,l-1); j++){
                rep(i,l){
                        if(i == 0) chmax(pl,x[j-1]);
                        else if(i+j-1<=l-1) chmax(pl,x[i+j-1]-x[i-1]);
                        else{
                            chmax(pl,x[l-1]-x[i-1]+x[(i+j-1)-l]);
                        }
                 }
            }
            chmax(ans,pl);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3864
//
//  main.cpp
//  Good Integer
//
//  Created by wenhan on 2017/11/18.
//  Copyright © 2017年 wenhan. All rights reserved.
//

#include <iostream>
#include <set>
using namespace std;
int main() {
    int t;
    cin>>t;
    set<int>q;
    if((t/1000==t%100/10&&t/1000==t/100%10)||(t%1000/100==t%100/10&&t%1000/100==t%10))
        printf("Yes\n");
    else
        printf("No\n");
    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_161_ABCSwap
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            List<long> inputLongList = new List<long>();
            inputLongList.AddRange(inputLongArray);
            inputLongList.Insert(0, inputLongList[2]);
            inputLongList.RemoveAt(3);

            string result = string.Join(" ",inputLongList);

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28360
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  ll n,u;
  cin >> n >> u;
  vector<ll> k(n,0);
  rep(i,n)cin >> k[i];
  rep(i,u){
    ll cn=0;
    rep(j,n)cn+=k[j];
    if(cn==n*n){
      rep(j,n-1)cout << n << " ";
      cout << n << endl;
      return 0;
    }
    vector<ll> u(n,0);
    rep(j,n){
      u[max(0,j-(int)k[j])]++;
      if(j+k[j]+1<n)u[j+k[j]+1]--;
    }
    //rep(j,n)cout << u[j] << endl;
    rep(j,n-1){
      u[j+1]+=u[j];
    }
    rep(j,n)k[j]=u[j];
  }
  rep(i,n-1){
    cout << k[i] << " ";
  }
  cout << k[n-1] << endl;
}   


Measured memory_bytes: 6428
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 in = new Scanner(System.in);
		int n = in.nextInt();
		List<String> city = new ArrayList<>();
		List<String> city_sorted = new ArrayList<>();
		for(int i=0;i<n;i++) {
			String s = in.next();
			int p = 100 - in.nextInt();
			if(p<10) {
				city.add(s + "00" + p);
				city_sorted.add(s + "00" + p);
			}
			else if(p<100) {
				city.add(s + "0" + p);
				city_sorted.add(s + "0" + p);
			}
			else {
				city.add(s + p);
				city_sorted.add(s + p);
			}
			
		}
		Collections.sort(city_sorted);
		for(int i=0;i<n;i++) {
			String s = city_sorted.get(i);
			for(int j=0;j<n;j++) {
				if(s.equals(city.get(j))) {
					System.out.println(j+1);
					break;
				}
			}
		}
		in.close();
	}

}


Measured memory_bytes: 21588
N = int(input())
if N < 105:
    print(0)
    exit()
ans = 1
for i in range(107,N+1,2):
    t = 0
    for j in range(1,i+1):
        if i % j == 0:
            t += 1
    if t == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3060
N = input()

Min = 1000
Base=753

for x in range(len(N)-2):
    d = int(N[x:x+3])
    sa = d - Base
    if sa >= 0 and sa < Min:
        Min = sa
    elif sa < 0 and sa*(-1) < Min:
        Min = -1*sa

print(Min)




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

using namespace std;

int main(){
  int a, b;
  string s;
  cin >> a >> b >> s;
  bool e = false;
  for(int i = 0;i < a+b+1;i++){
    if(i < a || a < i ){
      if(s[i] == '-'){
        e = true;
        break;
      }
    } else {
      if (s[i] != '-'){
        e = true;
        break;
      }
    }
  }
  cout << ((e)?"No":"Yes") << endl;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;

const int maxN = 1e5 + 10;
ll a[maxN];
int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    int l = 0;
    int r = n;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        bool ok = true;
        ll cur = a[mid];
        for (int j = 1; j <= n; j++) {
            if (j == mid) continue;
            if (a[j] > 2 * cur) {
                ok = false;
                break;
            }
            cur = min(a[n], cur + a[j]);
        }
        if (ok) r = mid;
        else l = mid;
    }
    cout << n - r + 1;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int64_t solve(int64_t n, int64_t d) {
  d = d * 2 + 1;
  return (n + d - 1) / d;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  int64_t d;
  std::cin >> d;
  auto const res = solve(n, d);
  std::cout << res << std::endl;
  return 0;
}


Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=100+10;

vector<int> c;

int main() {
    int n=read(),x=read();
    if (x==1||x==2*n-1) puts("No"); 
    else { puts("Yes");
        if (n==2) printf("1\n2\n3\n");
        else if (x==2) {
            for (re int i=5;i<=2*n-1;++i) c.push_back(i);
            int p=0;
            for (re int i=1;i<=n-2;++i) printf("%d\n",c[p++]);
            printf("3\n2\n1\n4\n");
            for (re int i=n+3;i<=2*n-1;++i) printf("%d\n",c[p++]);
        } else {
            for (re int i=1;i<=x-3;++i) c.push_back(i);
            for (re int i=x+2;i<=2*n-1;++i) c.push_back(i);
            int p=0;
            for (re int i=1;i<=n-2;++i) printf("%d\n",c[p++]);
            printf("%d\n%d\n%d\n%d\n",x-1,x,x+1,x-2);
            for (re int i=n+3;i<=2*n-1;++i) printf("%d\n",c[p++]);
        }
    }
    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		int n;
		cin >> n;
		if ( cin.eof() )
			break;

		long long f = 1;
		for ( int i = 2; i <= n; i++ )
		{
			f *= i;
		}

		cout << f << endl;
	}

}

Measured memory_bytes: 0
INF = 10 ** 9 + 7

n, m = gets.chomp.split.map(&:to_i)
if n == 1
  puts "1"
  exit
end

a = Array.new(m) { gets.to_i }
dp = Array.new(n + 1, 0)
dp[0] = 1
cur = 0
if a[cur] == 1
  cur += 1
  dp[1] = 0
else
  dp[1] = 1
end

2.step(n) do |i|
  if a[cur] == i
    dp[i] = 0
    cur += 1
  else
    dp[i] = (dp[i - 2] + dp[i - 1]) % INF
  end
end
puts dp[n]

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define inf 1000000000007;
typedef long long ll;
int main(){
	fast;
	int arr[3][3],n; bool dp[3][3]={0};
	for(auto i=0;i<3;++i){
		for(auto j=0;j<3;++j){
			cin>>arr[i][j];
		}
	}
	cin>>n;
	for(auto i=0;i<n;++i){
		int tmp; cin>>tmp; 
		for(auto i=0;i<3;++i){
			for(auto j=0;j<3;++j){
				if(tmp==arr[i][j]&&dp[i][j]==0){dp[i][j]=1; break;}
			}
		}
	}
	for(auto i=0;i<3;++i){
		if(dp[i][0]&&dp[i][1]&&dp[i][2]){
			cout<<"Yes\n"; exit(0);
		}
	}
	for(auto i=0;i<3;++i){
		if(dp[0][i]&&dp[1][i]&&dp[2][i]){
			cout<<"Yes\n"; exit(0);
		}
	}
	if(dp[0][0]&&dp[1][1]&&dp[2][2]){
		cout<<"Yes\n"; exit(0);
	}
	if(dp[0][2]&&dp[1][1]&&dp[2][0]){
		cout<<"Yes\n"; exit(0);
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
def counter():#島の数をカウントする
    count=0
    #12*12個の値をひとつずつ調べる
    for x in range(len(is_data)):
        for y in range(len(is_data)):
            if is_data[x][y] == '1':#島が発見されたら
                dfs(x,y)
                count+=1
    return count
def dfs(x,y):
    if x<0 or x == len(is_data) or y<0 or y == len(is_data):
        return
    if is_data[x][y] == '1':
        is_data[x][y] = '0'
        dfs(x+1,y)
        dfs(x,y+1)
        dfs(x-1,y)
        dfs(x,y-1)

is_data=[]
while True:
    try:
        s = list(input())#入力
        if not s:#空入力のとき
            print(counter())
            is_data=[]
            s = []
        else:
            is_data.append(s)
    except EOFError:
        print(counter())
        break


Measured memory_bytes: 5576
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> tri;

int n,m;
vector<tri> g[10100];

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  while(cin >> n >> m, n){
    rep(i,n)g[i].clear();
    rep(i,m){
      int u,v,d,c;
      cin >> u >> v >> d >> c;
      u--; v--;
      g[u].push_back(tri(pii(d,c),v));
      g[v].push_back(tri(pii(d,c),u));
    }

    vector<int> dis(n,1e9), cost(n,1e9);
    dis[0] = 0; cost[0] = 0;
    priority_queue<pii, vector<pii>, greater<pii> > q;
    q.push(pii(0,0));

    while(q.size()){
      pii p = q.top(); q.pop();
      int d = p.fs, v = p.sc;

      if(dis[v]<d)continue;
      
      for(tri nxt : g[v]){
	int nd = d + nxt.fs.fs, nc = nxt.fs.sc, u = nxt.sc;
	if(dis[u] > nd){
	  dis[u] = nd;
	  cost[u] = nc;
	  q.push(pii(nd,u));
	}else if(dis[u] == nd && cost[u] > nc){
	  cost[u] = nc;
	}
      }
    }
    cout << accumulate(cost.begin(),cost.end(),0) << endl;
  }
}

Measured memory_bytes: 3292
N = int(input())
Alist = list(map(int, input().split()))
dp = [[0, 0] for i in range(N+1)]
dp[0][1] = -(3*10**9)
for i in range(1, N+1):
    Ai = Alist[i-1]
    dp[i][0] = max(dp[i-1][0]+Ai, dp[i-1][1]-Ai)
    dp[i][1] = max(dp[i-1][0]-Ai, dp[i-1][1]+Ai)
print(dp[N][0])


Measured memory_bytes: 25572
#include<iostream>
using namespace std;
const long long M=123,D=1e9+7;
long long n,c[M],A=1;
string s;
int main()
{
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
		c[s[i]]++;
	for(int i=0;i<M;i++)
		(A*=c[i]+1)%=D;
	cout<<(A-1+D)%D;
	return 0;
}

Measured memory_bytes: 512
x, y  = gets.split.map(&:to_i)
_i, _j, _k = -1, -1, -1

(0..x).each{ |i| (0..x-i).each{ |j| 
    _i, _j, _k = i, j, x-i-j if y == 10000*i + 5000*j + 1000*(x-i-j)
}}
puts "#{_i} #{_j} #{_k}"

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

using namespace std;

int main(){
  int N; cin>>N;
  vector<int> p(N);
  int index=0;
  for(int i=0;i<N;i++){
    cin>>p[i];
    index=(p[index]>p[i]?index:i);
  }
   
  int sum=0;
  for(int i=0;i<N;i++){
    if(i==index){
      sum+=p[i]/2;
    }
    else sum+=p[i];
  }

  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	int d = n;
	if(n>=10)
		d = n % 10;
	
	if(d == 2||d==4||d==5||d==7||d==9)
		cout << "hon" << endl;
	else if(d==0||d==1||d==6||d==8)
		cout << "pon" << endl;
	else if (d==3)
		cout << "bon" << endl; 
	
	return 0;
 } 

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll N, ans;
    scanf("%lld", &N);
    vector<ll> d(N);
    ans = 0;
    REP(int, i, 0, N) scanf("%lld", &d.at(i));
    REP(int, i, 0, N-1){
        REP(int, j, i+1, N){
            ans += d.at(i) * d.at(j);
        }
    }
    printf("%lld\n", ans);
    return 0;
}

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

#define int long long
#define pb push_back
#define ff first
#define ss second

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    char c;
    cin>>c;
    
    if(c>='A' && c<='Z')
        cout<<"A";
    else
        cout<<"a";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int n;
  cin>>n;
  vector<string>s(n);
  for(int i=0;i<n;i++){
    cin>>s[i];
  }
  map<char,int>ans;
  for(int j=0;j<s[0].size();j++){
    ans[s[0][j]]++;
  }

  for(int i=0;i<n;i++){
    map<char,int>k;
    for(int j=0;j<s[i].size();j++){
      k[s[i][j]]++;
    }
    for(auto j='a';j<='z';j++){
      ans[j]=min(ans[j],k[j]);
    }
  }
  string p;
  for(auto c:ans){
    int v=c.second;
    for(int i=0;i<v;i++){
      p.push_back(c.first);
    }
  }
  sort(p.begin(),p.end());
  cout<<p<<endl;
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define veci(x,n) vector<int> x((int) (n))
#define vecs(x,n) vector<string> x((int) (n))
#define vecbf(x,n) vector<bool> x((int) (n), false)

int main(){
  int h,w;
  cin >> h >> w;
  vecs(data,h);
  rep(i,h) {
    cin >> data.at(i);
    //cout << data.at(i);
  }
  
  vecbf(x,h);
  vecbf(y,w);
  
  rep(i,h){
    rep(j,w){
      if(data.at(i).at(j) == '#'){
        x.at(i) = true;
        y.at(j) = true;
      }
    }
  }
  
  rep(i,h){
    if(x.at(i)){
      rep(j,w){
        if(y.at(j)){
          cout << data.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		String[] inputs = reader.readLine().split(" ");
		int n = Integer.parseInt(inputs[0]);
		int k = Integer.parseInt(inputs[1]);
		
		int[] weights = new int[n];
		int capacity = 0;
		for (int i = 0; i < n; i++) {
			int weight = Integer.parseInt(reader.readLine());
			weights[i] = weight;
			capacity += weight;
		}

		capacity /= k;
		while (true) {
			boolean canAllocate = checkAllocation(weights, k, capacity);
			if (canAllocate) {
				break;
			}
			capacity++;			
		}		
		System.out.println(capacity);		
	}

	private static boolean checkAllocation(int[] weights, int k, int capacity) {
		
		int num = 1;
		int current = 0;

		for (int i = 0; i < weights.length; i++) {
			int weight = weights[i];
			if (current + weight > capacity) {
				current = weight;
				num++;
				
				if (num > k || current > capacity) {
					return false;
				}
			} else {
				current += weight;
			}
		}
		return true;
	}
}



Measured memory_bytes: 35300
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main(){
 int n;
 cin>> n;
 vector<int> A(n) ;
 rep(i,n) cin>> A[i] ;
 int ans=0 ;
 int k= 0;
 rep(i,n-1){
   
   if(A[i]!=A[i+1]){
     ans+= (k+1)/2 ;
     k=0 ;
   }
  else if(i==n-2){
    ans+= (k+2)/2 ;
   }
   else
   k++ ;
 }
   cout<<ans<<endl; 
    return 0;
}

Measured memory_bytes: 256
// 解説を参照
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int[] ans = new int[n];
        for (int i = 1; i < n; i++) {
            for (int j = i+1; j <= n; j++) {
                int a = Math.abs(j - i);
                int b = Math.abs(x - i) + Math.abs(j - y) + 1;
                int c = Math.abs(y - i) + Math.abs(j - x) + 1;  // ここの計算がよくわかんない

                int min = Math.min(Math.min(a, b), c);
                ans[min]++;
            }
        }

        for (int i = 1; i < n; i++) {
            System.out.println(ans[i]);
        }
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 22100
#include <iostream>

using namespace std;

void solve()
{
	int A, B;
	cin >> A >> B;
	if (A + B >= 10)
	{
		cout << "error" << endl;
	}
	else
	{
		cout << A + B << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    while( true ){

        int m, t, p, r;
        cin >> m >> t >> p >> r;
        if(m == 0 && t == 0 && p == 0 && r == 0)
            break;

        vector<int> correct(t, 0);
        vector<int> time(t, 0);
        vector<vector<int>> incorrect(t, vector<int>(p, 0));

        for(int i = 0; i < r; i++){

            int mi, ti, pi, ji;
            cin >> mi >> ti >> pi >> ji;

            if(ji == 0){
                correct[ti - 1] += 1;
                time[ti - 1] += incorrect[ti - 1][pi - 1] * 20 + mi;
            } else {
                incorrect[ti - 1][pi - 1]++;
            }

        }

        vector<vector<int>> bucket(p + 1, vector<int>(0));

        for(int i = 0; i < t; i++)
            bucket[correct[i]].push_back(i);
/*
        for(auto &x : bucket){
            for(auto &z : x)
                cout << z << ' ';
            cout << endl;
        }
*/
        int count = 0;
        for(int i = bucket.size() - 1; i >= 0; i--) {
            if(bucket[i].size() == 1)
                cout << bucket[i][0] + 1 << ( ++count != t ? "," : "");
            if(bucket[i].size() > 1){
                vector<pair<int, int>> p(bucket[i].size());
                for(int j = 0; j < bucket[i].size(); j++){
                    p[j] = make_pair(time[bucket[i][j]], bucket[i][j]);
                }
                sort(p.begin(), p.end());
                stack<int> st;
                for(int j = 0; j < bucket[i].size(); j++){
                    if(j != bucket[i].size() - 1){
                        if(p[j].first == p[j+1].first) {
                            st.push(p[j].second);
                        } else {
                            if (!st.empty()) {
                                st.push(p[j].second);
                                while(!st.empty()) {
                                    cout << st.top() + 1 << ( ++count != t ? (st.size() != 1 ? "=" : ",") : "");
                                    st.pop();
                                }
                            } else
                                cout << p[j].second + 1 << ( ++count != t ? "," : "");
                        }
                    } else {
                        if (!st.empty()) {
                            st.push(p[j].second);
                            while(!st.empty()) {
                                cout << st.top() + 1 << ( ++count != t ? (st.size() != 1 ? "=" : ",") : "");
                                st.pop();
                            }
                        } else
                            cout << p[j].second + 1 << ( ++count != t ? "," : "");
                    }
                }
            }
        }
        cout << endl;

    }

    return 0;

}


Measured memory_bytes: 3144
n,m=map(int,input().split())
a=[list(map(int, input().split())) for i in range(n)]
c=[list(map(int, input().split())) for i in range(m)]
r=[]
for i in range(n):
    l=[0]*(m)
    for j in range(m):
        l[j]=abs(a[i][0]-c[j][0])+abs(a[i][1]-c[j][1])
    r.append(l)
#print(r)
for i in range(n):
    q=min(r[i])
    for j in range(m):
        if r[i][j]==q:
            print(j+1)
            break

Measured memory_bytes: 3064
/*
f[i][j]用数字1到i放前i位且最后一位是j的合法方案 
n=4,<><
  j=0,1,2,3,4
i=0 0 0 0 0 0
i=1 0 1 0 0 0
i=2 0 0 1 0 0
i=3 0 1 1 0 0
i=4 0 0 1 2 2
3<4>1<2
2<4>1<3
1<4>2<3
2<3>1<4
1<3>2<4
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=3009;
const ll MOD=1e9+7;
char s[N];
ll n,f[N][N];
int main(){
	cin>>n;
	for(ll i=1;i<=n;++i)cin>>s[i];
	f[1][1]=1;
	for(ll i=2;i<=n;++i){
		if(s[i-1]=='<'){
			for(ll j=2;j<=i;++j)
				f[i][j]=(f[i][j-1]+f[i-1][j-1])%MOD;		
		}
		else{
			for(ll j=i-1;j>=1;--j)
				f[i][j]=(f[i][j+1]+f[i-1][j])%MOD;
		}
	}	
	ll ans=0;
	for(ll j=1;j<=n;++j)ans=(ans+f[n][j])%MOD;
	cout<<ans<<endl;	
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    bool flag;
    int a;
    int kekka = 0;
    int res = 0;
    
    int counter;
    
    for (int i = 1; i <= N; i++) {
        flag = true;
        counter = 0;
        a = i;
        while (flag) {
            if(a % 2 == 0) {
                counter++;
                a /= 2;
            }
            else flag = false;
        }
        if (counter >= kekka) {
            kekka = counter;
            res = i;
        }
        //cout << kekka << endl;
        //cout << counter << endl;
    }
    cout << res << endl;
    return 0;
}


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

using namespace std;

long long ncr[55][55];

void precalc(){
	for(int n = 0; n < 51; ++n){
		for(int r = 0; r <= n; ++r){
			if(r == 0){
				ncr[n][r] = 1;
				continue;
			}
			ncr[n][r] = ncr[n-1][r-1] + ncr[n-1][r];
		}
	}
}

int main()
{
	precalc();
	int n, p;
	cin >>n >>p;
	
	int even = 0, odd = 0;
	for(int i = 0; i < n; ++i){
		int a;
		cin >>a;
		if(a % 2 == 0)
			++even;
		else
			++odd;
	}

	long long we = 1LL << even;
	long long wo = 0, ans = 0;
	int st = 0;

	if(p == 0)
		st = 0;	
	else
		st = 1;
	
	
	for(int i = st; i <= odd; i += 2)
		wo += ncr[odd][i];
	ans = wo * we;
	cout <<ans <<'\n';

	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=n/(a+b);
    ans*=a;
    n%=(a+b);
    if(n<=a)ans+=n;
    else ans+=a;
    cout << ans<<endl;
    return 0;
}


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

const long long mod=1000000007;
long long cntcol[3]={0,0,0}, n, ans=1;

int main(){
	cin >> n;
	for (int i=0;i<n;i++){
		long long a;
		cin >> a;
		long long tmp=0, ind=-1;
		for (int j=0;j<3;j++){
			if (cntcol[j]==a) tmp++, ind=j;
		}
		if (ind!=-1) cntcol[ind]++;
		ans*=tmp;
		ans%=mod;
	}
	cout << ans << "\n";
} 

Measured memory_bytes: 384