akhauriyash/Code-Regression huggingface dataset:
import numpy as np
import itertools

h, w, k = list(map(int, input().split(' ')))

cells = []
for _ in range(h):
  cells.append(list(input()))
cells = np.asarray(cells)

n_choice = 0
for n_target_rows in range(h + 1):
  target_rows = list(itertools.combinations(range(h), n_target_rows))
  
  for n_target_clms in range(w + 1):
    target_clms = list(itertools.combinations(range(w), n_target_clms))
    
    for rows in target_rows:
      row_converted_cells = cells.copy()
      row_converted_cells[rows, :] = 'r' * w
      
      for clms in target_clms:
        clm_converted_cells = row_converted_cells.copy()
        clm_converted_cells[:, clms] = 'r'
        n_black = np.count_nonzero(clm_converted_cells == '#')
        
        if n_black == k:
          n_choice += 1
                    
print(n_choice)

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;

    ll ans = 0;
    if(A+B < C*2)
    {
        ans = A * X + B * Y;
    }
    else
    {
        if(X == Y)
        {
            ans = C * 2 * min(X, Y);
        }
        else
        {
            ans += C * 2 * min(X, Y);
            if(X < Y)
            {
                if( B < C * 2)
                {
                    ans += (Y - X) * B;
                }
                else
                {
                    ans += (Y-X) * C * 2;
                }
            }
            else
            {
                if( A < C * 2)
                {
                    ans += (X - Y) * A;
                }
                else
                {
                    ans += (X-Y) * C * 2;
                }
            }
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,flag=0;
	scanf("%d",&n);
	while(n>0)
	{
		int x=n%10;
		if(x==7)
		flag=1;
		n/=10;
	} 
	if(flag)
	printf("Yes\n");
	else
	printf("No\n");
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int A[100001] = {};

int main(){
    
    int i, x, y, N, Q;
    long ans = 0;
    cin >> N;
    
    for (i = 0; i < N; i++){
        
        cin >> x;
        A[x]++;
    }

    for (i = 0; i < 100001; i++){
        
        ans += i * A[i];
    }

    cin >> Q;
    
    for (i = 0; i < Q; i++){
        
        cin >> x >> y;
        
        ans += (y - x) * A[x];
        cout << ans << "\n";
        A[y] += A[x];
        A[x] = 0;
    }
        
    return 0;
}




Measured memory_bytes: 3540
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        a: [[u8; 3]; 3],
        n: u8,
        b: [u8; n],
    }

    if (b.contains(&a[0][0]) && b.contains(&a[0][1]) && b.contains(&a[0][2]))
        || (b.contains(&a[1][0]) && b.contains(&a[1][1]) && b.contains(&a[1][2]))
        || (b.contains(&a[2][0]) && b.contains(&a[2][1]) && b.contains(&a[2][2]))
        || (b.contains(&a[0][0]) && b.contains(&a[1][0]) && b.contains(&a[2][0]))
        || (b.contains(&a[0][1]) && b.contains(&a[1][1]) && b.contains(&a[2][1]))
        || (b.contains(&a[0][2]) && b.contains(&a[1][2]) && b.contains(&a[2][2]))
        || (b.contains(&a[0][0]) && b.contains(&a[1][1]) && b.contains(&a[2][2]))
        || (b.contains(&a[2][0]) && b.contains(&a[1][1]) && b.contains(&a[0][2]))
    {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2136
#include<stdio.h>
int main(void)
{ int A,B,C,D;
  scanf("%d",&A);
  scanf("%d",&B);
  if(A<B){
    C=B; B=B-1;
  }
  else{
    C=A; A=A-1;
  }
 if(A<B){
    C=C+B; B=B-1;
  }
  else{
    C=C+A; A=A-1;
  }
   
 printf("%d",C);
 return(0);
}

Measured memory_bytes: 128
// author:  Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    double pi=3.1415926;
    ll r=0;
    cin>>r;
    cout<<fixed<<setprecision(10)<<2*pi*r;
    return 0;
}


Measured memory_bytes: 3808
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n;
int a;
int main()
{
	cin>>n;
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		sum+=a-1;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long x= sc.nextLong();
		long t=100;
		long ans=0;
		while(x>t){
			t+=t/100;
			ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 27080
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    cout << (N * (N - 1)) / 2 + (M * (M - 1)) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define fi first
#define se second
#define endl '\n'

const int N = 3*1e5+5;

set<pii> s;
int r[N], c[N];
vector<pii> R, L;

bool cmp(pii a, pii b){
    return a.fi > b.fi;
}

int main(){

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int h, w, m, a, b; cin >>h >>w >>m;
    for(int i = 0; i<m; i++){
        cin >>a >>b;
        r[a]++; c[b]++;
        s.insert({a, b});
    }

    for(int i = 1; i<=h; i++){
        R.push_back({r[i], i});
    }
    for(int i = 1; i<=w; i++){
        L.push_back({c[i], i});
    }

    sort(R.begin(), R.end(), cmp);
    sort(L.begin(), L.end(), cmp);

    int ans = R[0].fi + L[0].fi - s.count({R[0].se, L[0].se});
    for(int i = 0; i<h; i++){
        for(int j = 0; j<w; j++){
            if(R[i].fi + L[j].fi > ans){
                ans = max(ans, R[i].fi + L[j].fi - (int) s.count({R[i].se, L[j].se}));
            }
            else break;
        }
    }

    cout <<ans <<endl;

    return 0;
}


Measured memory_bytes: 27992
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>
#include <utility>
#include <functional>
#include <complex>
using namespace std;

typedef complex<double> point;
const double INF = 1e10;
const double EPS = 1e-9;


double cross(point a,point b){
	return imag(conj(a)*b);
}

bool is_intersected(point a1,point a2,point b1,point b2){
	return (cross(a2-a1,b1-a1) * cross(a2-a1,b2-a1) < EPS and
	 	(cross(b2-b1,a1-b1) * cross(b2-b1,a2-b1) < EPS));
}

vector<point> circles_point(point c1,double r1,point c2,double r2){
	double d = abs(c1-c2);
	double s = (r1+r2+d) / 2;
	double S = sqrt(s*(s-r1)*(s-r2)*(s-d));
	double h = 2 * S / d;
	point v = (c2-c1) / (abs(c2-c1));

	double m = sqrt(r1*r1 - h*h);

	vector<point> ret;
	ret.push_back(c1 + m*v+h*v*point(0,1));
	ret.push_back(c1 + m*v-h*v*point(0,1));
	return ret;
}

int main(){
cout << fixed << setprecision(10);
 	int n;
 	while(cin>>n,n!=0){
		vector<vector<double> > dist(200,vector<double>(200,INF));

 		vector<int> x(n),y(n),r(n);
 		for(int i=0;i<n;i++){
 			cin>>x[i]>>y[i]>>r[i];
		}
		vector<point> ps(2*n);

		ps[0] = point(x[0],y[0]);
		ps.back() = point(x.back(),y.back());

		for(int i=0;i<n-1;i++){
			vector<point> ks = circles_point(point(x[i],y[i]),r[i],point(x[i+1],y[i+1]),r[i+1]);
			ps[2*i+1] = ks[0];
			ps[2*i+2] = ks[1];
			// ps[1],ps[2]
		}

 		for(int i=0;i<2*n;i++){
 			for(int j=i;j<2*n;j++){
 				if(i==j){
 					dist[i][i]=INF;
 				}else{
					int k = (i+1) / 2;
					int l = (j+1) / 2;

					bool ok = true;
					// ayasii
					for(int m=k+1;m<l;m++){
						if(not is_intersected(ps[2*m-1],ps[2*m],ps[i],ps[j])){
							ok = false;
						}
					}
					if(ok){
						dist[i][j]=dist[j][i]= abs(ps[i]-ps[j]);
					}else{
						dist[i][j]=dist[j][i]= INF;
					}
 				}
 			}
		}
		priority_queue<pair<double,int>,vector<pair<double,int> >,greater<pair<double,int> > > que;
		que.push(make_pair(0,0));
		vector<char> visited(2*n,false);
		double ans = INF;
		while(not que.empty()){
			double cost;
			int where;
			cost = que.top().first;
			where = que.top().second;
			que.pop();

			if(where == 2*n-1){
				ans = cost;
				break;
			}
			if(visited[where]) continue;
			visited[where] = true;
			for(int i=0;i<2*n;i++){
				que.push(make_pair(cost+dist[where][i],i));
			}
		}
		cout << ans << endl;
 	}

	return 0;
}

Measured memory_bytes: 3072
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int par[100];

void init(int N){
    rep(i,N) par[i] = -1;
}

int find(int a){
    if(par[a] < 0) return a;
    else{
        return par[a] = find(par[a]);
    }
}

void unite(int a, int b){
    a = find(a);
    b = find(b);
    if(a == b) return;
    else{
        if(par[a] > par[b]) swap(a,b);
        par[a] += par[b];
        par[b] = a;
    }
}

int size(int A) {
     return -par[find(A)];
}

bool same(int a, int b){
    return find(a) == find(b);
}

int main(){
    int N;
    cin >> N;
    int ans = 100;
    vector<int> x(N),y(N);
    rep(i,N) cin >> x[i] >> y[i];
    rep(i,N){
        rep(j,N){
            if(i == j) continue;
            init(N);
            int p = x[i]-x[j];
            int q = y[i]-y[j];
            rep(k,N){
                rep(l,N){
                    if(k == l) continue;
                    if(x[k]-x[l] == p && y[k]-y[l] == q){
                        unite(k,l);
                    }
                }
            }
            set<int> s;
            rep(k,N){
                s.insert(find(k));
            }
            int cnt = s.size();
            ans = min(ans,cnt);
        }
    }
    if(N == 1) ans = 1;
    cout << ans << endl;
}

Measured memory_bytes: 3616
#coding:utf-8
#import math
import fractions
from functools import reduce
n,k = map(int, input().split())
A = list(map(int, input().split()))
gcd = reduce(fractions.gcd, A)
if (min(A)<=k and k<=max(A) and k%gcd==0):
    print ("POSSIBLE")
else:
    print ("IMPOSSIBLE")

Measured memory_bytes: 16240
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<math.h>
#include<array>
#include<stdlib.h>

using namespace std;

int main(void){

    double R;
    cin >> R;

    cout << (double)(R * 2 * M_PI) << endl;

    return 0;
}

Measured memory_bytes: 3788
A=gets.to_i
B=gets.to_i
C=gets.to_i
X=gets.to_i
r=0
(0 .. A).each{|a|
    break if a*500>X
    (0 .. B).each{|b|
        c=(X-500*a-100*b)/50
        if c>=0 && c<=C
            r+=1
        end
    }
}
puts r


Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
    string s;
    cin >> s;

    int n = s.length();
    int sol = n;
    bool change = false;

    for(int i = 1; i < n; i++)
    {
        if (s[i-1] != s[i])
        {
            change = true;
            sol = min(sol,max(i,n-i));
        }
    }

    // if (!change && s[0] == '0')
    // {
    //     sol = 0;
    // }

    cout << sol << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, ll>;

struct Edge {
    int to;
    ll c;
};

ll solve() {
    const ll INF = 1LL<<60;
    ll N, M, L;
    cin >> N >> M >> L;
    vector<vector<ll>> C(N,vector<ll>(N, INF));
    int a,b;
    ll c;
    for ( int i = 0; i < M; i++ ) {
        cin >> a >> b >> c;
        a--, b--;
        C[a][b] = c;
        C[b][a] = c;
    }
    for ( int i = 0; i < N; i++ ) {
        C[i][i] = 0;
    }
    ll Q;
    cin >> Q;
    vector<ll> S(Q), T(Q);
    for ( int i = 0; i < Q; i++ ) {
        cin >> S[i] >> T[i];
        S[i]--, T[i]--;
    }

    for ( int i = 0; i < N; i++ ) {
        for ( int j = 0; j < N; j++ ) {
            for ( int k = 0; k < N; k++ ) {
                C[j][k] = min(C[j][k], C[j][i]+C[i][k]);
            }
        }
    }
    vector<vector<ll>> d(N,vector<ll>(N, INF));
    for ( int i = 0; i < N; i++ ) {
        for ( int j = 0; j < N; j++ ) {
            d[i][j] = C[i][j] <= L ? 1 : INF;
        }
    }
    for ( int i = 0; i < N; i++ ) {
        for ( int j = 0; j < N; j++ ) {
            for ( int k = 0; k < N; k++ ) {
                d[j][k] = min(d[j][k], d[j][i]+d[i][k]);
            }
        }
    }

    for ( int i = 0; i < Q; i++ ) {
        ll dd = d[S[i]][T[i]];
        ll ans = (dd == INF) ? -1 : dd-1;
        cout << ans << "\n";
    }
    return 0;
}

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

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

int main(){
  while(true){
    int n, x;
    cin >> n >> x;
    if(n == 0 && x == 0) return 0;
    int cnt = 0;
    for(int i = 1; i <= n - 1; i++){
      for(int j = i + 1; j <= n; j++){
        int k = x - i - j;
        if(k <= j || k > n) continue;
        else if(i + j + k == x) cnt++;
      }
    }
    cout << cnt << endl;
  }
}


Measured memory_bytes: 3104
#include<iostream>
using namespace std;
int main(){
    int a,b,c,q;
    cin >>a>>b>>c;
    q = 0;
    while(a <= b){
        if(c%a==0){
          q++;
          a++;
        }
        else{
            a++;
            continue;
        }
    }
    cout <<q<<"\n";
}

Measured memory_bytes: 3096
#include <iostream>
#include <climits>
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 5;
ll n,a,b,t;
ll h[maxn];
bool ok(ll mid)
{
	ll need = 0;
	for(ll i = 0;i < n; ++i)
	{
		need += (max(0ll,h[i] - b * mid) + t - 1ll) / t;
	}
	return need <= mid;
}
int main()
{
	cin>>n>>a>>b;
	t = a - b;
	for(ll i = 0;i < n; ++i)
	{
		cin>>h[i];
	}
	ll left = 0ll,right = INT_MAX;
	while(left + 1 < right)
	{
		ll mid = (left + right) >> 1;
		if(ok(mid))
		{
			right = mid;
		}
		else
		{
			left = mid;
		}
		// printf("left = %lld,right = %lld\n",left,right);
	}
	cout<<right<<endl;
	return 0;
}

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

#[allow(dead_code)]
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 d = read::<usize>();
    print!("Christmas");
    for i in 0..(25 - d) {
        print!(" Eve");
    }
    println!("");
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

const int N = 1e5+100;
typedef long long LL;

int n,k;
bool dp[N];
int a[N];  //dp[i] 表示当前剩余i块石头时是否是必胜态
//当dp[i] 是必胜态时当且仅当 i>=aj,dp[i-aj]为必败态

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>k;
    
    for(int i = 1; i<=n; i++) cin>>a[i];

    dp[0] = false;
    for(int i = 1; i<=k; i++){
        dp[i] = false;
        
        for(int j = 1; j<=n; j++){
            if(i >= a[j] && !dp[i-a[j]])
                dp[i] = true;
        }
    }
    
    if(!dp[k]) puts("Second");
    else puts("First");
    return 0;
}

Measured memory_bytes: 3144
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b,c,x,y = LI()
ans = 0
if a + b < 2*c:
    ans += (a + b)*min(x, y)
    if x > y:
        ans += (x-y)*a
    else:
        ans += (y-x)*b
else:
    ans += 2*c*min(x,y)
    if x > y:
        ans += (x-y)*min(a,2*c)
    else:
        ans += (y-x)*min(b,2*c)
print(ans)

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


long long solve(long long N, long long X){
    if(X==0) return 0;
    else if(X==1 && N==0) return 1;
    else if(X==0) return 0;
    else if(X<(1ll << (N+1)) -1)        return solve(N-1,X-1);
    else if(X == (1ll << (N+1))-1)      return 1ll << N;
    else if( (X<(1ll << (N+2)) -3) && (X>(1ll << (N+1))-1))        return (1ll << N)+solve(N-1,X-(1ll<<(N+1))+1);
    else return (1ll << (N+1))-1;
}



int main ()
{
    long long N,X;
    cin >> N >> X;
    cout << solve(N,X) << endl;
    return 0;
}








Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;

int main(){
   int n;
   cin >> n;
   int a;
   int shain[n] ={};
   REP(i,n-1){
      cin >> a;
      shain[a-1]++;
   }
   
   REP(i,n){
      cout << shain[i] << endl;
   }
   
   return 0;
}

Measured memory_bytes: 4420
*before, = map(int, input().split())
for cnt in range(1 << 10):
    A, B, C = before
    if 1 in [A % 2, B % 2, C % 2]:
        print(cnt)
        exit()
    a = A // 2
    b = B // 2
    c = C // 2
    after = b + c, a + c, a + b
    if before == after:
        print(-1)
        exit()
    before = after

Measured memory_bytes: 3064
import fractions
N = int(input())
aLst = list(map(int, input().split()))

lans = 0
llst = [0] * (N + 1)
rans = 0
rlst = [0] * (N + 1)

for i in range(N):
    lans = fractions.gcd(lans, aLst[i])
    llst[i + 1] = lans

for i in range(N - 1, -1, -1):
    rans = fractions.gcd(rans, aLst[i])
    rlst[i] = rans

ansMax = 0
for i in range(N):
    ansMax = max(ansMax, fractions.gcd(llst[i], rlst[i + 1]))

print(ansMax)


Measured memory_bytes: 16128
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a) memset((a),0,sizeof(a))
#define MCLR(a) memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
    int n,a;
    cin >> n;
    VI result(n, 0);

    REP(i, n){
        cin >> a;
        if(n % 2 == 0){
            if(i % 2 == 0){
                result[n/2 + i/2] = a;
            }else{
                result[n/2 - (i+1)/2] = a;
            }
        }else{
            if(i % 2 == 0){
                result[n/2 - i/2] = a;
            }else{
                result[n/2 + (i+1)/2] = a;
            }
        }
    }

    REP(i, n){
        cout << result[i] << (i+1==n ? "\n" : " ");
    }
}


