akhauriyash/Code-Regression huggingface dataset:
/**
*	  Name: Ajay Subhash Jadhav
*	  Institute: International Institute of Technology Hyderabad 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void inputread()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}
int D,G,P[10],C[10];
int dp[11][401010];

int main()
{      
  fastio();
 
  int D, G;
  cin >> D >> G;
  G /= 100;
  vector<int> p;
  vector<int> c;
  for (auto i = 0; i < D; i++)
  {
    int x, y;
    cin >> x >> y;
    p.pb(x);
    c.pb(y/100);
  }
  int ans = inf;
  for (auto i = 0; i < (1 << D); i++)
  {
    int cnt = 0;
    int score = 0;
    for (auto j = 0; j < D; j++)
    {
      if ((i >> j) & 1)
      {
        cnt += p[j];
        score += p[j] * (j + 1) + c[j];
      }
    }
    if (score >= G)
    {
      ans = min(ans, cnt);
      continue;
    }
    for (auto j = D - 1; j >= 0; j--)
    {
      if (!((bool)((i >> j) & 1)))
      {
        int tmp = p[j];
        while (tmp > 0)
        {
          score += j + 1;
          tmp--;
          cnt++;
          if (score >= G)
          {
            ans = min(ans, cnt);
            break;
          }
        }
        break;
      }
    }
  }
  cout << ans << endl;

}

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

#define ll long long
#define pi pair<int,int>
#define ppi pair<pi,pi>
#define mp make_pair
#define fr first
#define sc second

using namespace std;


int main(){

    ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);

    ll n , sum = 0;
    cin >> n;
    for(int i = 1;i <= n;i++){
        if(i % 3 == 0 || i % 5 == 0)continue;
        sum+=i;
    }
    cout << sum << '\n';


    return 0;
}


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

int main(){
  int n;
  int h;
  int i,t;
  ll cnt = 0;
  ll sum = 0;
  int max = -100100100;
  int a;
  int b[100006];

  scanf("%d %d", &n, &h);

  for(i = 0;i < n;i++){
    scanf("%d %d", &a, &b[i]);

    if(max < a) max = a;
  }

  sort(b,b + n);

  for(i = n - 1;i >= 0;i--){
    if(b[i] < max) break;

    h -= b[i];
    cnt++;

    if(h <= 0) break;
  }

  if(h > 0){
    if(h % max == 0) cnt += h/max;

    else cnt += h/max + 1;
  }

  printf("%lld\n", cnt);

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ff first
#define ss second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define loopf(i,a,b) for(int i = a;i < b;i++)
#define loopb(i,a,b) for(int i = a;i >= b;i--)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;



int32_t main()
{
    fast

   int test=1;
   //cin>>test;
  
  while(test--)
  {
    
    string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
  // while loop ending
   }
  

return 0;
}

Measured memory_bytes: 3648
/// ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,p=INT_MAX,j=0,x,a=0,b,l=0,r=0,y,k,c;
     string s,m,st,sb,sc,po,ps;
     cin>>s;
     m=s.substr(0,s.size()/2);
     st=s.substr(s.size()/2+1,s.size()/2);
     reverse(st.begin(),st.end());
     sb=m.substr(0,m.size()/2);
     if(m.size()%2==0)
     sc=m.substr(m.size()/2,m.size()/2);
     else{
         sc=m.substr(m.size()/2+1,m.size()/2);
     }
     reverse(sc.begin(),sc.end());
     po=st.substr(0,st.size()/2);
     if(st.size()%2==0)
     ps=st.substr(st.size()/2,st.size()/2);
     else{
         ps=st.substr(st.size()/2+1,st.size()/2);
     }
      reverse(ps.begin(),ps.end());
    // cout<<m<<" "<<st<<" "<<sb<<" "<<sc<<" "<<ps<<" "<<po<<endl;
     if(m==st && sb==sc&&ps==po){
        cout<<"Yes"<<endl;
     }
     else{
        cout<<"No"<<endl;
     }


     return EXIT_SUCCESS;
}




Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;

void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  ll cnt = 1;
  ll sum = 0;
  while(true){
    if(sum >= n) break;
    sum+=cnt;
    cnt++;
  }
  ll num = sum - n;
  i = 1;
  while(i < cnt){
    if(i == num) {
      i++;
      continue;
    }else {
      cout<<i<<endl;
      i++;
    }
  }

}

int main(){
  solve();
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int M = 507;

int w, h;
char a[M][M];

void read() {
  cin >> h >> w;
  for (int i = 0; i < h; ++i)
    for (int j = 0; j < w; ++j)
      cin >> a[i][j];
}

void kill() {
  for (int i = 0; i < h; ++i, cout << endl)
    for (int j = 0; j < w; ++j) {
      char x = a[i][j];

      if (1 <= i && i + 1 < h && i % 2 == 1) {
        if (j != w - 1)
          x = '#';
      }

      if (j == 0)
        x = '#';

      cout << x;
    }

  cout << endl;

  for (int i = 0; i < h; ++i, cout << endl)
    for (int j = 0; j < w; ++j) {
      char x = a[i][j];
      if (1 <= i && i + 1 < h && i % 2 == 0) {
        if (j != 0)
          x = '#';
      }
      if (j == w - 1)
        x = '#';
      cout << x;
    }

}

int main() {
  cout.precision(20);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  read();
  kill();
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#define INF 1000000001;

using namespace std;

int main()
{
	int N, min, max, i, sabunmax;
	sabunmax = -INF;
	min = INF;
	max = 0;
	cin >> N;
	vector<int>Min(N), Max(N);
	vector<int>price(N);
	for (i = 0; i < N; i++)
	{
		cin >> price[i];
	}
	for (i = 0; i < N; i++)
	{
		if (price[i] < min)
		{
			min = price[i];
			Min[i] = min;
		}
		else
		{
			Min[i] = min;
		}
	}
	for (i = N - 1; i >= 0; i--)
	{
		if (price[i] > max)
		{
			max = price[i];
			Max[i] = max;
		}
		else
		{
			Max[i] = max;
		}
	}
	for (i = 0; i < N - 1; i++)
	{
		if (Max[i + 1] - Min[i] > sabunmax)
			sabunmax = Max[i + 1] - Min[i];

	}
	cout << sabunmax << endl;

	return 0;
}


Measured memory_bytes: 5088
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011
#define mod 1000000007

struct matrix {
    ll data[3][3];

    void init() {
        memset(data, 0, sizeof(data));
        data[0][0] = data[1][1] = data[2][2] = 1;
    }

    void set_full() {
        vector<ll> aux = {1, 2, 1,
                          0, 1, 1,
                          1, 2, 2};
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                data[i][j] = aux[i * 3 + j];
    }

    void set_deny() {
        vector<ll> aux = {1, 2, 1,
                          0, 1, 1,
                          0, 0, 1};
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                data[i][j] = aux[i * 3 + j];
    }

    matrix operator*=(matrix who) {
        static matrix aux;
        static int i, j, k;

        memcpy(aux.data, data, sizeof(data));
        for (i = 0; i < 3; i++) {
            for (j = 0; j < 3; j++) {
                data[i][j] = 0;
                for (k = 0; k < 3; k++)
                    data[i][j] += aux.data[i][k] * who.data[k][j];
                data[i][j] %= mod;
            }
        }
    }
};

int n, L, i;
int x[maxN];
matrix able, unable;
matrix ans;

matrix poww(matrix a, int b) {
    int i;
    matrix ans;

    ans.init();
    while (b > 0) {
        if (b & 1) ans *= a;
        b >>= 1;
        a *= a;
    }

    return ans;
}

int main()
{
 //   freopen("test.in","r",stdin);

    scanf("%d%d", &L, &n);
    for (i = 1; i <= n; i++) scanf("%d", &x[i]), x[i]++;
    x[0] = 0;

    able.set_full();
    unable.set_deny();
    ans.init();

    for (i = 1; i <= n; i++) {
        ans *= poww(able, x[i] - x[i - 1] - 1);
        ans *= unable;
    }

    ans *= poww(able, L - x[n]);
    printf("%lld", ans.data[0][2]);



    return 0;
}


Measured memory_bytes: 640
N=int(input())
A=list(map(int, input().split()))
cnt=1
condition=''
for i in range(N-1):
  if A[i]>A[i+1] and condition=='plus':
    cnt+=1
    condition=''
  elif A[i]<A[i+1] and condition=='minus':
    cnt+=1
    condition=''
  elif A[i]>A[i+1]:
    condition='minus'
  elif A[i]<A[i+1]:
    condition='plus'

print(cnt)

Measured memory_bytes: 14224
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
vector<ll> v;

int u[10];
int ans = 1000000;
int N, K;
void dfs(int s, int cnt)
{
    if (N <= s)
    {
        ans = min(ans, s);
        return;
    }
    if (cnt >= 7)
        return;

    for (int i = 0; i < 10; ++i)
    {
        if (!u[i])
        {
            dfs(s * 10 + i, cnt + 1);
        }
    }
}

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

    //cout << fixed << setprecision(15);

    cin >> N >> K;
    REP(i, K)
    {
        int a;
        cin >> a;
        u[a]++;
    }

    dfs(0, -1);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
ll modpow(ll a, ll n, ll mod=MOD){ // a^n % MOD の計算
  ll res = 1;
  while (n > 0){
      if(n & 1) res = res * a % mod;
      a = a * a  % mod;
      n >>= 1;
  }
  return res;
}
ll GCD(ll a, ll b) {
  if (b == 0) return a;
  else return GCD(b, a%b);
}
//--MAIN-----------------------------------
void Main() {
    ll H,W,T; cin>>H>>W>>T;
    ll x=H/GCD(H,T);
    ll gx=GCD(H,T);
    ll y=W/GCD(W,T);
    ll gy=GCD(W,T);
    ll g=GCD(x,y);

    ll ans=(modpow(2,x)+modpow(2,y)+modpow(2,g)-3+MOD)%MOD;
    ans=modpow(ans,(gx*gy));

    cout<< ans<<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
from collections import deque
sx, sy = 0, 0
h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]

def bfs():
    visited = [[-1]*w for _ in range(h)]
    queue = deque([[sx, sy]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [h-1,w-1]:
            return visited[y][x]
        
        for dy, dx in ([0,1], [1,0], [0, -1], [-1, 0]):
            ny, nx = y+dy, x+dx
            if 0<=ny<h and 0<=nx<w:
                if maze[ny][nx] == '.' and visited[ny][nx] == -1:
                    visited[ny][nx] = visited[y][x] + 1
                    queue.append([ny, nx])
                    
black_num = 0
for i in maze:
    black_num += i.count("#")
bfs = bfs()
if bfs is None:
    print(-1)
else:
    print(h*w - bfs -1 -black_num)

Measured memory_bytes: 3316
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0) 
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n,m,a,b,c=INF,d,x,y,z;
  string s,t;
  //

  // ここから
  IN(n);
  Vi w(n);
  VIN(w)
  REP(i,n){
    x=0;
    y=0;
    REP(j,i+1){
      x += w[j];
    }
    FOR(j,i+1,n){
      y += w[j];
    }
    c = min(c, abs(x-y));
  }
  OUT(c);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<int,pii> pip;
typedef vector<vi> vvi;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}

void print(vvi a){
    cout << endl;
    rep(i,a.size()){
        rep(j,a[i].size())cout << " " << a[i][j];
        cout << endl;
    }
}

signed main(void) {
    int n,m,t,p;
    while(cin >> n >> m >> t >> p,n){
        vvi a(n,vi(m,1));
        rep(i,t){
            //print(a);
            int d,c;
            cin >> d >> c;
            if(d == 2){
                int nn = n;
                int mm = max(m-c,c);
                vvi b(nn,vi(mm,0));
                rep(i,nn)rep(j,mm){
                    if(j+c < m)b[i][j] += a[i][j+c];
                    if(c-j-1 >= 0)b[i][j] += a[i][c-j-1];
                }
                n = nn,m = mm;
                a = b;
            }else{
                int nn = max(n-c,c);
                int mm = m;
                vvi b(nn,vi(mm,0));
                rep(i,nn)rep(j,mm){
                    if(i+c < n)b[i][j] += a[i+c][j];
                    if(c-i-1 >= 0)b[i][j] += a[c-i-1][j];
                }
                n = nn,m = mm;
                a = b;
            }
        }
        //print(a);
        rep(i,p){
            int x,y;
            cin >> x >> y;
            cout << a[x][y] << endl;
        }
    }
}



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

bool comp(pair<int,int> a, pair<int,int> b){
  return a.second < b.second;
}
int main(){
  int N, M;
  cin >> N >> M;
  vector<pair<int,int> > islands(M);

  rep(i,M){
    int a,b;
    cin >> a >> b;
    islands[i] = {a,b};
  }
  sort(islands.begin(),islands.end(),comp);
  int l = islands[0].second;
  int res = 1;
  rep(i,M){
    if(islands[i].first >= l){
      l = islands[i].second;
      res++;
    }
  }
  cout << res << endl;
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int t[n+1] = {}, sum[n+1] = {};
    t[0] = 0,sum[0] = 0;
    for(int i = 1; i < n+1; i++){
        int x = 0,y = 0;
        cin >> t[i] >> x >> y;
        sum[i] = x + y;
    }
    for(int i = 0; i < n; i++){
        bool p = t[i+1] - t[i] >= abs(sum[i+1] - sum[i]);
        bool q = (t[i+1] - t[i]) % 2 == (abs(sum[i+1] - sum[i])) % 2;
        if(p && q){
            continue;
        }else{
            cout << "No" << endl;
            return 0;
        }
        //cout << p << " " << q << " " << i << endl;
    }
    cout << "Yes" << endl;

    return 0;
}

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

int main()
{
    string x;
    set<string> s;
    int n;
    cin >> n;
    string str;
    rep(i, n)
    {
        cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 19176
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int N,T,A;
	cin>>N>>T>>A;
	double a[1010];
	double min=100000;int f;
	for(int i=0;i<N;i++){
		cin >> a[i];
		a[i]=abs(T-a[i]*0.006-A);
		if(a[i]<min){
			min=a[i];
			f=i;
		}
	}
	cout << f+1;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    // 入力
    String s = sc.next(); 
    
    // 出力
    for(int i=0; i<s.length(); ++i)
      System.out.print("x");
  }
}

Measured memory_bytes: 23508
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end()))
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll n; cin >> n;
  set<ll> set;
  rep(i, n) {
    ll ai; cin >> ai;
    set.insert(ai);
  }
  if (set.size() == n) YES();
  else NO();
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 9600
n=int(input())
a=list(map(int,input().split()))
min_ans=0
nxt=a
while len(nxt)!=0:
    min_ans=min(nxt)
    nxt=[]
    for v in a:
        if v%min_ans!=0:
            nxt.append(v%min_ans)
print(min_ans)

Measured memory_bytes: 14252
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    vb ans(B, false);
    for (int i = 0; i < K; i++) {
        if (A + 1 - 1 < B) {
            ans[A + i - 1] = true;
        }
        if (0 <= B - i - 1) {
            ans[B - i - 1] = true;
        }
    }
    for (int i = A - 1; i < B; i++) {
        if (ans[i]) {
            cout << i + 1 << endl;
        }
    }
}


Measured memory_bytes: 125140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int INF=1001001001;
const int mod=1000000007;
int main(){
    char c;cin>>c;
    if(c=='A')cout<<'T'<<endl;
    if(c=='T')cout<<'A'<<endl;
    if(c=='G')cout<<'C'<<endl;
    if(c=='C')cout<<'G'<<endl;
}

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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll INF = 1LL << 62;
#define atcoder(int)1e9+7
#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int main() {

	int a[13] = { 0,1,3,1,2,1,2,1,1,2,1,2,1 };
	int x, y;

	cin >> x >> y;

	if (a[x] == a[y])cout << "Yes" << endl;
	else cout << "No" <<endl;

	return 0;
}

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

int main(){

  int n;
  int a[100];
  cin >> n;
  for(int i=0; i<n; i++){
  	cin >> a[i];
  }
  
  int alice=0,bob=0;
  
  sort(a, a + n ,greater<int>());
  for(int i=0; i<n; i++){
  	if(i%2 == 0){
    alice += a[i];
    }
    else {
  	bob += a[i];
    }
  }
  cout << alice - bob << endl;
  
}

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

using namespace std;

class Mat
{
public:
    Mat(int n,int m)
    {
        mn = new int*[n];
        for(int i = 0;i < n;i++)
        {
            mn[i] = new int[m];
        }
    }
    int** mn;
};

int main()
{    
    int n,m;
    cin >> n >> m;
    Mat mat(n,m);
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < m;j++)
        {
            int num;
            cin >> num;
            mat.mn[i][j] = num;
        }
    }
    vector<int> vec;
    for(int i = 0;i < m;i++)
    {
        int v;
        cin >> v;
        vec.push_back(v);
    }
    for(int i = 0;i < n;i++)
    {
        int s = 0;
        for(int j = 0;j < m;j++)
        {
            s += mat.mn[i][j] * vec.at(j);
        }
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 1256
#![allow(unused_imports)]
use proconio::*;
use std::cmp::*;

fn gcd(a:usize, b:usize) -> usize {
   if b==0 {a} else {gcd(b, a%b)}
}

#[fastout]
fn main() {
   input! {
       k: usize
   }

   let mut ans = 0usize;
   for a in 1..k+1 {
       for b in 1..k+1 {
           for c in 1..k+1 {
               ans += gcd(a, gcd(b, c));
           }
       }
   }
   println!("{}" , ans);
}


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

#define BOLT ios_base::sync_with_stdio(0)
#define newline cout << "\n"
#define eline cerr << "\n"
#define LL_MAX 9223372036854775807
#define LL_MIN -9223372036854775808
#define IN_FILE freopen("input.txt", "r", stdin)
#define OUT_FILE freopen("output.txt", "w", stdout)


// g++ -o contest contest.cpp

long long w[100+5];
long long v[100000+5];
long long dp[100+5][100000+5];

void USEFILE(){
    IN_FILE;
    OUT_FILE;
}

void reset(){
    memset(dp, -1, sizeof dp);   
}

long long process(int n, int W){
    if(n <= 0 || W <= 0) return 0;
    if(dp[n][W] != -1) return dp[n][W];

    long long ans = 0;

    if(W < w[n]){
        ans = process(n-1,W);
    }
    else{
        ans = max(process(n-1,W) , v[n] + process(n-1,W-w[n]));
    }
    dp[n][W] = ans;
    return ans;
}   



void solve(int kase){
    reset();
    int n, W;
    cin >> n >> W;
    for(int i = 1 ; i <= n ; i++){
        cin >> w[i] >> v[i];
    }
    cout << process(n, W); newline;
}


int main(){
    BOLT;
    // USEFILE();
    int t, kase = 0;
    // cin >> t;
    // while(t--)
    //      solve(++kase);
    solve(0);

return 0;
}


Measured memory_bytes: 85604
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}



int main() {
  int N,cnt=0;
  string bs="",ts="";
  string S;
  cin >> S;
  N=S.size();
  rep(i,N) {
    if (bs!=ts+S[i]) {
      cnt++;bs=ts+S[i];ts="";
    }
    else ts+=S[i];
  }
  cout << cnt << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

bool cmp(pair<ll, ll> a, pair<ll, ll> b) { return a.second < b.second; }

int main()
{
  int n;
  cin >> n;
  ll r = -10010010010;

  vector<pair<ll, ll>> d;
  rep(i, n)
  {
    ll x, l;
    cin >> x >> l;
    d.emplace_back(x - l, x + l);
  }
  sort(d.begin(), d.end(), cmp);
  int res = 0;
  int endtime = r;
  for (int i = 0; i < n; ++i)
  {
    if (d[i].first >= endtime)
    {
      endtime = d[i].second;
      ++res;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
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; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    ll N, K;
    cin >> N >> K;
    VLL p(N);
    rep(i,N){
        cin >> p[i];
    }
    sort(all(p));
    ll sum=0;
    rep(i,K){
        sum+=p[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 3664
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define GYOU_MAX 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define s_pri(str) printf("%s\n",str);
#define PRINT(str) printf(#str "\n")
#define v_pri(val) printf("%d\n",val);
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define pi acos(-1.0)
#define sca(x) scanf("%d",&x);

typedef long long int ll;

/*
puts("aa");
//*/

