akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ri register int
const int N=5e3+5;
char s[N],t[N];
int a[N],b[N];
int main(){
	ri n,ns,nt,i,j,res,ans;
	scanf("%d%s%s",&n,s+1,t+1);
	ns=nt=0;
	for(i=1;i<n;++i)
		if(s[i]!=s[i+1])
			a[++ns]=i;
	for(i=1;i<n;++i)
		if(t[i]!=t[i+1])
			b[++nt]=i;
	ans=2e9;
	for(i=-max(ns,nt)-1;i<=max(ns,nt)+1;++i)
		if((i&1)^(s[1]==t[1])){
			res=0;
			for(j=min(1,1-i);j<=max(ns,nt-i);++j)
				res+=abs((j<0?0:(j>ns?n:a[j]))-(j+i<0?0:(j+i>nt?n:b[j+i])));
			ans=min(ans,res);
		}
	printf("%d\n",ans);
	return 0;
}

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

using ll=long long;

int main(){

string S;

cin >> S;

int a=S.size();

int j=0;

for(int i=0;i<a/2;++i){
if(S[i]!=S[a-i-1]){++j;}
}

cout<< j << endl;

}

Measured memory_bytes: 256
N,L = map(int,input().split())

N_all = []
for i in range(N):
    N_all.append(L + (i + 1) - 1)
#print(sum(N_all))
#print(N_all)

if N_all.count(0) == 1:
    x = N_all.index(0)
    del N_all[x]
elif N_all.count(0) == 0 and sum(N_all) >= 1:
    x = min(N_all)
    x = N_all.index(x)
    del N_all[x]
elif N_all.count(0) == 0 and sum(N_all) <= -1:
    x = max(N_all)
    x = N_all.index(x)
    del N_all[x]
else:
    pass
print(sum(N_all))

Measured memory_bytes: 3064
import itertools

n = int(input())
dict_ans = {}
for i in range(n):
    s = str(input())
    if s[0] in ["M","A","R","C","H"]:
        try:
            dict_ans[s[0]] += 1
        except KeyError:
            dict_ans[s[0]] = 1

if len(list(dict_ans.values())) < 3:
    ans = 0
else:
    list_ans = list(dict_ans.values())
    ans = 0
    for i,j,k in list(itertools.combinations(list_ans, 3)):
        ans += i*j*k
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
D=list(map(int,input().split()))
S = 0
# print("N=",N)
# print("D=",D)

for i in range(N):
    for j in range(i, N-1):
        S = S + D[i] * D[j+1]
#        print("i=",i,"j=",j, "D=",D[i],D[j+1], "S=",S)
print(S)


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

using namespace std;

string s;
int cnt[4];

int main(){
	cin >> s;
	int n = s.size();
	for(int i=0;i<n;++i){
		if(s[i] == 'N'){
			++cnt[0];
		}
		if(s[i] == 'S'){
			++cnt[1];
		}
		if(s[i] == 'W'){
			++cnt[2];
		}
		if(s[i] == 'E'){
			++cnt[3];
		}
	}
	
	bool ok1 = false;
	if((cnt[0] == 0 && cnt[1] == 0) || (cnt[0] > 0 && cnt[1] > 0)){
		ok1 = true;
	}
	bool ok2 = false;
	if((cnt[2] == 0 && cnt[3] == 0) || (cnt[2] > 0 && cnt[3] > 0)){
		ok2 = true;
	}
	if(ok1 && ok2){
		printf("Yes\n");
	}else{
		printf("No\n");
	}



	return 0;
}

Measured memory_bytes: 256
n, T = [int(_) for _ in raw_input().split()]
s = 0
S = 0
x = 0
for t in [int(_) for _ in raw_input().split()]:
    e = s + T
    if e < t:
        x += e - S
        S = t
    s = t

x += t + T - S

print(x)

Measured memory_bytes: 21188
/*
* Problem link
* 
*/

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> V;
typedef vector<V> VV;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
template<typename T>
inline bool chmin(T &a, T b) {
	bool res = a > b;
	if (res)a = b;
	return res;
}
typedef pair<int, int> P;
typedef vector<P> VP;
#define fi first
#define se second
#define ALL(v) (v).begin(),(v).end()

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed;
	int H, N, A, B, M;
	while (1) {
		cin >> H >> N >> M >> A >> B;
		if (H + N + A + B + M == 0)break;
		vector<double> h(H);
		REP(i, H)cin >> h[i];
		vector<int> a(M), b(M);
		vector<double> c(M);
		REP(i, M)cin >> a[i] >> b[i] >> c[i];
		double  res = 114514 + 1;
		vector<vector<double>> dp(1 << H, vector<double>(N + 1, res));
		dp[0][A] = 0;
		REP(bit, (1 << H)){
			chmin(res, dp[bit][B]);
			REP(k, H)if ((bit&(1 << k)) == 0) {
				int nxt = bit | (1 << k);
				REP(j, M)chmin(dp[nxt][b[j]], dp[bit][a[j]] + c[j] / h[k]);
				REP(j, M)chmin(dp[nxt][a[j]], dp[bit][b[j]] + c[j] / h[k]);
			}
		}

	

		if (res > 114514)cout << "Impossible" << "\n";
		else cout << res << "\n";
	}
	

	return 0;
}

