akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

int main() {
  string s,t;
  cin>>s>>t;
  ll a;
  a=s.size();
  t=t.substr(0,a);
  if(s==t){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  //cout<<t;
      
}


Measured memory_bytes: 3624
#ifndef VS
#include<bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

LL S;
LL ret = 0;
constexpr int mod = 1e9 + 7;
constexpr int ten8 = 1e8;
inline void inc(int &id, int &nxt, LL &len, LL& sum) {
	id++;
	if (id == nxt) {
		len++;
		nxt *= 10;
	}
	sum += len;
}
int main() {
	cin >> S;
	{
		int l = 0, r = 0;
		int lnxt = 10, rnxt = 10;
		LL llen = 1, rlen = 1;
		LL lsum = 0, rsum = 0;
		while (l < ten8-1) {
			while (rsum - lsum < S)inc(r, rnxt,rlen, rsum);
			if (rsum - lsum == S)ret++;
			inc(l,lnxt, llen, lsum);
		}
	}
	LL p = 10;
	LL q = 1;
	LL len = 1;
	for (int _ : range(1,S)) {
		int num = S - _;
		LL llen = S / num;
		if (llen <= 8)continue;
		if (S%num == 0) {
			while (len < llen) {
				len++; 
				p = p * 10 % mod;
				q = q * 10 % mod;
			}
			ret += p + mod + mod - num - q + 1;
			ret %= mod;
		}
		else {
			ret++;
		}
	}
	cout << ret%mod << endl;
	return 0;
}


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

int main() {
        int n, m, x, y;

        std::cin >> n >> m >> x >> y;

        std::vector<int> xn(n);
        std::vector<int> yn(m);

        for (auto& v : xn) {
                std::cin >> v;
        }
        for (auto& v : yn) {
                std::cin >> v;
        }

        if (x >= y) {
                std::cout << "War" << std::endl;
                return 0;
        }

        int xm = *std::max_element(std::begin(xn), std::end(xn));
        int ym = *std::min_element(std::begin(yn), std::end(yn));

        std::vector<int> d(std::abs(y - x));
        std::iota(std::begin(d), std::end(d), xm + 1);

        for (auto v : d) {
                if (x < v &&
                        y >= v &&
                        std::all_of(std::begin(xn), std::end(xn), [v](int x) { return x < v; }) &&
                        std::all_of(std::begin(yn), std::end(yn), [v](int y) { return y >= v; }) == true) {
                        std::cout << "No War" << std::endl;
                        return 0;
                }
        }

        std::cout << "War" << std::endl;

        return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll inf = 10e17;
const ld eps = 10e-9;



ll solve(void);
ll gcd(ll x, ll y);

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

ll mulmod(ll x, ll y)
{
	return (x * y) % mod;
}

ll submod(ll x, ll y)
{
	return (x - y + 100 * mod) % mod;
}

ll power(ll n, ll r)
{
	if ( r == 0 ) { return 1; }
	if ( r == 1 ) { return n; }
	if ( n == 0 ) { return 0; }
	if ( n == 1 ) { return 1; }

	if (r % 2 == 0)
	{
		ll y = power(n, r/2);
		return mulmod(y, y);
	}
	else
	{
		ll y = power(n, (r-1)/2);
		return n * mulmod(y, y) % mod;
	}
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}

vector<ll> perm;
vector<ll> inv;
void init_inv(ll m)
{
	perm.resize(m);
	inv.resize(m);
	
	perm[0] = 1;
	inv[0] = 1;

	for (ll i = 1; i < m; i++)
	{
		perm[i] = mulmod(perm[i-1], i);
	}
	
	for (ll i = 1; i < m; i++)
	{
		inv[i] = power(perm[i], mod - 2);
	}
}

ll ncr(ll n, ll r)
{
	// n (n-1) ... (n-r)
	if ( r == n || r == 0 ) { return 1; }

	ll ans = 1;
	//for (ll i = 0; i < r; i++)
	//	ans = mulmod(ans, n - i);

	// return mulmod(ans, inv[r]);
	return mulmod(perm[n], mulmod(inv[n-r], inv[r]));
}

ll solve(void)
{
	string s;
	cin >> s;

	for (ll i = 0; i < s.length(); i++)
		s[i] = 'x';

	cout << s << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



int main(){
	string s;
	cin >> s;
	rep(i,s.size() - 1){
		if(s[i] == s[i+1]){
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int la,lb;
string a,b;
int read()
{
	int s=0;
	char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
	{
		s=(s<<1)+(s<<3)+c-'0';
		c=getchar();
	}
	return s;
}
int main()
{
	int i;
	cin>>a;
	cin>>b;
	la=a.size();lb=b.size();
	for(i=0;i<min(la,lb);i++)
		printf("%c%c",a[i],b[i]);
	if(la>lb)
		printf("%c",a[la-1]);
	if(lb>la)
		printf("%c",b[lb-1]);
	return 0;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int n = sc.nextInt();
        List<Integer> bList = new ArrayList<>();
        for (int i = 0; i < n - 1; i++) {
            bList.add(sc.nextInt());
        }

        int sum = 0;

        for (int i = 0; i < n - 2; i++) {
            sum += Math.min(bList.get(i), bList.get(i+1));
        }

        sum += bList.get(0) + bList.get(n-2);
        System.out.println(sum);
    }
}

Measured memory_bytes: 23764
sx, sy, tx, ty = map(int, input().split())
dif_x, dif_y = tx - sx, ty - sy
ans = 'R' * dif_x + 'U' * (dif_y + 1) + 'L' * (dif_x + 1) + 'D' * (dif_y + 1) + 'R'
ans += 'U' * dif_y + 'R' * (dif_x + 1) + 'D' * (dif_y + 1) + 'L' * (dif_x + 1) + 'U'
print(ans)

Measured memory_bytes: 3060
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long
#define ld double
#define ull unsigned long long
#define PI pair < int, int > 
#define hash Hash

const int N = 567;
const int M = 123;
const ld Pi = acos(-1);
const ll Inf = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int Sz = 501;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) {
  return 1ll * a * b % mod;
}
int sum(int a, int b) {
  add(a, b);
  return a;
}

int n, m, a[N][N];
bool used[N];
int cnt[N];

bool check(int lim) {
  for (int i = 1;i <= m;i++) {
    used[i] = 1;
    cnt[i] = 0;
  }
  bool bad = 1;
  while(bad) {
    bad = 0;
    for (int i = 1;i <= n;i++) {
      for (int j = 1;j <= m;j++) {
        if (used[a[i][j]]) {
          cnt[a[i][j]]++;
          break;
        }
      }
    }
    for (int i = 1;i <= m;i++) {
      if (cnt[i] > lim) {
        bad = 1;
        used[i] = 0;
      }
      cnt[i] = 0;
    }
  }
  for (int i = 1;i <= m;i++) if (used[i]) return 1;
  return 0; 
}

void solve() {
  cin >> n >> m;
  for (int i = 1;i <= n;i++) {
    for (int j = 1;j <= m;j++) cin >> a[i][j];
  }
  int l = 1, r = n, ans;
  while(l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else l = mid + 1;
  }
  cout << ans << endl;
} 

int main() {
  #ifdef wws
   freopen("in", "r", stdin);
  // freopen("out", "w", stdout);
  #endif 
  ios_base::sync_with_stdio(0);
  int tt = 1; 
  while(tt--) solve();
  return 0;
}


Measured memory_bytes: 896
/*input
314 15
9 26 5 35 8 9 79 3 23 8 46 2 6 43 3
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
#define DEC(N)	cout << std::fixed; cout << setprecision(N);
void solve()
{
	lld n,m;
	cin >> n >> m;
	rep(i,0,m){
		lld x;
		cin >> x;
		n-=x;
	} 
	cout << max(n,-1LL) << endl;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
  	cin >> a.at(i);
  }
  sort(a.begin(), a.end(), greater<int>());
  int A =0 , B=0;
  for(int i = 0; i < N; i++){
  	if(i % 2 == 0){
    	A += a.at(i);
    }
    else{
    	B += a.at(i);
    }
  }
  cout << A - B << endl;
}


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

using namespace std;

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

    int count = 0;
    for (int i = A; i <= B; ++i) {
        string a = to_string(i);
        if (a[0] == a[4] && a[1] == a[3]) ++count;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;

int main(){
	while(1){
		int n,a[10010],ans=0,cnt=0;
		cin>>n;
		if(n==0)break;
		rep(i,0,n)cin>>a[i],ans+=a[i];
		ans/=n;
		rep(i,0,n)if(ans>=a[i])cnt++;
		print(cnt);
	}
	return 0;
}


Measured memory_bytes: 3088
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    for (int i = 0; i<n; i++ ) {
      a[i] = sc.nextInt();
    }
    int b = 1;
    int c = 0;
    int d = 0;

    while ( b != 2 ) {
      d += 1;
      c = b;
      b = a[b-1];
      if ( b == 0 ) {
        System.out.println(-1);
        return;
      }
      a[c-1] = 0;
    }
    System.out.println(d);
  }
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n,m;
  while(1){
    cin >> n >> m;
    if(n==0) return 0;
    vector<int> taro(n),hanako(m);
    int tt=0,ht=0;
    for(int i=0;i<n;i++){
      cin >> taro[i];
      tt+=taro[i];
    }
    for(int i=0;i<m;i++){
      cin >> hanako[i];
      ht+=hanako[i];
    }
    int ta=101,ha=101;
    if((tt-ht)%2){
      cout << -1 << endl;
      continue;
    }else{
      for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
          if(taro[i]==hanako[j]+(tt-ht)/2){
            if(ta+ha>taro[i]+hanako[j]){
              ta=taro[i];
              ha=hanako[j];
            }
          }
        }
      }
    }
    if(ta!=101){
      cout << ta << " " << ha << endl;
    }else{
      cout << -1 << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3076
<>=~$";
@a=glob`dd`;
for(1..$`*$'){
	if($a[$_-1]%2){
		($x=$_%$'?$_:$_<$`*$'&&$_-1+$')&&++$a[$x]+push@_,$_-1,$x
	}
}
print@_/2,$/,map{$_/$'+1|0,$",$_%$'+1,--$|?$":$/}@_


Measured memory_bytes: 113712
#include<iostream>
using namespace std;
int a[3][103];
int main()
{
	int sum=-1;
	
	int n;
	 cin>>n;
	for(int i=1;i<=n;i++)
	  cin>>a[1][i];
	for(int i=1;i<=n;i++)
	  cin>>a[2][i];
	
	
		for(int i=1;i<=n;i++)
		{
			int ans1=0;
			int ans2=0;//记得清零 
			for(int j=1;j<=i;j++)
			{
				ans1=ans1+a[1][j];
			}
			for(int m=i;m<=n;m++)
			{
				ans2=ans2+a[2][m];
			}
			if(sum<(ans1+ans2)) sum=ans1+ans2;
		}
	cout<<sum<<endl;
	return 0;
} 


Measured memory_bytes: 256
/*
 * Matheus Oliveira
 * 09:09:48 01/09/2019
 * c.cpp
*/
#include <bits/stdc++.h>
using namespace std;

#define EPS
#define INF
#define MAXN 100010
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define debug(x) printf("%s: %d\n", #x, x);
#define debugarr(x, ini, fim) printf("%s: ", #x); for(int i = ini; i <= fim; i++) printf("%d%c", x[i], (i == fim) ? '\n' : ' ');

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

int v[MAXN], ans[MAXN], best;

int main() {
	int n;

	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &v[i]);

	for(int i = n-2; i >= 0; i--) {
		if( v[i] >= v[i+1] ) ans[i] = ans[i+1] + 1;
		else ans[i] = 0;

		best = max(best, ans[i]);
	}

	printf("%d\n", best);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

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

    int sum = 0;
    for (int i = 0; i < N + 1; i++) {
        sum += abs(A[i + 1] - A[i]);
    }

    for (int i = 0; i < N; i++) {
        cout << sum - abs(A[i + 1] - A[i]) - abs(A[i + 2] - A[i + 1]) + abs(A[i + 2] - A[i]) << endl;
    }
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = 1;i <= n;i++)
#define fi first
#define se second
const int inf = 1e18;
typedef pair<int,int> P;

vector<P> x[200001], y[200001], G[400010];
priority_queue<P, vector<P>, greater<P> > q;
int d[400010];
signed main(){
	int w, h, n;
	fill(d, d+400010, inf);
	scanf("%lld%lld%lld", &w, &h, &n);
	for(int i = 1;i <= n;i++){
		int yy, xx;
		scanf("%lld%lld", &xx, &yy);
		x[xx].push_back(P(yy, i));
		y[yy].push_back(P(xx, i));
	}
	x[1].push_back(P(1, 0));
	x[w].push_back(P(h, n+1));
	y[h].push_back(P(w, n+1));
	n++;
	
	for(int i = 1;i <= w;i++){
		sort(x[i].begin(), x[i].end());
		for(int j = 1;j < x[i].size();j++){
			int from = x[i][j-1].se, to = x[i][j].se;
			int cost = x[i][j].fi-x[i][j-1].fi;
			G[from].push_back(P(to, cost));
			G[to].push_back(P(from, cost));
		}
	}
	for(int i = 1;i <= h;i++){
		sort(y[i].begin(), y[i].end());
		for(int j = 1;j < y[i].size();j++){
			int from = y[i][j-1].se+n, to = y[i][j].se+n;
			int cost = y[i][j].fi-y[i][j-1].fi;
			G[from].push_back(P(to, cost));
			G[to].push_back(P(from, cost));
		}
	}
	for(int i = 1;i <= n-1;i++){
		G[i].push_back(P(i+n, 1));
		G[i+n].push_back(P(i, 1));
	}
	
	d[0] = 0;
	q.push(P(0, 0));
	while(!q.empty()){
		P p = q.top();q.pop();
		if(d[p.se] < p.fi)continue;
		for(int i = 0;i < G[p.se].size();i++){
			int from = p.se, to = G[p.se][i].fi;
			int cost = G[from][i].se;
			if(d[from]+cost < d[to]){
				d[to] = d[from]+cost;
				q.push(P(d[to], to));
			}
		}
	}
	
	/*printf("\n");
	for(int i = 0;i < 10;i++){
		for(int j = 0;j < G[i].size();j++)
		printf("%d %d %d\n", i, G[i][j].fi, G[i][j].se);
	}*/
	
	int ans = min(d[n], d[2*n]);
	if(ans == inf)printf("-1\n");
	else printf("%lld\n", ans);
	//printf("%d\n", n);
	return 0;
} 


Measured memory_bytes: 69512
#include <cstdio>
#include <cstring>

int main() {
    char s1[15], s2[15], s3[15];
    scanf("%s %s %s", &s1[0], &s2[0], &s3[0]);

    int len1 = strlen(s1);
    int len2 = strlen(s2);

    if (s1[len1-1] == s2[0] && s2[len2-1] == s3[0])
        printf("YES");
    else
        printf("NO");

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int summation = 0;

		for (int i = 1; i <= N; i++) {
			int sum = 0;
			String I = String.valueOf(i);
			for (int j = 0; j < I.length(); j++) {
				sum += Integer.parseInt(I.substring(j, j + 1));
			}
			if (sum >= A && sum <= B) {
				summation += i;
			}
		}

		System.out.println(summation);
	}
}

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

int main(){
  char a,b;
  cin>>a>>b;
  
  if((a=='H'&&b=='H')||(a=='D'&&b=='D')){
    cout<<'H'<<endl;
  }
  
   else if((a=='H'&&b=='D')||(a=='D'&&b=='H')){
    cout<<'D'<<endl;
  }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n-1);
  rep(i,0,n-1)cin>>a[i];
  vector<ll>cnt(n);
  rep(i,0,n-1){
    a[i]--;
    cnt[a[i]]++;
  }
  rep(i,0,n)cout<<cnt[i]<<endl;
  return 0;
}

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

string b[1000000];

bool cmp(string a,string b)
{
    return a<b;
}

int main()
{
    int n,l;
    cin>>n>>l;
    for(int i=1;i<=n;++i)
        cin>>b[i];
    sort(b+1,b+1+n,cmp);
    for(int i=1;i<=n;++i)
        cout<<b[i];
    return 0;
}

Measured memory_bytes: 8064
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e16
using namespace std;
typedef pair<ll, ll> P;


int main(void) {
	ll n, k, ans = 0, num = 0;
	cin >> n >> k;
	ll m = min(n, k);
	vector<ll>v(n), x, y;
	for (ll i = 0;i < n;i++)cin >> v[i];
	for (ll i = -1;i < n;i++) {
		for (ll j = -1;j < n;j++) {
			num = 0;
			if ((i + j + 2) > n)continue;
			if ((i + j + 2) > k)continue;
			for (ll a = -1;a <= i;a++)if (a != -1)x.push_back(v[a]);
			for (ll a = -1;a <= j;a++)if (a != -1)x.push_back(v[n - 1 - a]);
			sort(x.begin(), x.end());
			ll c = k - (i + j + 2);
			for (ll l = 0;l < (ll)x.size();l++) {
				if (c > 0) {
					if (x[l] >= 0)num += x[l];
					else c--;
				}
				else num += x[l];
			}
			//cout << num << endl;
			ans = max(ans, num);
			x.clear();
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int a,b = 0;
    cin >> a >> b;
    int d = a/b;
    int r = a%b;
    double f = 1.000000000 * a/b;
//    cout << d << " " << r << " " << f << endl;
    printf("%d %d %f\n", d, r, f);
}


Measured memory_bytes: 3224
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n,i,j;
  scanf("%d",&n);
  int a[n];

  for(i=0;i<n;i++){
    //printf("inout\n");
    scanf("%d",&a[i]);
  }

  int max=-999999999;
  int min=1000000000;
  /*for(i=n-1;i>0;i--){
    for(j=0;j<i;j++){
      //printf("%d,%d,%d\n",i,j,a[i]-a[j]);
      if(max<a[i]-a[j]){
        max=a[i]-a[j];
      }
    }
  }*/
  for(i=1;i<n;i++){
    //printf("%d,\n",a[i]);
    if(min>a[i-1]){
      min=a[i-1];
    }
    //printf("%d,,\n",min);
    if(max<a[i]-min){
      //printf("%d\n",i);
      max=a[i]-min;
    }
  }

  printf("%d\n",max);
}



Measured memory_bytes: 2572
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;


int main(){

	int member[5],check[4],num_of_val;

	while(true){

		for(int i = 1; i <= 3; i++)check[i] = 0;

		scanf("%d",&member[0]);

		if(member[0] == 0)break;
		else{
			check[member[0]]++;
		}

		for(int i = 1; i < 5; i++){
			scanf("%d",&member[i]);
			check[member[i]]++;
		}

		num_of_val = 0;

		for(int i = 1; i <= 3; i++){
			if(check[i] > 0)num_of_val++;
		}

		if(num_of_val == 3 || num_of_val == 1){
			printf("3\n3\n3\n3\n3\n");
		}else{
			if(check[1] > 0 && check[2] > 0){	//??°?????¨?????§???
				for(int i = 0; i < 5; i++){
					if(member[i] == 1)printf("1\n");
					else{
						printf("2\n");
					}
				}
			}else if(check[1] > 0 && check[3] > 0){	//??°?????¨??????
				for(int i = 0; i < 5; i++){
					if(member[i] == 3)printf("1\n");
					else{
						printf("2\n");
					}
				}
			}else{ //?????§?????¨??????
				for(int i = 0; i < 5; i++){
					if(member[i] == 2)printf("1\n");
					else{
						printf("2\n");
					}
				}
			}
		}
	}
    return 0;
}

Measured memory_bytes: 2524
N = int(input())
H = [int(_) for _ in input().split()]

D = 0
ans = 0

for i in range(N-1):
    if H[i] - H[i+1] >= 0:
        D += 1
        if ans < D:
            ans = D
    else:
        D = 0

print(ans)


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

int main() {
  string str;
  int cntA = 0;
  int cntB = 0;
  int cntC = 0;
  cin >> str;
  
  for(int i = 0; i < 3; i++){
    if(str.at(i) == 'a') cntA++;
    else if(str.at(i) == 'b') cntB++;
    else if(str.at(i) == 'c') cntC++;
  }
  
  if(cntA == 1 && cntB == 1 && cntC == 1) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int N, K;
    int X[1000000];
    cin >> N >> K;
    for (int i = 0; i < N; i++){
        cin >> X[i];
    }
    vector<int> x;
    vector<int> y;
    for (int i = 0; i < N; i++){
        if (X[i] < 0) y.push_back(abs(X[i]));
        else x.push_back(X[i]);
    }
    sort(y.begin(), y.end());

    int min_distance = 1000000000;

    for (int i = 0; i < K; i++){
        x.push_back(1000000000);
        y.push_back(1000000000);
    }
    if (x[K - 1] < min_distance) min_distance = x[K - 1];
    if (y[K - 1] < min_distance) min_distance = y[K - 1];

    for (int i = 1; i < K; i++){
        int mindis = min(2 * x[K - 1 - i] + y[i - 1], x[K - 1 - i] + 2 * y[i - 1]);
        if (mindis < min_distance) min_distance = mindis;
    }
    cout << min_distance << endl;
    return 0;
}

Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,cnt=0,i=1;
    cin>>n;
    vector<int> a(n+1),on(n+1);
    repi(i,1,n+1) cin>>a[i];
    while(on[2]==0){
        if(cnt>n){
            cout<<-1;
            return 0;
        }
        on[a[i]]++;
        cnt++;
        i=a[i];
    }
    cout<<cnt;
}

Measured memory_bytes: 4044
import math

a,b,deg = map(int,input().split())
radi = math.radians(deg)

S = 1/2 * a * b * math.sin(radi)
L = a + b + math.sqrt(a**2+b**2 - 2*a*b*math.cos(radi))
h = b * math.sin(radi)

print("{:.8}".format(S))
print("{:.8}".format(L))
print("{:.8}".format(h))


Measured memory_bytes: 5708
#include <iostream>
#include <algorithm>

int main() {
    int w, h, n;
    std::cin >> w >> h >> n;
    
    int areaX[2] = {0, w}, areaY[2] = {0, h};
    
    for (int i = 0; i < n; ++i) {
        int x, y, a;
        std::cin >> x >> y >> a;
        if (a == 1)
            areaX[0] = std::max(areaX[0], x);
        else if (a == 2)
            areaX[1] = std::min(areaX[1], x);
        else if (a == 3)
            areaY[0] = std::max(areaY[0], y);
        else if (a == 4)
            areaY[1] = std::min(areaY[1], y);
    }
    
    std::cout << std::max(areaX[1] - areaX[0], 0) * std::max(areaY[1] - areaY[0], 0) << std::endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String[] str = scanner.next().split("");

        String guusuu = new String();
        String kisuu = new String();
        for(int i = 0; i < str.length; i++) {
            if(i % 2 == 0) {
                kisuu += str[i];
            } else {
                guusuu += str[i];
            }
        }

        if (guusuu.contains("R")  || kisuu.contains("L")) {
            System.out.println("No");
        } else {
            System.out.println("Yes");

        }
    }
}


Measured memory_bytes: 23508
n, m = [int(i) for i in input().split()]
sc = [list(map(int, input().split())) for _ in range(m)]


ans = -1
for i in range(10**(n-1) if n > 1 else 0, 10**n):
    for s, c in sc:
        if str(i)[s-1] != str(c):
            break
    else:
        ans = i
        break
print(ans)


Measured memory_bytes: 38384
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();
    int X = sc.nextInt();
    
    int leftCount = 0;
    for (int i = 0; i < M; i++) {
      int a = sc.nextInt();
      if (a < X) {
        leftCount++;
      }
    }
    
    System.out.println(M/2 < leftCount ? M - leftCount : leftCount);
  }
}

