akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
string S;
vector<int> alp(26, 0);
int main() {
    cin >> S;
    int slen = S.length();
    for(int i = 0; i < slen; ++i) {
        alp.at(S.at(i)-97)++;
    }

    for(int i = 0; i < 26; ++i) {
        if(alp.at(i) >= 2) {
            cout << "no" << endl;
            return 0;
        }
    }

    cout << "yes" << endl;
}

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

void Main()
{
    int64_t A, B, C, K;
    cin >> A >> B >> C >> K;

    int64_t result = 0;
    if(A >= K)
    {
        result = K;
        cout << result << endl;
        return;
    }
    else
    {
        result += A;
        K -= A;
    }
    if(B >= K)
    {
        cout << result << endl;
        return;
    }
    else
    {
        K -= B;
    }
    if(C >= K)
    {
        result -= K;
        cout << result <<endl;
        return;
    }
    else
    {
        result -= C;
        K -= C;
    }
    
    cout << result << endl;
}

int main()
{
    Main();
}


Measured memory_bytes: 3624
#include <iostream>
//#include <algorithm>
//#include <string>
//#include <functional>
using namespace std;
int main() {
  
    string x;
    cin>>x;
    char part1[20];
    char part2[20];
 
    x.copy(part1,4,0);
    x.copy(part2,8,4);
    
    cout<<part1<<" "<<part2<< endl;;
   
    return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    vint A(a);
    rep(i,a){
        int c;
        cin >> A.at(i);
    }
    sort(A.begin(),A.end());
    int64_t sum = 0;
    if(b<A.size()){
        rep(i,A.size() -b)
            sum += A.at(i);
        cout << sum << endl;
    }
    else
        cout << 0 << endl;
    
}
    

Measured memory_bytes: 1024
#include<stdio.h>