Measured memory_bytes: 3304
#include<stdio.h>

#define N 101

int G[N][N], X[N], Y[N], n;

void find(int x, int y){
  int i;
  X[x] = y;
  for(i = 1; i <= Y[x]; i++)
    if(y + 1 < X[G[x][i]]) find(G[x][i], y + 1);
}

int main(){
  int i, j, m;

  scanf("%d", &n);

  for(i = 1; i <= n; i++){
    X[i] = 100000000;
    scanf("%d", &m);
    scanf("%d", &Y[m]);

    for(j = 1; j <= Y[m]; j++) scanf("%d", &G[m][j]);
  }

  find(1, 0);

  for(i = 1; i <= n; i++)
    if(X[i] == 100000000) X[i] = -1;

  for(i = 1; i <= n; i++) printf("%d %d\n", i, X[i]);

  return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int main(int argc,char const *argv[]) {
    int a,b,p,q;
    cin>>a>>b>>p>>q;
    int s=max(a,p);
    int e=min(b,q);
    cout<<max(0,e-s);
    return 0;
}


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

#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

#define vc vector<char>
#define vvc vector<vc>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vs vector<str>
#define vvs vector<vs>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vpll vector<pll>
#define vvpll vector<vpll>
#define vb vector<bool>
#define vvb vector<vb>
#define rep(i, a, b) for (int i = (a); i < int(b); i++)
#define repi(i, a, b) for (int i = (a); i <= int(b); i++)


using namespace std;
ll INF = LONG_LONG_MAX;
ll mod = 1000000000 + 7;

template <typename T, typename L>
void read(vector<T> & _data, L & _size, bool _shift) {
    _data.resize(_size + (ll)_shift);
    for (ll i = (ll)_shift; i < _size + (ll)_shift; i++)
        cin >> _data[i];
}

template <typename T, typename L>
void read(vector<vector<T>> & _data, L & _rows, L & _cols, bool _shiftRows, bool _shiftCols) {
    _data.resize(_rows + (ll)_shiftRows);
    for (ll i = 0; i < _rows + (ll)_shiftRows; i++)
        _data[i].resize(_cols + (ll)_shiftCols);
    for (ll i = (ll)_shiftRows; i < _rows + (ll)_shiftRows; i++)
        for (ll j = (ll)_shiftCols; j < _cols + (ll)_shiftCols; j++)
            cin >> _data[i][j];
}

template <typename T>
void write(vector<T> & _data, bool _shift) {
    for (ll i = (ll)_shift; i < _data.size(); i++)
        cout << _data[i] << " ";
    cout << endl;
}


//TODO: SOLUTION


void solve() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    repi(b, k + 1, n) {
        ll x = k;
        ll y = b;
        while (x <= n) {
            ans += min(n + 1, y) - x;
            if (x == 0)
                ans--;
            x += b; y += b;
        }
    }
    cout << ans << endl;
}


int main() {

    // TODO: Set value of this variable manually
    ios::sync_with_stdio(0);
    bool _multipleTestCases = false;

    if (_multipleTestCases) {
        ll t; cin >> t;
        while (t--)
            solve();
    }
    else {
        solve();
    }

    return 0;
}

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<ll> A(N);
    ll gnum=1;
    rep(i,N){
        cin >> A[i];
        if(A[i]==K){
            cout << "POSSIBLE" << endl;
            return 0;
        }
        gnum*=A[i];
    }
    sort(A.rbegin(),A.rend());
    if(K>A[0]){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    rep(i,N){
        gnum = __gcd(gnum,A[i]);
    }
    if(K%gnum==0){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

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

int main(){
    int a, b, c;
    std::cin >> a >> b >> c;
    // aを最大にする
    if(a < std::max(b, c)){
        if(b <= c){
            std::swap(a, c);
        }else{
            std::swap(a, b);
        }
    }

    int offset = 0;
    if(a % 2 == b % 2 && a % 2 != c % 2){
        a += 1;
        b += 1;
        offset++;
    }else if(a % 2 != b % 2 && a % 2 == c % 2){
        a += 1;
        b += 1;
        offset++;
    }

    int cost = a - std::max(b, c);
    b += cost;
    c += cost;
    if(a != b){
        cost += (a - b) / 2;
    }else if(a != c){
        cost += (a - c) / 2;
    }
    std::cout << cost + offset << std::endl;
    return 0;
}


Measured memory_bytes: 256
import functools

n = int(input())
t = [int(input()) for i in range(n)]

def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)

def lcm(x, y):
  return x * y // gcd(x, y)

def lcm_list(*x):
  return functools.reduce(lcm, x)

print(lcm_list(*t))


Measured memory_bytes: 3572
//package AtCoder;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		//int[] a=new int[n];
		Set<Integer> set=new HashSet<>();
		for(int i=0;i<n;i++)
		{
			int a=sc.nextInt();
			set.add(a);
		}
		if(set.size()==n)
			System.out.println("YES");
		else
			System.out.println("NO");

	}

}


