akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using ll = long long;
using namespace std;

#define int ll

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define YES(f) if((f)){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(f) if((f)){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(12)

#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);

#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
#define MOD 1000000007

template<class T>
inline T GET() {
	T x;
	cin >> x;
	return x;
}


void init();
void solve();

signed main()
{
	init();
	solve();
}

void init()
{
	int N;
	cin >> N;
	vector<int> C;
	rep(i, N) C.PB(GET<int>());
	vector<int> dp(N+1, 1);
	vector<int> cnt(1000000, 0);
	rep(i, N) {
		dp[i+1] = dp[i];
		if (C[i] == C[i-1]) continue;
		dp[i+1] += cnt[C[i]];
		cnt[C[i]] = dp[i+1];
		dp[i+1] %= MOD;
	}
	cout << dp[N] << endl;
}

void solve()
{
}




Measured memory_bytes: 11376
#include <iostream>

using namespace std;

int main() {
  int n = 0;
  cin >> n;
  long long a = 1, b = 1;
  int tmp = 0;
  for (int i=0; i<n; i++) {
    cin >> tmp;
    a *= 3;
    if (tmp%2 == 0) {
      b *= 2;
    }
  }
  cout << a - b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;


char maze[29][29];
int d[409][409];
int H, W; 
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
bool check(int x, int y) {
	bool flag = true;
	if (x < 1) flag = false;
	if (y < 1) flag = false;
	if (x > H) flag = false;
	if (y > W) flag = false;
	return flag;
}

int V;
void warshall_floyd() {
	// 初期化
	for (int i = 0; i < V; i++) {
		for (int j = 0; j <= V; j++) {
			if (i != j && d[i][j] == 0) d[i][j] = INF; // この初期化を忘れてはいけない
													   // i == jのときは d[i][i] = 0
		}
	}

	for (int k = 0; k < V; k++) {
		for (int i = 0; i < V; i++) {
			for (int j = 0; j < V; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

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

	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) cin >> maze[i][j];
	}

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			for (int k = 0; k < 4; k++) {
				int nx = i + dx[k];
				int ny = j + dy[k];
				if (check(nx, ny)) {
					if (maze[i][j] == '.' && maze[nx][ny] == '.') {
						d[(i - 1) * W + j-1][(nx - 1) * W + ny-1] = 1;
					}
					else d[(i - 1) * W + j-1][(nx - 1) * W + ny-1] = INF;
				}
			}
		}
	}
	
	V = H * W;
	warshall_floyd();

	int ans = 0;
	for (int i = 0; i < V; i++) {
		for (int j = 0; j < V; j++) {
			if (d[i][j] < INF) {
				ans = max(ans, d[i][j]);
			}
		}
	}

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

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>

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

using namespace std;

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

int n, m;
char x[100][101];

void dfs(int i, int j){
  char c = x[i][j];
  x[i][j] = 0;
  rep(k, 4){
    int p = i + dx[k];
    int q = j + dy[k];
    if(0 <= p && p < n && 0 <= q && q < m && x[p][q] == c){
      dfs(p, q);
    }
  }
}

int main(){
  while(1){
    cin >> n >> m;
    if(!n){
      break;
    }
    rep(i, n){
      cin >> x[i];
    }
    int ans = 0;
    rep(i, n){
      rep(j, m){
        if(x[i][j]){
          dfs(i, j);
          ++ans;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647

int main() {
  kyun;
  int n;
  cin >> n;
  bool ans = 0;
  repa(i,1,10) {
    repa(j,1,10) {
      if(i*j == n) ans = 1;
    }
  }
  if(ans) cout << "Yes";
  else cout << "No";
  hinata;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int H = sc.nextInt();
        int[] b = new int[N];
        int aMax = Integer.MIN_VALUE;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            aMax = Math.max(a,aMax);
            b[i] = sc.nextInt();
        }
        Arrays.sort(b);
        int pos = -1;
        for(int i=N-1; i>=0; i--){
            if(aMax>=b[i]){
                pos = i;
                break;
            }
        }
        if(pos!=-1){
            for(int i=N-1;i>=pos+1; i--){
                H = H-b[i];
                if(H<=0){
                    System.out.println(N-i);
                    System.exit(0);
                }
            }
            int last = H%aMax==0?H/aMax:(H/aMax+1);
            System.out.println(N-pos-1+last);
        }
        else{ // least throw is more powerful than highest wield
            for(int i=N-1;i>=0; i--){
                H = H-b[i];
                if(H<=0){
                    System.out.println(N-i);
                    System.exit(0);
                }
            }
            int last = H%aMax==0?H/aMax:(H/aMax+1);
            System.out.println(N+last);
        }
    }
}

Measured memory_bytes: 65968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,ans,v[55],c[55];
int main(){
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> v[i];
	for(int i=0;i<n;i++){
		cin >> c[i];
		if(v[i]>c[i])ans+=v[i]-c[i];
	}
	cout << ans;
	return 0;
}

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

using namespace std;

const int N = 21;

const int mod = 1e9+7;

int n;
int yes[N][N];
int mem[N][1 << N];

int go(int idx , int msk){
    if(idx == n)
        return 1;
    int &ret = mem[idx][msk];
    if(~ret)
        return ret;
    ret = 0;
    for(int i = 0; i < n; i++){
        if(msk & (1 << i))
            continue;
        if(yes[idx][i]){
            ret = (go(idx + 1 , msk ^ (1 << i)) + ret) % mod;
        }
    }
    return ret;
}

int main(){
    scanf("%d" , &n);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            int x;
            scanf(" %d" , &x);
            yes[i][j] = x;
        }
    }
    memset(mem , -1 , sizeof mem);
    printf("%d\n" , go(0 , 0));
}


Measured memory_bytes: 175860
#include<iostream>
using namespace std;
int main(){
	int x,s,sum=0;
	cin>>x;
	s=x;
	if(x<15)
	{
		cout<<(s*800);}
	else 
	{
	while(x>=15)
	{sum=sum+1;
	x=x-15;
	}
		cout<<(s*800)-(200*sum);
}
	
	
	
	
	
	
	
	
	
	
	
	
	
}

Measured memory_bytes: 256
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())

    if n == 1:
        print("Hello World")
    else:
        a = int(input())
        b = int(input())
        print(a+b)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXN = 104;
int a[MAXN][MAXN];
int dp[MAXN][MAXN][2];
int n,m; 

int rec(int x,int y,int type){
    if(x == n && y == m){
        if(a[x][y] == 0) return 0;
        else return 1;
    }

    int &ans = dp[x][y][type];
    if(ans != -1) return ans;

    ans = 1e9;

    FOR(ty,0,1){
        if(type == ty){
            if(x + 1 <= n && a[x+1][y] == ty) ans = min(ans,rec(x+1,y,ty));
            if(y + 1 <= m && a[x][y+1] == ty) ans = min(ans,rec(x,y+1,ty));
        }else {
            if(x + 1 <= n && a[x+1][y] == ty) ans = min(ans,rec(x+1,y,ty) + 1);
            if(y + 1 <= m && a[x][y+1] == ty) ans = min(ans,rec(x,y+1,ty) + 1);
        }
    }

    return ans;
}

void solve(){

    cin>>n>>m;
    MINUS(dp);

    FOR(i,1,n) FOR(j,1,m){
        char x; cin>>x; 
        if(x == '#') a[i][j] = 1;
        else a[i][j] = 0;
    }


    int ans = 0;
    if(a[1][1] == 0) ans = rec(1,1,0);
    else ans = rec(1,1,1) + 1;
    cout<<ans/2<<endl;
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 512
N = int(input())
def n_ary_notation(N, n):
  if N == 0:
    return '0'
  else:
    s = ''
    while N:
      s = str(N % abs(n)) + s
      N -= N % abs(n)
      N //= n
    return s
print(n_ary_notation(N, -2))

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

using namespace std;

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

//int dxy[5] = {0, 1, 0, -1, 0};
// 01Trie BIT CHT DFT FFT avl cmd cusum dijkstra dinic geo2 gin graph kruskal lca lcm matrix ncm next_combination ppuf segtree st tmp topcoder uf vi 

struct Monoid {
    using T = int;
    T operator()(const T &a, const T& b) { return (a + b); }
    const T I = 0;
};
struct SegmentTree {
    using T = Monoid::T;
    Monoid op;
    int n;
    vector<T> d;
    SegmentTree(int m) {
        for (n = 1; n < m; n *= 2);
        d.assign(2 * n - 1, op.I);
    }
    void update(int k, T x) {
        k += n - 1;
        d[k] = x;
        while (k > 0) {
            k = (k - 1) / 2;
            d[k] = op(d[2 * k + 1], d[2 * k + 2]);
        }
    }
    T query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l)return op.I;
        if (a <= l&&r <= b)return d[k];
        T xl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T xr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return op(xl, xr);
    }
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
};

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

    Int(n);
    vector<int> data(n);
    SegmentTree kyoko(n);
    map<int, vi> funami;
    for (int i = 0; i < n; i++) {
        cin >> data[i];
        kyoko.update(i, 1);
        funami[data[i]].pb(i);
    }

    int ans = 0;

    for (auto i : funami) {
        int left = 0, right = i.sec.size()-1;
        //cout << "call : " << i.fir << endl;
        rep(j, i.sec.size()) {
            int lscore = kyoko.query(0, i.sec[left]),
                rscore = kyoko.query(i.sec[right]+1, n);
            if (lscore < rscore) {
                ans += lscore;
                kyoko.update(i.sec[left], 0);
                left++;
            } else {
                ans += rscore;
                kyoko.update(i.sec[right], 0);
                right--;
            }
            //cout << lscore << " " << rscore << endl;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 16552
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
-----------------------
local N = read.n()
local A = read.N(N)
local c = 0
for i=1,N do
    if i % 2 == 1 and A[i] % 2 == 1 then
        c = c + 1
    end
end
print(c)

Measured memory_bytes: 2728
import math
import re
import copy
import sys

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0

for i in range(n):
    c += min(a[i],b[i])
    if a[i] < b[i]:
        c += min(a[i+1],b[i]-a[i])
        a[i+1] -= min(a[i+1],b[i]-a[i])

print(c)

Measured memory_bytes: 86748
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }
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;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


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

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

    int ab, bc, ca;
    cin >> ab >> bc >> ca;

    cout << ab*bc/2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
using LL = long long;
const int N = 100005;
const int M = 200005;
LL hei[N];//高度
bool st[N];//标记每个点
int h[N], e[M], ne[M], idx;

void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	
	for (int i = 1; i <= n; ++i)
		scanf("%lld", &hei[i]);

	memset(h, -1, sizeof h);
	int a, b;
	for (int i = 1; i <= m; ++i)
	{
		scanf("%d%d", &a, &b);
		add(a, b), add(b, a);
	}

	int res = 0;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = h[i]; j != -1; j = ne[j])
		{
			int u = e[j];
			if (hei[i] <= hei[u]) st[i] = true;
		}
	}

	for (int i = 1; i <= n; ++i)
	{
		if (!st[i]) ++res;
	}

	printf("%d\n", res);

	return 0;
}

