akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int((a).size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if (i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = INF + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);
//const li MOD = 100055128505716009;
//const li P = 3e4 + 11;

const int N = 13;
const int M = 1e3 + 7;

int n, m;
int msk[M];
int cost[M];
int cnt[M];

bool read() {
	if (!(cin >> n >> m))
		return false;

	int mask = 0;
	forn(i, m) {
		cin >> cost[i] >> cnt[i];
		forn(j, cnt[i]) {
			int x;
			cin >> x;
			x--;

			msk[i] += (1 << x);
		}
	}

	return true;
}

int dp[M][1 << N];

int ms[1 << N];

void solve() {
	forn(i, m + 1) {
		forn(j, 1 << n) {
			dp[i][j] = INF;
			ms[j] = INF;
		}
	}

	dp[0][0] = 0;
	ms[0] = 0;

	fore(i, 1, m + 1) {
		forn(mask, 1 << n) {
			dp[i][mask] = dp[i - 1][mask];
			if (msk[i - 1] == mask) {
				dp[i][mask] = min(dp[i][mask], cost[i - 1]);
			}
			for (int sb = mask; sb > 0 ; sb = max(sb - 1, 0) & mask) {
				if ((sb | msk[i - 1]) == mask) {
					dp[i][mask] = min(dp[i][mask], cost[i - 1] + ms[sb]);
				}
			}
			ms[mask] = min(ms[mask], dp[i][mask]);
		}

	}

	int ans = INF;
	forn(i, m + 1) {
		ans = min(ans, dp[i][(1 << n) - 1]);
	}
	if (ans == INF) {
		cout << -1 << '\n';
	}
	else {
		cout << ans << '\n';
	}
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

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

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while (read()) {
#else
	if (read()) {
#endif

		solve();

#ifdef _DEBUG
		cout << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	}

Measured memory_bytes: 31104
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
   
int main(){
   string s;
   cin >> s;
   int ans=0;
   rep(i,6){
       char x=s.at(i);
       int n=x-'0';
       ans+=n;
   }
   cout << ans << endl;
} 
    

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;

const int MAXN = (int) 1e5;

int main() {
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;

    vector <ll> a(n);
    for(i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector < bitset <MAXN + 1> > eqs(60);

    vector <int> where(n, -1), sol(n, -1);
    ll ans = 0;

    for(int bit = 59; bit >= 0; bit--) {
        int cnt = 0;
        for(i = 0; i < n; i++) {
            if(a[i] & (1LL << bit)) {
                eqs[bit][i] = 1;
                cnt++;
            }
            else {
                eqs[bit][i] = 0;
            }
        }
        eqs[bit][n] = 1;

        if(cnt & 1) {
            ans += (1LL << bit);
            continue;
        }

        for(i = 0; i < n; i++) {
            if(eqs[bit][i] && where[i] != -1) {
                eqs[bit] ^= eqs[where[i]];
            }
        }

        int pos = -1;
        for(i = 0; i < n; i++) {
            if(eqs[bit][i]) {
                pos = i;
                break;
            }
        }
        if(pos == -1 && eqs[bit][n]) {
            continue;
        }
        ans += (2LL << bit);
        if(pos != -1) {
            where[pos] = bit;
            sol[pos] = eqs[bit][n];
            for(i = n - 1; i > pos; i--) {
                if(eqs[bit][i] && where[i] != -1) {
                    sol[pos] ^= sol[where[i]];
                }
            }
        }
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 2560
a, b, m = map(int, input().split())
a_p = list(map(int, input().split()))
b_p = list(map(int, input().split()))

min_price = min(a_p) + min(b_p)

for i in range(m):
    x, y, c = map(int, input().split())
    min_price = min(min_price, a_p[x-1] + b_p[y-1] - c)
print(min_price)

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

#define M 1000019
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }

int find(char str[]){
    int i=0;
    while(1){
        if(H[(h1((int)getKey(str))+i*h2((int)getKey(str)))%M][0]=='\0'){
            break;
        }
        else if(0==strcmp(H[(h1((int)getKey(str))+i*h2((int)getKey(str)))%M],str)){
            return 1;
        }
        else{
            i++;
        }
    }
    return 0;

}

int insert(char str[]){
    int i=0;
    while(1){
        if(H[(h1((int)getKey(str))+i*h2((int)getKey(str)))%M][0]=='\0'){
            strcpy(H[(h1((int)getKey(str))+i*h2((int)getKey(str)))%M],str);
            break;
        }
        else{
            i++;
        }
    }
    return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
    }
    }
    return 0;
}


Measured memory_bytes: 15460
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

n=int(input())
A= [[int(i) for i in input().split()] for j in range(n)]

MOD=10**9+7
_ALL=1<<n
dp = [0]*(_ALL)
dp[0] = 1

for m in range(1,n+1):
    a = (1<<m)-1
    while a < _ALL:
        for c,i in enumerate(A[m-1]):
            if (1<<c)&a and i:
                dp[a] += dp[a^(1<<c)]
                if dp[a] > MOD:
                    dp[a] -= MOD
        x = a & -a
        y = a + x
        a = (((a & ~y) // x) >> 1) | y

#print(dp)
print(dp[2**n-1])

Measured memory_bytes: 57580
S = list(str(input()))
N = len(S)
a = 0
newS = list(reversed(S))
if S == newS:
        a += 1

left = []
for i in range(0,int((N-1)/2)): #(N-1)/2までが回文か確認
  left += S[i]
newleft = list(reversed(left))
if left == newleft:
        a += 1

right = []
for i in range(0,int((N-1)/2)): #(N+3)/2までが回文か確認
  right += S[-i-1]
newright = list(reversed(right))
if right == newright:
        a += 1
    
if a == 3:
	print('Yes')
else :
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;

long long N, c1, c2, c3, cnt;
string S;

int main() {
	cin >> N >> S;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'R') c1++;
		if (S[i] == 'G') c2++;
		if (S[i] == 'B') c3++;
	}
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int k = j + (j - i); if (k >= N) continue;
			if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) cnt--;
		}
	}
	cnt += c1 * c2 * c3;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3640
S = input()
flg = True
for i, s in enumerate(S):
    if i % 2 == 0:
        flg = flg & (s != 'L')
    elif i % 2 == 1:
        flg = flg & (s != 'R')
if flg:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 61872
import math

# 入力
n, m = map(int, input().split())
# 初期値
ans = 1
# mの約数で全探索
for i in range(1, int(math.sqrt(m) + 1)):
    if m % i == 0:
        j = m // i
        if m // n >= j:
            ans = max(ans, j)
        elif m // n >= i:
            ans = max(ans, i)
print(ans)

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> seen(100001,0);
    int odd_l = 1;
    int odd_r = 1+m;
    int even_l = 2+m;
    int even_r = 2*m+1;
    int d = 1;
    for(int i = 1; i <= m; i++){
        if(i % 2 == 1){
            cout << odd_l << ' ' << odd_r << endl;
            odd_l++;
            odd_r--;
        }
        else{
            cout << even_l << ' ' << even_r << endl;
            even_l++;
            even_r--;
        }
        d++;
    }
}