Measured memory_bytes: 101452
//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <ctime>
#include <bitset>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=a%10, a/=10; return res;}
const int up[]={1,-1,0,0}, lf[]={0,0,1,-1};
ll gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}

int main() {
  int n; cin>>n;
  bool an = false;
  bool u[n];
  for(int i=0;i<n;i++) {
    int a,b; cin>>a>>b;
    u[i]=a==b;
  }
  for(int i=0;i<n-2;i++) {
    an |= u[i]&&u[i+1]&&u[i+2];
  }
  if (an) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest


Measured memory_bytes: 3628
#include<iostream>
using ll  = long long;
#define int ll
using namespace std;
int maxi = 1;
int n,m;
signed main(){
    scanf("%lld%lld",&n,&m);
    if(m%n==0)return cout << m/n << endl,0;
    for(int i = 2; i*n<=m ; i++)if(m%i == 0)maxi = max(maxi,i);
    printf("%lld\n",maxi);
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const ll MOD=1e9+7;

int M,D;
void input(){
	cin>>M>>D;
}

int ans;
void solve(){
	rep1(i,M)rep1(d,D){
		int d1=d%10;
		int d10=d/10;
		if(d1>1 && d10>1 && i==d1*d10)ans++;
	}
	cout<<ans<<endl;
}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 256
N,M = map(int,input().split())
Shops = [list(map(int,input().split())) for _ in range(N)]
cost = 0
Shops.sort()

for i in range(N):
  if Shops[i][1] < M:
    cost += Shops[i][0]*Shops[i][1]
    M -= Shops[i][1]
  else:
    cost += Shops[i][0]*M
    print(cost)
    exit()
  
  

Measured memory_bytes: 27760
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
    class Program
    {
        //メイン関数
        static void Main(string[] args)
        {
            string[] input = Read().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);
            int d = int.Parse(input[3]);

            if (a + b > c + d)
            {
                WriteLine("Left");
                return;
            }
            if (a + b == c + d)
            {
                WriteLine("Balanced");
                return;
            }
            if (a + b < c + d)
            {
                WriteLine("Right");
                return;
            }
        }

        //メインじゃない関数
        private static string Read() { return ReadLine(); }
        private static int ReadI() { return int.Parse(ReadLine()); }
    }
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-12
#define fi first
#define se second
#define MEM(a,b) memset((a),(b),sizeof(a))
#define mod(x) ((x)%MOD)
#define pii pair<int,int>


const int maxn = 4e5 + 10, INF = 0x3f3f3f3f;
const ll MOD = 1000000007LL;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

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

map<ll, int> m;

int main(){
//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
    ull a,b,c,k;
    cin>>a>>b>>c>>k;
    ll res;
    if (k & 1) {
        res = b - a;
    } else res = a - b;
    if (abs(res) > 1e18) puts("Unfair");
    else printf("%lld\n",res);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
int a[10]={0,2,5,5,4,5,6,3,7,6};
vector<int> v1,v2;
int dp[10][10100];
pii pre[10][10100];
int main()
{
	int i,j,k,n,m,x,y=10,z;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%d",&x);
		v1.push_back(x);
		v2.push_back(a[x]);
	}
	for(i=0;i<m;i++)
	{
		for(j=i+1;j<m;j++)
		{
			if(v1[i]>v1[j])
			{
				swap(v1[i],v1[j]);
				swap(v2[i],v2[j]);
			}
		}
	}
	memset(dp[0],-0x7f,sizeof(dp[0]));
	for(i=0;i*v2[0]<=n;i++)
	{
		dp[0][i*v2[0]]=i;
		pre[0][i*v2[0]]=mp(0,(i-1)*v2[0]);
	}
	for(i=1;i<m;i++)
	{
		for(j=0;j<=n;j++)
		{
			dp[i][j]=dp[i-1][j];
			pre[i][j]=mp(i-1,j);
			if(j>=v2[i])
			{
				if(dp[i-1][j-v2[i]]+1>=dp[i][j])
				{
					dp[i][j]=dp[i-1][j-v2[i]]+1;
					pre[i][j]=mp(i-1,j-v2[i]);
				}
				if(dp[i][j-v2[i]]+1>=dp[i][j])
				{
					dp[i][j]=dp[i][j-v2[i]]+1;
					pre[i][j]=mp(i,j-v2[i]);
				}
			}
		}
	}
	x=m-1;
	y=n;
	pii pi;
	while(x!=0||y!=0)
	{
		if(pre[x][y].se!=y)
			printf("%d",v1[x]);
		pi=pre[x][y];
		x=pi.fi;
		y=pi.se;
	}
	return 0;
}

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

const int dx[]={-1,0,1,-1,1,-1,0,1};
const int dy[]={-1,-1,-1,0,0,1,1,1};
int H,W;
char fld[1001][1001];
bool used[1000][1000];
int f(int z){
    int y=z/W,x=z%W;
    int ret=0;
    for(int d=0;d<8;d++){
        int ty=y+dy[d],tx=x+dx[d];
        if(ty<0||ty>=H||tx<0||tx>=W)continue;
        if(fld[ty][tx]=='.')ret++;
    }
    return ret;
}

int main(){
    scanf("%d%d",&H,&W);
    for(int i=0;i<H;i++)scanf("%s",fld[i]);

    vector<int>V[2];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(fld[i][j]=='.')continue;
            if(f(i*W+j)>=(fld[i][j]-'0')){
                V[0].push_back(i*W+j);
                used[i][j]=true;
            }
        }
    }

    for(int i=0;;i++){
        if(V[i&1].size()==0){
            printf("%d\n",i);
            break;
        }
        for(int j=0;j<V[i&1].size();j++){
            int y=V[i&1][j]/W,x=V[i&1][j]%W;
            fld[y][x]='.';
            for(int d=0;d<8;d++){
                int ty=y+dy[d],tx=x+dx[d];
                if(ty<0||ty>=H||tx<0||tx>=W)continue;
                if(used[ty][tx]||fld[ty][tx]=='.')continue;
                if(f(ty*W+tx)>=(fld[ty][tx]-'0')){
                    used[ty][tx]=true;
                    V[(i+1)&1].push_back(ty*W+tx);
                }
            }
        }

        V[i&1].clear();
    }
    return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <algorithm>

