akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    V<> a(n);
    cin >> a[0];
    int all = a[0];
    rep(i, n-1) cin >> a[i+1], all = all ^ a[i+1];
    rep(i, n) {
        cout << (all ^ a[i]) << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
int main()
{
    int n;
    cin >> n;
    map<int,int> mp;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        mp[a]++;
    }
    ll num1 = 0,num2 = 0;
    for(auto x = mp.rbegin(); x != mp.rend(); x++){
        if(x->second >= 2){
            if(num1){
                num2 = x->first;
                break;
            }
            num1 = x->first;
            x->second -= 2;
        } 
        if(x->second >= 2){
            num2 = x->first;
            break;
        }
    }
    cout << num1*num2 << endl;
    return 0;
}

Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int q = Integer.parseInt(br.readLine());
		int[] x = new int[q];
		int[] d = new int[q];
		int[] n = new int[q];
		for (int i = 0; i < q; i++) {
			String[] sa = br.readLine().split(" ");
			x[i] = Integer.parseInt(sa[0]);
			d[i] = Integer.parseInt(sa[1]);
			n[i] = Integer.parseInt(sa[2]);
		}
		br.close();

		int mod = 1000003;
		long[] p = new long[mod];
		long[] pi = new long[mod];
		p[0] = 1;
		for (int i = 1; i < p.length; i++) {
			p[i] = p[i - 1] * i % mod;
			pi[i] = modinv(p[i], mod);
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < q; i++) {
			long xi = x[i];
			long di = d[i];
			long ni = n[i];
			if (di == 0) {
				pw.println(power(xi, ni));

			} else {
				long xd = xi * modinv(di, mod) % mod;
				if (xd == 0 || xd + ni - 1 >= mod) {
					pw.println(0);
				} else {
					long ans = p[(int) (xd + ni - 1)];
					if (xd > 1) {
						ans *= pi[(int) (xd - 1)];
						ans %= mod;
					}
					ans *= power(di, ni);
					ans %= mod;
					pw.println(ans);
				}
			}
		}
		pw.flush();
	}

	static long modinv(long a, long m) {
		long b = m;
		long u = 1;
		long v = 0;
		long tmp = 0;

		while (b > 0) {
			long t = a / b;
			a -= t * b;
			tmp = a;
			a = b;
			b = tmp;

			u -= t * v;
			tmp = u;
			u = v;
			v = tmp;
		}

		u %= m;
		if (u < 0) u += m;
		return u;
	}

	static long power(long x, long n) {
		if (n == 0) {
			return 1;
		}
		if (n % 2 == 0) {
			return power(x * x % 1000003, n / 2) % 1000003;
		} else {
			return x * power(x, n - 1) % 1000003;
		}
	}
}


Measured memory_bytes: 75036
# -*- coding: utf-8 -*-
import math
#from collections import Counter
import collections

def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    N = int(input())
    A  =  [int(i) for i in input().split()]

    A_plus = []
    A_minus = []
    for i, a in enumerate(A):
        A_plus.append(a+i)
        A_minus.append(-a+i)
    #print(A_plus,A_minus)
    plus = collections.Counter(A_plus)
    minus = collections.Counter(A_minus)
    ans = 0
    for k,v in plus.items():
        if k in minus.keys():
            ans += minus[k]*plus[k]
    print(ans)


if __name__ == "__main__":
    main()
"""
ans = 0
for i in range(2,N-1):
    k = 0
    while(k+i<N):
        #print(A[k], A[k+i],i)
        if(A[k]+A[k+i]) == i:
            ans += 1
        k+=1
print(ans)
"""


