akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define ull         unsigned long long int
#define ll          long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> 
 
const long long INF = (long long) 1e11+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

ll power(ll x,ll y,ll m){
  ll res=1;
  while(y>0){
    if(y%2) res=(x%m*res%m)%m;
    x=(x%m*x%m)%m;    
    y=y/2;
  }
  
  return res%m;
}
 
ll modinv(ll x){
  return power(x,hell-2,1);
}

ll gcd(ll a,ll b){
    while(b!=0){
		ll t=b;
		b=a%t;
		a=t;
	}
	return a;
}    
    
void fastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
} 
vector<vector<int>> comb1,comb2;

void func(int ind,vi& temp,vi cur,int c){
    int sz=sz(temp);
    
    if(ind==sz){
        if(c==0)
        comb1.pb(cur);
        else
        comb2.pb(cur);
        
        return;    
    }
    
    func(ind+1,temp,cur,c);
    cur.pb(temp[ind]);
    func(ind+1,temp,cur,c);
    cur.pop_back();
    
}

bool chk(vector<int> c1,vector<int> c2,vector<vector<char>> mat,int k){
    int n=sz(mat);
    int m=sz(mat[0]);
    
    for(auto u:c1){
        forn(i,0,m)
        mat[u][i]='.';   
    }
    
    for(auto u:c2){
        forn(i,0,n)
        mat[i][u]='.';   
    }
    
    int cnt=0;
    
    forn(i,0,n){
        forn(j,0,m){
            if(mat[i][j]=='#')
            cnt++;
        }
    }
    
    return cnt==k;
}

void solve(){
    int n,m,k;
    cin>>n>>m>>k;
    
    vector<vector<char>> mat(n,vector<char>(m));
    
    forn(i,0,n){
        forn(j,0,m){
            cin>>mat[i][j];
        }
    }
    
    vi temp;
    
    temp.resize(n);
    
    forn(i,0,n){
        temp[i]=i;
    }
                  
    func(0,temp,{},0);
      
    temp.resize(m);
    
    forn(i,0,m){
        temp[i]=i;
    }            
      
    func(0,temp,{},1);
    
    int sz1=sz(comb1);
    int sz2=sz(comb2);

    int ans=0;
    
    for(int i=0;i<sz1;i++){
        for(int j=0;j<sz2;j++){
            if(chk(comb1[i],comb2[j],mat,k))
            ans++;
        }
    }
    cout<<ans;
}    
    
int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;    
   
   while(test--)
   solve();
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))

int main()
{
	int n, m, c, ans = 0;
	cin >> n >> m >> c;
	vector<int> b(m);
	rep(i, 0, m - 1)cin >> b[i];
	rep(i, 0, n - 1)
	{
		int a, res = 0;
		rep(j, 0, m - 1)
		{
			cin >> a;
			res += a * b[j];
		}
		res += c;
		if (res > 0) ++ans;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)


int power(ll x, unsigned int y)  
{  
	ll p=mod;
    ll res = 1;      
  
    x = x % p; 
               
   
    if (x == 0) return 0; 
  
    while (y > 0)  
    {  
       
        if (y & 1)  
            res = (res*x) % p;  
  
       
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}  

int main()
{
	ll n;
	cin>>n;
	vector<ll> a(n);
	ll ans=0;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<61;i++)
	{
		ll cnt=0;
		for(int j=0;j<n;j++)
		{
			if((a[j]>>i)&1) cnt++;
		}
		ll t=((power(2,i )* cnt)%mod * (n-cnt))%mod;
		ans=(ans+t)%mod;
		//ans%=mod;
	}
	cout<<ans;
}


Measured memory_bytes: 2560
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] ans = new int[N];
        for (int i = 2; i <= N; i++) {
            ans[sc.nextInt()-1]++;
        }

        StringBuilder a = new StringBuilder();
        for (int i = 0; i < N; i++) {
            a.append(ans[i]).append('\n');
        }

        System.out.print(a);
    }
}


