akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

string solve(string s, int x){
    string t;
    for(int i = x; i < s.size(); i++){
        t += s[i];
    }
    rep(i,x){
        t += s[i];
    }
    return t;
}

int main(){
    string str;
    int n;
    while(cin >> str){
        if(str == "-") break;
        cin >> n;
        rep(i,n){
            int x;
            cin >> x;
            str = solve(str, x);
        }
        cout << str << endl;
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
  int l,r,d; cin >> l >> r >> d;
  int ans = 0;
  FOR(i,l,r) {
    if (i % d == 0) ans++;
  }

  cout << ans << endl;

  return 0;
}


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

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;

void solve(){
  int x, y;
  cin>>x>>y;
  if( y >= 2 * x && (y - 2 * x)%2 == 0){
    if(4 * x - y >=0){
      cout<<"Yes"<<endl;
      return;
    }
  }
  cout<<"No"<<endl;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
#define fio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
// #define double long double
// #define mp make_pair
// #define pb push_back
// Upper case English alphabet to lower case ch |= ' ';
// Lower case English alphabet to upper case ch &= '_’ ;
//__builtin_popcount(x)

int INF=(int)1e18+1,t=-1,till=0;
int gcd(int a, int b) { return b!=0 ? gcd(b, a % b) : a; }
// int digits(int n){return floor(log10(n))+1 ;}
// bool ispoweroftwo (int x) { return x && (!(x&(x-1))); }
//vector<int> vis,parent,ti,tout,dis;
// vector<vector<int> > adj;
// map<pair<int,int>,int> vis;
// vector<int> row={-1,1,0,0};
// vector<int> col={0,0,-1,1};
// //map<pair<int,int>,int> dp;
// int n=1;
// int th=0;

// int dfs(int r,int c,vector<vector<int> > board,vector<vector<int> > &dp){
//     vis[{r,c}]=1;
//     if(dp[r][c]!=-1){
//         return dp[r][c];
//     }
//     int t=1;
//     for(int i=0;i<4;i++){
//         int r1=r+row[i],c1=c+col[i];
//         if(r1>=0 && r1<n && c1>=0 && c1<n && 
//           !vis[{r1,c1}] && board[r][c]<board[r1][c1]){
//           t=max(t,1LL + dfs(r1,c1,board,dp));
//         }
//     }
//     vis[{r,c}]=0;
//     return dp[r][c]=max(t,dp[r][c]);
    
    
// }




signed main(){
    fio;
    int n,wt;
    cin>>n>>wt;
    int dp[n+1][wt+1];
    vector<int> w(n),v(n);
    for(int i=0;i<n;i++) cin>>w[i]>>v[i];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=wt;j++){
            dp[i][j]=0;
            if(i==0 || j==0) {
                dp[i][j]=0;
                continue;
            }
            if(j<w[i-1]){
                dp[i][j]=dp[i-1][j];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
            }
        }
    }
    cout<<dp[n][wt]<<endl;



    
    


    

    
    
     
    



    
    
    
    
    



    
    
    


    

    

    

    



    

    

    

    


    

    
    
}


Measured memory_bytes: 79232
#include<stdio.h>

int main(){
  int n, m;
  int arr1[100][100];
  int arr2[100];
  int i, j;
  int input;
  int res[100];
  int sum;
  
  // input
  scanf("%d %d", &n, &m);
  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      scanf("%d", &input);
      arr1[i][j] = input;
    }
  }

  for(i = 0; i < m; i++){
    scanf("%d", &input);
    arr2[i] = input;
  }

  // calculation
  for(i = 0; i < n; i++){
    sum = 0;
    for(j = 0; j < m; j++){
      sum += arr1[i][j] * arr2[j];
    }
    res[i] = sum;
  }

  // output result
  for(i = 0; i < n; i++){
    printf("%d\n", res[i]);
  }
  
  return 0;
}



Measured memory_bytes: 2104
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int A = in.nextInt();
		int B = in.nextInt();
		int K = in.nextInt();
		in.close();

		List<Integer> nums = new ArrayList<>();
		for (int i = Math.min(A, B); i >= 1; --i) {
			if (A % i == 0 && B % i == 0) {
				nums.add(i);
			}
		}
		System.out.println(nums.get(K - 1));
	}

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    int N;cin >> N;
    deque<ll> qu;
    Rep(i,9)qu.push_back(i);
    int counter = 0;
    while(1){
        ll q = qu.front();
        counter++;
        if(counter==N){
            cout << q << endl;
            return 0;
        }
        qu.pop_front();
        if((q%10)!=0)qu.push_back(q*10+(q-1)%10);
        qu.push_back(q*10+(q%10));
        if(q%10!=9)qu.push_back(q*10+(q+1)%10);
    }
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(i%3==0){
			cout<<" "<<i;
			continue;
		}
		int x=i;
		while(x){
			if(x%10==3){
				cout<<" "<<i;
				break;
			}
			x/=10;
		}
		continue;
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3076
//#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1e9+10)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))


