akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(N: int, S: str, T: str):
    s = ""
    for i in range(N):
        s += S[i]
        s += T[i]
    print(s)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(N, S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
N = int(input())
all = []
n = []

for i in range(1,N+1):
    if i%3==0 and i%5==0:
        all.append('FizzBuzz')
    elif i%3==0:
        all.append('Fizz')
    elif i%5==0:
        all.append('Buzz')
    else:
        n.append(i)

print(sum(n))

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

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

    string ans = "";

    rep(i,S.length()){
        ans += "x";
    }
    cout<<ans<<"\n";
	
	return 0;
}

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

struct UnionFind
{
    vector<int> d;
    UnionFind(int n = 0) : d(n, -1){};

    // find
    int find(int x)
    {
        if (d[x] < 0)
            return x;
        return d[x] = find(d[x]);
    }
    // unite
    bool unite(int x, int y)
    {
        x = find(x);
        y = find(y);

        if (x == y)
            return false;

        if (d[x] > d[y])
            swap(x, y);
        d[x] += d[y];
        d[y] = x;

        return true;
    }
    // same
    bool same(int x, int y)
    {
        return (find(x) == find(y));
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    UnionFind uf = UnionFind(n);
    vector<bool> ans;
    for (int i = 0; i < q; i++)
    {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0)
        {
            uf.unite(x, y);
        }
        else
        {
            ans.push_back(uf.same(x, y));
        }
    }

    for (bool out : ans)
    {
        cout << out << endl;
    }
    return 0;
}


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

int main(){
	int N; cin >> N;
	ll x[N], y[N], rma = 0, rmi = 1e18, bma = 0, bmi = 1e18;
	rep(i, N){
		cin >> x[i] >> y[i];
		if(x[i] < y[i]) swap(x[i], y[i]);
		if(rma < x[i]) rma = x[i];
		if(bma < y[i]) bma = y[i];
		if(rmi > x[i]) rmi = x[i];
		if(bmi > y[i]) bmi = y[i];
	}
	ll ans = (rma - rmi)*(bma - bmi), ma = 0, mi = 1e18;
	vector<pair<ll, ll>> arr;
	rep(i, N){
		if(y[i] == rma || x[i] == bmi || (x[i] == rma && y[i] == bmi)){
			cout << ans << endl;
			return 0;
		}
		if(x[i] == rma && ma < y[i]) ma = y[i];
		if(x[i] == rma && mi > y[i]) mi = y[i];
		if(y[i] == bmi && ma < x[i]) ma = x[i];
		if(y[i] == bmi && mi > x[i]) mi = x[i];
		if(x[i] != rma && y[i] != bmi) arr.push_back({y[i], x[i]});
	}
	sort(arr.begin(), arr.end());
	ll s[2][arr.size()];
	rep(x, 2)rep(i, arr.size()){
		if(i==0) s[x][i] = arr[i].second;
		else if(x==0) s[x][i] = min(s[x][i-1], arr[i].second);
		else s[x][i] = max(s[x][i-1], arr[i].second);
	}
	ll d = 1e18;
	rep(i, arr.size()+1){
		if(i==0){
			if(d > max(ma, arr[arr.size()-1].first) - min(mi, arr[i].first)){
				d = max(ma, arr[arr.size()-1].first) - min(mi, arr[i].first);
			}
		}else{
			if(d > max(ma, max(s[1][i-1], arr[arr.size()-1].first)) - min(mi, min(arr[i].first, s[0][i-1]))){
				d = max(ma, max(s[1][i-1], arr[arr.size()-1].first)) - min(mi, min(arr[i].first, s[0][i-1]));
			}
		}
	}
	cout << min(ans, d*(rma - bmi)) << endl;
	return 0;
}


Measured memory_bytes: 10732
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar
#define putchar putchar
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

int main(void){
	int n=nextint();
	int x=nextint();
	if(x==1 || x==n*2-1){
		puts("No");
	}else{
		puts("Yes");
		if(n==2){
			puts("1");
			puts("2");
			puts("3");
		}else{
			if(x==2){
				int now=1;
				if(now==x-1) now+=4;
				for(int i=0; i<n-2; i++){
					printf("%d\n", now);
					now++;
					if(now==x-1) now+=4;
				}
				printf("%d\n", x+1);
				printf("%d\n", x);
				printf("%d\n", x-1);
				printf("%d\n", x+2);
				for(int i=0; i<n-3; i++){
					printf("%d\n", now);
					now++;
					if(now==x-1) now+=4;
				}
			}else{
				int now=1;
				if(now==x-2) now+=4;
				for(int i=0; i<n-2; i++){
					printf("%d\n", now);
					now++;
					if(now==x-2) now+=4;
				}
				printf("%d\n", x-1);
				printf("%d\n", x);
				printf("%d\n", x+1);
				printf("%d\n", x-2);
				for(int i=0; i<n-3; i++){
					printf("%d\n", now);
					now++;
					if(now==x-2) now+=4;
				}
			}
		}
	}
}