Measured memory_bytes: 50368
#include <stdio.h>

int main(void)
{
	int n;
	int ii;
	int i;
	float k1, k2;
	float x[4], y[4];
	
	scanf("%d", &n);
	for (ii = 0; ii < n; ii++){
		for (i = 0; i < 4; i++){
			scanf("%f %f", &x[i], &y[i]);
		}
		k1 = (y[1] - y[0]) / (x[1] - x[0]);
		k2 = (y[3] - y[2]) / (x[3] - x[2]);
		
		if (k1 == k2){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 616
#include <stdio.h>
int main(void){
    // Your code here!
    int a , b;
    scanf("%d %d", &a, &b); /* 変数a, bに２つの整数をこの順番で入力する */ 
    printf("%d %d\n" , a*b,2*(a+b));
    return 0;
    
}



Measured memory_bytes: 2040
#pragma region head
    #include <bits/stdc++.h>
    #include <atcoder/all>
    using namespace atcoder;
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define bit(n) (1LL<<(n))
    template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
    template<class T> inline bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main(){
    int _t; cin >> _t;
    while(_t--){
        ll n,m,a,b; cin >> n >> m >> a >> b;
        ll ans = floor_sum(n, m, a, b);
        cout << ans << '\n';
        
    }
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(a, b);
    if (b == 100) {
        cout << 101;
    } else {
        cout << b;
    }
    rep(i, a) {
        cout << "00";
    }
    cout << endl;

    return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b;
  cin >> a >> b;
  cout << max(a + b, max(a - b, a * b)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=(ll)1e9;

int main(){
    int Q;
    cin>>Q;
    vector<int> l(Q),r(Q);
    for (int i = 0; i < Q; ++i) {
        cin>>l[i]>>r[i];
    }

    vector<int> prime;
    vector<bool> is_prime(100001,false),is_2017(100001,false);
    prime.push_back(2);
    is_prime[2]=true;

    for(int i=3;i<=100000;i+=2){
        bool f=true;
        for(auto p:prime){
            if(i%p==0){
                f=false;
                break;
            }
        }
        if(f) {
            prime.push_back(i);
            is_prime[i]=true;
        }

    }

    for(int i=1;i<=100000;i+=2){
        if(is_prime[i]&&is_prime[(i+1)/2]) is_2017[i]=true;
    }

    vector<int> ruiseki(100002,0);
    for(int i=0;i<=100001;i++){
        ruiseki[i+1]=(is_2017[i]?1:0)+ruiseki[i];
    }

    for(int i=0;i<Q;i++){
        int ans=ruiseki[r[i]+1]-ruiseki[l[i]];
        cout<<ans<<endl;
    }


    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define endl "\n"
#define maX 1000005
	int main(){
		char x;
		cin>>x;
		if(isupper(x))
		cout<<'A';
		else
		cout<<'a';
		return 0;
	}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int a, b;

int main(void) {
  // Here your code !
  scanf("%d %d", &a, &b);

  printf("%d\n", max(a + b, max(a - b, a * b)));
  
  return 0;
}


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

#define int long long

#define _   int v, int tl, int tr, int l, int r
#define tm  (tl + tr >> 1)
#define sol v+v, tl, tm, l, r
#define sag v+v+1, tm+1, tr, l, r
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 2e5 + 5;

int P[N],S[N],I[N],n,ans = 1LL * mod * mod;

void f(int i, int j, int k){
    int a = P[i];
    int b = P[j] - P[i];
    int c = P[k-1] - P[j];
    int d = S[k];
    if(a == 0 || b == 0 || c == 0 || d == 0) return;
    ans = min(ans , max(max(a,b),max(c,d)) - min(min(a,b),min(c,d)));
}

signed main(){
    cin >> n;
    int j = 1;
    for(int i=1; i<=n; i++){
        scanf("%lld", &P[i]);
		P[i] += P[i-1];
        for(; j < i && 2*P[j] <= P[i];) j++;
        I[i] = j-1;
    }
    
	j = n;
    for(int i=n; i>=2; i--){
		S[i] = S[i+1] + P[i]-P[i-1];
        for(; j > i && 2*S[j] <= S[i];) j--;
    	f(I[i-1], i-1, j);
        f(I[i-1], i-1, j+1);
        f(I[i-1]+1, i-1, j);
        f(I[i-1]+1, i-1, j+1);
    }
        
    cout << ans;    
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    #define REVERSE(v) reverse(ALL(v))
    #define display(x) trav(a,x) cout<<a<<" ";cout<<endl
    #define debug cerr<<"bhau"<<endl
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        std::cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}
    void amax(int &a,int b){a=max(a,b)%M; }
    void amin(int &a,int b){ a=min(a,b)%M;}
    void inc(int &a,int b){a=(a+b)%M;}
    void dec(int &a,int b){a=(a-b+M)%M;}


    
     int solve()
     {  
        int a,b,c;cin>>a>>b;
        int cur=1;
        int count=0;
        while(cur<b){
            cur+=a-1;
            count++;
        }
        cout<<count;
        r0   
     }
    signed main()
    {   
        asdf
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

int     main() {
        int N, L;
        cin >> N >> L;
        int S=(2*L+N-1)*N/2;
        if ( 0 < L*(L+N-1) ) {
                if (abs(L)<abs(L+N-1)) S -= L;
                else S -= L+N-1;
        }
        cout << S << endl;
        return 0;
}

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

class Calc {
  private:
    string str;
    vector<char> p;
    string::iterator it;

  public:
    Calc (string str, vector<char> p) {
        this->str = str;
        this->p   = p;
        it = this->str.begin();
    }

    ll get_val(ll a, char op, ll b)
    {
        switch (op) {
            case '*':
                return a * b;
            case '+':
                return a + b;
            case '-':
                return a - b;                
        }
    }

    ll f0(int pt)
    {
        ll res = 0;
        if (*it == '(') {
            ++it;
            if (pt == 0) {
                res = f3(0);
            } else if (pt <= 2) {
                res = f2(pt);   
            } else {
                res = f1(3);
            }
            ++it;
        } else {
            while (isdigit(*it)) {
                res *= 10LL;
                res += (ll)(*it - '0');
                ++it;
            }
        }
        return res;
    }

    ll f1(int pt)
    {
        ll res = f0(pt);
        while (*it == p[0] ||
               (pt >= 2 && *it == p[1]) ||
               (pt >= 3 && *it == p[2])) {
            
            if (*it == p[0]) {
                ++it;            
                res = get_val(res, p[0], f0(pt));
            } else if (pt >= 2 && *it == p[1]) {
                ++it;
                res = get_val(res, p[1], f0(pt));
            } else if (pt >= 3 && *it == p[2]) {
                ++it;
                res = get_val(res, p[2], f0(pt));
            }            
        }
        return res;
    }

    ll f2(int pt)
    {
        ll res = f1(pt);
        while ((pt <= 1 && *it == p[1]) ||
               (pt >= 1 && *it == p[2])) {
            
            if (pt <= 1 && *it == p[1]) {
                ++it;
                res = get_val(res, p[1], f1(pt));                                
            } else if (pt >= 1 && *it == p[2]) {
                ++it;
                res = get_val(res, p[2], f1(pt));                
            }
                   
        }
        return res;
    }

    ll f3(int pt)
    {
        ll res = f2(0);
        while (*it == p[2]) {
            ++it;
            res = get_val(res, p[2], f2(0));
        }
        return res;
    }
};

int main()
{
    string str;
    cin >> str;      
    vector<char> p = {'*', '+', '-'};
    ll res = LLONG_MIN;    
    do {
        for (int i = 0; i < 4; i++) {
            Calc  c(str, p);
            ll r = -1;
            if (i == 0) {
                r = c.f3(0);
            } else if (i <= 2) {
                r = c.f2(i);
            } else {
                r = c.f1(3);
            }
            res = max(res, r);
        }
    } while (next_permutation(p.begin(), p.end()));
    cout << res << endl;    
    return 0;
}

Measured memory_bytes: 3192
N = int(input())
S = []
for row in range(N):
    S.append(str(input()))

nAC = S.count('AC')
nWA = S.count('WA')
nTLE = S.count('TLE')
nRE = S.count('RE')

print('AC x', int(nAC))
print('WA x', int(nWA))
print('TLE x', int(nTLE))
print('RE x', int(nRE))

Measured memory_bytes: 16156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n;
  cin >> n;
  vector<char> c(n);
  rep(i, n) cin >> c[i];

  vector<vector<ll>> dp(n + 10, vector<ll>(n + 10, 0));
  dp[0][0] = 1;
  rep(i, n) {
    if (c[i] == 'U') {
      rep(j, i + 1) {
        dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
        dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * (i - j) % mod) % mod;
      }
    }
    else if (c[i] == '-') {
      rep(j, i + 1) {
        dp[i + 1][j + 1] = dp[i][j];
      }
    }
    else {
      rep(j, i + 1) {
        dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * (i - j) % mod) % mod;
        dp[i + 1][j + 2] = (dp[i + 1][j + 2] + dp[i][j] * (i - j) * (i - j) % mod) % mod;
      }
    }
  }
  cout << dp[n][n] << '\n';






  
  return 0;
}


Measured memory_bytes: 3296
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>
#include <cassert>
using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    long double L;
    cin >> L;
    long double l = L / 3;
    long double ans = pow(l, 3);
    cout << fixed << setprecision(10) << ans << '\n';
}


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

int main() {
  string N;
  cin >> N;
  if((N[0] == N[1]) && (N[1] == N[2])){
    cout << "Yes" << endl;
  }else if((N[1] == N[2]) && (N[2] == N[3])){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
        t: Chars,
    };
    let mut ans = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

int main() {
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;
  bool a = A1 <= A2;
  bool b = A1 <= A3;
  bool c = A2 <= A3;
  bool d = A2 <= A1;
  bool e = A3 <= A1;
  bool f = A3 <= A2;
  
  if (a && c) {
    cout << (A3-A2)+(A2-A1) << endl;
  }
  else if (b && f) {
    cout << (A2-A3)+(A3-A1) << endl;
  }
  else if (d && b) {
    cout << (A3-A1)+(A1-A2) << endl;
  }
  else if (c && e) {
    cout << (A1-A3)+(A3-A2) << endl;
  }
  else if (e && a) {
    cout << (A2-A1)+(A1-A3) << endl;
  }
  else if (f && d) {
    cout << (A1-A2)+(A2-A3) << endl;
  }
}

Measured memory_bytes: 3648
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) cerr << #x << " = " << (x) << " " << endl;
#else
const bool test = false;
#define dump(x) 
#define dumpl(x) 
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
 
template<typename T>
T gcd(T a, T b)
{
  T c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}

int pow(int a, int b) {
  int res = 1;
  rep(i, b) res *= a;
  return res;
}
 
class Solver {
public:
  int A, B, C, D;

  void solve() {
    cin >> A >> B >> C >> D;
    int res = min(A, B) + min(C, D);
    cout << res << endl;
  }
};
 
signed main()
{
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {    
  //     auto ptr = new Solver();
  //     ptr->solve();
  //     delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

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;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
  ll N,K;cin>>N>>K;
  vl A(N);
  rep(i,N)cin>>A[i];
  for(int i= K;i<N;i++){
    if(A[i]>A[i-K])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}







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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if ( H == 0 && W == 0 ) break;
        
        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++){
                if ( i == 0 || i == H-1 || j == 0 || j == W-1 ){
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3068
#include <stdio.h>

int main(){
    int h, w;
    int i, j;
    
    scanf("%d %d\n", &h, &w);
    
    while((h!=0) && (w!=0)){
        for (j=0;j<h;j++){
            for(i=0;i<w;i++){
                if ((j+i)%2==0){
                    printf("#");                   
                } else {
                    printf(".");
                }

            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d\n", &h, &w);        
    }
    

    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;

int main() {
    fast();
    /*ll t;
    cin>>t;
    while(t--)
    {
       
    }*/
    ll m=1000000007;
    ll h,w;
    cin>>h>>w;
    string s[h];
    ll dp[h][w];
    for(ll i=0;i<h;i++)
    cin>>s[i];
    if(s[0][0]=='#')
    dp[0][0]=0;
    else
    dp[0][0]=1;
    for(ll i=1;i<w;i++)
    {
        if(s[0][i]=='.')
        dp[0][i]=dp[0][i-1]%m;
        else
        dp[0][i]=0;
    }
    for(ll i=1;i<h;i++)
    {
        for(ll j=0;j<w;j++)
        {
            if(j>0)
            {
                if(s[i][j]=='.')
                dp[i][j]=(dp[i-1][j]%m+dp[i][j-1]%m)%m;
                else
                dp[i][j]=0;
            }
            else
            {
                if(s[i][j]=='.')
                dp[i][j]=dp[i-1][j]%m;
                else
                dp[i][j]=0;
            }
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    char str[4];
    int contador = 0;
    for (int i = 0; i < 4; i++)
    {
        cin >> str[i];
    }
    for (int i = 0; i < 4; i++)
    {
        for (int j = i + 1; j < 4; j++)
        {
            if (str[i] == str[j])
            {
                contador++;
            }
        }
    }
    if (contador == 2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

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

int main()
{
    int n,res;
    
    scanf("%d",&n);
    
    if(n > 99999)
    {
        res = 90909;
    }
    else if(n > 9999)
    {
        res = (n - 9999) + 909;
    }
    else if(n > 999)
    {
        res = 909;
    }
    else if(n > 99)
    {
        res = (n - 99) + 9;
    }
    else if(n > 9)
    {
        res = 9;
    }
    else
    {
        res = n;
    }
    
    printf("%d\n",res);
    
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n, int m) {
	int digits = 0;
	while (n != 0) {
		n /= m;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum = 0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


//入力された文字列が回文か判断してboolを返す
bool is_kaibun(string s) {
	string s_r(s.rbegin(), s.rend());
	return (s == s_r);
}


void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }




//問題文を落ち着いて読む！
//型に注意！！
//出力例もちゃんと全部見る！！！！！
int main() {
	ll n, sum = 0;
	cin >> n;
	rep(i,1, n+1) {
		if (i % 3 != 0 && i % 5 != 0)sum += i;
	}

	cout << sum << endl;
	system("pause");
	return 0;
}


Measured memory_bytes: 3748
def turn(n)
    if n % 2 == 1
        n -= 1
    end
    return n/2
end

a,b,k = gets.chomp.split.map(&:to_i)
for i in 1..k
    if i % 2 == 1
        temp = turn(a)
        a = temp
        b += temp
    else
        temp = turn(b)
        b = temp
        a += temp
    end
end

puts "#{a} #{b}"

Measured memory_bytes: 1788
#include <stdio.h>
int main(){
	double w;
	while(scanf("%lf",&w)!=EOF){
	if(w<=48.00)puts("light fly");
	if(48.00<w&&w<=51.00)puts("fly");
	if(51.00<w&&w<=54.00)puts("bantam");
	if(54.00<w&&w<=57.00)puts("feather");
	if(57.00<w&&w<=60.00)puts("light");
	if(60.00<w&&w<=64.00)puts("light welter");
	if(64.00<w&&w<=69.00)puts("welter");
	if(69.00<w&&w<=75.00)puts("light middle");
	if(75.00<w&&w<=81.00)puts("middle");
	if(81.00<w&&w<=91.00)puts("light heavy");
	if(91.00<w)puts("heavy");
	}
return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }
ll MOD = 1000000007;


int calc(string s, char c,int n){
	int count = 0;
	bool perfect = true;
	if (n < 1)return 0;
	for (int i = 0; i < n - 1; i++) {
		if (s[i] != c) {
			perfect = false;
			s[i] = s[i+1];
		}
	}
	if (perfect) {
		return s[n - 1] == c ? 0 : 1;
	}
	else {
		return 1 + calc(s, c, n - 1);
	}
}
int main() {
	string s;
	cin >> s;
	int ans = s.length();
	for (char c = 'a'; c <= 'z'; c++) {
		ans = min(ans, calc(s, c, s.length()));
		//cout << c << ":" << calc(s, c, s.length()) << endl;
	}
	print(ans);
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
	int n,w;
	cin>>n>>w;

	vector< pair<int,int> > a(n);

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

	int dp[w+1];
	fill(dp,dp+w+1,0);

	for(int i=0;i<n;i++)
	{
		for(int j=w;j>=a[i].second;j--)
		{
				dp[j] = max(dp[j],dp[j - a[i].second ] + a[i].first);
		}
//		for(int i=0;i<=w;i++)	cout<<dp[i]<<" ";
//		cout<<"\n";
	}
	
	cout<<dp[w];
}

Measured memory_bytes: 1024
#!/usr/bin/env python
# coding: utf-8

# In[24]:


# S = input()


# In[25]:


# mylist = list(sorted(set(S)))
# abc = "abcdefghijklmnopqrstuvwxyz"
# for i in range(len(abc)):
#     if mylist[i] != abc[i]:
#         print(abc[i])
#         break
# else:
#     print("None")


# In[ ]:


s = input()
chars = set('abcdefghijklmnopqrstuvxwyz')
x = list(sorted(chars - set(s)))
if len(x):
    print(x[0])
else:
    print('None')



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

class Problem {
    public static void Main() {
        Console.ReadLine();
        var data = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Console.Write(data.Min() + " ");
        Console.Write(data.Max() + " ");
        Console.WriteLine(data.Sum());
    }
}


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


int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    rep(i,m) cin >> a[i];

    int sum1=0,sum2=0;
    rep(i,m){
        if(a.at(i) < x){
            sum1 ++;
        }
        else if(a.at(i) > x){
            sum2 ++;
        }
    }
    cout << min(sum1,sum2) << endl;

}

Measured memory_bytes: 3628
X, N = map(int, input().split())
p = list(map(int, input().split()))
tmp = 101
ans = 101
for i in range(-100, 201):
    if i not in p:
        if tmp == abs(X-i):
            if ans > i:
                ans = i
        elif tmp >= abs(X-i):
            ans = i
            tmp = abs(X-i)
print(ans)



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

int main()
{
    ll n;
    cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++) cin>>a[i];

    vector<ll>ans;
    for(ll i=n;i>0;i--)
    {
        ll j=i;
        while(j>0)
        {
            if(j == a[j])   break;
            j--;
        }
        if(j==0)
        {
            cout<<-1;
            return 0;
        }
        else
        {
            ans.push_back(j);
            while(j<n)
            {
                a[j] = a[j+1];
                j++;
            }
        }
    }

    reverse(ans.begin(),ans.end());
    for(auto it:ans)    cout<<it<<"\n";

    return 0;
}


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

using namespace std;

const int MAX_VAL = 200000;

bool is_prime[MAX_VAL+1];

void calc_prime(int x){
    is_prime[0] = is_prime[1] = false;

    for(int i=0;i<=MAX_VAL;++i)
        is_prime[i] = true;

    for(int i=2; i*i <= x; ++i){
        if(is_prime[i]){
            for(int j=2; i*j <= MAX_VAL; ++j){
                is_prime[i*j] = false;
            }
        }
    }

}

int main(void){
    int x;
    cin >> x;
    calc_prime(x);

    for(int i=x; i<= MAX_VAL; ++i){
        if(is_prime[i]){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
 
public class Main {
	static final long MOD = 1000000007L;

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.ni();
		int[] nums = new int[N];
		int[] primes = new int[1000001];
		for (int i = 0; i < N; i++) {
			nums[i] = sc.ni();
			int num = nums[i];
			for (int p = 2; p*p <= nums[i]; p++) {
				int pow = 0;
				while (num % p == 0) {
					num /= p;
					pow++;
				}
				primes[p] = Math.max(primes[p],pow);
			}
			if (num > 1 && primes[num] == 0) {
				primes[num] = 1;
			}
		}
		
		int[][] smallPowers = new int[1001][21];
		for (int i = 2; i <= 1000; i++) {
			smallPowers[i][0] = 1;
			int j = 1;
			while (smallPowers[i][j-1]*i <= 1000000) {
				smallPowers[i][j] = smallPowers[i][j-1]*i;
				j++;
			}
		}
		HashSet<Integer> lcm = new HashSet<Integer>();
		for (int i = 2; i <= 1000000; i++) {
			if (primes[i] > 0) {
				lcm.add(i);
			}
		}
		long ans = 0;
		for (int i = 0; i < N; i++) {
			int num = nums[i];
			long B = 1;
			for (int prime: lcm) {
				int powI = 0;
				while (num % prime == 0) {
					num /= prime;
					powI++;
				}
				int pow = primes[prime]-powI;
				if (prime <= 1000) {
					B *= smallPowers[prime][pow];
				} else if (pow == 1){
					B *= prime;
				}
				B %= MOD;
			}
			ans += B;
			ans %= MOD;
		}
		pw.println(ans);
		pw.close();
	}
	
	//Find the GCD of two numbers
	public static long gcd(long a, long b) {
		if (a < b) return gcd(b,a);
		if (b == 0)
			return a;
		else
			return gcd(b,a%b);
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 30604
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int B[] = new int[M];
		for(int i = 0; i < M; i++) {
			B[i] = sc.nextInt();
		}
		int A[][] = new int[N][M];
		int ans = 0;
		for(int i = 0; i < N; i++) {
			int temp = C;
			for(int j = 0; j < M; j++) {
				A[i][j] = sc.nextInt();
				temp = temp + A[i][j] * B[j];
				//System.out.println(temp);
			}
			//System.out.println(temp + ":");
			if(temp > 0) ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 25428
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, m, x, c[12], a[12][12] = {0};
	int cost = 1e9;
	scanf("%d%d%d", &n, &m, &x);
	for (int i = 0; i < n; i++) {
		scanf("%d", &c[i]);
		for (int j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (int bit = 0; bit < (1 << n); bit++) {
		int u[12] = {0};
		int co = 0;
		for (int i = 0; i < n; i++) {
			if ((bit >> i) & 1) {
				co += c[i];
				for (int j = 0; j < m; j++) {
					u[j] += a[i][j];
				}
			}
		}
		bool isOK = true;
		for (int i = 0; i < m; i++) {
			if (u[i] < x) {
				isOK = false;
				break;
			}
		}
		if (isOK && cost > co) {
			cost = co;
		}
	}
	printf("%d\n", cost == (int)1e9 ? -1 : cost);
	return 0;
}

Measured memory_bytes: 1736
n,k,*t=map(int,open(0).read().split())
e=[set()for _ in[0]*n]
for a,b in zip(t[::2],t[1::2]):
  e[a-1]|={b-1}
  e[b-1]|={a-1}
c,q=k,[0]
while q:
  v,i=q.pop(),1
  for w in e[v]:
    c=c*(k-i-(v>0))%(10**9+7)
    e[w]-={v}
    q+=w,
    i+=1
print(c)

Measured memory_bytes: 97924
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    bool a=false;
    for(int i=0;i<s.size();i++){
        string b=s;
        b.erase(0 ,b.size()-1);
        //cout << b << " ";
        s.erase(s.size()-1);
        s.insert(0,b);
        //cout<<s<<endl;
        if(s==t){
            a=true;
            break;
        }
    }

    if(a) cout << "Yes" << endl;
    else cout << "No" <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
	long N,i,temp,c=0;
	vector<long> A,B;
	cin>>N;
	for(i=0;i<N+1;i++){
		cin>>temp;
		A.push_back(temp);
	}
	for(i=0;i<N;i++){
		cin>>temp;
		B.push_back(temp);
	}
	for(i=0;i<N;i++){
		if(A.at(i)>=B.at(i)){
			c+=B.at(i);
		}else{
			if(A.at(i)+A.at(i+1)<B.at(i)){
				c+=A.at(i)+A.at(i+1);
				A.at(i+1)=0;
			}else{
				c+=B.at(i);
				A.at(i+1)-=B.at(i)-A.at(i);
			}
		}
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  string s; cin >> s;
  vector<char> res{};
  for (const auto& c : s) {
    if (c != 'B') {
      res.push_back(c);
    } else {
      if (!res.empty())
        res.pop_back();
    }
  }
  string ans{res.begin(), res.end()};
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

int x,y;
char ti[30][30];
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
int sum=0;

bool valid(int i,int j)
{
	return(i>=0&&i<y&&j>=0&&j<x);
}

void dfs(int m,int n)
{
	sum++;
	ti[m][n]='#';
	for(int i=0;i<4;i++)
	{
		int x,y;
		x=m+dx[i];
		y=n+dy[i];
		if(valid(x,y) && ti[x][y]=='.')
		  dfs(x,y);
	}
}

int main()
{
	int m,n;
	while(cin >> x >> y)
	{
		sum=0;
		if(!x&&!y)
		  break;
		for(int i=0;i<y;i++)
		   for(int j=0;j<x;j++)
		   {
		   	    cin >> ti[i][j];
		   	    if(ti[i][j]=='@')
		   	    {
		   	    	m=i;
		   	    	n=j;
				}
		   }
		dfs(m,n);
	    cout << sum << endl;
	}
}


Measured memory_bytes: 3016
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

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

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N, M; cin >> N >> M;
  vector<P> vec(M);
  rep(i, M) cin >> vec[i].second >> vec[i].first;
  sort(vec.begin(), vec.end());

  int ans = 1;
  int last = vec[0].first;
  for (int i = 0; i < M; ++i){
    if (vec[i].second >= last) {
      ans++;
      last = vec[i].first;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include <vector>
using namespace std;
   
int Merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  int L[n1+1],R[n2+1];
     
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=1000000000;
  R[n2]=1000000000;
     
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
    }
  }
  return right-left;
}
   
int Merge_Sort(int A[],int left,int right){
  int mid,res=0;
  if(left+1<right){
    mid=(left+right)/2;
   
    res+=Merge_Sort(A,left,mid);
    res+=Merge_Sort(A,mid,right);
    res+=Merge(A,left,mid,right);
       
  }
  return res;
}

void HeapBuild(vector<int> &vec, int root, int len) {
    int lchild = root * 2 + 1;
    if (lchild < len) {
        int flag = lchild;  // 保存左右孩子节点中的最大值下标
        int rchild = lchild + 1;
        if (rchild < len) {
            if (vec[rchild] > vec[flag]) {
                flag = rchild;
            }
        }
 
        if (vec[root] < vec[flag]) {
            std::swap(vec[root], vec[flag]);
            HeapBuild(vec, flag, len);
        }
    }
}
 
void HeapSort(vector<int> &vec) {
    for (int i = vec.size() / 2; i >= 0; --i) {
        HeapBuild(vec, i, vec.size());
    }
 
    for (int j = vec.size() - 1; j > 0; --j) {
        std::swap(vec[0], vec[j]);
        HeapBuild(vec, 0, j);
    }
}

int main(){
  int i,x,n,S[500000]; 
  cin>>n;
  for(i=0;i<n;i++)cin>>S[i];

  vector<int> vec(S,S + n);
  HeapSort(vec);
   
  x=Merge_Sort(S,0,n);
     
  for(i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<vec[i];
  }
  cout<<endl;
  cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 8500