akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

ll make(int d, int mask){
    string s = "";
    rep(i,d){
        if(mask>>i&1) s += '8';
        else s += '2';
    }
    return atoll(s.c_str());
}

const int INF = 19191919;
vector<ll> v;
int V;

const int N = 1<<10;
map<ll,int> dp[N];
int dfs(int d, ll n){
    if(d==V){
        if(n==1) return 0;
        return -INF;
    }
    if(dp[d].count(n)) return dp[d][n];

    int ret = -INF;
    if(n%v[d]==0) ret = max(ret, dfs(d, n/v[d])+1);
    ret = max(ret, dfs(d+1, n));

    return dp[d][n] = ret;
}

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

    for(int i=1; i<=9; ++i){
        rep(mask,1<<i) v.pb(make(i,mask));
    }
    V = v.size();

    int ans = -1;

    ans = max(ans, dfs(0,n));
    for(int i=10; i<=18; ++i){
        rep(mask,1<<i){
            ll val = make(i,mask);
            if(n%val==0){
                ans = max(ans, dfs(0, n/val)+1);
            }
        }
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 78700
N = int(input())
li = [list(map(int,input().split())) for i in range(N)]

dp =[[0,0,0] for i in range(N)]

for i in range(3):
    dp[0][i] = li[0][i]

for i in range(0,N-1):
    dp[i+1][0] = max(dp[i][1],dp[i][2])+li[i+1][0]
    dp[i+1][1] = max(dp[i][0],dp[i][2])+li[i+1][1]
    dp[i+1][2] = max(dp[i][0],dp[i][1])+li[i+1][2]

print(max(dp[N-1]))


Measured memory_bytes: 47364
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    cin>>N;
    vii A(2,vi(N));
    rep(i,2) {
        rep(j,N) {
            cin>>A[i][j];
        }
    }
    int counter=0;
    rep(i,N) {
        int sum=0;
        for(int j=0; j<=i;j++) {
            sum+=A[0][j];
        }
        for(int j=i; j<N; j++) {
            sum+=A[1][j];
        }
        counter=max(counter,sum);
        sum=0;
    }
    cout<<counter<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}
#define int long long

signed main() {
    int a,b;
    cin >> a >> b;
	if (a-2*b>0){
            cout << a - 2 * b << endl;

        }
		else
                    cout << 0 << endl;
}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

ll N, X;
ll x[100000];