Measured memory_bytes: 3792
N, h = gets.chomp.split(" ").map(&:to_i)
S = []
N.times{
  S << gets.chomp.split(" ").map(&:to_i)
}

ans = 0
a_m = S.max_by{|a, b| a}[0]
S.select{|a, b| b >= a_m}.sort_by{|a, b| b}.reverse.each{|a, b|
  ans += 1
  h -= b
  break if h <= 0
}
if h > 0 then
  dm = h.divmod(a_m)
  ans += dm[0]
  ans += 1 if dm[1] > 0
end

puts ans


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

const ll mod = 998244353;

ll modpow(ll a, ll p){
  ll ret = 1;
  while(p){
    if(p & 1) ret = ret * a % mod;
    a = a * a % mod;
    p >>= 1;
  }
  return ret;
}

int main(){
  int n; cin >> n;
  vector<ll> a(n); 
  for(int i = 0; i < n; i++) cin >> a[i];
  vector<ll> num(n);
  for(int i = 0; i < n; i++){
    num[a[i]]++;
  }
  ll ans = 1;
  for(int i = 1; i < n; i++){
    ans *= modpow(num[i-1], num[i]);
    ans %= mod;
  }
  if(num[0] != 1 || a[0] != 0) ans = 0;
  cout << ans << endl;
}

Measured memory_bytes: 4852
#!/usr/bin/env python3

def solve(h, w, a):
    ret = []
    for r in a:
        left = False
        for c in r:
            if c == '#':
                left = True
                break
        if left:
            ret.append(r)
    ret2 = ['' for _ in range(len(ret))]
    for j in range(w):
        left = False
        for i in range(len(ret)):
            if ret[i][j] == '#':
                left = True
                break
        if left:
            for i in range(len(ret)):
                ret2[i] += ret[i][j]
    for r in ret2:
        print(r)
    return


def main():
    h, w = map(int, input().split())
    a = []
    for i in range(h):
        a.append(str(input()))
    solve(h, w, a)
    # Failed to predict input format
    pass

if __name__ == '__main__':
    main()


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

