akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

double cross(const P &a, const P &b) { return imag(conj(a)*b); }
double dot(const P &a, const P &b) { return real(conj(a)*b); }

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        R x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    if (!sgn(cross(p[0]-p[1], p[2]-p[3]))) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
ll cl(ll a,ll b)
{
    return (a/b)+(!(!(a%b)));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin >> s;
    if(s=="ABC")cout << "ARC";
    else cout << "ABC";
    }

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


int main() {
  
  int H,N;
  
  cin>>H>>N;
  
  vector<int> A(N);
for (int i = 0; i < N; i++) {
  cin >> A.at(i);
}
  
  int sw=0;
  for (int i = 0; i < N; i++) {
  sw=sw+A.at(i);
}
  
  if(H>sw){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  
  
}





Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<set>
int const maxN=200001;
int op[maxN];
std::set<int> ops[maxN];
int main(){
    int h,w,n;
    scanf("%d%d%d",&h,&w,&n);
    for(int i=0;i<n;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        ops[y].emplace(x);
    }
    int offset=0;
    for(int i=1;i<=w;i++){
        while(ops[i].count(i+offset)>0)offset++;
        if(i+offset>h || ops[i].lower_bound(i+offset)==ops[i].end()){
            op[i]=h;
        }else{
            op[i]=*(ops[i].lower_bound(i+offset))-1;
        }
    }
    std::sort(op+1,op+w+1);
    printf("%d",op[1]);
    return 0;
}

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

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int dx = x2 - x1, dy = y2 - y1;
	cout << x2 - dy << " " << y2 + dx << " " << x2 - dy - dx << " " << y2 + dx - dy << endl;
}

Measured memory_bytes: 256
tmp = input().strip().split()
stack = []
for i in tmp:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(-stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print (stack[0])

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    int A[3][3];
    rep(i, 0, 9) { cin >> A[i/3][i%3]; }

    int N;
    cin >> N;

    bool B[3][3]; rep(i, 0, 9) { B[i/3][i%3] = false; }

    rep(i, 0, N) {
        int b;
        cin >> b;
        rep(j, 0, 9) {
            if (A[j/3][j%3] == b) { B[j/3][j%3] = true; }
        }
    }

    // rep(i, 0, 3) {
    //     rep(j, 0, 3) {
    //         cout << B[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    bool clear = false;

    rep(i, 0, 3) {
        if (B[i][0] && B[i][1] && B[i][2]) { clear = true; break; }
        if (B[0][i] && B[1][i] && B[2][i]) { clear = true; break; }
    }
    if (B[0][0] && B[1][1] && B[2][2]) { clear = true; }
    if (B[0][2] && B[1][1] && B[2][0]) { clear = true; }

    cout << (clear ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#ifdef CURIOUSCAT
#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)
#else
#define Pr(f,...) 
#endif

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int P=1e9+7,oo=P;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
void upd(int &a,int b){ a=add(a,b); }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }

const int N=1e7+50;
int n,fac[N],a,ans,inv[N],facinv[N];
int C(int n,int m){
	if(n<0||m>n)return 0;
	return mul(fac[n],mul(facinv[m],facinv[n-m])); 
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("d.in","r",stdin); 
#endif
	read(n),read(a); 
	fac[0]=1; 
	rep(i,1,n)fac[i]=mul(fac[i-1],i);
	inv[1]=1; 
	rep(i,2,n)inv[i]=mul(P-P/i,inv[P%i]); 
	facinv[0]=1; 
	rep(i,1,n)facinv[i]=mul(facinv[i-1],inv[i]);
	rep(t,2,a+1){
		int x=t-1,y=n-a,z=max(0,a-t);
		//Pr("%d,%d,%d\n",x,y,z);
		rep(d,0,a){
			int w=mul(C(x,d),mul(x-d,inv[x-d+y]));
			w=mul(w,fac[x-d+y+z]);
			if(d&1)ans=sub(ans,w);else ans=add(ans,w);
		}
	}
	cout<<ans<<endl;
}


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

using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  for(int tak=a,aok=c;;aok-=b,tak-=d){
    if(aok<=0){
      cout << "Yes" << endl;
      break;
    }
    if(tak<=0){
      cout << "No" << endl;
      break;
    }
  }
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n, k; cin >> n >> k;
   vector<int> a(n);
   rep(i,n)cin>>a[i];
   for (int i = k; i < n; i++){
      if (a[i-k] < a[i])cout << "Yes" << endl;
      else cout << "No" << endl;
   }
}

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