Measured memory_bytes: 2944
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll N;
	
	cin >> N;

	
	ll start = ll(sqrt(N));
	
	if (start * start < N)
	{
		start++;
	}
	
	//cout << start << endl;
	for (ll i = start; i > 0; i--)
	{
		if (N % i == 0)
		{
			ll tmp = N / i;
			int di = 0;
			while(tmp)
			{
				tmp = tmp / 10;
				di++;
			}
			cout << di << endl;

			break;
		}
	}

	
	return 0;
}


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


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

    for (;;) {
        int N, Q; cin >> N >> Q;
        if (N == 0) break;
        vector<string> eraName(N);
        vi eraBasedYear(N), westernYear(N);
        REP(i, N) {
            cin >> eraName[i] >> eraBasedYear[i] >> westernYear[i];
        }
        while (Q--) {
            int query; cin >> query;
            string name;
            int year;
            REP(i, N) {
                if (query <= westernYear[i] and westernYear[i] - eraBasedYear[i] < query) {
                    name = eraName[i];
                    year = query - westernYear[i] + eraBasedYear[i];
                }
            }
            if (name.size()) {
                cout << name << " " << year << endl;
            } else {
                cout << "Unknown" << endl;
            }
        }
   }

    return 0;
}



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

int main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);

  int d, t, s;
  cin >> d >> t >> s;

  if (d <= t*s) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 3584