Measured memory_bytes: 1604
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int L, sum[30];
vector< pair<int,int> > g[30]; 
int main() {

        for(int i=0;i<30;i++) g[i].clear();
        cin >> L; L --;
        int x = L, n = 0, m = 0; x ++;
        while(x) {
            x >>= 1; ++ n;
        }
        //printf("n = %d\n", n);
        for(int i=1;i<n;i++) {
            sum[i] = (1<<(i-1)) - 1;

            if(i==n-1) {
                g[i].push_back(make_pair(i+1,L-sum[i])); ++ m;
                L -= (sum[i]+1);
            } else { 
                g[i].push_back(make_pair(i+1,0)); ++ m;
                g[i].push_back(make_pair(i+1,1<<(i-1))); ++ m;
            }

        }

         for(int i=n-1;i>=1;i--) {
            //printf("i = %d, sum = %d, L = %d\n", i, sum[i], L);
            while (L >= sum[i]) {
                g[i].push_back(make_pair(n, L-sum[i])); ++m;
                L -= (sum[i]+1);
            }
        }
        
        printf("%d %d\n", n, m);
        for(int i=1;i<=n;i++) {
            sort(g[i].begin(), g[i].end());
            for(auto p: g[i]) {
                printf("%d %d %d\n", i, p.first, p.second);
            }
        }
    
}










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

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,m;
    cin>>n>>m;
    priority_queue<ll> pq;
    ll sum = 0;
    for(int i = 0; i<n; i++){
        ll t;
        cin>>t;
        sum += t;
        pq.push(t);
    }
    for(int i =0; i<m; i++){
        ll mt;
        mt = pq.top(); pq.pop();
        ll tt = mt/2;
        pq.push(tt);
        tt = mt-tt;
        sum -= tt;
    }
    cout<< sum <<endl;
    return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>

int main(){
  char line[202];
  char card[202];
  int m;						/* シャッフル回数 */
  int h[100];					/* シャッフルする枚数 */
  int i, j;
  int rest_card_length;			/* 残りのカード枚数 */
  int card_length;				/* カード総数 */
  while(1){
	//文字列の読み込み
	fgets(card, sizeof(card), stdin);
	if(card[strlen(card)-1]=='\n') /* カードなら改行文字が末尾につくから削除する */
	  card[strlen(card)-1]='\0';
	if(strcmp(card, "-")==0)		/* 終了条件 */
	  break;
	card_length=strlen(card);
	//シャッフル回数と下からシャッフルする枚数のよみこみ
	fgets(line, sizeof(line), stdin);
	sscanf(line, "%d", &m);
	for(i=0; i<m; ++i){
	  fgets(line, sizeof(line), stdin);
	  sscanf(line, "%d", &h[i]);
	}
	//shuffle
	for(i=0; i<m; ++i){
	  for(j=0; j<h[i]; ++j){	/* カードを取り出す */
		line[j]=card[j];
	  } 
	  line[h[i]]='\0';
	  for(j=0; j<(card_length-h[i]+1); ++j){
		card[j]=card[h[i]+j];
	  }
	  rest_card_length=strlen(card);
	  for(j=0; j<h[i]; ++j){
		card[rest_card_length+j]=line[j];
	  }
	  card[card_length]='\0';
	}
	//出力
	printf("%s\n", card);
  }
  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define int long long
#define inv(x) Power(x, mod - 2)
#define N 1000005

using namespace std;
typedef long long ll;

template <class T> inline void read(T &x) {
	char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	if (flag) x = -x;
}

inline int input() {
	int x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

const int mod = 1e9 + 7;
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; }
inline void inc(int &x, int y) { x += y; x -= x >= mod ? mod : 0; }

inline int Power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = (ll) res * x % mod;
		x = (ll) x * x % mod, y >>= 1;
	} return res;
}

template <class T> void chkmax(T &x, T y) { x = x > y ? x : y; }
template <class T> void chkmin(T &x, T y) { x = x < y ? x : y; }
template <class T> T gcd(T x, T y) { return !y ? x : gcd(x % y, y); }

int n, m;
int a[100];
int fac[N], ifac[N];
int f[20][N];

void init() {
	fac[0] = ifac[0] = 1;
	for (int i = 1; i < N; ++i) fac[i] = (ll) fac[i - 1] * i % mod;
	ifac[N - 1] = inv(fac[N - 1]);
	for (int i = N - 2; i; --i) ifac[i] = (ll) ifac[i + 1] * (i + 1) % mod;
}

inline int C(int x, int y) {
	if (x < y || y < 0) return 0;
	return (ll) fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}

signed main() {
	ios::sync_with_stdio(false);
	cin >> n >> m, init();
	for (int i = 1; i <= m; ++i) cin >> a[i];
	f[m + 1][0] = 1;
	for (int i = m; i; --i) {
		for (int S = 0; S < 1 << n; ++S) {
			if (!f[i + 1][S]) continue;
			inc(f[i][S], f[i + 1][S]);
			for (int j = 0; j < n; ++j) {
				if (!(1 << j & S)) {
					inc(f[i][S | 1 << j], (ll) f[i + 1][S] * 
						C((1 << n) - S - a[i], (1 << j) - 1) % mod * fac[1 << j] % mod);
				}
			}
		}
	}
	
	int ans = 0;
	for (int S = 0; S < 1 << n; ++S) {
		int cnt = 0, x = S;
		while (x) ++cnt, x ^= x & -x;
		int res = (ll) f[1][S] * fac[(1 << n) - 1 - S] % mod;
		if (cnt & 1) inc(ans, mod - res);
		else inc(ans, res);
	}
	
	printf("%lld\n", (ll) ans * (1 << n) % mod);
	return 0;
}

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

