akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

long long N, s = 0;

int main() {
	cin >> N;
	for (int i = 0; i <= 62; i++) {
		if (N >= (1LL << i) - 1) { s = i; }
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    ll ans=0;
    for(int i=0; i<3; ++i){
        scanf("%d",a+i);
    }
    sort(a, a+3);
    if(a[0]==a[1]&&a[1]!=a[2]){
    	cout<<"Yes"<<endl;
    }
    else if(a[1]==a[2] && a[0]!=a[1]){
    	cout<<"Yes"<<endl;
    }
    else{
    	cout<<"No"<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
from math import ceil
n=int(input())
s=[input() for i in range(n)]
cba=0
ca=0
cb=0
ans=0
for i in range(n):
  if s[i][0]=='B':
    if s[i][len(s[i])-1]=='A':
      cba+=1
    else:
      cb+=1
  if s[i][0]!='B' and s[i][len(s[i])-1]=='A':
    ca+=1
  ans+=s[i].count('AB')
if cba>0:
  ans+=cba-1
  if cb>0 and ca>0:
    ans+=2+min(cb-1,ca-1)
  elif cb==0 and ca==0:
    ans+=0
  else:
    ans+=1
else:
  ans+=min(cb,ca)
print(ans)

Measured memory_bytes: 3700
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int maxn = 1e5 + 7;
const LL INF = 1e12;
const LL mod = 1e9 + 7;

struct node {
    LL l,r;
    LL val;
}a[maxn];

bool cmp(node aa,node bb) {
    return aa.r < bb.r;
}

int main() {
    int n;
    while(~scanf("%d",&n)) {
        for(int i = 1 ; i <= n ; i++) {
            LL x;
            scanf("%lld%lld",&a[i].val,&x);
            a[i].l = a[i].val - x;
            a[i].r = a[i].val + x;
        }
        sort(a + 1 , a + n + 1 , cmp);
        int ans = 1;
        int temp = 1;
        for(int i = 2 ; i <= n ; i++) {
            if(a[i].l >= a[temp].r) {
                ans++;
                temp = i;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
//#defien itnt long long
using namespace std;
int i,j;
int main ()
{
    string s;
    cin >> s;
    int x;
    cin >> x;
    cout << s[0];
    for ( i = x ; i < s.size() ; i+=x )
    {
        cout << s[i] ;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int x=sc.nextInt();
			int y=sc.nextInt();
			if((x|y)==0){
				break;
			}
			if(x<y){
				int t=x;
				x=y;
				y=t;
			}
			for(int i=0;; i++){
				if(y==0){
					println(x+" "+i);
					break;
				}
				x=x%y;
				int t=x;
				x=y;
				y=t;
			}
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;
long LCM(long X, long Y){
  long Z, tmp, r, gcd;
  if(X>Y){
    tmp = X;
    X = Y;
    Y = tmp;
  }
  Z = X*Y;
  while(1){
    r = Y % X;
    if(r==0){
      gcd = X;
      break;
    }
    Y = X;
    X = r;
  }
  return Z/gcd;
}

int main(){
  long A, B, C, D;
  cin >> A >> B >> C >> D;

  long MofC, MofD, MofCD, LCMCD;
  LCMCD = LCM(C,D);
  MofC = B/C - (A-1)/C;
  MofD = B/D - (A-1)/D;
  MofCD = B/LCMCD - (A-1)/LCMCD;

  cout << (B-A+1) - MofC - MofD + MofCD << endl;
  return 0;
}


Measured memory_bytes: 256
A,B,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき

cnt=0
for i in reversed(range(1,A+1)):
    if A%i==0 and B%i==0:
        cnt+=1
    
    if cnt==K:
        break
print(i)

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

struct P
{
    int x,y,z;
    bool operator<(const P &a)const{
              return x>a.x;
    }
};

vector<int> v[211];
//bitset<4001000> b;
int a,c,i,b,k,n,d,e,m;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
long long o[111220];
long long l[113310];
int j[2112];
int dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};


long long x,y,mod=1000000007;
long long z;

P u[100550];
stack<int> s;

//set<int> s;
queue<int> q;


//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p[11];
//list<int> l;

string r;
//char r[33];
//deque<int> de;
bool as(int a,int b)
{
    return b<a;
}

int main()
{
    scanf("%d",&a);
    for(int t=1;t<=a;t++)
        scanf("%lld %lld",&o[t],&l[t]);
    sort(o+1,o+a+1,as);
    sort(l+1,l+a+1);
    for(int t=2;t<=a;l[t]+=l[t-1],o[t]+=o[t-1],t++);
    for(int t=1;t<=a;t++)
        x=max(max(x,o[t]-l[t]),max(o[t]-l[t-1],o[t-1]-l[t]));
    printf("%lld",x*2);
}








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

#define ALL(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;

void solve(void) {

	int n;
	cin >> n;
	string s;
	cin >> s;
	if(n % 2 == 1) {
		cout << "No\n";
	} else {
		cout << (s.substr(0, n/2) == s.substr(n/2, n/2) ? "Yes" : "No") << '\n';
	}
		


}

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


Measured memory_bytes: 256
using System;

class _3
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);

        var store = new Store[N];

        for(int i = 0; i < N; i++)
        {
            input = Console.ReadLine().Split(' ');
            store[i] = new Store();
            store[i].A = int.Parse(input[0]);
            store[i].B = int.Parse(input[1]);
        }

        Array.Sort(store);

        long money = 0;
        long count = 0;
        for(int i = 0; i < N;i++)
        {

            long n = 0;
            if(M < count + store[i].B)
            {
                n = M - count;
            } else
            {
                n = store[i].B;
            }
            money += n * store[i].A;
            count += n;
            
            if(count == M)
            {
                break;
            }
        }

        Console.WriteLine(money);
    }

    class Store : IComparable<Store>
    {
        public int A { get; set; }
        public int B { get; set; }

        public int CompareTo(Store other)
        {
            return A - other.A;
        }
    }
}



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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}

#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

void err(vector<string>::iterator it) {}

template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

ll solve(const string &s, int pos) {
	if (pos >= s.size()) return 0;
	ll ans = 0;
	REPU(i, pos, s.size()) {
		ll cnt = 1;
		int ind = (int) s.size() - i - 2;
		if (ind >= 0) cnt = 1LL << ind;
		ans += atoll(s.substr(pos, i - pos + 1).c_str()) * cnt + solve(s, i + 1);
	}
	return ans;
}

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	string s;

	cin >> s;
	cout << solve(s, 0) << endl;

	return 0;
}


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

int n;
int a[1000];


int main(){

    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];

    for(int i = 0; i < n; i++){
        if(a[i] % 2 == 0){
            if(a[i] % 3 == 0){
                continue;
            }
            if(a[i] % 5 == 0){
                continue;
            }

            cout << "DENIED" << endl;
            return 0;
        }
    }

    cout << "APPROVED" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
ll fac[2000005];
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
void pre(){fac[0]=1;fac[1]=1;for(int i=2;i<2000005;i++)fac[i]=(i*fac[i-1])%mod;}
signed main()
{   

      senky_bansal
      IIIT_ALLAHABAD
      
      ll t;
     // cin>>t;
      t=1;
      pre();
      while(t--)
      {
          ll x,y;
          cin>>x>>y;
          ll mx = max(x,y);
          ll mn = min(x,y);
          if(y>x) swap(x,y);
          if(x>=y)
          {
              ll diff = x-y;
              ll f=0;
              if((diff+x)%3!=0) f=1;
              if((2*diff+y)%3!=0) f=1;
              ll ans1 = (diff+x)/3;
              ll ans2 = (2*diff+y)/3;
              ans2-=diff;
              if(ans2<0) f=1;
              ll ans =1;
             // cout<<ans1<<" "<<ans2<<endl;
              ans=ncr((ans1+ans2),ans1);
              if(f) cout<<"0"<<endl;
              else
              cout<<(ans+mod)%mod<<endl;
          }
      }
}


















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

template <typename T>
class node {
public:
	node<T> *l, *r;
	T val;
	node() {}
	node(T val_, node<T>* l_ = nullptr, node<T>* r_ = nullptr) : l(l_), r(r_), val(val_) {}
	void init(T val_, node<T>* l_ = nullptr, node<T>* r_ = nullptr) {
		val = val_;
		l = l_;
		r = r_;
	}
};

template <typename T>
class DynamicSegmentTree {
	using func_t = function<T(T, T)>;
	const ll n;
	const T id;
	func_t merge;
	node<T> *root;
	vector<node<T>> pool;
	int it;
	ll size(ll n) {
		ll res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	node<T> *new_node() {
		pool[it].init(id);
		return &pool[it++];
	}
	T sub(ll l, ll r, node<T>* n, ll lb, ll ub) {
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) return n->val;
		return merge(n->l != nullptr ? sub(l, r, n->l, lb, (lb + ub) / 2) : id, n->r != nullptr ? sub(l, r, n->r, (lb + ub) / 2, ub) : id);
	}
	void suc(ll v, node<T>* n, ll lb, ll ub, T val) {
		if (ub - lb <= 1) {
			n->val = val;
			return;
		}
		ll c = (lb + ub) / 2;
		if (v < c) {
			if (n->l == nullptr) n->l = new_node();
			suc(v, n->l, lb, c, val);
		}
		else {
			if (n->r == nullptr) n->r = new_node();
			suc(v, n->r, c, ub, val);
		}
		n->val = merge(n->l != nullptr ? n->l->val : id, n->r != nullptr ? n->r->val : id);
	}
public:
	DynamicSegmentTree(ll n_, int max_, T id_, func_t merge_) :
		n(size(n_)), id(id_), merge(merge_), pool(max_)
	{
		it = 0;
		root = new_node();
	}
	void Update(ll p, T val) {
		suc(p, root, 0, n, val);
	}
	T Find(ll l, ll r) {
		return sub(l, r + 1, root, 0, n);
	}
};

int main()
{
	int n, q, com, x, y;
	cin >> n >> q;
	DynamicSegmentTree<int> dst(1000000000000ll, 10000000, 0x7fffffff, [](int l, int r) { return min(l, r); });
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			cout << dst.Find(x, y) << endl;
		}
		else {
			dst.Update(x, y);
		}
	}
	return 0;
}

Measured memory_bytes: 5468
n,m = map(int,input().split())
l = [[] for i in range(m)]
for i in range(m):
    a,b = map(int,input().split())
    l[i] = [a,b,i]
l = list(sorted(l,key=lambda x: (x[0], x[1])))
ans = [[] for i in range(m)]
x = 0
y = 1
for i in range(m):
    if x != l[i][0]:
        x = l[i][0]
        y = 1
    else:
        y += 1
    a = str(x).zfill(6)
    b = str(y).zfill(6)
    ans[i] = [a+b,l[i][2]]
ans = list(sorted(ans,key=lambda x: x[1]))
for i in range(m):
    print(ans[i][0])

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

int main(){
    int n;
    cin >> n;
    ll t;
    ll ans = 1;
    rep(i, n){
        cin >> t;
        ans = ans/__gcd(ans,t) * t;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back

int N;
int A[100005];
int ans[100004];
int MOD=1000000007;
vector<int> mod2019;
signed main(){
    scanf("%lld",&N);
    rep(i,N){
       scanf("%lld",&A[i]);
    }
    int low=0;
    int upp=A[0]+1;
    while(low<upp){
        //ifB_0==i
        ans[0]=(low+upp)/2;
        rep(j,N){
            if(j==0)continue;
            ans[j]=A[j-1]-ans[j-1];
        }
        if(ans[N-1]+ans[0]==A[N-1]){
            rep(i,N){
                printf("%lld",ans[i]*2);
                if(i<N-1)printf(" ");
                else printf("\n");
            }
            return 0;
        }else if(ans[N-1]+ans[0]>A[N-1]){
            upp=(low+upp)/2;
        }else{
            low=(low+upp)/2;
        }
    }
}


Measured memory_bytes: 2816
program ABC_077_B_AroundSquare
   implicit none
   integer(8) N, i
   read(*, *) N
   do i = 1, N
      if( i ** 2 <= N .and. (i+1) ** 2 > N) then
	      write(*, *) i ** 2
		  exit
	  end if
   end do
end program ABC_077_B_AroundSquare

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

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

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

    int64_t a, b;
    int count;

    while (true) {
        cin >> a >> b;
        if (cin.eof()) { break; }
        int64_t sum = a + b;
        count = 1;
        while (sum >= 10) {
            sum /= 10;
            count++;
        }
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

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

    ll ans = 1;
    for(int i=0;i<N;i++){
        ans *= 3;
    }

    ll noans = 1;
    for(int i=0;i<N;i++){
        ll A;
        cin >> A;
        if(A % 2 == 0){
            noans *= 2;
        }
    }
    cout << ans - noans << endl;

    return 0;
}

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

#define llong long long 
#define xx first
#define yy second
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define ii pair<int, int>

llong f(llong x) {
  if (x == 0) return 0;
  return f(x / 10) + x % 10;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  llong x; cin >> x;
  if (x % f(x) == 0) cout << "Yes";
  else cout << "No";

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    uint N; cin >> N;
    vector<int> vP(N);
    for(uint i=0; i<N; ++i){ cin >> vP[i]; }
    sort(vP.begin(), vP.end(), greater<int>());

    int64 sum=vP[0]/2;
    for(uint i=1; i<N; ++i){
        sum += vP[i];
    }
    
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
A, B, C = map(int, input().split())

if A+B<C and pow(A-B,2)+pow(C,2)-2*C*(A+B)>0:
#import numpy as np
#if np.sqrt(A)+np.sqrt(B)-np.sqrt(C)<0:
  ans = 'Yes'
else:
  ans = 'No'
  
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdlib>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int a,b;
  string s;
  cin >> a >> b >> s;
  //string as = to_string(a);
  //string bs = to_string(b);
  for(int i=0;i<a;i++){
    if(!isdigit(s[i])){
      cout << "No" << endl;
      return 0;
    }
  }
  if(s[a] != '-'){
    cout << "No" << endl;
    return 0;
  }
  for(int i=a+1;i<a+b+1;i++){
    if(!isdigit(s[i])){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,L;cin>>N>>L;
  int ans=0;
  for(int i=0;i<N;i++)ans+=L+i;
  if(L>0)ans-=L;
  else if(L+N-1<0)ans-=L+N-1;
  cout<<ans<<endl;
}

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

using namespace std;

int main(){
    int m,n_min,n_max;
    while(cin>>m>>n_min>>n_max,m){
        int pre;
        for(int i=0;i<n_min;++i){
            cin>>pre;
        }
        int buf1=0,ans;
        for(int i=n_min;i<=n_max;++i){
            int p;cin>>p;
            if(buf1<=pre-p){
                buf1=pre-p;
                ans=i;
            }
            pre=p;
        }
        for(int i=n_max+1;i<m;++i)cin>>pre;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 2972
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<tuple>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
int main(){
    int c[9], a=0;
    rep(i, 9){
        cin>>c[i];
    }
    rep(i, 3){
        a=min(min(c[i], c[i+3]), c[i+6]);
        c[i]-=a;
        c[i+3]-=a;
        c[i+6]-=a;
    }
    for(int i=0;i<3;i++){
        a=min(min(c[i*3], c[i*3+1]), c[i*3+2]);
        c[i*3]-=a;
        c[i*3+1]-=a;
        c[i*3+2]-=a;
    }
    rep(i, 9){
        if(c[i]!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n, k, ans = 2;
    scanf("%lld", &n);
    if(n == 2) {
        printf("1\n");
        return 0;
    }
    ll x = n - 1;
    for(ll i = 2; i * i <= x; i++) {
        if(x % i == 0) {
            ans++;
            if(i * i != x) ans++;
        }
    }
    for(ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            x = n;
            k = i;
            while(x % k == 0) {
                x /= k;
            }
            x--;
            //printf("%lld\n", x);
            if(x % k == 0) ans++;
            if(i * i != n) {
                x = n;
                k = n / i;
                while(x % k == 0) {
                    x /= k;
                }
                x--;
                //printf("%lld\n", x);
                if(x % k == 0) ans++;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d", $H, $W);

$loadmap = [];
for ($i = 0; $i < $H; ++$i) {
    $loadmap[] = array_map("intval", explode(" ", trim(fgets(STDIN))));
}
$answer = 2000000000000000;
// echo "$h $w $max\n";
for ($i = 0; $i < $H; ++$i) {
    for ($j = 0; $j < $W; ++$j) {
        $tmp_sum = 0;
        for ($row = 0; $row < $H; ++$row) {
            for ($col = 0; $col < $W; ++$col) {
                $tmp_sum += $loadmap[$row][$col] * min(abs($row-$i), abs($col-$j));
            }
        }
        $answer = min($answer, $tmp_sum);
    }
}

echo $answer, "\n";


Measured memory_bytes: 9384
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

int k;
bool chk[46][100000];
int main() {
	scanf("%d",&k);
	chk[0][0]=1;
	queue<Pi> q;
	q.push(mp(0,0));
	while(!q.empty())
	{
		int x,y;
		tie(x,y)=q.front();
		q.pop();
		fup(i,0,9,1)
		{
			int nx=x+i,ny=(10*y+i)%k;
			if(nx<=45 && !chk[nx][ny])
			{
				chk[nx][ny]=1;
				q.push(mp(nx,ny));
			}
		}
	}
	fup(i,1,45,1)if(chk[i][0])return !printf("%d",i);
}

Measured memory_bytes: 19768
(defmacro while (test &body body)
  `(do ()
       ((not ,test))
     ,@body))


(defun digits ()
  (let ((n (read))
        (k (read))
        (ans 0))
    (while (< 0 n)
           (setf n (floor n k))
           (incf ans))
    ans))


(format t "~A~%" (digits))

Measured memory_bytes: 13536
#include <bitset>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef vector<vector<ll>> vvll;

typedef pair<int, int> Pair;
#define mp(x, y) make_pair(x, y)

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

//nが素数かをO(√n)で判断
bool is_prime(int n) {
    bool res = true;

    if (n == 1) return false;
    else if (n == 2) return true;

    else {
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                res = false;
                break;
            }
        }
    }

    return res;
}



int perm(int n, int r) {
    if (r == 1) return n;
    return n * perm(n - 1, r - 1);
}

int fact(int n) {
    if (n == 1) return 1;
    return fact(n - 1) * n;
}

int comb(int n, int r) {
    int a = min(n, r), b = max(n, r);
    return perm(a, b) / fact(a);
}



/*
ll pow_mod(ll a, ll n, ll mod) {
    ll res = 1;

    ll base = a;
    while (n) {
        if (n & 1) res = res * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return res;
}
*/

//aの逆元　（a^(-1)）を求める
ll inv_mod(ll a, ll mod) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

/*
ll fact_mod(ll n, ll mod) {
    if (n == 1) return 1;
    return n * fact_mod(n - 1, mod) * mod;
}
*/

// 階乗 (mod とりバージョン)
ll fact_mod(ll n, ll mod) {
    ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}

ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % mod;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

// 組み合わせ nCr を求める (modあり)
ll comb_mod(ll n, ll r, ll mod) {
    if (r > n - r) r = n - r;
    if (r == 0) return 1;
    ll a = 1;
    for (int i = 0; i < r; i++) a = a * ((n - i) % mod) % mod;
    ll b = pow_mod(fact_mod(r, mod), mod - 2, mod);
    return (a % mod) * (b % mod) % mod;
}

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

    ll cnt = 0;

    for (int A = 1; A < N; A++) {
        int q = (N - 1) / A;

        cnt += (ll)q;
    }


    cout << cnt << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,a,ans;cin>>n;vector<ll> v(100000+1,0);
  rep(i,n) {cin>>a;v[a]+=1;}
  ans=v[0]+v[1];
  ans=max(ans,v[100000]+v[100000-1]);
  for(ll i=1; i<100000; ++i) {
    ll ans_ = v[i-1]+v[i]+v[i+1];
    ans=max(ans,ans_);
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(){
    int i,n,m;
    for(i=1;;i++){
    scanf("%d %d",&n,&m);
    if(n!=0 || m!=0){
        if(m>n)
            printf("%d %d\n",n,m);
        else
         printf("%d %d\n",m,n);    
        
    
    }else{
            break;
        }
    
        
    }
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    vector<int> ans;
    int i,j,k,d,n;
    cin>>n>>k;
    vector<int>:: iterator low;
    for(i=1;i<=n;i++)
        ans.push_back(i);
    for(i=0;i<k;i++)
    {
        cin>>d;
      //  cout<<"ok";
        for(j=0;j<d;j++)
            {
              //
                //cout<<"in";
                int x;
                cin>>x;
                if(binary_search(ans.begin(),ans.end(),x))
                {
                    low=lower_bound(ans.begin(),ans.end(),x);
                    if(low!=ans.end())
                    ans.erase(low);
                }
            }

    }
    cout<<ans.size();
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,t;cin>>n>>t;
    vector<pair<int,int>>a(n);
    for(int i=0;i<n;i++)cin>>a[i].first>>a[i].second;
    sort(a.begin(),a.end());
    int dp[n+1][t+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<t;j++){
            dp[i][j]=0;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        int x=a[i].first,y=a[i].second;
        for(int j=0;j<=t;j++){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
            int nj=j+x;
            if(nj<t)dp[i+1][nj]=max(dp[i+1][nj],dp[i][j]+y);
        }
        int now=dp[i][t-1]+y;
        ans=max(ans,now);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 35456
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		char a = s.charAt(0);
		int b = s.length()-2;
		char c = s.charAt(s.length()-1);
		System.out.print(""+a+b+c);

	}

}

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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 55, M = 3e3, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int n, a[N], av;

ll dp[55][M];

ll solve(int i, int sum){
    if(i == n)
        return sum == 2500;

    ll &ret = dp[i][sum];
    if(~ret)    return ret;

    return ret = solve(i + 1, sum + a[i]) + solve(i + 1, sum);
}
int main(){
    init();

    cin >> n >> av;
    for(int i = 0;i < n;i++)    cin >> a[i], a[i] -= av;
    memset(dp, -1, sizeof dp);
    cout << solve(0, 2500) - 1;
}

Measured memory_bytes: 1536
use proconio::input;
use std::collections::BinaryHeap;

fn main() {
    input! {
        n: usize,
        ab: [(i64, i64); n],
    }

    let mut heap = BinaryHeap::new();

    for (a, b) in ab {
        heap.push((a+b, a, b));
    }

    let mut sum = 0;
    let mut i = 0;
    
    while let Some((_, a, b)) = heap.pop() {
        if i % 2 == 0 {
            sum += a;
        } else {
            sum -= b;
        }
        i += 1;
    }

    println!("{}", sum);
}


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

template <typename Tp> void println(const std::vector<Tp>& A){
    for(auto itr = A.cbegin(); itr != A.cend(); ){ 
        std::cout << (*itr++); std::cout << (itr == A.cend() ? '\n' : ' ');
    }
}

int main(void){
    std::cin.tie(nullptr); std::cin.sync_with_stdio(false); std::cout.tie(nullptr);
    int n; std::cin >> n;
    std::vector<int> A(n); for(int i = 0; i < n; ++i) std::cin >> A[i];
    int cnt = 0;
    {
        bool continuous = true;
        while(continuous){
            continuous = false;
            for(int i = 0, j = 1; j < n; ++i, ++j) if(A[i] > A[j]){ std::swap(A[i], A[j]); ++cnt; continuous = true;}
        }
    }
    println(A);
    std::cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 3216
import java.io.*;
import java.util.*;

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

	int W = sc.nextInt();
	int H = sc.nextInt();
	int x = sc.nextInt();
	int y = sc.nextInt();
	int r = sc.nextInt();

	if (x >= r && x <= W-r && y >= r && y <= H-r) {
	    System.out.println("Yes");
	}
	else {
	    System.out.println("No");
	}
    }
}

Measured memory_bytes: 26196
class NormalInput {
  input: string[];
  pointer: number;
  constructor(raw: string) {
    this.input = raw.split(/ |\n/);
    this.pointer = 0;
  }
  int = (): number => {
    const ret = parseInt(this.input[this.pointer], 10);
    this.pointer++;
    return ret;
  };
  str = (): string => {
    const ret = this.input[this.pointer];
    this.pointer++;
    return ret;
  };
  strs = (length: number): string[] => {
    let ret: string[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.str());
    }
    return ret;
  };
  ints = (length: number): number[] => {
    let ret: number[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.int());
    }
    return ret;
  };
}
function rep(a: number, b: number) {
  let arr = [];
  for (let i = a; i < b; i++) arr.push(i);
  return arr;
}

function Main({ int, str, strs, ints }: NormalInput) {
  const S = str();
  console.log(S === "ABC" ? "ARC" : "ABC");
}

//DO NOT EDIT
Main(new NormalInput(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29632
#include<iostream>

using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){cin>>a[i];}
  bool flag=true;
  int cnt=0;
  while(1){
    for(int i=0;i<n;i++){
      if(a[i]%2==0){
        a[i]=a[i]>>1;
      }else{
        flag=false;
        break;
      }
    }
    if(flag==false) break;
    cnt++;
    //for(int i=0;i<n;i++){cout<<a[i]<<endl;}
  }
  cout<<cnt<<endl;
}

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

int N;
string S;

bool ok(string t)
{
	while(t.length()<3) t="0"+t;
	int idx = 0;
	for(int i=0;i<N;++i){
		if(S[i]==t[idx]){
			idx++;
			if(idx == 3) return true;
		}
	}
	return false;
}

void solve()
{
	int ans = 0;
	for(int i=0;i<=999;++i){
		if(ok(to_string(i))) ans++;
	}
	cout << ans << "\n";
}

int main()
{
	cin >> N >> S;
	solve();
	return 0;
}


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

long ans(long long  i)
{
    if(i==1)return 1;
    long long l=1;long long r=10000;
    while(r-l>1)
    {
        long long  mid=(l+r)/2;
        long long d=mid*(mid+1LL)/2LL;
        if(d>=i)r=mid;
        else l=mid;

    }
    return r;
}
int main()
{
    long long n;
    cin>>n;
    while(n!=0)
    {
        long d=ans(n);
        cout<<d<<endl;
        n=n-d;
    }


}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	bool flag[26] = {};
	string S; cin >> S;

	for (int i = 0;i < S.size();i++){
		flag[S[i]-'a'] = true;
	}

	for (int i = 0;i < 26;i++){
		if(!flag[i]){
			cout << char('a'+i) << endl;
			return 0;
		}
	}

	cout << "None" << endl;

	return 0;

}


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

int main() {
  int N,Y;
  cin >> N >> Y;
  
  int x = -1;
  int y = -1;
  int z = -1;
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N; j++) {
      if (i + j > N) continue;
      else if (10000 * i + 5000 * j + 1000 * (N-i-j) != Y) continue;
      else {
        x = i;
        y = j;
        z = N-i-j;
        goto OUT;
      }
    }
  }
  
  OUT:
  
  cout << x << " " << y << " " << z << endl;
}

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

using namespace std;

#define INLINE   inline __attribute__ ((always_inline))
#define NOINLINE __attribute__ ((noinline))

#define ALIGNED __attribute__ ((aligned(16)))

#define likely(x)   __builtin_expect(!!(x),1)
#define unlikely(x) __builtin_expect(!!(x),0)

#define SSELOAD(a)     _mm_load_si128((__m128i*)&a)
#define SSESTORE(a, b) _mm_store_si128((__m128i*)&a, b)

#define FOR(i,a,b)  for(int i=(a);i<(b);++i)
#define REP(i,a)    FOR(i,0,a)
#define ZERO(m)     memset(m,0,sizeof(m))
#define ALL(x)      x.begin(),x.end()
#define PB          push_back
#define S           size()
#define LL          long long
#define ULL         unsigned long long
#define LD          long double
#define MP          make_pair
#define X           first
#define Y           second
#define VC          vector
#define PII         pair <int, int>
#define PDD         pair <double, double>
#define VI          VC < int >
#define VVI         VC < VI >
#define VVVI        VC < VVI >
#define VPII        VC < PII >
#define VD          VC < double >
#define VVD         VC < VD >
#define VVVD        VC < VVD >
#define VS          VC < string >
#define VVS         VC < VS >
#define DB(a)       cerr << #a << ": " << (a) << endl;
#define ASSERT      assert

template<class T> void print(VC < T > v) {cerr << "[";if (v.S) cerr << v[0];FOR(i, 1, v.S) cerr << ", " << v[i];cerr << "]" << endl;}
template<class T> string i2s(T x) {ostringstream o; o << x; return o.str();}

using namespace std;
int main()
{   string s;
    cin >> s;
    vector<int> a = vector<int>(27, 1000);
    vector<int> r = vector<int>(27, 1000);
    for(int i = 0; i < s.size(); ++i) {
      int idx = s[i] - 'a';
      char c = s[i];

      if(a[idx] == 1000){
        a[idx] = i;
        r[idx] = i;
      }
      for(int j = i+1; j < s.size(); ++j) {
        if(s[j] == c){
          a[idx] = max(a[idx], int(j-i-1));
          r[idx] = j;
          break;
        }
      }
    }
    for(int idx = 0; idx < 27; idx++){
      a[idx] = max(a[idx], int(s.size() - r[idx] - 1));

    }

    int m = 10000;
    for(int i = 0; i < 27; i++){
      m = min(a[i], m);

    }
    cout << m;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}

int prime[1000000];bool visprime[10000000];
void sieve(){int k=0;for(int i=2;i*i<=1000000;i++){for(int j=i*i;j<=1000000;j+=i){visprime[j]=true;}}for(int i=2;i<=1000000;i++){if(visprime[i]==false) prime[k++]=i;}}


int main()
{


  string  a,b,p,q;
  cin>>a>>b;
   int x=stoi(a);
   int y=stoi(b);
   //cout<<x<<" "<<y<<endl;
   for(int i=0;i<x;i++)
   {
       p+=b;
   }
   for(int i=0;i<y;i++)
   {
       q+=a;
   }

   if(p<=q) cout<<p<<endl;
   else cout<<q<<endl;



















}


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

#define N 12

int ld (
  int     * d,
  size_t    n
  )
{
  while ( n-- )
  {
    int ch = ' ';

    while ( ch != EOF && !isdigit ( ch ) )  ch = getchar ( );
    if ( ch == EOF )  return ( 0 );
    *( d++ ) = ch - '0';
  }

  return ( 1 );
}

int fill (
  int d[ N ][ N ],
  int x,
  int y
  )
{
  if ( x < 0 || y < 0
    || x >= N || y >= N ) return ( 0 );

  if ( d[ y ][ x ] )
  {
    d[ y ][ x ] = 0;
    fill ( d, x - 1, y );
    fill ( d, x + 1, y );
    fill ( d, x, y - 1 );
    fill ( d, x, y + 1 );
    return ( 1 );
  }

  return ( 0 );
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int map[ N ][ N ];
  int i, j;

  while ( ld ( (int *)map, N * N ) )
  {
    int res = 0;

    for ( j = 0; j < N; ++j )
    for ( i = 0; i < N; ++i )
      res += fill ( map, j, i );
    
    printf ( "%d\n", res );
  }

  return ( 0 );
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
  int a, b;
  cin >> a >> b;

  cout << ceil((a + b) / 2.0) << endl;
}

Measured memory_bytes: 256
def prime(n):
    if n<2:
        return False
    if n == 2:
        return True
        
    for i in range(2,int(-(-n**0.5//1))+1):
        if n%i == 0:
            return False
            
    return True        

x=int(input())

while not(prime(x)):
    x+=1

print(x)    

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

using namespace std;

int main()
{
  int X;
  cin >> X;
  if(X== 7 || X==5 || X==3) {
    cout << "YES" << endl;
  } else {
      cout << "NO" << endl;
  }
  return 0;
}


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

int n, m, mx;
int main()
{
	int i;
	cin >> n >> m;
	for (i = 1; i * i <= m; i++) {
		if (m % i == 0) {
			if (m / i >= n) mx = max(mx, i);
			if (i >= n) mx = max(mx, m / i);
		}
	}
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#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 MAX 20
using namespace std;

struct distance{
  int d;
  int p;

  bool operator <( const struct distance& right) const {
    return p == right.p ? d < right.d : p < right.p;
  }
};

int main(void){
  while(true){
    int n, m; cin >> n >> m;
    if(n+m == 0)  break;
    int ans = 0;
    vector<struct distance> inns;
    rep(i, n){
      struct distance inn;
      cin >> inn.d >> inn.p;
      inns.push_back(inn);
    }
    sort(inns.begin(), inns.end());

    rrep(i, n){
      if(m > 0){
        if(m >= inns[i].d){
          m -= inns[i].d;
        }else{
          ans += ((inns[i].d - m)*inns[i].p);
          m = 0;
        }
      }else{
        ans += inns[i].d*inns[i].p;
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define ll long long
using namespace std;
template<class T>inline void read(T &res)
{
    char c;
    T flag=1;
    while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
    res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';
    res*=flag;
}
map<int,int> m;
int main()
{
    ll sum=0;
    int n,x,q,b,c;
    read(n);
    for(int i=0;i<n;i++)
    {
        read(x);
        m[x]++;
        sum+=x;
    }
    read(q);
    while(q--)
    {
        read(b);
        read(c);
        sum+=m[b]*(c-b);
        m[c]+=m[b];
        m[b]=0;
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 8024
// Problem : C - Sum of product of pairs
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

///Astalavista Code........~boy_with_no_gf
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
inline void PP(int n) { cout << n << " ";}
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].first << " " << v[i].second << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}

// <=================================================================================================================================
// <=================================================================================================================================

void fun(){
	int n;cin>>n;
	vi arr(n);
	for(int i=0;i<n;i++)cin>>arr[i];
	vi pre(n+1,0);
	for(int i=n-1;i>=0;i--){
		pre[i]=pre[i+1]+arr[i];
	}
	int ans=0;
	for(int i=0;i<n;i++){
		ans=(ans+(arr[i]*(pre[i+1]%M))%M)%M;	
	}
	cout<<ans;
}

signed  main() {
    lets_go

    int t;
    t=1;
//    cin >> t;
    while (t--) {

    fun();

    }



    return 0;

}


Measured memory_bytes: 6332
import java.util.Scanner;
import java.util.Vector;

public class Main {

    public static void main(String[] args) {

	Scanner sc=new Scanner(System.in);

	long  n=sc.nextInt();
	int d= (int) (n%10);
	if(d==2||d==4||d==5||d==7||d==9)
      {
          System.out.println("hon");
      }
	else if(d==0||d==1||d==6||d==8)
      {
          System.out.println("pon");
      }
	else if(d==3)
      {
          System.out.println("bon");
      }


    }
}


Measured memory_bytes: 35752
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
	//mahakal();fast;

	ll n ,m;
	cin>>n>>m;
	vector<string> vec[n+1];
	for(ll i=0;i<m;i++){
		ll a ;string str;
		cin>>a>>str;
		vec[a].pb(str);
	}
	ll ac=0 ,  wa=0;
	for(ll i=1;i<=n;i++){
		ll temp=0;
		for(ll j=0;j<vec[i].size();j++){
			if(vec[i][j]=="AC"){
				wa+=temp;
				ac++;break;
			}
			else{
				temp++;
			}
		}
	}
	cout<<ac<<" "<<wa<<endl;

	return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,x,y=0,n;
  char s,d[100],c[100];
  cin>>a>>s>>b;
  if(s=='+')
    cout<<a+b<<endl;
  else
    cout<<a-b<<endl;
  return(0);
}

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

int main(){
    int m1, d1, m2, d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;

    int ans;
    if(m1 == m2){
        ans = 0;
    }
    else{
        ans = 1;
    }

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

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        long[] H = new long[N];
        int[] A = new int[M];
        int[] B = new int[M];
        boolean[] isGood = new boolean[N + 1];
        Arrays.fill(isGood, true);
        int ans = N;

        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        for (int i = 0; i < M; i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
            if ((H[A[i] - 1] > H[B[i] - 1]) && (isGood[B[i] - 1])) {
                ans--;
                isGood[B[i] - 1] = false;
                continue;
            }
            if ((H[A[i] - 1] < H[B[i] - 1]) && (isGood[A[i] - 1])) {
                ans--;
                isGood[A[i] - 1] = false;
            }
            if ((H[A[i] - 1] == H[B[i] - 1])) {
                if (isGood[A[i] - 1]) {
                    ans--;
                    isGood[A[i] - 1] = false;
                }
                if (isGood[B[i] - 1]) {
                    ans--;
                    isGood[B[i] - 1] = false;
                }
            }
        }

        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 61404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll triple(int x)
{
    return 1LL*x*x*x;


}


int main()
{
    int n,k;
    cin>>n>>k;
    if(k%2==1){
        int odd=0;
        for(int i=1;i<=n;i++)
            if(i%k==0) odd++;
        ll ans=1LL*odd*odd*odd;
        cout<<ans;
    }
    else{
        int case1=0;
        int case2=0;
        for(int i=1;i<=n;i++){
            if(i%k==0) case1++;
            if(i%k==k/2) case2++;
        }
        ll nas=triple(case1)+triple(case2);
        cout<<nas;

    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N, C[500], S[500], F[500];
int main() {
    scanf("%d", &N);
    for (int i = 0; i < N - 1; i++) scanf("%d%d%d", &C[i], &S[i], &F[i]);
    for (int i = 0; i < N; i++) {
        int t = 0;
        for (int j = i; j < N - 1; j++) {
            if (t < S[j])
                t = S[j];
            else if (t % F[j] == 0);
            else t = t + F[j] - t % F[j];
            t += C[j];
        }
        printf("%d\n ", t);
    }
}


Measured memory_bytes: 3840