akhauriyash/Code-Regression huggingface dataset:
using namespace std;
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cassert>
#define N 1000010
int n;
char str[N];
int cnt[3],p[3],re[3];
void adjust(int &A,int &B,int &C){
	memset(cnt,0,sizeof cnt);
	for (int i=1;i<=n;++i)
		cnt[str[i]-'A']++;
	for (int i=0;i<3;++i)
		p[i]=i;
	for (int i=0;i<3;++i)
		for (int j=1;j<3;++j)
			if (cnt[p[j-1]]<cnt[p[j]])
				swap(p[j-1],p[j]);
	for (int i=0;i<3;++i)
		re[p[i]]=i;
	for (int i=1;i<=n;++i)
		str[i]=re[str[i]-'A']+'A';
	A=cnt[p[0]],B=cnt[p[1]],C=cnt[p[2]];
}
struct LIST{
	LIST *pre,*suc;
	char c;
} s[N];
void erase(LIST *p){
	p->pre->suc=p->suc;
	p->suc->pre=p->pre;
}
bool BAC(LIST *p){return p->c=='A' && p->pre->c!=p->suc->c;}
bool BAB(LIST *p){return !p->pre->c || !p->suc->c || p->pre->c==p->suc->c;}
int main(){
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	scanf("%s",str+1);
	n=strlen(str+1);
	int tmp=0;
	for (int i=1;i<=n;++i)
		if (str[i]!=str[i-1])
			str[++tmp]=str[i];
	n=tmp;
	str[n+1]=0;
	int A,B,C;
	adjust(A,B,C);
	if (C==0)
		return 0;
//	printf("%s\n",str+1);
	s[0].suc=&s[1];
	s[n+1].pre=&s[n];
	for (int i=1;i<=n;++i)
		s[i]={&s[i-1],&s[i+1],str[i]};
	for (LIST *p=s[0].suc;p!=&s[n+1] && A>B;p=p->suc)
		if (BAC(p)){
			A--;
			erase(p);			
		}	
//	for (LIST *p=s[0].suc;p!=&s[n+1];p=p->suc)
//		putchar(p->c);
//	printf("\n");
	int z=B+C-A;
	int neB=B-z,neC=C-z;
	for (LIST *p=s[0].suc;p!=&s[n+1];p=p->suc){
		if (BAB(p)){
//			for (LIST *p=s[0].suc;p!=&s[n+1];p=p->suc)
//				putchar(p->c);
//			printf("\n");
			if (p->c=='A'){
				if ((p->pre->c|p->suc->c)=='B')
					{if (neB) erase(p->pre->c?p->pre:p->suc),erase(p),neB--;}
				else
					{if (neC) erase(p->pre->c?p->pre:p->suc),erase(p),neC--;}
			}
			else if ((p->pre->c|p->suc->c)=='A'){
				if (p->c=='B')
					{if (neB) erase(p->pre->c?p->pre:p->suc),erase(p),neB--;}
				else
					{if (neC) erase(p->pre->c?p->pre:p->suc),erase(p),neC--;}
			}
		}
	}
	for (LIST *q=s[0].suc;q!=&s[n+1];q=q->suc)
		putchar(p[q->c-'A']+'A');
	return 0;
}
	
	
	
	
	
	
	
	
	
	
	


Measured memory_bytes: 26056
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B, C, D;
	cin >> A >> B >> C >> D;

	int a = (C + B - 1) / B;
	int b = (A + D - 1) / D;

	if (a <= b)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;

    ll l = lcm(c, d);
    a--;
    ll x = b / c + b / d - b / l;
    ll y = a / c + a / d - a / l;
    cout << (b - a) - (x - y) << endl;

    return 0;
}


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



