akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

using ipair = pair<int,int>;

int INF = 1e9+7;

using ipair = pair<int,int>;
bool operator>(const ipair a,const ipair b){return a.first > b.first;}


int main(){
  int N, M;
  cin >> N >> M;

  vector<int> a;
  map<int, int> mp;

  rep(i, N){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }

  rep(i, M){
    int b, c;
    cin >> b >> c;
    mp[c] += b;
  }

  priority_queue<ipair> q;
  for(ipair p: mp){
    q.push(p);
  }

  sort(a.begin(), a.end());

  ipair p = q.top(); q.pop();
  rep(i, N){
    // cout << "c: " << p.first << endl;
    // cout << "cnt: " << p.second << endl;

    // 超えるｃを探す
    if(p.first < a[i] || p.second==0){
      while(!q.empty()){
        p = q.top(); q.pop();

        if(p.first > a[i]){
          break;
        }
      }
      // 超えられなかったら
      if(p.first <= a[i]){
        break;
      }
    }

    if(p.first > a[i] && p.second != 0){
      a[i] = p.first;
      p.second--;
    }

  }

  ll sum = 0;
  rep(i, N){
    sum += a[i];
  }

  cout << sum << endl;
}

Measured memory_bytes: 6520
N, K = list(map(int, input().split()))
D = list(map(int, input().split()))

number = [i for i in range(10)]
num_lis = list(set(number) - set(D))
ans=[]
for i in range(N, 100000):
    a=i//10000
    if bool((a not in D) or i <10000):
        b=i//1000 - 10*a
        if bool((b not in D) or i <1000):
            c=i//100 - 100 * a - 10 * b
            if bool((c not in D) or i < 100):
                d= i//10 - 1000 * a - 100*b - 10*c
                if bool((d not in D) or i <10):
                    e=i%10
                    if e not in D:
                        ans.append(i)
print(ans[0])

Measured memory_bytes: 43760
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define show(x) cout<< #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

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

const ll mod=998244353;
const int INF=INT_MAX/2;
const int N_MAX=100010;
const double PI=3.14159265359;

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

int main(){
	int A[3][3];
	bool open[3][3];
	int n;
	REP(i,3)REP(j,3){
		cin>>A[i][j];
		open[i][j]=false;
	}
	cin>>n;
	int b[n];
	REP(i,n)cin>>b[i];
	REP(i,3){
		REP(j,3){
			REP(k,n){
				if(A[i][j]==b[k])open[i][j]=true;
			}
		}
	}
	bool res=false;
	REP(i,3){
		bool column=true;
		bool row=true;
		REP(j,3){
			if(!open[i][j])column=false;
			if(!open[j][i])row=false;
		}
		if(column)res=true;
		if(row)res=true;
	}
	if(open[0][0] && open[1][1] && open[2][2])res=true;
	if(open[0][2] && open[1][1] && open[2][0])res=true;

	if(res)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#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() {
  string s;
  cin >> s;
  int ans = 0;
  if (s == "RRR") ans = 3;
  if (s == "RRS") ans = 2;
  if (s == "RSR") ans = 1;
  if (s == "RSS") ans = 1;
  if (s == "SRR") ans = 2;
  if (s == "SRS") ans = 1;
  if (s == "SSR") ans = 1;
  if (s == "SSS") ans = 0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
n=int(input())
l=list(map(int, input().split()))
val=0
ans=1
num=10**18
if 0 in l:
    print(0)
else:
    for i in l:
        l1=len(list(str(ans)))
        l2=len(list(str(i)))
        if l1+l2>20:
            val=1
            break
        ans=ans*i
        if ans>num:
            val=1
            break
    if val==1:
        print(-1)
    else:
        print(ans)

Measured memory_bytes: 21780
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int insertionSort(int A[], int N,int g,int cnt);
void shellSort(int A[], int n);

int main(){
	int *A, n, i;
	scanf("%d", &n);
	A = (int *)malloc(sizeof(int)*n);
	for (i = 0; i < n; ++i)  scanf("%d", A + i);
	shellSort(A, n);
	free(A);
	return 0;
}

int insertionSort(int A[], int N,int g,int cnt){
	int i, j, v;
	for (i = g; i < N ; i++) {
		v = A[i];
		j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j + g] = v;
	}
	return cnt;
}