Measured memory_bytes: 143288
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 4000000;
const int mod = 998244353;
int t[N], suf[N], p[N], n;
bool ok(int x){
    int y = n;
    if (x == 1) return 0;
    while(y % x == 0){
        y /= x;
    }
    return (y % x == 1);
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  //  freopen("input.txt", "r", stdin);
    cin >> n;
    set <int> ans;
    for (int i = 1; i * i <= (n - 1); i++){
        if ((n - 1) % i == 0){
            ans.insert(i);
            ans.insert((n - 1) / i);
        }
    }
    for (int i = 1; i * i <= n; i++){
        if (ok(i)) ans.insert(i);
        if (ok(n / i)) ans.insert(n / i);
    }
    ans.erase(1);
    cout << ans.size();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int a[101];
int main(){
	cin>>N;
	int ans=0;
	REP(i,N){
		cin>>a[i];
		if(i!=0&&a[i]==a[i-1]){
			a[i]=-1;
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
(N,) = gets.chomp.split(/ /).map(&:to_i)
H = gets.chomp.split(/ /).map(&:to_i)

h0 = 0
H.slice(0, N).each {|h|
  if h0 <= h
    h0 = h
  elsif h0 == h + 1
    h0 = h + 1
  else
    h0 = nil
    break
  end
}

puts h0 ? "Yes" : "No"

Measured memory_bytes: 9604
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;


int main(){
    int N,K;
    cin >> N >> K;
    int A[N];
    REP(i,N){
        cin >> A[i];
    }
    cout << (N-2)/(K-1) + 1;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
int N,A,B;
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  cin>>N;
  if(N==1){
    cout << "Hello World"<<endl;
  }else{
    cin>>A>>B;
    cout<<A+B<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll fact[200003];
ll ifact[200003];
ll Combination(ll a,ll b) {
  ll s = (fact[a] * ifact[b]) % Mod;
  return (s * ifact[a-b]) % Mod;
}

int main() {
  fact[0] = 1;
  ifact[0] = 1;
  for (int i = 1; i <= 200003; i++) {
    fact[i] = fact[i-1] * i;
    fact[i] %= Mod;
    ifact[i] = modinv(fact[i],Mod);
  }
  int N,K;
  cin >> N >> K;
  for (int i = 1; i <= K; i++) {
    if (i > N - K + 1) {
      cout << 0 << endl;
    } else {
      ll res = Combination(N-K+1,i);
      res *= Combination(K-1,i-1);
      res %= Mod;
      cout << res << endl;
    }
  }  
  return 0;
}

Measured memory_bytes: 3328
import itertools

N = int(input())

xy = []
for _ in range(N):
    xy.append(list(map(int, input().split())))


junretsu = list(itertools.permutations(xy))
kyori_list = []
for temp in junretsu:
    total_kyori = 0
    for i in range(0,N-1):
        temp1 = temp[i+1][0] - temp[i][0]
        temp2 = temp[i+1][1] - temp[i][1]
        kyori = (temp1**2 + temp2**2) **0.5
        total_kyori += kyori
    
    kyori_list.append(total_kyori)


print(sum(kyori_list)/len(kyori_list))

   

Measured memory_bytes: 9332
#include <iostream>
#include <iomanip>
 

using namespace std;

 

int main()
{
    int a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (double)a / b;
    cout << fixed << setprecision(5) << d << " " << r << " " <<  f << endl; 
    
}


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

int main()
{
	string s;
	cin >> s;
	int n = s.size()+1;
	vector<int> ans(n);
	int cnt = 0;
	for(int i = 1 ;i<n;++i)
	{
		if(s[i-1]=='<')
		{
			cnt ++ ;
			ans[i]  = cnt;
		}
		else
		{
			cnt = 0;
		}
		
	}
	ans.back() = cnt;
	cnt = 0;
	
	for(int i=n-2;i>=0;i--)
	{
		if(s[i]=='>')
		{
			cnt ++;
			
			if(ans[i]==0)ans[i] = cnt;
			else ans[i] = max(ans[i],cnt);
		}
		else
		{
			cnt = 0;
		}
	}

	//for(int i = 0;i<n-1;i++){cout<<ans[i]<<' '<<s[i]<<' ';}cout<<ans.back();
	ll Ans = 0;
	for(auto i:ans)Ans += i;
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 2820
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <cstdlib>
using namespace std;

typedef pair<int,int> pii;


const char *p;

int solve(){
	int ret = 0;
	++p;
	if(*p == '['){
		vector<int> v;
		while(*p == '['){
			v.push_back(solve());
		}
		sort(v.begin(), v.end());
		ret = 0;
		for(int i = v.size() / 2; i >= 0; --i){
			ret += v[i];
		}
	}
	else{
		char *e;
		ret = strtol(p, &e, 10) / 2 + 1;
		p = e;
	}
	++p;
	return ret;
}


int main(){
	int n;
	string s;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> s;
		p = s.c_str();
		cout << solve() << endl;
	}
}

Measured memory_bytes: 1284
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> a = new ArrayList<>();
		int sum = 0;
		for(int i=0; i<n; i++) {
			int v = sc.nextInt();
			a.add(v);
			sum += v;
		}

		ArrayList<Integer> ans = new ArrayList<>();
		int x1 = sum;
		for(int i=1; i<n-1; i+=2) {
			x1 -= 2*a.get(i);
		}
		ans.add(x1);
		for(int i=1; i<n; i++) {
			int nx = 2*a.get(i-1)-ans.get(i-1);
			ans.add(nx);
		}
		for(int i=0; i<ans.size(); i++) {
			System.out.print((i>0 ? " " : "") + ans.get(i));
		}
		System.out.println();
		sc.close();
	}
}


Measured memory_bytes: 64920
(let* ((n (read))
    (ans (make-array (+ n 1) :initial-element 0)))

    (loop for x from 1 to 100 do
        (loop for y from 1 to 100 do
            (loop for z from 1 to 100 do
                (if (<= (+ (expt x 2) (expt y 2) (expt z 2) (* x y) (* y z) (* z x)) n)
                    (incf (aref ans (+ (expt x 2) (expt y 2) (expt z 2) (* x y) (* y z) (* z x))))
                )
            )
        )
    )
    (loop for i from 1 to n do
        (format t "~D~%" (aref ans i))
    )


)

Measured memory_bytes: 24324
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;

int int_pow(int n, int m){
	int ans = 1;
	while (m--){
		ans *= n;
	}
	return ans;
}

int main(){
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		int max = 0, mini = 0;
		char input[8];
		for (int j = 0; j < 8; j++){
			cin >> input[j];
			input[j] -= '0';
		}
		sort(input, input + 8);
		for (int j = 0; j < 8; j++){
			mini += input[j] * int_pow(10, 7 - j);
			max += input[j] * int_pow(10, j);
		}
		printf("%d\n", max - mini);
	}
}

Measured memory_bytes: 1160
#include <stdio.h>
#include<string.h>
int main(void){
char w[11],t[1001];
scanf("%s",w);
int i,j=0;
for(i=0;w[i];i++){
    if(w[i]>'Z')
    w[i]-=32;
}
while(1){
    scanf("%s",t);
    if(strcmp(t,"END_OF_TEXT")==0)
    break;
    
    for(i=0;t[i];i++){
    if(t[i]>'Z')
    t[i]-=32;
}
    if(strcmp(w,t)==0)
    j++;
    
}
printf("%d\n",j);
    return 0;
}

Measured memory_bytes: 2708
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    long long a,b,x;
    cin >> a >> b >> x;
    long long ans = b/x - a/x;
    if(a%x==0){
        ans++;
    }
    cout << ans << endl;

    return 0;
}

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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            double[] n = Console.ReadLine().Split(' ').Select(s => double.Parse(s)).ToArray();
            Array.Sort(n);
            int K = int.Parse(Console.ReadLine());
            for(int i = 0 ; i < K ; i++)
            {
                n[n.Count()-1] *= 2;
            }
            Console.WriteLine(n[0]+n[1]+n[2]);
        }
    }
}