int main() {
	int n,m;
	cin>>n>>m;
	if(m==1){
		cout<<0<<endl;
	}else{
		cout<<n-m<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main()
{
    int n,p;
    cin >> n >> p;
    string s;
    cin >> s;
    
    reverse(s.begin(),s.end());
    vector<ll> d(n+1);
    d[0] = 0;
    ll ans = 0;
    rep(i,n){
        ll x = s[i] - '0';//今の桁
        d[i+1] = (d[i] + (x*modpow(10,i,p))%p)%p;
    }
    if(p == 2|| p == 5){
        for(int i = n-1;i>=0;--i){
            if((s[i] - '0')%p == 0)ans += n-i;  

        }
        cout << ans << endl;
    }
    else{
        vector<int> cnt(p);
        for(int i = n;i >=0;i--){
            ans += cnt[d[i]];
            cnt[d[i]]++;
        }
        cout << ans << endl;

    }
        
    return 0;
}

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

int main(){
 
 char qwe[6],ans[6];

 int hit,blow,count;

     count = 0;
 
 while(1){
    cin >> qwe >> ans;
    if(qwe[0]=='0'&&ans[0]=='0'&&qwe[1]=='\0'&&ans[1]=='\0') break;
    hit = 0 ;
    blow = 0;


   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;
   count++;
  }

 /* hit = 0 ;
  blow = 0;

  while(hit != 4){
    if(count == 0){
      break;
    } 
    cin >> qwe >> ans;
    hit = 0 ;
    blow = 0;

   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;
   
   count--;
 }*/

 return 0;
}

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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

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

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    int K=in();
    vector<int> x(N);
    REP(i,N){
        x[i]=in();
    }
    int ans=0;
    REP(i,N){
        ans+=min(x[i],abs(K-x[i]))*2;
    }
    print(ans);
    return 0;
}

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

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    bool ans=false;
    
    for(int i=0; i<b; i++)
    if(a * i %b ==c) {ans = true;break;}
    
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
 
        int coin = n % 500;
        if (coin <= a) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22996
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a<b)?a:b)
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rp(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
using namespace std;
const ll maxn=5e5+5;
ll a[maxn],b[maxn],fa[maxn];
ll n,m,i,t,j,k,l,x,y,z,ans,mx,mi;
int main(){
	//freopen("data.in","r",stdin);
	scanf("%lld",&n);mi=n+1,mx=0;
	fo(i,1,n)scanf("%lld",&a[i]),mx=max(mx,a[i]),mi=min(mi,a[i]);
	if (mx==mi){
		if (mx<n-1 && 2*mx>n) printf("No");
		else printf("Yes");
	}else if (mx-mi>1) printf("No\n");
	else{
		t=0;
		fo(i,1,n) t+=(a[i]==mi);	
		n-=t;mx-=t;
		if (mx>0 && 2*mx<=n) printf("Yes");
		else printf("No");
	} 
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<functional>
#include<stack>
#include<list>
#include<set>
#include<deque>
#include<climits>
using namespace std;

typedef long long ll;

int main(){
	int N, M, ans[100];
	cin >> N >> M;
	ans[0] = M;
	for(int i = 1; i < (N-1)/2; i++) ans[i] = M;
	for(int i = (N-1)/2; i < N; i++) ans[i] = 0;

	printf("%d", ans[0]);
	for(int i = 1; i < N; i++) printf(" %d", ans[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 1152
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	vector<bool>v(1300000, true);
	v[0] = v[1] = false;
	for (int i = 2; i <= sqrt(1300000); i++) {
		if (v[i]) {
			for (int j = 2; i*j < 1300000; j++) {
				v[i*j] = false;
			}
		}
	}

	int x;
	while (cin >> x, x) {
		int ans = 0;
		for (int i = 0; v[x + i] == false; i++)ans++;
		for (int j = 0; v[x + j] == false; j--)ans++;
		cout << ans  << endl;

	}
	return 0;
}

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

using namespace std;

int main() {
  string s; cin>>s;
  reverse(s.begin(), s.end());
  vector<int>v(2019 , 0);
  v[0]++;
  int cur = 0 , rem = 1;
  for(int i = 0 ; i < s.size(); ++i){
    cur = (cur + (s[i] - '0')*rem* 10) % 2019;
    rem = rem * 10 % 2019;
    v[cur]++;
  }
  int ans = 0;
  for(int i = 0 ; i < v.size(); ++i){
    ans += v[i] * ( v[i] - 1) / 2;
  }
  cout<<ans<<"\n";
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 212345;
const int MAX_A = 212345;
int A[MAX_N * 2];
int nxt[MAX_N * 2];
int inc[MAX_N * 2];
int last[MAX_A];
ll vis[MAX_N * 2];
bool isin[MAX_A];

int main2() {
  int N = nextInt();
  ll K = nextLong();
  REP(i, N) A[i] = nextInt();
  REP(i, N) A[i + N] = A[i];

  CLR(last, -1);
  CLR(inc, 0);

  REP(i, 2 * N) {
    if (last[A[i]] >= 0) {
      nxt[ last[A[i]] ] = (i + 1) % N;
      inc[ last[A[i]] ] = (i + 1) / N;
    }
    last[A[i]] = i;
  }
  // pv(A, A+N);
  // pv(nxt, nxt + N);
  // pv(inc, inc + N);

  CLR(vis, -1);
  ll k = 0;
  int pos = 0;
  while (vis[pos] == -1) {
    vis[pos] = k;
    k += inc[pos];
    pos = nxt[pos];
  }

  ll L = k - vis[pos];
  // cout << "L=" << L << endl;
  // cout << "k=" << k << endl;
  if (K - k >= 2) {
    k += (K - k - 1) / L * L;
  } else {
    k = 0;
    pos = 0;
  }
  // cout << "k=" << k << endl;

  while (k < K - 1) {
    k += inc[pos];
    pos = nxt[pos];
  }

  CLR(isin, 0);
  vector<int> stack;

  // cout << "k=" << k << endl;
  // cout << "pos=" << pos << endl;
  for (; k < K && pos < N; pos++) {
    const int v = A[pos];
    if (isin[v]) {
      while (isin[v]) {
        isin[stack.back()] = false;
        stack.pop_back();
      }
    } else {
      stack.push_back(v);
      isin[v] = true;
    }
  }

  REP(i, stack.size()) {
    if (i > 0) cout << " ";
    cout << stack[i];
  }
  cout << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

int main(){
    double n, m, d;
    cin >> n >> m >> d;
    double ans;
    if(d > 0) ans = (n-d)*2.0*(m-1)/(n*n);
    else ans = (n-d)*(m-1)/(n*n);
    printf("%.9f",ans);
    return 0;
} 

Measured memory_bytes: 256
// author:  Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define all(x) x.begin(),x.end()
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;

//ll modexp(ll x, ll y, ll p)
//{
//	ll res = 1;
//	x = x % p;
//	while (y > 0)
//	{
//		if (y & 1)
//			res = (res * x) % p;
//		y = y >> 1;
//		x = (x * x) % p;
//	}
//	return res;
//}

//ll mulmod(ll a, ll b,ll m)
//{
//	return ((a % m) * (b % m)) % m;
// }

// ll sub_mod(ll a, ll b, ll m){
//    if (a >= b)
//        return a - b;
//    else
//        return m - b + a;
// }

// ll add_mod(ll a, ll b){
//    if (0 == b)
//        return a;

//    b = mod - b;
//    if (a >= b)
//        return a - b;
//    else
//        return mod - b + a;
// }

// ll gcd(ll a, ll b)
// {
// 	if (a == 0)
// 		return b;
// 	else
// 		return gcd(b % a, a);
// }

// ll modInv(ll a)
// {
//     ll g = gcd(a, mod);
//     if (g != 1)
//         return -1;
//     else
//         return modexp(a, mod-2, mod);
// }
bool isp(string a){
    string o=a;
    reverse(all(a));
    if(o==a)
        return true;
    else
        return false;
}
int main()
{
	fastio;
	bool f=true;
	string s;
	cin>>s;
    ll n=s.length();
    if(!isp(s))
        f=false;
    if(!isp(s.substr(0,n/2)))
       f=false;
    if(f)
        cout<<"Yes";
    else
        cout<<"No";
   	return 0;
}


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

int mcxi2int(string mcxi) {
    int res = 0;
    while (!mcxi.empty()) {
        int num = 1;
        if (isdigit(mcxi[0])) {
            num = mcxi[0] - '0';
            mcxi.erase(0, 1);
        }
        switch (mcxi[0]) {
        case 'm':
            res += num * 1000;
            break;
        case 'c':
            res += num * 100;
            break;
        case 'x':
            res += num * 10;
            break;
        case 'i':
            res += num;
            break;
        }
        mcxi.erase(0, 1);
    }
    return res;
}

void int2mcxi(int from, string& mcxi) {
    const char digitChar[] = "ixcm";
    int num;
    for (int i = 3; i >= 0; i--) {
        num = from / (int) pow(10, i);
        if (num > 0) {
            if (num > 1) {
                mcxi.push_back(num + '0');
            }
            mcxi += digitChar[i];
        }
        from %= (int) pow(10, i);
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string mcxi1, mcxi2;
        cin >> mcxi1 >> mcxi2;
        int sum = mcxi2int(mcxi1) + mcxi2int(mcxi2);
        string output;
        int2mcxi(sum, output);
        cout << output << endl;
    }
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

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; }

/*
int N;
ll h[100010];

// DP テーブル
ll dp[100010];
*/

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

	int diff1 = abs(a - b);
	int diff2 = abs(b - c);
	int diff3 = abs(a - c);

	if (diff3 <= d) cout << "Yes" << endl;
	else if (diff1 <= d && diff2 <= d) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
  int a,b,h,m;
  cin>>a>>b>>h>>m;
  double ans=sqrt(a*a+b*b-2*a*b*cos((h*60-11*m)*3.14159265358979/360));
  printf("%.10lf\n", ans);
}


Measured memory_bytes: 4192
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

int main ()
{
    long long n, m;
    scanf ("%lld%lld", &n, &m);
    long long ans = 0;
    if ((n == 1) && (m > 1))
    {
        ans = m - 2;
    }
    else if ((n > 1) && (m == 1))
    {
        ans = n - 2;
    }
    else
    {
        ans = (n - 2) * (m - 2);
    }
    printf ("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main(void){
    // Your code here!
    int N, K, p[200000];
    double max = -1, E[200000], test = 0;
    scanf("%d",&N);
    scanf("%d",&K);
    for(int i =0; i < N; i++)
    {
        scanf("%d",&p[i]);
        E[i] = (double)(1+p[i])/2;
    }
    
    for(int i = 0; i <= N-K; i++)
    {
        if(i == 0)
        {
            for(int j = 0; j < K; j++)
            {
                test += E[j];
            }
            max = test;
        }
        else
        {
            test = test - E[i-1] + E[i+K-1];
            if(max<test)
                max = test;
        }
    }
    printf("%lf\n",max);
}


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

int main(){
    int64_t n, d, ans = 0; cin >> n >> d;
    for(auto i = 0; i < n; i++) {
        int64_t x, y; cin >> x >> y;
        if(x * x + y * y <= d * d) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
N, M, X = map(int, input().split())
C, A = [], []
ans = 1200000
exist = False
for n in range(N):
    li = list(map(int, input().split()))
    C.append(li[0])
    A.append(li[1:])
for b in range(1 << N):
    amount = 0
    understand = [0] * M
    for n in range(N):
        if (b >> n) & 1 == 1:
            amount += C[n]
            for m in range(M):
                understand[m] += A[n][m]
    achieve = True
    for m in range(M):
        if X > understand[m]:
            achieve = False
    if achieve:
        exist = True
        ans = min(ans, amount)
if exist:
    print(ans)
else:
    print(-1)

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

constexpr int MAX_N = 8;

int N, A[3];
int l[MAX_N];

int dfs(int n, array<int, 3> a) {
  if (n == N) {
    int mp{};
    for (int i{}; i < 3; ++i) {
      if (a[i] == 0) {
        return 10000;
      }
      mp += abs(A[i] - a[i]);
    }
    return mp;
  }

  int ret[4];
  for (int i{}; i < 3; ++i) {
    array<int, 3> na{a};
    na[i] += l[n];
    ret[i] = dfs(n + 1, na) + (a[i] > 0 ? 10 : 0);
  }
  ret[3] = dfs(n + 1, a);
  sort(ret, ret + 4);

  return ret[0];
}

int main() {
  cin >> N;
  for (int i{}; i < 3; ++i)
    cin >> A[i];
  for (int i{}; i < N; ++i)
    cin >> l[i];

  array<int, 3> a{};
  cout << dfs(0, a) << endl;
  return 0;
}


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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  ll A,B;
  cin >> A >> B;
  cout << A * B  << endl;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cmath>

int n = 0;
double x[20], y[20];

int main()
{
	while( scanf( "%lf,%lf", &x[n], &y[n] ) != EOF )
		++n;

	double area = 0.0;
	for( int i = 0; i != n; ++i )
		area += x[i] * y[(i+1)%n] - y[i] * x[(i+1)%n];

	area /= 2.0;

	printf( "%.6f", std::abs( area ) );

	return 0;
}

Measured memory_bytes: 1080
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

vector<int>a;

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

	ll N, x;
	cin >> N >> x;
	a.resize(N);
	vector<ll>a(N);
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sort(all(a));

	if (x > sum)puts(N - 1);
	else if (sum == x)puts(N);
	else {
		ll ans = 0;
		for (int i = 0; i < N; i++) {
			if (x >= a[i]) {
				x -= a[i];
				ans++;
			}
		}
		puts(ans);
	}
	

	return 0;
}

Measured memory_bytes: 256
package main 

import (
	"fmt"
	"os"
	"bufio"
	"strings"
	)

/*
	C - BBuBBBlesort!
	https://atcoder.jp/contests/agc003/tasks/agc003_c
 */

// 文字列を1行入力
func StrStdin() (stringInput string) {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	stringInput = scanner.Text()
	stringInput = strings.TrimSpace(stringInput)
	return
}

func solve(str string) bool {
	if strings.Contains(str, "N") && strings.Contains(str, "S") {
		if strings.Contains(str, "W") && strings.Contains(str, "E") {
			return true
		}
		if strings.Contains(str, "W") || strings.Contains(str, "E") {
			return false
		}
		return true
	}

	if strings.Contains(str, "W") && strings.Contains(str, "E") {
		if strings.Contains(str, "N") && strings.Contains(str, "S") {
			return true
		}
		if strings.Contains(str, "N") || strings.Contains(str, "S") {
			return false
		}
		return true
	}

	return false
}

func main() {
	str := StrStdin()
	//str := "SENW"
	//fmt.Println("str=", str)

	if solve(str) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}




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

int main() {
  int N;
  cin >> N;
  vector<int> ca(N);
  for (int i = 0; i < N ; i++){
    cin >> ca.at(i);
    
  }
  
  sort(ca.begin(), ca.end());
  reverse(ca.begin(), ca.end());
  
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < N ; i++){
    if ( i % 2 == 0) alice += ca.at(i);
    else bob += ca.at(i);
    }
  
  cout << alice - bob << endl;
}


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

template<class T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}

int main(){
  int n, m; cin >> n >> m;
  vector<pair<int, int>> d(m);
  for(int i = 0; i < m; i++){
    int a, b; cin >> a >> b;
    d[i] = make_pair(a, b);
  }
  sort(d.begin(), d.end());
  int l = 0, r = 0;
  int ans = 0;
  for(int i = 0; i < m; i++){
    if(chmax(l, d[i].first)){
      if(l < r) chmin(r, d[i].second);
      else{
        chmax(r, d[i].second);
        ans++;
      }
    } 
  }
  cout << ans << endl;
}

Measured memory_bytes: 4048
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::cmp::{max, min, Ordering};

const MOD: u64 = 1000000007;

fn main() {
    let mut cin = Input::new();

    let mut N: usize = 0;
    cin = cin >> &mut N;

    N %= 10;
    if N == 2 || N == 4 || N == 5 || N == 7 || N == 9 {
        println!("hon");
    }
    if N == 0 || N == 1 || N == 6 || N == 8 {
        println!("pon");
    }
    if N == 3 {
        println!("bon");
    }
}

struct Input {
    data: Vec<String>,
}

impl Input {
    pub fn new() -> Input {
        Input{data: Vec::new()}
    }

    fn read(&mut self) {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        self.data = line.split_whitespace().rev().map(|s| s.parse::<String>().unwrap()).collect::<Vec<_>>();
    }

    pub fn get<T: core::str::FromStr>(&mut self) -> T {
        if self.data.len() == 0 {
            self.read();
        }
        return self.data.pop().unwrap().parse::<T>().ok().unwrap();
    }
}

impl<T: core::str::FromStr> std::ops::Shr<&mut T> for Input {
    type Output = Input;

    fn shr(mut self, rhs: &mut T) -> Input {
        *rhs = self.get::<T>();
        return self;
    }
}


Measured memory_bytes: 2116
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >> k;
	int l[n];
	for(int i=0;i<n;i++)
		cin >> l[i];
	sort(l,l+n);
	int sum=0;
	for(int i=0;i<k;i++)
		sum+=l[n-1-i];
	cout << sum << endl;
}

Measured memory_bytes: 256
//written by syzs
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int e,Pri[N>>1],n,f;
long long a[N],w[N],c[N];
bool pri[N],flag;
map <long long,int> cot;
map <long long,bool> jug;
void P(){
    pri[0]=pri[1]=1;
    for(long long i=2;i<=1e5;i++){
        if(!pri[i]){
            pri[i]=1;
            Pri[++e]=i;
            jug[i*i]=1;
        }
        for(int j=1;j<=e&&i*Pri[j]<=1e5;j++){
            pri[i*Pri[j]]=1;
            if(!(i%Pri[j])) break;
        }
    }
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    P();
    for(int i=1;i<=n;i++){
        w[i]=1;
        long long W=1,sto=1;
        for(int j=1;Pri[j]<=a[i]&&j<=2400;j++){
            long long v=Pri[j],tal=0;
            while(!(a[i]%v)) a[i]/=v,tal++;
            tal%=3;
            if(tal){
            	for(int _=1;_<=tal;_++) sto*=Pri[j];
            	for(int _=1;_<=3-tal;_++) W*=Pri[j];
            }
        }
		sto*=a[i];
        if(a[i]){
        	if(jug[a[i]]) W*=sqrt(a[i]);
        	else W*=a[i]*a[i];
        }
        if(sto==1) flag=1;
        if(!cot[sto]&&sto!=1){
            c[++f]=sto;
            w[f]=W;
        }
        cot[sto]++;
    }
    long long ans=0;
    for(int i=1;i<=f;i++) if(cot[c[i]]){
        ans+=max(cot[c[i]],cot[w[i]]);
        cot[c[i]]=cot[w[i]]=0;
    }
    if(flag) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 20224
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<size_t N> struct solve {

	lint lun[N + 5];

	constexpr solve() : lun() {

		for (int i = 1; i <= 9; i++) lun[i] = i;

		for (int st = 1, idx = 10; idx <= N; st++) {

		bool m_ok =( lun[st] % 10 != 0);
 lun[idx*m_ok] = lun[st] * 10 + lun[st] % 10 - 1;
idx+=m_ok;
			lun[idx++] = lun[st] * 10 + lun[st] % 10;

bool p_ok = (lun[st] % 10 != 9);

			lun[idx*p_ok] = lun[st] * 10 + lun[st] % 10 + 1;
idx+=p_ok;
			
		}

	}

};

solve<100000> S;

int main() {

	int N;
	scanf("%d", &N);
	printf("%lld", S.lun[N]);

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

int main() {
    int N, K;
    bool dislike[10] = {false};

    cin >> N >> K;

    for (int j = 0; j < K; ++j) {
        int t;
        cin >> t;
        dislike[t] = true;
    }

    for (int t = N; ; ++t) {
        bool ok = true;
        for (int u = t; u > 0 && ok; u /= 10) {
            if (dislike[u % 10]) {
                ok = false;
            }
        }
        if (ok) {
            cout << t << endl;
            return 0;
        }
    }

    return 0;
}


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

int main()
{
	int a, i, j, k;
	cin >> a;
	int N[a];
	for (i = 0; i < a; i++)cin >> N[i];
	j = 0;
	do {
		k = 0;
		for (i = 0; i < a; i++) {
			if (N[i] % 2 == 0)k += 1;
			N[i] /= 2;
		}
		if (k != a)break;
		j += 1;
	} while (j > 0);
	cout << j;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
   int a,b,c;
   scanf("%d %d %d",&a,&b,&c);
   int m1=a+b,m2=b+c,m3=a+c;
   if(m1<=m2)
   {
       if(m1<=m3)
        printf("%d",m1);
       else
         printf("%d",m3);
   }
   else
   {
       if(m2<=m3)
         printf("%d",m2);
         else
          printf("%d",m3);
   }

   return 0;
}



Measured memory_bytes: 128
N , M = map(int,input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)

for node0 in graph[0]:
    for node1 in graph[node0]:
        if node1 == N - 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

Measured memory_bytes: 38320
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  string s;
  char c;
  std::cin >> n;
  std::cin >> s;
  std::cin >> k;
  c=s[k-1];
  for (int i = 0; i < n; i++) {
      /* code */
      if(c!=s[i])s[i]='*';
  }
  std::cout << s << std::endl;
}

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

int main(void) {
	int n, k, ans = 1;
	cin >> n >> k;
	while (n) {
		if (ans * 2 < ans + k)
			ans = ans * 2;
		else
			ans = ans + k;
		n--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define INF 1000000007
#define PI 3.141592653589793

int main() 
{	ios;
	int t = 1;
	//cin>>t;
	while (t--) {
		int n;
		cin>>n;
		string s;
		cin>>s;
		ll r = 0, g = 0, b = 0, cnt = 0;
		for (int i = 0; i < n; i++) {
			if(s[i] == 'R') {
				r++;
			}
			if(s[i] == 'G') {
				g++;
			}
			if(s[i] == 'B') {
				b++;
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 1; j < n; j++) {
				if((i+j) < n && (i+j+j) < n) 
					if (s[i] != s[i+j] && s[i+j] != s[i+j+j] && s[i+j+j] != s[i])
						++cnt;
			}
		}
		ll ans = r*g*b - cnt;
		cout<<ans;
		cout<<"\n";
	}
    return 0; 
} 


Measured memory_bytes: 3588
import java.util.Scanner;

// https://atcoder.jp/contests/abc141/submissions/7542028がjavaだとTLEせず通るのかテスト
// StringBuilderだとどうなるか
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long K = Long.parseLong(sc.next());
        int Q = Integer.parseInt(sc.next());

        int[] A = new int[Q];
        for (int i = 0; i < Q; i++) {
            A[i] = Integer.parseInt(sc.next());
        }

        String ans = solve(N, Q, K, A);
        System.out.println(ans);
    }

    public static String solve(int n, int q, long k, int[] a) {
        long[] dp = new long[n];
        for (int i = 0; i < q; i++) {
            int winner = a[i];
            dp[winner - 1] = dp[winner - 1] + 1;
        }

        StringBuilder sb = new StringBuilder();
        for (long element : dp) {
            sb.append(q - k >= element ? "No\n" : "Yes\n");
        }
        return sb.toString();
    }
}



Measured memory_bytes: 48872
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int main(){
    string n, m;
    while(cin >> n >> m){
        int ans = 0;
        if(n.size() > m.size()) swap(n, m);
        for(int i=0; i < n.size(); i++){
            for(int j=i+1; j <= n.size(); j++){
                if(j-i <= ans) continue;
                string s = n.substr(i, j-i);
                if(m.find(s) != string::npos){ans = max(ans, (int)s.size());}
                else j = 40000;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1212
/*Rabbi Zidni Ilma*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define mod 1000000007
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

ll dp[100005],ar[100005];

int main()
{
	ll n,i;
    scl(n);
    for(i=1;i<=n;i++)
    scl(ar[i]);
    
    dp[n]=0;
    for(i=n-1;i>=1;i--)
    {
    	if(i==n-1)
    	dp[i]=dp[i+1]+abs(ar[i]-ar[i+1]);
    	else
    	dp[i]=min(dp[i+1]+abs(ar[i]-ar[i+1]),dp[i+2]+abs(ar[i]-ar[i+2]));
	}
    printf("%lld\n",dp[1]);
}



Measured memory_bytes: 5300
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> C(N), V(N);
  rep(i, N)
  {
    cin >> V[i];
  }
  rep(i, N)
  {
    cin >> C[i];
  }

  int ans = 0;
  for (int i = 0; i < N; ++i)
  {
    if (V[i] > C[i])
    {
      ans += V[i] - C[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const double PI=3.14159265358979323846;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

bool check_num(int i)
{
	int x = i;
	if ( x % 3 == 0 ){
		cout << " " << i;
		//goto END_CHECK_NUM;
		return true;
  	}

	return false;
}




void call(int n)
{
	int i = 1;

	for(;;){
		//CHECK_NUM:
		int x = i;
		if ( x % 3 != 0 ){
			for(;;){
				if ( x % 10 == 3 ){
					cout << " " << i;
					break;
				}
				x /= 10;
				if ( !x )
					break;
			}
		}
		else{
			cout << " " << i;
		}

		//END_CHECK_NUM:
		if (!( ++i <= n ))
			break;
	}

	cout << endl;
}

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

	call(n);

	return 0;
}




Measured memory_bytes: 3116
use std::io::{stdin, Read};

macro_rules! parse {
    ($iter: ident) => {
        $iter.next().unwrap().parse().unwrap()
    };
    ($iter: ident,2) => {
        (parse!($iter), parse!($iter))
    };
    ($iter: ident,3) => {
        (parse!($iter), parse!($iter), parse!($iter))
    };
    ($iter: ident,4) => {
        (parse!($iter), parse!($iter), parse!($iter), parse!($iter))
    };
    ($iter: ident, $n: ident) => {
        $iter.take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut iter = s.split_whitespace();
    let s = iter.next().unwrap();
    let t = iter.next().unwrap();
    let (i, j): (isize, isize) = parse!(iter, 2);
    let u = iter.next().unwrap();
    if u == s {
        println!("{} {}", i - 1, j);
    } else {
        println!("{} {}", i, j - 1);
    }
}


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

int main()
{
    long long t,n,m,i,j,k,x=0,y=0,z;
    cin>>n>>m;
    if(n==m){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

class Dijkstra{ //O((N+M)logN)
    private:
        vector<vector<pair<int,long long>>> graph; //pair<next_path,cost>
        vector<long long> total_cost;
    
    public:
        void aDijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
            priority_queue<
                pair<int,long long>,
                vector<pair<int,long long>>,
                greater<pair<int,long long>>> q;
            vector<long long> cost(size,1e18+7);
            cost[start] = 0;
            q.push(make_pair(start,0ll));
            while (!q.empty()){
                auto now = q.top();
                q.pop();
                int prev = now.first;
                if( cost[prev] < now.second) continue;
                for (auto next : graph[prev]){
                    if (cost[next.first] <= cost[now.first] + next.second) continue;
                    cost[next.first] = cost[now.first] + next.second;
                    q.push(next);
                }
            }
            total_cost = cost;
        }
        long long get_cost(int goal){ return total_cost[goal]; }
};
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n,x,y; cin >> n >> x >> y;
    x--; y--;
    vector<vector<pair<int,ll>>>  graph(n);
    graph[x].push_back(make_pair(y,1));
    graph[y].push_back(make_pair(x,1));
    rep(i,0,n-1){
        graph[i].push_back(make_pair(i+1,1));
        graph[i+1].push_back(make_pair(i,1));
    }
    int co[100010]={};
    vector<Dijkstra> d(n);
    rep(i,0,n){
        d[i].aDijkstra(graph,i,n);
        rep(j,i+1,n){
            co[d[i].get_cost(j)]++;
        }
    }
    rep(i,1,n){
        cout << co[i] << endl;
    } 
}

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

int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  rep(i, n) cin >> l[i];

  vector<char> cl = {'a', 'b', 'c', 'x'};

  queue<vector<char>> q;
  for (char c : cl) {
    vector<char> comb;
    comb.push_back(c);
    q.push(comb);
  }

  int ans = 100000;
  while (!q.empty()) {
    vector<char> comb = q.front();
    q.pop();
    if (comb.size() == n) {
      int a1 = 0, b1 = 0, c1 = 0, g = 0;
      rep(i, n) {
        if (comb[i] == 'a') a1 += l[i];
        if (comb[i] == 'b') b1 += l[i];
        if (comb[i] == 'c') c1 += l[i];
        if (comb[i] == 'x') g++;
      }

      if (a1 == 0 || b1 == 0 || c1 == 0) continue;

      int m = (n - g - 3) * 10;

      m += abs(a - a1);
      m += abs(b - b1);
      m += abs(c - c1);

      ans = min(ans, m);
      continue;
    }

    for (char c : cl) {
      vector<char> tmp = comb;
      tmp.push_back(c);
      q.push(tmp);
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3840
def main():
    #infile = open("compprog.txt", mode="r")
    #n, m = [int(x) for x in infile.readline().split()]
    n, m = [int(x) for x in input().split()]
    a = []
    b = []
    for _ in range(n):
        #a.append(infile.readline())
        a.append(input())
    for _ in range(m):
        #b.append(infile.readline())
        b.append(input())
    if solve(a, b, n, m):
        print("Yes")
    else:
        print("No")


def solve(a, b, n, m):
    for row in range(n - m + 1):
        for col in range(n - m + 1):
            if check(a, row, col, b, m):
                return True
    return False


def check(a, row, col, b, m):
    for this_row in range(row, row + m):
        for this_col in range(col, col + m):
            if a[this_row][this_col] != b[this_row - row][this_col - col]:
                return False
    return True


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using P = pair <int,int>; //to, cost
using WeightedGraph = vector<vector <P>>; //to cost
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; cin>>n;
    vector <int> a(n);
    rep(i,n) cin>>a[i]; 
    sort(a.begin(),a.end());
    rep(i,n-1){
        if(a[i] == a[i+1]) {cout<<"NO"<<endl; return 0;}
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<cmath>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;

ll A[110000];

int main(){
  int N;
  ll M;

  cin>>N>>M;

  for(int i=1;i<=N;i++){
    cin>>A[i];
    A[i]+=A[i-1];
    A[i]%=M;
  }
  sort(A,A+N+1);

  ll pre=-1,ans=0;
  int count=0;
  for(int i=0;i<=N;i++){
    //cout<<A[i]<<endl;
    if(pre==A[i]){
      count++;
      ans+=count;
    }else{
      count=0;
      pre=A[i];
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024