void shellSort(int A[], int n){
	int cnt = 0, m=0;
	int *G;
	int i;
	
	for (i = 1; (int)(pow(3, i) - 1) / 2.0<n; i++) m++;
	if (n == 1) m = 1;
	G = (int *)malloc(sizeof(int)*m);
	for (i = m-1; i >= 0; --i) G[m-i-1] = (int)((pow(3, i+1) - 1) / 2.0);
	
	for (i = 0; i < m; i++) {
		cnt=insertionSort(A, n, G[i],cnt);
	}
	printf("%d\n", m);
	for (i = 0; i < m; ++i) printf("%d%c", G[i], i < m - 1 ? ' ' : '\n');
	printf("%d\n", cnt);
	for (i = 0; i < n; i++) printf("%d\n", A[i]);
}

Measured memory_bytes: 4516
#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()

int D;
vector<int> c;
vector<vector<int>> s;
vector<int> solution;
vector<int> last(26);

unsigned int xor128() {
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t;
    t = x ^ (x << 11);
    x = y; y = z; z = w;
    return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
}

ll evaluate(vector<int>& sol) {
    ll score = 1e6;
    fill(ALL(last), 0);

    REP(d, D) {
        int j = sol[d] - 1;
        last[j] = d + 1;
        REP(i, 26) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][j];
    }

    return max(score, 0ll);
}

void simulated_annealing() {

    auto begin_time = chrono::steady_clock::now();
    auto cur_time = begin_time;
    ll time_elapsed = 0;
    const ll DURATION = 1000;

    double temperature = 1;

    vector<int> cur_state = solution;

    ll cur_score = evaluate(cur_state);
    ll best_score = cur_score;

    int iter = 0;

    while (true) {
        // check the time and update the temperature
        if (iter % 100 == 0) {
            cur_time = chrono::steady_clock::now();
            time_elapsed = chrono::duration_cast<chrono::milliseconds>(cur_time - begin_time).count();
            if (time_elapsed > DURATION) break;
            temperature = (double) (DURATION - time_elapsed) / DURATION;
        }

        // get the next state
        // pick a day and change it to other type
        int d = xor128() % D;
        int i = cur_state[d];
        int j = xor128() % 26 + 1;
        cur_state[d] = j;

        // calculate the score of the next state
        ll next_score = evaluate(cur_state);

        // if the score improved or force_next is true, set the neighbor as the current node
        const ll R = 10000;
        // const bool force_next = temperature > (double) (xor128() % R) / R;
        const bool force_next = false;

        if (next_score > cur_score || force_next) {
            cur_score = next_score;
        } else {
            // roll back the change
            cur_state[d] = i;
        }

        // save the best state
        if (cur_score > best_score) {
            solution = cur_state;
            best_score = cur_score;
        }

        iter++;
    }

    cerr << "Time elapsed: " << time_elapsed << endl;
    cerr << "Iterations: " << iter << endl;
}

void greedy() {
    fill(ALL(last), 0);

    for (int d = 0; d < D; d++) {
        int j = 0, score = 0;
        for (int i = 0; i < 26; i++) {
            int nscore = s[d][i] + (d - last[i]) * c[i] * 5;
            if (nscore > score) {
                j = i;
                score = nscore;
            }
        }
        last[j] = d + 1;
        solution[d] = j + 1;
    }
}

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

    cin >> D;
    c.resize(26);
    REP(i, 26) cin >> c[i];
    s.resize(D, vector<int>(26));
    REP(i, D) REP(j, 26) cin >> s[i][j];
    solution.resize(D);

    greedy();
    simulated_annealing();

    REP(d, D) cout << solution[d] << endl;
}