Measured memory_bytes: 11476
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n;cin>>n;
    vLL A(n);cin>>A;
    
    int even = 0; int odd = 0;
    rep(i,n){
        if(A[i]%2==0)even++;
        else odd++;
    }

    if ((even==0 && odd == 1) || (even==1 && odd == 0))cout<<"YES"<<endl;
    else{
        if(odd%2==1){cout<<"NO"<<endl; return 0;}
        else cout<<"YES"<<endl;
    }
    
    
    // e e => e, o o =>eなので、oddの個数がどんどん減っていく。
    // eの個数をn, oの個数をmとした時、実質 eが n+m/2個と見て良い。
    // n + m/2個のeは最終的に1個まで落ちるので、その時点でoが余っていると不成立。
    // つまり、 oddが奇数ならアウト。
    
    
    return 0;
}








Measured memory_bytes: 1024
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN      
const ll mod=1e9+7;
const int N=2e5+4;

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

	if(x<0)
	x*=-1;

	if(x==0)
	{
		if(k%2==0)
		lpri(0LL);
		else
		lpri(d);

		return 0;
	}

	ll temp=x/d; 

	if(temp>=k)
	{
		ll ans=x-k*d;

		lpri(ans); return 0;
	}

	ll ans=0;

	if((k-temp)%2==0)
	ans=x-temp*d;
	else
	ans=x-(temp+1)*d;

	if(ans<0)
	ans*=-1;

	lpri(ans);

    return 0;
}

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

#define pb push_back

using ll = long long;
using pii = pair<int, int>;

const int N = 2e5 + 10;
ll psum[N];
map<int, ll> cnt;

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int N, K; cin >> N >> K;
    int pref = 0;
    ll ans = 0;
    cnt[0] = 1;
    for (int i = 1; i <= N; ++i) {
    	int A; cin >> A;
    	--A;
    	pref += A; pref %= K;
    	psum[i] = pref;
    	if (i - K >= 0)
    		--cnt[psum[i - K]];
    	if (cnt.count(pref)) {
    		ans += cnt[pref];
    		++cnt[pref];
    	}
    	else 
    		cnt[pref] = 1;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 14336
import java.util.Scanner;

public class Main {

	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] n = scanner.nextLine().toCharArray();
			System.out.println((n[0] == n[N - 1]) ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(), a.end());
	int ans = 0;
	rep(i,n-1){
		if(a[i] <= x){
			++ans;
			x -= a[i];
		}
		else break;
	}
	if(x == a[n-1]) ++ans;
	cout << ans << endl;
	return 0;
}


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

