akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


int main() {
	cout << fixed << setprecision(18);
	string str[5001];
	cin>>str[0];
	str[0]=str[0]+"PP";
	for(int i=1;i<=5000;i++){
		long long int a=0,b=0,c=0,abc=0;
		for(int j=0;j<str[i-1].length()-2;j++){
			if(str[i-1].substr(j,3)!="ABC"){
				
				for(int k=0;k<1;k++){
					if(str[i-1][j+k]=='A'){a++;}
					else if(str[i-1][j+k]=='B'){b++;}
					else{c++;}
				}
			}else{abc++;j+=2;}
		}
		for(int j=0;j<str[i-1].length()-2;j++){
			if(str[i-1].substr(j,3)=="ABC"){
				if(a==0){str[i].push_back('A');}
				else if(b==0){str[i].push_back('B');}
				else{str[i].push_back('C');}
				j+=2;
			}else{
				str[i].push_back(str[i-1][j]);
			}
		}
		str[i]=str[i]+"PP";

		if(str[i-1]=="ABCPP"){
			cout<<"Yes"<<endl;
			return 0;
		}else if(abc==0||a!=0&&b!=0&&c!=0){
			cout<<"No"<<endl;
			return 0;
		}
		//cout<<a<<" "<<b<<" "<<c<<" "<<str[i]<<endl;
	}
	
} 



Measured memory_bytes: 9280
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(q), p(n, k);
  rep(i, q){
    cin >> a.at(i);
    p.at(a.at(i)-1)++;
  }
  rep(i, n) {
    if(p.at(i) <= q) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
}

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

#define OUT(x)  cerr << #x << " = " << x << endl;
#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

int main() {
        int n;
        cin >> n;
        vector<int> p(n);
        for (int i = 0; i < n; i ++) cin >> p[i];
        int ans = 0;
        for (int i = 0; i < n; i ++) {
                if (p[i] == i + 1) { 
                        swap(p[i], p[i + 1]);
                        ans ++;
                }
        }
        cout << ans << endl;
        return 0;
}



Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int N, A[200005], cnt[200005];
int main() {
  scanf("%d", &N);
  for(int i = 1; i <= N; ++i) {
    scanf("%d", &A[i]);
    ++cnt[A[i]];
  }
  ll calc[200005], sum = 0LL;
  for(int i = 1; i <= N; ++i) {
    calc[i] = 1LL*cnt[i]*(cnt[i]-1)/2;
    sum += calc[i];
  }
  for(int i = 1; i <= N; ++i) {
    ll tcalc = max(0LL, 1LL*(cnt[A[i]]-1)*(cnt[A[i]]-2)/2);
    printf("%ld\n", sum-calc[A[i]]+tcalc);
  }
}

Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i, ans = 0;
	string s;
	cin >> num >> s;
	rep(i, num - 2) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

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

int main(){
  int ans=0,t=10;
  vector<int> a(6);
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  
  for(int i=0; i<5; i++){
    t=min(t,((a[i]-1)%10)+1);
    ans+=((a[i]+9)/10)*10;
  }
  cout << ans-10+t;
}

Measured memory_bytes: 256
import string

N = int(input())
name_l = list(string.ascii_lowercase)

name_N = ''
div_N = N

while True:
    i = div_N%26
    if i == 0:
        i = 26
    name_N = name_l[i-1] + name_N
    if div_N <= 26:
        break
    div_N //= 26
    if i == 26:
        div_N -= 1

print(name_N)

Measured memory_bytes: 9868
#include <cstdio>
#include <string>
#include <map>
using namespace std;

int N;
char S[50];
long long res;
map<string, int> mpl, mpr;

void solve()
{
	int i, j;
	string s1, s2;
	for(i=0; i<(1<<N); i++){
		s1 = "";
		s2 = "";
		for(j=0; j<N; j++){
			if( (i & (1<<j)) > 0){
				s1 += S[j];
			}
			else
				s2 += S[j];
		}
		s1 += '_';
		s1 += s2;
		mpl[s1] ++;
	}
	for(i=0; i<(1<<N); i++){
		s1 = "";
		s2 = "";
		for(j=0; j<N; j++){
			if( (i & (1<<j)) > 0){
				s1 += S[2*N-1-j];
			}
			else{
				int oo = 1;
				s2 += S[2*N-1-j];
			}
		}
		s2 += '_';
		s2 += s1;
		mpr[s2] ++;
	}
	long long tmp;
	for(map<string, int>::iterator it=mpl.begin(); it!=mpl.end(); it++){
		s1 = (*it).first;
		tmp = (*it).second;
		tmp *= mpr[(*it).first];
		res += tmp;
	}
	printf("%lld\n", res);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%s", S);
	solve();
	return 0;
}

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