using ll=long long;
using int64=int64_t;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
    int n=in(),b[n-1],ans=0;
    forin(b,n-1);
    ans+=b[0]+b[n-2];
    for (int i=0;i<n-2;i++){
        ans+=min(b[i],b[i+1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import Counter
H,W,*L = open(0).read().split()
H,W = map(int, (H,W))
s = ''
for c in L:
  s += c
Cnt = Counter(s)
g1 = 0
g2 = 0
g3 = 0
if H%2==1 and W%2==1:
  g1 = 1
  g2 = H//2+W//2
  g3 = (H//2)*(W//2)
elif H%2==1:
  g1 = 0
  g2 = W//2
  g3 = (H//2)*(W//2)
elif W%2==1:
  g1 = 0
  g2 = H//2
  g3 = (H//2)*(W//2)
else:
  g1 = 0
  g2 = 0
  g3 = (H//2)*(W//2)

while g3:
  for k in Cnt.keys():
    if Cnt[k]>=4:
      Cnt[k] -= 4
      g3 -= 1
      break
  else:
    break
  
while g2:
  for k in Cnt.keys():
    if Cnt[k]>=2:
      Cnt[k] -= 2
      g2 -= 1
      break
  else:
    break
  
while g1:
  for k in Cnt.keys():
    if Cnt[k]>=1:
      Cnt[k] -= 1
      g1 -= 1
      break
  else:
    break

if all(Cnt[k]==0 for k in Cnt.keys()):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	vector<int> A(N);
	map<int, int> m;
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
		++m[A[i]];
	}

	vector<int> B(N);
	B[N - 1] = A[N - 1];
	for (auto i = N - 2; i >= 0; --i)
	{
		B[i] = max(B[i + 1], A[i]);
	}

	auto maxDiff = 0;
	map<int, int> diffM;
	for (auto i = 0; i < N; ++i)
	{
		auto diff = B[i] - A[i];
		if (maxDiff < diff)
		{
			maxDiff = diff;
			diffM.clear();
			++diffM[B[i]];
		}
		else if (maxDiff == diff)
		{
			++diffM[B[i]];
		}
	}

	auto ans = 0;
	for (auto& p : diffM)
	{
		ans += min(p.second, m[p.first]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n,h;
cin>>n>>h;
ll x = -1,y = -1,z = -1;
int flag =0;
for(ll i =0;i<=n;i++)
{

    for(ll j = 0;j<=n;j++)
    {
        ll k = n-i-j;
           if(k>=0)
           {
                if((10000*i+ 5000*j+1000*k)==h)
               {
                 x =i;y = j;z = k;
                  break;
                }
           }
    }
}
 cout<<x<<" "<<y<<" "<<z;
return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws IOException {
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    int n = in.nextInt();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = in.nextInt();
    }
    final Solver solve = new Solver();
    System.out.println(solve.solve(h));
  }
}

class Solver {
  public int solve(int[] h) {
    int n = h.length;
    int[] dp = new int[n + 1];
    dp[1] = 0;
    dp[2] = Math.abs(h[1] - h[0]);
    for (int i = 3; i <= n; i++) {
      dp[i] = Math.min(Math.abs(h[i-1]-h[i-2])+dp[i-1], Math.abs(h[i-1]-h[i-3])+dp[i-2]);
    }
    return dp[n];
  }
}

Measured memory_bytes: 50500
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  string s;
  cin >> s;
  map<char, bool> mp;
  for (ll i = 0; i < s.size(); i++) {
    mp[s[i]] = true;
    if (s[i] == 'F' && mp['C']) {
      Yes();
      return 0;
    }
  }
  No();
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
xs = list(map(int, input().split()))

G = [set() for _ in range(N+1)]
es = []
for i in range(M):
    u, v = map(int, input().split())
    if xs[u-1] == xs[v-1]:
        G[v].add(u)
        G[u].add(v)
    elif xs[u-1] > xs[v-1]:
        G[u].add(v)
    else:
        G[v].add(u)
    e = (min(u,v), max(u,v))
    es.append(e)

xs = sorted([(x,i+1) for i, x in enumerate(xs)])
d = dict()
cc = dict()
for i in range(N):
    if not G[i+1]:
        print(-1)
        sys.exit()
for x, u in xs:
    if u in cc:
        continue
    cc[u] = 1
    for c in G[u]:
        if c in cc:
            cc[u] = 1-cc[c]
    stack = [u]
    while stack:
        q = stack.pop()
        for c in G[q]:
            e = (min(q,c), max(q,c))
            d[e] = x
            if c in cc:
                continue
            stack.append(c)
            cc[c] = 1 - cc[q]
print("".join("BW"[cc[i]] for i in range(1,N+1)))
for i in range(M):
    print(d[es[i]])



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

int main() {
    int n, t, a;
    int h[1100];
    cin >> n >> t >> a;
    for(int i = 0; i < n; ++i) cin >> h[i];
    
    double min = fabs(t - h[0]*0.006 - a);
    int ans = 1;
    for(int i = 0; i < n; ++i) {
        double tem = t - h[i]*0.006;
        if(min > fabs(tem - a)) {
            min = fabs(tem - a);
            ans = i + 1;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, S; cin >> N >> S;
    vi data(N); F0R(i, N) cin >> data[i];

    ll ans = 0;
    ll dp[S]; F0R(i, S) dp[i] = 0;
    ll cnt[S]; F0R(i, S) cnt[i] = 0;
    F0R(i, N) {
        if (data[i] > S) continue;
        if (data[i] == S) {
            ans += (ll) (i+1) * (ll) (N-i);
            ans %= MOD;
            continue;
        }
        FORd(j, 1, S) {
            if (j + data[i] > S) continue;
            if (j + data[i] == S) {
                ans += dp[j] * (ll) (N-i);
                //cout << i << " " << dp[j] << " " << cnt[j] << endl;
                //cout << ans << endl;
                ans %= MOD;

            } else {
                dp[j+data[i]] += dp[j];
                cnt[j+data[i]] += cnt[j];
            }
        }
        dp[data[i]] += i+1;
        cnt[data[i]]++;
        F0R(j, S) dp[j] %= MOD;
    }

    cout << ans << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
constexpr ll INF = 1e16;
constexpr ll MOD = 1000000007;
 
#define rep(i, N) for(ll i=0; i<(N); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if(a < b) { a = b; return 1; } else { return 0; }}
template<class T> inline bool chmin(T& a, T b) { if(a > b) { a = b; return 1; } else { return 0; }}
 
 
ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }
 
template<typename T> inline string toString(const T &a) {
  ostringstream oss; oss << a; return oss.str();
}
 
ll gcd(ll x, ll y) { return x % y ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }
 
int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  map<string, int> mp;
  rep(i, N) {
    string S;
    cin >> S;
    ++mp[S];
  }
  int mv = 0;
  for(auto m : mp) {
    if(m.second > mv) mv = m.second;
  }
  for(auto m : mp) {
    if(m.second == mv) cout << m.first << endl;
  }  
}


Measured memory_bytes: 26752
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    ll N, C;
    cin >> N >> C;
    vector<ll> his;
    for (ll i = 0; i < N; i++) {
        ll hi;
        cin >> hi;
        his.push_back(hi);
    }
    vector<ll> dp(N);
    dp[0] = 0;
    deque<ll> lines;
    lines.push_back(0);
    for (ll i = 1; i < N; i++) {
        while (true) {
            if (lines.size() <= 1) {
                break;
            }
            ll a = lines[0];
            ll b = lines[1];
            ll val_a = dp[a] + his[a] * his[a] - 2 * his[a] * his[i];
            ll val_b = dp[b] + his[b] * his[b] - 2 * his[b] * his[i];
            if (val_b >= val_a) {
                break;
            }
            lines.pop_front();
        }
        ll a = lines[0];
        ll val_a = dp[a] + his[a] * his[a] - 2 * his[a] * his[i];
        dp[i] = his[i] * his[i] + C + val_a;
        while (true) {
            if (lines.size() <= 1) {
                break;
            }
            ll a = lines[lines.size() - 1];
            ll b = lines[lines.size() - 2];
            double int_ab = (double)(dp[a] - dp[b] + his[a] * his[a] - his[b] * his[b]) / (double)(2 * his[a] - 2 * his[b]);
            double int_ib = (double)(dp[i] - dp[b] + his[i] * his[i] - his[b] * his[b]) / (double)(2 * his[i] - 2 * his[b]);
            if (int_ib >= int_ab) {
                break;
            }
            lines.pop_back();
        }
        lines.push_back(i);
    }
    cout << dp[N-1] << endl;
}



Measured memory_bytes: 4464
#include<bits/stdc++.h>
using namespace std;
const int N=100000+10;
int n,m,a[N],b[N];

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++) scanf("%d",&a[i]);
	sort(a+1,a+m+1);
	if (n>=m) {
		printf("0");
		return 0;
	}
	int ans=a[m]-a[1];
	for (int i=2;i<=m;i++) b[i-1]=a[i]-a[i-1];
	sort(b+1,b+m);
	for (int i=m-1;i;i--) 
		if (--n>0) ans-=b[i];
	cout<<ans;	 
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
   

    ll n;
    string s;
    cin >> n >> s;
    ll ans = 0;
    for(ll i=0;i<n-2;i++){
        if(s.substr(i,3) == "ABC")ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int rectCount = 0;
		int diamondCount = 0;
		while(stdIn.hasNext())
		{
			String[] s = stdIn.next().split(",");
			int a = Integer.valueOf(s[0]);
			int b = Integer.valueOf(s[1]);
			int c = Integer.valueOf(s[2]);
			if(a * a + b * b == c * c)
			{
				++rectCount;
			}
			if(a == b)
			{
				++diamondCount;
			}
		}
		System.out.println(rectCount);
		System.out.println(diamondCount);
	}
}

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

#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define lb(v, z) lower_bound(all(v), z)
#define ub(v, z) upper_bound(all(v), z)
#define fill(a, z) memset(a, z, sizeof(a))
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define rdp(i, a, b) for (int i = (a); i >= (b); i--)
#define rlt(i, a, b) for (int i = (a); i < (b); i++)
#define cns(z) cout << z << ' '
#define cnl(z) cout << z << '\n'
#define M 1000000007
#define M2 998244353
#define INF 10000000000000000000
#define MAXN 300005
#define endl "\n"
#define iip(t) \
	int t;     \
	cin >> t;
#define iip2(a, b) \
	int a, b;      \
	cin >> a >> b;
#define dip(a) \
	double a;  \
	cin >> a;
#define dip2(a, b) \
	double a, b;   \
	cin >> a >> b;
#define garr(ip)       \
	for (auto &x : ip) \
		cin >> x;
#define parr(ip)          \
	for (auto &x : ip)    \
		cout << x << " "; \
	cout << endl;
#define test   \
	int _t;    \
	cin >> _t; \
	while (_t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vp;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	iip(n);
	string s;
	cin >> s;
	vector<vi> cnt(3);
	rep(i, 1, n)
	{
		char it = s[i - 1];
		if (it == 'R')
			cnt[0].push_back(i);
		else if (it == 'G')
			cnt[1].push_back(i);
		else
		{
			cnt[2].push_back(i);
		}
	}
	int rs = cnt[0].size();
	int bs = cnt[1].size();
	int gs = cnt[2].size();
	int ans = 0;
	// parr(cnt[0]);
	// parr(cnt[1]);
	// parr(cnt[2]);
	rlt(i, 0, rs)
		rlt(j, 0, bs)
	{
		ans += gs;
		if (binary_search(all(cnt[2]), cnt[1][j] + cnt[1][j] - cnt[0][i]))
			ans--;
		if (binary_search(all(cnt[2]), cnt[0][i] + cnt[0][i] - cnt[1][j]))
			ans--;
		if ((cnt[0][i] + cnt[1][j]) % 2 == 0 and binary_search(all(cnt[2]), (cnt[0][i] + cnt[1][j])/2))
			ans--;
	}
	cnl(ans);
}

Measured memory_bytes: 3688
#include<stdio.h>

int serch(int n, int S[], int q, int T[]) {
	int count = 0;
	int i, j;
	for (i = 0; i < q; i++) {
		for (j = 0; j < n; j++) {
			if (T[i] == S[j]) {
				count++;
				break;
			}
		}
	}
	return count;
}

int main() {
	int n, q;
	int S[10000], T[500];
	int i;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d", &T[i]);
	}
	printf("%d\n", serch(n, S, q, T));
	return 0;
}


Measured memory_bytes: 2108
#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
	int A,B,C,D;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	int a = max(A,C);
	int b = min(B,D);
	b -= a;
	printf("%d\n",b >= 0 ? b : 0);
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <functional>
#include <utility>
#include <tuple>
#include <numeric>
#include <queue>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <regex>
#include <stack>
#include <limits>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n; 
	map<int, int> a;
	for (int i = 0; i < n; ++i) {
		int j;
		cin >> j;
		a[j]++;
	}

	map<int, int> b;
	for (int i = 0; i < n; ++i) {
		int j;
		cin >> j;
		b[j]++;
	}

	set<pair<int, int>, greater<pair<int, int>>> s;
	for (auto& it : a) {
		if (b.count(it.first) > 0) {
			int cnt = it.second;
			s.insert({cnt + b[it.first], it.first});
		}
	}

	vector<pair<int, int>> res;
	while (!s.empty()) {
		auto it = begin(s);
		int cnt = it->first;
		int num = it->second;
		if (cnt > n) { cout << "No\n"; return 0; }
		if (s.size() > 1) {
			auto it2 = ++begin(s);
			int num2 = it2->second;
			int cnt2 = it2->first;
			a[num]--;
			b[num2]--;
			res.emplace_back(num, num2);
			s.erase(it);
			s.erase(it2);
			if (a[num] != 0) {
				s.insert({ cnt - 1, num });
			} else {
				a.erase(num);
			}

			if (b[num2] != 0) {
				s.insert({ cnt2 - 1, num2 });
			} else {
				b.erase(num2);
			}
		} else {
			auto it2 = begin(b);
			if (it2->first == num) {
				++it2;
			}
			int num2 = it2->first;
			a[num]--;
			b[num2]--;
			res.emplace_back(num, num2);
			s.erase(it);
			if (a[num] != 0) {
				s.insert({ cnt - 1, num });
			}
			else {
				a.erase(num);
			}

			if (b[num2] == 0) {
				b.erase(num2);
			}
		}
	}

	int c = res.size();
	for (auto& it : a) {
		for (int i = 0; i < it.second; ++i) {
			res.emplace_back(it.first, 0);
		}
	}

	for (auto& it : b) {
		for (int i = 0; i < it.second; ++i) {
			res[c].second = it.first;
			++c;
		}
	}

	sort(begin(res), end(res));
	cout << "Yes\n";
	for (int i = 0; i < n; ++i) {
		cout << res[i].second << ' ';
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 32864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		
		if (a < b) {
			System.out.println("a < b");
				
		} else if (a > b) {
			
			System.out.println("a > b");
					
			}
		
		
		else {
			
			System.out.println("a == b");
					
		}
		
	}

}


Measured memory_bytes: 26172
from decimal import Decimal
def waru(N,num):
  cnt = 0
  while N%num==0:
    N //= num
    cnt += 1
  return cnt
def solve():
  N = int(input())
  num = [[0]*101 for _ in range(101)]
  lis = [0]*N
  for i in range(N):
    a = int(Decimal(input())*10**9)
    two,five = waru(a,2)-9,waru(a,5)-9
    two -= 50
    five -= 50
    num[two][five] += 1
    lis[i] = [two,five]
  cum2 = [[0]*101 for _ in range(101)]
  for i in range(99,-1,-1):
    for j in range(99,-1,-1):
      cum2[i][j] = cum2[i+1][j]+cum2[i][j+1]-cum2[i+1][j+1]+num[i][j]
  ans = 0
  for i in range(N):
    two,five = lis[i]
    two2,five2 = -(two+50)-50,-(five+50)-50
    ans += cum2[two2][five2]
    if two+50>=0 and five+50>=0:
      ans -= 1
  return ans//2
print(solve())

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

int main() {
    char X,Y;
    cin >> X >> Y;
    vector<char>A(6);
    A={'A','B','C','D','E','F'};
    for(int i=0;i<6;i++){
        if(X==A.at(i)&&Y==A.at(i)){ cout << '=' << endl;
        break;}
        else if(X==A.at(i)){ cout << '<' << endl;
        break;
        }
        else if(Y==A.at(i)) {cout  << '>' << endl;
        break;}
    }
}

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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val % MOD + (val > 0 ? 0 : MOD)) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 1000000007>;

Int n, k;
Mint ans;

Mint com[112345];

int main(){
	cin >> n >> k;
	std::vector<Int> a(n);
	RC(i, n){
		cin >> a[i];
	}
	std::sort(a.begin(), a.end());
	com[k - 1] = 1;
	for(Int i = k; i < n; ++i) com[i] = com[i - 1] * Mint(i) / Mint(i - k + 1);

	for(Int i = k - 1; i < n; ++i){
		Int tmp = a[i] * (Int)com[i];
		ans += Mint(tmp);

		tmp = a[n - i - 1] * (Int)com[i];
		ans -= Mint(tmp);
	}

	cout << ans << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin>>n;
  if(n.at(0)==n.at(1) && n.at(1)==n.at(2) || n.at(1)==n.at(2) && n.at(2)==n.at(3)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
ABCDE = [int(input()) for _ in range(5)]
ABCDE_ = [(ABCDE[i] + 9) // 10 * 10 for i in range(5)]

s = sum(ABCDE_)
m = float('inf')
for i in range(5) :
    m = min(m, s - (ABCDE_[i] - ABCDE[i]))
    
print(m)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
#define LONGLONGMAX 9223372036854775807
#define LONGLONGMIN -9223372036854775807
#define INTMAX 32767
#define INTMIN -32767
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
long long int n,q;
string s;
std::vector<long long int> l,r;
std::vector<long long int> ans;
int main(){
  cin >> n >> q >> s;
  l.resize(q);r.resize(q);
  for (size_t i = 0; i < n; i++) {
    if(s[i]=='A' && s[i+1] == 'C'){
      ans.push_back(i);
    }
  }
  sort(ans.begin(),ans.end());
  for (size_t i = 0; i < q; i++) {
    cin >> l[i] >> r[i];
    auto low = lower_bound(ans.begin(),ans.end(), l[i]-1);
    auto up = upper_bound(ans.begin(),ans.end(), r[i]-2);
    cout << up-low << endl;
  }
}


Measured memory_bytes: 3064
using System;
 
class Program
{
    static void Main()
    {
    	while(true) {
    		string[] s = Console.ReadLine().Split(' ');
    		int n = int.Parse(s[0]);
    		int x = int.Parse(s[1]);
    		
    		if( (n == 0) && (x == 0) ) break;
    		
    		int cnt = 0;
    		
    		for(int i = 1; i <= (n-2); i++) {
    			for(int j = 1; j <= (n-i); j++) {
    				for(int k = 1; k <= (n-i-j); k++) {
    					if( x == (3*i + 2*j + k) ) cnt++;
    				}
    			}
    		}
    		
    		Console.WriteLine(cnt);
    	}
    }
}

Measured memory_bytes: 9120
#include <stdio.h>

int main(void)
{
	int n, i, j, k, l, re = 0;
	while (scanf("%d", &n) != EOF){
		re = 0;
		for (i = 0; i <= 9; i++){
			for (j = 0; j <= 9; j++){
				for (k = 0; k <= 9; k++){
					for (l = 0; l <= 9; l++){
						if (n == i + j + k + l) re++;
					}
				}
			}
		}
	printf("%d\n", re);
	}

	return (0);
}

Measured memory_bytes: 596
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
#ifdef DEBUG
	printf("");
#endif

	int N,K;
	int l[50];
	int i,j;
	int tmp;
	int ans=0;

	scanf("%d %d", &N, &K);
	for (i = 0; i < N; i++) {
		scanf("%d", &l[i]);
		for (j = i; j > 0; j--) {
			if (l[j] > l[j - 1]) {
				tmp = l[j - 1];
				l[j - 1] = l[j];
				l[j] = tmp;
#ifdef DEBUG
				printf("l[%d]=%d\n", j-1, l[j-1]);
				printf("l[%d]=%d\n", j, l[j]);
#endif
			}
		}
	}
	
	for (i = 0; i < K; i++) {
#ifdef DEBUG
		printf("l[%d]=%d\n", i, l[i]);
#endif
		ans += l[i];
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N, M;
  cin >> N >> M;
  if (N == 1 && M == 1){
    cout << 1 << endl;
  } else if (N == 1){
    cout << M - 2 << endl;
  } else if (M == 1){
    cout << N - 2 << endl;
  } else {
    cout << (N - 2) * (M - 2) << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1.0)
using namespace std;

const int maxn = 1e5 + 10;
int a[maxn], b[maxn];

int main() {
  #ifdef LOCAL
  freopen("in", "r", stdin);
  freopen("out", "w", stdout);
  #endif

  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i <= n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += min(a[i], b[i]);
    b[i] -= min(a[i], b[i]);
    int tmp = min(a[i + 1], b[i]);
    ans += min(a[i + 1], b[i]);
    b[i] -= tmp;
    a[i + 1] -= tmp;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using int128 = __int128;
using cint = cpp_int;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)

// Stream
#define input(a) scanf("%lld", &(a))
#define output(a) printf("%lld\n", (a))
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

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

signed main() {
    ll N, M;
    string S, T;
    cin >> N >> M >> S >> T;
    rep(i, gcd(N, M)) {
        if (S[N / gcd(N, M) * i] != T[M / gcd(N, M) * i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << lcm(N, M) << endl;
}

// for compilation: g++ -O3 -o _ _.cpp -std=c++17


Measured memory_bytes: 640
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	input := []rune(nextString())

	words := make(map[rune]int)

	for _, w := range input {
		if w == '1' {
			words[w]++
		}
	}
	fmt.Println(words['1'])
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

var nextReader func() string

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

lis = [a,b,c,d,e]
lis2 = [999]*5
for i in range(5):
  if lis[i]%10==0:
    lis2[i] = 10
  else:
    lis2[i] = lis[i]%10

last = lis2.index(min(lis2))
total = 0
for i in range(5):
  if i ==last:
    total += lis[i]
  else:
    total += -(-lis[i]//10)*10
    
print(total)

Measured memory_bytes: 38256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    ans = X*min(N,K) + Y*max(N-K,0)
    print(ans)

if __name__ == "__main__": main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  int h, w, n;
  cin >> h >> w >> n;
  cout << int(ceil(1.0 * n / max(h, w))) << endl;
}

Measured memory_bytes: 3644
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  double A, B, X;
  cin >> A >> B >> X;

  double ans;
  if (X / A >= A * B / 2){
    ans = atan(A / (2 * B - 2 * X / (A * A)));
  }else{
    ans = atan(2 * X / (A * B * B));
  }
  cout << setprecision(32) << 90 - ans / PI * 180 << endl;

  return 0;
}


Measured memory_bytes: 4076
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll x;
  cin >> x;

  for(ll i = x;;i++)
  {
    bool b = false;
    for(ll j = 2;j < i;j++)
    {
      if(i % j == 0)
      {
        b = true;
        break;
      }
    }

    if(!b)
    {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

#define __m int mid=(l+r)>>1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

template<class T>
inline bool rd(T &num) {
    char in;
    bool IsN = false;
    while(in = getchar(), in != '-' && (in < '0' || in > '9'))if(in == EOF)return false;
    in == '-' ? (IsN = true, num = 0) : num = in - '0';
    while(in = getchar(), in >= '0' && in <= '9')num = num * 10 + in - '0';
    return IsN ? num = -num : num, true;
}

#define rep(i,a,b) for(register int i = (a); i< (b); i++)
#define per(i,a,b) for(register int i = (a); i> (b); i--)
#define clr(a) memset(a,0,sizeof(a));
#define inf(a) memset(a,0x3f,sizeof(a));
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rd2(a,b) rd(a)&&rd(b)
#define rd3(a,b,c) rd(a)&&rd(b)&&rd(c)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

string nico;
#ifdef LOCAL
#define bug(x) cout<<#x<<" : "<<x<<endl
#define infile(x) freopen(x,"r",stdin)
#define outfile(x) freopen(x,"w",stdout)
#else
#define bug(x)
#define infile(x)
#define outfile(x)
#endif

const int maxn = 1e5 + 7;
const int inf  = 0x3f3f3f3f;
const LL linf  = (LL)inf << 32 | inf;
const int mod  = 1e9 + 7;

int main() {
    IO;
    int n;
    cin>>n;
    char num[maxn];
    sprintf(num,"%d",n);
    int k=0;
    for(int i=0;i<strlen(num);i++)
        k+=num[i]-'0';
    if(n%k==0)
        cout<<"Yes"<<endl;
    else 
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	A, B := sc.nextInt(), sc.nextInt()
	var ans int
	for i := 1; i <= 1000; i++ {
		n := float64(i)
		//fmt.Fprintln(wtr, i, n*0.08, n*0.1)
		if int(n*0.08) == A && int(n*0.1) == B {
			ans = i
			break
		}
	}

	if ans == 0 {
		fmt.Fprintln(wtr, -1)
	} else {
		fmt.Fprintln(wtr, ans)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main()
{	
	int l, r, d;
	cin >> l >> r >> d;

	int ans = 0;
	RNG(i, l, r + 1) {
		if (i % d == 0)ans++;
	}
	col(ans);
	return 0;
}


Measured memory_bytes: 3608
n = int(input())
c = input()

t = n
lw, rr = 0, c.count('R')
for ci in c+'Z':
    swap = min(lw, rr)
    wtor, rtow = max(0, lw-swap), max(0, rr-swap)
    t = min(t, swap + wtor + rtow)
    lw = lw + (ci == 'W')
    rr = rr - (ci == 'R')

print(t)


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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	string s,t;
	cin>>s>>t;
	cout<<t<<s<<'\n';
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""
 


Measured memory_bytes: 3656
#include<stdio.h>

int main()
{
int a,b,i;
char op;
for(i=1; i>0; i++){
   scanf("%d %c %d", &a,&op,&b);
   if(op == '+')
   { printf("%d\n",a+b);
   }
   else if(op=='-')
   {printf("%d\n", a-b);
   }
   else if(op=='/')
   {printf("%d\n",a/b);
   }
   else if(op=='*')
   {printf("%d\n",a*b);
   }
   else{
   break;
   }
   
   }
   
   return 0;
   } 


Measured memory_bytes: 2052
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int N, Q, s[1000000];
vector<int> all;
multiset<int> now;

string binary_search(int x){
	int ok = 1000000005;
	int ng = -1;
	while(ok-ng > 1){
		int m = (ng+ok) / 2;
		int c = 0;
		int l = -1;
		for(auto itr=now.begin(); itr!=now.end(); itr++){
			int r = *itr - m;
			// c += st.count(l, r)
			if(l < r) c += lower_bound(all.begin(), all.end(), r) - upper_bound(all.begin(), all.end(), l);
			l = *itr;
		}
		auto itr = now.end();
		itr--;
		c += all.end() - upper_bound(all.begin(), all.end(), *itr);
		if(c <= x) ok = m;
		else ng = m;
	}
	if(ok == 1000000005) return "NA";
	return to_string(ok);
}

int main(){
	cin >> N >> Q;
	for(int i=0; i<N; i++){
		cin >> s[i];
		all.PB(s[i]);
	}
	sort(all.begin(), all.end());
	for(int i=0; i<Q; i++){
		string S;
		cin >> S;
		if(S == "ADD"){
			int a;
			cin >> a;
			now.insert(s[a-1]);
		}
		if(S == "REMOVE"){
			int a;
			cin >> a;
			auto itr = now.find(s[a-1]);
			now.erase(itr);
		}
		if(S == "CHECK"){
			int x;
			cin >> x;
			if(x >= N) cout << 0 << endl;
			else if(now.size() == 0) cout << "NA" << endl;
			else cout << binary_search(x) << endl;
		}
	}
}


Measured memory_bytes: 10960