akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#define PI 3.14159265358979323846264338327950288
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
typedef long long ll;
using namespace std;
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //



int main(void) {

	int A, B;
	cin >> A >> B;
	cout << A * B << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;
const int maxn = 608;

int a[maxn], b[maxn], c[maxn], n, k;
ll p[maxn], f[maxn][maxn];

bool in(int a, int l, int r) {
	return l <= a && a < r;
}

bool chk(int l, int r) {
	for (int i = 0; i < k; i++) {
		if (in(a[i], l, r) && !in(b[i], l, r)) return true;
		if (!in(a[i], l, r) && in(b[i], l, r)) return true;
	}
	return false;
}

int main() {
	//freopen("1.txt","r",stdin) ;
	scanf("%d%d",&n,&k);

	p[0] = 1;
	for (int i = 0; i < n-k; i++) {
 		p[i+1] = p[i] * (i<<1|1) %MOD; 
	}

	
	n <<= 1;
	for (int i = 0; i < k; i++) {
		scanf("%d%d",a+i,b+i);
		c[a[i]--] = c[b[i]--] = 1;
	}
	for (int i = 1; i <= n; i++) {
		c[i] = (!c[i]) + c[i-1];
	}

	
	ll ans = 0;
	for (int l = 0; l < n; l++)
		for (int r = l+1; r <=n;r++) {
			int x = c[r] - c[l];
			if ((x%2!=0) || chk(l, r)) continue;
			ll s = p[x>>1];
			for (int i = l+1; i<r;i++)
				s = (s - f[l][i] * p[(c[r]-c[i])>>1]) %MOD;
			f[l][r] = s;
			ans = (ans + s * p[((n-x-2*k)>>1)]) %MOD;
		}
	if (ans < 0) ans += MOD;
	printf("%lld\n",ans);
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N, H;
    ll count = 0;
    vector<ll> A, B;
    cin >> N >> H;
    A.resize(N);
    B.resize(N);
    for(ll i = 0;i < N;i++) cin >> A[i] >> B[i];
    sort(A.begin(), A.end(), greater<>());
    sort(B.begin(), B.end(), greater<>());
    for(auto &i: B) {
        if(i <= A.front()) break;
        H -= i;
        count++;
        if(H <= 0) {
            cout << count << endl;
            return 0;
        }
    }
    count += ceil((double)H / A.front());
    cout << count << endl;
    return 0;
}


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

int gcd(int x, int y)
{
    if (x == 0) return y;
    else return gcd(y%x, x);
}

int main()
{
    int n, x, xt, ans;
    int dx[1<<17];
    std::cin >> n >> x;
    for (int i = 0; i < n; i++) {
        std::cin >> xt;
        dx[i] = xt > x ? xt-x : x-xt;
    }
    ans = dx[0];
    for (int i = 1; i < n; i++) {
        ans = gcd(ans, dx[i]);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 640
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN [IUT CSE(SWE)-19]

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

#define fastio          ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define read            freopen("blue.txt","r",stdin);
#define write           freopen("red.txt","w",stdout);

using ll=long long;
using ull=unsigned long long;
const double pi = 2*acos(0.0);

int  main()
{

    fastio;

    long long x,y;
    cin>>x>>y;

    if(y%2==0 && y>=2*x && y<=4*x)
        cout<<"Yes";

    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner stdin = new Scanner(System.in);
		String data = null;
		double hight = stdin.nextDouble();;
		double max = hight;
		double min = hight;
		while(stdin.hasNext()) {

			hight = stdin.nextDouble();
			
			if(max < hight) {
				max = hight;
			}
			
			if(min > hight) {
				min = hight;
			}
			
		}
		
		System.out.println(max - min);
	}
}

Measured memory_bytes: 27808
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int N,M;
int W[100000];int L[100000];
bool board[5000][5000];
int WC[5000];int LC[5000];
bool F[5000];
int main()
{
	scanf("%d%d",&N,&M);
	for(int i=0;i<M;i++){
		scanf("%d%d",&W[i],&L[i]);W[i]--;L[i]--;
		board[W[i]][L[i]]=true;
		WC[W[i]]++;LC[L[i]]++;
	}
	bool ans=true;
	for(int i=0;i<N;i++){
		int now=-1;
		for(int j=0;j<N;j++){
			if(F[j])continue;
			if(LC[j]==0){
				if(now!=-1)ans=false;
				else now=j;
			}
		}
		printf("%d\n",now+1);
		F[now]=true;
		for(int j=0;j<N;j++){
			if(board[now][j]){
				LC[j]--;
			}
		}
	}
	if(ans)printf("0\n");
	else printf("1\n");
	return 0;
}

Measured memory_bytes: 26424
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ar array<int,2>
#define inf 1000000000000000000 
int mod=1e9+7;
int min(int a,int b){return (a<b)?a:b;}
int max(int a,int b){return (a>b)?a:b;}
int fp(int a,int b){if(b==0) return 1;int x=fp(a,b/2);x=(x*x)%mod;if(b&1) x=(x*a)%mod;return x;}


const int N=2e5+5;



void solve()
{
        int n;
        cin>>n;
        vector<int> v;
        int a[n+1],ans=0;
        for(int i=1;i<=n;i++)
            cin>>a[i];
        for(int i=1;i<=n;i++)
        {
            for(int j=i+1;j<=n;j++)
            {
                for(int k=j+1;k<=n;k++)
                {
                    v={a[i],a[j],a[k]};
                    // for(auto l:v)
                    //     cout<<l<<" ";
                    // cout<<endl;
                    sort(v.begin(),v.end());
                    if(v[0]+v[1]>v[2]&&v[0]!=v[1]&&v[0]!=v[2]&&v[1]!=v[2])
                        ans++;
                }
            }
        }
        cout<<ans;


}

signed main() {
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
 srand(time(0));
 int t;
 t=1;
 for(int i=1;i<=t;i++)
 {
   solve();
 }


}

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

using ll = long long;

int nums(char s){
  return s - '0';
}

int main()
{
  string s;
  cin >> s;
  int leng = s.length();
  ll sn = 0;
  vector<int> v(2019, 0);

  v.at(0) = 1;
  int amari = 0;
  int ten = 1;
  for(int i = leng-1; i>=0; i--){
    amari = amari + nums(s[i]) * ten;
    ten *= 10;
    ten %= 2019;
    amari %= 2019;
    // cout << amari << endl;
    v.at(amari) += 1;
  }

  int ans = 0;
  for(int i = 0; i<2019; i++){
    ans += v.at(i) * (v.at(i) -1) /2;
  }
  cout << ans << endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(auto i = n; i != k; i--)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;

vector<int> makePrimes(int size) {
    size = max(size, 25); // 小さすぎるとバグる
    vector<int> primes;
    bool *flag = new bool[size];

    memset(flag, true, size);

    int limit = sqrt(size);
    REP(i, 2, limit) {
        if(flag[i]) {
            primes.push_back(i);
            for(int j=i; j<size; j+=i) {
                flag[j] = false;
            }
        }
    }
    REP(i, limit, size) {
        if(flag[i]) {
            primes.push_back(i);
        }
    }

    delete[] flag;
    return primes;
}

map<int, int> prime_div(long long N, vector<int> primes) {
    map<int, int> m;
    m.insert(make_pair(1,1));
    while(true) {
        bool ok = false;
        for(int i=0; i<primes.size(); i++) {
            if(N%primes[i] == 0) {
                if(m.find(primes[i]) != m.end()) m[primes[i]] += 1;
                else m.insert(make_pair(primes[i], 1));
                N /= primes[i];
                break;
            }
            if(primes[i] > N) {
                ok = true;
                break;
            }
        }
        if(ok) break;
    }
    return m;
}

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

    int N; cin >> N;
    vector<int> primes = makePrimes(N+1);
    map<int, int> pd;
    REP(i,1,N+1) {
        map<int, int> pdi = prime_div(i,primes);
        REP(itr,pdi.begin(),pdi.end()) {
            if(pd.find(itr->first) != pd.end()) pd[itr->first] += pdi[itr->first];
            else pd.insert(*itr);
        }
    }
    pd.erase(pd.begin());

    ll ans = 1;
    REP(itr,pd.begin(),pd.end()) ans = (ans*(itr->second+1)) % (1000000000 +7);
    cout << ans << endl;

    // REP(itr,pd.begin(),pd.end())
    //     cout << "(" << itr->first << "," << itr->second << ") ";
    // cout << endl;

    return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int st = -1;
  for ( int i = 0; i < n; ++ i) {
    cin >> a[i];
  }
  for ( int i = 1; i < n; ++ i) {
    if( a[i-1] + a[i] >= m) {
      st = i;
    }
  }
  if( ~ st) {
    cout << "Possible\n";
    for ( int i = 1; i < st; ++ i) {
      cout << i << "\n";
    }
    for ( int i = n-1; i > st; -- i) {
      cout << i << "\n";
    }
    cout << st << "\n";
  } else {
    cout << "Impossible\n";
  }
  return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int main(void)
{
int i,num=0;

char s[4]={0,0,0,0};

scanf("%s",s);

for(i=0; i<4; i++)
{
	if(s[i] == '+')
		num++;
	if(s[i] == '-')
		num--;
}
printf("%d\n",num);

	return 0;
}

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

using namespace std;

int INF = 10000000;

int n , r;
int N[50];


int main()
{

	while(cin >> n >> r && n && r)
	{

		for(int i = 0;i < n;i++)N[i] = n-i-1;

		for(int i = 0;i < r;i++)
		{
			int p,c;
			cin >> p >> c;p--;

			int temp[50];
			int t = 0;

			for(int j = p;j < p+c;j++)
			{
				temp[t++] = N[j];
			}
			t = p-1;

			for(int j = p+c-1;j >= 0;j--)
			{
				if(t>=0)N[j] = N[t--];
			}

			for(int j = 0;j < c;j++)
			{
				N[j] = temp[j];
			}
		}

		cout << N[0]+1 << endl;



	}

  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <string>
using namespace std;

#ifdef DEBUG
#define dump(s) cerr << #s << " = " << s << endl
#else
#define dump(...)
#endif

char s[5000];
int len;

int length(int const k, int const l, int const r)
{
    int cur = 0, res = 0, p = l;
    while (s[p] && p < r)
    {
        if (isalpha(s[p]))
        {
            while (s[p] && p < r && isalpha(s[p]))
            {
                //printf(" %c\n", s[p]);
                if (cur == k)
                {
                    throw s[p];
                }
                res++;
                p++;
                cur++;
            }
        }
        else if (isdigit(s[p]))
        {
            int times = 0;
            while (s[p] && p < r && isdigit(s[p]))
            {
                times = times * 10 + s[p] - '0';
                p++;
            }
            int d = 0, i = p;
            p++;
            assert(s[i] == '(');
            while (1)
            {
                if (s[i] == '(') d++;
                else if (s[i] == ')') d--;
                if (d == 0) break;
                i++;
            }
            for (int j = 0; j < times; j++)
            {
                int d = length(k - cur, p, i);
                res += d;
                cur += d;
            }
            p = i + 1;
        }
    }
    return res;
}

int main()
{
    static char t[5000];
    int k;
    while (cin >> t >> k && t[0] != '0')
    {
        int tlen = strlen(t);
        len = 0;
        for (int i = 0; i < tlen; i++)
        {
            if (i > 0 && isdigit(t[i - 1]) && isalpha(t[i]))
            {
                s[len++] = '(';
                s[len++] = t[i];
                s[len++] = ')';
            }
            else
            {
                s[len++] = t[i];
            }
        }
        s[len] = 0;
        //cout << s << endl;
        try
        {
            length(k, 0, len);
            puts("0");
        }
        catch (char e)
        {
            cout << e << endl;
        }
    }
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define pc putchar
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
using namespace std;
const int N=100005;
int n,ans,cnt,vis[N],tot;
struct node{
	int x,y;
}a[N];
struct lxy{
	int v,id,t;
	friend bool operator < (lxy A,lxy B){
		return A.v<B.v;
	}
}b[N<<1];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
void write(int x){if(x<0){x=-x,pc('-');}if(x>9) write(x/10);pc(x%10+48);}
void writeln(int x){write(x),hh;}
void writesp(int x){write(x),pc(' ');}
signed main(){
	n=read();
	for(int i=1;i<=n;i++){
		a[i].x=read();
		a[i].y=read();
		b[++cnt]=(lxy){a[i].x,i};
		b[++cnt]=(lxy){a[i].y,i};
	}
	sort(b+1,b+cnt+1);
	for(int i=1;i<=n;i++){
		ans+=b[i].v;
		if(!vis[b[i].id]){
			vis[b[i].id]++;
			tot++;
		}
	}
	if(tot==n){
		if(b[n+1].id==b[n].id) ans+=min(b[n+2].v-b[n].v,b[n+1].v-b[n-1].v);
		else ans+=b[n+1].v-b[n].v;
	}
	int sum=0;
	for(int i=1;i<=n;i++) sum+=a[i].x;
	ans=min(ans,sum);
	sum=0;
	for(int i=1;i<=n;i++) sum+=a[i].y;
    ans=min(ans,sum);
	write(ans);
    return 0;
}

Measured memory_bytes: 7296
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    if (a < b) return gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    ull X, v = 100, y = 0;
    cin >> X;
    while (v < X) {
        v += v * 0.01;
        y++;
    }
    cout << y << endl;
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <math.h>
int main(void){
    int n;
    double s[1000];
    int i;

    for(;;){
        scanf("%d", &n);
        if(n == 0) break;

        double sum = 0;
        for(i = 0; i < n; i++){
            scanf("%lf", &s[i]);
            sum += s[i];
        }

        double m = sum / n;
        double SUM = 0;
        for(i = 0; i < n; i++)
           SUM += (double) pow(s[i] - m, 2);
        
        double a = sqrt(SUM / n);

        printf("%.8f\n", a); 
    }

    return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef pair<int, int> pi;
#define SQ(a) (a) * (a)
#define deb(x) cout << #x << " = " << x << '\n'
#define deb2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
 
bool triangle(int x,int y,int z){
    if(x+y<=z){
        return false;
    }
    if(x+z<=y){
        return false;
    }
    if(y+z<=x){
        return false;
    }
    return true;
}
 
int main(int argc, char const *argv[])
{
 
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int count=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]==a[j] || a[j]==a[k] || a[i]==a[k]){
                    continue;
                }
                if(triangle(a[i],a[j],a[k])){
                    count++;
                }
            }
        }
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){

    int n;
    cin >> n;

    vector<string> cards(n);
    vector<string> cards_cpy(n);
    // stable性を判定するため(SelectionSortで必要)
    vector<char> chars(n);
    vector<char> chars_sorted(n);
    for(int i=0; i<n; i++){
        cin >> cards[i];
    }
    cards_cpy = cards;

    // BubbleSort
    for(int i=0; i<n; i++){
        for(int j=n-1; i+1<=j; j--){
            if(cards[j][1]-'0' < cards[j-1][1]-'0'){
                string tmp = cards[j];
                cards[j] = cards[j-1];
                cards[j-1] = tmp;
            }
        }
    }

    // bubblesortはstableであるため、そのときのalphabetの配列を取得し、
    // SelectionSortでのstable判定に用いる
    for(int i=0; i<n; i++){
        chars[i] = cards[i][0];
    }

    for(int i=0; i<n; i++){
        if(i==n-1){
            cout << cards[i] << endl;
            break;
        }
        cout << cards[i] << " ";
    }
    // BubbleSortはその機構上stable(inputされたalphabetのorderは保つ)
    cout << "Stable" << endl;


    cards = cards_cpy;
    // SelectionSort
    for(int i=0; i<n; i++){
        int mini = i;
        for(int j=i; j<n; j++){
            if(cards[j][1]-'0' < cards[mini][1]-'0'){
                mini = j;
            }
        }
        string tmp = cards[i];
        cards[i] = cards[mini];
        cards[mini] = tmp;
    }

    for(int i=0; i<n; i++){
        chars_sorted[i] = cards[i][0];
    }

    for(int i=0; i<n; i++){
        if(i==n-1){
            cout << cards[i] << endl;
            break;
        }
        cout << cards[i] << " ";
    }
    if(chars==chars_sorted){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }

    return 0;
}



Measured memory_bytes: 3220
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;

const int MAX_N = 2 * 1e5 + 2;

ll A[MAX_N];

int main() {
    int N;
    cin >> N;
    map<ll, int> a_cnt;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        a_cnt[A[i]]++;
    }
    sort(A, A + N);
    int ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        if (a_cnt[A[i]] == 0) continue;
        a_cnt[A[i]]--;
        ll target = 1;
        while (target <= A[i]) target *= 2;
        if (a_cnt[target - A[i]] > 0) {
            ans++;
            a_cnt[target - A[i]]--;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 26752
s=input()
t=input()
ans=[]
for i in range(len(s)-len(t)+1):
    ts=s[i:i+len(s)]
    c=0
    for x,y in zip(t,ts):
        if x==y:
            c+=1
    ans.append(c)
print(len(t)-max(ans))

Measured memory_bytes: 9124
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <math.h>
using namespace std;
int n;
int a[200001];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int idx = 1;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == idx) {
			idx += 1;
			cnt += 1;
		}
	}
	if (!cnt) {
		cout << -1;
	}
	else {
		cout << n - cnt;
	}
}