int main() {
	rep(i, 3) {
		int a, b, c, d, e, f;
		scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
		int cnt = (d - a) * 3600 + (e - b) * 60 + f - c;
		cout << cnt / 3600 << ' '; cnt %= 3600;
		cout << cnt / 60 << ' '; cnt %= 60;
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<string>
#include<cstring>

using namespace std;

int main(){
  int n,t = 0,h = 0;
  string T[1000],H[1000];
  cin >> n;
  for(int i=0;i < n;i++){
    cin >> T[i] >> H[i];
    if(T[i] > H[i]) t += 3;
    else if(T[i] == H[i]){
      t += 1;h += 1;
    }else{
      h += 3;
    }
  }
  cout << t << " " << h << endl;
  return 0;
}


Measured memory_bytes: 3260
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[float("inf") for _ in range(N)]
dp[0]=0
for i in range(N-1):
	for j in range(1,min(K+1,N-i)):
		dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[N - 1])

Measured memory_bytes: 56928
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;


int main(){
	long long n;
	cin >> n;
	
	if(n == 1){
		cout << 0 << endl;
		return 0;
	}

	long long sum = 0;
	for(long long i = n - 1; i > 0; i--){
		sum += i;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		long max = -1000000;
		long min = 1000000;
		long sum = 0;
		long[] num = new long[n];
		for(int i = 0; i < n; i++) {
			num[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			if(num[i] > max)
				max = num[i];
			if(num[i] <= min)
				min = num[i];
			sum += num[i];
		}
		System.out.println(min + " " + max + " " + sum);
	}
}



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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

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

  if (K==0) {
    OUT(N*N);
    return 0;
  }

  // bに入りうる値でループ
  ll ans = 0;
  FOR(b,K+1,N+1) {
    // 余りがK以上になる個数
    // 境界線を見つけて、そこまで足していく
    // ....ooo....ooo....oo|o
    // あまりの島が全部入っている個数
    int gap = b-K;
    int island_cnt = N/b;
    ans += gap*island_cnt;

    // 最後の島が境界線に分断されている場合
    if ((b*island_cnt+K-1)<=N) {
      ans += N-(b*island_cnt+K-1);
    }
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        
		Scanner sc=new Scanner(System.in);

		int A=sc.nextInt();
		int B=sc.nextInt();
		int ans;
		
		if (A==B){
		    ans=A+B;
		}else{
		    if (A<B){A=B;}
		    ans=A*2-1;
		}

        System.out.println(ans);
    }
}


Measured memory_bytes: 23892
from itertools import accumulate
num = int(input())
maxnum = 10000

A = [int(x) for x in input().split()]
B = [0] * (maxnum +1)
C =[0] * (len(A)+1)
for i in A:
    B[i] += 1
B = list(accumulate(B))
for i in reversed( range(0,len(A))):
    k = A[i]
    j = B[k]
    B[k] -= 1
    C[j] = k
print(*C[1:])




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

#define INF (1LL << 31 - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define fi first
#define se second

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int n, c[10], x, mi, ma;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        for (int j = 0; j <= 3200; j += 400) {
            if (max(1, j) <= x and x < j + 400) {
                c[j / 400]++;
                break;
            }
            else if (3200 <= x) {
                c[8]++;
                break;
            }
        }
    }

    rep(i, 8) {
        if (c[i] > 0) {
            mi++, ma++;
        }
    }

    if (mi == 0) {
        mi = 1;
        ma = c[8];
    }
    else {
        ma = ma + c[8];
    }

    cout << mi << " " << ma << endl;

    return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
ans = 0
if a > b:
  for i in range(1, a + 1):
    if b * i % a == 0:
      ans = b * i
      break
else:
  for i in range(1, b + 1):
    if a * i % b == 0:
      ans = a * i
      break
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
//4008802802
//4008160009
//1175114440
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define pb push_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define forn(i, a) for(register int i=0; i<a; i++)
#define Forn(i, a) for(register int i=1; i<=a; i++)
#define memINF 127
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;
typedef vector<vector<ll> > matrix;