namespace _1_8_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string _readLine_S = Console.ReadLine();
            string _readLine_P = Console.ReadLine();
            if((_readLine_S+_readLine_S).Contains(_readLine_P))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}



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

int main() {
  string s;
  cin >> s;
  if (s == "SUN") {
    cout << 7 <<endl;
  }
  if (s == "MON") {
    cout << 6 <<endl;
  }
  if (s == "TUE") {
    cout << 5 <<endl;
  }
  if (s == "WED") {
    cout << 4 <<endl;
  }
  if (s == "THU") {
    cout << 3 <<endl;
  }
  if (s == "FRI") {
    cout << 2 <<endl;
  }
  if (s == "SAT") {
    cout << 1 <<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define _BFS 1
// #define _DFS 1

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

ll cost[100010];
vector< pair<int, ll> > v[100010];

void bfs(int k){
  queue< pil > q;
  q.push(pil(k, 0));

  pil p;
  int x, y, c;
  while(!q.empty()){
    p = q.front();
    q.pop();

    x = p.first;
    c = p.second;
    REP(i, v[x].size()){
      y = v[x][i].first;
      if(cost[y] != -1) continue;
      cost[y] = c + v[x][i].second;
      q.push(pil(y, cost[y]));
    }

  }
}

void dfs(int x, ll c){
  // dump(x);
  // if(cost[x] != -1) {cout << "exit" << endl; return;}
  if(cost[x] != -1) return;
  cost[x] = c;

  REP(i, v[x].size()){
    dfs(v[x][i].first, c + v[x][i].second);
  }
}

#ifdef _BFS
int main(){
  int n;
  cin >> n;

  int x, y, z;
  pair<int, int> p;
  REP(i, n-1){
    cin >> x >> y >> z;
    p.first = y;
    p.second = z;
    v[x].push_back(p);
    p.first = x;
    v[y].push_back(p);
  }

  int q, k;
  cin >> q >> k;

  REP(i, n+1) cost[i] = -1;
  dfs(k, 0);

  REP(i, q){
    cin >> x >> y;
    cout << cost[x] + cost[y] << endl;
  }

  return 0;
}
#endif

#ifdef _DFS
int main(){
  int n;
  cin >> n;

  int x, y, z;
  pair<int, int> p;
  REP(i, n-1){
    cin >> x >> y >> z;
    p.first = y;
    p.second = z;
    v[x].push_back(p);
    p.first = x;
    v[y].push_back(p);
  }

  int q, k;
  cin >> q >> k;

  REP(i, n+1) cost[i] = -1;
  dfs(k);

  REP(i, q){
    cin >> x >> y;
    cout << cost[x] + cost[y] << endl;
  }

  // FOR(i, 1, n+1) cout << cost[i] << endl;
  
  return 0;
}
#endif

Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;



void solve(){
	
	string s;
	cin >> s;
	if (s== "ABC") printf("ARC");
	else printf("ABC");
	
}
 
int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	//int t; scanf("%d", &t);
	//while(t--){
	solve();
	//}
	return 0;
}

Measured memory_bytes: 3736
#include <stdio.h>
#include <bits/stdc++.h>
#include <algorithm>
#include <cassert>

using namespace std;

// bool get_answer(array<int,3> &ans, int target){
//     while(ans[0]*500 > target){
//         ans[0]--;
//     }
//     target -= ans[0]*500;
//     while(ans[1]*100 > target){
//         ans[1]--;
//     }
//     target -= ans[1]*100;
//     while(ans[2]*50 > target){
//         ans[2]--;
//     }
//     target -= ans[2]*50;
//     return (target == 0);

// }

double solve(int R){
    const double PI=3.141592653589;
    double ans = R*PI*2;
    cout << ans << "\n";
    return ans;
}

// class input{
//     public:
//     input(int _A, int _B, int _C, int _X, int _ans){
//         A = _A;
//         B = _B;
//         C = _C;
//         X = _X;
//         ans = _ans;
//     }
//     int A;
//     int B;
//     int C;
//     int X;
//     int ans;
// };

// int solve(input key){
//     return solve(key.A, key.B, key.C, key.X);
// }

int main(){
    int R;
    bool use_stdin = true;
    // use_stdin = false;
    if(use_stdin){    
        cin >> R;
        solve(R);
    }else{
        // input keys[] = {
        //     {30,40,50,6000,213},
        //     {5,1,0,150,0},
        //     {2,2,2,100,2}
        // };
        // for(auto key:keys){
        //     assert(solve(key)==key.ans);
        // }
    }
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  vector<string> vec;
  
  int n = s.size();
  int lastcut = 0;
  for(int i = 1; i < n; ++i) {
    if(s[i-1] == 'L' && s[i] == 'R') { 
      vec.push_back(s.substr(lastcut, i-lastcut));
      lastcut = i;
    }
  }
  vec.push_back(s.substr(lastcut, n-lastcut));
  
  for(string x : vec) {
    int r = 0; int l = 0;
    for(char y : x) {
      if(y == 'R') ++r;
      else ++l;
    }
    
    int left = (r+1)/2 + l/2;
    int right = r/2 + (l+1)/2;
    rep(i, r-1) cout << "0 ";
    cout << left << " " << right << " ";
    rep(i, l-1) cout << "0 ";
  }
  
  return 0;
}


Measured memory_bytes: 5456
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

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

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//233
	string s;
	cin>>s;
	ll k;
	cin>>k;
	for(char c:s) {
		if(k==1&&c=='1'){
			cout<<1;
			return;
		}
		k--;
		if(c!='1'){
			cout<<c;
			return;
		}
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3588
// problem: "https://atcoder.jp/contests/abc147/tasks/abc147_a"

#include<bits/stdc++.h>

using namespace std;

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

    if(a+b+c < 22)
        cout<<"win";

    else
        cout<<"bust";

    return 0;
}


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

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

    int ans = 0;
    int cnt = 0;
    rep(i, n + 1) {
        if (a[i] == i + 1) {
            cnt++;
        } else {
            ans += (cnt + 1) / 2;
            cnt = 0;
        }
    }

    cout << ans << endl;

    return 0;
}

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