Measured memory_bytes: 1152
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define NUM 300000
typedef long long ll;

bool prime[300010];

int main(void) {
    for (int i = 0; i <= NUM; i++) prime[i] = true;
    prime[1] = false;
    for (int i = 2; 6 * i <= NUM; i++) {
        prime[6 * i] = false;
    }
    for (int i = 1; i * 7 <= NUM; i++) {
        int j = i * 7 + 1;
        if (prime[j]) {
            for (int k = 2; k * j <= NUM; k++) {
                prime[k * j] = false;
            }
        }
        j = i * 7 + 6;
        if (prime[j]) {
            for (int k = 2; k * j <= NUM; k++) {
                prime[k*j] = false;
            }
        }
    }
    int N;
    while (1) {
        cin >> N;
        if (N == 1) break;
        vector<int> ans;
        for (int i = 1; i * i <= N; i++) {
            if (N % i == 0) {
                int I = N / i;
                if (i % 7 == 1 || i % 7 == 6) {
                    ans.push_back(i);
                }
                if (I != i && (I % 7 == 1 || I % 7 == 6)) {
                    ans.push_back(I);
                }
            }
        }
        sort(ans.begin(), ans.end());
        printf("%d:", N);
        for (int i = 0; i < ans.size(); i++) {
            if (prime[ans[i]]) cout << " " << ans[i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1540
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>

using namespace std;

int N, K;
string S;

vector<pair<int, char> > v;

int main()
{
    cin >> N >> K >> S;
    char x;
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        if (i == 0)
        {
            cnt++;
            x = S[i];
        }
        else if (x == S[i])
        {
            cnt++;
        }
        else
        {
            v.push_back(make_pair(cnt, x));
            cnt = 1;
            x = S[i];
        }
    }
    v.push_back(make_pair(cnt, x));
    v.push_back(make_pair(0, '1'));
    v.push_back(make_pair(0, '1'));
    /*
    for (int i = 0; i < v.size();i++)
    {
        cout << v[i].first << " ";
    }
    cout << endl;
    */

    int ans = 0;
    int temp = 0;
    int l = 0, r = 0, k = 0;
    while (r < v.size() - 2)
    {
        if(k <= K)
        {
            if(v[r].second == '0')
            {
                k++;
                temp += v[r].first + v[r + 1].first;
                r += 2;
            }
            else
            {
                temp += v[r].first;
                r++;
            }
        }
        while(k > K)
        {
            if (v[l].second == '0')
            {
                k--;
                temp -= v[l].first;
                l++;
            }
            else
            {
                k--;
                temp -= v[l].first + v[l+1].first;
                l += 2;
            }
        }
        //cout << "r:" << r << endl;
        //cout << temp << endl;
        ans = max(ans, temp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1528
s = input()
ans = [0]*len(s)
tmp = [0, 0]
pre = 'R'
for ind, c in enumerate(s):
    if c!=pre:
        if c=='L':
            left = ind-1
            right = ind
            pre = 'L'
        else:
            ans[left] = tmp[left%2]
            ans[right] = tmp[right%2]
            tmp = [0, 0]
            pre = 'R'

    tmp[ind%2] += 1

ans[left] = tmp[left%2]
ans[right] = tmp[right%2]
print(*ans)

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

using namespace std;

#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container), element) != container.end())
#define INF 0x3f3f3f3f
#define f1(n) for(int i=0 ; i<n ; i++)
#define f2(m) for(int j=0 ; j<m ; j++)
#define ll unsigned long long
typedef pair<int, int> iPair;
const double epsilon = 1e-7;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  unordered_map<ll, ll> m;
  int x;
  ll sum = 0;
  f1(n) {
    cin >> x;
    m[x]++;
    sum += x;
  }
  int q;
  cin >> q;
  int b, c;
  f1(q) {
    cin >> b >> c;
    ll count = m[b];
    m.erase(b);
    sum -= b * count;
    m[c] += count;
    sum += c * count;
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 6600
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():
    n,k=INTM()
    L=LIST()
    L=sorted(L, reverse=True)
    print(sum(L[0:k]))
if __name__ == '__main__':
    do()

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

int n;
long long a[200002];
long long b[200002];
long long sum = 0;
long long ans = 0;
int main(){

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

	for(int i=n;i>0;i--){
		sum += a[i];
		sum %= 1000000007ll;
		ans += sum*a[i-1];
		ans %= 1000000007ll;
	}

	cout<<ans<<endl;

	return(0);
}

Measured memory_bytes: 5176
def main():
    S = input()
    # S = 'aabbaa'
    # S = 'aaaccacabaababc'
    strs = []
    prev = ''
    word = ''
    for v in S:
        word = v + word
        if word != prev:
            strs.append(word)
            prev = word
            word = ''
    # print(strs)
    print(len(strs))


if __name__ == '__main__':
    main()

Measured memory_bytes: 8296
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct UnionFind{
    vector<int> par, siz;
    void init(int n){
        par.resize(n);
        siz.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            siz[i] = 1;
        }
    }
    
    int root(int i){
        if(par[i] == i) return i;
        else return par[i] = root(par[i]);
    }

    bool same(int a, int b){
        return root(a) == root(b);
    }

    int size(int i){
        return siz[root(i)];
    }

    void unite(int a, int b){
        a = root(a);
        b = root(b);
        if(a == b) return;
        if(size(a) < size(b)) swap(a, b);
        siz[a] += siz[b];
        par[b] = a;
    }
};
struct edge{
    int from;
    int to;
    int cost;
};
bool comp(const edge &e1, const edge &e2){
    return e1.cost < e2.cost;
}
int main(){
    int V, E;
    cin >> V >> E;
    vector<int> used(V, 0);
    vector<edge> es(E);
    for(int i = 0; i < E; i++){
        int s, t, w;
        cin >> s >> t >> w;
        edge e = {s, t, w};
        es[i] = e;
    }
    sort(es.begin(), es.end(), comp);
    int ans = 0;
    UnionFind U;
    U.init(V);
    for(int i = 0; i < E; i++){
        edge e = es[i];
        if(!U.same(e.from, e.to)){
            U.unite(e.from, e.to);
            ans += es[i].cost;
        }
    }
    cout << ans << endl;
}


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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
constexpr int inf = 1000000;
constexpr int def = inf;

int main(){
    int n,k;
    cin>>n>>k;
    cout << n-k+1 << endl;
    return 0;
}



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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n,m;
    cin>>n>>m;
    ll a[n],b[m];
    ll mod = 1e9+7;
    map<ll,ll> mh,mw;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mh[a[i]] = i+1;
    }
    for(int i=0;i<m;i++){
        cin>>b[i];
        mw[b[i]] = i+1;
    }
    ll ans = 1;
    bool uh[n+1]={},uw[m+1]={};
    ll h=0,w=0;
    for(int i=n*m;i>=1;i--){
        if(mh[i] && mw[i]){
            if(!uh[mh[i]]) h++;
            if(!uw[mw[i]]) w++;
            uh[mh[i]] = 1;
            uw[mw[i]] = 1;
        }
        else if(mw[i]){
            ans *= h;
            if(!uw[mw[i]]) w++;
            uw[mw[i]] = 1;
        }
        else if(mh[i]){
            ans *= w;
            if(!uh[mh[i]]) h++;
            uh[mh[i]] = 1;
        }
        else{
            ans *= (h*w-n*m+i)%mod;
            if(ans<0){
                cout << 0 << endl;
                return 0;
            }
        }
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
    
}

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

//unsigned long long
int main()
{
    string S;
    cin >> S;
    int A = stoi(S.substr(0, 2));
    int B = stoi(S.substr(2, 4));
    if(0 < A && A <= 12 && 0 < B && B <= 12){
      cout << "AMBIGUOUS" << endl;
    }
    else if(0 < A && A <= 12 && 0 <= B){
      cout << "MMYY" << endl;
    }
    else if(0 < B && B <= 12 && 0 <= A){
      cout << "YYMM" << endl;
    }
    else{
      cout << "NA" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <sstream>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 100100100;
const ll llINF = 1LL << 60;
string s = "";
int Size;
ll chmin(ll a, ll b)
{
	return a > b ? b : a;
}
bool getPos(int pos)
{
	//cout << "pos : " << pos << endl;
	if (pos == Size)	return true;
	if (pos > Size)	return false;
	int tmpPos;
	auto dreamItr = s.find("dream", pos);
	auto dreamerItr = s.find("dreamer", pos);
	auto eraseItr = s.find("erase", pos);
	auto eraserItr = s.find("eraser", pos);
	//cout << dreamItr << endl;
	//cout << dreamerItr << endl;
	//cout << eraseItr << endl;
	//cout << eraserItr << endl;
	bool ok = false;
	if (pos == dreamItr) {
		if (getPos(pos + 5)) return true;
	}
	if (pos == dreamerItr) {
		if (getPos(pos + 7)) return true;
	}
	if (pos == eraseItr) {
		if (getPos(pos + 5)) return true;
	}
	if (pos == eraserItr) {
		if (getPos(pos + 6)) return true;
	}
	if (!ok)	return false;
}
int main()
{
	cin >> s;
	auto dreamItr = s.find("dream");
	auto dreamerItr = s.find("dreamer");
	auto eraseItr = s.find("erase");
	auto eraserItr = s.find("eraser");
	Size = s.size();
	getPos(0);
	if (getPos(0))	cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 4536
import java.util.Scanner;
 
public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    
    String A[] = new String[N];
    
    for(int i=0; i<N; i++){
      A[i]=sc.next();
    }
    
    String B[] = new String[M];
    
    for(int i=0; i<M; i++){
      B[i]=sc.next();
    }
    
    for(int i=0; i<=N-M; i++){
      
      for(int j=0; j<=N-M;j++){
    
          for (int k = 0; k < M; k++) {
            String a = A[k + i].substring(j, j + M);
            if(!a.equals(B[k])) {
              break;
            }
            if(k == M - 1) {
              System.out.println("Yes");
              return;
            }
          }
        }
      }
    System.out.println("No");
  }
}
    
    

Measured memory_bytes: 35936
#define _USE_MATH_DEFINES
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int a = 0, b = 0;
	char c = 0;
	while (cin >> a >> c >> b)
	{
		if (c == '?')
		{
			break;
		}
		if (c == '+')
		{
			cout << a + b << endl;
		}
		if (c == '-')
		{
			cout << a - b << endl;
		}
		if (c == '*')
		{
			cout << a * b << endl;
		}
		if (c == '/')
		{
			cout << a / b << endl;
		}
	}
	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
int lbound(vector<long long>&v, long long b){
	int s = 0, e = v.size() - 1;
	int l = v.size();
	int m;
	while(e - s > 1){
		m = (s + e) / 2;
		if(v[m] >= b){
			e = m;
		}
		else{
			s = m;
		}
	}
	if(v[max(s - 1, 0)] >= b) return max(s - 1, 0);
	else if(v[s] >= b) return s;
	else if(v[min(s + 1, l - 1)] >= b) return min(s + 1, l - 1);
	else return v.size();
}

LL N;
vector<LL> A;
int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i=0; i<N; i++){
		long long a;
		cin >> a;
		A.push_back(a);
	}
	sort(A.begin(), A.end());

	if(N == 2){
		printf("%lld %lld\n", A[1], A[0]);
		return 0;
	}

	LL n = A[A.size()-1];
	int k = n/2;
	int r = lbound(A, (LL)k);
	if(r >= A.size() - 1){
		printf("%lld %lld\n", A[A.size()-1], A[A.size()-2]);
		return 0;
	}
	else{
		LL r1 = abs(A[r-1] - k);
		LL r2 = abs(A[r] - k);
		LL r3 = abs(A[r+1] - k);
		if(r1 < r2){
			if(r1 < r3){
				printf("%lld %lld\n", A[A.size()-1], A[r-1]);
			}
			else{
				printf("%lld %lld\n", A[A.size()-1], A[r+1]);
			}
			return 0;
		}
		else{
			if(r2 < r3){
				printf("%lld %lld\n", A[A.size()-1], A[r]);
			}
			else{
				printf("%lld %lld\n", A[A.size()-1], A[r+1]);
			}
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 4264
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n,m;
 cin>>n>>m;
 vector<ll> a(m);
 for(ll i=0;i<m;i++)cin>>a[i];
 ll sum = 0;
 for(auto i:a)sum+=i;
 
 if(n-sum >= 0 )cout<<n-sum<<endl;
 else cout<<-1<<endl;   
 return 0;
}


Measured memory_bytes: 3704
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int P = 1e9 + 7, N = 5010;
int n, A, B, f[N][2], g[N], h[N];
int main(){
	read(n); read(A); read(B);
	if (A > B) swap(A, B);
	g[1] = 1;
	for (int i = 2; i <= B; i++){
		g[i] = g[i - 1];
		for (int j = A + 1; j <= i; j++)
			g[i] = (g[i] + g[i - j]) % P;
	}
	h[0] = 1;
	for (int i = 1; i <= B; i++){
		h[i] = h[i - 1];
		for (int j = A + 1; j <= i; j++)
			h[i] = (h[i] + h[i - j]) % P;
	}
	f[0][0] = f[0][1] = 1;
	for (int i = 1; i <= n; i++){
		if (i != n){
			for (int j = 1; j <= min(A - 1, i); j++)
				f[i][0] = (f[i][0] + f[i - j][1]) % P;
			for (int j = 1; j <= min(B - 1, i - 1); j++)
				f[i][1] = (f[i][1] + 1ll * f[i - j][0] * g[j]) % P;
			if (B > i) f[i][1] = (f[i][1] + 1ll * f[0][0] * h[i]) % P;
		}
		else {
			for (int j = 1; j <= min(A - 1, i); j++)
				f[i][0] = (f[i][0] + f[i - j][1]) % P;
			for (int j = 1; j <= min(B - 1, i); j++)
				f[i][1] = (f[i][1] + 1ll * f[i - j][0] * h[j]) % P;
		}
	}
	int ans = 1;
	for (int i = 1; i <= n; i++) ans = ans * 2 % P;
	ans = (ans - (f[n][0] + f[n][1]) % P + P) % P;
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3672
package main

import (
  "fmt"
)

func reversedString(s string) string {
  r := []rune(s)
  n := len(r)
  for i := 0; i < n / 2; i++ {
    r[i], r[n-1-i] = r[n-i-1], r[i]
  }
  return string(r)
}

func isPalindrome(s string) bool {
  return reversedString(s) == s
}

func main() {
  var s string 
  fmt.Scan(&s)
  n := len(s)
  res := "No"
  if isPalindrome(s) && isPalindrome(s[:n/2]) {
    res = "Yes"
  }
  fmt.Println(res)
}

Measured memory_bytes: 512
n, k, q = map(int, input().split())
a = []
for i in range(q):
    a.append(int(input()))
scores = [k - q] * n

for i in range(q):
    scores[a[i] - 1] += 1

for i in range(n):
    if scores[i] <= 0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 10472
#include<stdio.h>
 
long ruijo(int a){
	int i;
	long tmp=1;
	for(i=0;i<a;i++)tmp*=10;
	return tmp;
}
 
int main(){
	long n;scanf("%ld",&n);
	int kakui[4]={0,3,5,7},ans=0,count=0,keta[11]={-1};
	long tmp=0;
	while(n>=tmp){
		int i=0;
		for(i=0;i<11;i++)keta[i]=-1;
		i=0;
		int cpy=count;
		while(cpy>0){
			keta[i]=cpy%4;
			cpy-=keta[i];
			cpy=cpy/4;i++;
		}
	//	keta[i]=0;
//		for(i=0;i<10;i++)printf("%d,",keta[i]);
//		puts("OK");
		int flag[4]={0};
		tmp=0;
		for(i=0;keta[i]!=-1;i++){
				tmp+=ruijo(i)*kakui[keta[i]];
				flag[keta[i]]++;
		}
//		for(i=0;i<4;i++)printf("%d,",flag[i]);
//		printf("!!%ld\n",tmp);
		if(flag[1]!=0&&flag[2]!=0&&flag[3]!=0){
			if(flag[0]==0){
				if(n>=tmp)ans++;
//				puts("IN");
			}
		}
		count++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
 
class Main {
static Scanner scan = new Scanner(System.in);
  
  public static void main(String[] args){
  
    int tate = scan.nextInt();
    int yoko = scan.nextInt();
    
    tate -= 1;
    yoko -= 1;
    
    System.out.println(tate*yoko);
  }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define MAXN 100010
using namespace std;

int n, ans, happy[MAXN][3], dp[MAXN][3];

void init(){
    for(int i=1; i<=3; i++) dp[1][i]=happy[1][i];
}

int main(){

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

    cin>>n;

    for(int i=1; i<=n; i++){
        for(int j=1; j<=3; j++){
            cin>>happy[i][j];
        }
    }

    init();

    for(int i=2; i<=n; i++){
        for(int j=1; j<=3; j++){
            for(int k=1; k<=3; k++){
                if(k==j) continue;
                dp[i][j]=max(dp[i][j], dp[i-1][k]+happy[i][j]);
            }
        }
    }

    for(int i=1; i<=3; i++) ans=max(ans, dp[n][i]);

    cout<<ans;

return 0;
}


Measured memory_bytes: 2560
n=input()

def make_seven(n):
    al=[]
    for i in range(4):
        a=int(n[i])
        al.append(a)

    for j in range(-1,2,2):
        for k in range(-1,2,2):
            for l in range(-1,2,2):
                if al[0]+j*al[1]+k*al[2]+l*al[3]==7:
                    if j==-1:
                        o1="-"
                    else:
                        o1="+"
                    if k==-1:
                        o2="-"
                    else:
                        o2="+"
                    if l==-1:
                        o3="-"
                    else:
                        o3="+"
                    print(str(al[0])+o1+str(al[1])+o2+str(al[2])+o3+str(al[3])+"=7")
                    return
make_seven(n)

Measured memory_bytes: 9200
from collections import defaultdict

def main():
    data = defaultdict(int)

    num = int(input())
    for i in range(num):
        aaa = input()
        data[aaa] += 1

    num = int(input())
    for i in range(num):
        aaa = input()
        data[aaa] -= 1

    print(max(0, max(data.values())))




if __name__ == '__main__':
    main()



Measured memory_bytes: 38256
s=input()
K=int(input())
n=len(s)
se=set()
for i in range(n):
    se.add(s[i:i+1])
    se.add(s[i:i+2])
    se.add(s[i:i+3])
    se.add(s[i:i+4])
    se.add(s[i:i+5])
l=list(se)
l.sort()
print(l[K-1])

Measured memory_bytes: 4464
n = int(input()) 

s=''

num2alpha = lambda c: chr(c+96)

q=n
while 1:
    q, mod = divmod(q, 26)

    if mod==0:
        s=s+'z'
        q-=1
    else:
        s=s+num2alpha(mod)
    if q<=26:
        if q!=0:
            s=s+num2alpha(q)
        break;

s = s[::-1]
print(s)

Measured memory_bytes: 9188
import sys
  
def bubble_sort(C, N):
    for i in range(N):
        for j in range(N - 1, i, -1):
            if C[j][1] < C[j - 1][1]:
                C[j], C[j - 1] = C[j - 1], C[j]
                  
    return C
def selection_sort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[j][1] < C[minj][1]:
                minj = j
  
        C[i], C[minj] = C[minj], C[i]
      
    return C
fin = sys.stdin
  
N = int(fin.readline())
A = fin.readline().split()
B = A[:]
  
A = bubble_sort(A, N)
B = selection_sort(B, N)
  
print(" ".join(A))
print("Stable")
  
print(" ".join(B))
if A == B:
    print("Stable")
else:
    print("Not stable")



Measured memory_bytes: 5612
from itertools import *
n=104730;a=list(range(n));a[:2]=0,0
for i in range(2,323):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(range(n),a))
for e in iter(input,'0'):print(sum(p[:int(e)]))


Measured memory_bytes: 10460
N,Q = list(map(int, input().split()))
S = input()
x=[]
y=[]
for i in range(Q):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
t = [0]*(N+1)

for i in range(N):
    if S[i:i+2] == "AC":
        t[i+1] = t[i]+1
    else:
        t[i+1] = t[i]
for i in range(Q):
    print(t[y[i]-1]-t[x[i]-1])

Measured memory_bytes: 14140
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int a, b;
	std::cin >> a >> b;
	if (a > b) {
		std::cout << (a-1) << "\n";
	} else {
		std::cout << a << "\n";
	}
}


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

using namespace std;

char s[1005], t[1005];

int main() {
	scanf("%s%s", s, t);
	
	int n = strlen(s);
	int m = strlen(t);
	
	int res = 1e9;
	
	for (int i = 0; i < n - m + 1; i++) {
		int diff = 0;
		for (int j = 0; j < m; j++) {
			diff += (s[i + j] != t[j]);
		}
		res = min(res, diff);
	}
	
	printf("%d\n", res);
}


Measured memory_bytes: 3800
n, k = map(int, input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
elif s[k-1] == 'C':
    s[k-1] = 'c'

print(''.join(s))


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.size();
    
    if(n==2){
        if(s[0]==s[1]) cout<<"1 2"<<endl;
        else cout<<"-1 -1"<<endl;
        return 0;
    }
    REP(i,0,n-2){
        char a,b,c;
        a=s[i];
        b=s[i+1];
        c=s[i+2];
        if(a==b || b==c || c==a){cout<<i+1<<" "<<i+3; return 0;}
    }
    cout<<"-1 -1"<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <iostream>
#include <iomanip> 
#include <algorithm>
#include <queue>
#include <list>
#include <numeric>
#include <stack>
#include <unordered_map>
#include <map>
#include <set>
 
using namespace std;
 
#define sz(a) int((a).size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define endl '\n'
#define watch(x) cout << #x << " : " << x << endl;
 
#define FastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef vector<ii> vii;
 
const int N = int(2e5)+10;
const int K = 10005;
// const int MOD = int(1e9)+7;
const int INF = int(1e9)+5;
const ll INF64 = 1e18;

const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

ll a[N];
map<ll,int> mp;

void solve () {
    int x;cin>>x;
    if (x >= 30) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}

int main () {
    FastIO
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    int t;
    // cin>>t;
    t = 1;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
Module Module1

    Sub Main()
        'let'
        Dim N As Long = Console.ReadLine()
        Dim tmp() As String = Console.ReadLine().Split()
        Dim a(N - 1) As Long

        For i As Long = 0 To N - 1
            a(i) = tmp(i)
        Next

        Array.Sort(a)
        Array.Reverse(a)

        'var'
        Dim ans As Long = 0

        For i As Long = 0 To N - 1
            ans += New Long() {-1, 1}(i Mod 2) * a(i)
        Next

        Console.WriteLine(Math.Abs(ans))

    End Sub

End Module

Measured memory_bytes: 13140
#include <stdio.h>

int main(){
  char s[4];
  scanf("%s",s);
  int flag = 0;
  if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) flag = 1;
  if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) flag = 1;
  if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) flag = 1;
  if(flag == 1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

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

int main() {
	
	long long int n,a,b;
	cin>>n>>a>>b;
	
	long long int ans=a*(n/(a+b));
	if(n%(a+b)>=a)
	ans+=a;
	else
	ans+=n%(a+b);
	cout<<ans;
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 256