int cmp(const void *a, const void*b) {
	return *(int*)b - *(int*)a;
}
int main(void) {


	ll H;
	scanf("%lld", &H);

	ll count = 0;

	while (H > 1) {
		H /= 2;
		count++;
	}
	ll sum = 0;
	for (int i = 0; i <= count; i++) {
		sum += pow(2, i);
	}
	printf("%lld", sum);

	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9,MOD = 1e9+7,ohara = 1e6;
const ll LINF = 1e18;
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n;
    map<ll,ll> mp;
    rep(i,n){
        cin>>a;
        if(a!=0){
        mp[a-1]++;
        }
        mp[a]++;
        mp[a+1]++;
    }
    rep(i,100000+10){
        ans=max(ans,mp[i]);
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
#include <iterator>     // std::back_inserter
const double PI = acos(-1);
using namespace std;
using ll =long long;
#define rep(i,n)for(ll i=0;i<(n);i++)
const int mod = 1000000007;
const ll inf = 1e18 + 1;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
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;
}

/*�R���r�l�[�V����*/

//ll f[101010], rf[101010];
//ll inv(ll x) {
//	ll res = 1;
//	ll k = mod - 2;
//	ll y = x;
//	while (k) {
//		if (k & 1) res = (res * y) % mod;
//		y = (y * y) % mod;
//		k /= 2;
//	}
//	return res;
//}
//void init() {
//	f[0] = 1;
//	for (ll i = 1; i < 101010;i++) f[i] = (f[i - 1] * i) % mod;
//	for(ll i = 0; i < 101010; i++) rf[i] = inv(f[i]);
//}
////---------------------------------------------------------------------------------------------------
//ll C(int n, int k) {
//	ll a = f[n]; // = n!
//	ll b = rf[n - k]; // = (n-k)!
//	ll c = rf[k]; // = k!
//
//	ll bc = (b * c) % mod;
//
//	return (a * bc) % mod;
//}

///*�R���r�l�[�V����*/
//
/*Union Find*/
#define MAX_N 200000
#define MAX_M 200000
vector<ll>par(MAX_N);
vector<ll>ran(MAX_N);
void init(ll N) {
	rep(i, N) {
		par[i] = i;
		ran[i] = 0;
	}
}
ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//x��y�̑�����W���𕹍�
void unite(ll x,ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (ran[x] < ran[y]) {
		par[x] = y;

	}
	else {
		par[y] = x;
		if (ran[x] == ran[y])ran[x]++;
	}
}
bool same(ll x, ll y) {
	return find(x) == find(y);
}
/*Union Find*/
	
int main() {
	int N, M;
	cin >> N >> M;
	vector<int>a(M), b(M);
	rep(i, M) {
		cin >> a[i] >> b[i];
	}
	init(N);
	rep(i, M) {
		unite(a[i], b[i]);
	}
	map<ll,ll>m;
	rep(i, N) {
		m[find(i)]++;
	}
	cout << m.size() - 1;

}

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

int main(){
    int n; cin >> n;
    map<int,int> mp;
    priority_queue<P> que;
    rep(i,n){
        int a,b; cin >> a >> b;
        mp[b] += a;
    }
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        int key = itr->first;
        int val = itr->second;
        que.push(P(key,val));
    }
    int time = 1e9;
    while(que.size()){
        P p = que.top();que.pop();
        time = min(time,p.first);
        time -= p.second;
        if(time < 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });

            var S = GetStrArray();
            var ans = new string(S.Select(s => (char.ToUpper(s[0]))).ToArray());

            Console.WriteLine(ans);


            Console.Out.Flush();
            Console.ReadKey();
        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public char GetChar() { return Console.ReadLine().Trim()[0]; }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V,W>(out T a, out U b, out V c, out W d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);
        }
        static void Multi<T, U, V, W,X>(out T a, out U b, out V c, out W d,out X e)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);e = cv<X>(ar[4]);
        }
    }
}