inline int in() 
{
    int x=0, c;
    while((uint)((c=getchar())-48)>=10) 
        if(c=='-') 
            return -in();
    do 
    { x=(x<<3)+(x<<1)+(c^48); }
    while((uint)((c=getchar())^48)<10);
    return x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=1e5+5;

priority_queue<pi, vector<pi>, greater<pi> > q;
int N, K, a, b, val[MAX];
vi e[MAX];

int main()
{
    memset(val, -1, sizeof(val));
    N=in();
    Forn(i, N-1)
    {
        a=in(), b=in();
        e[a].eb(b);
        e[b].eb(a);
    }
    
    K=in();
    while(K--)
    {
        a=in();
        val[a]=in();
        q.push(mp(val[a], a));
    }
    
    while(!q.empty())
    {
        a=q.top().s;
        q.pop();
        foreach(it, e[a])
            if(val[*it]==-1)
                val[*it]=val[a]+1, q.push(mp(val[*it], *it));
    }
    
    Forn(i, N)
        foreach(it, e[i])
            if(abs(val[*it]-val[i])!=1)
            {
                puts("No");
                return 0;
            }
    
    puts("Yes");
    Forn(i, N)
        printf("%d\n", val[i]);
    return 0;
}

Measured memory_bytes: 7924
#include <bits/stdc++.h>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
#define MOD 1000000007
const int INF = 1e9;
const double PI = 3.14159265358979323846;
ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}
ll spow(ll base, ll exp){
	ll ans = 1;
	for(ll i=0;i<exp;i++) ans = ans * base % MOD;
	return ans;
}
ll divide(ll a, ll b){
	return a * spow(b, MOD-2) % MOD;
}
void solve(){
	
}

int main(){
	//~ load;
	//~ int t;
	//~ cin >> t;
	//~ while(t--){
		//~ solve();
	//~ }
	
	string s, t;
	cin >> s >> t;
	
	int ans = INT_MAX;
	for (int i = 0; i<= s.size()-t.size(); i++){
		int diff = 0;
		
		for(int j=0; j<t.size(); j++){
			if (t[j] != s[i + j]){
				diff++;
			}
		}
		ans = min(ans, diff);
	}
	cout << ans << "\n";
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 

typedef unsigned long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/*********** TEMPLATE ENDS HERE *************/

const int DIM = 1e5 + 17;

pii v[DIM];

main()
{
	IOS
	
	int n, H;
	cin >> n >> H;
	
	int wield = -1;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> v[i].S >> v[i].F;
		amax(wield, v[i].S);
	}
	
	sort(v + 1, v + 1 + n);
	
	int indx = 0;
	int thr = INF;
	
	for(int i = 1; i <= n; i++)
		if(v[i].S == wield)
			if(v[i].F < thr)
			{
				thr = v[i].F;
				indx = i;
			}
	
	int pos = n;
	
	if(pos == indx)
		pos--;
	
	int nr = 0;
	
	while(H > 0)
	{
		nr++;
		
		if(v[indx].F >= H)
		{
			break;
		}
		
		if(v[indx].S >= v[pos].F || pos == 0)
		{
			H -= v[indx].S;
			
			if(H <= v[indx].F)
			{
				nr++;
				break;
			}
			
			int p1 = ceil(H * 1.0 / v[indx].S);
			int p2 = ceil((H * 1.0 - v[indx].F) / v[indx].S);
			
			nr += min(p1, 1 + p2);
			
			break;
		}
		
		H -= v[pos].F;
		pos--;
		
		if(pos == indx)
			pos--;
	}
	
	cout << nr;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
typedef pair<li, li> PI;


int main(void)
{
    li n, a;
    cin >> n >> a;
    cout << (n % 500 <= a ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
l = list(input())
l2 = list(set(l))
if len(l2) == 2:
  n = 0
  if l[0] == l[1] and l[0] != l[2] and l[0] != l[3]:
    n += 1
  elif l[0] != l[1] and l[0] == l[2] and l[0] != l[3]:
    n += 1
  elif l[0] != l[1] and l[0] != l[2] and l[0] == l[3]:
    n += 1
  else:
    n += 0
  if n == 1:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Measured memory_bytes: 3188
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector> 
using namespace std;
const int maxn=1e5+10;
char s[maxn];
int main(){
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;i+=2){
		printf("%c",s[i]);
	} printf("\n");
	return 0;
}
/*
A
int main(){
	int n,t;
	scanf("%d%d",&n,&t);
	if(t>=n) printf("0\n");
	else printf("%d\n",n-t);
	return 0;
} 
*/


Measured memory_bytes: 384
#include<iostream>
using namespace std;
#define MAX 100
#define White 1
#define Black 2
#define Red 3
#define Infinit 2001
struct Vertex {
	int weight,color,parent;
};
int M[MAX][MAX];
int n;
Vertex v[MAX];
void search() {
	int weight[MAX],pointer,min;
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			v[i].weight = 0;
		}
		else {
			v[i].weight = Infinit;
		}
		v[i].color = White;
		v[i].parent = -1;
	}
	while (true) {
		min = Infinit;
		pointer = -1;
		for (int i = 0; i < n; i++) {
			if (v[i].color != Black && min>v[i].weight) {
					min = v[i].weight;
					pointer = i;
			}
		}
		if (min==Infinit) break;
		v[pointer].color = Black;
		for (int k = 0; k < n; k++) {
			if (M[pointer][k] != -1 && v[k].color!=Black) {
				if (M[pointer][k]<v[k].weight) {
					v[k].weight = M[pointer][k];
					v[k].parent = pointer;
					v[k].color = Red;
				}
			}
		}

	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += v[i].weight;
	}
	cout << sum << endl;


}
int main() {
	int id;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >>id;
			M[i][j]=id;
		}
	}
	search();
}