ll gcd(ll a, ll b)
{
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll gcd(vector<ll> v)
{
    size_t s = v.size();
    if(s == 0) return -1;
    if(s == 1) return v[0];
    ll ret = gcd(v[0], v[1]);
    FOR(i, 2, s){
        ret = gcd(ret, v[i]);
    }
    return ret;
}

void solve()
{
    vector<ll> v;
    REP(i, N){
        v.pb(x[i]-X >= 0 ? x[i]-X : -(x[i]-X));
    }
    cout << (v.size() == 1 ? v[0] : gcd(v)) << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> X;
    REP(i, N){
        cin >> x[i];
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 2804
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define itn int
#define retrun return
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
typedef long long llong;
typedef pair<int, int> pii;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
string S;
int main() {
	cin >> S;
	int N = S.length();
	for (int i = 0; i < N; i++) {
		cout << 'x';
	}
	return 0;
}

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

int main(){
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  vector<int>x(N);
  vector<int>y(M);
  for(int i=0; i<N; i++){
   cin>>x[i];}  
  for(int i=0; i<M; i++){
   cin>>y[i];}
  
 x.push_back(X);
 y.push_back(Y);
 sort(x.begin(), x.end());
 reverse(x.begin(), x.end()); 
 sort(y.begin(), y.end());
  
  if(x.at(0)<y.at(0)){cout<<"No War"<<endl;}
  else{cout<<"War"<<endl;}
  
}

Measured memory_bytes: 256
def main():
    from fractions import gcd
    import sys
    input=sys.stdin.readline
    N=int(input())
    A=list(map(int,input().split()))
    lcm=A[0]
    for a in A:
        lcm=lcm*a//(gcd(lcm,a))

    ans=0
    for a in A:
        ans=ans+(lcm//a)
    print(ans%(10**9+7))

if __name__ == '__main__':
    main()


Measured memory_bytes: 6200
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int t = sc.nextInt();
		int cost, time, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			cost = sc.nextInt();
			time = sc.nextInt();
			if (t >= time) {
				min = Math.min(min, cost);
			}
		}
		if (min == Integer.MAX_VALUE) {
			System.out.println("TLE");
		} else {
			System.out.println(min);
		}
	}
}


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

using namespace std;

int main(){
  string S;
  cin >> S;
  
  bool YYMM, MMYY;
  if(int(S[0]-'0')*10 + int(S[1] - '0') == 0 || int(S[0]-'0')*10 + int(S[1] -'0') >= 13) MMYY = false;
  else MMYY = true;
  
  if(int(S[2]-'0')*10 + int(S[3] - '0') == 0 || int(S[2]-'0')*10 + int(S[3] - '0') >= 13) YYMM = false;
  else YYMM = true;
  
  if(YYMM & MMYY) cout << "AMBIGUOUS";
  else if(YYMM & !MMYY) cout << "YYMM";
  else if(!YYMM & MMYY) cout << "MMYY";
  else cout << "NA";
}

Measured memory_bytes: 256
def action_handler(list, k)
  return 0 if list.size <= k
  injec = list.inject(:+)
  return injec if k <= 0
  new_array = list.sort.reverse
  for i in 0..(k - 1)
    injec -= new_array[i]
  end
  return injec
end

n, k = gets.chop.split.map(&:to_i)
list = gets.chop.split.map(&:to_i)

print action_handler(list, k)

Measured memory_bytes: 20992
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int M = 1 << 20, N = 2*M, INF = 1e18;

int n, val[N], h[N], a[N], b[N], d[N], f[N];

void insert(int i, int A, int B) {
    if(i >= N)
        return;
    int deb[] = {A*d[i]+B, a[i]*d[i]+b[i]},
        fin[] = {A*f[i]+B, a[i]*f[i]+b[i]};
    if(deb[0] <= deb[1] && fin[0] <= fin[1])
        return;
    if(deb[1] <= deb[0] && fin[1] <= fin[0]) {
        a[i] = A, b[i] = B;
        return;
    }
    int m = (d[i] + f[i])/2,
        med[] = {A*m+B, a[i]*m+b[i]};
    if(med[0] > med[1]) {
        swap(a[i], A);
        swap(b[i], B);
        swap(deb[0], deb[1]);
    }
    if(deb[0] > deb[1])
        insert(i*2, A, B);
    else
        insert(i*2+1, A, B);
}

int getMax(int x) {
    int i = x + M, maxi = -INF;
    while(i > 0) {
        maxi = max(maxi, a[i]*x + b[i]);
        i /= 2;
    }
    return maxi;
}

signed main() {
    /*
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    */
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    for(int i = M; i < N; i++)
        f[i] = 1 + (d[i] = i - M);
    for(int i = M-1; i > -1; i--) {
        d[i] = d[i*2];
        f[i] = f[i*2+1];
    }
    for(int i = 0; i < N; i++)
        b[i] = -INF;
    
    int A, B, C;
    /*cin >> n >> A >> B >> C;
    
    n++;
    for(int i = 1; i < n; i++)
        cin >> h[i];
    for(int i = 1; i < n; i++)
        h[i] += h[i-1];*/
    A = -1, B = 0;
    cin >> n >> C;
    C = -C;
    for(int i = 0; i < n; i++)
        cin >> h[i];
    
    for(int i = 0, j = 1; j < n; i++, j++) {
        insert(1, -2*h[i]*A, A*h[i]*h[i] - B*h[i] + C + val[i]);
        val[j] = getMax(h[j]) + A*h[j]*h[j] + B*h[j];
    }
    cout << -val[n-1];
}

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

int factorial(int n, int op = 0) {
    int result = 1;

    if(n < 0) {
        cout << "caution: n must be positive number." << endl;
    }

    if (n==0) {
        return result;
    }

    for (int i = op+1; i <= n; i++) {
        result *= i;
    }
    return result;
}

int comb(int x, int y) {
    if (y > x) {
        return 0;
    }

    int result = factorial(x, x-y)/factorial(y);
    return result;

}

int main() {
    int n;
    int m;

    cin >> n >> m;

    // cout << "n: " << n << endl;
    // cout << "m: " << m << endl;
    // cout << "comb(n, 2): " << comb(n, 2) << endl;
    // cout << "comb(m, 2): " << comb(m, 2) << endl;


    double result = comb(n, 2) + comb(m, 2);

    cout << result;

    return 0;
}




Measured memory_bytes: 256
# 2020/04/12
# AtCoder Beginner Contest 148 - D

# Input
n = int(input())
a = list(map(int,input().split()))

# Init
wkidx = 0
wk_i = -1

# Search
for i in range(1, n+1):
    foundflg = False
    for j in range(wkidx, n):
        if a[j] == i:
            wkidx = j + 1
            foundflg = True
            break
    
    if foundflg == False:
        wk_i = i
        break

if wk_i == -1:
    # Case sorted
    ans = 0
elif wk_i == 1:
    # Case 1 not found
    ans = -1
else:
    # Case other
    ans = n - (wk_i - 1)

# Output
print(ans)


Measured memory_bytes: 26524
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define MAX 100005

int top[MAX];
int middle[MAX];
int bottom[MAX];

int main() {
    int N, num;
    LL comb = 0;
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> top[i];
    }
    sort(top, top + N);

    for (int i = 0; i < N; i++) {
        cin >> middle[i];
    }
    sort(middle, middle + N);

    for (int i = 0; i < N; i++) {
        cin >> bottom[i];
    }
    sort(bottom, bottom + N);
    
    for (int i = 0; i < N; i++) {
        int *top_pos = lower_bound(top, top + N, middle[i]);
        int *bottom_pos = upper_bound(bottom, bottom + N, middle[i]);
        comb += distance(top, top_pos) * (N - distance(bottom, bottom_pos));
    }
    cout << comb << endl;

    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>

int main(){
	int n;
	int a,b,c;
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d",&a,&b,&c);
		if(a*a == b*b + c*c || b*b == c*c + a*a || c*c == a*a + b*b){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	string s; cin >> s;
	string t;
	rep(i, 0, s.size()) {
		if (s[i] == '0') {
			t += '0';
		}
		else if (s[i] == '1') {
			t += '1';
		}
		else if (s[i] == 'B') {
			if (t.size() > 0) {
				t = t.substr(0, t.size() - 1);
			}
		}
	}
	cout << t << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]
 
A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        if A[n][-1] != -1:
            cand1.add(A[n][-1])
    return len(can_use), cand1
    
answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break
    
print(answer)

Measured memory_bytes: 75996
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define ull unsigned long long

int main(){
    int i,n,k,r,s,p,point=0;
    char t[100002]={};
    scanf("%d%d",&n,&k);
    scanf("%d%d%d",&r,&s,&p);
    scanf("%s",t);
    for (i=k; i<n; i++) {
        if (t[i]==t[i-k]) {
            t[i]='0';
        }
    }
    for (i=0; i<n; i++) {
        switch (t[i]) {
            case 'r':
                point+=p;
                break;
            case 's':
                point+=r;
                break;
            case 'p':
                point+=s;
                break;
            default:
                break;
        }
    }
    printf("%d",point);
    return 0;
}



Measured memory_bytes: 256
G1 = list(map(int, input().split()))
G2 = list(map(int, input().split()))
G3 = list(map(int, input().split()))
sub_G1 = []
sub_G2 = []
sub_G3 = []
sub_R12 = []
sub_R23 = []
for i in range(2):
  sub_G1.append(G1[i+1] - G1[i])
  sub_G2.append(G2[i+1] - G2[i])
  sub_G3.append(G3[i+1] - G3[i])
for k in range(3):
  sub_R12.append(G2[i]-G1[i])
  sub_R23.append(G3[i]-G2[i])
condition1 = bool(sub_G1[0] == sub_G2[0] == sub_G3[0])
condition2 = bool(sub_G1[1] == sub_G2[1] == sub_G3[1])
condition3 = bool(len(set(sub_R12)) == 1)
condition4 = bool(len(set(sub_R23)) == 1)
if condition1 and condition2 and condition3 and condition4:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9108
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long a = sc.nextLong();
    long b = sc.nextLong();
    long cnt = n/(a+b);
    long mod = n%(a+b);
    if(mod>=a) mod=a; 
    System.out.println(a*cnt+mod);
  }
}

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