#include <bits/stdc++.h>
using namespace std;

typedef long long int64;

class CNextPrime {
 public:
  void solve(std::istream &in, std::ostream &out) {
    int n;
    in >> n;
    int ans = -1;
    for (int i = n; ans == -1; ++i) {
      bool ok = 1;
      for (int64 j = 2; j * j <= i; ++j) {
        if (i % j == 0) {
          ok = 0;
        }
      }
      if (ok)ans = i;
    }
    out << ans << endl;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  CNextPrime solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type TupleInt struct {
	first  int
	second int
}

func main() {
	sc := NewScanner()
	_, _, M := sc.NextInt(), sc.NextInt(), sc.NextInt()
	a := sc.NextIntArray()
	b := sc.NextIntArray()
	mp := map[TupleInt]int{}
	for j := 0; j < M; j++ {
		k := sc.NextIntArray()
		P := TupleInt{
			first:  k[0],
			second: k[1],
		}
		if l, ok := mp[P]; ok && l > k[2] {
		} else {
			mp[P] = k[2]
		}
	}
	min := minA(a...) + minA(b...)
	for k, v := range mp {
		q := a[k.first-1] + b[k.second-1] - v
		if min > q {
			min = q
		}
	}
	fmt.Println(min)
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func minA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = min(s, v)
	}
	return s
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 13184
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = n - 1; i >= 0; --i)
#define pb push_back

typedef long long ll;

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

	//x + y + z = s
	//z = S - x - y
	//k >= z = t = S - x -y
	
	int ans = 0;

	REP(i, k+1){
		REP(j, k+1){
			int t = s - i - j;
			if ((0 <= t) and ( t <= k)) ++ans;
		}
	}

	cout << ans << endl;


	return 0;
}

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

int main() {
  vector<int> V(3);
  cin >> V[0] >> V[1] >> V[2];
  sort(V.begin(), V.end());
  if (V[0]==V[1]) {
    cout << V[2] << endl;
  }
  else {
    cout << V[0] << endl;
  }
}


Measured memory_bytes: 3600
# 普通のナップサックは O(荷物の数、ナップサックに入る重量の上限)で計算できる。
# 今回はこれだと O(100 * 10**9) なので無理。
# 明らかに条件で重要なのは「すべてのi=2,3,...,Nについて、w_1<=w_i<=w_1+3」

# w_1が1000とする
# W = 4500→4つが必ず入り、5つは必ず入らない。価値の高いものから4つ。
# W = 4005→3つが必ず入る。4つが入るかどうかは場合による。
# max(3つの場合, 4つの場合)。3つは価値の高いものから3つ。4つは?
# 4つ選ぶ、4005以下、価値最大化
# dp[i][k][l]

# w_1〜w_iの中からk個選んで、重量をちょうどlにしたときの、最大価値
# dp[i][k][l] := max(dp[i-1][k][l], dp[i-1][k-1][l - w_i] + v_i)

# w_1〜w_iの中からk個選んで、重量をl以下にしたときの、最大価値
# dp[i][k][l] := max(dp[i-1][k][l], dp[i-1][k-1][l - w_i] + v_i)

# 後者を使うべき。更新式は同じで最後に重量に関してmaxを取る手間が無いので。
# i <= N, k <= N, l <= 3*N

n, w_limit = list(map(int, input().split()))

baggage = [list(map(int, input().split())) for _ in range(n)]

weight_base = baggage[0][0]

# i添字は0〜n-1 問題文から1引いて0-indexにする
# k添字は0〜n 
# l添字は0〜3n

for i in range(n):
    baggage[i][0] -= weight_base

dp = [[[0 for _ in range(3*n+1)] for _ in range(n+1)] for _ in range(n)]

for l in range(baggage[0][0], 3*n):
    dp[0][1][l] = baggage[0][1]

for i in range(1, n):
    for k in range(1, n+1):
        for l in range(3*n+1):
            if l - baggage[i][0] >= 0:
                dp[i][k][l] = max(dp[i-1][k][l], dp[i-1][k-1][l - baggage[i][0]] + baggage[i][1])
            else:
                dp[i][k][l] = dp[i-1][k][l]

valid_min_num = w_limit // (weight_base+3)
valid_max_num = w_limit // weight_base

ans = 0
for num in range(valid_min_num, min(valid_max_num, n) + 1):
    weight_rest = w_limit - weight_base * num
    if not 0 <= weight_rest:  # ここがないとREになるらしい。理由を要検討。
        continue
    elif weight_rest >= 3*n:
        weight_rest = 3*n

    # print(n-1, num, weight_rest)
    ans = max(ans, dp[n-1][num][weight_rest])

print(ans)