Measured memory_bytes: 3096
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
left = 0
right = n-1
for i in range(n):
    x = a.pop()
    if i % 2 == 0:
        b[left] = x
        left += 1
    else:
        b[right] = x
        right -= 1
print(*b)

Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int p, q; cin >> p >> q;

    q /= __gcd(p, q);

    int ans = 1;
    for (int i = 2; i * i <= q; ++i) {
        if (q % i == 0) ans *= i;
        while (q % i == 0) q /= i;
    }
    ans *= q;

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3220
D=int(input())
C=list(map(int,input().split()))
S=list()
for i in range(D):
  S.append(list(map(int,input().split())))
t=[0]*D
M=0
N=0
L=-10000000000000000000000
di=[0]*26
ddi=[0]*26
dddi=[0]*26
for d in range(D):
  #j番目のコンテストを実施したときにスコアが改善するなら更新する
  for j in range(26):
    for i in range(26): #ddiはj番目のコンテスト以外はdi+1,j番目は0
      if i==j:
        ddi[i]=0
      else:
        ddi[i]=di[i]+1
    N=S[d][j] #sを加算
    for i in range(26): #c*ddiを減算
      N-=C[i]*ddi[i]
    if N>L:
      L=N
      for i in range(26):
        dddi[i]=ddi[i]
      t[d]=j+1
  for i in range(26):
    di[i]=dddi[i]
  L=-10000000000000000000000 #次の日になる前にLをリセット

for i in range(D):
  print(t[i])

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

using namespace std;

int main() {
  vector<int> A(3);
  for (int i = 0; i < 3; i++) cin >> A[i];
  int sum = accumulate(A.begin(), A.end(), 0);
  if (sum >= 22) {
    cout << "bust\n";
  } else {
    cout << "win\n";
  }

  return 0;
}


Measured memory_bytes: 256
n =int(input())

s=[0 for i in range(n+1)]
sum=0
for i in range(n):
	s[i] = int(input())
	sum += s[i]

s.sort()

if n==1 :
	if sum%10==0:
		print('0')
	else:
	    print(sum)
	exit(0)

while (sum%10==0):
	if len(s)<2:
		print(0)
		exit(0)
	if s[0]%10==0:
		s.pop(0)
	else:
		sum -= s[0]
		s.pop(0)

print(sum)


