akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;++i)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);
  int N;cin >> N;
  priority_queue<ll,vector<ll>,greater<ll> > pos_que;
  priority_queue<ll> neg_que;
  REP(i,N){
    ll x;cin >> x;
    if(x>=0) pos_que.push(x);
    else neg_que.push(x);
  }
  queue<PLL> ans;
  if(pos_que.empty()){
    ll x = neg_que.top();neg_que.pop();
    while(!neg_que.empty()){
      ll y = neg_que.top();neg_que.pop();
      ans.push(PLL(x,y));
      x-=y;
    }
    cout << x << endl;
    while(!ans.empty()){
      PLL x = ans.front();ans.pop();
      cout << x.first << " " << x.second << endl;
    }
  }else if(neg_que.empty()){
    ll x = pos_que.top();pos_que.pop();
    while(pos_que.size()>1){
      ll y = pos_que.top();pos_que.pop();
      ans.push(PLL(x,y));
      x-=y;
    }
    ll y = pos_que.top();pos_que.pop();
    ans.push(PLL(y,x));
    y-=x;
    cout << y << endl;
    while(!ans.empty()){
      PLL x = ans.front();ans.pop();
      cout << x.first << " " << x.second << endl;
    }
  }else{
    ll n_top = neg_que.top();neg_que.pop();
    while(pos_que.size()>1){
      ll p_top = pos_que.top();pos_que.pop();
      ans.push(PLL(n_top,p_top));
      n_top -= p_top;
    }
    ll p_top = pos_que.top();pos_que.pop();
    ans.push(PLL(p_top,n_top));
    p_top -= n_top;
    while(!neg_que.empty()){
      ll n_top = neg_que.top();neg_que.pop();
      ans.push(PLL(p_top,n_top));
      p_top -= n_top;
    }
    cout << p_top << endl;
    while(!ans.empty()){
      PLL x = ans.front();ans.pop();
      cout << x.first << " " << x.second << endl;
    }
  }
 //while(!pos_que.empty()){
 //  cout << pos_que.top() << endl;
 //  pos_que.pop();
 //}
 //while(!neg_que.empty()){
 //  cout << neg_que.top() << endl;
 //  neg_que.pop();
 //}
  return 0;
}


Measured memory_bytes: 4340
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

LL N,M,a,b,c,d;
string s;
map<char,int> mp;
int main(){
    cin>>s;
    for(auto c:s){
        mp[c]++;
    }
    for(char i='a';i<='z';i++){
        if(mp[i]==0){
            cout<<i;
            return 0;
        }
    }
    cout<<"None";
    return 0;
}


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

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