int main() 
{
  ll sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
  ll w=tx-sx,h=ty-sy;
  rep(i,w) cout<<"R";
  rep(i,h) cout<<"U";
  rep(i,w) cout<<"L";
  rep(i,h) cout<<"D";
  cout<<"D";
  rep(i,w+1) cout<<"R";
  rep(i,h+1) cout<<"U";
  cout<<"L";
  cout<<"U";
  rep(i,w+1) cout<<"L";
  rep(i,h+1) cout<<"D";
  cout<<"R";
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3544
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<ctime>
#define MAXN 200005
#define ll long long
#define maxn 15
#define maxs 1000005
#define inf (9e18)
#define eps 1e-9
using namespace std;
inline char gc() {
	static char now[1<<16],*S,*T;
	if (T==S) {
		T=(S=now)+fread(now,1,1<<16,stdin);
		if (T==S) return EOF;
	}
	return *S++;
}
inline ll readlong() {
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') {
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		x*=10;
		x+=ch-'0';
		ch=getchar();
	}
	return x*f;
}
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*=10;
		x+=ch-'0';
		ch=getchar();
	}
	return x*f;
}
void putint(long long t) {
	int ans[40]= {0};
	for(; t; t/=10)ans[++ans[0]]=t%10;
	for(; ans[0]; ans[0]--)putchar('0'+ans[ans[0]]);
	putchar('\n');
}
const int N=200005;
ll x;
int n;
ll ans=inf;
ll a[N];
int main(){
	n=read();
	x=readlong();
	for(int i=1;i<=n;i++){
		a[i]=readlong();
		a[i]+=a[i-1];
	}
	for(int k=1;k<=n;k++){
		ll num_xi=3ll;
		ll sum=0;
		for(int i=n;i>=1;i-=k){
			sum+=(a[i]-a[max(0,i-k)])*max(num_xi,5ll);
			num_xi+=2;
			if(sum>=ans){
				break;//防爆 
			}
		}
		ans=min(ans,sum+(ll)(k+n)*x);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n>>s;
    if(n%2==1){cout<<"No";return 0;}
    else{
        int m=n/2;
        string t=s.substr(0,m);
        string r=t+t;
        if(r==s){cout<<"Yes";}
        else{cout<<"No";}
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
const int INF = 1001001001;
int N,Q;
vector<vector<int>> graph;
vector<int> counter;
vector<ll> ans;
vector<bool> reached;

void dfs(int v, ll s){
    if(ans[v] >= 0) return;
    ans[v] = s+counter[v];
    for(auto e : graph[v]){
        dfs(e,ans[v]);
    }
}

int main(){
    cin >> N >> Q;
    graph.resize(N);
    counter.resize(N,0);
    ans.resize(N,-1);
    for(int i=0;i<N-1;i++){
        int x,y;
        cin >> x >> y;
        x--;y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    for(int i=0;i<Q;i++){
        int x,y;
        cin >> x >> y;
        x--;
        counter[x] += y;
    }
    dfs(0,0);
    for(int i=0;i<N;i++){
        cout << ans[i] << ' ';
    }
    cout << endl;
}



Measured memory_bytes: 21888
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define vii vector<int>
#define vll vector<long long>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vll a(n);
    rep(i, 0, n) cin >> a[i];
    int k = a[0];
    rep(i, 1, n) k = gcd(k, a[i]);
    vii ans;
    erep(x, 1, k) {
        bool flag = true;
        rep(i, 0, n) {
            if (a[i] % x != 0) flag = false;
        }
        if (flag) {
            ans.pb(x);
        }
    }
    rep(i, 0, ans.size()) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3164
import sys
sys.setrecursionlimit(10**8)
N=int(input())
G=[[] for i in range(N)]
E=[]
ans=[0]*(N-1)
for i in range(N-1):
  a,b=map(int,input().split())
  G[a-1].append((b-1,i))
  G[b-1].append((a-1,i))
s=[int(i) for i in input().split()]
n=[0]*N
visited=[False]*N
def size(x):
  res=1
  visited[x]=True
  for i,e in G[x]:
    if visited[i]:
      continue
    res+=size(i)
    E.append((e,x,i))
  n[x]=res
  return res
size(0)
#print(n)
flag=0
E.sort()
for i in range(N-1):
  e,a,b=E[i]
  if 2*n[b]==N:
    flag=e+1
    continue
  ans[e]=abs((s[a]-s[b])//(2*n[b]-N))
#print(ans,flag)
#print(E)
if flag:
  A=s[0]
  for i in range(N-1):
    A-=n[E[i][2]]*ans[i]
  ans[flag-1]=A//n[E[flag-1][2]]
for i in range(N-1):
  print(ans[i])

Measured memory_bytes: 185120
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

const int MAX = 200010;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

	COMinit();

	int N, M, K;

	cin >> N >> M >> K;
	int ans = 0;
	rep(i, 1, M)
	{
		ans +=i* (M - i)*N*N*COM(N*M - 2, K - 2);
		ans %= MOD;
	}
	rep(i, 1, N)
	{
		ans += i*(N - i)*M*M*COM(N*M - 2, K - 2);
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <math.h>

#define SIZE 3
#define ELEM 2

double array[SIZE * ELEM];

int main(int argc,char* argv[]){
  
  for(;;){
    int i, j;
    double xp, yp;
    double ans = 0, a_ans = 0;

    if(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
	  &array[0], &array[1],
	  &array[2], &array[3],
	  &array[4], &array[5],
	     &xp, &yp) == EOF){
      return 0;
    }
    
    //printf("ok %f %f\n", xp, yp);

    for(i = 0; i < SIZE; i++){
      array[i * ELEM + 0] -= xp;
      array[i * ELEM + 1] -= yp;
    }
    
    for(i = 0; i < SIZE; i++){
      const int next = (i + 1) % SIZE;
      double tmp = 0;

      tmp += array[i * ELEM + 0] * array[next * ELEM + 1];
      tmp -= array[i * ELEM + 1] * array[next * ELEM + 0];
      
      ans += tmp;
      a_ans += fabs(tmp);

      //printf("ans = %lf\n", ans);
    }

    printf("%s\n", (fabs(ans) == a_ans ? "YES" : "NO"));
  }
  
}

Measured memory_bytes: 612
import sys
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

list_1 = [a,b,c,d,e,k]

for i1 in reversed(range(5)):
    for i2 in reversed(range(i1-1)):
        ans = int(list_1[i1]) - int(list_1[i2])
        if ans > int(list_1[5]):
            print(":(")
            sys.exit()
        else:
            continue

print("Yay!")

Measured memory_bytes: 3064
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
# sys.setrecursionlimit(10000)
import sys,collections,math
sys.setrecursionlimit(100000)
a,b = sys.stdin.readline().split()
a = int(a)
b = float(b)
b = int(b*1000)
print(a*b//1000)


Measured memory_bytes: 9468
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int foo(string& s, int& i, map<string, int>& m) {
	i++;
	int sum = 0;
	for (;;) {
		if (s[i] == ')') {
			i++;
			return sum;
		}
		int x;
		if (s[i] == '(')
			x = foo(s, i, m);
		else {
			string t;
			if (s[i + 1] >= 'a' && s[i + 1] <= 'z') {
				t = s.substr(i, 2);
				i += 2;
			}
			else {
				t = s.substr(i, 1);
				i++;
			}
			x = (m.count(t) ? m[t] : -1);
		}
		int y = 1;
		if (s[i] >= '0' && s[i] <= '9') {
			y = s[i] - '0';
			i++;
			if (s[i] >= '0' && s[i] <= '9') {
				y = y * 10 + (s[i] - '0');
				i++;
			}
		}
		if (sum == -1 || x == -1) sum = -1;
		else sum += x * y;
	}
}

int main() {
	map<string, int> m;
	for (;;) {
		string s; cin >> s;
		if (s == "END_OF_FIRST_PART") break;
		int x; cin >> x;
		m[s] = x;
	}
	for (;;) {
		string s; cin >> s;
		if (s == "0") break;
		s = '(' + s + ')';
		int i = 0, x = foo(s, i, m);
		if (x == -1) cout << "UNKNOWN" << endl;
		else cout << x << endl;
	}
}

Measured memory_bytes: 1236
N,C=gets.split.map &:to_i
q=N.times.map{s,t,c=gets.split.map &:to_i;[[s-0.5,1,c],[t+0.5,0 ,c]]}.flatten(1).sort
sum=dbl=0
cnt=[0]*(C+1)
p q.each.map{|a,b,c|
  if b==1
    sum+=1
    cnt[c]+=1
    dbl += 1 if 1<cnt[c]
  else
    dbl -= 1 if 1<cnt[c]
    cnt[c]-=1
    sum-=1
  end
  sum-dbl
}.max


Measured memory_bytes: 30300
while True:
    n = int(input())
    
    if n==0:
        break
    
    clist = []
    for i in range(n):
        c = int(input())
        clist.append(c)
    
    klist = []
    for i in range(10):
        kosu = clist.count(i)
        klist.append(kosu)
    
    for i in range(10):
        if klist[i]>0:
            print('*'*klist[i])
        if klist[i]==0:
            print('-')


Measured memory_bytes: 5708
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int i,v;
		for(;;){
			int h = scan.nextInt();
			int w = scan.nextInt();
			if(h == 0 && w == 0)
				break;
			for(i = 1; i <= h; ++i){
				for(v = 1; v <= w; ++v){
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
	}
}	

Measured memory_bytes: 33808
#include <iostream>
#include <algorithm>
#include <cstdio>
#define MAX_N 50
using namespace std;

long long memo[MAX_N+1][MAX_N+1];

long long combination(int n, int r) {
    if(n == r || r == 0) return 1;
    if(memo[n][r] == -1) {
        memo[n][r] = combination(n-1, r-1) + combination(n-1, r);
    }
    return memo[n][r];
}

int main() {
    int N, A, B;
    long long v[MAX_N];
    cin >> N >> A >> B;
    for(int i=0; i<N; i++) cin >> v[i];
    sort(v, v+N, greater<long long>());
    double max_ave = 0;
    long long sum = 0;
    for(int i=0; i<A; i++) sum += v[i];
    max_ave = (double)sum / A;
    for(int i=0; i<=MAX_N; i++) for(int j=0; j<=MAX_N; j++) memo[i][j] = -1;
    long long comb;
    if(v[0] == v[A-1]) {
        int n = 0;
        for(int i=0; i<N; i++) {
            if(v[0] == v[i]) n++;
        }
        comb = 0;
        for(int r=A; r<=n && r<=B; r++) {
            comb += combination(n, r);
        }
    } else {
        int n = 0, r = 0;
        for(int i=0; i<N; i++) {
            if(v[A-1] == v[i]) {
                n++;
                if(i < A) r++;
            }
        }
        comb = combination(n, r);
    }
    printf("%.6f\n%lld\n", max_ave, comb);
    return 0;
}


Measured memory_bytes: 256
// Library
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

// TYPEDEFS
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

// CONSTANTS
#define SZA 0
#define SZB 0

// MACRO
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "unsafe" : "safe")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

#define F first
#define S second
#define PB push_back
#define MP make_pair


// Global Tables

//ull gPreProcess[SZA][SZB];

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    ull i, j; 
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vi& v)
{
    ull i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, ull N)
{
    ull i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
    ull i, j;
    for(i = 0; i < SZA; i++)
    {
        for(j = 0; j < SZB; j++)
        {
            break;
        }
        break;
    }
}

void TC(int t)
{
    int S, W;
    cin >> S >> W;
    cout << YN(W >= S) << endl;
}

// Main

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

    int T = 1, t;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


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

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

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

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

  string sa = "", sb = "";
  rep(i, b) sa += to_string(a);
  rep(i, a) sb += to_string(b);

  string res = (sa < sb) ? sa : sb;

  cout << res << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  priority_queue<int> A;
  for (int i = 0; i < N; ++i) {
    int memo;
    cin >> memo;
    A.push(memo);
  }
  
  for (int i = 0; i < M; ++i) {
    A.push(A.top() / 2);
    A.pop();
  }
  long long sum = 0;
  while (!A.empty()) {
    sum += A.top();
    A.pop();
  }
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    ll lb=-linf-1,ub=linf+1;
    while(ub-lb>1){
        ll x=(ub+lb)/2;
        ll cnt=0;
        rep(i,n-1){
            if(a[i]==0){
                if(x>=0)cnt+=n-1-i;
            }
            else if(a[i]>0){
                if(x>=0)cnt+=upper_bound(a.begin()+i+1,a.end(),x/a[i])-(a.begin()+i+1);
                else cnt+=upper_bound(a.begin()+i+1,a.end(),(x-a[i]+1)/a[i])-(a.begin()+i+1);
            }
            else{
                if(x>=0)cnt+=upper_bound(a.rbegin(),a.rend()-i-1,x/a[i],greater<ll>())-a.rbegin();
                else cnt+=upper_bound(a.rbegin(),a.rend()-i-1,(x+a[i]+1)/a[i],greater<ll>())-a.rbegin();
            }
        }
        if(cnt<k)lb=x;
        else ub=x;
    }
    cout<<ub<<endl;
}


Measured memory_bytes: 1792
n, k, q = gets.split.map(&:to_i)

arr = Array.new(n, k)
arr = arr.map { |a| a - q }

q.times { arr[gets.to_i - 1] += 1 }

arr.each do |a|
  puts (a > 0) ? 'Yes' : 'No'
end


Measured memory_bytes: 3964
#include<cstdio>
#include<algorithm>
#include<functional>

using namespace std;

int main(void)
{
	int pa[3],ju[2];
	int x,y,i;
	for(i=0;i<3;i++){
		scanf("%d",&pa[i]);
	}
	for(i=0;i<2;i++){
		scanf("%d",&ju[i]);
	}
	sort(pa,pa+3);
	sort(ju,ju+2);
	x=pa[0]+ju[0]-50;
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 1036
from collections import Counter
h = int(input())
if h == 1:
	print(1)
	exit()
a = list(map(int,input().split()))
t = Counter(a)
b = []
for i, j in t.most_common():
	if j == 1:
		b.append(i)
bset = set(a)


def sieve(n):
	ret = []
	divlis = [-1]*(n+1)  # 何で割ったかのリスト(初期値は-1)
	flag = [True]*(n+1)
	flag[0] = False
	flag[1] = False
	ind = 2
	while ind <= n:
		if flag[ind]:
			ret.append(ind)
			ind2 = ind**2
			while ind2 <= n:
				flag[ind2] = False
				divlis[ind2] = ind
				ind2 += ind
		ind += 1
	#何で割ったかのリストを取得したいとき, divlisも出力する
	return ret

"""
makediv 2
write defsieve first, we will use.
"""
import itertools
sievelist = sieve(1000)

def makediv_pfact(m):
	pf = {}
	cnt = 0
	st = len(sievelist)
	while m > 1 and cnt < st:
		pf_i = sievelist[cnt]
		while m%pf_i == 0:
			pf[pf_i] = pf.get(pf_i, 0) + 1
			m //= pf_i
		cnt += 1
	if m>1 : pf[m]=1
	return pf

def makediv(n):
	pfactdict = makediv_pfact(n)
	k = [range(atai+1) for atai in pfactdict.values()]
	returnlist = []
	for jousuu in itertools.product(*k):
		ans = 1
		for banme, kazu in enumerate(pfactdict.keys()):
			ans *= (kazu**jousuu[banme])
		returnlist.append(ans)
	
	#if you want to sort, just add this
	
	#ansl.sort()
	
	return returnlist

ans = 0
for i in b:
	t=makediv(i)
	t.remove(i)
	mode = 1
	for l in t:
		if l in bset:
			mode = 0
			break
	if mode:
		ans += 1
print(ans)

Measured memory_bytes: 149272
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n];
        long r = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            r += a[i];
        }

        long q = 0;
        long m = Long.MAX_VALUE;
        for (int i = 0; i < n - 1; i++) {
            q += a[i];
            r -= a[i];

            m = Math.min(m, Math.abs(q - r));
        }

        out.println(m);
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 44084
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <limits>
#include <math.h>
#include <cassert>

#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++)
#define INF 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    ll a, b, c, d;

    cin >> a >> b >> c >> d;
    ll A = max(a * c, a * d);
    ll B = max(b * c, b * d);
    cout << max(A, B) << endl;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;


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


unsigned long long lcm(unsigned long long a, unsigned long long b){
    unsigned long long g = gcd(a, b);

    return a/g*b;
}

int main(){
    int N;
    cin >> N;
    unsigned long long T[N];
    for(int i = 0; i < N; i++){
        cin >> T[i];
    }

    unsigned long long ans = 1uLL;
    for(int i = 0; i < N; i++){
        ans = lcm(ans, T[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

MAX = 10**9 + 7

def main():
  n = int(input())
  As = numpy.array([int(line) for line in input().strip().split()])
  counts = numpy.zeros(60)
  for i in range(60):
    counts[i] = numpy.sum((As >> i) % 2)
  print(int(sum([(n-count) * count * (2**i) % MAX for i, count in  enumerate(counts)])) % MAX)

if __name__=='__main__':
  main()

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

int n, m;
int t[502];
set<int> s;

int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    s.insert(x);
  }

  int c = 0;

  cin >> m;
  for(int i = 0; i < m; i++){
    int x;
    cin >> x;

    if(s.find(x) != s.end()){
      c++;
    }
  }

  cout << c << endl;
}

Measured memory_bytes: 3216
#include <stdio.h>
int main(){
	int data,i=0;
	double x1,y1,x2,y2,m1,m2;
	scanf("%d",&data);
	while(i<data){
		scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
		m1 = (y2-y1)/(x2-x1);
		scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
		m2 = (y2-y1)/(x2-x1);
		if(m1==m2) printf("YES\n");
		else printf("NO\n");
		i++;
	}
	return 0;
}

Measured memory_bytes: 620
#include <stdio.h>
#include <math.h>

int main(void) {
	int i,n;
	double x[100],y[100],max=0,d1=0,d2=0,d3=0;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%lf",&x[i]);
	for(i=0;i<n;i++) scanf("%lf",&y[i]);
	
	for(i=0;i<n;i++){
		d1 += fabs(x[i]-y[i]);
		d2 += pow(fabs(x[i]-y[i]),2);
		d3 += pow(fabs(x[i]-y[i]),3);
		if(max<fabs(x[i]-y[i])) max=fabs(x[i]-y[i]);
	}
	printf("%f\n%f\n%f\n%f\n",d1, sqrt(d2), cbrt(d3),max);
	
	return 0;
}

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

struct Point {
    ll x;
    ll y;
};

int main()
{
    int N, K;
    cin >> N >> K;
    Point p[N];
    ll X[N]; //ソート用に別途確保
    ll Y[N]; //同上
    rep(i, N) {
        ll x, y;
        cin >> x >> y;
        p[i].x = X[i] = x;
        p[i].y = Y[i] = y;
    }
    sort(X, X + N);
    sort(Y, Y + N);
    ll minArea = __LONG_LONG_MAX__;
    for (int x1 = 0; x1 < N; x1++) {
        ll l = X[x1];
        for (int y1 = 0; y1 < N - 1; y1++) {
            ll t = Y[y1];
            for (int x2 = x1; x2 < N; x2++) {
                ll r = X[x2];
                for (int y2 = y1; y2 < N; y2++) {
                    ll b = Y[y2];

                    int count = 0;
                    rep(i, N) {
                        if (p[i].x >= l && p[i].x <= r && p[i].y >= t && p[i].y <= b) {
                            count++;
                        }
                    }
                    if (count >= K) {
                        ll a = (r - l) * (b - t);
                        minArea = min(minArea, a);
                    }
                }
            }
        }
    }
    cout << minArea << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 *      purpose : ABC 84 D
 *      author  : kyomukyomupurin
 *      created : 2018-11-12 01:38:27
**/
 
#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'
 
bool isPrime(int N){
    if (N == 1) return false;
    else if (N == 2 || N == 3) return true;
    for (int i = 2; i * i <= N; ++i){
        if (N % i == 0) return false;
    }
    return true;
}
 
bool like2017(int N){
    if (isPrime(N) && isPrime((N + 1) / 2)) return true;
    else return false;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int Q; scanf("%d", &Q);
 
    bool t[100005] = {};
    for (int i = 3; i <= 100000; i += 2){
        if (like2017(i)) t[i] = true;
    }
 
    int cnt[100005] = {};
    cnt[1] = t[1];
 
    for (int i = 2; i <= 100000; ++i){
        cnt[i] = cnt[i - 1] + t[i];
    }
 
    for (int i = 0; i < Q; ++i){
      	int l, r; scanf("%d %d", &l, &r);
        print(cnt[r] - cnt[l - 1]);
    }
    
    return 0;
}

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

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

const int maxn = 2e5 + 10;


ll a[maxn], s[maxn], p[maxn];
map < ll , ll > num;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  for(int i = 1; i <= n; ++i) {
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }
  ll res = 0;
  for(int i = n; i >= 1; --i) {
    s[i] = s[i + 1] + a[i];
    num[s[i]] ++;
  }
  num[0] ++;
  for(int i = 1; i <= n; ++i) {
    num[s[i]] --;
    res += num[p[n] - p[i - 1]];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
ll a[1005];
int main()
{
    ll i,j,k,n,l,m,tc,a,b;
    cin>>n>>a>>b;
    if(abs(a-b)%2==0)
    {
        cout<<"Alice"<<endl;
    }
    else if(abs(a-b)%2!=0)
    {
        cout<<"Borys"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    lint dp[N+5][2]={};
    dp[0][0]=1000; 
    dp[0][1]=1000;
    for(int i=0;i<N;i++){
        dp[i+1][0]=max(dp[i+1][0],dp[i][0]);
        dp[i+1][0]=max(dp[i+1][0],(dp[i][1]/A[i])*A[i+1]+dp[i][1]%A[i]);
        dp[i+1][1]=max(dp[i+1][1],dp[i][1]);
        dp[i+1][1]=max(dp[i+1][1],(dp[i][0]/A[i])*A[i+1]+dp[i][0]%A[i]);
    }
    cout << dp[N-1][0] << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int v[105];

int main() {
   // freopen("a.in", "r", stdin);
 //  freopen("a.out", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++)
        cin >> v[i];
    int i = 1, nr = 1, sol = 0;
    while(i <= n) {
        while(v[i] == v[i + 1] && i < n) {
            i ++;
            nr ++;
        }
        sol += (nr / 2);
        i ++;
        nr = 1;
    }
    cout << sol;
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_i
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define EPS (1e-7)
#define INF (1e9)
#define MODI (1000000007)

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// dp[i][j] : コインをi枚使い、j枚が表である確率
// double dp[3001][3001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    // 入力、DP後、DP前
    vector<double> p(n), dpA(n + 1, 0), dpB(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    dpB[0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            // i-1回目で表の枚数がj-1で、i回目が表
            // i-1回目で表の枚数がjで、i回目が裏
            dpA[j] = dpB[j - 1] * p[i - 1] + dpB[j] * (1.0 - p[i - 1]);
        }
        dpB = dpA;
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans += dpB[i];
    }
    printf("%0.10f\n", ans);

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<map>
#include<cstring>
#include <stack>
#include <numeric>
#include<climits>
#include<cmath>
#include<set>
#include<unordered_set>
#include<iomanip>
#include<queue>
#include<unordered_map>
#define vi vector<float>
#define vl vector<long long>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define loop(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<float,float>
#define umap unordered_map<ll,float>
using namespace std;

#define xx first
#define yy second

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

// #ifndef ONLINE_JUDGE
// 	freopen("in.txt", "r", stdin);
// 	freopen("out.txt", "w", stdout);
// #endif

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

	int ans = 1e8;

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

	cout << ans << endl;








	return 0;
}










Measured memory_bytes: 256
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using llv = vector<ll>;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD7 = 1000000007;
	constexpr ll MOD9 = 1000000009;

	void reverse(string& s){
		reverse(all(s));
	}

	template<typename T>
	void init(vector<T>& v, T initVal = T()){
		for(auto& e : v){
			e = initVal;
		}
	}

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	void reverse(vector<T>& v){
		reverse(all(v));
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T1, typename T2>
	inline vector<T1>& operator+=(vector<T1>& v1, const vector<T2>& v2){
		for(const auto& e : v2) v1.push_back(e);
		return v1;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T1, typename T2>
	void in(vector<T1>& v1, vector<T2>& v2){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i];
	}
	template<typename T1, typename T2, typename T3>
	void in(vector<T1>& v1, vector<T2>& v2, vector<T3>& v3){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i] >> v3[i];
	}
	template<typename T1, typename T2, typename T3, typename T4>
	void in(vector<T1>& v1, vector<T2>& v2, vector<T3>& v3, vector<T4>& v4){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i] >> v3[i] >> v4[i];
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	template<typename T>
	inline set<T>& operator+=(set<T>& v, const T& e){
		v.insert(e);
		return v;
	}

	template<typename T1, typename T2>
	inline set<T1>& operator+=(set<T1>& v1, const set<T2>& v2){
		for(const auto& e : v2) v1.insert(e);
		return v1;
	}

	constexpr ll modPow(ll x, ll n, ll m){ // O(logn)
		if(n == 0) return 1;
		else if(n % 2 == 0) return modPow((x * x) % m, n / 2, m);
		else return x * modPow(x, n - 1, m) % m;
	}
}
using namespace atcoder;
#endif

bool f(const string& s){
	string tmp = s;
	reverse(tmp);
	return s == tmp;
}

int main(){
	cout << fixed << setprecision(15);
	
	double L;cin>>L;

	cout<<(L*L*L/27);
}


Measured memory_bytes: 256
using System;

    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var K = int.Parse(Console.ReadLine());
            var X = int.Parse(Console.ReadLine());
            var Y = int.Parse(Console.ReadLine());
            if(N<=K)
            {
                Console.WriteLine(N * X);
                return;
            }
            Console.WriteLine((K*X)+(N-K)*Y);
        }
    }

Measured memory_bytes: 11220
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e3+7;
const ll mod = 1e9+7;

int main()
{
    int x;cin>>x;
    for(int i=1;i<=9;i++){
        int y=i*111;
        if(y>=x){
            cout<<y<<endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
using namespace std;
int main(void){
    int h,w;
    cin>>h>>w;
    vector<vector<int>>a;
    a=vector<vector<int>>(h,vector<int>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a[i][j];
        }
    }
    int cnt=0;
    bool l_to_r=true;
    vector<pair<int,int>>f;
    vector<pair<int,int>>d;
    for(int i=0;i<h;i++){
        if(l_to_r){
            for(int j=0;j<w;j++){
                if(a[i][j]%2){
                    int next_y,next_x;
                    if(j==w-1){
                        next_y=i+1;
                        next_x=j;
                    }else{
                        next_y=i;
                        next_x=j+1;
                    }
                    if(next_y<h&&next_x<w){
                    a[next_y][next_x]++;
                    a[i][j]--;
                    f.push_back(make_pair(i+1,j+1));
                    d.push_back(make_pair(next_y+1,next_x+1));
                    l_to_r=false;
                    cnt++;
                    }
                }
            }
        }else{
            for(int j=w-1;j>=0;j--)
            {
                 if(a[i][j]%2)
                 {
                    int next_y,next_x;
                    if(j==0){
                        next_y=i+1;
                        next_x=j;
                    }else{
                        next_y=i;
                        next_x=j-1;
                    }
                    if(next_y<h&&next_x<w){
                    a[next_y][next_x]++;
                    a[i][j]--;
                    f.push_back(make_pair(i+1,j+1));
                    d.push_back(make_pair(next_y+1,next_x+1));
                    l_to_r=true;
                    cnt++;
                    }
                    }
            }
        }

    }
    cout<<cnt<<endl;
    for(int i=0;i<cnt;i++){
      cout<<f[i].first<<" "<<f[i].second<<" "<<d[i].first<<" "<<d[i].second<<endl;
    }
}

Measured memory_bytes: 5228
N = int(input())
A = [int(a) for a in input().split()]

ans_list = [0]*N
x = A[0]
for i in range(1, N-1):
    x += (-1)**i*A[i]
    
x += A[N-1]
ans_list[0] = str(x)
x //= 2
for i in range(N-1):
    x = A[i] - x
    ans_list[i+1] = str(2*x)
    
print(" ".join(ans_list))

Measured memory_bytes: 17224
#include <bits/stdc++.h>
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

/****************** グラフ ******************/
// 諸宣言
using Weight = lint;
using Flow = lint;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
    Edge(int s, int d, Weight w, Flow c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
    g[b].emplace_back(b, a, w, c);
}
void add_arc(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
}

// ワーシャルフロイド法 (O(V^3))
Matrix warshall_floyd(const Graph &g) {
    auto const INF = numeric_limits<Weight>::max() / 8;
    int n = g.size();
    Matrix d(n, Array(n, INF));
    repeat(i, n) d[i][i] = 0;
    repeat(i, n) for (auto &e : g[i]) d[e.src][e.dst] = min(d[e.src][e.dst], e.weight);
    repeat(k, n) repeat(i, n) repeat(j, n) {
        if (d[i][k] != INF && d[k][j] != INF) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }
    return d;
}

int main(void) {
    int h, w;
    cin >> h >> w;
    Graph g(10);
    repeat(i, 10) repeat(j, 10) {
        int c;
        cin >> c;
        if (i == j) continue;
        add_arc(g, i, j, c);
    }
    Matrix dist = warshall_floyd(g);
    
    lint ans = 0;
    repeat(i, h) repeat(j, w) {
        int a;
        cin >> a;
        if (a == -1 or a == 1) continue;
        ans += dist[a][1];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MaxN = 1e5;
typedef long long ll;

map <char, int> res;
map <int, char> ans;
char s[MaxN + 5];

int main()
{
	ll k;
	scanf("%s %lld", s+1, &k);
	int cnt = 0;
	for(char i = 'a';i <= 'z';i++){
		res[i] = ++cnt;
		ans[cnt] = i;
	}
	int len = strlen(s+1);
	for(int i = 1;i < len;i++){
		if(res[s[i]]+k >= 27 && s[i] != 'a'){
			k -= 27 - res[s[i]];
			s[i] = 'a';
		}
	}
	k = k%26;
	while(res[s[len]]+k > 26){
		k -= 26;
	}
	s[len] = ans[res[s[len]]+(k%26)];
	printf("%s\n", s+1);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(N), b(N);
  rep(i, N) cin >> a[i] >> b[i];
  vector<int> c(M), d(M);
  rep(i, M) cin >> c[i] >> d[i];

  rep(i, N) {
    int p;
    int D = INF;
    rep(j, M) {
      int temp = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (chmin(D, temp))
        p = j + 1;
    }
    cout << p << endl;
  }
}

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

  int n;
  vector <pair<int,int>> a;
  cin>>n;
  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    a.push_back(make_pair(x,y));
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++) cout<<a[i].first<<" "<<a[i].second<<endl;
  return 0;


}



Measured memory_bytes: 3812
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String secc = sc.next();
      	char[] sec = secc.toCharArray();
		for(int i = 1; i < 4; i++) {
			if (sec[i-1] == sec[i]) {
				count++;
            }
		}
		if (count == 0) {
			System.out.println("Good");
		}
		else {
			System.out.println("Bad");
		}
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define nl '\n'
#define INF 2147483647
#define si(i) scanf("%d", &i)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n;

int main(){
    cin >> n;
    cout << "Christmas";
    n = -( n - 25);
    while( n-- ){
        cout << " Eve";
    }
    cout << nl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut p: Vec<usize> = vec![];

    for _ in 0..n {
        let pi = read();
        p.push(pi);
    }
    let mut ans = 0;

    let mut continuous_cnt = 0;
    for i in 0..p.len() {
        let pi = p[i];
        // println!("pi:{}, cnt:{}", pi, continuous_cnt);
        if pi == i + 1 {
            ans += 1;
            continuous_cnt += 1;
        } else {
            continuous_cnt = 0;
        }
        if continuous_cnt % 2 == 0 && continuous_cnt > 0 {
            ans -= 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
const int M=10010;
long long n;
int a[255];
int main(){
    cin>>n;
    memset(a,0,sizeof(a));
    int i=0;
    while(n!=0){
        a[i]=n%(-2);
        n/=(-2);
        if(a[i]==-1)
        {
            a[i]=1;
            n++;
        }
        i++;
    }
    int j=i;
    while(j && a[j]==0)j--;
    for(; j>=0; j--)
    {
        printf("%d",a[j]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 256