Measured memory_bytes: 13396
# -*- coding: utf-8 -*-

H, W = map(int, input().split())
A = []
for i in range(H):
    row = list(map(int, input().split()))
    assert len(row) == W
    A.append(row)

# 操作の列
ops = []

# 各行について, 奇数が左端だけになるように操作
oddrow = []
for r, row in enumerate(A):
    # 奇数の位置
    odd = [i for i in range(len(row)) if row[i] % 2 > 0]
    odd.reverse()
    # 奇数のマスから奇数のマスへ1枚移動
    while len(odd) > 1:
        f, t = odd[:2]
        for i in range(f, t, -1):
            ops.append((r, i, r, i-1))
        odd = odd[2:]
    # 残った1個の奇数を第0列に移動
    if len(odd) > 0:
        for i in range(odd[0], 0, -1):
            ops.append((r, i, r, i-1))
        oddrow.append(r)

# 各行に残っている奇数を移動
while len(oddrow) > 1:
    f, t = oddrow[:2]
    for i in range(f, t):
        ops.append((i, 0, i+1, 0))
    oddrow = oddrow[2:]

# 出力
print(len(ops))
for op in ops:
    print(' '.join([str(x+1) for x in op]))

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

#define ll long long
#define ull unsigned long long
#define ld long double
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define fo(i,start,end) for(int i=start;start<end?i<end:i>end;start<end?i+=1:i-=1)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vop vector<pll>
#define vov vector<vector<ll>>
#define endl "\n"
using namespace std;
const ld pi=3.14159265358979323;