using namespace std;

string s;
long long int al[26], n, ans;

int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    al[s[i] - 'a']++;
  }

  ans = n * (n - 1) / 2;
  for (int i = 0; i < 26; i++) {
    ans -= al[i] * (al[i] - 1) / 2;
  }

  cout << ans + 1 << endl;

  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.nextLine();
        for(int i = 0 ; i < n ; i++){
            int[] number = new int[10];
        	String s = input.nextLine();

        	for(int j = 0 ; j < s.length(); j++){
        		number[s.charAt(j)-48]++;
        	}

        	String min = "";

        	for(int j = 0 ; j < number.length ; j++){
        		while(number[j] != 0){
        			min += j;
        			number[j]--;
        		}
        	}

        	String max = "";

        	for(int j = 0 ; j < s.length(); j++){
        		number[s.charAt(j)-48]++;
        	}

        	for(int j = number.length-1 ; j >= 0 ; j--){
        		while(number[j] != 0){
        			max += j;
        			number[j]--;
        		}
        	}
        	System.out.println(Integer.parseInt(max)-Integer.parseInt(min));
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned uint;
typedef pair<uint, uint> pairUInt;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

int main(int argc, char *argv[])
{
    uint a, b, c;
    ll count = 0;
    set<pairUInt> hist;

    cin >> a >> b >> c;

    while(a%2 == 0 && b%2 == 0 && c%2 == 0) {
        if (hist.find(make_pair(max(max(a, b), c), max(min(a, b), c))) != hist.end()) {
            count = -1;
            break;
        }
        hist.insert(make_pair(max(max(a, b), c), max(min(a, b), c)));
        count ++;
        uint tmp_a=a, tmp_b=b;
        a = (b+c)/2;
        b = (tmp_a + c)/2;
        c = (tmp_a + tmp_b)/2;
    }

    cout << count << endl;;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

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

    int ans=0;
    ll sum=0;
    vector<ll> v;
    rep(i,n){
        if(a[i]>b[i]){
            v.push_back(a[i]-b[i]);
        }
        else if(a[i]<b[i]){
            ans++;
            sum+=b[i]-a[i];
        }
    }

    if(sum==0){
        cout<<0<<endl;
        return 0;
    }
    
    sort(all(v));
    reverse(all(v));
    rep(i,v.size()){
        sum-=v[i];
        ans++;
        if(sum<0){
            cout<<ans<<endl;
            return 0;
        }
    }

    cout<<-1<<endl;
}

Measured memory_bytes: 5496
#include<bits/stdc++.h>
#define ff first
#define ss second
#define IO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
ll mx = 1e18;

int main() {
    IO;
    ll a;
    string s;
    cin >> a >> s;

    int sz = s.size();
    ll x = 0;
    for(int i = 0; i < sz; i++)
        if(s[i] == '.'){
            x = sz - i - 1;
            break;
        }
    ll y = 0;
    for(int i = 0; i < sz; i++){
        if(s[i] == '.') continue;
        y = y * 10 + s[i] - '0';
    }
//    cout << a << '\n';
//    cout << y << endl;
    ll b = pow(10, x);
//    cout << b << '\n';
    cout << (a * y) / b << '\n';
    return 0;

}


Measured memory_bytes: 3772
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin>>N;
	vector<vector<int> > A(N,vector<int>(2));
	for(int i=0;i<N;++i){
		cin>>A[i][0] >>A[i][1];
	}
	sort(A.begin(),A.end());
	
	LL ans = A[N-1][0]+A[N-1][1];
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 5760
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
println!("{}", 3 * n * n);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}