Measured memory_bytes: 6660
// ABC 081 A
#include<bits/stdc++.h>

using namespace std;
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define PB(a) push_back(a)
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------

  int a,b;
  str s;
  int  ans=0;
  cin >> s;
//  VI a(N);
  EACH(i,s){
    if(*i=='1') ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
n =int(input())
a = list(map(int,input().split()))
if a.count(0) >0:
    print(0)
    sys.exit()
b = 1
for i in range(n):
    b *= a[i]
    if b> 10**18:
        print("-1")
        sys.exit()
print(b)


Measured memory_bytes: 21764
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:00:46 2020

@author: saito
"""

# %% import phase

# %% define phase

# %% input phase
N = input()

# %% process phase
a = list(map(int, N))
if sum(a) % 9 == 0:
    ans = 'Yes'
else:
    ans = 'No'


# %%output phase
print(ans)

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

using namespace std;
#define ll long long

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif

int N, M;

bool m[21][21];
int X, Y;

void mygo(int x, int y, int dx, int dy, int cnt)
{
	if (cnt == 0) return;
	m[x][y] = false;
	X = x;
	Y = y;
	mygo(x+dx, y+dy, dx, dy, cnt-1);
}

int main()
{
	cin >> N;
	while (N) {
		rep(i, N) {
			CIN(int, a);
			CIN(int, b);
			m[a][b] = true;
		}
		cin >> M;
		X = Y = 10;
		rep(i, M) {
			CIN(char, c);
			CIN(int, a);
			int dx = 0, dy = 0;
			if (c == 'N') dy = 1;
			if (c == 'E') dx = 1;
			if (c == 'S') dy = -1;
			if (c == 'W') dx = -1;
			mygo(X+dx, Y+dy, dx, dy, a);
		}
		bool f = false;
		rep(i, 21) rep(j, 21) {
			f |= m[i][j];
			m[i][j] = false;
		}
		PRINT(!f);
		cin >> N;
	}
}



Measured memory_bytes: 3020
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b,c,d = readInts()
ad = a-1
cdg = gcd(c,d)
cdl = c*d//cdg
b = b - b//c - b//d + b//cdl
ad = ad - ad//c - ad//d + ad//cdl
print(b-ad)


Measured memory_bytes: 10624
def dfs(now):
    if vis[now]:
        return 0
    vis[now]=1
    for i in range(n):
        if graph[now][i]:
            dfs(i)
n,m=map(int,input().split())
edge=[[int(i) for i in input().split()]for i in range(m)]
graph=[[0 for i in range(n)]for i in range(n)]
for i in range(m):
    graph[edge[i][0]-1][edge[i][1]-1]=1
    graph[edge[i][1]-1][edge[i][0]-1]=1
vis=[0]*n
ans=0
for i in range(m):
    graph[edge[i][0]-1][edge[i][1]-1]=0
    graph[edge[i][1]-1][edge[i][0]-1]=0
    vis=[0]*n
    dfs(0)
    connect=False
    for j in range(n):
        if vis[j]==0:
            connect=True
    if connect:
        ans+=1
    graph[edge[i][0]-1][edge[i][1]-1]=1
    graph[edge[i][1]-1][edge[i][0]-1]=1

print(ans)


Measured memory_bytes: 3064
# シェルソート
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D&lang=jp
# 挿入ソートを応用してn個の整数を含む数列Aを昇順に整列するプログラム

def show(array):
    for i in range(len(array)):
        if (i+1) >= len(array):
            print(array[i])
        else:
            print(array[i], end=' ')

def insertion_sort(c, g):
    n = len(c)
    count = 0
    for i in range(g, n):
        v = c[i]
        j = i - g
        while j >= 0 and c[j] > v:
            c[j+g] = c[j]
            j = j - g
            count += 1
        c[j+g] = v
    return c, count


def shell_sort(c, G):
    counts = 0
    for g in G:
        co, count = insertion_sort(c, g)
        counts += count
    return co, counts


def main():
    n = int(input())
    c = [int(input()) for _ in range(n)]

    # For making G
    n = len(c)
    g = []
    for m in range(1, 100):
        t = (3 ** m - 1) // 2
        if t > n:
            break
        g.append(t)
    g = g[::-1]

    result, count = shell_sort(c, g)

    print(m-1)
    show(g)
    print(count)
    for num in result:
        print(num)

main()


Measured memory_bytes: 45528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll mod = 1e9 + 7;
int N, K;
pair<int, int> E[200001];
int H[100001];
ll kotae;

void dfs(int A, int B, int C, int mae) {
	int k = max(0, K - B - C);
	kotae = kotae * k % mod;
	int b = 0;
	int c = min(2, C + 1);
	for (int i = H[A]; i; i = E[i].second) {
		if (E[i].first != mae) {
			dfs(E[i].first, b, c, A);
			b++;
		}
	}
}

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


	N = getint();
	K = getint();
	rep1(i, 2 * (N - 1)) {
		int a = getint(), b = getint();
		E[i] = mp(b, H[a]);
		H[a] = i++;
		E[i] = mp(a, H[b]);
		H[b] = i;
	}
	kotae = 1;
	dfs(1, 0, 0, 0);
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 5888
use std::io;
use std::cmp;

// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}

fn main() {

    let l = read_t_in_line::<i32>();
    let (n, _, x) = (l[0], l[1], l[2]);

    let mut v = vec![0 ; (n + 1) as usize];

    let a = read_t_in_line::<i32>();

    for aa in a {
        v[aa as usize] = 1;
    }
    

    let mut c1 = 0;
    let mut c2 = 0;
    for i in 0..(n+1) {
        if i < x {
            c1 += v[i as usize];
        }
        else{
            c2 += v[i as usize];
        }
    }
    println!("{}", min(c1, c2));

    
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end



int main(){
   int a,b,c; scanf("%d%d%d",&a,&b,&c);
   bool f=0;
   if(a==b&&b!=c)f=1;
   if(b==c&&c!=a)f=1;
   if(c==a&&a!=b)f=1;
   printf(f?"Yes\n":"No\n");
   return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;
import std.math;

int x, y;

int distance(int u, int v) {
  return abs(x-u) + abs(y-v) + 1;
}

void main() {
  int n;
  readf("%d %d %d", &n, &x, &y);
  x--; y--;
  int[][] table = new int[][](n, n);
  int[] list = new int[](n-1);
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      if(i>=j) table[i][j] = -1;
      else {
        auto v1 = j-i;
        auto v2 = distance(i, j);
        auto value = v1 < v2 ? v1 : v2;
        if(value > 0) list[value-1]++;
      }
    }
  }
  for(int k=0; k<n-1; k++) writeln(list[k]);
}


Measured memory_bytes: 18044
#include <iostream>
#include <string>

using namespace std;

string check(int a, int b, int c);

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  string res = check(a, b, c);
  cout << res << endl;
}

string check(int a, int b, int c){
  int array[3] = {a, b, c};
  int five = 2;
  int seven = 1;

  for (int i = 0; i < 3; ++i){
    if (array[i] == 5){
      five -= 1;
    }else if (array[i] == 7){
      seven -= 1;
    }else{
      return "NO";
      break;
    }
  }

  if (five == 0 and seven == 0){
      return "YES";
  }else{
    return "NO";
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <iomanip>
#include <queue>
#include <map>
#include <unordered_map>
typedef long long ll;
using namespace std;


int main()
{
	int A,B;
	std::cin >> A >> B;

	if(A*B%2 == 1){
		std::cout << "Odd" << std::endl;
	}else{
		std::cout << "Even" << std::endl;
	}

	return 0;

}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)

	X := getInt()

	Y := X % 100
	X /= 100
	//out(Y, X)
	if X*5 >= Y {
		out(1)
		return
	}
	out(0)
}


Measured memory_bytes: 640
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))


(princ (ceiling (read) (read)))


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

int main(){
  int n,a,b;
  cin>>a>>b;
  char s[100][100];

  for(int i=0;i<50;i++){
    for(int j=0;j<100;j++){
      s[i][j]='#';
    }
  }
  for(int i=50;i<100;i++){
    for(int j=0;j<100;j++){
      s[i][j]='.';
    }
  }

  int x=0,y=0;
  for(int i=1;i<a;i++){
    s[x][y]='.';
    if(y>=98) x+=2,y=0;
    else y+=2;
  }

  x=51;y=0;
  for(int i=1;i<b;i++){
    s[x][y]='#';
    if(y>=98) x+=2,y=0;
    else y+=2;
  }

  cout<<"100 100"<<endl;
  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
      cout<<s[i][j];
    }
    cout<<endl;
  }
  return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    int N;
    cin >> N;
    vector<ll> H(N);
    for(int i = 0; i < N; i++){
        cin >> H[i];
    }

    ll tmp = H[0];
    bool ans = true;
    for(int i = 1; i < N; i++){
        if(H[i] >= tmp){
            tmp = H[i];
        }else if((tmp - H[i]) >= 2){
            ans = false;
        }
    }

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

    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second

ll knapSack( ll W, ll wt[], ll val[], ll n) 
{ 
    // array to store final result 
    //dp[i] stores the profit with KnapSack capacity "i" 
    ll dp[W+1]; 
      
    //initially profit with 0 to W KnapSack capacity is 0 
    memset(dp, 0, sizeof(dp)); 
  
    // iterate through all items 
    for(ll i=0; i < n; i++)  
        //traverse dp array from right to left 
        for(ll j=W; j>=wt[i]; j--) 
            dp[j] = max(dp[j] , val[i] + dp[j-wt[i]]); 
    /*above line finds out maximum of  dp[j](excluding ith element value) 
      and val[i] + dp[j-wt[i]] (including ith element value and the 
      profit with "KnapSack capacity - ith element weight") */    
    return dp[W]; 
} 

int main() {
	ll n,W;
	cin>>n>>W;
	ll v[n],w[n];
	rep(i,n){
		cin>>w[i]>>v[i];
	}
	cout<<knapSack(W,w,v,n);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;

    C*=2;

    int ans;
    if(C>=A+B){
        ans=A*X+B*Y;
    }
    else{
        if(X>=Y){
            ans=C*Y+min(A,C)*(X-Y);
        }
        else{
            ans=C*X+min(B,C)*(Y-X);
        }
    }
    cout<<ans<<endl;

}


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

int main() {
  int H,W,A,B;
  cin>>H>>W>>A>>B;
  rep(i,H){
    if(i<B){
      rep(j,W){
        if(j<A) cout<<0;
        else cout<<1;
      }
      cout<<endl;
    }
    else {
     rep(j,W){
      if(j<A) cout<<1;
      else cout<<0;
     }
      cout<<endl;
    }
  }     
  return 0;
}


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

using namespace std;


int main() {
	long long n;
	long long count = 0;

	cin >> n;
	for (long long i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			count += i;
		}
	}

	cout << count;

}


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

int main(void){
	int a=0;
	int b=0;
	char c[80];
	scanf("%d %d", &a, &b);
	do{
		sprintf(c, "%d", a+b);
		printf("%d\n", strlen(c));
	}while(scanf("%d %d", &a, &b) != EOF);
	return 0;
}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double

// ABC167 C - Skill Up
int main(){
  ll n, m, x;
  cin >> n >> m >> x;
  vector<ll> c(n, 0);
  VECTOR_DIM2(ll, a, n, m, 0);
  rep(i, n) {
    cin >> c[i];
    rep(j,m) {
      cin >> a[i][j];
    }
  }

  ll minCost = LONG_LONG_MAX;
  for (int buymap = 0; buymap <= (1 << n); ++buymap) {
    ll cost = 0;
    vector<ll> rikaido(m, 0);
    for (int i = 1; i <= n; ++i) {
      if ((buymap & (1 << (i-1))) > 0) {
        cost += c[i-1];
        rep(j, m) {
          rikaido[j] += a[i-1][j];
        }
      }
    }
    if (std::all_of(rikaido.cbegin(), rikaido.cend(), [&x](const ll& r)->bool{ return r >= x; })) {
      if (minCost > cost) {
        minCost = cost;
      }
    }
  }
  cout << ((minCost == LONG_LONG_MAX) ? -1 : minCost) << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 1e16;

void solve(long long N, std::vector<long long> a) {
  ll maxNum = -INF;
  ll maxIndex = -1;
  ll minNum = INF;
  ll minIndex = -1;
  rep(n, N) {
    if (a[n] < minNum) {
      minIndex = n;
      minNum = a[n];
    }

    if (a[n] > maxNum) {
      maxIndex = n;
      maxNum = a[n];
    }
  }

  print(2 * N - 1);

  // すべての符号を揃えて累積和
  if (maxNum > -minNum) {
    rep(n, N) { print(maxIndex + 1 << " " << n + 1); }
    rep(n, N - 1) { print(n + 1 << " " << n + 2); }
  } else {
    rep(n, N) { print(minIndex + 1 << " " << n + 1); }
    rrep(n, N - 1) { print(n + 2 << " " << n + 1); }
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, std::move(a));
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    int cntk = 0, cntg = 0;
    rep(i,n){
        cin >> a[i];
        if(a[i]%2==0)
            cntg++;
            else
                cntk++;
    }
    if(cntk%2==1)
        cout << "NO" << endl;
        else 
            cout << "YES" << endl;
        return 0;
}

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

int main(void){
	int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 
               14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n;cin >> n;
	cout << a[n-1];
return 0;
}

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());


signed main()
{
    gearup;
    ll n; cin >> n;
    ll wa = n/15;
    out(800*n - 200 * wa);
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

int main()
{
    string s;
    cin >> s;
    bool flag = (s[0] == s[1]) && (s[1] == s[2]);

    if (!flag)
        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 all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> a(n + 1, 0);
    for (int i = 1; i <= n; ++i) cin >> a[i];
    vector<int> ball(n + 1, 0);

    for (int i = n; i > 0; --i) {
        int m = i;
        int k = 2;
        int cnt = 0;

        while (true) {
            int p = m * k;
            if (p > n) break;
            cnt += ball[p];
            k++;
        }

        if (cnt % 2 != a[i]) ball[i] = 1;
    }

    vector<int> ans;
    for (int i = 1; i <= n; ++i) if (ball[i]) ans.push_back(i);
    int res = 0;
    for (int i = 1; i <= n; ++i) if (ball[i]) res++;
    cout << res << endl;
    for (auto e: ans) cout << e << " ";
    cout << endl;
}


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
typedef long long ll;
using namespace std;

int main(){
  char w[100];
  int a[30] = {0};
  bool flag = true;

  scanf("%s", w);

  for(int i = 0; i < strlen(w); i++){
    a[w[i]-'a']++;
  }
  /*
  for(int i = 0; i < 30; i++){
    printf("%d\n", a[i]);
  }
  */
  for(int i = 0; i < 30; i++){
    if(a[i] % 2 == 1){
      printf("No\n");
      flag = false;
      break;
    }
  }
  if(flag){
    printf("Yes\n");
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
int main(){
  int n;
  	cin>>n;
  vector<int>A(n);
  cin>>A[0];
  
  for(int i=1;i<n;i++){
	cin>>A[i];
    A[i]+=A[i-1];
  }
  
  int ans=10000;
  for(int i=0;i<n-1;i++){
	ans=min(ans,abs(A[n-1]-2*A[i]));
  }
  
  cout<<ans<<endl;
}
    

Measured memory_bytes: 256
s = list(input())
l = 0
r = len(s)-1
ans = 0
while l < r:
    if s[l] == s[r]:
        l+=1
        r-=1
    elif s[l] == 'x':
        l+=1
        ans+=1
    elif s[r] == 'x':
        r-=1
        ans+=1
    else:
        print(-1)
        exit()
print(ans)




Measured memory_bytes: 70568
n=int(input())
l=list()
for i in range(n):
    l.append(list(map(int,input().split())))
l.sort(key=lambda x:x[1])
t=0#time
p=True
for i,j in l:
    t+=i
    if t>j:
        p=False
        print('No')
        break
if p:
    print('Yes')

Measured memory_bytes: 53724
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
highest_value=0
M=1
while N-1>0:
  highest_value+=B[N-1]/(2**M)
  M+=1
  N-=1 
highest_value+=B[0]/(2**(M-1))
print(highest_value)

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
using namespace std;
typedef unsigned long long ll;
#define rep(i, n) for ( int i = 0; i < n ; i ++)
int main()
{
	char s[200];
	scanf("%s", s);
	int len = strlen(s);
	rep(i, len)printf("x");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N,K;
	bool can[10];
	rep(i,10) can[i]=1;
	cin>>N>>K;
	rep(i,K){
		int x;
		cin>>x;
		can[x]=0;
	}
	for(int i=N;;i++){
		int x=i;
		bool ok=1;
		while(x){
			if(!can[x%10]) ok=0;
			x/=10;
		}
		if(ok){
			cout<<i<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<string> s(n);
    for(ll i=0;i<n;++i){
        cin>>s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());

    ll ans = 0;
    ll count = 0;
    for(ll i=1;i<n;++i){
        if(s[i-1] == s[i]){
            ans++;
            count++;
        }else{
            if(count > 1){
                ans -= count;
                ans += (count+(ll)1) * count / 2;
            }
            count = 0;
        }
    }
    if(count > 1){
        ans -= count;
        ans += (count+(ll)1) * count / 2;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 7296
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[2*n];
	for(int i=0;i<2*n;i++)
	cin>>a[i];
	int s=0;
	sort(a,a+2*n);
	for(int i=0;i<2*n;i+=2)
	s=(a[i]>a[i+1])?s+a[i+1]:s+a[i];
	cout << s;

}

Measured memory_bytes: 256
#if 0
PDFの内容のおかげで、容易に解くことができた。
#endif

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

int N, W;
int v[110]; int w[110];
int V[110][10010];

int main() {
  cin >> N >> W;
  for (int i = 1; i <= N; i++)
    cin >> v[i] >> w[i];
  for (int i = 0; i <= N; i++) {
    for (int c = 0; c <= W; c++) {
      if (i == 0 || c == 0)
        V[i][c] = 0;
      else if (c-w[i] < 0)
        V[i][c] = V[i-1][c];
      else
        V[i][c] = max(v[i] + V[i-1][c-w[i]], V[i-1][c]);
    }
  }
  cout << V[N][W] << endl;
}



Measured memory_bytes: 7072