int main(void)
{
	int a, b, c;

	scanf("%d %d %d",&a,&b,&c);

	if (a < b && b < c)
	{
		printf("Yes\n");
	}

	else
	{
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define max_n 1000000

using namespace std;

void solve()
{
	ll n;
	cin>>n;
	ll ans=0;
	if(n%2==0)
	{
		ll c=0;
		ll x=1;
		while(n>0 && n%2==0)
		{
			n/=2;
			c++;
			if(c==x)
			{
				c-=x;
				x++;
				ans++;
				
			}
		}
		
	}
	for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        if(n%i==0)
        {		
        	ll c=0;
        	ll x=1;
        	while (n % i == 0)  
            {  
                n = n/i; 
                c++;
				if(c==x)
				{
					c-=x;
					x++;
					ans++;
					
				}
            }  
           
         }
    }  
    if (n > 2)  
       ans++;
   cout<<ans<<endl;
}

int32_t main() 
{
	IOS	
	ll T=1;
	// cin>>T;
	for(ll i=1;i<=T;++i)
	{		
		// cout<<"Case #"<<i<<": ";
    	solve();
	}
	return 0;
}

Measured memory_bytes: 3696
"""
S = chokudai
T = redcoder

'redcoder' には 'e' が２つあるので一度に変える必要があるが、
Sではそれに相当する場所には 'h' と 'a' の2種類の文字があるので不可能。
こういう感じで一文字ずつ見ていけばよさそう。

10 ** 5なのでstring.count()とか使っちゃうとTLEしそう。

文字の出現回数を格納するリストを作っていって、それぞれ比較すればよさそう。
上の例だと、
    s_li = [1, 1, 1, 1, 1, 1, 1, 1]
    t_li = [2, 2, 2, 1, 1, 2, 2, 2]
になり、s_liとt_liの中身が異なるのでNG。
"""
from collections import defaultdict

S = input()
T = input()
s_li = [0] * len(S)   # 文字列Sに登場する文字の出現回数を順番に格納する
t_li = [0] * len(T)   # 文字列Tに登場する文字の出現回数を順番に格納する

# s_liを作っていく
s_cnt_dict = defaultdict(int)   # 文字ごとに出現回数をメモしていく
s_idx_dict = defaultdict(list)  # 同じ文字が出現するインデックスをメモしていく
for i in range(len(S)):
    k = S[i]
    s_cnt_dict[k] += 1
    s_idx_dict[k].append(i)
for k in s_cnt_dict:
    for idx in s_idx_dict[k]:
        s_li[idx] = s_cnt_dict[k]

# t_liを作っていく
t_cnt_dict = defaultdict(int)   # 文字ごとに出現回数をメモしていく
t_idx_dict = defaultdict(list)  # 同じ文字が出現するインデックスをメモしていく
for i in range(len(T)):
    k = T[i]
    t_cnt_dict[k] += 1
    t_idx_dict[k].append(i)
for k in t_cnt_dict:
    for idx in t_idx_dict[k]:
        t_li[idx] = t_cnt_dict[k]

print('Yes') if s_li == t_li else print('No')


Measured memory_bytes: 91648
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, m, i, j, k, a, b, best = 1LL<<60, xx;
	cin >> n >> k;
	vector<long long> x(n);
	for (i = 0; i < n; i++) cin >> x[i];
	sort(x.begin(), x.end());
	for (i = 0; i + k <= n; i++) {
		a = x[i]; b = x[i + k - 1];
		if (k == 1) xx = abs(a);
		else if (b <= 0) xx = -a;
		else if (a >= 0) xx = b;
		else xx = min(-a + (b - a), b + b - a);
		best = min(best, xx);
	}
	cout << best << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(5*1e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int from, to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
map<int, int>factor(int x) {
	map<int, int>res;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1)res[x]++;
	return res;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	rep(i, 40) {
		int n = (int)(1) << (i + 1);
		int memo = 0;
		memo += b / n * (n / 2);
		memo += max((int)(0), b%n - n / 2 + 1);
		memo -= (a - 1) / n * (n / 2);
		memo -= max((int)(0), (a - 1) % n - n / 2 + 1);
		if (memo % 2)ans += n / 2;
	}
	cout << ans << endl;
	endre;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;
#define INF 1e18LL

const ll MAX = 1000000000000000000; //1e18

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char>>  a(h+2, vector<char>(w+2));
    rep(i, h+2){
        rep(j, w+2){
            a[i][j] = '#';
        }
    }

    rep(i, h+2){
        if(i == 0 || i == h+1){
            continue;
        }
        rep(j, w+2){
            if(j == 0 || j == w+1) continue;
            else{
                cin >> a[i][j];
            }
        }
    }
    rep(i, h+2){
        rep(j, w+2){
            cout << a[i][j];
        }
        cout << endl;
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN   1000001 
  
// stores smallest prime factor for every number 
int spf[MAXN]; 
  
// Calculating SPF (Smallest Prime Factor) for every 
// number till MAXN. 
// Time Complexity : O(nloglogn) 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
vector<int> getFactorization(int x) 
{ 
    vector<int> ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 
 int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    
    
    int n;
    cin>>n;

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

    sieve();
    int cp=1;
    unordered_map<int,int>m;
    for(int i=0;i<n;i++)
    {
        vector<int>t;
        t=getFactorization(a[i]);
        unordered_map<int,int>mm;
        for(int j=0;j<t.size();j++)
        {
            if(mm[t[j]]==1)
                continue;
            if(m[t[j]]==1)
            {
                cp=0;
                break;
            }
            m[t[j]]=1;
            mm[t[j]]=1;
            //cout<<t[j]<<" ";
        }
        //cout<<endl;
        if(cp==0)
            break;
    }
    if(cp==1)
    {
        cout<<"pairwise coprime"<<endl;
    }
    else
    {   
        int sp=1;
        int gg=a[0];
        for(int i=1;i<n;i++)
        {

            gg=__gcd(gg,a[i]);
           
        }
        if(gg==1)
        {
            cout<<"setwise coprime"<<endl;
        }
        else
        {
            cout<<"not coprime"<<endl;
        }
    }

}

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

int main(){
	int n,a,Min,Max; cin>>n>>a;
	Min=Max=a;
	for(int i=1;i<n;i++)
		cin>>a,Min=min(Min,a),Max=max(Max,a);
	cout<<Max-Min<<endl;
	return 0;
}

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

#define BUILDINGS 4
#define FLOOR 3
#define ROOMS 10

int main()
{
        int data[BUILDINGS+1][FLOOR+1][ROOMS+1];
        int numInput;
        int b, f, r, v;

        for(int i=0; i<BUILDINGS+1; i++){
                for(int j=0; j<FLOOR+1; j++){
                        for(int k=0; k<ROOMS+1; k++){
                                data[i][j][k] = 0;
                        }
                }
        }

        cin >> numInput;

        for(int i=0; i<numInput; i++){
                cin >> b >> f >> r >> v;
                data[b][f][r] += v;
        }


        for(int i=1; i<BUILDINGS+1; i++){
                for(int j=1; j<FLOOR+1; j++){
                        for(int k=1; k<ROOMS+1; k++){
                                cout << " " << data[i][j][k];
                        }
                        cout << endl;
                }

                if(i!=BUILDINGS)cout << "####################\n";
        }

        return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=acos(-1.0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
vector<complex<double>> fft(vector<complex<double>> a,int bo){
    int n=a.size();
    int h=0;
    while((1<<h)<n)h++;
    rep(i,0,n){
        int j=0;
        rep(k,0,h)j|=((i>>k)&1)<<(h-1-k);
        if(i<j)swap(a[i],a[j]);
    }
    for(ll i=1;i<n;i*=2){
        rep(j,0,i){
            complex<double> w=polar(1.0,(-(2*pi)/(2*i))*j*bo);
            for(ll k=0;k<n;k+=i*2){
                complex<double> s=a[j+k];
                complex<double> t=a[j+k+i]*w;
                a[j+k]=s+t;
                a[j+k+i]=s-t;
            }
        }
    }
    if(bo==-1)rep(i,0,n)a[i]/=n;
    return a;
}
vector<complex<double>> fft(vector<double> a,int bo){
    vector<complex<double>> b(a.size());
    rep(i,0,a.size())b[i]=complex<double>(a[i],0);
    return fft(b,bo);
}
vector<double> convolve(vector<double> a,vector<double> b){
    int s=a.size()+b.size()-1;
    int t=1;
    while(t<s)t*=2;
    a.resize(t);
    b.resize(t);
    vector<complex<double>> A=fft(a,1);
    vector<complex<double>> B=fft(b,1);
    rep(i,0,t)A[i]*=B[i];
    A=fft(A,-1);
    rep(i,0,s)a[i]=A[i].real();
    return a;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,m;cin>>n>>m;
    vector<double> a(100001),b(100001);
    ll cn[100001];
    fill(cn,cn+100001,0);
    rep(i,0,n){
        int t;cin>>t;
        cn[t]++;
       
    }
    rep(i,0,100001){
        a[i]=(double)cn[i];
        b[i]=(double)cn[i];
    }
    vector<double> anss=convolve(a,b);
    ll ans[anss.size()];
    rep(i,0,anss.size())ans[i]=(ll)round(anss[i]);
    ll sum=0;
    ll cnt=0;
    //cout<<anss.size()<<endl;
    rrep(i,anss.size()-1,0){
        if(cnt+ans[i]>m){
            sum+=i*(m-cnt);
            break;
        }
        else{
            sum+=i*ans[i];
            cnt+=ans[i];
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 23128
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int  A ,B ,k;
  cin >> A >> B >> k;
  vector<int> devisors(100);
  int counter = 0;
  for(int i = 1; i <= max(A,B); i++){
    if(A % i == 0 && B % i == 0){
     devisors[counter] = i;
     counter++;
    }
  }
  cout << devisors[counter - k];
}


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

using namespace std;

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

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

    bool c = false, f = false;
    for (auto i : S) {
        if (i == 'C') c = true;
        if (c && i == 'F') f = true;
    }

    cout << (f ? "Yes" : "No") << endl;
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i,0,N) cin >> a[i];

    ll c = 1;
    REP(i,0,N) if(a[i] == c) ++c;
    if(c == 1) _PR(-1);
    else _PR(N-c+1);

    return 0;
}

/*



*/

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
    int a[100005];
    string str;
    cin>>str;
    int len=str.length();
    int cnt=0;
    for(int i=1;i<len;i++)
        if(str[i]!=str[i-1])
            a[++cnt]=max(i,len-i);
    int res=len;
    for(int i=1;i<=cnt;i++)
        res=min(res,a[i]);
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int i = 0;
  while(true){
    if(i % 2 == 0){
      c -= b;
    }else{
      a -= d;
    }

    if(a <= 0){
      cout << "No\n";
      break;
    }
    if(c <= 0){
      cout << "Yes\n";
      break;
    }
    i++;
  }
  return 0;
}



Measured memory_bytes: 3600
#include<stdio.h>

int main(void) {
	int x, y, z, sum;
	scanf("%d %d", &x, &y);
	sum = x + y + 2;
	z = x%y;
	while (z != 0) {
		x = y;
		y = z;
		z = x%y;
	}
	sum -= (y + 1);
	printf("%d\n",sum);

	return 0;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if (a >= 13)
        cout << b;
    else if (a >= 6 && a <= 12)
        cout << b / 2;
    else
        cout << 0;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.io.InputStreamReader;
import java.util.*;
public class Main
{

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        HashSet<Integer>set = new HashSet<>();
        for(int i = 1;i <= n;i++) {
            int a = Integer.parseInt(br.readLine());
            if(!set.contains(a))set.add(a);
            else set.remove(a);
        }
        System.out.println(set.size());

    }

}

Measured memory_bytes: 39124
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - Next Prime
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_P = 101000;

/* typedef */

/* global variables */

bool primes[MAX_P + 1];
int pnums[MAX_P];

/* subroutines */

int gen_primes(int maxp, int pnums[]) {
  memset(primes, true, sizeof(primes));
  primes[0] = primes[1] = false;

  int p, pn = 0;
  for (p = 2; p * p <= maxp; p++)
    if (primes[p]) {
      pnums[pn++] = p;
      for (int q = p * p; q <= maxp; q += p) primes[q] = false;
    }
  for (; p <= maxp; p++)
    if (primes[p]) pnums[pn++] = p;
  return pn;
}

/* main */

int main() {
  int pn = gen_primes(MAX_P, pnums);
  //printf("pn=%d\n", pn);

  int x;
  scanf("%d", &x);

  int *pt = lower_bound(pnums, pnums + pn, x);
  printf("%d\n", *pt);
  return 0;
}


Measured memory_bytes: 384
from decimal import *
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=STRM()
    a=Decimal(int(a))
    b=b[0]+b[2:4]
    b=Decimal(int(b))
    print(a*b//Decimal(100))
    
if __name__ == '__main__':
    do()

Measured memory_bytes: 10096
import java.util.Scanner;

/* Signboard */

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); // 看板の枚数
        String name = sc.next(); // 店名
        int cnt=0;
        for(int i=0;i<n;i++) {
            String str = sc.next();
            label: for(int j=0; j<str.length(); j++) { // 最初の文字がある位置を探索(jが最初の文字の位置)
                if(str.charAt(j)!=name.charAt(0)) continue;
                for(int k=j+1;k<str.length();k++) { // 2文字目がある位置を探索(kが2文字目の位置)
                	if(str.charAt(k)!=name.charAt(1)) continue;
                	int dist=k-j; // 文字間隔
                	// System.out.println("dist->"+dist);
                	int m=2; // nameの3文字目を探索
                    for(int l=k+dist;l<str.length();l+=dist) { // 文字列strをdistごとに探索
                    	// System.out.printf("j->%d k->%d l->%d m->%d\n",j,k,l,m);
                    	if(str.charAt(l)!=name.charAt(m)) break;
                    	else {
                    		if(m==name.length()-1) {
                    			cnt++;
                    			break label;
                    		}
                    		m++;
                    	}
                    }
                }
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 20560
a=input()
if a=='MON':
    print(6)
if a=='TUE':
    print(5)
if a=='WED':
    print(4)
if a=='THU':
    print(3)
if a=='FRI':
    print(2)
if a=='SAT':
    print(1)
if a=='SUN':
    print(7)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
  ll n, o = 0;
  cin >> n;
  vector<int> a(n + 1), b(n);
  for(int i = 0; i < n + 1; i++)
    cin >> a.at(i);
  for(int i = 0; i < n; i++)
    cin >> b.at(i);
  for(int i = n - 1; i >= 0; i--) {
    o += min(b.at(i), a.at(i) + a.at(i + 1));
    a.at(i) = min(a.at(i), max(0, a.at(i) + a.at(i + 1) - b.at(i)));
  }
  cout << o << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  GI3(A, B, C);
  GVI(l, N);
  int maxi = 1;
  int ans = 1e9;
  FOR(i, N) maxi *= 4;
  for (int i = 1; i < maxi; ++i) {
    int suma = 0, sumb = 0, sumc = 0, cost = -30;
    for (int n = 0; n < N; ++n) {
      int use = (i >> (n * 2)) & 3;
      if (use == 1) {
        suma += l[n];
        cost += 10;
      } else if (use == 2) {
        sumb += l[n];
        cost += 10;
      } else if (use == 3) {
        sumc += l[n];
        cost += 10;
      }
    }
    if (suma == 0 || sumb == 0 || sumc == 0)
      continue;
    cost += abs(A - suma) + abs(B - sumb) + abs(C - sumc);
    ans = min(ans, cost);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb push_back
const int N=1e5+5;
// const ll M = 998244353;
const ll M=1e9+7;
const ll inf=1e18;


int main()
{
	// ios;
	string s,t;
	cin>>s>>t;

	int n=s.size();
	int m=t.size();
	s='S'+s;
	t='T'+t;
	int dp[n+1][m+1];
	memset(dp,0,sizeof(dp));
	// cout<<"  ";
	// for(int i=1;i<=m;i++)
	// 	cout<<t[i]<<' ';
	// cout<<"\n";
	for(int i=1;i<=n;i++)
	{
		// cout<<s[i]<<' ';
		for(int j=1;j<=m;j++)
		{
			dp[i][j] = max(dp[i-1][j],dp[i][j-1]);

			if(s[i]==t[j])
				dp[i][j] = max(1+dp[i-1][j-1],dp[i][j]);			
		
			// printf("%d ",dp[i][j]);
		}
		// printf("\n");
	}
	string ans = "";
	int row = n;
	for(int col=m;col>0 and row>0;col--)
	{
		if(dp[row][col] == dp[row][col-1])
			continue;
		while(dp[row][col]==dp[row-1][col-1]+1 and s[row]!=t[col])
		{
			row--;			
		}
		ans+=t[col];
		row--;

	}
	reverse(ans.begin(),ans.end());
	cout<<ans;


}

Measured memory_bytes: 35456
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

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

    for(int i = 0; i < max(a,b); i++){
        cout << min(a,b);
    }

    cout << endl;
}

Measured memory_bytes: 256
#ifndef _WIN32
#include<iostream>
#endif

#include<string>
#include<cmath>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<utility>
#include<tuple>
using namespace std;

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ITR(x,v) for(auto &x:v)
typedef pair<int, int> P;

const int dx[] = { 0,1,1,0,-1,-1 };
const int dy[] = { 1,1,0,-1,-1,0 };
int main() {
	int t,n;
	while (cin >> t >> n,t) {
		map<P,int> z;
		REP(i, n) {
			int x, y;
			cin >> x >> y;
			z[P(x, y)] = -114514;
		}
		queue<P> que;
		int a, b;
		cin >> a >> b;
		que.push(P(a, b));
		z[P(a, b)] = 0;
		while (que.size()) {
			int x, y;
			tie(x, y) = que.front(); que.pop();
			if (z[P(x, y)] == t)continue;
			REP(i, 6) {
				int nx = x + dx[i];
				int ny = y + dy[i];
				if (z.count(P(nx, ny)))continue;
				que.push(P(nx, ny));
				z[P(nx, ny)] = z[P(x, y)] + 1;
			}


		}
		cout << z.size() - n << endl;
	}

	return 0;
}

Measured memory_bytes: 3284
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll n;cin>>n;
    ll x;cin>>x;
    ll y;cin>>y;
    x--;y--;
    vector<vector<ll>> graph(n);
    For(i,0,n-1){
        graph[i].push_back(i+1);
        graph[i+1].push_back(i);
    }
    graph[x].push_back(y);
    graph[y].push_back(x);
    vector<vector<ll>> dist(n,vector<ll> (n,10000));
    For(i,0,n){
        dist[i][i]=0;
        queue<ll> que;
        que.push(i);
        while(!que.empty()){
            ll t=que.front();
            que.pop();
            for(auto j:graph[t]){
                if(dist[i][j]>dist[i][t]+1){
                    dist[i][j]=dist[i][t]+1;
                    que.push(j);
                }
            }
        }
    }
    vector<ll> num(n+10,0);
    For(i,0,n-1){
        For(j,i+1,n){
            num[dist[i][j]]++;
            //cout<<i+1<<" "<<j+1<<" "<<dist[i][j]<<endl;
        }
    }
    For(i,1,n){
        cout<<num[i]<<endl;
    }
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 31744
#include <boost/algorithm/string/join.hpp>
#include <boost/format.hpp>
#include <sstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <map>

using namespace std;
using namespace boost;

typedef int64_t INT;
void Resolve(istream &is, ostream &os) {
    INT H, W;
//    is >> H >> W;
vector<int> list;
    for(int i =0;i < 5;i++)
    {
        int n;
        is>>n;
        list.push_back(n);
    }
    int k;
    is>>k;
    for(int a = 0;a < 5;a++)
    {
        for(int b = a+1;b < 5;b++)
        {
            if(abs(list[a]-list[b])>k)
            {
                os<<":(";
                return;
            }
        }
    }
    os<<"Yay!";
    return;
}

#if !TEST
int main() { cin.tie(0); ios::sync_with_stdio(false); Resolve(cin, cout); cout.flush(); return 0;}
#endif


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ret = false;
            var input = spr(RL()).Select(x=>c2i(x)).ToList();
            var inN = input[0];
            var inM = input[1];

            var sum = (int)getnsqr(inN) + (int)getnsqr(inM); 

            Console.WriteLine(sum);
            Console.ReadLine();
        }
        static int getnsqr(int n) { return (n>0)?(n * (n - 1)) / 2:0; }

        static string RL() { return Console.ReadLine().Trim(); }
        static IEnumerable<string> spr(string s) { return s.Split(' '); }
        static int c2i(string c) { return int.Parse(c); }
        static double c2d(string c) { return double.Parse(c); }
        static string bool2ret(bool b) { return b ? "Yes" : "No"; }
    }
}


Measured memory_bytes: 13268
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
a.sort()
b.sort()
if n & 1:
    print(b[n // 2] - a[n // 2] + 1)
else:
    print(b[n // 2] + b[n // 2 - 1] - a[n // 2] - a[n // 2 - 1] + 1)


Measured memory_bytes: 25496
S = input()


if 0 < int(S[:2]) <= 12 and  0 < int(S[2:]) <= 12:
    print("AMBIGUOUS")
elif (int(S[:2]) > 12 or int(S[:2]) == 0) and 0 < int(S[2:]) <= 12:
    print("YYMM")
elif 0 < int(S[:2]) <= 12 and (int(S[2:]) > 12 or int(S[2:]) == 0):
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 3064
//#include "bits/stdc++.h"

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

void std_dev(int n, vector<int> s) {
	double sum = 0, mean, std_d;
	for (auto x : s) {
		sum += x;
	}
	mean = sum / n;
	sum = 0;
	for (auto x : s) {
		sum += pow(mean - x, 2);
	}
	std_d = sqrt(sum / n);
	cout << fixed << setprecision(6);
	cout << std_d << endl;
}

int main() {
	while (1) {
		int n;
		cin >> n;
		if (n == 0) {
			break;
		}

		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			s[i] = tmp;
		}

		std_dev(n, s);
	}
	// std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}



Measured memory_bytes: 3200
n,m = map(int,input().split())
a = {int(input()) for _ in range(m)}
mod = 10**9 + 7

dp = [0]*(n+1)
dp[0] = 1
    
for i in range(1,n+1):
    if i in a:
        continue
    x = dp[i-1] 
    if i > 1:
        x += dp[i-2]
    dp[i] = x % mod
ans = dp[n]
print(ans)

Measured memory_bytes: 17196
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

vector<P> ans;

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

  int n; cin >> n;
  vector<ll> vec(n);
  unordered_map<ll, int> mp;

  rep(i, n) {
    cin >> vec.at(i);
    mp[vec.at(i)] = i+1;
  }

  vector<int> used(n);
  rep(i, n) {
    used.at(i) = 1;
  }
  vector<int> graph[n+1];

  sort(vec.rbegin(), vec.rend());
  rep(i, n) {
    ll a = vec.at(i);
    int s = mp[a];
    int d = n-(2*used.at(s-1));

    if (d > 0 && mp[a-d] > 0) {
      int t = mp[a-d];
      used.at(t-1) += used.at(s-1);
      ans.push_back(P(s,t));
      graph[s].push_back(t);
      graph[t].push_back(s);
    }
  }

  vector<int> distance(n);
  rep(i, n) {
    distance.at(i) = INT_MAX;
  }
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, 1));
  while (!que.empty()) {
    P pa = que.top(); que.pop();
    int pos = pa.second;
    int d = pa.first;
    distance.at(pos-1) = d;
    for(auto e : graph[pos]) {
      if (distance.at(e-1) == INT_MAX) {
        que.push(P(d+1, e));
        //debug(d+1);debugln(e);
      }
    }
  }

  ll sum = 0;
  rep(i, n) {
    if (distance.at(i) == INT_MAX) {
      cout << -1 << endl;
      return 0;
    }
    sum += distance.at(i);
  }
  if (mp[sum] != 1) {
    cout << -1 << endl;
    return 0;
  }

  for(auto e: ans) {
    cout << e.first << ' ' << e.second << '\n';
  }
}

Measured memory_bytes: 13344
#include<stdio.h>
#define N 8
#define FREE 1
#define NOT_FREE -1

void printBoard(void );
void putQueen(int );

int row[N],col[N];
int dpos[15],dneg[15];
int X[N][N];

int main(){
  int i,j,r,c,k;

  for(i=0 ; i<N ; i++){
    for(j=0 ; j<N ; j++) X[i][j] = 0;
  }

  scanf("%d",&k);
  for(i=0; i<k; i++){
    scanf("%d%d",&r,&c);
    X[r][c] = 1;
  }

  for(i=0 ; i<N ; i++){
    row[i] = FREE;
    col[i] = FREE;
  }
  for(i=0 ; i<15 ; i++){
    dpos[i] = FREE;
    dneg[i] = FREE;
  }

  putQueen(0);

  return 0;
}



void putQueen(int i){
  int j;
  if(i == N){
    printBoard();
    return;
  }
  for(j = 0; j < N; j++){
    if(NOT_FREE == col[j] || NOT_FREE == dpos[i+j] || NOT_FREE == dneg[i-j+N-1]) continue;
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    putQueen(i+1);
    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}


void printBoard(){
  int i,j;
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(X[i][j]){
    if(row[i] != j) return;
      }
    }
  }
  for(i=0 ; i<N ; i++){
    for(j=0 ; j<N ; j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

Measured memory_bytes: 572
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll N;
ll b[110];
vector<ll> ans, now;
bool used[110];
int main() {
	cin>>N;
	REP(i,0,N) {
		cin>>b[i];
		now.push_back(b[i]);
	}
	RREP(i,0,N){
		if(now[i]==i+1){
			ans.push_back(i+1);
			now.erase(now.begin()+i);
			i=now.size();
			continue;
		}
		if(i==0){
			p(-1);
			return 0;
		}
	}
	reverse(ans.begin(), ans.end());
	REP(i,0,N){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int H,W;
    cin >> H >> W;
    vector<string> m(H);
    for(int i = 0; i < H; i++) cin >> m[i];
    int black = 0;
    for(string temp : m){
        for(int i = 0; i < W; i++){
            if(temp[i] == '.') black++; 
        }
    }
    int dist[H][W];
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            dist[i][j] = -1;
        }
    }
    dist[0][0] = 1;
    int dx[4] = {1,0,-1,0};
    int dy[4] = {0,1,0,-1};
    queue<pair<int,int>> que;
    que.push(make_pair(0,0));
    while(!que.empty()){
        pair<int,int> cur = que.front();
        que.pop();
        int x = cur.first;
        int y = cur.second;
        for(int dir = 0; dir < 4; ++dir){
            int nx = x + dx[dir];
            int ny = y + dy[dir];
            if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if(m[nx][ny] == '#') continue;
            if(dist[nx][ny] == -1){
                dist[nx][ny] = dist[x][y] + 1;
                que.push(make_pair(nx,ny));
            }
        }
    }
    if(dist[H-1][W-1] == -1) cout << -1 << endl;
    else cout << black - dist[H-1][W-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  vector<char> vec(str.size());
  for ( int i = 0 ; i < str.size() ; i++ ) {
    vec.at(i) = str.at(i);
  }
  
  int n = str.size();
  bool f = true;
  
  for ( int i = 0 ; i < (n-1)/2 ; i++ ) {
    if (vec.at(i) != vec.at(n-i-1) ){
      f = false;
      break;
    } 
  }
  
  if (f) {
    if ( ((n-1)/2) % 4 == 3 ) {
      int m = ((n-1)/2 -1)/2;
      for ( int i = 0 ; i < m ; i++ ) {
        if ( vec.at(i) != vec.at((n-1)/2-i-1) ) {
          f = false;
          break;
        }
      }
    }
    else {
      int m = (n-1)/4;
      for ( int i = 0 ; i < m ; i++ ) {
        if ( vec.at(i) != vec.at((n-1)/2-i-1) ) {
          f = false;
          break;
        }
      }
    }
  }
  
  if (f) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

const int MOD = 1e9+7;

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N),less(N,0),kleene(N,0);
    rep(i,N)cin >> A[i];
    rep(i,N){
        int a = A[i];
        for(int j=0;j<N;j++){
            if(A[j]<a)less[i]++;
            if(j>i&&A[j]<a)kleene[i]++;
        }
    }

    ll res = 0;
    if(K>1){
        rep(i,N){
        ll a = (K*kleene[i])%MOD;
        ll b = (less[i]*(((K*(K-1))/2)%MOD))%MOD;
        res += (a+b)%MOD;
        res%=MOD;
        }
    }else{
        rep(i,N){
            res += kleene[i];
            res%=MOD;
        }
    }
    
    cout << res << endl;
    return 0;
}

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

bool B[3][3];
int main(){ 
    int A[3][3];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            int a; cin >> a;
            A[i][j] = a;
        }
    }
    int n; cin >> n;
    for (int i = 0; i < n; i++)
    {
        int b; cin >> b;
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                if(A[j][k] == b)B[j][k] = true;
            }   
        }   
    }
    if (B[0][0] * B[1][1] * B[2][2])
    {
        cout << "Yes" << endl;
        return 0;
    }
    if (B[0][2] * B[1][1] * B[2][0]){
        cout << "Yes" << endl;
        return 0;
    }
    for (int i = 0; i < 3; i++)
    {
        if (B[i][0]*B[i][1]*B[i][2]){
            cout << "Yes" << endl;
            return 0;
        }
        if (B[0][i]*B[1][i]*B[2][i]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long ans;
bool fins(string s,string t){
	int i,j;
	for(i=0,j=0;i<s.size()&&j<t.size();i++)
		if(s[i]==t[j])
			j++;
	return (j==3);
}
string aco(int x){
	string s="";
	s+=char(x/100+'0');
	s+=char(x/10%10+'0');
	s+=char(x%10+'0');
	return s;
}
int main(){
	int n;
	string s;
	cin>>n>>s; 
	for(int i=0;i<1000;i++)
		ans+=fins(s,aco(i));
	cout<<ans;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
const ll INF = 1e17;
const int MOD = 1e9 + 7;

int x,a, b;

int main(void) {
	cin >>x>> a >> b;
	if (b - a > x)ct("dangerous");
	else if (b - a > 0)ct("safe");
	else ct("delicious");

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>

#define rep(i, n) for (int i = 0; i < n; i++) 
#define rrep(i, n) for(int i = n-1; i>=0; i--)
#define range(i, n, m) for (int i = n; i < m; i++) 
#define rrange(i, n, m) for (int i = n - 1; i => m; i--) 
#define MOD 1000000007;

typedef long long int ll;
typedef unsigned long long int ull;


using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

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

	ll N, M;
	cin >> N >> M;

	rrep(i, M/N + 1) {
		if (M%i == 0 && M / i >= N) {
			cout << dec << i;
			break;
		}

	}


	return 0;
}


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

template <typename T> class SegmentTree{
	public :
		int n;
		SegmentTree(int size,T o): out_of_range(o){
			for(n=1;n<size;n<<=1);
			data=vector<T>(2*n,out_of_range);
			lazy=vector<bool>(2*n,false);
		}

		void update(int a,int b,T x,int k,int l,int r){
			//cout << a << " " << b << " " << l << " " << r << endl;
			if(r<=a || b<=l) return;
			if(a<=l&&r<=b){data[k]+=x,lazy[k]=true;return;}
			if(lazy[k]) lazy_evaluate(k);
			update(a,b,x,k*2+1,l,(l+r)/2);
			update(a,b,x,k*2+2,(l+r)/2,r);
			data[k]=data[k*2+1]+data[k*2+2];
		}

		T query(int a,int b,int k,int l,int r){
			if(r<=a||b<=l) return out_of_range;
			if(a<=l&&r<=b){
				if(lazy[k]) return (r-l)*data[k];
				return data[k];
			}
			if(lazy[k]) return (r-l)*data[k];
			T vl = query(a,b,k*2+1,l,(l+r)/2);
			T vr = query(a,b,k*2+2,(l+r)/2,r);
			return vl+vr;
		}
		void show(){
			cout << "DATA" << endl;
			rep(i,2*n-1) cout << i << " " << data[i] << endl;
			cout << endl;
		}
	private:
		vector<T> data;
		vector<bool> lazy;
		const T out_of_range;

		inline void lazy_evaluate(int k){
			data[k*2+1]+=data[k];lazy[k*2+1]=true;
			data[k*2+2]+=data[k];lazy[k*2+2]=true;
			lazy[k]=false;
		}
};

int main(void){
	int N,Q;
	cin >>  N >> Q;
	SegmentTree<int> rsq(N,0);

	for(int i=0;i<Q;i++){
		int type;
		cin >> type;
		if(type){
			int s,t;
			cin >> s >> t;
			s--,t--;
			cout << rsq.query(s,t+1,0,0,rsq.n) << endl;
		}else{
			int a,x;
			cin >> a >> x;
			a--;
			rsq.update(a,a+1,x,0,0,rsq.n);
		}
	}
	return 0;
}

Measured memory_bytes: 2256
#include <bits/stdc++.h>
using namespace std;
#define EPS 0.0001

typedef struct {
  double x;
  double y;
  double z;
  double r;
} Cell;

bool eq(double a, double b){
  return abs(a-b) < EPS;
}

double cellLength( Cell a, Cell b){
  double l = sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2) + pow(a.z - b.z, 2)) - (a.r + b.r);
  if(l <= 0) return 0;
  else return l;
}

int main(void){
  int n;
  double btw[101][101];
  Cell cell[101];
  while(cin >> n, n){
    for(int i=0; i < n; i++){
      double x, y, z, r;
      cin >> x >> y >> z >> r;
      Cell tmp = {x, y, z, r};
      cell[i] = tmp;
    }

    for(int p=0; p < n; p++){
      for(int q=0; q < n; q++){
        btw[p][q] = cellLength(cell[p], cell[q]);
      }
    }

    //prim
    double mincost[101];
    bool used[101];
    for(int i=0; i < n; i++){
      mincost[i] = INT_MAX-1;
      used[i] = false;
    }
    mincost[0] = 0;
    double res = 0;

    while(true){
      int v = -1;
      for(int u=0; u < n; u++){
        if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
      }

      if(v == -1) break;
      used[v] = true;
      res += mincost[v];

      for(int u=0; u < n; u++){
        mincost[u] = min(mincost[u], btw[v][u]);
      }
    }
    printf("%.3f\n", res);
  }
  return 0;
}

Measured memory_bytes: 1328
#include<iostream>
#include<string.h>
using namespace std;
int main() {
	char s[1010];
	cin >> s;
	int len = strlen(s);
	if (s[len - 1] == 's') {
		s[len] = 'e';
		s[len + 1] = 's';
		s[len + 2] = '\0';
	}
	else {
		s[len] = 's';
		s[len + 1] = '\0';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3648
# coding: utf-8
# Your code here!
r,D,x2000 =  map(int,input().split())

l = [0] * 11
l[0] = x2000
for i in range(1,11):
    l[i] = r * (l[i - 1]) - D
    
for i in range(1, 11):
    print(l[i])


Measured memory_bytes: 38256
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = LLONG_MAX, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

Pa arr[50];
ll xarray[50];
ll yarray[50];
int main() {
	cin >> N >> K;
	rep(i, N) {
		cin >> A >> B;
		arr[i] = Pa(A, B);
		xarray[i] = A;
		yarray[i] = B;
	}
	sort(xarray, xarray + N);
	sort(yarray, yarray + N);

	ll ans = MAX;
	for (int x1 = 0; x1 < N - 1; x1++) {
		for (int x2 = x1 + 1; x2 < N; x2++) {
			for (int y1 = 0; y1 < N - 1; y1++) {
				for (int y2 = y1 + 1; y2 < N; y2++) {
					int cnt = 0;
					rep(i, N) {
						if (xarray[x1] <= arr[i].first && arr[i].first <= xarray[x2] &&
							yarray[y1] <= arr[i].second && arr[i].second <= yarray[y2])cnt++;
						if (cnt == K) break;
					}
					if (cnt == K) {
						ans = min(ans, (xarray[x2] - xarray[x1]) * (yarray[y2] - yarray[y1]));
					}
				}
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N, A, B; cin>>N>>A>>B;
  int ans = min(A*N, B);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256