/*

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct edge {
	ll to;
	ll cost;
};

*/

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int A[3][3];
	rep(i, 3) {
		rep(j, 3) {
			cin >> A[i][j];
		}
	}

	int ap[3][3];
	rep(i, 3) rep(j, 3) ap[i][j] = 0;
	int n;
	cin >> n;
	rep(i, n) {
		int tmp;
		cin >> tmp;
		rep(i, 3)rep(j, 3) if (A[i][j] == tmp) ap[i][j] = 1;
	}

	bool ans = false;
	rep(i, 3) {
		int c = 0;
		rep(j, 3) {
			c += ap[i][j];
		}
		if (c == 3) ans = true;
	}
	rep(i, 3) {
		int c = 0;
		rep(j, 3) {
			c += ap[j][i];
		}
		if (c == 3) ans = true;
	}
	int c = 0;
	rep(i, 3) c += ap[i][i];
	if (c == 3)ans = true;

	c = 0;
	rep(i, 3) c += ap[2 - i][i];
	if (c == 3)ans = true;

	cout << (ans ? "Yes" : "No") << endl;


ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let mut cnt = 0;

    for i in a..b + 1 {
        let r: String = i.to_string().chars().rev().collect();
        if i.to_string() == r {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
#include<stdio.h>
#define SENTINEL 2000000000
#define MAX 500000


int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
    /*division of A[]*/
    int n1=mid-left;
    int n2=right-mid;
    for (int i=0;i<n1;i++) L[i]=A[left+i];
    for (int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    
    /*merge L,R*/
    int i=0,j=0;
    for (int k=left;k<right;k++){
        cnt++;
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }
}
void mergeSort(int A[],int n,int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}


int main(){
    int A[MAX],n,i;
    cnt=0;
    
    scanf("%d",&n);
    for (i=0;i<n;i++){
        scanf("%d",&A[i]);}
        
    mergeSort(A,n,0,n);
    
    for(i=0;i<n;i++){
        if(i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",cnt);
    
    return 0;
}



Measured memory_bytes: 5588
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < n; ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define ll long long

//
typedef pair<int, int> pii;
// typedef vector<int> vi;
// typedef vector<pii> vpi;
// typedef vector<vi> vvi;
// typedef long long i64;
// typedef vector<i64> vi64;
// typedef vector<vi64> vvi64;
// typedef pair<i64, i64> pi64;
// typedef double ld;
typedef  long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
// ui64 mx=1000*1000*1000+3;
// ui64 dp[mx];
int dp[100000];
bool vis[100000];
int dfs(int n,int dis,vector<int>g[])
{
	if(vis[n])
	return dp[n];
	vis[n]=true;
	for(auto i:g[n])
	{
		if(i==n)
		continue;


		dp[n]=max(dp[n],dfs(i,dis+1,g)+1);
	}
	return dp[n];
}
int main()
{
   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	ui64 n,m;
	cin>>n>>m;
vector<int>g[n+1];
	forn(i,m)
	{
		ui64 a,b;
		cin>>a>>b;
		g[a].push_back(b);
	}
for1(i,n)
{dp[i]=0;
	// memset(vis,false,sizeof(vis));
dfs(i,0,g);
}
int ans=0;
for1(i,n)
ans=max(ans,dp[i]);

	cout<<ans;
	return 0;
}


Measured memory_bytes: 8960
N = int(input())
lst_W = list(map(int, input().split()))
sum_W = sum(lst_W)

ans = float("INF")
for i in range(N):
    S1 = sum(lst_W[:i])
    S2 = sum_W - S1
    ans = min(ans, abs(S1 - S2))
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
int main(){
    int n,m,k;std::cin>>n>>m>>k;
    std::vector<int>p(n,-1);
    auto find=[&](auto&&find, int x)->int{
        return p.at(x)<0?x:p.at(x)=find(find,p.at(x));
    };
    auto unite=[&](int x, int y){
        x=find(find,x),y=find(find,y);
        if(x==y)return ;
        p.at(y)+=p.at(x);
        p.at(x)=y;
    };
    std::vector<int>a(n,-1);
    for(int i=0;i<m;i++){
        int u,v;std::cin>>u>>v;
        u--,v--;
        a.at(u)--,a.at(v)--;
        unite(u,v);
    }
    for(int i=0;i<n;i++){
        a.at(i)+=-p.at(find(find,i));
    }
    for(int i=0;i<k;i++){
        int u,v;std::cin>>u>>v;
        u--,v--;
        if(find(find,u)!=find(find,v))continue;
        a.at(u)--,a.at(v)--;
    }
    for(int i=0;i<n;i++){
        std::cout<<(i?" ":"")<<a.at(i);
    }
    std::cout<<std::endl;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e5+5;
void solve(){
	string s; 
	cin>>s; 
	int ans = 0;
	int rock = 0;
	for(char c:s){
		if(c=='g'){
			if(rock>0){
				ans++;
				rock--;
			}
			else{
				rock++;
			}
		}
		else{
			if(rock>0){
				rock--;
			}
			else{
				ans--;
				rock++;
			}
		}
	}
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3780
N, W = map(int,input().strip().split(" "))
Vmax = 10**5
dp = [10**9+1] * (Vmax+1)
dp[0] = 0
Vtotal = 0

for _ in range(N):
    w, v = map(int, input().strip().split(" "))
    Vtotal += v
    for i in range(Vtotal-v, -1, -1):
        dp[i+v] = min(dp[i+v], dp[i]+w)

for v in range(Vtotal, -1, -1):
    if dp[v] <= W:
        print(v)
        break


Measured memory_bytes: 41324
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>

#include<cmath>
#include<iostream>
#include<fstream>

#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<sstream>
#include<stack>

using namespace std;

int main()
{
    int W, H, x, y, r;
    while(scanf("%d%d%d%d%d", &W, &H, &x, &y, &r)!=EOF){
        if((x+r)>W || (x-r)<0 || (y+r)>H || (y-r)<0 || x<0 || y<0)
            printf("No\n");
        else
            printf("Yes\n");
    }
}



Measured memory_bytes: 3148
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include <math.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll) 1 << 62;
const ll MOD = 1000000007, INF = 1e18;

int main(void) {
    int n, hp;
    cin >> n >> hp;
    vi a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end(), greater<int>());
    sort(b.begin(), b.end(), greater<int>());

    int cnt = 0;
    int b_i = 0;
    while (hp > 0) {
        if (b_i < n && b[b_i] > a[0]) {
            hp -= b[b_i++];
            cnt++;
        } else {
            int temp = hp / a[0];
            if (temp == 0) {
                cnt++;
                break;
            }
            hp -= temp * a[0];
            cnt += temp;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1024
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    else:
        return gcd(y,x%y)
    
K=int(input())
num=0
for i in range(1,K-1):
    for j in range(i+1,K):
        for k in range(j+1,K+1):
            num+=6*gcd(i,gcd(j,k))
for i in range(1,K):
    for j in range(i+1,K+1):
        num+=6*gcd(i, j)
for i in range(1,K+1):
    num+=i
print(num)

Measured memory_bytes: 75856
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long LL;

LL cnt[100000];
int n, m, p[100000];

int main() {
	cin >> n >> m;
	REP(i, m) scanf("%d", &p[i]);

	FOR(i, 1, m) {
		int a = min(p[i - 1], p[i]) - 1, b = max(p[i - 1], p[i]) - 1;
		cnt[a]++; cnt[b]--;
	}
	FOR(i, 1, n) cnt[i] += cnt[i - 1];

	LL total = 0;
	REP(i, n - 1) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		LL ans = min(a*cnt[i], b*cnt[i] + c);
		total += ans;
	}

	cout << total << endl;
	return 0;
}

Measured memory_bytes: 2412
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

void use_io_optimizations()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main()
{
    use_io_optimizations();

    long long n;
    cin >> n;
    int res = to_string(n).size();
    for (long long i = 1; i * i <= n; ++i ) {
        if (n % i == 0) {
            long long j = n / i;
            res = min(res, (int)max(to_string(i).size(), to_string(j).size()));
        }
    }
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <vector>
using namespace std; 
const int Nmax = 10000;
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{   
    char a;
    cin>>a;
    if(a>='A'&&a<='Z') cout<<'A';
    else if(a>='a'&&a<='z') cout<<'a';
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using Int = long long;
int main()
{
    int A, B;
    cin >> A >> B;
    int a = A + B, b = A - B, c = A * B;
    cout << max(max(a, b), c) << endl;
    return 0;
}

Measured memory_bytes: 256
# import math
# from collections import Counter

# N = int(input()) # 1行, 単数
# arg = list(map(int, input().split())) # 1行, 配列
# D = Counter(arg) # 出現数カウント

# print('Yes')
# print('No')
# print()

arg = list(map(int, input().split())) # 1行, 配列
A = arg[0]
B = arg[1]

print(A*B)

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

#define ll long long

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll a, b;
	cin >> a >> b;
	ll ans = min(a%b, b-a%b);
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
long long gcd(long long x,long long y)
{
    return x%y==0?y:gcd(y,x%y);
}
int main()
{
    int n,i;
    long long s,sum=1,x;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&x);
        s=gcd(sum,x);
        sum=sum/s*x;
    }
    printf("%lld\n",sum);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

int main(void) {
    std::string s;
    std::cin >> s;
    if (s[0] == s[2]) {
        puts("Yes");
    }
    else {
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
N, M = map(int,input().split())
li = []
for _ in range(M):
  p, S = input().split()
  li.append([int(p), S])

ac = [0] * N
wa = [0] * N
c1 = 0
c2 = 0

for i in range(M):
  j = li[i][0] - 1
  if li[i][1] == "WA":
    wa[j] += 1
  if ac[j] == 0 and li[i][1] == "AC":
    ac[j] = 1
    c1 += 1
    c2 += wa[j]

print(c1, c2)


Measured memory_bytes: 28468
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			int count = 0;
			for (int i = 1; i <= n; i++) {
				for (int j = i+1; j <= n; j++) {
					for (int k = j+1; k <= n; k++) {
						if ((i + j + k == x) && (i < j) && (j < k)) {
							count++;
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}


Measured memory_bytes: 26704
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
    int n;
    cin >> n;
    set<char> S;
    rep(i, n) {
        char c;
        cin >> c;
        S.insert(c);
    }
    int m = S.size();
    if (m == 3) puts("Three");
    else puts("Four");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 1000010
int n,ans=1e9;
int b[MAXN],w[MAXN];
char a[MAXN];
inline int read(){
	int x=0,t=1,c;
	while(!isdigit(c=getchar())) if(c=='-') t=-1;
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*t;
}
int main(){
	n=read();
	scanf("%s",a+1);
	for(int i=1;i<=n;i++){
	    if(a[i]=='#') b[i]++;
        b[i]+=b[i-1];
	}
	for(int i=n;i>=1;i--){
		if(a[i]=='.') w[i]++;
		w[i]+=w[i+1];
	}
	for(int i=0;i<=n;i++)
	    ans=min(ans,b[i]+w[i+1]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

double dp[51][5001];//マス目、所持金
int main(void)
{
	int x, y, z;
	vector<int> xmass;
	map<int, P> evemass; 
	while(cin >> x >> y >> z && x && y)
	{
		memset(dp, 0, sizeof(dp));
		xmass.resize(x);
		for (int i = 0; i < x; i++)
		{
			cin >> xmass[i];
		}
		evemass.clear();
		for (int i = 0; i < z; i++)
		{
			int n, e, a;
			cin >> n >> e >> a;
			evemass[n] = P(e, e == 3 ? -a: a);
		}
		dp[0][0] = 1;
		for (int i = 0; i < y; i++)//マス目
		{
			for (int j = 0; j <= 5000; j++)//所持金
			{
				for (int k = 0; k < x; k++)//出たマスの種類
				{
					int ni = min(i + xmass[k], y), nj = j;
					if(evemass.count(ni))
					{
						if(evemass[ni].first == 1)
							ni = min(ni + evemass[ni].second, y);
						else nj = max(0, j + evemass[ni].second);
					}
					if(dp[i][j])
						dp[ni][nj] += dp[i][j] / x;
				}
			}
		}
		double ans = 0;
		for (int i = 0; i <= 5000; i++)
		{
			ans += dp[y][i] * i;
		}
		cout << (int)ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int n, k;
string s;
int solve();

int main() {
  cin >> n >> k;
  cin >> s;
  int score = solve();
  cout << score << endl;
}

int solve() {
  int score = 0;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] == s[i]) {
      score++;
    }
  }
  // 操作回数の制限がない場合の最大数
  int max_score = n - 1;
  // max_scoreに必要な操作回数
  int max_score_man = (n - score + 1) / 2;
  if (k >= max_score_man) {
    score = max_score;
  } else {
    score += k * 2;
  }
  return score;
}


Measured memory_bytes: 512
X = int(input())
a = [-1] * 2 * X
a[0] = 0
a[1] = 1
for i in range(2, X):
    if a[i] == -1:
        for j in range(i, 2*X, i):
            a[j] = i
for ans in range(X, 2*X):
    if a[ans] == -1:
        break
print(ans)


Measured memory_bytes: 67936
#include<iostream>
using namespace std;
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int sum=0;
  if(k>=a){
	sum += a;
    k=k-a;
  }
  else{
    sum = k;
    k=0;
  }
  if(k>=b){
    k=k-b;
  }
  else{
    k=0;
  }
  if(k){
    sum = sum - k;
    k=0;
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n, c, b, a, mal=0, need, sum=0;
        a=in.nextLong();
        b=in.nextLong();
        c=in.nextLong();
        if (a >= c) {
            sum = a - c;
            mal=b;
        } else if (a <= c) {
            sum = c - a;
            mal = b - sum;
            if (b <= sum) {
                mal = 0;
            }
            if (a <= c) {
                sum = 0;
            }
        }
        System.out.println(sum+" "+mal);
    }

}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
int main(){
    
    ll n,s=0;
    cin>>n;
    for(ll i=1;i<=n;i++){
        if(!(i%3==0 || i%5==0))
            s+=i;
    }
    cout<<s<<endl;
    return 0;
}

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

using namespace std;

void solve() {
    long long h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a;
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>
const int N = 2e5 + 10;

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    int a[2][n];
    for(int i = 0 ; i < 2; i++) {
        for(int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }
    int sum1[2][n], sum2[2][n];
    sum1[0][0] = a[0][0], sum1[1][0] = a[1][0];
    sum2[0][n - 1] = a[0][n - 1], sum2[1][n - 1] = a[1][n - 1];
    for(int i = 1; i < n; i++) {
        sum1[0][i] = a[0][i] + sum1[0][i - 1];
        sum1[1][i] = a[1][i] + sum1[1][i - 1];
    }
    for(int i = n - 2; i >= 0; i--) {
        sum2[0][i] = a[0][i] + sum2[0][i + 1];
        sum2[1][i] = a[1][i] + sum2[1][i + 1];
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
        ans = max(ans, sum1[0][i] + sum2[1][i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s[i])
	}

	cnt := 0
	for a := 0; a < n; a++ {
		t := make([][]byte, n)
		for i := 0; i < n; i++ {
			t[i] = make([]byte, n)
			for j := 0; j < n; j++ {
				t[i][j] = s[(i+a)%n][(j)%n]
			}
		}

		ok := true
		for i := 0; i < n; i++ {
			for j := i; j < n; j++ {
				if t[i][j] != t[j][i] {
					ok = false
					break
				}
			}
		}
		if ok {
			cnt++
		}
	}

	fmt.Println(cnt * n)
}


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

#define MAX 1000000

int parent(int i)
{
    return i / 2;
}

int  left(int i)
{
    return 2 * i;
}

int right(int i)
{
    return 2 * i + 1;
}

int main()
{
    int H, A[MAX+1];
    cin >> H;
    for (int i = 1; i <= H; ++i){
        cin >> A[i];
    }

    for (int i = 1; i <= H; ++i){
        cout << "node " << i << ": key = " << A[i] << ", ";
        if( parent(i) >=1 )
            cout << "parent key = " << A[parent(i)] << ", ";
        if( left(i) <= H )
            cout << "left key = " << A[left(i)] << ", ";
        if( right(i) <=H )
            cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }

    return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
  int N;
  cin>>N;
  double x[N];
  string S[N];
  double count=0; 
  rep(i,N){
    cin>>x[i]>>S[i];
      if(S[i][0]=='J')
	count+=x[i];
      else
	count+=x[i]*380000.0;

  }
  cout<<count<<endl;


  return 0;
}


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

#define sc second
#define fr first

#define ll long long
#define pi pair<int,int>
#define ppi pair<pi,pi>
#define mp make_pair
using namespace std;



ll arr[100100];
ll Dp[100010][2] , n;
ll solve(int i, int pre)
{
	if (i == n)return 0;
	ll &ret = Dp[i][pre];
	if (ret != -1e18)return ret;
	if (pre)
	{
		ret = max(ret, solve(i + 1, 0) - arr[i]);
		if (i < n - 1)
			ret = max(ret, solve(i + 1, 1) + arr[i]);
	}
	else
	{
		ret = max(ret, solve(i + 1, 0) + arr[i]);
		if (i < n - 1)
			ret = max(ret, solve(i + 1, 1) - arr[i]);
	}
	return ret;
}
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i], Dp[i][0] = -1e18, Dp[i][1] = -1e18;
	cout << solve(0, 0) << '\n';
	return 0;
}


Measured memory_bytes: 5760
import java.io.*;

class Main{

    public static void main(String[] args)throws IOException{

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String strInput = br.readLine();
	String[] input = strInput.split(" ");
	int a = Integer.parseInt(input[0]);
	int b = Integer.parseInt(input[1]);
	int c = Integer.parseInt(input[2]);
	int count = 0;
	
	for(int i = a; i < (b+1); i++){
	    if(c % i == 0){
		count++;
	    }
	}

	System.out.println(count);
	
    }

}

Measured memory_bytes: 17060
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    long long ans = 0;
    vector<int> l;
    cin >> n;
    l.assign(n, 0);
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int ok = j, ng = n;
            while(ok + 1 < ng){
                int mid = (ok + ng) / 2;
                if(l[mid] < l[i]+l[j])ok = mid;
                else ng = mid;
            }
            ans += ok-j;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static int[][] array = {
		{1 , 2 , 1 , 2 , 1 , 4 , 1 , 4 },
		{1 , 2 , 1 , 4 , 1 , 4 , 1 , 2 },
		{1 , 4 , 1 , 2 , 1 , 2 , 1 , 4 },
		{1 , 4 , 1 , 4 , 1 , 2 , 1 , 2 },
		{2 , 1 , 2 , 1 , 4 , 1 , 4 , 1 },
		{2 , 1 , 4 , 1 , 4 , 1 , 2 , 1 },
		{4 , 1 , 2 , 1 , 2 , 1 , 4 , 1 },
		{4 , 1 , 4 , 1 , 2 , 1 , 2 , 1 }
	};
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int[] input = new int[8];
			String[] str = sc.nextLine().split(" ");
			
			for(int i = 0; i < 8; i++){
				input[i] = Integer.parseInt(str[i]);
			}
			
			int[] edit = new int[8];
			int min = Integer.MAX_VALUE;
			int min_num = -1;
			for(int i = 0; i < 8; i++){
				for(int j = 0; j < 8; j++){
					edit[j] = input[j] - array[i][j];
					if(edit[j] < 0){
						edit[j] = 0;
					}
				}
				
				int sum = 0;
				for(int j = 0; j < 8; j++){
					sum += edit[j]; 
				}
				
				if(min > sum){
					min = sum;
					min_num = i;
				}
			}
			
			boolean first = true;
			for(int i = 0; i < 8; i++){
				System.out.print(first ? array[min_num][i] : " "+array[min_num][i]);
				if(first == true){
					first = false;
				}
			}
			System.out.println();
			
		}
		
	}
	
}

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

int main(){
    int x;
    cin >> x;
    vector<bool> expo(x+1);

    expo[1] = true;
    for(int b=2;b<=x;b++){
        int v = b*b;
        while(v <= x){
            expo[v] = true;
            v *= b;
        }
    }
    for(int i=x;i>=1;i--){
        if(expo[i]){
            cout << i << endl;
            exit(0);
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, d[105][2];
int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        scanf("%d%d", &d[i][0], &d[i][1]);
    }
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        if (d[i][0] == d[i][1]) ++cnt;
        else cnt = 0;
        if (cnt >= 3) {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
}


Measured memory_bytes: 3760
#include <stdio.h>

int main(void)
{
    int n, count = 0;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        (i + 1) % 2 == 1 && (a[i] % 2 == 1)?count++:count;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 2024
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    string s;
    cin >> s;

    vector<bool> ise(26, false);
    for (int i = 0; i < s.size(); i++) {
        ise[s[i] - 'a'] = true;
    }

    bool none = true;
    for (int i = 0; i < 26; i++) {
        if (!ise[i]) {
            cout << (char)(i + 'a') << endl;
            none = false;
            break;
        }
    }

    if (none) {
        cout << "None" << endl;
    }

    return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize("trapv")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>

using namespace std;

#define int long long
typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e5 + 100, INF = 1e9 + 10, MOD = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll curBst[2001];

signed main()
{
    fastInp;

    ll n, x;
    cin >> n >> x;
    vector<ll> vec(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> vec[i];
        curBst[i] = vec[i];
        ans += vec[i];
    }

    for (int i = 0; i < n; i++) {
        ll s = vec.front();
        vec.erase(vec.begin());
        vec.push_back(s);
        ll curS = 0;
        for (int j = 0; j < n; j++) {
            curBst[j] = min(curBst[j], vec[j]);
            curS += curBst[j];
        }
        ans = min(ans, curS + (i + 1) * x);
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

int main()
{
	int n, t;
	cin >> n >> t;

	int total = t;
	int tx, btx;
	for( int i = 0;i < n;++i )
	{
		cin >> tx;
		if( i > 0 )
		{
			int diff = tx - btx;
			total += ( diff > t )? t : diff;
		}
		btx = tx;
	}
	cout << total;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// C - Candies
int N;
int A[2][110];
int dp[5][110];
int ans = 0;

int main(){
    cin >> N;
    rep(i, 0, 2){
        rep(j, 0, N){
            cin >> A[i][j];
        }
    }

    dp[0][0] = A[0][0];


    rep(i, 0, 2){
        rep(j, 0, N){
            if(i==0){
                if(j==0){
                    dp[i][j] = A[i][j];
                }else{
                    dp[i][j] = dp[i][j - 1] + A[i][j];
                }
            }else{
                if(j==0){
                    dp[i][j] = dp[0][0] + A[i][j];
                }
                dp[i][j] = max(dp[i-1][j], dp[i][j - 1]) + A[i][j];
            }
        }
    }

    cout << dp[1][N-1] << endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sp  set< pair<ll,ll> >
#define vp vector< pair<ll,ll> >
#define spp set< pair<pair<ll,ll>,ll> >
#define maxe 100000000
#define MOD 1000000007
#define ll long long int
#define pb push_back
#define mp  make_pair
#define forn(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define for1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<int,int> PI;
typedef vector<PI> VPI;
typedef map<int,int> MPII;
typedef set<int> SETI;
#define ps fixed<<setprecision(y)<<x;
#define F first
#define S second
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,n) FOR(i,0,(int)n-1)
#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define FOREACH_FN(v, fn) for_each(ALL(v), myobject);

#define SORT(a) sort(a.begin(),a.end())
#define RSORT(a) sort(a.rbegin(),a.rend())
#define REV(a) reverse(a.begin(),a.end())
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MINIMUM(a)	*min_element(a.begin(), a.end())
#define MAXIMUM(a)	*max_element(a.begin(), a.end())

#define ld long double
#define bigint int64_t
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define hurry ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define forn(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define for1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
#define forr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
#define forab(i,a,b,c) for(ll (i) = a ; (i) <= (b) ; (i)+=(c))
const int N =1e+5;
int main()
{
hurry;
ll n,l,i;
vector<string> v;
string s;
cin>>n>>l;
for(i=0;i<n;i++)
{
  cin>>s;
  v.pb(s);
}
SORT(v);
for(i=0;i<v.size();i++)
cout<<v[i];
}


Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {
	static final int MAX = 1000005;
    static final int MOD = 1000000007;
    static long[]fact = new long[MAX];
    static long[]factInv = new long[MAX];
    static long[]inv = new long[MAX];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		factMOD();
        invMOD();
        factInvMOD();
        long ans = 0;
        for(int i = B; i < W; i++) {
        	ans += combMOD(H - A - 1 + i, i) * combMOD(W + A - i - 2, A - 1);
        	ans %= MOD;
        }
        System.out.println(ans);
	}
	static void factMOD() {
        fact[0] = 1;
        for(int i = 1; i < MAX; i++) {
            fact[i] = fact[i - 1] * i % MOD;
        }
    }
    static void invMOD() {
        inv[0] = 1;
        inv[1] = 1;
        for(int i = 2; i < MAX; i++) {
            inv[i] = MOD - inv[(int)(MOD % i)] * (MOD / i) % MOD;
        }
    }
    static void factInvMOD() {
        factInv[0] = 1;
        for(int i = 1; i < MAX; i++) {
            factInv[i] = factInv[i - 1] * inv[i] % MOD;
        }
    }
    static long combMOD(int n, int k) {
        if(n < k) return 0;
        if(n < 0 || k < 0) return 0;
        return fact[n] * ((factInv[k] * factInv[n - k]) % MOD) % MOD;
    }
}

Measured memory_bytes: 49876
#include <bits/stdc++.h>
using namespace std;
long long endtime(long long x,long long y){
	if(x%y)return x/y+1;
	else return x/y;
}
int main(){
	long long a,b,c,d,e,n,ea,eb,ec,ed,ee;
	cin>>n;
	cin>>a>>b>>c>>d>>e;
	ea=endtime(n,a);
	if(b>=a){
		eb=ea+1;
		b=a;
	}
	else eb=endtime(n,b)+1;
	if(c>=b){
		ec=eb+1;
		c=b;
	}
	else ec=endtime(n,c)+2;
	if(d>=c){
		ed=ec+1;
		d=c;
	}
	else ed=endtime(n,d)+3;
	if(e>=d){
		ee=ed+1;
		e=d;
	}
	else ee=endtime(n,e)+4;
	cout<<ee<<endl;
	return 0;
} 


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

using namespace std;

int main(){
	int a,b,c,x;
	int count = 0;
	cin >> a >> b >> c >> x;
	for(int i_0=0; i_0<=a; i_0++){
		for(int i_1=0; i_1<=b; i_1++){
			for(int i_2=0; i_2<=c; i_2++){
				int total = 500*i_0 + 100*i_1 + 50*i_2;
				if(total == x) count++;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let mut cnt = vec![vec![vec![0; 10]; 3]; 4];

    let n: usize = sc.next();
    for _ in 0..n {
        let b = sc.next::<usize>() - 1;
        let f = sc.next::<usize>() - 1;
        let r = sc.next::<usize>() - 1;
        let v: i32 = sc.next();
        cnt[b][f][r] += v;
    }

    for (v, b) in cnt.iter().zip(0..4) {
        for w in v {
            for x in w {
                print!(" {}", x);
            }
            println!();
        }

        if b < 3 {
            println!("{}", "#".repeat(20));
        }
    }
}

/* ========== Scanner ========== */

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

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    fn char(&mut self) -> char {
        self.chars()[0]
    }
}



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

int main() {
  int N,N1,N2,N3,N4;
  cin >> N;
  
  N1 = N/1000;
  N2 = (N-N1*1000)/100;
  N3 = (N-N1*1000-N2*100)/10;
  N4 = (N-N1*1000-N2*100-N3*10);

  if (((N1==N2)&&(N2==N3))||((N2==N3)&&(N3==N4)))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
import sys
input_lines = sys.stdin.readlines()
for input_ in input_lines:
    input_ = input_.split()
    a, op, b = int(input_[0]), input_[1], int(input_[2])
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a//b)
    else:
        break


Measured memory_bytes: 5600
import sys
n = int(input())
if n == 2:
	print(2)
	sys.exit()
for i in range(n,10**6):
	bol = True
	for j in range(2,i):
		if i%j == 0:
			bol = False
	if bol:
		print(i)
		sys.exit()

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

using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
const double EPS=1E-8;
////////////////////////////////////////

#define MAX_N (ll)1E6///変更！！！！！！！
vector<int>prime;
bool is_prime[MAX_N+1];
void precal(){
    rep(i,0,MAX_N)is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    rep(i,2,MAX_N){
        if(is_prime[i]){
            prime.pb(i);
            for(int j=2*i;j<=MAX_N;j+=i)is_prime[j]=false;
        }
    }
}
vector<i_i> fact(ll n){//ただし2<=n<=MAX_N^2
    ll m=n;
    vector<i_i>v;
    for(int p:prime){
        if(p*p>n)break;
        int c=0;
        while(m%p==0){
            m/=p;
            c++;
        }
        if(c)v.pb(i_i(p,c));
    }
    if(m!=1)v.pb(i_i(m,1));
    return v;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    
    precal();
    int i;cin>>i;
        cout<<i<<":";
        vector<i_i>v=fact(i);
        for(i_i x:v){
            while(x.second--)cout<<" "<<x.first;
        }cout<<endl;
    
    
    return 0;
}
//ios::sync_with_stdio(false);cin.tie(0);
/*
 
 */



Measured memory_bytes: 4404
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	int n,h;
	cin>>n>>h;
	priority_queue<int> a,b;
	int c,d,ans=0;
	for(int i=0;i<n;i++){
		cin>>c>>d;
		a.push(c);
		b.push(d);
	}
	c=a.top();
	while(h>0&&!b.empty()&&b.top()>c){
		h-=b.top();
		ans++;
		b.pop();
	}
	if(h>0){
		ans+=h/c;
	}
	if(h%c!=0&&h>0)ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1276
while 1:
    n = int(input())
    if n == 0:
        break
    a = list(map(int,input().split()))
    Min = 9999999999
    a.sort()
    for i in range(n-1):
        Min = min(Min,abs(a[i] - a[i+1]))
    print(Min) 


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

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

  set<char> st;
  rep(i, S.size()) st.insert(S[i]);

  for (int i = 0; i < 26; i++) {
    if (!st.erase((char)('a' + i))) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 3704
s = input()

a = []
for i in range(0,len(s)):
  c = 0 
  for j in range(0,len(s)):
    if(s[i] == s[j]):
      c += 1
  a.append(c)
#print(a)
if(a[0] == 2 and a[1] == 2 and a[2] == 2 and a[3] == 2):
  print("Yes")
else:
  print("No")

      
      
    
    

Measured memory_bytes: 38416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

struct segtree{
    vector<int> vec;
    
    segtree(int N) : vec(N){
        rep(i,N){
            vec[i] = 0;
        }
    }
    
    void make(int k, int a, int N){ //0_indexed
        k += (N / 2);
        vec[k] = a;
    }
    
    void max_update(int k, int a, int N){ //0_indexed
        k += (N / 2);
        vec[k] = a;
        while(k > 1){
            k = k / 2;
            vec[k] = max(vec[k * 2], vec[k * 2 + 1]);
        }
    }
    
    void min_update(int k, int a, int N){ //0_indexed
        k += (N / 2);
        vec[k] = a;
        while(k > 1){
            k = k / 2;
            vec[k] = min(vec[k * 2], vec[k * 2 + 1]);
        }
    }
    
    int min_query(int a, int b, int k, int l, int r){ // min_query(a,b,1,0,N / 2) a,b,l,r=0_indexed
        if (r <= a || b <= l) return 1000000000;
        if (a <= l && r <= b) return vec[k];
        int vl = min_query(a, b, k * 2, l, (l + r) / 2);
        int vr = min_query(a, b, k * 2 + 1, (l + r) / 2, r);
        return min(vl,vr);
    }
    
    int check(int i){
        return vec[i];
    }
    
    int max_query(int a, int b, int k, int l, int r){ // max_query(a,b,1,0,N / 2) a,b,l,r=0_indexed
        if (r <= a || b <= l) return -1000000000;
        if (a <= l && r <= b) return vec[k];
        int vl = max_query(a, b, k * 2, l, (l + r) / 2);
        int vr = max_query(a, b, k * 2 + 1, (l + r) / 2, r);
        return max(vl,vr);
    }
    
};

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<segtree> vec(0, segtree(1048576));
    rep(i,26){
        segtree seg(1048576);
        vec.push_back(seg);
    }
    rep(i,N){
        int x = S[i] - 'a';
        vec[x].make(i,1,1048576);
    }
    rep(i,26){
        for (int j = 0; j < 524288; j++){
            int x = vec[i].check(j + 524288);
            vec[i].max_update(j, x, 1048576);
        }
    }
    int Q;
    cin >> Q;
    rep(i,Q){
        int x;
        cin >> x;
        if (x == 1){
            int j;
            cin >> j;
            j--;
            char c;
            cin >> c;
            int y = c - 'a';
            for (int k = 0; k < 26; k++){
                if (vec[k].check(j + 524288) == 1){
                    vec[k].max_update(j, 0, 1048576);
                }
            }
            vec[y].max_update(j,1,1048576);
        }
        if (x == 2){
            int l,r;
            cin >> l >> r;
            l--;
            int ans = 0;
            for (int k = 0; k < 26; k++){
                int y = vec[k].max_query(l,r,1,0,524288);
                if (y == 1) ans++;
            }
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 114336
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total = 500*i + 100*j + 50*k
            if total == x:
                cnt += 1 
print(cnt)

Measured memory_bytes: 9124
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    int N; readf("%d\n", &N);
    long a = 1, t = 1;
    foreach (i; 0 .. N) {
        long b, u; readf("%s %s\n", &b, &u);
        long k = 1;
        if (a > b) {
            k = max(k, (a + b - 1) / b);
        }
        if (t > u) {
            k = max(k, (t + u - 1) / u);
        }
        a = b * k;
        t = u * k;
    }
    writeln(a + t);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

ll gcd(ll x, ll y)
{
    while (y > 0)
    {
        ll tmp = y;
        y = x % y;
        x = tmp;
    }
    return x;
}

ll lcm(ll x, ll y)
{
    return x / gcd(x, y) * y;
}

int main(int argc, char const *argv[])
{
    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000;
const int MOD = (int)1e9 + 7;

signed main()
{
    int n, x;
    cin >> n >> x;
    vector<int> v;
    v.push_back(0);
    for (int i = 0; i < n; i++)
    {
        int l;
        cin >> l;
        v.push_back(v[i] + l);
    }
    int cnt = 0;
    for (auto &&i : v)
    {
        if (i > x) break;
        cnt++;
    }
    cout << cnt << "\n";
}

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int a, b;
    cin>>a>>b;
    if(a>=6 && a<=12){
        cout<<b/2<<endl;
    }
    else if(a<=5){
        cout<<"0"<<endl;
    }
    else{
        cout<<b<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<cmath>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<stdio.h>
#include<queue>
using namespace std;
int main()
{
  int n,m;
  string s[120],t[120];
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>s[i];
  cin>>m;
  for(int i=0;i<m;i++)
    cin>>t[i];
  int ans=-1;
  for(int i=0;i<n;i++)
  {
    int a=0;
    for(int j=0;j<n;j++)
      if(s[i]==s[j])
        a++;
    for(int j=0;j<m;j++)
      if(s[i]==t[j])
        a--;
    ans=max(a,ans);
  }
  ans=max(0,ans);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256