using namespace std;

const int X = 100;

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

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

    int ans = 1e6;
    for (int i = 1; i <= X; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cur += (x[j] - i) * (x[j] - i);
        }
        ans = min(ans, cur);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}
template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int R;
  cin >> R;
  long double ans = 2 * R * M_PI;
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

Measured memory_bytes: 3788
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int a, b;
	cin >> a >> b;
	cout << max(0, a - b) << endl;
	//printf((a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) ? "Possible\n" : "Impossible\n");
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        int c = 0;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == 'o') c++;
        }
        System.out.println(c >= s.length() - 7 ? "YES" : "NO");
        scan.close();
    }
}


Measured memory_bytes: 26704
#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, d;
  cin >> n >> d;
  cout << (2 * d + n) / (2 * d + 1);
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int N;
int dp[100007];

int main(){
  cin >> N;
  dp[0] = 0;
  REP(i, N){
    dp[i+1] = dp[i] + 1;
  }
  for(int i = 6; i <= N; i*=6){
    REP(j, N-i+1){
      dp[j+i] = min(dp[j+i], dp[j]+1);
    }
  }
  for(int i = 9; i <= N; i*=9){
    REP(j, N-i+1){
      dp[j+i] = min(dp[j+i], dp[j]+1);
    }
  }
  cout << dp[N] << endl;
  
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iomanip>
#include<map>
#include<cstring>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vi>
const int INF = int(1e9);
typedef long long int ll;
/* -- template -- */

int main(){
    ll N, x; cin >> N >> x;
    ll a[N];rep(i, N)cin >> a[i];
    ll ans = 0;
    rep(i, N - 1){
        if(a[i] + a[i + 1] > x){
            ll c = a[i] + a[i + 1] - x;
            if(a[i + 1] >= c){
                a[i + 1] -= c;
                ans += c;
            }else{
                a[i + 1] = 0;
                ans += c;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const int INF = 1 << 30;

int c[26];
int t[365];
int s[365][26];
int last[26];

int main() {
	int d;
	cin >> d;
	for (int i = 0; i < 26; i++)
		cin >> c[i];
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < 26; j++) {
			cin >> s[i][j];
		}
	}
	for (int i = 0; i < d; i++) {
		cin >> t[i];
		t[i]--;
	}

	int sum = 0;
	for (int i = 0; i < d; i++) {
		sum += s[i][t[i]];
		last[t[i]] = i + 1;
		for (int j = 0; j < 26; j++) {
			sum -= c[j] * (i + 1 - last[j]);
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3568
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut dp = vec![1; n+1];
    for _ in 0..m {
        let a: usize = sc.read();
        dp[a] = 0;
    }
    for i in 2..n+1 {
        if dp[i] == 0{
            continue
        } else {
            dp[i] = (dp[i-1]+dp[i-2]) % 1_000_000_007;
        }
    }
    println!("{}", dp[n]);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
    static final int RIGHT = 1;
    static final int LEFT = 0;
    static final char NULL = '\0';

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        while (true) {
            String tmp = sc.next();
            if (tmp.equals("#"))
                break;
            char inps[] = tmp.toCharArray();
            int hand = -1;
            int ans = 0;
            for (int i = 0; i < inps.length; i++) {
                switch (inps[i]) {
                case 'y':
                case 'u':
                case 'i':
                case 'o':
                case 'l':
                case 'k':
                case 'j':
                case 'p':
                case 'h':
                case 'm':
                case 'n':
                    if (hand == LEFT) {
                        hand = RIGHT;
                        ans++;
                    } else
                        hand = RIGHT;
                    break;
                case 'q':
                case 'w':
                case 'e':
                case 'r':
                case 't':
                case 'a':
                case 's':
                case 'd':
                case 'f':
                case 'g':
                case 'z':
                case 'x':
                case 'c':
                case 'v':
                case 'b':
                    if (hand == RIGHT) {
                        hand = LEFT;
                        ans++;
                    } else
                        hand = LEFT;
                    break;
                }
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 12000
import java.util.Scanner;

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

		int dd = n / (2 * d + 1);
		if(n % (2 * d + 1) != 0)
			dd++;

		System.out.println(dd);
	}
}


Measured memory_bytes: 22612
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int x,a,b;
  cin >> x >> a >> b;

  cout << (x - a) % b;


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

long long l,r,i,j,s;

int main()
{
	s=2021;
	cin>>l>>r;
	for(i=l;i<=r;i++)
		for(j=i+1;j<=r;j++)
		{
			if(i%2019==0 || j%2019==0)
			{
				cout<<'0';
				return 0;
			}
			if(i*j%2019<s)
				s=i*j%2019;
			if(s==0)
			{
				cout<<s;
				return 0;
			}
		}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ab = []
cd = []
for i in range(N):
    a, b = map(int, input().split())
    ab.append([a, b])

for i in range(M):
    c, d = map(int, input().split())
    cd.append([c, d])

for i in range(N):
    m_min = 100000000000
    i_min = -1
    for j in range(M):
        m = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if m < m_min:
            m_min = m 
            i_min = j
    print(i_min+1)



Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 

using namespace std;

int main() {
	//string matrix[100];
	char matrix[100][100];
	int matrix2[100][100] = { 0 };
	int i, j, k;
	int h, w;

	cin >> h >> w;

	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			cin >> matrix[i][j];
		}
	}

	/*
	for (i = 0; i < h; i++) {
		//matrix[i][matrix[i].length()] = 'b';
		matrix[i][w] = 'b';
	}

	for (i = 0; i <= w; i++) {
		matrix[h][i] = 'b';
	}
	*/

	int cnt = 0;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			cnt = 0;

			if (i>=1 && matrix[i - 1][j] == '#') {
				cnt++;
			}
			if (i >= 1 && matrix[i - 1][j+1] == '#') {
				cnt++;
			}
			if (matrix[i][j+1] == '#') {
				cnt++;
			}
			if (matrix[i + 1][j+1] == '#') {
				cnt++;
			}
			if (matrix[i + 1][j] == '#') {
				cnt++;
			}
			if (j >= 1 && matrix[i + 1][j-1] == '#') {
				cnt++;
			}
			if (j >= 1 && matrix[i ][j-1] == '#') {
				cnt++;
			}
			if (i >= 1 && j >= 1 && matrix[i - 1][j-1] == '#') {
				cnt++;
			}

			matrix2[i][j] = cnt;
		}
	}


	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (matrix[i][j] == '#') {
				cout << "#";
			}
			else {
				cout << matrix2[i][j];
			}
		}
		cout << endl;
	}







	return 0;
}

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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;

typedef double number;
typedef valarray<number> point;
const int dim = 3;

number dot(const point& a, const point& b) {
	return (a * b).sum();
}
point cross(const point& a, const point& b) {
	return a.cshift(+1)*b.cshift(-1)
		- a.cshift(-1)*b.cshift(+1);
}
number dist2(const point& a, const point& b) {
	return dot(a - b, a - b);
}

struct min_ball {
	point center;
	number radius2;
	void add(const point& p) {
		ps.push_back(p);
	}
	void compile() {
		m = 0;
		center.resize(dim, 0);
		radius2 = -1;
		make_ball(ps.end());
	}
	template <class OUT>
	void support(OUT out) {
		copy(ps.begin(), supp_end, out);
	}
	min_ball() {
		for (int i = 0; i <= dim; ++i) {
			c[i].resize(dim, 0);
			v[i].resize(dim, 0);
		}
	}
private:
	list<point> ps;
	list<point>::iterator supp_end;
	int m;
	point v[dim + 1], c[dim + 1];
	number z[dim + 1], r[dim + 1];
	void pop() { --m; }
	void push(const point& p) {
		if (m == 0) {
			c[0] = p; r[0] = 0;
		}
		else {
			number e = dist2(p, c[m - 1]) - r[m - 1];
			point delta = p - c[0];
			v[m] = p - c[0];
			for (int i = 1; i < m; ++i)
				v[m] -= v[i] * dot(v[i], delta) / z[i];
			z[m] = dot(v[m], v[m]);
			c[m] = c[m - 1] + e * v[m] / z[m] / 2.0;
			r[m] = r[m - 1] + e * e / z[m] / 4.0;
		}
		center = c[m];
		radius2 = r[m]; ++m;
	}
	void make_ball(list<point>::iterator i) {
		supp_end = ps.begin();
		if (m == dim + 1) return;
		for (list<point>::iterator k = ps.begin(); k != i; ) {
			list<point>::iterator j = k++;
			if (dist2(*j, center) > radius2) {
				push(*j); make_ball(j); pop();
				move_to_front(j);
			}
		}
	}
	void move_to_front(list<point>::iterator j) {
		if (supp_end == j) ++supp_end;
		ps.splice(ps.begin(), ps, j);
	}
};

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


	min_ball b;



	REP(i, n) {
		double a, aa;
		cin >> a >> aa;
		b.add({ a, aa });
	}

	b.compile();

	cout << fixed << setprecision(15) << sqrt(b.radius2) << endl;



}

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