const long long mod1=1e9+7;
const long long mod2=1e18;
const ll mod3=9e18;
const ll N=1e9+7;

long long power(ll  x, ll n){if(n==0)return 1;ll temp=power(x,n/2);if(n%2==0)return temp*temp;else return x*temp*temp;}

ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return (a*b)/(gcd(a,b));}
void swap(int* a, int* b){int t = *a;*a = *b;*b = t;}
bool f(ll x,ll y){return x>y;}

ll MAX(ll a,ll b){return a>b?a:b;}
ll MIN(ll x,ll  y){return x>y?y:x;}

ll pmod(ll a, ll b,ll mod)//a^b%mod
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b/=2;
        a=(a*a)%mod;
    }
    return ans;
}

bool cmp2( pair<ll,ll> &a,
           pair<ll,ll> &b)
{
    return a.second>b.second;
}


void solve() {
string s1,s2;
cin>>s1>>s2;
ll n=s1.size();
ll m=s2.size();
ll ans[n+1][m+1];
s1=','+s1;
s2=','+s2;
for(ll i=0;i<=n;i++){
    ans[i][0]=0;
}
for(ll i=0;i<=m;i++){
    ans[0][i]=0;
}
for(ll i=1;i<=n;i++){
    for(ll j=1;j<=m;j++){
        if(s1[i]==s2[j])ans[i][j]=1+ans[i-1][j-1];
        else {
            ans[i][j]=MAX(ans[i-1][j],ans[i][j-1]);
        }

    }
}


ll i=n;
ll j=m;
ll len=ans[n][m];
    char lcs[len+1];
    lcs[len]='\0';

while(i>0&&j>0){
    if(s1[i]==s2[j]){
        lcs[len-1]=s1[i];
        len--;
        //cout<<s1[i];
        i--;
        j--;
    }
    else{
        if(ans[i-1][j]>ans[i][j-1])i--;
        else j--;



    }



}

cout<<lcs;





}

