struct Node {
    int parent, left, right;
};

vector<Node> t(MAX, {NIL, NIL, NIL});
vector<int> d(MAX);

void set_depth(int u, int p) {
    d[u] = p;
    if (t[u].right != NIL) {
        set_depth(t[u].right, p);
    }
    if (t[u].left != NIL) {
        set_depth(t[u].left, p+1);
    }
}

int get_depth(int u) {
    int p = 0, v = u;
    while (t[v].parent != NIL) {
        v = t[v].parent;
        p++;
    }
    return d[u] = p;
}

int main() {
    int n;
    scanf("%d", &n);
    rep(i, n) {
        int id, k;
        scanf("%d %d", &id, &k);
        int l;
        rep(j, k) {
            int c;
            scanf("%d", &c);
            t[c].parent = id;
            if (j == 0) t[id].left = c;
            else t[l].right = c;
            l = c;
        }
    }

    // int r;
    // rep(i, n) {
    //     if (t[i].parent == NIL) {
    //         r = i;
    //         break;
    //     }
    // }
    // set_depth(r, 0);
    
    rep(i, n) {
        printf("node %d: parent = %d, ", i, t[i].parent);
        // printf("depth = %d, ", d[i]);
        printf("depth = %d, ", get_depth(i));
        if (t[i].parent == NIL) printf("root");
        else if (t[i].left == NIL) printf("leaf");
        else printf("internal node");
        printf(", [");
        int u = t[i].left;
        if (u != NIL) {
            printf("%d", u);
            while (t[u].right != NIL) {
                printf(", %d", t[u].right);
                u = t[u].right;
            }
        }
        printf("]\n");
    }
}


Measured memory_bytes: 4196
# coding: utf-8
# Your code here!

N,K = map(int,input().split())

vec = [int(input()) for i in range(N)]

vec.sort()

minV = 100000

l = []
for i in range(0,N-K+1):
    l.append(vec[i+K-1] - vec[i])
    

print(min(l))