using namespace std;

#define vv vector< vector< int > >
#define ll long long
#define ALL(a) (a).begin(), (a).end()
const long long mod = 1000000000 + 7;
const long long INF = 9e18;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b){if (b == 0) return a;return gcd(b, a % b);}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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


int main(){
    string S;
    cin >> S;
    int a, z;
    a = S.find('A');
    z = S.rfind('Z');
    cout << z - a + 1 << endl;
    return 0;
}




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


int main()
{
    std::ios_base::sync_with_stdio(0);	
    cin.tie(0);
    cout.tie(0);
    
    ll n,D,A;
    cin>>n>>D>>A;
    
    vector<pair<ll,ll>> arr;
    vector <ll> vec;
    for(ll i=0;i<n;i++)
    {
		arr.push_back({0,0});
		cin>>arr[i].first>>arr[i].second;
		vec.push_back(arr[i].first);
	}
	sort(arr.begin(),arr.end());
	sort(vec.begin(),vec.end());
	ll cost[n];
	
	for(ll i=0;i<n;i++)
	{
		cost[i] = 0;
	}
	
	ll ans = 0;
	ll cur = 0;
	ll ed = 0;
	for(ll i=0;i<n;i++)
	{
		ll d =  ceil(arr[i].second/(A+0.0L));
		if(i!=0)
		{
			cost[i]+=cost[i-1];
		}
		//cout<<ed<<" "<<cur<<" "<<cost[i]<<" "<<d<<endl;
		
		if(ed>=arr[i].first)
		{
			if(cost[i]<d)
			{
				ed = arr[i].first+2*D;
				ans += d-cost[i];
				ll it = upper_bound(vec.begin(),vec.end(),ed)-vec.begin();
				if(it!=vec.size())
				{
					cost[it]-=(d-cost[i]);
				}
				cost[i] = d;
				
			}
		}
		else
		{
			ed  = arr[i].first+2*D;
			cost[i] = 0;
			ll it = upper_bound(vec.begin(),vec.end(),ed)-vec.begin();
			if(it!=vec.size())
			{
				cost[it]-=(d-cost[i]);
			}
			cost[i] = d;
			ans+=d;
			
		}
	}
	cout<<ans;
}