char grid[60][60];
int H, W, flag;

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


  for(int i = 1; i <= H; i++){
    for(int j = 1; j <= W; j++) {
      if(grid[i][j] == '#' && grid[i-1][j] != '#' && grid[i+1][j] != '#' && grid[i][j-1] != '#' && grid[i][j+1] != '#' ) flag++;
    }
  }
  if(flag == 0){
    cout << "Yes" <<endl;
  }else{
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> P;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int M,N;
char C[512][512], c[512][512];
int dy[]={-1,0,1,0},dx[]={0,-1,0,1};

int del(int y, int x){
  vector<P>v;
  rep(d,4){
    int ny=y+dy[d], nx=x+dx[d];
    while(ny>=0&&ny<M&&nx>=0&&nx<N&&c[ny][nx]=='.') ny += dy[d], nx += dx[d];
    if(ny<0||ny>=M||nx<0||nx>=N) continue;
    v.push_back(P(ny, nx));
  }
  int ret = 0;
  rep(i, v.size()) for(int j=i+1;j<v.size();j++){
    if(c[v[i].first][v[i].second] != '.' && c[v[i].first][v[i].second] == c[v[j].first][v[j].second]){
      ret++;
      c[v[i].first][v[i].second] = c[v[j].first][v[j].second] =  '.';
    }
  }
  return ret;
}

int main(){
  scanf("%d%d", &M,&N);
  rep(i,M) scanf("%s", C[i]);
  rep(i,M) rep(j,N) c[i][j] = C[i][j];
  int f = 1;
  while(f){
    f = 0;
    rep(i,M) rep(j,N) if(c[i][j]=='.') f += del(i, j);
  }
  int res = 0;
  rep(i,M) rep(j,N) if(c[i][j]!=C[i][j]) res++;
  //  rep(i,M) puts(c[i]);
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 1700
# ABC155 B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
a=nl()
for aa in a:
    if aa%2==0:
        if aa%3==0 or aa%5==0:
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

Measured memory_bytes: 3060
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <limits>//setprecision
#include <iomanip>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
//#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
long long MOD = 1000000007;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;cin >> N;
    vector<pair<int,int>> retu(N);
    for(int i = 0;i<N;i++){
        cin >> retu.at(i).first >> retu.at(i).second;
    }
    int ren = 0;
    for(int i = 0;i<N;i++){
        if(retu.at(i).first == retu.at(i).second){
            ren++;
        }
        else{
            ren = 0;
        }
        if(ren == 3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int max(vector<int> &v){
    int ret=v[0];
    for(int i=1; i<(int) v.size(); i++){
        ret=max(ret,v[i]);
    }
    return ret;
}

void cout_vec(vector<int> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

void colorize(vector<int> &ans, vector<vector<pair<int, int> > > &neig, int now, int prev_color){
    int cnt=1;
    deque<pair<int, int> > que;
    for(int i=0; i<(int) neig[now].size(); i++){
        int next_=neig[now][i].first;
        int nn=neig[now][i].second;
        if(ans[nn]!=0)continue;
        if(cnt==prev_color){
            cnt++;
            ans[nn]=cnt;
        }else{
            ans[nn]=cnt;
        }
        que.push_back(make_pair(next_,cnt));
        cnt++;
    }
    while((int) que.size()>0){
        int next_=que.front().first;
        int nc=que.front().second;
        que.pop_front();
        colorize(ans, neig, next_, nc);
    }
}


int main(){
    int N;
    cin >> N;
    vector<vector<pair<int, int> > > neigh(N,vector<pair<int, int> >());
    vector<int> num(N,0);
    for(int i=0; i<N-1; i++){
        int a,b;
        cin >> a >> b;a--;b--;
        neigh[a].push_back(make_pair(b,i+1));
        neigh[b].push_back(make_pair(a,i+1));
        num[a]++;
        num[b]++;
    }
    
    int max_=max(num);
    vector<int> ans(N,0);

    ans[0]=max_;
    colorize(ans, neigh, 0, 0);
    
    for(int i=0; i<N; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 49536
N = int(input())
A = list(map(int, input().split()))

A.sort()
from collections import deque

pot = deque([A.pop()])
com = 0
while A:
    com += pot.pop()
    new = A.pop()
    pot.appendleft(new)
    pot.appendleft(new)

print(com)


Measured memory_bytes: 31608
#include <bits/stdc++.h>
 
using namespace std;
const int maxn = 1e5 + 10;
 
#define ll long long
#define LL long long
const ll MOD = 1e9 + 7;
ll v[maxn], a[maxn];
LL da[maxn];//G++ long long
ll inv[maxn],fac[maxn],finv[maxn];
void make()
{
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(int i=2;i<maxn;i++)
	{
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		fac[i]=fac[i-1]*(ll) i%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}
ll C(int a,int b)
{
	if(a<b) return 0;
	return fac[a]*(finv[b]*finv[a-b]%MOD)%MOD;
}
int main() {
    ios_base::sync_with_stdio(0);
    ll n;
    make();
    ll id1 = 0, id2 = 0;
    cin >> n;
    memset(a, 0, sizeof(a));
    memset(v, 0, sizeof(v));
    for(ll i = 1; i <= n + 1; ++i){
        cin >> a[i];
        v[a[i]]++;
    }
    for(ll i = 1; i <= n + 1; ++i){
        if(v[a[i]] == 2 && !id1){
            id1 = i;
        }
        else if(v[a[i]] == 2) {
            id2 = i;
        }
    }
    ll L = max(id1 - 1LL, 0LL), /*M = id2 - id1 - 1LL*/ R = max(n + 1LL - id2, 0LL);
    ll res = 0;
    for(ll i = 1; i <= n + 1; ++i){
        res = C(n + 1, i * 1LL);
        res -= C(L + R, (i - 1) * 1LL);
        if(res < 0)res += MOD;
        cout << res << '\n';
    }
    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
using namespace std;

typedef long long ll;

int main(){
   int A, B, C;
   cin >> A >> B >> C;
   if(A <= C && C <= B) cout << "Yes" << endl;
   else cout  << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 20
#define Q 200

int solve(int, int);

int a[N];
int n;

int main(){
  int q, i;
  int m[Q];

  scanf("%d", &n);

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

  scanf("%d", &q);

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

  for(i = 0; i < q; i++){
    if(solve(0, m[i]) == 1){
      printf("yes\n");
    }else {
      printf("no\n");
    }
  }
  
  return 0;
}

int solve(int i, int m){
  int res;
  if(m == 0){
    return 1;
  }
  if(i >= n){
    return 0;
  }
  res = solve(i + 1, m) || solve(i + 1, m - a[i]);
  i++;
  return res;
}



Measured memory_bytes: 2108
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();
	int max = 0;
	int abc[] = {a,b,c};
	Arrays.sort(abc);
	for(int i = 0;i < 2;i++){
		max = max + abc[i] - abc[i+1];
	}
	System.out.println(Math.abs(max));	
	}	
}
	

Measured memory_bytes: 21972
import std.stdio, std.range, std.conv, std.string;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.setops, std.algorithm.sorting;

void main()
{
    long[] input = readln().split.to!(long[]);
    long A = input[0];
    long B = input[1];
    writeln(A*B/2);
}


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

int main() {
  int N;
  int s;
  int x = 10;
  cin >> N;
  for (int i = 0; i < 8; i++) {
    s += (N % x - s) / (x / 10);
    x *= 10;
  }
  if (N % s == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<unordered_set>
#include<math.h>
#include<utility>
#include<iomanip>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	bool ans = true;
	while (n--) {
		int a;
		cin >> a;
		if (a % 2 == 0) {
			if (a % 3 != 0 && a % 5 != 0) {
				ans = false;
			}
		}
	}

	if (ans) cout << "APPROVED";
	else cout << "DENIED";

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define inf 10000000
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

/* add vars here */

const int nmax = 40, abmax = 10;
int a[nmax], b[nmax], c[nmax];
int dp[nmax + 1][nmax * abmax + 1][nmax * abmax + 1];

/* add your algorithm here */

int main() {
  int n, ma, mb;
  cin >> n >> ma >> mb;

  rep(i,n) {
    cin >> a[i] >> b[i] >> c[i];
  }

  rep(i,n+1) {
    rep(ca, nmax*abmax+1) {
      rep(cb, nmax*abmax+1) {
        dp[i][ca][cb] = inf;
      }
    }
  }

  dp[0][0][0] = 0;

  rep(i,n) {
    rep(ca, nmax*abmax+1) {
      rep(cb, nmax*abmax+1) {
        if (dp[i][ca][cb] == inf) continue;
        dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb]);
        dp[i+1][ca + a[i]][cb + b[i]] = min(dp[i+1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]);
      }
    }
  }

  int ans = inf;

  for (int ca = 1; ca <= nmax * abmax; ++ca) {
    for (int cb = 1; cb <= nmax * abmax; ++cb) {
      if (ca * mb == cb * ma) ans = min(ans, dp[n][ca][cb]);
    }
  }

  if (ans == inf) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 25984
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		for (int i = 0 ; i < 5 ; i++) {
			int score = sc.nextInt();
			if (score < 40) score = 40;
			sum += score;
		}
		System.out.println(sum/5);
	}
}

Measured memory_bytes: 17304
#include <bits/stdc++.h>
#pragma GCC optimize("O999")
#define long long ll
const int INF=0x3f3f3f3f;
int maxn=50000005;
using namespace std;

int main(){
	//freopen(".in", "r",stdin );
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	int a[n+1], b[n+1], c[n], ans=0;
	for(int i=1; i<=n; i++)cin >> a[i];
	for(int i=1; i<=n; i++)cin >> b[i];
	for(int i=1; i<n; i++) cin >> c[i];
	ans+=b[1];
	for(int i=2; i<=n; i++){
		ans+=b[i];
		if(a[i]==a[i-1]+1)
			ans+=c[a[i-1]];
	}
	cout<<ans<<endl;
	return 0;
}

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

const int MAXN = 5010;
const int mod = 1000000007;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
int f[MAXN][MAXN], n;
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	f[0][0] = 1; std::cin >> n;
	for (int i = 1; i <= n; ++i)
		for (int j = 0; j <= i; ++j) {
			reduce(f[i][j + 1] += mul(f[i - 1][j], 2) - mod);
			reduce(f[i][std::max(j - 1, 0)] += f[i - 1][j] - mod);
		}
	static char buf[MAXN]; std::cin >> buf; int len = strlen(buf);
	std::cout << pow(mod + 1 >> 1, len, f[n][len]) << std::endl;
	return 0;
}


Measured memory_bytes: 96512
def main(a: int, b: int, c: int):
    ls = []

    for i in range(a, b * a + 1, a):
        if i % b in ls:
            break

        ls.append(i % b)

    if c in ls:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    a, b, c = map(int, input().split())

    main(a, b, c)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

string divide[4] = { "dream","dreamer","erase","eraser" };
int main()
{
	int N,C,K;
	cin >> N>>C>>K;
	vector<int> T(N);
	for (int i = 0; i < N; i++)
	{
		cin >> T.at(i);
	}

	sort(T.begin(), T.end());
	int noruhito = 0;
	int limit = T.at(0) + K;
	int cnt = 0;
	for(int i = 0;i < N;i++)
	{
		if (noruhito >= C)
		{
			cnt++;
			limit = T.at(i) + K;
			noruhito = 0;

		}
		if (T.at(i) > limit)
		{
			cnt++;
			limit = T.at(i) + K;
			noruhito = 0;
		}
		noruhito++;
	}
	if (noruhito > 0) {
		cnt++;
	}
	cout << cnt << endl;
	return 0;


	
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const long long INFdesu=2E10;

int main(){
   int N,K;
   cin >> N >> K;
   int tmp;
   int ix;
   for(int i=0;i<N;i++){
       cin >> tmp;
       if(tmp==1) ix=i;
   }
   if((N-1)%(K-1)==0)cout << (N-1)/(K-1) << endl;
   else cout << (N-1)/(K-1)+1 << endl;
   return 0;
}


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

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

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

int main2() {
  int N = nextLong();

  bool ans = false;
  int len = 0;
  REP(i, N) {
    int a = nextLong();
    int b = nextLong();
    if (a == b) {
      len++;
      if (len >= 3) ans = true;
    } else {
      len = 0;
    }
  }
  cout << (ans ? "Yes": "No") << endl;
  return 0;
}

int main() {

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

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

int main(){
  long long n, k;
  long long surplus, ark_surplus;
    
  cin >> n >> k;
  surplus = n % k;
  ark_surplus = abs(surplus - k);

  if(surplus <= ark_surplus){
      cout << surplus << endl;
  }
  else{
      cout << ark_surplus << endl;
  }
}

Measured memory_bytes: 256
//quming
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
int P;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
    R int res=1;
    for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
    return res;
}
const int N=155;
int n,p;
inline int max(R int x,R int y){return x>y?x:y;}
int solve(int n,int p){
    static int f[N][N];memset(f,0,sizeof(f));
    f[0][0]=1;
    fp(i,0,n-1)fp(j,0,p)if(f[i][j])upd(f[i+1][0],f[i][j]),upd(f[i+1][j+1],f[i][j]);
    R int res=0;fp(i,0,p)upd(res,f[n][i]);
    return res;
}
int f[N][N][N];
int main(){
//  freopen("testdata.in","r",stdin);
    scanf("%d%d%d",&n,&p,&P);
    if(p&1^1)return printf("%d\n",mul(solve(n>>1,p>>1),solve((n+1)>>1,p>>1))),0;
    f[0][0][0]=1;
    fp(i,1,n+1){
        R int r=(i<<1),l=r-p;
        R bool fr=(r>=1&&r<=n),fl=(l>=1&&l<=n);
        fp(j,0,n)fp(k,0,p+1)if(f[i-1][j][k]){
            upd(f[i][0][0],f[i-1][j][k]);
            if(fr)upd(f[i][j+1][0],f[i-1][j][k]);
            if(fl&&k+1<p+2)upd(f[i][0][k?k+1:k],f[i-1][j][k]);
            if(fl&&fr&&max(j+2,k+1)<p+2)upd(f[i][j+1][max(k+1,j+2)],f[i-1][j][k]);
        }
    }
    printf("%d\n",f[n+1][0][0]);
    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
 
#define mem(dp,a)       memset(dp,a,sizeof dp)
#define ninja           ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)           push_back(x)
#define mp(x,y)         make_pair(x,y)
#define all(c)          c.begin(), c.end()
#define ff              first
#define ss              second
#define nl              '\n'
#define inf             1e9+7

string matrix[2001];
int main()
{
	ninja
	int n,m; cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>matrix[i];

	int l[n+1][m+1],r[n+1][m+1],u[n+1][m+1],d[n+1][m+1];
	mem(l,0);
	mem(r,0);mem(d,0);mem(u,0);

	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(matrix[i][j]=='.'){
				if(j==0)
					l[i][j]=1;
				else
					l[i][j]=1+l[i][j-1];
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=m-1;j>=0;j--){
			if(matrix[i][j]=='.'){
				if(j==m-1)
					r[i][j]=1;
				else
					r[i][j]=1+r[i][j+1];
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(matrix[i][j]=='.'){
				if(i==0)
					u[i][j]=1;
				else
					u[i][j]=1+u[i-1][j];
			}
		}
	}
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<m;j++){
			if(matrix[i][j]=='.'){
				if(i==n-1)
					d[i][j]=1;
				else
					d[i][j]=1+d[i+1][j];
			}
		}
	}
	int res=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			res = max(res,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
		}
	}
	cout<<res;
}


Measured memory_bytes: 67072
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let n: String = read();
    let ch: Vec<char> = n.chars().collect();
    for i in 0..ch.len()-1{
	if ch[i as usize] == ch[i as usize +1] {
	    println!("Bad");
	    return;
	}
    }
    println!("Good");
}


Measured memory_bytes: 4352
sa=list(input())
sb=list(input())
sc=list(input())

n=sa.pop(0)
while True:
    if n == 'a':
        if len(sa)==0:
            print('A')
            break
        n=sa.pop(0)
    elif n == 'b':
        if len(sb)==0:
            print('B')
            break
        n=sb.pop(0)
    elif n == 'c':
        if len(sc)==0:
            print('C')
            break
        n=sc.pop(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

struct mint
{
	ll x;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a)
	{
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a)
	{
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a)
	{
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const
	{
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const
	{
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const
	{
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const
	{
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const
	{
		return pow(mod - 2);
	}
	mint& operator/=(const mint a)
	{
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const
	{
		mint res(*this);
		return res /= a;
	}

};

int main()
{
	ll n, k;
	cin >> n >> k;

	mint minv;
	for (ll i = 0; i <= k; i++) minv += i;
	mint maxv;
	for (ll i = n + 1; n + 1 - k < i; i--) maxv += i;
	mint ans = maxv - minv + 1;

	for (ll i = k + 1; i <= n + 1; i++) {
		minv += i;
		maxv += n + 2 - i;
		ans += maxv - minv + 1;
	}
	cout << ans.x << endl;
}

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

int main() {
  int a[100];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n-1; i >= 0; i--) {
    if (i != n-1) {
      cout << " ";
    }
  cout << a[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3096
import numpy as np

x, n = map(int, input().split())
p_list = list(map(int, input().split()))
i = 0
while True:
    if not x -i in p_list:
        print(x-i)
        break
    if not x + i in p_list:
        print(x + i)
        break
    i += 1


Measured memory_bytes: 27160
#include<bits/stdc++.h>
using namespace std;
long long int n,k,a,i,dp[1000001],m=1e9+7,j;
main(){
	cin>>n>>k;
	dp[k]=1;
	for(i=0;i<n;i++){
		cin>>a;
		for(j=k;j>=0;j--)dp[j]+=dp[j+1];
		for(j=0;j<k;j++)dp[j]=(dp[j]-dp[j+a+1])%m;
	}
	cout<<dp[0];
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//

//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//
int main() {
	string S;
	cin >> S;
	N = S.size();
	vl sum(N);
	for (i = N-1; i >= 0; i--) {
		if (i == N - 1) {
			if (S[i] == 'W') {
				sum[i] = 1;
			}
			else {
				sum[i] = 0;
			}
		}
		else {
			if (S[i] == 'W') {
				sum[i] = sum[i + 1] + 1;
			}
			else {
				sum[i] = sum[i + 1];
			}
		}
	}

	for (i = 0; i < N; i++) {
		if (S[i] == 'B') {
			ans += sum[i];
		}
	}
	cout << ans;
}

Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x>> y >> r;
    if(0>x-r||x+r>w){
        cout << "No" << endl;
        return 0;
    }
    if(0>y-r||y+r>h){
        cout << "No" << endl;
        return 0;
    }
     cout << "Yes" << endl;
     return 0;   
}


Measured memory_bytes: 3096
import math
a,b = map(int,input().split())
flag=0

for i in range (1,1001):
    a1 = math.floor(i*0.08)
    b1 = math.floor(i*0.1)
    if a1 == a and b1 == b:
        print(i)
        flag += 1
        break

if flag == 0:
    print("-1")

Measured memory_bytes: 3060
S = input()
T = input()

def f(U):
    U2 = []
    for u in list(U):
        if u not in U2:
            U2.append(u)
    h = {}
    i = ord('a')
    for u in U2:
        h[u] = chr(i)
        i += 1
    U3 = ''
    for u in list(U):
        U3 += h[u]
    return U3
#print(f(T))
#print(f(S))
if f(S) == f(T):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 5396
import math
N = int(input())
ans = 0
for i in range(N):
    a = int(input())
    if a!=2:
        an = math.ceil(math.sqrt(a))
    else:
        an = 1
    flag = 0
    for j in range(an-1):
        if a%(j+2) == 0:
            flag = 1
            break
            
    if flag == 0:
        ans+=1
        #print(a)
print(ans)


Measured memory_bytes: 5672
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
int vis[100];
int main(){
    ____();
    int x,y;
    cin >> x >> y;
    vis[x] = vis[y] = 1;
    for(int i = 1; i <= 3; i++) if(!vis[i]) cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

l = inn()
arcs = []
for i in range(21):
    if 2**i>l:
        break
for j in range(1,i):
        arcs.append((j,j+1,0))
        arcs.append((j,j+1,2**(j-1)))
for j in range(i-1):
    if (l>>j)%2!=0:
        l -= 2**j
        arcs.append((j+1,i,l))

print(f"{i} {len(arcs)}")
for f,t,c in arcs:
    print(f"{f} {t} {c}")


Measured memory_bytes: 61744
N, M = map(int, input().split(' '))

s_old = []
s_c_old =[]
result = 0
FLAGS = True
for i in range(M):
  s, c = map(int, input().split(' '))

  if (N != 1) & (s == 1) & (c == 0):
    print('-1')
    FLAGS = False
    break
  elif (s in s_old):
    if ([s,c] in s_c_old):
      s_old.append(s)
      s_c_old.append([s,c])
    else:
      print('-1')
      FLAGS = False
      break
  else:
    result += c*10**(N - s)
    s_old.append(s)
    s_c_old.append([s,c])

if (N == 1) and (M == 0):
  result = 0
elif 1 in s_old:
  result = result
#elif N != 1:
else:
  result += 1*10**(N - 1)
  
if FLAGS == True:
  print(result)



Measured memory_bytes: 3192
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
	ll a;
    cin >> a;
    cout << a/2+a%2;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    long long n, k; cin >> n >> k;
    int ans = 0;
    while (n > 0) {
        ans++;
        n /= k;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;cin>>n;
    ll res = 0;
    for(int i = 0; i < n;i++){
        res+=i;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
int N,a,b,c;
string S,T;
vi V,U;
// auto solve(){
// 	ll ans = 0;
// 	return ans;
// }

int main(){
	cin>>S;
	// T = "coffee";
	bool ans = false;
	if(S[2]==S[3] && S[4]==S[5]){
		ans = true;
	}
	cout<< (ans? "Yes":"No") <<endl;
	// cout<< solve() <<endl;
	// printf("%f\n",solve());
}


Measured memory_bytes: 256
import numpy as np

N, D = [int(i) for i in input().split()]
X = np.zeros((N,D))
for i in range(N):
    X[i] = [int(i) for i in input().split()]
    
count_dummy=0
for i in range(N):
    for j in range(i+1,N):
        dist = (np.sum((X[i] - X[j])**2))**0.5
        if dist.is_integer():
            count_dummy+=1
            
print(count_dummy)


Measured memory_bytes: 12444
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

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

vector<pair<int, int>> factor(int n) {
    vector<pair<int, int>> res;
    for(int i = 2; i * i <= n; i++) {
        if(n % i != 0) continue;
        int ex = 0;
        while(n % i == 0) {
            ex++;
            n /= i;
        }
        res.push_back({i, ex});
    }
    if(n != 1) res.push_back({n, 1});
    return res;
}

struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main()
{
    int n;
    cin >> n;
    map<int, int> mp;
    repl(i, 1, n + 1) {
        vector<pair<int, int>> div;
        div = factor(i);
        for(auto x : div) {
            mp[x.first] += x.second;
        }
    }
    mint ans = 1;
    for(auto y : mp) {
        ans *= (mint) y.second + 1;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
int main(){
	int n,b[10]={0},cnt=0,i,x=0;
	cin >> n;
	for(i=0;i<n;i++){
		int a;
		cin >> a;
		if(a<3200){
			b[a/400] = 1;
		}else{
			cnt++;
		}
	}
	
	for(i=0;i<10;i++){
		if(b[i]){
			x++;
		}
	}
	
	cout << max(x,1) << " " << x+cnt << endl;
}

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

#define pb              push_back
#define pi              acos(-1.0)
#define loop(i,a,n)     for(int i=a;i<n;i++)
#define rloop(i,n,a)    for(int i=n;i>=a;i--)
#define ll              long long int
#define ff              first
#define ss              second
#define pii             pair<ll,ll>
#define sc1(a)          scanf("%d",&a)
#define sc2(a,b)        scanf("%d %d",&a,&b)
#define sc3(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define all(v)          v.begin(),v.end()
#define ms(a,b)         memset(a,b,sizeof a)
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define fileout         freopen("output.txt","w",stdout)
#define filein          freopen("input.txt","r",stdin)
#define inf             2e9+5
#define Q               int q;cin>>q;while(q--)
#define check           cout<<"HI"<<endl;

//int x[]= {-1,0,0,1};
//int y[]= {0,-1,1,0};

using namespace std;

int main()
{
    
    int n,s=0;
    sc1(n);
    int a[n+5];
    int b[n+5];
    int c[n+5];
    loop(i,0,n)sc1(a[i]);
    loop(i,0,n)sc1(b[i]);
    loop(i,0,n-1)sc1(c[i]);

    loop(i,0,n)
    {
        s+=b[a[i]-1];
        if(i!=0 && a[i-1]+1==a[i])
        {
            s+=c[a[i-1]-1];
        }
    }cout<<s<<endl;
    
}













Measured memory_bytes: 3684
# AOJ 1106 Factorization of Quadratic Formula

# a の因数分解。
# p >= r を満たすすべての [p, q] を返す。
def factorize_a(a)
  max = Math.sqrt(a).to_i
  (1..max).select {|x| a % x == 0}.map {|x| [a / x, x]}
end

# c の因数分解。
# すべての [q, s] を返す。
def factorize_c(c, p, r)
  if c.zero?
    raise "c is zero"
  elsif c > 0
    max = Math.sqrt(c).to_i

    factors_plus_1 = (1..max).select {|x| c % x == 0}.map {|x| [c / x, x]}
    factors_plus_2 = factors_plus_1.map {|q, s| [s, q]}
    factors_plus = factors_plus_1 + factors_plus_2
    factors_minus = factors_plus.map {|q, s| [-q, -s]}

    factors_plus + factors_minus
  else
    max = Math.sqrt(-c).to_i

    factors1 = (1..max).select {|x| c % x == 0}.map {|x| [-c / x, -x]}
    factors2 = factors1.map {|q, s| [s, q]}
    factors3 = factors1.map {|q, s| [-q, -s]}
    factors4 = factors3.map {|q, s| [s, q]}

    factors1 + factors2 + factors3 + factors4
  end
end

while line = gets
  a, b, c = line.split.map(&:to_i)
  break if a.zero? && b.zero? && c.zero?

  possible = false

  factorize_a(a).each do |p, r|
    if c.zero?
      if b % p == 0
        possible = true
        s = b / p
        q = 0
      elsif b % r == 0
        possible = true
        q = b / r
        s = 0
      else
        next
      end

      possible = true
      q, s = [s, q] if p == r && q < s
      puts [p, q, r, s].join(" ")
    else
      factorize_c(c, p, r).each do |q, s|
        if p * s + q * r == b
          possible = true
          q, s = [s, q] if p == r && q < s
          puts [p, q, r, s].join(" ")
          break
        end
      end
    end

    break if possible
  end

  puts "Impossible" unless possible
end

Measured memory_bytes: 6148
#include<iostream>
using namespace std;
int main(){
	int H,W,i,j;
	for(;;){
	cin>>H>>W;
	if(H==0&&W==0)
	break;
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			cout<<"#";
		}
		cout<< endl ;
	}
	cout<<endl;
	

	
	
	}
return 0;
}

Measured memory_bytes: 3064