Measured memory_bytes: 4352
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    VL a(n);
    REP(i,n) scanf("%lld", &a[i]);
    sort(ALL(a));
    int ans = n;
    ll s = 0;
    REP(i,n-1){
        s += a[i];
        if (2*s < a[i+1]) ans = n-i-1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1532
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    N, M = list(map(int, input().split()))

    if N == M:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	
	int c,t,x,y;//x animal  y legs
	
	cin >>x>>y;
	
	for (c=0;c<=x;c++)
	{
		//c=0
		if((c*2+(x-c)*4)==y){
			cout <<"Yes";
			break;
		}
		else{
			if(c==x){
				cout << "No";
			}
		}
		
	}
	
	return 0;
	
	
	
}

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

using namespace std;

int main(){
    int MX, ans;
    MX = ans = 0;
    for(int i = 0; i < 5; i++){
        int curr; cin >> curr;
        ans += curr + (10 * (curr % 10 != 0) - (curr % 10));
        MX = max(MX, 10 * (curr % 10 != 0) - (curr % 10));
    }
    cout << ans - MX << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

long long memo[87];

long long solve(const long long n)
{
  if (n == 0)
    return 2;
  if (n == 1)
    return 1;
  if (n >= 2)
    if (memo[n] > 0)
      return memo[n];
    else
      return memo[n] = solve(n - 1) + solve(n - 2);
}

int main()
{
  int n;
  cin >> n;
  cout << solve(n) << endl;
}


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

int main()
{
    int n,count1=0,count2=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        count1++;
        if(a[i]%2==0&&(a[i]%3==0||a[i]%5==0))
            count2++;

    }
    if(count1==count2)
        cout<<"APPROVED"<<endl;
    else
        cout<<"DENIED"<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[100010];
ll n;
ll ans;
int main(){
	scanf("%s",s);
	n=strlen(s);
	rep(i,0,n-1)if(s[i]!=s[i+1])ans++;
	printf("%lld\n",ans);
}

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

void solve(){
  int l ,r,d;
  cin>>l>>r>>d;
  int cnt =0;
  for (int i = l; i <= r; ++i)
  {
    if(i%d==0)cnt++;
  }
  cout<< cnt;
}

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

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

Measured memory_bytes: 3656
#include<stdio.h>
#include<math.h>
int main() {
  int i,n,m,s,c,x = 0,flag = 0;
  scanf("%d %d",&n,&m);
  int ansnum[n + 1],firstcheck[n + 1];

  for (i = 1;i <= n;i ++) {
    ansnum [i] = 0;
    firstcheck[i] = 1;
  }
  for (i = 1;i <= m;i ++) {
    scanf("%d %d",&s,&c);
    if (firstcheck[s] == 1) {
      ansnum[s] = c;
      firstcheck[s] = 0;
    }
    else if (ansnum[s] != c) {
      ansnum[1] = 0;
      firstcheck[1] = 0;
      flag = 1;
      break;
    }
  }
  if (m == 0 && n != 1) {
    ansnum[1] = 1;
  }
  if (n == 1 && ansnum[1] == 0 && firstcheck[1] == 0 && flag == 1) {
    x = -1;
    printf("%d",x );
  }
  else if (n == 1 && ansnum[1] == 0) {
    x = 0;
    printf("%d",x);
  }
  else if (firstcheck[1] == 1) {
    ansnum[1] = 1;
  }
  if (ansnum[1] != 0) {
      for (i = n - 1;i >= 0;i --) {
        x = x + ansnum[n - i] * pow(10,i);
      }
      printf("%d",(int)x);
    }
  else if(n != 1) {
      x = -1;
      printf("%d",x);
    }
    //for (i = 0;i < n;i ++) {
      //printf("%d",firstcheck[i]);
    //}
}


Measured memory_bytes: 128
n, k = map(int, input().split())
A = list(map(int, input().split()))
D = [1]
seen = [0]*n
seen[0] = 1
now = 0
while True:
    now = A[now] - 1
    D.append(now+1)
    if seen[now]:
        break
    seen[now] = 1
f = D.index(D[-1])
if k < f:
    print(D[k])
else:
    cycle = len(D) - f - 1
    k -= f
    print(D[f + k%(cycle)])

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

int main() {
  int k,n;
  int maxd=0;
  cin >> k >> n;
  for (int i=0;i<n;i++){
    int first,prev,a;
    if (i==0){
      cin >> first;
      a=first;
    }
    if (i==n-1){
      maxd=max(maxd,k-prev+first);
      break;
    }
    cin >> a;
    maxd=max(maxd,a-prev);
    prev=a;
  }
  cout << k-maxd << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        int remain = a - b;
        while ((remain - c) >= 0) {
                remain -= c;
        }
        System.out.println(remain);
    }
}


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