Measured memory_bytes: 9836
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int arr[5],i;
    for(i=0;i<5;i++)
    {
        scanf("%d",&arr[i]);

    }
     for(i=0;i<5;i++){
         if(arr[i]==0)
         {
             break;
         }
     }
     cout<<i+1<<endl;

    return 0;
}


Measured memory_bytes: 3708
import math
def intpow(X):
    return int(X*1.01)

X = int(input())

ans = math.ceil((math.log(X)-2*math.log(10))/math.log(1.01))

# X0 = 100
Xn = 100
for i in range(ans):
    Xn = int(Xn*1.01)
    # print(Xn)

while X > Xn:
    Xn = int(Xn*1.01)
    ans += 1

print(ans)

Measured memory_bytes: 9316
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	if( s == "ABC" ) cout << "ARC" << endl;
	else cout << "ABC" << endl;
	
	return 0;
}


Measured memory_bytes: 3600
W = int(input());#list(map(int, input().split()))
N = int(input());#list(map(int, input().split()))

field=[[-1 for i in range(W)] for j in range(N)]

for i in range(N):
	a,b=list(map(int, input().split(',')))
	field[i][a-1]=b-1;
	field[i][b-1]=a-1;

result=[0 for i in range(W)];
for i in range(W):
	now=i;
	for j in range(N):
		if(field[j][now]!=-1):
			now=field[j][now];
	result[now]=i+1;