Measured memory_bytes: 23124
using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            solve();
        }
        private static void solve()
        {
            var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var a = arr[0];
            var b = arr[1];
            var h = arr[2];
            var m = arr[3];
            //var bigpoint = m * 12 / 60;
            //var smallpoint = h * 5 + 5 * (m / 60);
            //var diff = 60 - bigpoint - smallpoint;
            //var ugol = diff * 180 /30;
            double pi = 3.14159265358979323846264338327950;
            //var rad = ugol * pi/180;
            var rad = pi * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

            double r = (a * a + b * b) - (2 * a * b * Math.Cos(rad));

            Console.WriteLine(Math.Sqrt(r));
        }
    }
}

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

#define int long long

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  int now=1000,kabu=0;
  for(int i=0;i<n;i++){
    now+=kabu*v[i];kabu=0;
    if(i<n-1&&v[i]<v[i+1]){
      kabu=now/v[i];
      now%=v[i];
    }
  }
  cout<<now<<endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    int n,m; cin >> n >> m;
    vector<P> v;
    rep(i,m){
        int a,b; cin >> a >> b;
        v.push_back(make_pair(b,a));
    }
    sort(v.begin(),v.end());
    int ans = 0, t = 0;
    rep(i,m){
        if(t <= v[i].second){
            ans++;
            t = v[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int N = 2e4 + 50;
int n; char S[N], T[N];
int A[N], B[N], ca, cb, a[N], b[N];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d%s%s",&n,S+1,T+1);
	if(S[1]=='1') A[++ca]=0;
	for(int i=1; i<n; i++) if(S[i]!=S[i+1]) A[++ca]=i;
	if(S[n]=='1') A[++ca]=n;
	if(T[1]=='1') B[++cb]=0;
	for(int i=1; i<n; i++) if(T[i]!=T[i+1]) B[++cb]=i;
	if(T[n]=='1') B[++cb]=n;
	for(int i=1; i<=ca; i++) a[i+cb]=A[i];
	for(int i=ca+cb+1; i<=ca+cb+cb; i++) a[i]=n;
	int Ans=1e9;
	for(int i=0; i<=ca+cb; i+=2){
		for(int j=1; j<=i; j++) b[j]=0;
		for(int j=1; j<=cb; j++) b[i+j]=B[j];
		for(int j=i+cb+1; j<=ca+cb+cb; j++) b[j]=n;
		int now = 0;
		for(int j=1; j<=ca+cb+cb; j++) now += abs(b[j]-a[j]);
		Ans = min(Ans,now);
	} cout<<Ans; return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    bool color[8];
    for(int i=0;i<8;i++) color[i] = false;
    int N;
    cin >> N;
    int fr = 0;
    for(int i=0;i<N;i++){
        int rate;
        cin >> rate;
        if(rate<3200) color[rate/400] = true;
        else fr ++;
    }
    int n=0;
    for(int i=0;i<8;i++) if(color[i]) n++;
    if(n==0) cout << 1 << " " << fr+n<<endl;
    else cout << n << " " << fr+n<<endl;
}

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

int main() {
  string s;
  cin >> s;

  string ans = "No";
  for(int i = 1; i < s.length(); ++i){
    if(s.at(i-1) != s.at(i)) ans = "Yes";
  }

  cout << ans << endl;
}


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

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

  int sum = 0;
  for (int i = 0; i < N.length(); i++) {
    if (N[i] == '1') sum += 1;
    else if (N[i] == '2') sum += 2;
    else if (N[i] == '3') sum += 3;
    else if (N[i] == '4') sum += 4;
    else if (N[i] == '5') sum += 5;
    else if (N[i] == '6') sum += 6;
    else if (N[i] == '7') sum += 7;
    else if (N[i] == '8') sum += 8;
    else if (N[i] == '9') sum += 9;
  }
  
  int num = stoi(N);
  if ((num % sum) == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define int long long 
using namespace std;
const int N=1e3+7,M=31;
int n,x[N],y[N],f[N],tot;
string s;
void work(int dx,int dy){
	int nx=0,ny=0;
	per(i,tot,1){
		int tx=dx-nx,ty=dy-ny;
		if(abs(tx)>abs(ty)){
			if(tx>0)s="R"+s,nx+=f[i];
			else s="L"+s,nx-=f[i];
		}
		else {
			if(ty>0)s="U"+s,ny+=f[i];
			else s="D"+s,ny-=f[i];
		}
	}
}
signed main(){
	cin>>n;
	rep(i,1,n)cin>>x[i]>>y[i];
	
	rep(i,2,n)if(abs(x[1]+y[1]-x[i]-y[i])&1){cout<<-1;return 0;}
	if((x[1]+y[1])&1){f[1]=1;rep(i,2,31)f[i]=f[i-1]<<1;tot=31;}
	else {f[1]=f[2]=1;rep(i,3,32)f[i]=f[i-1]<<1;tot=32;}
	
	cout<<tot<<endl;
	rep(i,1,tot)cout<<f[i]<<" ";
	cout<<endl;
	
	rep(i,1,n){
		s="";
		work(x[i],y[i]);
		cout<<s<<endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const ld PIE = atan2(0, -1);

void solve() {
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	int sum = 0;
	for (int i = 0; i < m; ++i) {
		cin >> a[i]; sum += a[i];
	}
	if (sum > n) cout << -1 << "\n";
	else cout << n - sum << "\n";
}

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

Measured memory_bytes: 3644
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}

ll Q;


typedef vector<vector<pll>> graph;


graph tree;
ll vis[100005], d[100005];
vector<ll> val[100005][2];

bool flag = false, flag2 = true;

int sign(int a) {
	if (a % 2 == 1)
		return -1;
	else
		return 1;
}

void dfs(int s, int p, int dist, int sum) {
	vis[s] = 1;
	d[s] = dist + 1;
	val[s][d[s] % 2].push_back(sum);
	rep(i, tree[s].size()) {
		int ni = tree[s][i].first;
		int omomi = tree[s][i].second;
		if (ni == p)
			continue;

		if (vis[ni] == 0) {
			dfs(ni, s, d[s], omomi - sum);
		}

		else {
			val[ni][(d[s] + 1) % 2].push_back(omomi - sum);
		}
	}

}


int main() {
	ll N, M;

	cin >> N >> M;
	tree.resize(N);

	rep(i, M) {
		ll a, b, s;

		cin >> a >> b >> s;
		a--;
		b--;
		tree[a].push_back({ b, s });
		tree[b].push_back({ a, s });
	}

	dfs(0, 0, -1, 0);

	ll m1 = -inf, m2 = inf;

	ll u1 = -inf;
	rep(i, N) {
		ll a = inf, b = inf;

		rep(j, val[i][0].size()) {
			if (j != 0 && a != val[i][0][j]) {
				cout << 0 << endl;
				return 0;
			}
			if (j == 0) {
				a = val[i][0][0];
				m1 = max(m1, -min(a, 0));
			}
		
		}

		rep(j, val[i][1].size()) {
			if (j != 0 && b != val[i][1][j]) {
				cout << 0 << endl;
				return 0;
			}
			if (j == 0) {
				b =val[i][1][0];
				m2 = min(b, m2);
			}
		}
		

		if (a != inf && b != inf) {
			flag = true;
			if (u1 == -inf) {
				u1 = (-a + b) / 2;
			}
			
			if ((-a + b) % 2 != 0 || u1 != (-a + b) / 2) {
				cout << 0 << endl;
				return 0;
			}


		}

	}

	if (flag == true) {

		if (u1 > m1 && u1 < m2)
			cout << 1 << endl;
		else
			cout << 0 << endl;

		return 0;
	}

	m1++;
	m2--;
	cout << max(m2 - m1 + 1, 0) << endl;

	return 0;
}


Measured memory_bytes: 24704
object Main extends App {
  val flags = Array.ofDim[Boolean](102)

  @scala.annotation.tailrec
  def loop(low: Int, high: Int): Int =
    if (!flags(low)) low else if (!flags(high)) high else loop(low - 1, high + 1)

  val sc = new java.util.Scanner(System.in)
  val X, N = sc.nextInt()
  for (_ <- 1.to(N)) flags(sc.nextInt()) = true
  println(loop(X, X))
}


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

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

signed main(){
    int x;
    cin>>x;
    
    int p=x;
    while(!is_prime(p)) p++;
    
    cout<<p<<endl;
    
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int path[4] = {};
string S;
int IDX = 0;
int calc(int idx)
{
    IDX = idx;
    if (S[idx] - 'a' >= 0 && S[idx] - 'a' < 4)
    {
        return path[S[IDX] - 'a'];
    }
    if (S[idx] == '+')
    {
        return calc(++IDX) | calc(++IDX);
    }
    if (S[idx] == '*')
        return calc(++IDX) & calc(++IDX);
    if (S[idx] == '^')
        return calc(++IDX) ^ calc(++IDX);
    else
        return calc(++IDX);
}
int main()
{
    vector<int> ans1, ans2;
    while (1)
    {
        IDX = 0;
        cin >> S;
        if (S[0] == '.')
            break;
        string P;
        cin >> P;
        rep(i, 4) path[i] = P[i] - '0';
        int res = calc(IDX);
        ans1.push_back(res);
        int ans = 0;
        rep(i, 10000)
        {
            IDX = 0;
            string p = to_string(i);
            reverse(p.begin(), p.end());
            while (p.size() < 4)
                p.push_back('0');
            reverse(p.begin(), p.end());
            rep(j, 4) path[j] = p[j] - '0';

            if (calc(IDX) == res)
                ans++;
        }
        ans2.push_back(ans);
    }

    rep(i, ans1.size())
    {
        cout << ans1[i] << " " << ans2[i] << endl;
    }
    return 0;
}



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

int n,ans;
int a[100010];

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

Measured memory_bytes: 640
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local N, K = read.nn()
if N == 0 then
    print(1)
    return
end
local n = N
local ans = 0
while n > 0 do
    ans = ans + 1
    n = n // K
    --print(n)
end
print(ans)

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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	int n;
	cin>>n;
	set<string> s;
	forn(i, n){ string t; cin>>t; s.insert(t);}
	cout<<s.size()<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 19212
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
int cnt[105]={0};
int main(){
	int i,j,n,k,d,num;
	scanf("%d%d",&n,&k);
	for(i=0;i<k;i++){
		scanf("%d",&d);
		for(j=0;j<d;j++){
			scanf("%d",&num);
			cnt[num]++;
		}
	}
	int ans=0;
	for(i=1;i<=n;i++)
		if(!cnt[i])
			ans++;
	printf("%d\n",ans);
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y, int md = MOD){x += y; if(x >= md) x -= md;}
void sub_self(int &x, int y, int md = MOD){x -= y; if(x < 0) x += md;}
void mul_self(int &x, int y, int md = MOD){x = x * 1LL * y % md;}
inline int mul(int x, int y, int md = MOD){return x * 1LL * y % md;}
inline int add(int x, int y, int md = MOD){x += y; if(x >= md) x -= md; return x;}
inline int sub(int x, int y, int md = MOD){x -= y; if(x < 0) x += md; return x;}

const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};
	
void pre(){
}	

void solve(){

	int h, w, n;
	cin >> h >> w >> n;
	vector<array<int, 2>> vec(n);
	for(auto &[x, y] : vec){
		cin >> x >> y;
		--x, --y;
	}

	vector<vector<int>> row(h);
	vector<int> cnt(w);
	for(int i = 0; i < n; ++i){
		row[vec[i][0]].push_back(i);
		cnt[vec[i][1]]++;
	}

	set<int> lst;
	int mxCol = *max_element(all(cnt));
	for(int i = 0; i < w; ++i){
		if(cnt[i] == mxCol) lst.insert(i);
	}

	int res = 0;

	for(int i = 0; i < h; ++i){
		int sz = row[i].size();
		int cur = sz;
		if((int)lst.size() > (int)row[i].size()) cur += mxCol;
		else{
			int cc = 0;
			for(auto &cell_idx : row[i]){
				cc += lst.count(vec[cell_idx][1]) != 0;
			}
			cur += mxCol - (cc == (int)lst.size());
		}
		res = max(res, cur);
	}

	cout << res << '\n';
	
	return;
}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	// freopen("input.in", "r", stdin);
	// freopen("output.out", "w", stdout);

	int t;
	t = 1;
	// cin >> t;
	// pre();
	for(int i = 1; i <= t; ++i){
		// cout << "Case #" << i << ": ";
		solve();
		// cout << '\n';
		// cout << endl;
	}

	return 0;
}


Measured memory_bytes: 37188
from collections import defaultdict


def solve(s, l):
    for now in range(1, len(s) + 1):
        now %= len(s)
        pre = now - 1
        nex = (now + 1) % len(s)

        # 整合性のチェック
        if l[pre] is not None and l[nex] is not None:
            if l[now] == 1:
                if s[now] == "o":
                    if l[nex] != l[pre]:
                        return False
                else:
                    if l[nex] == l[pre]:
                        return False
            else:
                if s[now] == "o":
                    if l[nex] == l[pre]:
                        return False
                else:
                    if l[nex] != l[pre]:
                        return False

        # nextを決める
        if l[pre] is not None and l[nex] is None:
            # ひつじ
            if l[now] == 1:
                # 両隣が同じはず
                if s[now] == "o":
                    l[nex] = l[pre]

                # 両隣が違うはず
                else:
                    l[nex] = -1 * l[pre]
            # おおかみ
            else:
                # 両隣が違うはず
                if s[now] == "o":
                    l[nex] = -1 * l[pre]
                # 両隣が同じはず
                else:
                    l[nex] = l[pre]

    return True


def main():
    N = int(input())
    S = input()

    for a, b in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
        ans = [None] * N
        ans[0], ans[1] = a, b

        if solve(S, ans):
            print(*["S" if x == 1 else "W" for x in ans], sep="")
            return

    print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7872