akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int d = 0;
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for(int n = 1; n <= a; n++) {
			int b = sc.nextInt();
			d = d + b;
			list.add(b);
		}
		Integer i = Collections.max(list);
		int c  = d - i;
		i = i / 2;
		c = c + i;
		
		System.out.println(c);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    string a;
    map<char, int> mp;
    cin >> a;

    ll n = a.size();
    ll ans = 1 + n * (n - 1) / 2;
    REP(i, n)
    {
        ans -= mp[a[i]];

        mp[a[i]]++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pii> vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef map<ll,ll> mll;

#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin() , x.end()
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define F first
#define S second
#define left (node << 1)
#define right (node << 1) + 1
// #define mod 998244353
#define mod 1000000007 

#define trace1(x)                       cerr<<#x<<": "<<x<<endl
#define trace2(x, y)                    cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)                 cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(x, y, z , t)             cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#t<<": "<<t<<endl
#define trace5(x, y, z , t , u)         cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#t<<": "<<t<<" | "<<#u<<": "<<u<<endl
#define trace6(x, y, z , t , u , v)     cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#t<<": "<<t<<" | "<<#u<<": "<<u<<" | "<<#v<<": "<<v<<endl

#define repa(i,sta,end,inc) for(int i = sta ; i <= end ; i += inc)
#define repb(i,sta,end,inc) for(int i = sta ; i >= end ; i -= inc)

ll power(ll x , ll y , ll z){ll res = 1;x %= z;while(y){if(y&1){res = res * x % z;}x = x*x % z;y /= 2;}return res%z;}
ll gcd(ll a , ll b){return (b == 0 ? a : gcd(b , a % b));}

const int N = 2 * 100000 + 1;
const int inf = (1<<30);

void solve(){
    string s;
    cin >> s;
    if(s[0] == '7' or s[1] == '7' or s[2] == '7'){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


int main(){
    FIO;
    int T = 1;
    // cin >> T;
    repa ( i , 1 , T , 1){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3656
result=[]
while true
  m, f, r = gets.split.map(&:to_i)
  sum=m+f
  if m==-1 && f==-1 && r==-1
    break
  elsif m==-1 || f==-1
    result << "F"
  elsif sum>=80
    result << "A"
  elsif sum>=65 && sum<80
    result << "B"
  elsif sum>=50 && sum<65
    result << "C"
  elsif sum>=30 && sum<50
    if r>=50
      result << "C"
    else
      result << "D"
    end
  else 
    result << "F"
  end
end
puts result

Measured memory_bytes: 8608
#include <stdio.h>
#include <algorithm>
const int maxn = 1e5+10;
using namespace std;
int a[maxn], n, k, mi = 1e9, l, r, ans = 1e9;
int check(int x){
    if(x%(k-1) == 0) return x/(k-1);
    return x/(k-1)+1;
}
int main(){
    scanf("%d%d", &n, &k);
    for(int i=0;i<n;i++){
        scanf("%d", &a[i]);
        mi = min(mi, a[i]);
    }
    for(int i=0;i<n;i++){
        if(mi == a[i]){
            l = i;
            r = n-1-i;
            break;
        }
    }
    ans = min(ans, check(l)+check(r));
    for(int i=1;i<=min(l, k-1);i++){
        ans = min(ans, check(l-i)+check(r-(k-1-i))+1);
    }
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;
int n , a[N] , seg[4*N];
set<int> st;
set<int> ::iterator it;

void update(int node , int st , int en , int idx , int val)
{
    if (st==en)
    {
        seg[node] = val;
    }
    else
    {
        int mid = (st+en)/2;
        if (st <= idx && idx <= mid) update(2*node , st , mid , idx , val);
        else update(2*node+1 , mid+1 , en , idx , val);
        seg[node] = max(seg[2*node] , seg[2*node+1]);
    }
}

int query(int node , int st , int en , int l , int r)
{
    if (r<st || l>en) return -1e9;

    if (l<=st && en <= r)
        return seg[node];

    int mid = (st+en)/2;
    return max(query(2*node , st , mid , l , r) , query(2*node+1 , mid+1 , en , l , r));
}

int BS(int idx)
{
    int l=idx+1 , h=n , mid , ans=1e9;
    while(l<=h)
    {
        mid = (l+h)/2;
        if (query(1,1,n,idx+1,mid) > a[idx])
        {
            ans = min(ans , mid);
            h = mid-1;
        }
        else l=mid+1;
    }
    if (ans == 1e9) return -1;
    return ans;
}

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

    cin >> n;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        update(1,1,n,i,a[i]);
        st.insert(i);
    }

    int ans=0;
    while(st.size())
    {
        ans++;
        int idx = *st.begin();
        while(idx != -1)
        {
            update(1,1,n,idx,(int)-1000000000);
            st.erase(idx);
            idx = BS(idx);
        }
    }

    cout << ans << '\n';

    return 0;
}

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

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

    cin >> a >> b >> c >> d;

    long long int temp1 = a*c, temp2 = b*d, temp3 = a*d, temp4 = b*c;

    // cout << temp1 << endl;

    long long int ans1 = max(temp1, temp2);
    long long int ans2 = max(temp3, temp4);

    long long int ans = max(ans1, ans2);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3596
package main

import "fmt"

func nextInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func main() {
	n := nextInt()
	cnt := 0

	for range make([]struct{}, n) {
		a := nextInt()
		for a%2 == 0 {
			cnt++
			a /= 2
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int N,T,t[200010],ans=0;

int main(){
	cin>>N>>T;
	REP(i,N){
		cin>>t[i];
	}
	REP(i,N-1){
		if(i!=N-1&&t[i+1]-t[i]<=T){
			ans+=t[i+1]-t[i];
		}
		else{
			ans+=T;
		}
	}
	ans+=T;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>

using namespace std;

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

	ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
	cout << (1900 * M + 100 * (N - M)) * pow(2 , M) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
ll cnt[10000001];
void divisor()
{
    for(int i=1;i<=10000005;i++)
    {
        cnt[i]=1;
    }
        for(int i=2;i<=10000000;i++)
            for(int j=i;j<=10000000;j+=i)
            cnt[j]++;

}
int main()
{
    ios;
    divisor();
    int n;
    cin>>n;
    ll sum=0;
     for(ll i=1;i<=n;i++)
        sum+=(i*cnt[i]);
        cout<<sum<<endl;
}










































Measured memory_bytes: 81748
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

#define INF (1e9)

vvvi G;
vector<bool> visited;
vi ans;

void dfs(int v) {
    visited[v] = true;
    for (auto nv : G[v]) {
        if (visited[nv[0]]) continue;
        if (nv[1] == 0) {
            ans[nv[0]] = ans[v];
        } else {
            ans[nv[0]] = 1 - ans[v];
        }
        dfs(nv[0]);
    }
}

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

    G = vvvi(N, vvi(0));
    visited = vector<bool>(N);

    int u, v, w;

    for (int i = 0; i < N - 1; i++) {
        cin >> u >> v >> w;
        u--;
        v--;
        G[u].push_back(vi{v, w % 2});
        G[v].push_back(vi{u, w % 2});
    }

    ans = vi(N);
    dfs(0);

    for (int a : ans) cout << a << endl;
    return 0;
}


Measured memory_bytes: 18432
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	s_list = list(S())
	for t in range(2,min(len(s_list)+1,4)):
		for i in range(len(s_list)-t+1):
			c = Counter(s_list[i:i+t])
			if c.most_common()[0][1] / t  > 0.5:
				print(i+1, i+t)
				break
		else:
			continue
		break
	else:
		print(-1, -1)

if __name__ == '__main__':
    main()

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

int main()
{
	ll N, K;
	cin >> N >> K;
	ll t0 = N / K, t1 = K & 1 ? 0 : max(0LL, (N + K / 2) / K);
	cout << t0 * t0 * t0 + t1 * t1 * t1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;

int main() {
    int n,k;
    cin >> n >> k;
    int a,m;
    rep(i,n) {
        cin >> a;
        if (a==1) m=i;
    }
    int l=m,r=n-1-m;
    if (l<r) swap(l,r);
    int ans=1;
    if (r<k) {
        l=n-k;
        if (l>0) {
            ans+=l/(k-1);
            if (l%(k-1)>0) ++ans;
        }
    } else {
        ans=(n-1)/(k-1);
        if ((n-1)%(k-1)>0) ++ans;
    }
    cout << ans << endl;
}

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

int main(){
    int h, w, n;
    std::cin >> h >> w >> n;
    std::vector<int> c(h * w);

    int k = 0;
    for (int i = 1; i <= n; i++)
    {
        int a;
        std::cin >> a;
        for (int j = 0; j < a; j++)
        {
            c[k] = i;
            k++;
        }
    }
    
    k = 0;
    for (int i = 0; i < h; i++)
    {
        if (i % 2 == 0)
        {
            for (int j = 0; j < w; j++)
            {
                std::cout << c[k] << " ";
                k++;
            }
            std::cout << std::endl;
        }
        else
        {
            std::vector<int> tmp(w);
            for (int j = 0; j < w; j++)
            {
                tmp[j] = c[k];
                k++;
            }
            for (int j = w - 1; j >= 0; j--)
            {
                std::cout << tmp[j] << " ";
            }
            std::cout << std::endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
int score_a,score_b;
int main(void)
{
using namespace std;
int n,data_a,data_b;
while(1)
{
cin>>n;
if(!n)break;
score_a=0;
score_b=0;
for(;n>0;n--){
cin>>data_a;
cin>>data_b;
if(data_a>data_b){
score_a+=(data_a+data_b);
}else if(data_a<data_b){
score_b+=(data_a+data_b);
}else{
score_a+=data_a;
score_b+=data_b;
}
}
cout<<score_a<<" "<<score_b<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <algorithm>
using namespace std; 
  
typedef long long LL; 
typedef pair<int, int> pii; 
typedef pair<LL, LL> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<string> vs;
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<LL> vl; 
typedef vector<vl> vvl; 
  
double EPS = 1e-9; 
int INF = 100005; 
long long int mod=1000000007;
long long TES=1000007;
long long INFF = 1000000000000000005LL; 
double PI = acos(-1); 
int dirx[8] = { -1, 0, 0, 1, -1, -1, 1, 1 }; 
int diry[8] = { 0, 1, -1, 0, -1, 1, -1, 1 }; 
  
#ifdef TESTING 
#define DEBUG fprintf(stderr, "====TESTING====\n") 
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl 
#define debug(...) fprintf(stderr, __VA_ARGS__) 
#else 
#define DEBUG 
#define VALUE(x) 
#define debug(...) 
#endif 
  
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a)) 
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a)) 
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a)) 
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a)) 
#define FOREACH(a, b) for (auto&(a) : (b)) 
#define rep(i, n) FOR(i, 0, n) 
#define repn(i, n) FORN(i, 1, n) 
#define MAX(a, b) a = max(a, b) 
#define MIN(a, b) a = min(a, b) 
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define TC(t) while (t--)

void solve()
{
    LL n,sum=0;
    cin>>n;
    int  mp[100005]={0};
    rep(i,n)
    {
        int temp;
        cin>>temp;
        sum+=temp;
        mp[temp]++;
    }
    LL query;
    cin>>query;
    rep(i,query)
    {
        LL a,b;
        cin>>a>>b;
        sum+=(b-a)*mp[a];
        mp[b]+=mp[a];
        mp[a]=0;
        cout<<sum<<endl;
    }
    return;
}
 
int main()
{
    IOS();
    solve();
    return 0;
}





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

int main(){
  int n;
  cin >> n;
  bool x = false;
  for(int i = 1; i<=9; i++){
    for(int j = 1; j<=9; j++)
      if(i*j == n) x = true;
  }
  if(x) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll n, k;

ll solve() {
    ll res = k;
    for (int i = 0; i < n-1; i++)
        res *= (k-1);
    return res;
}

void input() {
    cin >> n >> k;
}

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

    input();
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 1e18
#define REPL(i,a,b) for(int i=a;i<a;++i)
#define REPLE(i,a,b) for(int i=a;i<=a;++i)
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;

#define M_PI 3.14159265358979323846

int a[100020][3];
const int oo = 1e9+10;
const int mod = 7901;

ll gcd(ll a, ll b){return a==0 ? b : gcd(b%a, a);}

int memo[100005][3];
int n,k;

int dp(int ac, int d){
	if(d == n)return 0;
	if(ac == 4){
		int ans = dp(0, d+1) + a[d][0];
		ans = max(ans , dp(1, d+1) + a[d][1]);
		ans = max(ans , dp(2, d+1) + a[d][2]);
		memo[d][ac] = ans;
	}
	if(memo[d][ac] != -1)return memo[d][ac];
	if(ac==0){
		int ans = dp(1, d+1) + a[d][1];
		ans = max(ans , dp(2, d+1) + a[d][2]);
		memo[d][ac] = ans;
	}
	if(ac==1){
		int ans = dp(0, d+1) + a[d][0];
		ans = max(ans , dp(2, d+1) + a[d][2]);
		memo[d][ac] = ans;
	}
	if(ac==2){
		int ans = dp(0, d+1) + a[d][0];
		ans = max(ans , dp(1, d+1) + a[d][1]);
		memo[d][ac] = ans;
	}
	return memo[d][ac];
}

void solve(){
	cin>>n;
	for(int i = 0 ; i < n; ++i){
		for(int j = 0 ; j < 3 ; ++j){
			cin >> a[i][j];
		}
	}	
	memset(memo, -1, sizeof memo);
	cout << dp(4,0) << '\n';
}
int main(){   
    ios::sync_with_stdio(0);cin.tie(0);
	int t=1;
	while(t--){
		solve();
	}
}  

Measured memory_bytes: 13676
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a + b >= 10) {
            _out.println("error");
        } else {
            _out.println((a + b));
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 21844
import java.math.BigInteger;
import java.util.*;
public class Main{
public static void main(String[]args) {
	Scanner sc = new Scanner (System.in);
	int a= sc . nextInt();
	ArrayList<Long> ar= new ArrayList<Long>();
	for(int i=0;i<a;i++) {
		long val = sc.nextLong();
		ar.add(val);
		if(val == 0) {
			System.out.println("0");
			return ;
		}
	}
	BigInteger prod= new BigInteger("1");
	for(long i:ar) {
		prod = prod.multiply(BigInteger.valueOf(i));
		if(prod .compareTo(BigInteger.valueOf((long) Math.pow(10, 18))) == 1) {
			System.out.println("-1");
			return;
		}
	}
	System.out.println(prod.longValue());
	
}
}


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

int main() {
  string C;
  cin >> C;
  if (C == "a" || C == "i" || C == "u" || C == "e" || C == "o"){
    cout << "vowel" << endl;
  }
  else cout << "consonant" << endl;
    
}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = int.Parse(Console.ReadLine());
        int[] p = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = 0;
        for (int i = 0; i < n; i++)
        {
            if (i < n - 1)
            {
                if (p[i] == i + 1)
                {
                    var tmp = p[i];
                    p[i] = p[i + 1];
                    p[i + 1] = tmp;

                    ans++;
                }
            }
            else
            {
                if (p[i] == i + 1)
                {
                    var tmp = p[i];
                    p[i] = p[i - 1];
                    p[i - 1] = tmp;

                    ans++;
                }
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 18016
from heapq import heappush, heappop, heapify

N,M = map(int, input().split())
hq = [-int(i) for i in input().split()]

heapify(hq)

for i in range(M):
    tmp = -heappop(hq) // 2
    heappush(hq, -tmp)

print(-sum(hq))    


Measured memory_bytes: 14180
*S, = map(ord, input())
N = len(S)
L = 26
ca = ord('a')
d = [[] for i in range(L)]
for i, c in enumerate(S):
    d[c-ca].append(i)

odd = 0
for v in d:
    if len(v) % 2:
        odd += 1
if not odd <= N%2:
    print(-1)
    exit(0)

data = [0]*(N+1)
def add(k, x):
    while k <= N:
        data[k] += x
        k += k & -k
def get(k):
    s = 0
    while k:
        s += data[k]
        k -= k & -k
    return s

M = [None]*N
for v in d:
    vl = len(v)
    for i in range(vl):
        if not i <= vl-1-i:
            break
        p = v[i]; q = v[-i-1]
        M[p] = q
        M[q] = p
cnt = 0
B = [0]*N
for i in range(N-1, -1, -1):
    if M[i] <= i:
        B[i] = B[M[i]] = cnt
        cnt += 1

cur = -1
ans = 0
for i in range(N-1, -1, -1):
    if cur < B[i]:
        cur = B[i]
        if M[i] == i:
            ans += N//2 - cur
        else:
            ans += M[i] - get(M[i]+1)
        add(M[i]+1, 1)
print(ans)

Measured memory_bytes: 21036
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	int k, x;
	cin >> k >> x;

	if (k * 500 >= x) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

int main() {
  vector<int> vec(5);
  for (int i = 0; i < 5; i++) cin >> vec.at(i);
  int N;
  cin >> N;

  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if(max(vec.at(i), vec.at(j)) - min(vec.at(i), vec.at(j)) > N) {
        cout << ":(" << endl;
        return 0;
      }
    }
  }

  cout << "Yay!" << endl;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

ll A, B, C, K;

ll GetDigit(ll num){
    return to_string(num).length();
}


signed main()
{
    cin >> A >> B >> C >> K;
    if(K % 2 == 0) {
        printf("%lld\n", A - B);
    } else {
        printf("%lld\n", (B + C) - (A + C));
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;
 
class Main
{
 public static void main(String[] args) throws IOException
 {
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     String str = br.readLine();
     String[] abc = str.split(" ", 0);
     int a = Integer.parseInt(abc[0]);
     int b = Integer.parseInt(abc[1]);
     int c = Integer.parseInt(abc[2]);
 
     if(a < b){
         if (b<c){        
         System.out.println(a+" "+b+" "+c);}
         else if(a<c){
             System.out.println(a+" "+c+" "+b);}
         else{
             System.out.println(c+" "+a+" "+b);}
         }       
     else {
         if (a<c){        
             System.out.println(b+" "+a+" "+c);}
         else if(b<c){
             System.out.println(b+" "+c+" "+a);}
         else{
             System.out.println(c+" "+b+" "+a);}
 }
}
}

Measured memory_bytes: 24432
I=input;n,q=map(int,I().split());s=' %s '%I();l,r=0,n+1
for t,_,d in eval('I(),'*q)[::-1]:L=d<'R';R=1-L;l+=(t==s[l+1])*L-(t==s[l])*R;r+=(t==s[r])*L-(t==s[r-1])*R
print(max(0,r-l-1))

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

int a, b, c;


int main(){

    cin >> a;
    cin >> b;
    cin >> c;

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

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

//????????±?????¨??????
int lcs(string X, string Y) {
	static const int MAX_X = 0, MAX_Y = 0;
	static int dp[MAX_X + 1][MAX_Y + 1];
	memset(dp, 0, sizeof(dp));
	for (int i = 1; i <= X.size(); i++) {
		for (int j = 1; j <= Y.size(); j++) {
			if (X[i - 1] == Y[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else {
				dp[i][j] = max(
					dp[i - 1][j],
					dp[i][j - 1]
				);
			}
		}
	}
	return dp[X.size()][Y.size()];
}

//???????¢??????¨?????? (??????A[]???0??§?????????)
int lis(int A[]) {
	static const int MAX_N = 100000;
	static int a[MAX_N];
	memset(a, 0x3f, sizeof(a));
	for (int i = 0; i < MAX_N; i++) {
		*lower_bound(a, a + MAX_N, A[i]) = A[i];
	}
	return find(a, a + MAX_N, INF) - a;
}

int main() {
	int A[100000] = {};
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	cout << lis(A) << endl;
	return 0;
}

Measured memory_bytes: 2032
s=list(input())
t=list(input())
s=sorted(s)
t=sorted(t)
x=s[0]
for i in range(len(s)-1):
    x=x+s[i+1]
y=t[-1]
for i in range(len(t)-1):
    y=y+t[-i-2]




l=[]
l.append(x)
l.append(y)
l=sorted(l)

if l.index(x)<l.index(y):
    print("Yes")
else:
    print("No")


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

int X;

bool prime(int n){
  for(int i = 2; i * i < n; i++){ if(n % i == 0) return false; }
  return true;
}

int main(){
  cin >> X;

  int i = X;
  while(1){
    if(prime(i)){ cout << i << endl; return 0; }
    i++;
  }

  return 1;
}

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

using namespace std;

/**
 *  Name: Chris M. Perez
 *  University: Interamerican University Metro Campus
 *
**/

#define endl '\n'
#define MOD 10e9
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define gcd(x , y) __gcd(x , y)
#define all(x) (x).begin() , (x).end()
#define forn(i , a , b) for(int i=(a);i<(b);i++)
#define forrange(j , a , b) for(int j=(a);j<=(b);j++)
#define nestedforn(i , a , b , j , c , d) for(int i=(a);i<=(b);i++) for(int j=(c);j<=(d);j++)
#define sort_all(x) sort(all(x))
#define zeros_at_beginning(x) __builtin_clz(x)
#define zeros_at_end(x) __builtin_ctz(x)
#define ones(x) __builtin_popcount(x)
#define parity_even_or_odd_ones __builtin_parity(x)

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef tuple<int , int , int> tiii;
typedef vector<pii> vpii;
typedef vector<tiii> vtiii;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int lli;

             
inline int input(){
  int n;
  scanf("%d" , &n);
  return n;
}

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

#ifdef LOCAL_DEFINE
  freopen("input.txt" , "rt" , stdin);
#endif

  int n; cin >> n;
  int m; cin >> m;
  int c; cin >> c;
  vector<int> v;
  forn(i , 0 , m){
    int x; cin >> x; 
    v.push_back(x);
  }
  int t = INT_MAX;
  int k = 0;
  forn(i , 0 , n){
    t = c;
    forn(j , 0 , m){ 
      int x; cin >> x;
      t += v[j] * x;
    }
    if(t > 0) k++;
  }
  cout << k << endl;
         
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
  return 0;
}

Measured memory_bytes: 256
n, a, b, c, d = map(int, input().split())

cnt = n - 1
diff = abs(a-b)

for i in range(cnt+1):
    plus_cnt = i
    minus_cnt = cnt - i
    plus_range = [c*plus_cnt, d*plus_cnt]
    minus_range = [c*minus_cnt, d*minus_cnt]
    ran = [plus_range[0] - minus_range[1], plus_range[1] - minus_range[0]]
    if ran[0] <= diff and diff <= ran[1]:
        print("YES")
        exit()
print("NO")

Measured memory_bytes: 40428
import java.util.Arrays;
import java.util.Scanner;

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

		for(int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);

		int alice = 0;
		int bob = 0;

		for(int i = 0; i < n; i++) {
			if(i % 2 == 0) {
				alice += a[i];
			}else {
				bob += a[i];
			}
		}
		if (alice > bob) {
			System.out.println(alice - bob);
		} else {
			System.out.println(bob - alice);
		}
	}
}

Measured memory_bytes: 21844
x1,y1,x2,y2 = map(int,input().split())

v = [x2 - x1, y2-y1]
rotv = [-v[1],v[0]]

P3 = [x2+rotv[0],y2+rotv[1]]
P4 = [P3[0] - v[0], P3[1] - v[1]]

print(*(P3 + P4))

Measured memory_bytes: 38384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

ll MOD = 1000000007;

function<void(int,int)> tensi_no_3p=[&](int v,int d){
};

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	int N = in();
	vint A(N), B(N);
	rep(i, N) A[i] = in();
	rep(i, N) B[i] = in();
	repr(i, 1, N-1) A[i] += A[i-1];
	for (int i = N - 2; i >= 0; i--) B[i] += B[i+1];
	int ans = 0;
	rep(i, N) CHMAX(ans, A[i] + B[i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from itertools import product
N, M = list(map(int, input().split()))
light_sw = []
for _ in range(M):
    light_sw.append(list(map(lambda x: x-1, map(int, input().split()[1:]))))
P = list(map(int, input().split()))

count = 0
pro = product([0, 1], repeat=N)
for pr in pro:
    for i, sw in enumerate(light_sw):
        sw_sum = 0
        flag = True
        for k in sw:
            sw_sum += pr[k]
        if sw_sum%2 != P[i]:
            flag = False
            break
    if flag:
        count += 1
print(count)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,x=0,t,r=0,i;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        x=s[i]-'0';
        r=r+x;
    }
    if(r%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;


}


Measured memory_bytes: 3712
/**
 *      purpose : 
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 
**/

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}';
  return os;
}
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {
  return os << '{' << p.first << " " << p.second << '}';
}
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int64 INF64 = numeric_limits<int64>::max() / 2;
constexpr int MOD = 1'000'000'007;
const double PI = acos(-1);

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

  int a, b; cin >> a >> b;
  auto ok = [](int x) -> bool {
    return 1 <= x && x <= 9;
  };
  if (ok(a) && ok(b)) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
int n;
int x;
int num;
int min = 1000001;
int max = -1000001;
long total = 0;

scanf("%d", &n);
for (x = 0; x < n; x++) {
scanf("%d", &num);
if (min > num) min = num;
if (max < num) max = num;
total += num;
}
printf("%d %d %ld\n", min, max, total);

return (0);
}

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

class Hanafuda
{
  public:
    Hanafuda(int size);
    ~Hanafuda();
    void Shuffle(int p, int c);
    int Top();

  private:
    int* m_hanafuda;
    int m_size;
};

Hanafuda::Hanafuda(int size)
{
  m_size = size;
  m_hanafuda = new int[m_size];
  for (int i = 0; i < m_size; ++i)
  {
    m_hanafuda[i] = m_size - i;
  }
}

Hanafuda::~Hanafuda()
{
  delete[] m_hanafuda;
}

void Hanafuda::Shuffle(int p, int c)
{
  int* buf_p = new int[p-1];
  int* buf_c = new int[c];

  copy(m_hanafuda, m_hanafuda + p  - 1, buf_p);
  copy(m_hanafuda + p - 1, m_hanafuda + p - 1 + c, buf_c);
  
  copy(buf_c, buf_c + c, m_hanafuda);
  copy(buf_p, buf_p + p - 1, m_hanafuda + c);
}

inline int Hanafuda::Top()
{
  return m_hanafuda[0];
}

int main(void)
{
  while (true)
  {
    int n, r;
    cin >> n >> r;
    if ( n == 0 and r == 0 ) break;

    Hanafuda hanafuda(n);

    int p, c;
    for (int i = 0; i < r; ++i)
    {
      cin >> p >> c;
      hanafuda.Shuffle(p, c);
    }

    cout << hanafuda.Top() << endl;
  }
  return 0;
}

Measured memory_bytes: 1584
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define ll long long
#define INF 999999999

const ll mod = 1e9+7;

int main(){
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	REP(i, n){cin >> a[i];}
	auto min = min_element(a.begin(), a.end());
	ll ans = 0;
	if (n == k){
		cout << 1 << endl;
		return 0;
	}
	cout << (n-2)/(k-1) + 1 << endl;
}


Measured memory_bytes: 1024
N,*A=list(map(int,input().split()))
baml=[int(input()) for _ in range(N)]
ans=-1
tmp=0
def makelist(num):
    madelist=[[],[],[],[]]
    for i in range(N):
        madelist[num%4].append(i)
        num=int(bin(num>>2),0)
    return madelist

def mpcheck(n,comb):
    return abs(sum([baml[x] for x in comb])-A[n])+(len(comb)-1)*10

for i in range(4**N):
    mk=makelist(i)
    tmp=0
    flag=0
    if min([len(x) for x in mk[:3]])==0:
        continue
    for j in range(3):
        tmp+=mpcheck(j,mk[j])
    ans=(min(ans,tmp),tmp)[ans==-1]
print(ans)


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

int main() {
    char X, Y;
    std::cin >> X >> Y;

    if (X < Y) {
        std::printf("<\n");
    } else if (X > Y) {
        std::printf(">\n");
    }  else {
        std::printf("=\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  cout << n / 3 << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<string,int> P;
int digit(int n){
    if(n==0) return 0;
    else return 1 + digit(n/10);
}
int beki(int m){
    if(m==0) return 1;
    else return 10*beki(m-1);
}
int main(){
  	int a, b;
    cin >> a >> b;

    int check = b + beki(digit(b))*a;
    
    if(sqrt(check)==int(sqrt(check))) cout << "Yes" <<endl;
    else cout << "No" <<endl;



  return 0;
}






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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int x;
  cin >> x;
  int mx = 1000000;
  vector<int> is_prime(mx + 1, 1);
  vector<int> prime;
  int ans = 0;
  for (int i = 2; i <= mx; i++) {
    if (is_prime[i]) {
      for (int j = 2 * i; j <= mx; j += i)
        is_prime[j] = 0; // 素数の倍数を排除
      prime.push_back(i);
      if (x <= i) {
        ans = i;
        break;
      }
    }
  } 
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
// #define first first
// #define second se
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;

signed main(){
    string s;
    getline(cin, s);
    map<string, int> mp;
    stringstream ss;
    ss << s;
    string t;
    int l = 0;
    string lw;
    while(ss >> t){
        mp[t]++;
        if(t.size() > l){
            l = t.size(); lw = t;
        }
    }
    int MAX = 0;
    string ans;
    for(auto it = mp.begin(); it != mp.end(); it++){
        if(MAX < it -> second){
            MAX = it -> second;
            ans = it -> first;
        }
    }
    cout << ans << " " << lw << endl;
}

Measured memory_bytes: 3020
use std::cmp;
use std::collections::BTreeMap;

fn main() {
    let sc = std::io::stdin();
    let mut sc = Scanner { reader: sc.lock() };
    let n = sc.read();
    let mut graph = vec![vec![]; n];
    for _ in 1..n {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        graph[a].push(b);
        graph[b].push(a);
    }

    let mut max = vec![0; n];
    let mut parent = vec![0; n];
    dfs(0, 0, &mut max, &mut parent, &graph);

    let mut map = BTreeMap::new();
    let mut diff_count = vec![0; n];
    for v in 1..n {
        if v > max[parent[v]] {
            diff_count[v] = query(v, max[v], &graph, &parent, &mut map) + 1;
        } else {
            diff_count[v] = query(v, max[v], &graph, &parent, &mut map)
                - query(v, max[parent[v]], &graph, &parent, &mut map);
        }
    }

    let mut count = vec![0; n];
    count[0] = 1;
    ans_dfs(0, 0, &diff_count, &graph, &mut count);
    for i in 1..n {
        if i > 1 {
            print!(" ");
        }
        print!("{}", count[i] - 1);
    }
    println!();
}

fn ans_dfs(
    v: usize,
    p: usize,
    diff_count: &Vec<usize>,
    graph: &Vec<Vec<usize>>,
    count: &mut Vec<usize>,
) {
    for &next in graph[v].iter() {
        if next == p {
            continue;
        }
        count[next] = diff_count[next] + count[v];
        ans_dfs(next, v, diff_count, graph, count);
    }
}

fn query(
    v: usize,
    x: usize,
    graph: &Vec<Vec<usize>>,
    parent: &Vec<usize>,
    map: &mut BTreeMap<(usize, usize), usize>,
) -> usize {
    if map.contains_key(&(v, x)) {
        return *map.get(&(v, x)).unwrap();
    }
    let mut result = 0;
    for &child in graph[v].iter() {
        if parent[child] != v || child >= x {
            continue;
        }
        result += 1 + query(child, x, graph, parent, map);
    }
    map.insert((v, x), result);
    result
}

fn dfs(v: usize, p: usize, max: &mut Vec<usize>, parent: &mut Vec<usize>, graph: &Vec<Vec<usize>>) {
    for &next in graph[v].iter() {
        if p == next {
            continue;
        }
        parent[next] = v;
        max[next] = cmp::max(max[v], v);
        dfs(next, v, max, parent, graph);
    }
}

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

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


Measured memory_bytes: 67196
s = input()
n = len(s)
s = s[:-1] if n % 2 == 1 else s[:-2]
while len(s) >= 2:
    n = len(s)
    c = n // 2
    if s[:c] == s[c:]:
        print(n)
        break
    s = s[:-2]


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


vector<string> split(string str, string delim)
{
    vector<string> result;
    int cutAt;
    while( (cutAt = str.find_first_of(delim)) != str.npos )
    {
        if(cutAt > 0)
        {
            result.push_back(str.substr(0, cutAt));
        }
        str = str.substr(cutAt + 1);
    }
    if(str.length() > 0)
    {
        result.push_back(str);
    }
	return result;
}


struct P{ double x, y; };
bool operator > (P x, P y)
{ return x.x > y.x || (x.x == y.x && x.y > y.x); }


double getlen(P a, P b)
{ return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0)); }

double helon(double a, double b, double c)
{
	double s = (a + b + c) / 2;

	return sqrt(s * (s - a) * (s - b) * (s - c));
}

int main()
{
	vector<P> ps(4);
	string str;

	while(getline(cin, str))
	{
		vector<string> ss = split(str, ",");

		rep(i, 4)
		{
			stringstream sts;
			sts << ss[i*2];
			sts >> ps[i].x;
			sts.clear();
			sts.str("");
			sts << ss[i*2+1];
			sts >> ps[i].y;
		}

		if(cin.eof()) break;

		

		double ab = getlen(ps[0], ps[1]);
		double bc = getlen(ps[1], ps[2]);
		double cd = getlen(ps[2], ps[3]);
		double da = getlen(ps[3], ps[0]);
		double ac = getlen(ps[2], ps[0]);
		double db = getlen(ps[1], ps[3]);

		if( abs(helon(ab, bc, ac) + helon(cd, da, ac) - helon(db, bc, cd) - helon(ab, db, da)) < EPS)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A+B == C+D) {
    cout << "Balanced" << endl;
  } else if(A+B > C+D){
    cout << "Left" << endl;
  } else{
    cout << "Right" << endl;
  }
}

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

typedef long long ll;

ll arr[3005];
ll dp[3005][3005];


int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	
	for(int i = n-1; i >= 0; i--){
		for(int j = i; j < n; j++){
			if(i == j){
				dp[i][j] = arr[i];
			}else{
				dp[i][j] = max(arr[i]-dp[i+1][j], arr[j]-dp[i][j-1]);
			}
		}
	}
	
	cout << dp[0][n-1] << endl;
	
}

Measured memory_bytes: 70016