for i in result:
	print(i);


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

int main(int , char *[])
{
int a[10];
int b[10];
for(int i=0;i<10;i++)
{
cin>>a[i];
for(int j=0;j<10;j++)
{
if(a[i]>b[j])
{
for(int k=10-j;k>0;k--)
{
b[j+k]=b[j+k-1];
}
b[j]=a[i];
break;
}
}
}
for(int n=0;n<3;n++)
{
cout<<b[n]<<endl;
}
return 0;
}

Measured memory_bytes: 0
n = gets.to_i
array = gets.split(" ").map(&:to_i)
b = []
for i in 0..array.length-1
#   puts "#{array[i] - (i+1)} - b"
  b << array[i] - (i+1)
end
b.sort!
if b.length % 2 != 0
  bb = b[b.length / 2]
else
  bb = (b[b.length / 2] + b[(b.length / 2) - 1]) / 2
end

sum = 0
for i in 0..array.length-1
  sum += (array[i] - (bb + (i + 1))).abs
end
puts sum

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

int main() {
 int K,N;
  cin >> K >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
   cin >>A.at(i); 
  }
  int x = 0;
    for (int i = 0;i<N-1;i++){
      int s =A.at(i+1) - A.at(i);
     x = max (x,s); 
    }
	int p = (A.at(0)+K) - A.at(N-1);
	x = max(x,p);
	cout << K - x <<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;