Measured memory_bytes: 97956
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
int dist(int a,int b,int c,int d){
    return abs(a-b)+abs(c-d);
}
int main(){
    int N,M;
    cin>>N>>M;
    vector<int> A(N);
    vector<int> C(N);
    vector<int> B(M);
    vector<int> D(M);
    vector<int> res(N,0);
    REP(i,N){
        cin>>A[i]>>C[i];
    }
    REP(i,M){
        cin>>B[i]>>D[i];
    }
    REP(i,N)REP(j,M){
        int k=res[i];
        if(dist(A[i],B[j],C[i],D[j])<dist(A[i],B[k],C[i],D[k]))
            res[i]=j;
    }
    for(auto &it:res)cout<<it+1<<endl;
    
    return 0;
}


Measured memory_bytes: 256
from collections import deque
n = int(input())
a = input().split()
b = deque()

if n % 2 == 0:
  for x in range(n):
    if x % 2 == 0:
      b.append(a[x])
    else:
      b.appendleft(a[x])
else:
  for y in range(n):
    if y % 2 == 1:
      b.append(a[y])
    else:
      b.appendleft(a[y])

print(" ".join(b))

Measured memory_bytes: 26564
#include <bits/stdc++.h>
using namespace std;
int a[110];
int main()
{
	int n;
	
	scanf("%d", &n);
	for (int i = 0; i < 2 * n; i++) {
		scanf("%d", &a[i]);
	}
	sort(a, a + 2 * n);
	int s = 0;
	for (int i = 0; i < 2 * n; i += 2) {
		s += a[i];
	}
	printf("%d\n", s);
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	for (int i = 0; i < 4;i++) {
		char c; cin >> c; cout << c;
	}
	cout << " ";
	for (int i = 0; i < 8; i++) {
		char c; cin >> c; cout << c;
	}
	cout << endl;
}

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

#define M_PI 3.141592653589793

int main(void) {

	int i, j;
	double r;

	scanf("%lf", &r);
	
	printf("%lf %lf\n", M_PI*r*r, 2 * M_PI*r);


	return 0;
}