Measured memory_bytes: 3064
export class Main {
  static main(input): string {
    const [a, b, t]: number[] = input.split("\n")[0].split(" ").map(Number);
    return `${Math.floor((t + 0.5) / a) * b}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define iiii tuple<int, int, int, int>
#define iii tuple<int, int, int>
#define ii pair<int, int>
#define dd pair<double, double>
#define fi first
#define vi vector<int>
#define vvi vector<vector<int>>
#define se second

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int M = 1e3;
double e = 1e-8;

double f(vector<ii>& a, double x, double y) {
    double res = 0;
    for (auto& i : a)
        res = max(res, sqrt((i.fi - x) * (i.fi - x) + (i.se - y) * (i.se - y)));
    return res;
}

double dx(vector<ii>& a, double x, double y) {
    return (f(a, x + e, y) - f(a, x - e, y)) / e;
}

double dy(vector<ii>& a, double x, double y) {
    return (f(a, x, y + e) - f(a, x, y - e)) / e;
}

bool test(vector<ii>& a, double L, double x, double y) {
    return f(a, x, y) > f(a, x - dx(a, x, y) * L, y - dy(a, x, y) * L);
}

double cal_L(vector<ii>& a, double x, double y, double tdx, double tdy) {
    double lef = -M, rig = M;
    int cnt = 100;
    while (cnt--) {
        double l1 = (lef + lef + rig) / 3;
        double l2 = (lef + rig + rig) / 3;
        if (f(a, x - tdx * l1, y - tdy * l1) > f(a, x - tdx * l2, y - tdy *
        l2))
            lef = l1;
        else
            rig = l2;
    }
    return lef;
}

void solve() {
    int n;
    cin >> n;
    vector<ii> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i].fi >> a[i].se;

    int cnt = 1000;
    double L = 100, x = 0, y = 0;
    while (cnt--) {
        // int cnt_test = 100;
        // while (!test(a, L, x, y) && cnt_test--) L = L * 0.9;
        // L = L * 0.999;

        double tdx = dx(a, x, y), tdy = dy(a, x, y);
        L = cal_L(a, x, y, tdx, tdy);

        x -= tdx * L;
        y -= tdy * L;
    }
    cout << fixed << setprecision(15) << f(a, x, y) << '\n';
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include <string.h>
using namespace std;
int main(void){
    char S[3];
    for (int i = 0; i < 3; i++) {
        std::cin >> S[i];
    }
    if(S[0]=='a'&&S[1]=='b'&&S[2]=='c'){
        std::cout << "Yes" << std::endl;
    }
    else if(S[0]=='b'&&S[1]=='a'&&S[2]=='c'){
        std::cout << "Yes" << std::endl;
    }
    else if(S[0]=='c'&&S[1]=='a'&&S[2]=='b'){
        std::cout << "Yes" << std::endl;
    }
    else if(S[0]=='a'&&S[1]=='c'&&S[2]=='b'){
        std::cout << "Yes" << std::endl;
    }
    else if(S[0]=='b'&&S[1]=='c'&&S[2]=='a'){
        std::cout << "Yes" << std::endl;
    }
    else if(S[0]=='c'&&S[1]=='b'&&S[2]=='a'){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	long long int n,m,kr;
	cin >> n >> m;
	kr = m >> 1;
	if(n > kr){
		m -= kr << 1;
	}else{
		kr = n;
		m -= n << 1;
	}
	if(kr < 0) kr=0;
	cout << kr + m/4 << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: i64,
        t: i64,
        mat: [[i64; 2]; n],
    }
    let mut best = 99999;
    let mut best_i = 99999;
    for i in 0..n {
        if mat[i as usize][1] <= t && best > mat[i as usize][0] {
            best = mat[i as usize][0];
            best_i = i;
        }
    }
    if best_i == 99999 {
        println!("TLE");
    } else {
        println!("{}", mat[best_i as usize][0]);
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
	    int number1 = stdin.nextInt();
	    int number2 = stdin.nextInt();
	    int number3 = stdin.nextInt();
	    int temp = 0;
		if (number1 > number2) {
		       temp = number1;
		       number1 = number2;
		       number2 = temp;
		    }
		if (number2 > number3) {
		       temp = number2 ;
		       number2= number3;
		       number3= temp;
		    }
		if (number1 > number2) {
		      temp =number1;
		      number1 = number2;
		      number2 = temp;
		    }
		System.out.println(number1 + " " + number2 + " " + number3);
	}
}

Measured memory_bytes: 26164
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 0

for i in range(n):
    b = B[i]
    if A[i] >= b:
        ans += b
    elif A[i] < b:
        ans += A[i]
        b -= A[i]
        if A[i+1] >= b:
            ans += b
            A[i+1] -= b
        elif A[i+1] < b:
            ans += A[i+1]
            A[i+1] = 0 

print(ans)


Measured memory_bytes: 19156
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  ll a, b;
  cin >> a >> b;
  ll count = a;
  if(b<a){
    count--;
  }
  print(count);
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i=1; i*i<=n; i++) {
        if(n%i==0) {
            ret.pb(i);
            if(i*i!=n) {
                ret.pb(n/i);
            }
        }
    }
    sort(ALL(ret));
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;

    ll cnt = 0;
    REP(i,1,n+1){
        Vec v = divisor(i);
        if(i%2==0)continue;
        if(v.size()==8)cnt++;
    }

    cout<<cnt<<endl;
    return  0;
}


Measured memory_bytes: 256
n,x = map(int,input().split())
l = list(map(int,input().split()))
res = 0
d = 0
for i in range(0,len(l)+1):
    if i == 0:
        res+=1
        continue
    elif d + l[i-1] <= x:
        res+=1
    d = d + l[i-1]

print(res)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdint>

using namespace std;

int64_t n;
int64_t *a,*s;
int64_t cut[5] = {0};

int main(void) {
    cin >> n;
    a = new int64_t[n];
    s = new int64_t[n+1];
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
    for(int i = 1;i <= n;i++) {
        s[i] = s[i-1] + a[i-1];
    }
    cut[0] = 0;
    cut[4] = n;
    int64_t res = INT64_MAX;
    for(int i = 0;i < n-1;i++) {
        cut[2] = i;
        while(abs(s[cut[1]] - (s[cut[2]] - s[cut[1]])) > abs((s[cut[1]+1]) - (s[cut[2]] - s[cut[1]+1]))) {
            cut[1]++;
        }
        while(abs((s[n]-s[cut[3]]) - (s[cut[3]]-s[cut[2]])) > abs((s[n]-s[cut[3]+1]) - (s[cut[3]+1]-s[cut[2]]))) {
            cut[3]++;
        }
        int64_t k[4];
        for(int j = 0;j < 4;j++) {
            k[j] = s[cut[j+1]] - s[cut[j]];
        }
        int64_t mmax = INT64_MIN,mmin = INT64_MAX;
        for(auto e:k) {
            mmax = max(mmax,e);
            mmin = min(mmin,e);
        }
        res = min(res,abs(mmax-mmin));
    }
    cout << res << endl;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    string s, t; cin >> s >> t;
    int n = s.size();
    ll res = 0;
    rep(i, n){
        if(s[i] != t[i]) res++;
    }
    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7892
#include <stdio.h>
#include <stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}
 
Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;
 
}
 
Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key){
    return u;
  }
  if(k < u->key){
    return treeSearch(u->left, k);
  }
  else{
    return treeSearch(u->right, k);
  }
 
}
 
Node treeSuccessor(Node x){
  Node y;
 
  if(x->right != NIL){
    return (Node)treeMinimum(x->right);
  }
 
  y = x->parent;
 
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
 
  return y;
 
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
 
  if(z->left == NIL || z->right == NIL){
    y = z;
  }
  else{
    y = (Node)treeSuccessor(z);
  }
   
  if(y->left != NIL){
    x = y->left;
  }
  else{
    x = y->right;
  }
   
  if(x != NIL){
    x->parent = y->parent;
  }
   
  if(y->parent == NIL){
    root = x;
  }
  else if(y == y->parent->left){
    y->parent->left;
  }
  else{
    y->parent->right = x;
  }
   
  if(y != z){
    z->key = y->key;
  } 
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z->parent = y;
 
  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else{
    y->right = z;
  }
 
}
 
void inorder(Node u){
   
  if(u->left != NIL){
    inorder(u->left);
  }
  printf(" %d", u->key);
  if(u->right != NIL){
    inorder(u->right);
  }
   
}
void preorder(Node u){
   
  printf(" %d", u->key);
  if(u->left != NIL){
    preorder(u->left);
  }
  if(u->right != NIL){
    preorder(u->right);
  }
}
 
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}



Measured memory_bytes: 20448
#include<bits/stdc++.h>
using namespace std;
#define M 200005
int n,A[M],B[M];
int main(){
	scanf("%d",&n);
	int l=n/2+1,r=n/2,a;
	for(int i=1;i<=n;i++){
		scanf("%d",&a);
		if(i&1)B[++r]=a;
		else B[--l]=a;
	}
	if(n&1)for(int i=r;i>=l;i--)printf("%d ",B[i]);
	else for(int i=l;i<=r;i++)printf("%d ",B[i]);
	return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 998244353

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

using ll = long long;

template<class T> void chmax(T& a, T b){ a>b?:a=b; }
template<class T> void chmin(T& a, T b){ a<b?:a=b; }

ll dp[200001];

ll pow(ll a, ll b) {
    if (b == 0) return 1;
    if (b % 2) return a * pow(a, b - 1);
    return pow(a * a, b / 2);
}

//a^(-1)≡a^(p-2) (mod p) (but p is prime)
ll powMod(ll a, ll b, ll p) {
    if (b == 0) return 1;
    if (b % 2) return (a * powMod(a, b - 1, p)) % p;
    return powMod(a * a % p, b / 2, p);
}

int main() {
    ll n, m, k, ans = 0, c = 1;
    cin >> n >> m >> k;
    for (int i = 0; i <= k; ++i) {
        ll t = 1;
        (t *= m) %= MOD;
        (t *= powMod(m - 1, n - i - 1, MOD)) %= MOD;
        (t *= c) %= MOD;
        (ans += t) %= MOD;
        (c *= n - i - 1) %= MOD;
        (c *= powMod(i + 1, MOD - 2, MOD)) %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            String line = sc.nextLine();
            if(line.equals("0")) System.exit(0);
            int l = line.length();
            int[] num = new int[l];
            int s=0;
            for(int i=0;i<l;i++){
                num[i] = line.charAt(i) - '0';
                s += num[i];
            }
            System.out.println(s);
        }
    }
}


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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int N,D;

  cin>>N>>D;

  if(N%(D*2+1)==0){
    cout<<N/(D*2+1)<<endl;
  }else{
    cout<<N/(D*2+1)+1<<endl;

  }
  
  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n, m, c;
    int b[30];
    int a[30][30];

    scanf("%d %d %d", &n, &m, &c);
    for(int i = 0; i < m; ++i){
        scanf("%d", &b[i]);
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            scanf("%d", &a[i][j]);
        }
    }

    int sum = 0;
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        sum = 0;
        for(int j = 0; j < m; ++j){
            sum += (a[i][j] * b[j]);
        }
        if(sum + c > 0) cnt++;
    }

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

    return 0;
}


Measured memory_bytes: 1728
#include<stdio.h>
#include<ctype.h>
int main(void){
    int h, w;
    int H, W;
    while(1){
        scanf("%d %d", &H, &W);
        if(H==0&&W==0) break;
        for(h=0; h<H; h++){
            for(w=0; w<W; w++)
                putchar('#');
                printf("\n");
        }
    printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2048
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define sqr(x) (x*x)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

//#define int ll


const int N = 1e5+33, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const char pxy[] = {'R' , 'L' , 'D' , 'U'};
const double EPS = 1e-4;
const double PI = acos(-1.0);

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}
ll bp(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

void solve() {
    unordered_map<int , int> mp1;
    int n;
    cin >> n;
    for(int i = 1; i < n; i ++) {
        int x;
        cin >> x;
        mp1[x] ++;
    }
    for(int i = 1; i <= n; i ++) {
        cout << mp1[i] << '\n';
    }
}

/*
*/

main() {
    ios;
    int tt = 1;
//    cin >> tt;
    while(tt --) {
        solve();
        cout << '\n';
    }
    return 0;
}
/*
++>
+++>
<[<+>-]<
++++++++++++++++++++++++++++++++++++++++++++++++.

500000000000000000000000000000000000000000000000

1 1 2 3 6


*/


Measured memory_bytes: 11432
def is_2power(n: int)->bool:
    a = 1
    while a < n:
        a <<= 1
    return a == n


def skolem_xor_tree(N: int)->list:
    if is_2power(N):
        return []

    res = [
        (1, 2),
        (2, 3),
        (3, N+1),
        (N+1, N+2),
        (N+2, N+3),
    ]

    for a in range(4, N+(N % 2), 2):
        res.append((1, a))
        res.append((a, a+1))

        res.append((1, N+a+1))
        res.append((N+a+1, N+a))

    if N % 2 == 0:
        a = N ^ 1
        b = None
        for i in range(2, N):
            if (a ^ i) < N:
                a = a ^ i
                b = i
                break

        if not b:
            raise Exception()

        if a < N and a % 2 == 1:
            a += N

        if b < N and b % 2 == 1:
            b += N

        res.append((a, N))
        res.append((b, N+N))

    return res


if __name__ == "__main__":
    N = int(input())

    ans = skolem_xor_tree(N)
    if ans:
        print('Yes')
        for a, b in ans:
            print(a, b)
    else:
        print('No')


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

// ===== Attempt 1 =====
// vector<string> R;
// vector<string> S;
// int N = 0;
// void permute(vector<string> &strings, int l, int r) {
//   int fact = N; //Get the factorial of N
//   if (l == r) {
//     for (int i = 0; i < strings.size(); i++) {
//       cout << strings[i];
//     }
//     cout << endl;
    
//   }
//   else {
//     for (int i = l; i <= r; i++) {
//       swap(strings[l], strings[i]);
//       permute(strings, l + 1, r);
//       swap(strings[l], strings[i]);
//     }
//   }
  
// }
// int main() {
  
//   int L = 0;
//   cin >> N >> L;
//   for (int i = 0; i < N; i++) {
//     string k;
//     cin >> k;
//     S.push_back(k);
//   }
  

//   // cout << S[0] << endl;
//   permute(S, 0, N);
//   // cout << comb << endl;
//   return 0;
// }

// ==== Attempt 2 ====
int main () {
  int N, L;
  cin >> N >> L;
  vector<string> S(N); //We put (N) to specify the length
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  string ans = "";
  sort(S.begin(), S.end());//If we didn't say S(N), S.end() wouldn't be defined
  for (int i = 0; i < N; i++) { 
    ans += S.at(i);
  }
  cout << ans;
  return 0;
}

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

int main()
{
  int a, b, k;
  cin >> a >> b >> k;
  vector<int> v;
  for (int i = 1; i <= min(a, b); i++)
  {
    if (a % i == 0 && b % i == 0)
    {
      v.push_back(i);
    }
  }
  cout << v[v.size() - k] << endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
P A[2005];
int dp[2005][2005];
signed main(){
	cin>>N;
	rep(i,N){
		cin>>A[i].first;A[i].second=i;
	}
	sort(A,A+N,greater<>());
	rep(i,N+1)rep(j,N+1)dp[i][j]=-inf;
	dp[0][0]=0;
	rep(i,N){
		rep(j,i+1){
			if(dp[i][j]==-inf)continue;
			chmax(dp[i+1][j+1],dp[i][j]+A[i].first*abs(j-A[i].second));
			chmax(dp[i+1][j],dp[i][j]+A[i].first*abs(N-1-(i-j)-A[i].second));
		}
	}
	int ans=-inf;
	rep(i,N+1)chmax(ans,dp[N][i]);
	cout<<ans<<endl;
}


Measured memory_bytes: 34944
#include <cstdio>
#include <cstring>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define clr(a,v) memset((a),(v),sizeof(a))

const int MAX_M = 500, MAX_N = 500;

int m, n;
int b[MAX_M], r[MAX_N];
std::vector<int> G[MAX_M];
bool used[MAX_M];
int pr[MAX_M];
int ans;

bool dfs( int v )
{
  if( v < 0 )
    return true;
  if( used[v] )
    return false;

  used[v] = true;

  for( int u : G[v] )
  {
    if( dfs( pr[u] ) )
    {
      pr[u] = v;
      return true;
    }
  }

  return false;
}

int gcd( int a, int b )
{ return b ? gcd( b, a%b ) : a; }

int main()
{
  while( scanf( "%d%d", &m, &n ), m|n )
  {
    rep( i, m )
      G[i].clear();
    ans = 0;

    rep( i, m )
      scanf( "%d", b+i );
    rep( i, n )
      scanf( "%d", r+i );

    rep( i, m ) rep( j, n ) if( gcd( b[i], r[j] ) != 1 )
      G[i].push_back( j );

    clr( pr, -1 );

    rep( v, m )
    {
      clr( used, false );
      
      if( dfs(v) )
        ++ans;
    }

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

  return 0;
}

Measured memory_bytes: 3544