map<ll, ll> prime_factor(ll n)
{
  map<ll, ll> res;
  for (ll i=2; i*i<=n; i++) {
    while (n%i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

int main()
{
  ll n;
  cin >> n;
  map<ll, ll> mp = prime_factor(n);
  ll ans = 0;
  for (auto v:mp) {
    ll esum = v.second;
    ll step = 1;
    while (esum >= step) {
      esum -= step;
      ans++;
      step++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
#define MOD 1000000007
using namespace std;
using ll=int64_t;
using pii=pair<int,int>;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
//最大公約数
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
//最小公倍数
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
bool prime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)
        return false;
    }
    return true;
}
int main(){
    int n,ac=0,wa=0,tle=0,re=0;
    cin>>n;
    vis s(n);
    rep(i,n)
    cin>>s.at(i);
    rep(i,n){
        if(s.at(i)=="AC")
        ++ac;
        if(s.at(i)=="WA")
        ++wa;
        if(s.at(i)=="TLE")
        ++tle;
        if(s.at(i)=="RE")
        ++re;
    }
    cout<<"AC"<<' '<<'x'<<' '<<ac<<endl;
    cout<<"WA"<<' '<<'x'<<' '<<wa<<endl;
    cout<<"TLE"<<' '<<'x'<<' '<<tle<<endl;
    cout<<"RE"<<' '<<'x'<<' '<<re<<endl;
}

Measured memory_bytes: 6424
n = gets.to_i
p_a = gets.chomp.split
diff_count = 0
n.times do |i|
    p_a[i] = p_a[i].to_i
    diff_count += 1 if i + 1 != p_a[i]
    break if diff_count > 2
end
puts diff_count <= 2 ? "YES" : "NO"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
string a;
cin>>a;
if(a.size()<7){
cout<<"NO";
return 0;
}
else if(a.size()==7){
	if(a!="keyence"){
		cout<<"NO";
	}
	else{
		cout<<"YES";
	}
	return 0;
}
int t=a.size()-7;
string c="keyence";
int j=0;
for(int i=0;i<7;i++)
{
	if(c[j]!=a[i]){
	string d=a.substr(0,i);
	d+=a.substr(i+t,a.size()-(i+t));
	if(c!=d)
	{
		cout<<"NO";
		return 0;
	}
	else
	{
		cout<<"YES";
		return 0;
	}

}
	j++;
}
cout<<"YES";
}

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

int main()
{
    int h, a;
    cin >> h >> a;

    int ans = 0;
    if (h % a != 0)
        ans = h / a + 1;
    else
        ans = h / a;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import re

n = int(input())
for _ in range(n):
    dataset = input()
    stage = 1
    while (re.match('\[[0-9]+\]', dataset) is None):
        iterator = re.finditer('\[([0-9]+\]\[)+[0-9]+\]', dataset)
        minimum_votes = []
        for i, match in enumerate(iterator):
            areas = list(map(int, match.group()[1:-1].split('][')))
            minimum_areas = sorted(areas)[:len(areas)//2 + 1]
            if stage == 1:
                minimum_voters = [m // 2 + 1 for m in minimum_areas]
                minimum_vote = sum(minimum_voters)
            else:
                minimum_vote = sum(minimum_areas)
            minimum_votes.append(str(minimum_vote))
            dataset = dataset.replace(match.group(), str(-i-1), 1)
        for i, minimum_vote in enumerate(minimum_votes):
            dataset = dataset.replace(str(-i-1), minimum_vote, 1)
        stage += 1
    print(dataset[1:-1])


Measured memory_bytes: 7168
#include <cstdio>

typedef long long LL;

LL N, A, B;

int main() {
	scanf("%lld%lld%lld", &N, &A, &B);
	if ((B - A) % 2 == 0) printf("%lld\n", (B - A) / 2);
	else printf("%lld\n", (B - A - 1) / 2 + (A - 1 < N - B ? A : N - B + 1));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

// get<K>(tuple型の変数)

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


const long double pi = acos(-1);
const long double eps = 0.000000001;

long double a, b, x;

long double f(long double theta){
    if(theta > pi / 2.0 - eps) return 0;
    if(theta < eps) return a*a*b;
    if(a*tan(theta) <= b) return a * a * b - a * a * a * tan(theta) / 2;
    else return a * b * b / tan(theta) / 2;
}

void input(){
    cin >> a >> b >> x;
}

void solve(){
    input();
    long double ok = pi / 2.0;
    long double ng = 0.0;
    for(int _=0; _<100000; ++_){
        long double mid = (ok + ng) / 2.0;
        (f(mid) < x? ok:ng) = mid;
    }
    cout << setprecision(13) << ok * 180 / pi << endl;
}

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

    solve();
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int c,q,i,j,z=0,k=1,m[1001][1001]={0},e[6][2]={0};
  for(i=0;i<6;i++){
    cin>>q>>c;
    if(q>c)m[q][c]++;
    else m[c][q]++;
  }
  for(i=0;i<1001;i++)for(j=0;j<1001;j++){
    if(m[i][j]){
      if(m[i][j]==4){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;}
      else if(m[i][j]==6){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;}
      else{ e[z][0]=i;e[z++][1]=j;}
    }
  }
  if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1])k=0;
  if(k)cout<<"yes"<<endl;
  else cout<<"no"<<endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> x(N);
  int S=0;
  for (int i=0; i<N; i++)
    cin >> x.at(i);
  for (int i=0; i<N; i++) {
    if (K >= 2*x.at(i))
      S=S+2*x.at(i);
    else
      S=S+2*(K-x.at(i));
  }
  cout << S << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
int N,Z,W;
int a[100010];
int main(){
    cin>>N>>Z>>W;
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    if(N>=2){
        cout<<max(abs(a[N-1]-a[N-2]),abs(W-a[N-1]));
    }else{
        cout<<abs(W-a[N-1]);
    }
    return 0;
}

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

using namespace std;

long long a[1005];

int main() {
  int n;
  cin >> n;
  long long sum0 = 0, sum1 = 0;
  for (int ni = 0; ni < n; ni++) {
    cin >> a[ni];
    if (a[ni] > 0) {
      if (ni % 2 == 0) {
        sum0 += a[ni];
      } else {
        sum1 += a[ni];
      }
    }
  }
  long long val;
  vector<int> ans;
  if (sum0 <= 0 && sum1 <= 0) {
    int maxi = 0;
    for (int ni = 1; ni < n; ni++) {
      if (a[ni] > a[maxi]) {
        maxi = ni;
      }
    }
    val = a[maxi];
    for (int i = n - 1; i > maxi; i--) {
      ans.push_back(i);
    }
    for (int i = 0; i < maxi; i++) {
      ans.push_back(0);
    }
  } else {
    int st;
    if (sum0 >= sum1) {
      val = sum0;
      st = 0;
    } else {
      val = sum1;
      st = 1;
    }
    int fi = -1, li = -1;
    for (int ni = st; ni < n; ni += 2) {
      if (a[ni] > 0) {
        if (fi == -1) fi = ni;
        li = ni;
      }
    }
    for (int i = n - 1; i > li; i--) {
      ans.push_back(i);
    }
    for (int i = 0; i < fi; i++) {
      ans.push_back(0);
    }
    int offset = 0;
    for (int i = fi + 2; i < li; i += 2) {
      if (a[i] <= 0) {
        ans.push_back(i - offset - fi);
        offset += 2;
      }
    }
    for (int i = fi + 1; i < li - offset; i += 2) {
      ans.push_back(1);
    }
  }
  cout << val << endl;
  cout << ans.size() << endl;
  for (int x : ans) {
    cout << x + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll a;
    cin >> a;
    cout << a + a*a + a*a*a;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
int n;
set<int> s;
/**********************************************/

int main(){
    cin >> n;
    REP(i, n){
        int x;
        cin >> x;
        s.insert(x);
    }

    cout << s.size() << endl;


}


Measured memory_bytes: 256