Measured memory_bytes: 2740
(let* ((menu 
         (loop repeat 5 collect (read)))
       (extra-wait-time
         (- 10 (car (sort (mapcar (lambda (x) 
                                    (let ((x1 (rem x 10)))
                                      (if (equal x1 0)
                                        10
                                        x1)))
                                  menu) #'<))))
       (wait-time-with-extra
         (reduce #'+ (mapcar (lambda (x)
                               (let* ((x1 (rem x 10))
                                      (w  (if (equal x1 0) 0 (- 10 x1))))
                                 (+ x w)))
                             menu))))
  (format t "~a~%" (- wait-time-with-extra extra-wait-time)))


Measured memory_bytes: 15844
import sys
from collections import deque
#import numpy as np
import math
#sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve(val):
    if val<=1:
        return 1
    else:
        return 2*solve(val//2)+1

if __name__=='__main__':
    h = I()
    print(solve(h))

Measured memory_bytes: 9436
n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**n):
  bit = [i>>j & 1 for j in range(n)]
  for k,x in enumerate(s):
    if p[k] != sum([bit[y-1] for y in x[1:]])%2:
      break
  else:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;
llint mod = 1000000007;

int main() {
  queue<llint> q;
  for (int i = 1; i < 10; i++) {
    q.push(i);
  }
  int n;
  cin >> n;
  llint s;
  for (int i = 0; i < n; i++) {
    s = q.front();
    q.pop();
    if (s % 10 == 0) {
      q.push(s * 10);
      q.push(s * 10 + 1);
    }
    else if (s % 10 == 9) {
      q.push(s * 10 + 8);
      q.push(s * 10 + 9);
    }
    else {
      q.push(s*10+s%10-1);
      q.push(s*10+s%10);
      q.push(s*10+s%10+1);
    }
  }
  printf("%lld\n", s);
} 

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

int main(){
    int K, S;
    cin >> K >> S;

    int ct = 0;
    for(int a=0; a<=K; a++){
        for(int b=0; b<=K; b++){
            int c = S - b - a;
            if(c <= K && 0 <= c){
                ct++;
            }
        }
    }
    cout << ct << endl;

}

Measured memory_bytes: 256
def man_dis(s, c):
    return abs(s[0]-c[0])+abs(s[1]-c[1])


def main():
    n, m = map(int, input().split())
    s_list = [list(map(int, input().split())) for _ in range(n)]
    c_list = [list(map(int, input().split())) for _ in range(m)]

    for s in s_list:
        minv = 1000000000
        for i, c in enumerate(c_list):
            tmp = man_dis(s, c)
            if tmp < minv:
                minv = tmp
                idx = i
        print(idx+1)
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
  
x = int(input())
while True:
  if is_prime(x):
    print(x)
    break
  x += 1

Measured memory_bytes: 2940
grid = [[int(i) for i in input().split()] for _ in range(3)]

fin = False

for a1 in range(101):
	if fin:
		break
	for a2 in range(101):
		if fin:
			break
		for a3 in range(101):
			if (grid[0][0]-a1==grid[1][0]-a2 and grid[1][0]-a2==grid[2][0]-a3) and (grid[0][1]-a1==grid[1][1]-a2 and grid[1][1]-a2==grid[2][1]-a3) and (grid[0][2]-a1==grid[1][2]-a2 and grid[1][2]-a2==grid[2][2]-a3):
				print("Yes")
				fin = True
				break
if not fin:
	print("No")

Measured memory_bytes: 3064
n, q = map(int, input().split())
parents = [set() for _ in range(n)]
nodes = [0 for _ in range(n)]

for _ in range(n - 1):
    a, b = map(int, input().split())
    parents[b - 1].add(a - 1)

for _ in range(q):
    i, k = map(int, input().split())
    nodes[i - 1] += k

for i, p in enumerate(parents):
    nodes[i] += sum([nodes[j] for j in p])

print(*nodes)


Measured memory_bytes: 70200
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
diff_X = []
for i in range(M-1):
  tmp = X[i+1] - X[i]
  diff_X.append(tmp)

diff_X.sort(reverse=True)
ans = sum(diff_X[N-1:])
print(ans)

Measured memory_bytes: 13968
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<algorithm>
#define f first
#define s second
#define pb push_back
using namespace std;
int const INF=0x3f3f3f3f;
int const maxn=1005;
typedef long long ll;
typedef pair<int,int>P;
int a[12][maxn],num[12];
char p[maxn];
int n,m,k;
int judge(int x,int y){
	int res=0;
	for(int i=0;i<y;i++) num[i]=0;
	for(int i=0;i<m;i++){
		int cnt=0;
		bool flag=0;
		for(int j=0;j<n;j++){
			num[cnt]+=a[j][i]==0?1:0;
			if(num[cnt]>k) flag=1;
			if(x&(1<<j)) cnt++;
		}
		if(flag){
			res++;
			cnt=0;
			for(int j=0;j<y;j++) num[j]=0;
			for(int j=0;j<n;j++){
				num[cnt]+=(a[j][i]==0?1:0);
				if(x&(1<<j)) cnt++;
			}
			for(int j=0;j<y;j++) if(num[j]>k) return INF;
		}
	} 
	return res;
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++){
		scanf("%s",p);
		for(int j=0;j<m;j++) a[i][j]=(p[j]=='0'?1:0);
	}

	int num=n-1;
	int res=0x3f3f3f3f;
	for(int i=0;i<1<<num;i++){
		int cnt=0;
		for(int j=0;j<num;j++) if(i&(1<<j)) cnt++;
		cnt+=judge(i,cnt+1);
		res=min(res,cnt);
	}
	printf("%d\n",res);
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N, 0);
  for (int i = 1; i < N; i++) {
    int a;
    cin >> a;
    A[a - 1]++;
  }

  for (int i = 0; i < A.size(); i++) cout << A[i] << endl;

  return 0;
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long n, m;
		
		n = sc.nextLong();
		m = sc.nextLong();
		
		if(m < 2 * n)System.out.println(m / 2);
		else {
			long x = (m - 2 * n) / 4;
			x += n;
			System.out.println(x);
		}
		
		sc.close();
	}

}


Measured memory_bytes: 22868
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        // int T;
        // T=in.nextInt();
        // while((T--)>0)
        // {
        //     //code comes here

        // }   
            int TH,TS,HH,HS;
            TH=in.nextInt();
            TS=in.nextInt();
            HH=in.nextInt();
            HS=in.nextInt();
            int turnTaka=TH/HS;
            if(TH%HS!=0)
            ++turnTaka;
            int turnHaya=HH/TS;
            if(HH%TS!=0)
            ++turnHaya;
            if(turnHaya<=turnTaka)
            System.out.println("Yes");
            else
            System.out.println("No");

    }

}