int main(){
  string w;
  cin >> w;
  vector<int> alpha(26,0);
  rep(i,w.size()){
    alpha[w[i]-'a']++;
  }
  rep(i,alpha.size()){
    if(alpha[i]%2==1){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
int main()
{
	int a,b,c,d,s;
	int i,j;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a>c)
	i=a;
	else
	i=c;
	if(b>d)
	j=d;
	else
	j=b;
	s=j-i;
	if(s>0)
	printf("%d\n",s);
	else
	printf("0\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
int main(void){
    float l ;
    cin >> l ;
    float ans = (l/3.0) * (l/3.0)  * (l / 3.0) ;
    cout << fixed << setprecision(7) << ans << endl; 
   
    return 0;
}

Measured memory_bytes: 256
import copy
import itertools
h,w,k = map(int,input().split())
c = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
	c[i] = input()
	c[i] = list(c[i])

counter = 0	
ans = 0
b = 0
for (i,j) in itertools.product(range(h), range(w)):
	if c[i][j] == '#':
		b += 1

for hl in range(h+1):
	for wl in range(w+1):
		for	hi in itertools.combinations(range(h),hl):
			for wj in itertools.combinations(range(w),wl):
				C = copy.deepcopy(c)
				for i in hi:
					for j in range(w):
						if C[i][j] == '#':
							counter += 1
							C[i][j] = '.'
				for j in wj:
					for i in range(h):
						if C[i][j] == '#':
							counter += 1
				if b - counter == k:
					ans += 1
				counter = 0
print(ans)

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

using namespace std;

int w[300005];

int main(){

	int n;
	cin >> n;
	string s;
	cin >> s;
	for(int i=0;i<n;i++)
		if(s[i]=='W')
			w[i+1] = w[i]+1;
		else
			w[i+1] = w[i];
	int mn=1e9;
	for(int i=1;i<=n;i++){
		mn = min(mn,w[i-1]+((n-i)-(w[n]-w[i])));
	}
	cout << mn;
}

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

MOD = 2  # type: int


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    N,M = map(int,input().split())
    from collections import defaultdict
    d = defaultdict()
    for i in range(M):
        l = list(map(int,input().split()))
        d[i] = l[1:]

    # for k,v in d.items():
    #     print(k,v)

    p = list(map(int,input().split()))

    ans = 0
    import itertools
    s = ('on', 'off')
    for i in itertools.product(s, repeat=N):
        anst = 0
        for k,v in d.items():
            if(len([x for x in v if(i[x-1] == 'on')])%2 == p[k]):
                anst += 1

        if(anst == M):
            ans += 1
    
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int32_t; using i64 = int64_t; using f64 = double_t; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(n, m, i) for (i32 i = (n); i < (m); ++i)
#define upto(n, m, i) for (i32 i = (n); i <= (m); ++i)
#define downto(n, m, i) for (i32 i = (n); i >= (m); --i)
#define foreach(xs, x) for (auto &x : (xs))
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define maximum(xs) (*max_element(all(xs)))
#define minimum(xs) (*min_element(all(xs)))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
const i64 MOD = 1000000007;

struct unionfind {
    vec<i32> data;
    unionfind(i32 size) : data(size, -1) { }
    void unite(i32 x, i32 y) {
        x = find(x); y = find(y); if (x == y) return;
        if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x;
    }
    i32 find(i32 x) { return data[x] < 0 ? x : data[x] = find(data[x]); }
    i32 size(i32 x) { return -data[x]; }
    i32 same(i32 x, i32 y) { return find(x) == find(y); }
};

i32 n, k, l;

i32 main()
{
    cin >> n >> k >> l;
    unionfind uf_p(n), uf_r(n);
    times(k, i) {
        i32 p, q; cin >> p >> q; p--; q--;
        uf_p.unite(p, q);
    }
    times(l, i) {
        i32 r, s; cin >> r >> s; r--; s--;
        uf_r.unite(r, s);
    }
    map<pair<i32, i32>, i32> m;
    times(n, i) {
        pair<i32, i32> p = make_pair(uf_p.find(i), uf_r.find(i));
        if (m.find(p) != m.end()) {
            m[p]++;
        } else {
            m[p] = 1;
        }
    }

    pair<i32, i32> p = make_pair(uf_p.find(0), uf_r.find(0));
    cout << m[p];
    range(1, n, i) {
        p = make_pair(uf_p.find(i), uf_r.find(i));
        cout << " " << m[p];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 13568
#include<stdio.h>
int main()
{
    int ara[20],i,x,j;
    for(i=0;i<10;i++)
    {
        scanf("%d",&ara[i]);
    }
    for(i=1;i<10;i++)
    {
        x=ara[i];
        j=i-1;
        while(j>=0&&ara[j]>x)
        {
            ara[j+1]=ara[j];
            j--;
        }
        ara[j+1]=x;
    }
    for(i=9;i>=7;i--)
    {
        printf("%d\n",ara[i]);
    }
    return 0;
}



Measured memory_bytes: 2036
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [n,h,w]=arr.shift().split(" ").map(Number);
var x=arr.shift().split(" ").map(Number);
var m=[];
for(var i=0;i<(n*w);i++)m[i]=1;
x.forEach((v,i)=>{
   var k=(i%2==0)?w*i+v:w*i-v;
   for(var j=k;j<k+w;j++)m[j]=0;
});
var sum=m.reduce((a,b)=>a+b);
console.log(sum*h);


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

#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

typedef long long ll;

void solve(long long H, long long N, std::vector<long long> A,
           std::vector<long long> B) {
    ll dp[N + 1][H + 1];
    fill(dp[0], dp[N + 1], INF);

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < H + 1; j++) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            int nj = min(j + A[i], H);
            dp[i + 1][nj] = min(dp[i + 1][nj], dp[i + 1][j] + B[i]);
        }
    }
    cout << dp[N][H] << endl;
}

int main() {
    long long H;
    scanf("%lld", &H);
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
        scanf("%lld", &B[i]);
    }
    solve(H, N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 78464
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>

using namespace std;



int main(int argc, char *argv[])
{
	string s;
	int val;
	//input
	cin >> s;

	val = s[5] - '0';
	val = val * 10 + s[6] - '0';
	val = val * 10 + s[8] - '0';
	val = val * 10 + s[9] - '0';







	//calc
	string ans;
	if (val <= 430){
		ans = "Heisei";
	}
	else{
		ans = "TBD";
	}





	//ans
	cout << ans << endl;


	return 0;
}


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

int N, M;
std::vector <int> edge[210000];
char s[210000];
int cnt[210000][2];
int vis[210000];

int main () {
  std::ios::sync_with_stdio (0);
  std::cin >> N >> M;
  for (int i = 0; i < N; ++i) std::cin >> s[i];
  for (int i = 0; i < M; ++i) {
    int u, v; std::cin >> u >> v; --u; --v;
    edge[u].push_back (v); cnt[u][s[v] - 'A']++;
    edge[v].push_back (u); cnt[v][s[u] - 'A']++;
  }
  std::queue <int> q;
  for (int i = 0; i < N; ++i) if (!cnt[i][0] || !cnt[i][1]) q.push (i), vis[i] = true;
  while (!q.empty ()) {
    int n = q.front (); q.pop ();
    for (int i : edge[n])
      if (!--cnt[i][s[n] - 'A'] && !vis[i]) q.push (i), vis[i] = true;
  }
  for (int i = 0; i < N; ++i) if (!vis[i]) {
    std::cout << "Yes\n"; return 0;
  }
  std::cout << "No\n";
}


Measured memory_bytes: 13568
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int s;
bool used[1010101];

int main()
{
    cin >> s;

    int next, last;
    last = s;
    used[last] = true;
    for (int i = 2; i < 1010101; i++)
    {
        if (last % 2 == 0)
        {
            next = last / 2;
        }
        else
        {
            next = 3 * last + 1;
        }
        if (used[next])
        {
            cout << i << endl;
            return 0;
        }
        used[next] = true;
        last = next;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
#define ll long long int
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define make_pair
#define rep(i,l,r) for(i=l;i<r;i++)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
int main()
{
    io;
    int i,n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;
    a-=1;
    b-=1;
    c-=1;
    d-=1;
    int r=0;
    rep(i,a,c+1)
    {
        if(s[i]=='#')
            r++;
        else
            r=0;
        if(r>1)
            break;
    }
    if(r>1)
    {
        cout<<"No";
        return 0;
    }
    r=0;
    rep(i,b,d+1)
    {
        if(s[i]=='#')
            r++;
        else
            r=0;
        if(r>1)
            break;
    }
    if(r>1)
    {
        cout<<"No";
        return 0;
    }
    if(d>c)
    {
        cout<<"Yes";
        return 0;
    }
    r=0;
    rep(i,b-1,d+2)
    {
        if(s[i]=='.')
            r++;
            else
                r=0;
        if(r>=3)
            break;
    }
    if(r>2)
    {
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 592
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
int cnt = 0;
vector<ll> insertion(vector<ll> a, int n, int g){
  FOR(i, g, n){
    ll v = a[i];
    int j = i - g;
    while(j >= 0 && a[j] > v){
      a[j+g] = a[j];
      j -= g;
      cnt++;
    a[j+g] = v;
    }
  }
  return a;
}

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n)cin >> a[i];
  int m = 1;
  vector<int> G;
  while(m < n){
    G.pb(m);
    m = 3 * m + 1;
  }
  reverse(G.begin(), G.end());
  if(G.size() == 0)G.pb(1);
  cout << G.size() << endl;
  rep(i, G.size()){
    cout << G[i];
    if(i + 1 == G.size())cout << endl;
    else cout << " ";
  }
  rep(i, G.size()){
    a = insertion(a, n, G[i]);
  }
  cout << cnt << endl;
  rep(i, n)cout << a[i] << endl;
	return 0;
}



Measured memory_bytes: 18476
/*input
12 3
1 1
1 1
1 1
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  ll d;
  cin >> n >> d;
  int ans = 0;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    if (x*x+y*y <= d*d) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;


double dist(double x1, double x2, double y1, double y2) {
	return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}
double dist(P &p1, P &p2) {
	double x1 = p1.first, x2 = p2.first, y1 = p1.second, y2 = p2.second;
	return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}


void solve() {
	int N, K, S; cin >> N >> K >> S;
	vector<int>ans(N);
	if (S < 1e9) {
		REP(i, N) {
			if (i < K)ans[i] = S;
			else ans[i] = S+1;
		}
	}
	else {
		REP(i, N) {
			if (i < K)ans[i] = S;
			else ans[i] = 998244353;
		}
	}
	print_space(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




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

using namespace std;

typedef long long       ll;

#define all(x)            (x).begin(),(x).end()
#define Sort(x)            sort(all(x))
#define A               first
#define B               second
#define sep             ' '
#define fast_io         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random     mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count())

const int MAX1 = 2e5+10,
         Md = 1e9+7,
		 Base = 257;

ll n, num[MAX1], ans;
set <ll> st1, st2;


int main(){
    fast_io;
    cin >> n;
    for (int i = 0; i < n; ++i){
    	cin >> num[i];
	}
	sort(num, num+n);
	for (int i = 0; i < n-1; ++i){
		if (num[i] == num[i+1])	st1.insert(num[i]);
	}
	for (int i = 0; i < n-3; ++i){
		if (num[i] == num[i+1] && num[i+2] == num[i] && num[i+3] == num[i])	st2.insert(num[i]);
	}
	if (st1.size() > 1)	ans = max(ans, *(--st1.end()) * *(--(--st1.end())));
	if (st2.size() > 0)	ans = max(ans, *(--st2.end()) * *(--st2.end()));
	cout << ans;
    return 0;
}
/*               now or never                 */


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

int main(void)
{
  string S;
  cin >> S;

  if (S[2] == S[3] &&
      S[4] == S[5])
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		double[] x=new double[n];
		double[] y=new double[n];
		for(int i=0; i<n; i++){
			x[i]=sc.nextDouble();
		}
		for(int i=0; i<n; i++){
			y[i]=sc.nextDouble();
		}
		d1(x,y);
		d2(x,y);
		d3(x,y);
		dmax(x,y);

    }
	public static void d1(double[] x,double[] y){
		double sum=0;
		for(int i=0; i<x.length; i++){
			sum+=Math.abs(x[i]-y[i]);
		}
		System.out.printf("%.6f\n",sum);
	}
	public static void d2(double[] x,double[] y){
		double sum=0;
		for(int i=0; i<x.length; i++){
			sum+=Math.pow(Math.abs(x[i]-y[i]), 2);

		}
		sum=Math.sqrt(sum);
		System.out.printf("%.6f\n",sum);
	}
	public static void d3(double[] x,double[] y){
		double sum=0;
		for(int i=0; i<x.length; i++){
			sum+=Math.pow(Math.abs(x[i]-y[i]), 3);

		}
		sum=Math.pow(sum, 1.0/3);
		System.out.printf("%.6f\n",sum);
	}
	public static void dmax(double[] x, double[] y){
		double max=0;
		for(int i=0; i<x.length; i++){
			if(Math.abs(x[i]-y[i])>max){
				max=Math.abs(x[i]-y[i]);
			}
		}
		System.out.printf("%.6f\n",max);
	}
}


Measured memory_bytes: 29220
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
using namespace std;
using ll = long long;


int main() {
    V v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 
    2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n; cin>>n;
    cout<<v[n-1]<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, x int
	for {
		fmt.Scan(&n, &x)
		if n == x && x == 0 {
			break
		}
		ans := 0
		for a := 1; a <= n; a++ {
			for b := a + 1; b <= n; b++ {
				for c := b + 1; c <= n; c++ {
					if a+b+c == x {
						ans++
					}
				}
			}
		}
		fmt.Println(ans)
	}
}



Measured memory_bytes: 1152
n = int(input())
a = [int(input())-1 for i in range(n)]
#print(a)

light = 0
count = 0
while count < n:
  #print(light)
  light = a[light]
  count +=1  
  if light == 1:
   # print('b')
    ans = count
    break
else:
  ans = -1

print(ans)    


Measured memory_bytes: 7084
q,w=[*(%w{+ - *}*3).combination(3)],%w{$%$ %%($%%) %%(%%$) ($%%)%% (%%$)%%}.map{|s|s.gsub(?$,"(%%%)").gsub"%","%s"};until f=/0/=~s=gets;s.split.permutation.map{|a,b,c,d|q.map{|x,y,z|w.map{|e|10==eval(e%=[a,x,b,y,c,z,d])&&(puts f=e;break)};break if f};break if f};p 0 if !f;end

Measured memory_bytes: 6512
N = int(input())
l = len(str(N))

if l == 1:
  print(N)
elif l == 2:
  print(9)
elif l == 3:
  print(N-90)
elif l == 4:
  print(909)
elif l == 5:
  print(N-9090)
else:
  print(90909)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  vector<int> deg(n, 0);
  rep(i,n + m - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].emplace_back(b);
    deg[b]++;
  }
  int root = -1;
  for ( int i = 0; i < n; i++) if (!deg[i]) root = i;
  vector<int> par(n, 0);
  queue<int> que;
  que.push(root);
  par[root] = -1;
  while (!que.empty()) {
    int u = que.front(); que.pop();
    for (auto v : g[u]) {
      deg[v]--;
      if (deg[v] == 0) {
        que.push(v);
        par[v] = u;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << par[i] + 1 << endl;
  return 0;
}


Measured memory_bytes: 9524
#include <bits/stdc++.h>
using namespace std;
#define int long long int
main() {
	int n;
	cin>>n;
	vector<int>s;
	vector<int>b;
	for(int i=0; i<n; i++){
		int a1, b1;
		cin>>a1>>b1;
		if(n%2==0){
			s.push_back(2*a1);
			b.push_back(2*b1);
		}
		else{
			s.push_back(a1);
			b.push_back(b1);
		}
	}
	sort(s.begin(), s.end());
	sort(b.begin(), b.end());
	if(n%2==1){
		cout<<b[n/2]-s[n/2]+1;
		return 0;
	}
	else{
		cout<<((b[n/2]+b[(n/2)-1])/2)-((s[n/2]+s[(n/2)-1])/2)+1;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 6644
#include<iostream>
using namespace std;
int main(){
    int R,G,B,N;
    int ans=0;
    cin>>R>>G>>B>>N;
    for(int i=0;i<=N;i++){
        if(i*R>N)break;
        for(int j=0;j<=N;j++){
            if(i*R + j*G>N)break;
            
            if((N- i*R - j*G)%B==0)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long   ll;
typedef  long double ld;
#define ceil(n, m) ((n / m) + ( n % m ? 1 : 0))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("input.txt", "r", stdin);
	ll n, ans = 0;
	cin >> n;
	vector<ll> a(n);
	deque<ll> dq;
	for (auto& i : a)
		cin >> i;
	sort(rall(a));
	dq.emplace_back(a[0]);
	for (int i = 1; i < n; ++i) 
		dq.emplace_back(a[i]), dq.emplace_back(a[i]);
	for (int i = 0; i < n - 1; ++i)
		ans += dq[i];
	
	cout << ans;


}


Measured memory_bytes: 8212