#include <iostream>
#include <math.h>
#include <vector>
#include <cstdlib>

using namespace std;

int main(int argc, const char * argv[]) {
	char S[100];

	cin >> S;

	//Odd number
	for(int i=0; i<strlen(S); i+=2){
		if(S[i] == 'R' || S[i] == 'U' || S[i] == 'D'){
		}else{
			cout << "No" << endl;
			return 0;
		}
	}

	//Even number
	for(int i=1; i<strlen(S); i+=2){
		if(S[i] == 'L' || S[i] == 'U' || S[i] == 'D'){
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;


	return 0;
}


Measured memory_bytes: 760
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
bool echeck(ll a) { return a % 2 == 0 ? 1 : 0; }
ll comb(ll n, ll m){
  ll tmp = 1;
  for(int i = n; i >= n - m + 1; i--){
    tmp *= i;
  }
  ll temp = 1;
  for(int i = 1; i <= m; i++){
    temp *= i;
  }
  return tmp / temp;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int>v(n);
  sort(v.rbegin(),v.rend());
  ll H;
  bool can = false;
  rep(i,n)cin >> v[i];
  sort(v.rbegin(),v.rend());
  rep(i,n - 1){
    if(can && v[i] == v[i + 1]){
      cout << H * v[i] << endl;
      return 0;
    }
    if(v[i] == v[i + 1]){
      can = true;
      H = v[i];
      i++;
    }
  }
  cout << 0 << endl;
  return 0;
}  

Measured memory_bytes: 640
import java.io.PrintWriter
import java.util.NoSuchElementException

fun main(args: Array<String>) = IO().exec {
    val n = int()
    val k = int()
    val a = LongArray(n){long()}
    val preCond = LongArray(n)
    for (i in 0 until n-1) preCond[i+1] = Math.max(preCond[i], a[i])
    var minCost = 1L.shl(60)
    for (mask in 0 until 1.shl(n)) {
        if (Integer.bitCount(mask) != k) continue
        val bits = bitCollect(mask, n)
        var cost = 0L
        var pre = 0L
        for (b in bits) {
            pre = Math.max(pre, preCond[b])
            if (pre >= a[b]) {
                cost += pre + 1 - a[b]
                pre++
            } else {
                pre = a[b]
            }
        }
        minCost = Math.min(minCost, cost)
    }
    println(minCost)
}

fun bitCollect(mask: Int, n: Int): MutableList<Int> {
    val ret = mutableListOf<Int>()
    for (i in 0 until n) if (mask.and(1.shl(i)) > 0) ret.add(i)
    return ret
}

class IO {
    val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    val out = PrintWriter(System.out)
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = System.`in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun string(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun long(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun double(): Double {
        return string().toDouble()
    }
    fun print(obj: Any) = out.print(obj)
    fun print(i: Int) = out.print(i)
    fun print(l: Long) = out.print(l)
    fun println(obj: Any) = out.println(obj)
    fun println(i: Int) = out.println(i)
    fun println(l: Long) = out.println(l)
    inline fun exec(block: IO.() -> Unit) {
        block()
        out.flush()
    }
}

Measured memory_bytes: 31396
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(K: int):
    dp = [[-1] * (K + 1) for _ in range(K + 1)]
    def gcd(a, b):
        if dp[a][b] >= 0:
            return dp[a][b]
        else:
            ret = a if b == 0 else gcd(b, a % b)
        dp[a][b] = ret
        return ret
    ret = 0
    for i in range(1, K + 1):
        for j in range(1, K + 1):
            for k in range(1, K + 1):
                tmp = gcd(i, j)
                ret += gcd(tmp, k)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 68380
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x){return __builtin_popcount(x);}
int popcnt(ll x){return __builtin_popcountll(x);}
int bsr(int x){return 31 - __builtin_clz(x);}
int bsr(ll x){return 63 - __builtin_clzll(x);}
int bsf(int x){return __builtin_ctz(x);}
int bsf(ll x){return __builtin_ctzll(x);}

/*他のライブラリを入れる場所*/

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	int x,y;
	cin>>s>>x>>y;
	int t=0;
	vi a(1,0),b;
	rep(i,s.size()){
		if(s[i]=='T'){
			t++;
			(t%2?b:a).push_back(0);
		}else{
			(t%2?b:a).back()++;
		}
	}
	int n=s.size();
	vvi dp(2,vi(n*2+1,0));
	dp[0][n]=1;
	rep(i,a.size()){
		rep(j,n*2+1){
			if(dp[i%2][j]){
				if(i==0 and s[0]=='F'){
					dp[(i%2)^1][j+a[i]]=1;
				}else{
					dp[(i%2)^1][j+a[i]]=1;
					dp[(i%2)^1][j-a[i]]=1;
				}
			}
			dp[i%2][j]=0;
		}
	}
	vvi dp2(2,vi(n*2+1,0));
	dp2[0][n]=1;
	rep(i,b.size()){
		rep(j,n*2+1){
			if(dp2[i%2][j]){
				dp2[(i%2)^1][j+b[i]]=1;
				dp2[(i%2)^1][j-b[i]]=1;
			}
			dp2[i%2][j]=0;
		}
	}
	Out(dp[a.size()%2][x+n] and dp2[b.size()%2][y+n]);
	return 0;
}

Measured memory_bytes: 640
#include <atcoder/dsu.hpp>
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = a; i >= (b); --i)
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void writef(T ...tail) { write(tail...); cout << flush; }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  if (v.size()) {
    rep(i, 0, sz(v) - 1)
      out << v[i] << " ";
    out << v.back();
  }
  return out;
}
#endif
using namespace std;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n, q; read(n, q);
  atcoder::dsu dsu(n);
  rep(i, 0, q) {
    int t, u, v; read(t, u, v);
    if (t == 0)
      dsu.merge(u, v);
    else
      write(dsu.same(u, v) ? 1 : 0);
  }
}



Measured memory_bytes: 3828
/*	
	Over ice, I'm freezing
	Beautiful eyes, deceiving
	We may die this evening
	Coughing, wheezing, bleeding...
*/	
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define mp make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=18, maxm=1e3+10, lg=19, mod=1e9+7, inf=1e18;

ll n,a[maxn];

ll moz(ll l,ll r,ll x1,ll x2){
	if(r-l==1) return a[l]*x1+a[r]*x2;
	ll ret=inf;
	for(int m=l+1;m<r;m++) ret=min(ret,moz(l,m,x1,x1+x2)+moz(m,r,x1+x2,x2)-a[m]*(x1+x2));
	return ret;
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n; for(int i=0;i<n;i++) cin>>a[i];
	cout<<moz(0,n-1,1,1);

	return 0;
}





Measured memory_bytes: 3632
a, b, c, x, y = map(int, input().split())
ans = x * a + y * b

for i in range(1, 10 ** 5 + 1):
    ans = min(ans, max(x - i, 0) * a + max(y - i, 0) * b + i * 2 * c)

print(ans)

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

int main() {
  int N;  cin >> N;
  
  int A[N];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  
  int counter = 0;
  while(1){
    for(int i=0; i<N; i++){
      if(A[i] % 2 == 0)
        A[i] /= 2;
      else{
  		cout << counter << endl;
      	return 0;
      }
    }
    
    counter++;
  }
  
}


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

char c[55][55]; int H, W, cnt;

int main() {
	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) cin >> c[i][j];
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (c[i][j]=='#' && c[i][j-1]!='#' && c[i-1][j]!='#' && c[i][j+1]!='#' && c[i+1][j]!='#') cnt++;
		}
	}
	if (cnt == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split(' '))
H = [int(input()) for n in range(N)]

H.sort(reverse=True)

ans = H[0] - H[K-1]
for n in range(0, N - K + 1):
    dif = H[n] - H[n + K -1]
    if (dif < ans):
        ans = dif

print(ans)

Measured memory_bytes: 7384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    int n,l;
    cin >> n >> l;
    vi app(n);
    rep(i,n){
        app[i]=l+i;
    }
    int sum=0;
    int sub=inf;
    int ans;
    rep(i,n) sum+=app[i];
    rep(i,n){
        int x=app[i];
        int y=sum-x;
        int z=abs(sum-y);
        if(z<=sub){
            ans=y;
            sub=z;
        }
    }
    cout << ans << endl;


    return 0;
}


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

int main(){
	int num;
	cin >> num;
	vector<int>vec(num);
	for(int i = 0;i<num;i++)
	{
		cin >> vec[i];
	}
	for(int i = 0;i<num;i++){
		if(vec[i]%2==0)
		{
			if(vec[i] %3 == 0 || vec[i]%5==0){
		}
			else{
				cout << "DENIED" << endl;
				return(0);
		}
		}
	}
	cout << "APPROVED" << endl;
}


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

  cin >> N;

  if (N / 10 % 111 == 0 || N % 1000 % 111 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

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

	ll a, b, c;
	cin >> a >> b >> c;

	// sqrt(a) + sqrt(b) < sqrt(c)?
	// a + b + 2sqrt(ab) < c
	// 4ab < (c - a - b)^2

	if (c <= a + b) cout << "No\n";
	else cout << ((4 * a * b < (c - a - b) * (c - a - b)) ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort()

while len(a)>=2:
  for i in range(1,len(a)):
    a[i]=a[i]%a[0]
  if 0 in a:
    for j in range(a.count(0)):
      a.remove(0)
  a.sort()
    

print(a[0])



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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
    cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
q = int(input())
d = defaultdict(int)
 
for i in a:
  d[i] += 1
s = sum(a)
 
for i in range(q):
  b, c = map(int, input().split())
  if b < c:
    x = (c-b)*d[b]
    s += x
  else:
    x = (b-c)*d[b]
    s -= x
  d[c] += d[b]
  d[b] = 0
  print (s)

Measured memory_bytes: 94704
#include <iostream>
using namespace std;
void swap(int &a,int &b){
  int temp=a;
  a=b;
  b=temp;
}
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;
}


Measured memory_bytes: 256
// Problem : A - A?C
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

#define FIO ios_base::sync_with_stdio(0); cin.tie(0);
#define T() int tt; cin >> tt; rep1(qq,1,tt)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define eps (1e-6)
#define what_is(x) cerr << #x << " is " << x << "\n";
#define int long long int
#define infll 9e18
#define inf 1e12

#define lnode (2 * node + 1)
#define rnode (2 * node + 2)

using namespace std;

typedef pair<int, int> pii;

const int N = 3 * 1e6 + 2;

int n, k;

int32_t main(){

  FIO
  //cout << fixed << setprecision(10);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  string s;
  cin >> s;
  if(s == "ABC") cout << "ARC\n";
  else cout << "ABC\n";


	return 0;
}






Measured memory_bytes: 3652
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<' '<<y<<endl
#define p3(x,y,z)               out<<x<<' '<<y<<' '<<z<<endl
#define p4(x,y,z,w)             out<<x<<' '<<y<<' '<<z<<' '<<w<<endl
#define pl(x)                   out<<x
#define pll(x)                  out<<x<<' '
#define range(v)                v.begin(),v.end()
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

#define EACH(x, a) for (auto& x: a)
template<class T> void read_v(T& x, std::istream& in) {
    in >> (x);
}
template<class A> void read_vec(vector<A>& x, std::istream& in) {
    EACH(a, x)
        read_v(a, in);
}

bool sortpairbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
template <typename T>
T factmod(T a, T modulus){ int res = 1, i; for (i = 2; i <= a; i++){ res *= i; res%=modulus;} return res; }
template <typename T>
int powmod(T a,T b,int m){ int ans=1; while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;} return ans; }
template <typename T>
int power(T a, T b){ int ans=1; while(b>0){if(b&1){ans*=a;}a*=a;b>>=1;}return ans;}


void ssolve(std::istream& in, std::ostream& out){
    int k; s(k);
    int check = 7;
    for(int i = 1; i <= k; i++){
        if(check%k==0){
            p(i);
            return;
        }
        check = (check * 10) + 7;
        check %= k;
    }
    p(-1);
}

class CRepsept {
public:
void solve(std::istream& in, std::ostream& out) {
    ios_base::sync_with_stdio(false);
    in.tie(nullptr);out.tie(nullptr);
    int t;
    int READ = 0;
    if(READ) s(t);
    else t = 1;
    while(t--){
        ssolve(in, out);
    }
}
};

integer main() {
    CRepsept solver;
    std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
}

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

int main() {
  int A,B;
  cin >> A >> B;
  
  if (A % 2 == 0 || B % 2 == 0){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

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;
const int inf = 1001001001;

int main(){
  int n;
  cin >> n;
  vector<int>a(n), b(n);
  rep(i,n) cin >> a[i] >> b[i];


  ll cnt = 0;
  ll tot = 0;
  for(int i = n-1; i >= 0; i--){
    ll na  = a[i]+tot;
    if(na%b[i] == 0) continue;
    else{
      ll m = na/b[i];
      tot += b[i]*(m+1)-na;
    }
    //cout << tot << endl;
  }
  cout << tot << endl;
}


Measured memory_bytes: 4032
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using static System.Math;

class P
{
    static void Main()
    {
        string s = Console.ReadLine();
        for (int i = 0; i < s.Length; i++)
        {
            for (int j = 0; j < s.Length - i; j++)
            {
                if("keyence" == s.Substring(0, i) + s.Substring(i + j))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
        }
        Console.WriteLine("NO");
    }
}


static class Writer
{
    public static void WriteLine<T>(this T item) => Console.WriteLine(item);

    public static void WriteLog<T>(this T item) => Debug.WriteLine(item);
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll              long long int
#define nl              '\n'
using namespace std;

int main(void){

    ll t,x,y,n,m,mx=0;
    string s;
        cin>>s;
    int cnt=0;

        if(s=="RRR") cnt=3;
        else if(s=="SSS") cnt=0;
        else if(s=="RRS") cnt=2;
        else if(s=="SRR") cnt=2;
        else cnt=1;

            cout<<cnt;
}


Measured memory_bytes: 3612
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <queue>
#include <cstring>
#include <iterator>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;

typedef long long LL;

LL roadcomp[200020];
LL railcomp[200020];

map<LL, LL> freqs; 

LL roadfind(LL i) {
  if (roadcomp[i] == i)
    return i;
  return roadcomp[i] = roadfind(roadcomp[i]);
}
LL railfind(LL i) {
  if (railcomp[i] == i)
    return i;
  return railcomp[i] = railfind(railcomp[i]);
}

int main()
{
  LL N, K, L;
  scanf("%lld %lld %lld", &N, &K, &L);

  for (LL i = 1; i <= N; i++) {
    roadcomp[i] = railcomp[i] = i;
  }
  for (LL i = 0; i < K; i++) {
    LL p, q;
    scanf("%lld %lld", &p, &q);
    roadcomp[roadfind(q)] = roadfind(p);
  }

  for (LL i = 0; i < L; i++) {
    LL p, q;
    scanf("%lld %lld", &p, &q);
    railcomp[railfind(q)] = railfind(p);
  }

  for (LL i = 1; i <= N; i++) {
    LL prod = railfind(i)*200001+roadfind(i);
    freqs[prod]++;
  }
  /*
  for (LL i = 1; i <= N; i++) {
    printf("%lld %lld\n", railcomp[i], roadcomp[i]);
  }
  */
  for (LL i = 1; i <= N; i++) {
    LL prod = railfind(i)*200001+roadfind(i);
    printf("%lld", freqs[prod]);
    if (i == N)
      printf("\n");
    else
      printf(" ");
  }

  return 0;
}

Measured memory_bytes: 15104
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed 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 l:usize = read();
    let r:usize = read();
    if r - l > 3000 {
        println!("0");
    } else {
        let mut res = 2018;
        for i in l..r {
            for j in i+1..=r {
                res = min(res, (i*j) % 2019);
            }
        }
        println!("{}", res);
    }
}


Measured memory_bytes: 2092