Measured memory_bytes: 11292
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int a[100001];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  REP(i, n) {
    cin >> a[i];
  }

  int nh = INF + 10;
  RREP(i, n) {
    if(nh >= a[i]) {
      nh = a[i];
    } else if (nh >= a[i] - 1) {
      nh = a[i] - 1;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 640
# 非再帰版
N = int(input())

ans = 0
d = ['']
while d:
  base = d.pop()
  for c in '753':
    num = base + c
    if int(num) <= N and all(_c in num for _c in '753'):
      ans += 1
    
    if int(num) <= N:
      d.append(num)

print(ans)

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

using namespace std;

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;  cin >> n;
    int a = -1, x = 0;
    int b = -1, y = 0;
    int c = -1, z = 0;

    for(int i = 0 ; i < n ; ++i)    {
        int m;  cin >> m;
        if (a < 0)  a = m;
        if (a == m) {   x++;    continue;   }
        if (b < 0)  b = m;
        if (b == m) {   y++;    continue;   }
        if (c < 0)  c = m;
        if (c == m) {   z++;    continue;   }
        return  0 * puts("No");
    }
    if (b < 0)  return  0 * puts(a ? "No" : "Yes");
    if (c < 0)  {
        if (b)  swap(a,b), swap(x,y);
        return  0 * puts(!b && x == 2 * y ? "Yes" : "No");
    }
    if ((a ^ b) != c || x != y || y != z)
        return  0 * puts("No");
    puts("Yes");
}


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

int dp[5009][5], N, A[5009];

int main() {
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> A[i];
    for (int i = 0; i <= N + 1; i++) { for (int j = 0; j <= 4; j++) dp[i][j] = (1 << 30); }
    
    for (int i = 0; i <= 4; i++) dp[0][i] = i;
    for (int i = 1; i <= N + 1; i++) {
        for (int j = 0; j <= 4; j++) {
            if (dp[i - 1][j] == (1 << 30)) continue;
            for (int k = max(0, A[i] - j); k <= 4; k++) {
                int r = k * 2; if (i >= N) r = k;
                dp[i][k] = min(dp[i][k], dp[i - 1][j] + r);
            }
        }
    }
    int ret = (1 << 30);
    for (int i = 0; i <= 4; i++) ret = min(ret, dp[N + 1][i]);
    cout << ret << endl;
    return 0;
}



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

int main(){


	int n , k;
	cin >> n >> k;
	char s[n];
	for(int i = 1; i <= n; i++){
		cin >> s[i];
		if(k == i){
			if(s[i] == 'A')
				s[i] =  'a';
			else if(s[i] == 'B')
				s[i] = 'b';
			else
				s[i] = 'c';
		}
	}

	for(int i = 1; i <= n; i++){
		cout << s[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(s) string(s);cin >> (s)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define V vector
#define S set<int>
#define pb(v) push_back(v)
int main(){
    CIN(N);
    COUT(N/3);
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    long long N;
    cin >> N;
    if(N==1){
        cout << 0;
        return 0;
    }
    vector<long long> X(N);
    unsigned long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> X[i];
    }
    for (int i = 0; i < X.size()-1;i++){
        if(X[i] - X[i+1] >0){
            sum += X[i] - X[i + 1];
            X[i+1] += X[i] - X[i + 1];
        }
    }
        cout << sum;
    return 0;
}

Measured memory_bytes: 4812
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000003LL)

class mod {
public:
    mod() {m_n = 0;}
    mod(ll n) {if (n >= 0) m_n = n % MOD; else m_n = n % MOD + MOD;}
    friend bool operator== (const mod& a, const mod& b) {return a.m_n == b.m_n;}
    friend bool operator!= (const mod& a, const mod& b) {return !(a == b);}
    friend mod operator+ (const mod& a, const mod& b) {return (a.m_n + b.m_n) % MOD;}
    friend mod& operator+= (mod& a, const mod& b) {return a = a + b;}
    friend mod operator- (const mod& a) {return -a.m_n;}
    friend mod operator- (const mod& a, const mod& b) {return (a.m_n + (-b.m_n)) % MOD;}
    friend mod& operator-= (mod& a, const mod& b) {return a = a - b;}
    friend mod operator* (const mod& a, const mod& b) {return (a.m_n * b.m_n) % MOD;}
    friend mod& operator*= (mod& a, const mod& b) {return a = a * b;}
    friend mod mod_pow(const mod& n, ll r) {
        if (r == 0) {
            return 1;
        } else if (r < 0) {
            return mod_pow(n, (MOD - 2) * (-r));
        } else if (r % 2 == 0) {
            mod tmp = mod_pow(n, r / 2);
            return tmp * tmp;
        } else {
            return n * mod_pow(n, r - 1);
        }
    }
    friend mod operator/ (const mod& a, const mod& b) {return a * mod_pow(b, -1);}
    friend mod& operator/= (mod& a, const mod& b) {return a = a / b;}
    friend ostream& operator<< (ostream& os, const mod& n) {os << n.m_n; return os;}
    friend istream& operator>> (istream& is, mod& n) {ll tmp; is >> tmp; n = mod(tmp); return is;}
    ll m_n;
};
mod mod_pow(ll n, ll r) {return mod_pow(mod(n), r);}

#define FACT_MAX 2000000
mod t_fact[FACT_MAX], t_fact_inv[FACT_MAX];
mod fact(int n)
{
    if (n == 0 || n == 1) return t_fact[n] = 1;
    if (t_fact[n] != 0) return t_fact[n];
    else return t_fact[n] = n * fact(n-1);
}
mod fact_inv(int n)
{
    if (t_fact_inv[n] != 0) return t_fact_inv[n];
    else return t_fact_inv[n] = mod_pow(fact(n), -1);
}
mod comb(int n, int k) {if (n < 0 || k < 0 || k > n) return 0; else return fact(n) * fact_inv(n - k) * fact_inv(k);}
mod multi_choose(int n, int k) {return comb(n + k - 1, k);}

void PreCalc()
{
    t_fact[0] = 1;
    t_fact_inv[0] = 1;
    for (int i = 1; i < MOD; ++i) {
        t_fact[i] = i * t_fact[i-1];
        t_fact_inv[i] = mod_pow(t_fact[i], -1);
    }
}

mod Calc(mod x, mod d, int n)
{
    if (d == 0) return mod_pow(x, n);
    
    x /= d;
    if (x.m_n+n-1 >= MOD) {
        return 0;
    }
    
    return fact(x.m_n+n-1) * fact_inv(x.m_n-1) * mod_pow(d, n);
}

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int Q;
    cin >> Q;
    PreCalc();
    for (int q = 0; q < Q; ++q) {
        int x, d, n;
        cin >> x >> d >> n;
        cout << Calc(x, d, n) << endl;
    }

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll N; cin >> N;
  ll A[N]; rep(i,N) cin >> A[i];
  ll result = 0;
  rep(i,61) {
    ll num = (1ull<<i);
    ll count = 0;
    rep(j,N) if (A[j]&num) count++;
    result += ((((num%MOD)*count)%MOD)*(N-count))%MOD;
    result %= MOD;
    // cout << i << " " << count << endl;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 2560
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main implements Runnable {
	public static void main(String[] args) {
		new Main().run();
	}

	class State {
		int i;
		int parent;
		int j;// in the next step,go into g[i][j]

		public State(int i_, int parent_, int j_) {
			i = i_;
			parent = parent_;
			j = j_;
		}
	}

	int strongly_connected_componets(ArrayList<Integer>[] g, int[] col) {
		int n = g.length;
		Arrays.fill(col, -1);
		int cols = 0;
		int[] low = new int[n];
		int[] ord = new int[n];
		boolean[] marked = new boolean[n];
		Arrays.fill(low, -1);
		Arrays.fill(ord, -1);
		int order = 0;
		ArrayDeque<State> stk = new ArrayDeque<>();
		ArrayDeque<Integer> pnd = new ArrayDeque<>();
		for (int ii = 0; ii < n; ++ii) {
			if (ord[ii] == -1) {
				stk.add(new State(ii, -1, 0));
			}
			while (!stk.isEmpty()) {
				State s = stk.pollFirst();
				if (ord[s.i] == -1) {
					low[s.i] = (ord[s.i] = order++);
					pnd.addFirst(s.i);
				}
				if (s.j > 0 && s.parent != g[s.i].get(s.j - 1) && !marked[g[s.i].get(s.j - 1)]) {
					if (low[g[s.i].get(s.j - 1)] == -1) {
						throw new AssertionError();
					}
					low[s.i] = Math.min(low[s.i], low[g[s.i].get(s.j - 1)]);
				}
				if (s.j == g[s.i].size() && low[s.i] == ord[s.i]) {
					while (true) {
						int v = pnd.pollFirst();
						col[v] = cols;
						marked[v] = true;
						if (v == s.i)
							break;
					}
					++cols;
					continue;
				}
				if (s.j == g[s.i].size())
					continue;
				int v = g[s.i].get(s.j);
				stk.addFirst(new State(s.i, s.parent, s.j + 1));
				if (ord[v] == -1) {
					stk.addFirst(new State(v, s.i, 0));
				} else if (!marked[v]) {
					low[s.i] = Math.min(low[s.i], low[v]);
				}
			}
		}
		return cols;
	}

	@SuppressWarnings("unchecked")
	public void run() {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int V = sc.nextInt();
		int E = sc.nextInt();
		ArrayList<Integer>[] g = new ArrayList[V];
		for (int i = 0; i < V; ++i) {
			g[i] = new ArrayList<>();
		}
		for (int i = 0; i < E; ++i) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			g[s].add(t);
		}
		int[] col = new int[V];
		strongly_connected_componets(g, col);
		int q = sc.nextInt();
		while (q-- > 0) {
			int u = sc.nextInt();
			int v = sc.nextInt();
			System.out.println(col[u] == col[v] ? "1" : "0");
		}
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}

Measured memory_bytes: 100316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int black[200050];
int white[200050];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if((b - c) * (c - a) >= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    bool flag1 = false;
    bool flag2 = false;

    rep(i, n) {
        if (s[i] == 'C') flag1 = true;
        if (flag1 && s[i] == 'F') flag2 = true;
    }
    if (flag2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = [int(x) for x in input().split()]

X = [[0]*N for _ in range(M)]
for i in range(M):
    u = [int(x) for x in input().split()]
    k = u[0]
    for j in range(1, k + 1):
        X[i][u[j] - 1] = 1

p = [int(x) for x in input().split()]

ans = 0
for b in range(2**N):
    q = [0]*M
    for i in range(M):
        for j in range(N):
            if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
    if q == p:
        ans += 1

print(ans)

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

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

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

	if (a[0] == '7' || a[1] == '7' || a[2] == '7')
	{
		puts("Yes");
	}else
	{
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#define L64 long long

#define ASDF (1000000007LL)
#define MODADD(A, B) (A = (A + B) % ASDF)

L64 modpow(L64 src, L64 pow, L64 mod)
{
    L64 res = 1;
    while (0 < pow) {
        if (pow % 2 == 1) {
            res = (res * src) % mod;
            pow--;
        }
        src = (src * src) % mod;
        pow /= 2;
    }
    return res;
}

L64 modinv(L64 src, L64 mod)
{
    return modpow(src, mod - 2, mod);
}

L64 getConv(L64 n, L64 k)
{
    L64 ret = 1;
    for (L64 i = 1; i <= k; i++) {
        ret = (ret * (n + 1 - i)) % ASDF;
        ret = (ret * modinv(i, ASDF)) % ASDF;
    }
    return ret;
}

int main(void)
{
    L64 h, w, a, b;
    std::cin >> h >> w >> a >> b;
    L64 sum = 0;
    /* get ue */
    L64 n, k, n2, k2;
    n = h - a - 1 + b;
    k = h - a - 1;
    n2 = a + w - b - 2;
    k2 = a - 1;
    L64 val = 1;
    L64 val2 = 1;
    for (L64 i = 0; i < w - b; i++) {
        if (i == 0) {
            val = getConv(n, k);
            val2 = getConv(n2, k2);
        }
        else {
            val = (val * (n + i)) % ASDF;
            val = (val * modinv(n + i - k, ASDF)) % ASDF;
            val2 = (val2 * (n2 + 1 - i - k2)) % ASDF;
            val2 = (val2 * modinv(n2 + 1 - i, ASDF)) % ASDF;
        }
        sum = MODADD(sum, (val * val2) % ASDF);
    }
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k;
vi a;

int main(){
	cin>>n>>k;
	a=vi(n);
	ll t=0;
	for(auto &i:a){
		cin>>i;
		t+=i;
	}
	sort(a.rbegin(),a.rend());
	for(int i=0;i<min(n,k);i++) t-=a[i];
	cout<<t<<endl;
}

Measured memory_bytes: 1024
using System;

public class hello
{
    public static void Main()
    {
        var ticket = new int[] { 6000, 4000, 3000, 2000 };
        for (int i = 0; i < 4; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var t = int.Parse(line[0]);
            var n = int.Parse(line[1]);
            Console.WriteLine(ticket[t - 1] * n);
        }
    }
}

Measured memory_bytes: 9168
//Name: League Match Score Sheet
//Level: 1
//Category: やるだけ
//Note: 

/**
 * 入力時に勝ち点を計算し、ソートする。
 *
 * オーダーは O(N log N)。
 */
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;
    if(!N) return false;
    if(!first) cout << endl;

    vector<pair<int,string>> vs;
    for(int i = 0; i < N; ++i) {
        string t;
        int w, l, e;
        cin >> t >> w >> l >> e;
        vs.emplace_back(w*3 + e, t);
    }
    stable_sort(begin(vs), end(vs), [](const pair<int,string> &a, const pair<int,string> &b){return a.first > b.first;});
    for (const auto &t : vs) {
        cout << t.second << "," << t.first << endl;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) first = false;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
int mpow(int n,int m){
    int ret=1;
    while(m){
        if(m&1)ret=ret*n%mod;
        n=n*n%mod;
        m>>=1;
    }
    return ret;
}
const int FACT_SIZE=2222222;
int fact[FACT_SIZE];
int inv[FACT_SIZE];
struct fact_exec{
    fact_exec(){
        fact[0]=1;
        for(int i=1;i<FACT_SIZE;i++)fact[i]=fact[i-1]*i%mod;
        inv[FACT_SIZE-1]=mpow(fact[FACT_SIZE-1],mod-2);
        for(int i=FACT_SIZE-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
    }
}factexec;
int nCk(int n,int k){
    if(n<0|k<0||k>n)return 0;
    return fact[n]*inv[k]%mod*inv[n-k]%mod;
}
int nPk(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*inv[n-k]%mod;
}

int N;
signed main(){
    cin>>N;

    if(N==2){
        cout<<1<<endl;
        return 0;
    }
    N--;

    int ans=N*fact[N]%mod;
    add(ans,mod-(N-2)*fact[N-1]%mod);
    for(int i=2;i<N;i++){
        int b=N-2-i-(i-1);
        int tmp=nCk(i+b,b)*fact[N-i]%mod*fact[i]%mod;
        add(ans,mod-tmp);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
    int N,D;
    cin >> N >> D;
    vector<vector<int>>X(N,vector<int>(D));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < D; j++) {
            cin >> X[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            if(i == j) {
                continue;
            }
            int cnt = 0;
            for(int k = 0; k < D; k++) {
                cnt+=abs(X[i][k]-X[j][k])*abs(X[i][k]-X[j][k]);
            }
            for(int k = 0; k*k <= cnt; k++) {
                if(k*k == cnt) {
                    ans++;
                }
            }
        }
    }
    cout << ans/2 << endl;
}

Measured memory_bytes: 256
N = int(input())
music_list=[]

for i in range(N):
    music_list.append(input().split(' '))

kyoku = input()

for i in range(N):
    if kyoku == music_list[i][0]:
        index = i

result = 0

for i in range(index+1, N):
    result += int(music_list[i][1])

print(result)


Measured memory_bytes: 3060
N, K = map(int, input().split())
a = list(map(int, input().split()))

dp = [0] * (K + 1)

for i in range(1, K + 1):
    for j in range(N):
        if i - a[j] >= 0 and dp[i - a[j]] == 0:
            dp[i] = 1

print('First' if dp[K] else 'Second')


Measured memory_bytes: 9468
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
const int mod=1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main(){
    int x;
    cin >> x;
    int dp[x+200] = {0};
    dp[0] = 1;
    rep(i,0,x){
        if(dp[i]>0){
            dp[i+100]++;
            dp[i+101]++;
            dp[i+102]++;
            dp[i+103]++;
            dp[i+104]++;
            dp[i+105]++;
        }
    }
    if(dp[x]>0){
        puts("1");
    }else{
        puts("0");
    }

    //cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

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

  int n, a, b;
  cin >> n >> a >> b;
  if ((b - a) % 2 == 0) {
    cout << "Alice" << endl;
  } else {
    cout << "Borys" << endl;
  }
  return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

  bool can = true;
  for (int i = 0; i < n; i++) {
    if (v[i] % 2 == 0 && v[i] % 5 != 0 && v[i] % 3 != 0) can = false;
  }
  if (can)
    cout << "APPROVED" << endl;
  else
    cout << "DENIED" << endl;
}


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

namespace Practice
{
    class Program
    {

        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        static void SolveA(string[] args)
        {
            int q = int.Parse(Console.ReadLine());
            for(int i=0;i<q;++i)
            {
                string x = Console.ReadLine();
                string y = Console.ReadLine();
                int lcs = LCS(x, y);
                Console.WriteLine(lcs);
            }
        }
        static int LCS(string x, string y)
        {
            int m = x.Length;
            int n = y.Length;
            int[,] c = new int[m+1, n+1];
            for(int i=1;i<=m;++i)
            {
                for(int j=1;j<=n;++j)
                {
                    if(x[i-1] == y[j-1])
                    {
                        c[i, j] = c[i - 1, j - 1] + 1;
                    }else
                    {
                        c[i, j] = Math.Max(c[i - 1, j], c[i, j - 1]);
                    }
                }
            }
            return c[m, n];
        }
    }

}



Measured memory_bytes: 13040
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    string S;
    cin >> S;
    bool a = true;
    int c = 0, lit = 0;
    if(S[0]!='A') a = false;
    REP(i,S.size()){
        if(i>=2 && i<= S.size()-2 && S[i] == 'C') c++;
        if(S[i] >= 'a' && S[i] <= 'z') lit++;
    }
    if (a && c == 1 && lit == S.size()-2) 
        cout << "AC" << endl;
    else cout << "WA" << endl;
    
    //cout << ans << endl;
}

Measured memory_bytes: 256
import sys
while True:
  a=int(input())
  if a==0: break
  ans,name1,name2=[],[],[]
  hogehoge=0
  for i in range(a):
    hoge=map(int,raw_input().split())
    if hoge[0] in name2:
      ww = hoge[1]*hoge[2]
      r = name2.index(hoge[0])
      if len(str(ans[r]+ww)) >= 7: 
        hogehoge+=1
        name1.append(hoge[0])
      else:
        ans[r]+=ww
    else:
      qq = hoge[1]*hoge[2]
      if len(str(qq)) >= 7: 
        hogehoge+=1
        name1.append(hoge[0])
      else: 
        name2.append(hoge[0])
        ans.append(qq)
  if hogehoge == 0: print "NA"
  else: 
    for i in range(len(name1)):
      print name1[i]

Measured memory_bytes: 5216
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

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

int n, m;

int get(int x, int y){
   return x + n - y;
}

int32_t main(){_
   
   
   cin >> n >> m;

   int l = 1, r = n;
   vector<vector<int>> v;
   
   for (int i = 0; i < m; ++i)
   {
      assert(l < r);
      v.push_back({l, r});
      ++l, --r;
   }

   if (n % 2 == 0){
      
      v.clear();
      v.push_back({1, n});
      set<int> s;
      s.insert(n-1);
      s.insert(get(1, n));

      int l = 2, r = n-1;
      for (int i = 0; i+1 < m; ++i)
      {
         int d1 = r - l;
         int d2 = get(l, r);
         if (s.count(d1) or s.count(d2) or d1 == d2){
            r--;
         }
         v.push_back({l, r});
         d1 = r - l;
         d2 = get(l, r);
         s.insert(d1);
         s.insert(d2);
         --r, ++l;
      }
   }

   for(auto it: v){
      cout<<it[0]<<" "<<it[1]<<endl;
   }


   return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> p(H,vector<char>(W));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W ;j++){
      cin >> p.at(i).at(j);
    }
  }
  
  for(int i = 0; i < H; i++){
    bool isspace = true;
    for(int j = 0; j < W ;j++){
      if(p.at(i).at(j) == '#'){
        isspace = false;
        break;
      }
    }    
    if(isspace){
      for(int k = i; k < H-1; k++){
        for(int l = 0; l < W ;l++){
          p.at(k).at(l) = p.at(k+1).at(l);
        }  
      }
      H--;
      i--;
    }
  }
  
  for(int j = 0; j < W; j++){
    bool isspace = true;
    for(int i = 0; i < H ;i++){
      if(p.at(i).at(j) == '#'){
        isspace = false;
        break;
      }
    }    
    if(isspace){
      for(int k = j; k < W-1; k++){
        for(int l = 0; l < H ;l++){
          p.at(l).at(k) = p.at(l).at(k+1);
        }  
      }
      W--;
      j--;
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W ;j++){
      cout << p.at(i).at(j);
      if(j == W-1){
        cout << endl;
      }
    }
  }
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    string pre = s.substr(0, (n-1)/2);
    string post = s.substr((n+1)/2, (n-1)/2);

    string ans = "Yes";
    if (pre == post) {
        rep(i, pre.size()/2) {
            if (pre[i] != pre[pre.size()-i-1]) {
                ans = "No";
                break;
            }
        }
    } else {
        ans = "No";
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256