int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    //freopen("error.txt" , "w" , stderr) ;
#endif








    ll t;
    t=1;
    //cin>>t;
    //  cin.ignore();
    while(t--){

        solve();
    }




    return 0;


}

////vll adj[100001];
////ll vis[100001];
////ll sssp[100001];

Measured memory_bytes: 73960
n = input()

a = n[0]+n[1]
a = int(a)

b = n[2]+n[3]
b = int(b)

#print(a,b)

if a==0:
	if b==0:
		print('NA')
	elif 0<b<13:
		print('YYMM')
	else:
		print('NA')

elif 0<a<13:
	if b==0:
		print('MMYY')
	elif 0<b<13:
		print('AMBIGUOUS')
	else:
		print('MMYY')	

else:
	if b==0:
		print('NA')
	elif 0<b<13:
		print('YYMM')
	else:
		print('NA')




Measured memory_bytes: 3064
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const int MX = (1 << 16) + 7;
const ll INF = 1e18;

ll sm[MX];
ll f[MX];

ll a[20][20];

int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }

    for (int i = 0; i < (1 << n); i++) {
        for (int j = 0; j < n; j++) {
            if (!(i & (1 << j))) {
                continue;
            }
            for (int k = j + 1; k < n; k++) {
                if (i & (1 << k)) {
                    sm[i] += a[j][k];
                }
            }
        }
    }

    for (int i = 1; i < (1 << n); i++) {
        f[i] = -INF;
    }

    for (int i = 1; i < (1 << n); i++) {
        for (int j = i; j > 0; j = (j - 1) & i) {
            f[i] = max(f[i], f[i ^ j] + sm[j]);
        }
    }

    cout << f[(1 << n) - 1] << "\n";
    return 0;
}



Measured memory_bytes: 1280
import math
sigma=[]
while(True):
    N=int(input())
    if N==0:
        break
    s=[int(i) for i in input().split()]
    av=sum(s)/N
    sg=math.sqrt(sum([(s[i]-av)**2 for i in range(N)])/N)
    sigma.append(sg)
for sg in sigma:
    print(sg)



Measured memory_bytes: 5712
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){ 
    int n,m;
    cin>>n>>m;
    cout << (n+m)%24 << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n;
string s;
string t;
int main()
{
	cin>>n;
	cin>>s;
	cin>>t;
	rep(i,n)
	{
		if(s.substr(i)==t.substr(0,n-i))
		{
			cout<<n+i<<endl;
			return 0;
		}
	}
	cout<<2*n<<endl;
	return 0;
}

Measured memory_bytes: 256