Measured memory_bytes: 35768
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
// ------ Classes ------ //
class Point {
public:
	long double px, py;
	Point() : px(0), py(0) {};
	Point(long double px_, long double py_) : px(px_), py(py_) {};
	friend bool operator==(const Point& p1, const Point& p2) { return p1.px == p2.px && p1.py == p2.py; }
	friend bool operator!=(const Point& p1, const Point& p2) { return p1.px != p2.px || p1.py != p2.py; }
	friend Point operator+(const Point& p1, const Point& p2) { return Point(p1.px + p2.px, p1.py + p2.py); }
	friend Point operator-(const Point& p1, const Point& p2) { return Point(p1.px - p2.px, p1.py - p2.py); }
	friend Point operator*(const Point& p1, long double d) { return Point(p1.px * d, p1.py + d); }
	friend Point operator*(long double d, const Point& p1) { return p1 * d; }
	friend Point operator/(const Point& p1, long double d) { return Point(p1.px / d, p1.py / d); }
	Point& operator+=(const Point& p1) { px += p1.px; py += p1.py; return *this; }
	Point& operator-=(const Point& p1) { px -= p1.px; py -= p1.py; return *this; }
	Point& operator*=(long double d) { px *= d; py *= d; return *this; }
	Point& operator/=(long double d) { px /= d; py /= d; return *this; }
};
// ------ Functions ------ //
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int ccw(Point p0, Point p1, Point p2) {
	Point a = p1 - p0, b = p2 - p0;
	if (crs(a, b) > 1e-10) return 1;
	if (crs(a, b) < -1e-10) return -1;
	if (dot(a, b) < -1e-10) return 2;
	if (norm(a) < norm(b)) return -2;
	return 0;
}
// ------ Main ------ //
Point p1, p2, p3, p4; int r1, r2, r3, r4;
int main() {
	while (~scanf("%Lf,%Lf,%Lf,%Lf,%Lf,%Lf,%Lf,%Lf", &p1.px, &p1.py, &p2.px, &p2.py, &p3.px, &p3.py, &p4.px, &p4.py)) {
		r1 = ccw(p1, p2, p3);
		r2 = ccw(p2, p3, p4);
		r3 = ccw(p3, p4, p1);
		r4 = ccw(p4, p1, p2);
		printf("%s\n", (r1 == r2 && r2 == r3 && r3 == r4 && abs(r1) == 1) ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 3108
#include <stdio.h>
int main(void)
{
	int w;
	int m,i;
	
	while(scanf("%d",&w)&&w!=-1){
		m=1150;
		if(10<w&&w<=20)
			m=m+125*(w-10);
		if(20<w&&w<=30)
			m=m+140*(w-20)+1250;
		if(30<w)
			m=m+160*(w-30)+2650;
		
		printf("%d\n",4280-m);
	}
	return 0 ;
}

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

#define M 1e6

int main(){
  vector<bool> hurui(M, true);
  hurui[1] = false;
  for(int i=2; i<=sqrt(M); i++){
    if(hurui[i]){
      for(int j=2*i; j<M; j+=i){
        hurui[j] = false;
      }
    }
  }
  
  int a, d, n;
  while(true){
    cin >> a >> d >> n;
    if(a == 0)
      break;

    for(int i=a; i<M; i+=d){
      if(hurui[i])
        n--;
      if(n == 0){
        cout << i << endl;
        break;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 3172
#優先度付きキュー -> 最小値をO(logN)で取り出す
import heapq

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

a = [-x for x in a]

#aを優先度付きキューに変更
heapq.heapify(a)

for _ in range(m):
   
    tmp = heapq.heappop(a)
    tmp = (-tmp // 2) * -1
    heapq.heappush(a,tmp)
        
    
print(sum(a) * -1)

Measured memory_bytes: 14224
#include<stdio.h>

int A[1000000],n;
int binarySearch(int key){
int left=0;
int right=n;
int mid;
while(left<right){
mid=(left+right)/2;
if (key==A[mid]) return 1;
if (key>A[mid]) left=mid+1;
else if(key<A[mid]) right=mid;
}
return 0;
}
int main(){
int i,q,k,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&k);
if (binarySearch(k))sum++;
}
printf("%d\n",sum);
return 0;
}

Measured memory_bytes: 980
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> h(n);
    
    for (int i=0; i<n; i++){
        cin >> h[i];
    }
    int ans = 0;
    
    for (int i=0; i<n; i++){
        bool check = true;
        for (int j=0; j<i; j++){
            if (h[j] > h[i]){
                check = false;
                break;
            }
        }
        if (check){
           ans += 1;
        }
    }
    cout << ans <<endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  
  for(int i=0; i<N ; i++){
    cin >> vec[i];    
  }
  
  sort(vec.begin(),vec.end());
  
  int count = 1;
  
  for(int i=0;i<N-1;i++){
    if(vec[i]<vec[i+1]){
      count ++;
    }
  }
  
  
  cout << count <<endl;  
  
  
}


Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a<=b and b<=c:
    print(a,b,c)
elif a<=c and c<=b:
    print(a,c,b)
elif b<=a and a<=c:
    print(b,a,c)
elif b<=c and c<=a:
    print(b,c,a)
elif c<=a and a<=b:
    print(c,a,b)
elif c<=b and b<=a:
    print(c,b,a)


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

int main() {
  string S;
  cin >> S;
  int n, k, m;
  n=S.size();
  k=0;
  if (n%2!=0) {
    cout << "No" << endl;
  }
  else {
    m=n/2;
    for (int i=0; i<m; i++) {
      if (S.at(2*i)=='h' && S.at(2*i+1)=='i') {
        k=k+1;
      }
    }
    if (k==m) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 3624
s = input()
t = input()
ss = []
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] not in ('?', t[j]):
            break
    else:
        S = s[:i] + t + s[i+len(t):]
        ss.append(S.replace('?', 'a'))
if ss:
    print(min(ss))
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

const long long INF = 1LL << 60;

struct Edge {
    long long from;
    long long to;
    long long cost;
    Edge(int s, int d) : to(s),cost(d) {}
};

using Graph = vector<vector<Edge>>;
using Edges = vector<Edge>;
 
/* dijkstra(G,s,dis)
    入力：グラフ G, 開始点 s, 距離を格納する dis
    計算量：O(|E|log|V|)
    副作用：dis が書き換えられる
*/
void dijkstra(const Graph &G, int s, vector<long long> &dis) {
    int N = G.size();
    dis.resize(N, INF);
    priority_queue<P, vector<P>, greater<P>> pq;  // 「仮の最短距離, 頂点」が小さい順に並ぶ
    dis[s] = 0;
    pq.emplace(dis[s], s);
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        int v = p.second;
        if (dis[v] < p.first) {  // 最短距離で無ければ無視
            continue;
        }
        for (auto &e : G[v]) {
            if (dis[e.to] > dis[v] + e.cost) {  // 最短距離候補なら priority_queue に追加
                dis[e.to] = dis[v] + e.cost;
                pq.emplace(dis[e.to], e.to);
            }
        }
    }
}    
 
/* bellman_ford(Es,s,t,dis)
    入力: 全ての辺Es, 頂点数V, 開始点 s, 最短経路を記録するdis
    出力: 負の閉路が存在するなら ture
    計算量：O(|E||V|)
    副作用：dis が書き換えられる
*/
bool bellman_ford(const Edges &Es, int V, int s, vector<long long> &dis) {
    dis.resize(V, INF);
    dis[s] = 0;
    int cnt = 0;
    while (cnt < V) {
        bool end = true;
        for (auto e : Es) {
            if (dis[e.from] != INF && dis[e.from] + e.cost < dis[e.to]) {
                dis[e.to] = dis[e.from] + e.cost;
                end = false;
            }
        }
        if (end) break;
        cnt++;
    }
    return (cnt == V);
}

 int main() {
        ll V,E,r;
        cin >> V >> E >> r;
        vector<ll>dist;
        Graph G(V);
        rep(i,E) {
            ll a,b,c;
            cin >> a >> b >> c;
            G[a].push_back(Edge(b,c));
        }
        dijkstra(G,r,dist);
        rep(i,V) {
            if(dist[i] == INF) {
                cout << "INF" << endl;
                continue;
            }
            cout << dist[i] << endl;
        }
}


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


void solve(long long N, std::vector<long long> A){
    long long xor_sum = 0;
    for (int i = 2; i < N; i++) {
        xor_sum ^= A[i];
    }
    // if (xor_sum > A[0] + A[1]) {
    //     cout << -1 << endl;
    //     return;
    // }
    long long rest = A[0] + A[1];
    rest -= xor_sum;
    if (rest % 2 == 1) {
        cout << -1 << endl;
        return;
    }
    long long both = rest / 2;
    if ((xor_sum & both) || both > A[0]) {
        cout << -1 << endl;
    }

    else {
        long long ans = both;
        for (int bi = 62; bi >= 0; bi--) {
            long long b = 1L << bi;
            if ((xor_sum & b) && ans + b < A[0]) {
                // printf("bi: %d, b: %llx\n", bi, b);
                ans += b;
            }
        }
        // printf("xor_sum: %llx\n", xor_sum);
        // printf("both: %llx\n", both);
        // printf("ans: %llx\n", ans);
        if (ans == 0) {
            cout << -1 << endl;
        } else {
            cout << A[0] - ans << endl;
        }
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>

int main(void){
  int A, P;
  int n_pi;
  scanf("%d%d", &A, &P);

  P = 3*A + P; //林檎の欠片の総数

  n_pi = P/2;

  printf("%d\n", n_pi);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int M,D,M1,D1;
	cin >> M >> D >> M1 >> D1;
	cout << (M != M1) << endl;

	return 0;
}



Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N = 0;
    cin(N);

    //vll X(N)
    //REP(i,N) cin(X.at(i));




if(N >= 30){cout << "Yes" << endl;}
else{ cout << "No" << endl;}
    //出力
    //cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3644