Measured memory_bytes: 3712
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC113A
{
    static class MainClass
    {
        public static void Main(string[] args)
        {

            string[] input1 = Console.ReadLine().Split(' ');
            int N = int.Parse(input1[0]);

            if(N == 1){
                Console.WriteLine("Hello World");
                return;
            }


            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());

            Console.WriteLine(A + B);
            return;

        }


        public static int Gcd(int a, int b)
        {
            int tmp;
            // a<bにする
            if (a >= b)
            {
                tmp = a;
                a = b;
                b = tmp;
            }

            if (a == 0)
            {
                return b;
            }

            tmp = a;
            a = b % a;
            b = tmp;
            return Gcd(a, b);

        }


    }

}






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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> hig(n);
  vector<bool> good(n,true);
  for(int i=0; i<n; ++i){
    cin >> hig[i];
  }
  for(int i=0; i<m; ++i){
    int a, b;
    cin >> a >> b;
    --a; --b;
    if(hig[a] >= hig[b]) good[b]=false;
    if(hig[a] <= hig[b]) good[a]=false;
  }
  int ans=0;
  for(int i=0; i<n; ++i){
    if(good[i]) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3788
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int a,b,c;
    scanf("%d%d%d", &a,&b,&c);
    printf("%d\n", MIN(MIN(a+b,b+c),a+c));

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
using namespace std;


void solve(){
  int a, b, k; cin >> a >> b >> k;
  for(int i = a; i <= min(a + k - 1, b); i++) cout << i << endl;
  for(int i = max(b - k + 1, a + k); i <= b; i++) cout << i << endl;
  return;
}

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


Measured memory_bytes: 256
#include <iostream>

int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  
  int32_t N;
  std::cin >> N;
  int32_t orig_price = N / 1.08;
  if ((int32_t)(orig_price * 1.08) == N) {
    std::cout << orig_price << std::endl;
  } else if ((int32_t)((orig_price+1) * 1.08) == N) {
    std::cout << orig_price + 1 << std::endl;
  } else if ((int32_t)((orig_price-1) * 1.08) == N) {
    std::cout << orig_price - 1 << std::endl;
  } else {
    std::cout << ":(" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        
        for (int i = 0; i < n; i++) {
            double x1 = scanner.nextDouble();
            double y1 = scanner.nextDouble();
            double x2 = scanner.nextDouble();
            double y2 = scanner.nextDouble();
            double x3 = scanner.nextDouble();
            double y3 = scanner.nextDouble();
            double x4 = scanner.nextDouble();
            double y4 = scanner.nextDouble();

            
            if (isParallel(x1, y1, x2, y2, x3, y3, x4, y4)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    
    public static boolean isParallel(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
        if ( (x4-x3)*(y2-y1) == (x2-x1)*(y4-y3) ) {
            return true;
        } else {
            return false;
        }
    }
}

Measured memory_bytes: 18760
from collections import defaultdict,deque
import sys, bisect, math, itertools
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n = inp()
a = inpl()
dp = defaultdict(int)
ans=0
for i in range(n):
    #check
    if i-a[i]>=0:
        ans += dp[i - a[i]]
    
    dp[i + a[i]] += 1

print(ans)

Measured memory_bytes: 118992
#include<bits/stdc++.h>
using namespace std;   //author: madmin2619/mintu_agarwal
     
#define nfs() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define pf push_front
#define forin(i, n) for(int i=0;i<n;i++)
#define tr(c, it) for(auto it=c.begin();it!=c.end();it++)
#define sz(c) c.size()
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define m_p(x, y) make_pair(x, y)
     
const int M = 1e9 + 7;
     
int32_t main(){
    nfs()
    int t, n, i, j, k;
    t=1;
    while(t--){
        cin >> n >> k;
        vector<int> a(n, 0);
        forin(i, n)	cin >> a[i];
        vector<bool> dp(2*k+1, false);
        for(int i=0;i<=k;i++){
        	for(j=0;j<n;j++){
        		if(!dp[i])
        			dp[i+a[j]]=1;
        	}
        }
        if(dp[k])
        	cout << "First\n";
        else	cout << "Second\n";
    }
    return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  string s;
  cin>>s;
  int Q;
  cin>>Q;
  deque<char>q;
  for(auto it:s)q.push_back(it);
  bool now=true;
  for(int i=0;i<Q;i++){
    int t;
    cin>>t;
    if(t==1){
      now=!now;
    }
    if(t==2){
      int f;
      cin>>f;
      char c;
      cin>>c;
      if(f==1){
        if(now)q.push_front(c);
        else q.push_back(c);
      }
      if(f==2){
        if(now)q.push_back(c);
        else q.push_front(c);
      }
    }
  }
  if(now){
    while(q.size()){
      cout<<q.front();
      q.pop_front();
    }
  }
  else{
    while(q.size()){
      cout<<q.back();
      q.pop_back();
    }
  }
  return 0;
}


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    int n;
    cin >> n;
    vector<lint> a(n);
    lint sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }
    int ans = 0, now = n * a[0];
    rep(i, n){
        if(abs(now - sum) > abs(n * a[i] - sum)){
            ans = i;
            now = n * a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>  
using namespace std;

int main(void)
{
  int k;
  string s;

  cin>>k;

  for(int i=0;i<k;i++)
  {
    s+="ACL";
  }
  cout<<s<<endl;
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-

import sys

CELL_LENGTH = 9999
TOKEN = [">", "<", "+", "-", ".", ",", "[", "]"]

"""
"""; bfcode = """
+++[>,[>+<-]++++
[>--------<-]<-]>>.
""".strip()

"""

101
ABC 081 A Placing Marbles
bfcode by koi_koTya
"""; read = """
""".strip()[::-1]

if len(read) == 0:
    read = sys.stdin.read()[::-1]

read = list(read)
cells = bytearray([0] * CELL_LENGTH)
write = ""
seek = 0
ptr = 0

def ci(n): return n % CELL_LENGTH
def csize(n): return n % 256

while seek < len(bfcode):
    if bfcode[seek] == TOKEN[0]:
        ptr += 1

    elif bfcode[seek] == TOKEN[1]:
        ptr -= 1

    elif bfcode[seek] == TOKEN[2]:
        cells[ci(ptr)] = csize(cells[ci(ptr)] + 1)

    elif bfcode[seek] == TOKEN[3]:
        cells[ci(ptr)] = csize(cells[ci(ptr)] - 1)

    elif bfcode[seek] == TOKEN[4]:
        write += chr(cells[ci(ptr)])

    elif bfcode[seek] == TOKEN[5]:
        if read: cells[ci(ptr)] = ord(read.pop())

    elif bfcode[seek] == TOKEN[6]:
        # 0 < cells[ptr] なら何もしない。次の文字へ進む
        # cells[ptr] == 0 なら、"同階層の ']'" まで seek を進める
        if cells[ptr] == 0:
            level = 1
            while level != 0:
                seek += 1
                if seek == len(bfcode):
                    print("'{}' is missing".format(TOKEN[7]))
                    sys.exit(1)
                if bfcode[seek] == TOKEN[6]:
                    level += 1
                elif bfcode[seek] == TOKEN[7]:
                    level -= 1

    elif bfcode[seek] == TOKEN[7]:
        # cells[ptr] == 0 なら何もせず次の文字へ進む
        # 0 < cells[ptr] なら、"同階層の ']'" まで seek を戻す
        if cells[ptr] != 0:
            level = 1
            while level != 0:
                seek -= 1
                if seek < 0:
                    print("'{}' is missing".format(TOKEN[6]))
                if bfcode[seek] == TOKEN[7]:
                    level += 1
                elif bfcode[seek] == TOKEN[6]:
                    level -= 1
    seek += 1

if __name__ == "__main__":
    print(write)


Measured memory_bytes: 3192
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

typedef long long s64;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 100000;
const int MaxM = 100000;

int n, m;

struct halfEdge
{
	int v, w;
	halfEdge *next;
};
halfEdge adj_pool[MaxM * 2], *adj_tail = adj_pool;
halfEdge *adj[MaxN + 1];

inline void addEdge(const int &u, const int &v, const int &w)
{
	adj_tail->v = v, adj_tail->w = w;
	adj_tail->next = adj[u], adj[u] = adj_tail++;
}

int num[5];
bool inv;

int col[MaxN + 1];

void dfs(const int &u, const int &now)
{
	col[u] = now;
	++num[col[u]], ++num[3];

	for (halfEdge *e = adj[u]; e; e = e->next)
	{
		++num[4];

		int l = (now + e->w) % 3;
		if (!~col[e->v])
			dfs(e->v, l);
		else if (col[e->v] != l)
			inv = true;
	}
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int u = getint(), v = getint();
		addEdge(u, v, 1);
		addEdge(v, u, 2);
	}

	for (int u = 1; u <= n; ++u)
		col[u] = -1;

	s64 res = 0;
	for (int u = 1; u <= n; ++u)
		if (!~col[u])
		{
			inv = false;
			num[0] = num[1] = 0;
			num[2] = num[3] = num[4] = 0;

			dfs(u, 0);

			if (inv)
				res += (s64)num[3] * num[3];
			else if (!num[0] || !num[1] || !num[2])
				res += num[4] / 2;
			else
			{
				res += (s64)num[0] * num[1];
				res += (s64)num[1] * num[2];
				res += (s64)num[2] * num[0];
			}
		}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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() {
  string S;
  cin >> S;
  if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) cout << "Bad" << endl;
  else cout << "Good" << endl;
  return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;

int main ()
{
    int num ;
    st nu , ha1 , ha2 ;
    cin >> num ;
    cin >> nu ;

    ha1 = nu . substr (0 , (num / 2)) ;
    ha2 = nu . substr (num / 2 , num - 1) ;

    if (ha1 != ha2 || num < 2)
        printf("No") ;
    else if (ha1 == ha2)
        printf("Yes") ;

    return 0 ;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

        }

        public void Solve(ConsoleInput cin)
        {
            int a = cin.ReadInt;

            double max = 1;
            for (int i = 1; i < 100; i++)
                for (int j = 2; j < 100; j++)
                    if (Math.Pow(i, j) > max && Math.Pow(i, j) <= a)
                        max = Math.Pow(i, j);

            Console.WriteLine(max);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long num) { var ret = new string[num]; for (long i = 0; i < num; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long num) { var ret = new int[num]; for (long i = 0; i < num; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long num) { var ret = new long[num]; for (long i = 0; i < num; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int mx1 = INT_MIN, mx2 = INT_MIN, mn1 = INT_MAX, mn2 = INT_MAX;
    for(int i = 0; i < n; i++){
        int x, y;
        cin >> x >> y;
        mx1 = max(mx1, x + y);
        mn1 = min(mn1, x + y);
        mx2 = max(mx2, x - y);
        mn2 = min(mn2, x - y);
    }
    int ans = max(abs(mx1 - mn1), abs(mx2 - mn2));
    cout << ans;
    return 0;
}



Measured memory_bytes: 3656
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long A, B, X;
    scan(A, B, X);
    real eval(real theta)
    {
        real ha = A * sin((PI / 2) - theta);
        real hb = B * sin(theta);
        // writeln(theta);
        if (ha < hb)
        {
            return A * (A * B - (A * A * sin(PI / 2 - theta)) / (2 * sin(PI - theta)));
        }
        else
        {
            return A * ((B * B * sin(theta)) / (2 * sin(PI / 2 + theta)));
        }
    }

    real ok = 0;
    real ng = 90;
    while (10.0 ^^ -15 < ng - ok)
    {
        real m = (ok + ng) / 2;
        // writeln(m, " ", eval(PI * (90 - m) / 180));
        if (X <= eval(PI * (90 - m) / 180))
        {
            ok = m;
        }
        else
        {
            ng = m;
        }
    }
    writefln("%.10f", ok);
}


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

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

fn divisors(n: u64) -> Vec<u64> {
    let mut divisors: Vec<u64> = Vec::new();
    for i in 1..(n+1) {
        if i * i > n {
            break;
        }
        if n % i == 0 {
            divisors.push(i);
            if i * i != n {
                divisors.push(n / i);
            }
        }
    }
    divisors
}

fn main() {
    let n: u64 = input();
    let mut count = 0;
    for i in 1..(n+1) {
        if i % 2 == 1 && divisors(i).len() == 8 {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2084
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long int ll;
typedef pair<int, int> pr;
typedef priority_queue<int> p_int_max;
typedef priority_queue<int, vector<int>, greater<int>> p_int_min;

ll n, b, r, ans;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> b >> r;
    ans = b * (n / (b + r)) + ((n % (b + r)) < b ? (n % (b + r)) : b);
    cout << ans << "\n";
}


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

int main(){
  int N,result=0;
  cin>>N;
  string S;
  cin>>S;
  char x=' ';
  for(int i=0;i<N;i++){
    if(x!=S[i]){
      result++;
      x=S[i];
    }
  }
  cout<<result;
}

Measured memory_bytes: 512
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r, s;};
/*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
//s: 兄弟(sibling)
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];
int DEG[MAX];
int H[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", u, T[u].p, T[u].s, DEG[u], D[u], H[u] );

  if(D[u] == 0   /*ここを埋める (fill this blank)*/) printf("root");
  else if( H[u] == 0 /*ここを埋める(fill this blank)*/) printf("leaf");
  else printf("internal node");
  /*  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  */
   printf("\n");
}

void calcDepth(int u, int p){
  D[u] = p;
  if( T[u].r != NIL  /*ここを埋める*/) calcDepth( T[u].r, p+1    /*ここを埋める*/);
  if( T[u].l != NIL  /*ここを埋める*/) calcDepth( T[u].l , p+1 /*ここを埋める*/);
}

void calcDegree(int u){
  int tmp=0;
  if(T[u].r != NIL){
    DEG[u]+=1;
    calcDegree(T[u].r);
  }
 if(T[u].l != NIL){
    DEG[u]+=1;
    calcDegree(T[u].l);
  }



}


int calcHeight(int u){

  int left=0,right=0;

  if(T[u].l == NIL && T[u].r == NIL){
     H[u] = 0 ;
    return 0;
  }
  if( T[u].r != NIL) right = calcHeight(T[u].r)+1;
  if(T[u].l != NIL) left = calcHeight(T[u].l)+1;
		    
  if(left > right)  H[u] = left;
  else H[u] = right;

  return H[u];
}



int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d", &id);

    for(j = 0, sib = NIL; j<2; j++){ //子を入力する (input children)//2回まわす
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0){
	T[id].l = child; //idの一番左の子 (the most left child of id)
	
      }else{
	T[id].r = child; //左の兄弟に繋げる (connect to left sibling)
        //T[child].s = T[id].l;//兄弟の情報を伝える
	T[T[id].r].s = T[id].l;
	T[T[id].l].s = T[id].r;
	
      }
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
    //    T[T[child].s].s = T[T[child].s].r;//兄弟の情報を伝える
	
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  T[root].s = NIL; //ルートの兄弟を初期化
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //for(i=0; i<n; i++){
    calcDegree(root);
    //}
  //for(i=0; i<n; i++){
    calcHeight(root);
    //  }
    
  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 2104
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        String s = scan.next();
        if(s.charAt(a)!='-')
        {
            System.out.println("No");
            return;
        }
        for(int i=0;i<a;i++)
        {
            if(s.charAt(i)=='-')
            {
                System.out.println("No");
                return;
            }
        }
        for(int j=a+1;j<a+b+1;j++)
        {
            if(s.charAt(j)=='-')
            {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }    
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
using namespace std;
char s[200];
int n;
int main(){
	scanf("%s",s);
	scanf("%d",&n);
	int len=strlen(s);
	rep(i,0,len-1){
		if(s[i]=='1'){
			--n;
			if(n==0){
				printf("1");break;
			}
		}
		else{
			printf("%c",s[i]);break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        int n = nextInt();
        long m = nextLong();
        int[] a = new int[n];


        for (int i = 0; i < a.length; i++) a[i] = nextInt();

        long lcm = a[0];
        for (int i = 1; i < a.length; i++) {
            long gcd = gcd(a[i], lcm);
            lcm = lcm*a[i]/gcd;
        }

        boolean odd = (a[0]/2) % 2 == 1;
        boolean change = false;
        for (int i = 1; i < a.length; i++) {
            if (((a[i]/2) % 2 == 1) != odd) {
                change = true;
                break;
            }
        }
//        System.out.println(lcm + " " + (2 * m) / lcm);

        if (change) System.out.println(0);
        else {
            double ans = Math.ceil((double) ((2 * m) / lcm) / 2.0);
            if (odd) System.out.println((int) ans);
            else {
                odd = (lcm/a[0]) % 2 == 1;
                for (int i = 1; i < a.length; i++) {
                    odd = odd && (lcm/a[i]) % 2 == 1;
                }
                if (odd) System.out.println((int) ans);
                else System.out.println(0);
            }
        }
    }

    private static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

Measured memory_bytes: 39496
import sys
N,M = map(int,input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
for i in range(N-M+1):
    for l in range(N - M + 1):
        if A[i][l:l+M] == B[0]:
            for q in range(M):
                if A[i+q][l:l+M] != B[q]:
                    break
                if q == M-1:
                    print("Yes")
                    sys.exit()
print("No")


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#define FOR(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
int a[3000];
multiset<int> s;
int main (int argc, char *argv[])
{
	std::ios::sync_with_stdio(false);
	int n;cin>>n;
	int maxa=0;
	FOR(i,1,n){
		cin>>a[i];
		s.insert(a[i]);
		maxa=max(maxa,a[i]);
	}
	bool fail=false;
	FOR(i,(maxa+1)/2,maxa){
		int cnt=2;
		if (maxa%2==0 && i==maxa/2)	cnt--;
		//cout<<"r"<<cnt<<endl;;
		FOR(_,1,cnt){
			if (s.find(i)==s.end()){fail=true;}
			else s.erase(s.find(i));
		}
	}
	for(auto x:s){
		if (x<=maxa && x>=(maxa+1)/2+1)	;
		else fail=true;
	}
	if (fail)	cout<<"Impossible"<<endl;
	else cout<<"Possible"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define n 300000
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
struct edge{
	int to, weight;
};
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
vector<edge> V[n + 50];
int a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;

void solve()
{
	cin >> a >> str;
	for(int i=0; i<str.size(); i++)
	{
		str[i] += a;
		if(str[i] > 'Z') str[i] -= 26;
	}
	cout << str << '\n';
}	

Measured memory_bytes: 8832
c = []
for i in range(3):
   c.append(list(map(int, input().split())))

flag = 0
b = c[0]
for i in range(2):
   if (c[i+1][0]-b[0])==(c[i+1][1]-b[1])==(c[i+1][2]-b[2]):
      flag = flag+1

if flag == 2:
   print("Yes")

else:
   print("No")



Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {

  int n, odd, p;
  cin >> n;
  for(int i =1;i <= n;i++){
    cin >> p;
    odd += p % 2;
  }
  if(odd % 2 == 0){
    cout << "YES";
  }else{
    cout << "NO";
  }
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef long long ll;

mat mul(mat &A, mat&B) {
        mat C(A.size(),vec(B[0].size()));
        for(int i=0;i<A.size();i++){
                for(int k=0;k<B.size();k++){
                        for(int j=0;j<B[0].size();j++){
                                C[i][j] = (C[i][j] + A[i][k]*B[k][j]) % MOD;
                        }
                }
        }
        return C;
}

mat pow(mat A,ll n){
        mat B(A.size(), vec(A.size()));
        for(int i=0;i<A.size();i++) B[i][i] = 1;
        while(n > 0){
                if(n & 1) B = mul(B,A);
                A = mul(A,A);
                n >>= 1;
        }
        return B;
}

int main(){
  int n;
  ll k;
  cin >> n >> k;
  mat A(n,vec(n));
  rep(i,n)rep(j,n) cin >> A[i][j];
  mat B = pow(A,k);
  ll ans = 0;
  rep(i,n) rep(j,n) ans = (ans + B[i][j]) % MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
import collections
def main():

    N, M = map(int, input().split())
    graph = collections.defaultdict(list)
    for _ in range(M):
        A, B = map(int, input().split())
        graph[A].append(B)
        graph[B].append(A)

    visited = dict()
    cur = [1]
    while cur:
        temp = []
        for v in cur:
            for u in graph[v]:
                if u not in visited:
                    visited[u] = v
                    temp.append(u)
        cur = temp

    if len(visited) < N:
        print("No")
    else:
        print("Yes")
        for i in range(2, N+1):
            print(visited[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 47456
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
# print(N,A,B)
Nhunt = 0
for i in range(N):
    if A[i]>=B[i]: # Hunter is not strong enough
        Nhunt+=B[i]
    elif A[i+1]>=B[i]-A[i]:# Hunter is not strong enough to hunt all enemies.
        Nhunt+=B[i]
        A[i+1]-=B[i]-A[i]
    else:#Hunter is too strong
        Nhunt+=A[i]+A[i+1]
        A[i+1]=0

print(Nhunt)

Measured memory_bytes: 19648
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int ans = 0;
		
		for(int i=0; i<n-1; i++){
		    b[i] = sc.nextInt();
		}
		
		for(int i=0; i<n-1; i++){
		    if(i==0){
		        a[i]=b[i];
		    }else{
		        if(b[i]>=b[i-1]){
		            a[i]=b[i-1];
		        }else{
		            a[i]=b[i];
		        }
		    }
		    ans+=a[i];
		}
		
		ans+=b[n-2];
        System.out.println(ans);
	}
}


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

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

   string s;
   cin >> s;

   int ans = 0;

   for(int i = 1; i < n; i++){
       int cnt = 0;

       for(char  c = 'a'; c <= 'z'; c++){
           bool checkLeft = false;
           bool checkRight = false;

           //left
           for(int j = 0; j < i; j++){
               if(s.at(j) == c){
                   checkLeft = true;
               }
           }
           for(int j = i; j < n; j++){
               if(s.at(j) == c){
                   checkRight = true;
               }
           }

           if(checkLeft && checkRight){
               cnt++;
           }
       }

       if(cnt > ans) ans = cnt;
   }

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


Measured memory_bytes: 256
import math

def myfactorial(n):
    return math.factorial(n)

def combinations_count(n, r):
    return (myfactorial(n) // (myfactorial(n - r) * myfactorial(r))) % 1000000007

n, k = map(int, input().split())
for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
    else:
        print(combinations_count(k-1, i-1) * combinations_count(n-k+1, i) % 1000000007) 

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

int main() {
    int N, sum=0, a, tsum=0;
    cin >> N;
    int W[N];
    for(int i=0; i<N; i++) {
        cin >> W[i];
        sum += W[i];
    }
    a = sum/2;

    int j=0;
    while(tsum <= a) {
        tsum += W[j++];
    }
    if(abs(tsum-a) > abs(tsum-W[j-1]-a)) tsum -= W[j-1];
    cout << abs(tsum - (sum - tsum)) << endl;

    return 0;

}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    solve(java.util.Scanner(System.`in`))
}

fun solve(sc: java.util.Scanner) {
    val L = sc.nextInt()

    val result = (L.toDouble() / 3) * (L.toDouble() / 3) * (L.toDouble() / 3)
    println("%f".format(result))
}


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

int main() {
  int n;
  long long a = 1;

  cin >> n;
  
  vector<long> tmparr(n);
  double l;

  for (int i = 0; i < n; i++) {
    
    cin >> tmparr[i];
  }
  
  sort(tmparr.begin(), tmparr.end());
  if (tmparr[0] == 0) {
    cout << 0 << endl;
    return 0;
  }  

  for (int i = 0; i < n; i++) {
    l = log10(tmparr[i]) + log10(a);
    a = a * tmparr[i];

    if (l > 18 || a > 1000000000000000000) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << a << endl;
}

  

Measured memory_bytes: 4052
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
#define Length 80000
using namespace std;
typedef pair<ll, ll> P;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

bool used[110];

bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
	return a.first * a.first + a.second * a.second > b.first*b.first + b.second * b.second;
}

void solve(int n) {
	vector<pair<int, int>>p(n), q(n);
	for (int i = 0;i < n;i++) {
		cin >> p[i].first >> p[i].second;
	}
	for (int i = 0;i < n;i++) {
		cin >> q[i].first >> q[i].second;
	}
	int dist = Length, flag = 0;
	int ans = 0;
	sort(p.begin(), p.end());
	for (int i = 0;i < n;i++) {
		dist = Length;
		flag = 0;
		for (int j = 0;j < n;j++) {
			if (!used[j]) {
				int x = q[j].first - p[i].first;
				int y = q[j].second - p[i].second;
				if ((x > 0) && (y > 0) && y < dist) {
					dist = y;
					flag = j;
				}
			}
		}
		if (dist < Length) {
			ans++;
			used[flag] = true;
		}
	}
	cout << ans << endl;
}

ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

ll Q[110];
	
int main(void){
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0;i < n;i++)cin >> a[i];
	sort(a.begin(), a.end());
	int x = a[n - 1];
	int y = a[0];
	int z = a[0];
	if (x % 2 == 1) {
		int half = x / 2;
		for (int i = 0;i < n - 1;i++) {
			if (half < a[i]) {
				if (z < x - a[i]) {
					y = a[i];
					z = x - a[i];
				}
			}
			else {
				if (z < a[i]) {
					y = a[i];
					z = a[i];
				}
			}
		}
	}
	else {
		int half = x / 2;
		for (int i = 0;i < n - 1;i++) {
			if (half < a[i]) {
				if (z < x - a[i]) {
					y = a[i];
					z = x - a[i];
				}
			}
			else {
				if (z < a[i]) {
					y = a[i];
					z = a[i];
				}
			}
		}
	}
	cout << x << " " << y << endl;
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
vector<ll>kaijou;
ll exgcd(ll a, ll b, ll& x, ll& y) {
  ll d = a;
  if (b == 0) {
    x = 1;
    y = 0;
  }
  else {
    d = exgcd(b, a % b, y, x);
    y = y - (a / b) * x;
  }
  return d;
} 
ll flip(ll a);
ll combi(ll n, ll r);
int main () {
  ll H, W, A, B;
  cin >> H >> W >> A >> B;
  ll ans = 0;
  kaijou.resize(1000000);
  kaijou[0] = 1;
  for (int i = 1; i <= H + W + 3; i ++) {
    kaijou[i] = kaijou[i - 1] * i;
    kaijou[i] %= mod;
  }
  for (ll i = B; i <= W - 1; i ++) {
    ans += (combi(i + H - A - 1, i) * combi(W - i + A - 2, A - 1)) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
ll flip(ll a) {
  ll k, ans;
  ll d = exgcd(a, mod, ans, k);
  while (ans < 0) ans += mod;
  return ans % mod;
}
ll combi(ll n, ll r) {
  ll ret = kaijou[n];
  ret *= flip(kaijou[r]);
  ret %= mod;
  ret *= flip(kaijou[n - r]);
  ret %= mod;
  return ret;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)      //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++)    //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> PII;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/
/*FUNCs=================================================*/
long long GCD(long long a, long long b){
    return (b ? GCD(b, a%b) : a);
}

// LCM == a*b/GCD(a,b)

/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);
    
    ll a,b; cin >> a >> b;
    ll ans =a*b;
    ans /= GCD(a, b);

    cout << ans << '\n';
}

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

answer=[-1,-1,-1]
for x in range(N+1):    
    for y in range(N-x+1):
        z=N-x-y
        A=Y-10000*x-5000*y-1000*z
        if A==0:
            answer=[x, y, z]

print(*answer)

Measured memory_bytes: 67396
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右下左上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, -1 };
constexpr int dy[] = { 0, 1, 0, -1, 1, 1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; ++i) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j]; return a;
        }
    };
    inp inp1;
}

int main() {

    int n = inp1;
    vector<int> a = inp(n);

    sort(allof(a));

    map<int, bool> mp;

    int ans = 0;

    vector<int> num(*max_element(allof(a)) + 1, 0);
    for (auto v : a) ++num[v];

    for (auto v : a) {
        if (num[v] >= 2) {
            mp[v] = true;
            continue;
        }

        bool can = true;

        for (int i = 1; i * i <= v; ++i) {
            if (v % i == 0) {
                int first = i;
                int second = v / i;
                if (mp.find(first) != mp.end()) {
                    can = false;
                    break;
                }
                if (mp.find(second) != mp.end()) {
                    can = false;
                    break;
                }
            }
        }

        if (can) {
            ++ans;
            mp[v] = true;
        }
    }

    Cout(ans);

    return 0;
}


Measured memory_bytes: 17168