akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    A,B = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    if (A+B)%2==1:
        print('IMPOSSIBLE')
    else:
        print((A+B)//2)





if __name__ == "__main__":
    main()

Measured memory_bytes: 77440
//  IT'S NEVER TOO LATE...

		    #include <bits/stdc++.h>
			#include <complex>
		    #define ll long long

			#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
			#define forn(i, n) fore(i, 0, n)
			#define fori(i, l, r) fore(i, l, (r) + 1)
			#define sz(v) int((v).size())
			#define all(v) (v).begin(), (v).end()
			#define pb push_back
			#define mp make_pair
		    #define ff first
		    #define ss second
		    
			//#define C complex<int>
			#define X real()
			#define Y imag()

		    using namespace std; 

		    const double PI = atan(1)*4;
		    #define inf 1e9
		    const int mod=1e9+7;


		    /*struct matrix
		    {
		    	int k;
		    	vector<vector<ll>> data;
		    	matrix(int x)
		    	{
		    		k=x;
		    		data.resize(x);
		    		forn(i,x)
		    		data[i].resize(x);
		    	}

		    	matrix operator *(matrix m1)
		    	{
		    		int n=m1.data.size();
		    		matrix m2(n);

		    		forn(i,n)
		    		{
		    			forn(j,n)
		    			{
		    				forn(k,n)
		    				{
		    					m2.data[i][k]+=((m1.data[i][j]%1000000007)*(data[j][k]%1000000007))%1000000007;
		    					m2.data[i][k]%=1000000007;
		    				}
		    			}
		    		}


		    		return m2;
		    	}
		    };*/

		    /*bool comp(pair<int,int> a,pair<int,int> b)
		    {
		    	return ((double)a.ff/a.ss) < ((double)b.ff/b.ss) ;
		    }

		    int dp[100][100],val[100],wt[100];
		    int knapsack(int n,int cap)
		    {
		    	if(n==0 || cap==0)
		    		return 0;
		    	if(dp[n][cap])
		    		return dp[n][cap];
		    	if(wt[n-1]<=cap)
		    	{
		    		return dp[n][cap]=max(knapsack(n,cap-wt[n-1]) + val[n-1], knapsack(n-1,cap));
		    	}
		    	else
		    		return dp[n][cap]= knapsack(n-1,cap);
		    }*/

		    int main()
		    {
		    	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		     
		    	#ifndef ONLINE_JUDGE
		        freopen("input.txt","r", stdin);
		        freopen("output.txt", "w", stdout);
		        #endif
		     
		    	int tt=1;
		    	//cin>>tt;
		    	
		    	while(tt--)
		    	{
		    		//matrix mat(n),m2(n);
		    		
		    		string s;
		    		cin>>s;

		    		int n=s.length(),sum=0;
		    		forn(i,n)
		    		{
		    			sum+=(int)(s[i]-'0');
		    		}

		    		if(sum%9)
		    			cout<<"No";
		    		else
		    			cout<<"Yes";
		    	}
		    	cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";

		    	return 0;
		    }
		    				//              NOW IT'S TIME TO WAKE UP... 

Measured memory_bytes: 3944
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

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

int main(){
    int N, a[3];
    std::cin >> N;

    REP(i, N){
        std::cin >> a[i];
    }

    int g = a[0];
    FOR(i, 1, N){
        g = gcd(g, a[i]);
    }

    FOR(i, 1, g+1){
        if(g % i == 0){
            std::cout << i << std::endl;
        }
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<=y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
char s[1100];
int main()
{
	while(scanf("%s",s)!=EOF)
	{
		printf("%c%d%c\n",s[0],strlen(s)-2,s[strlen(s)-1]);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final int n = scanner.nextInt();
    final int k = scanner.nextInt();
    final List<Integer> h = new ArrayList<>();


    for (int i = 0; i < n; i++) {
      h.add(scanner.nextInt());
    }
    Collections.sort(h);


    if(n > k) {
      long count = 0;
      for (int i = 0; i < n-k; i++) {
        count += h.get(i);
      }
      System.out.println(count);
    } else {
      System.out.println(0);
    }

  }
}


Measured memory_bytes: 91912
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
 
typedef string::const_iterator iter;
 
typedef double D;
struct P {
  D x,y;
  P(){}
  P(D x_, D y_) : x(x_), y(y_) { }
};
 
struct L {
  P a,b;
  L(){}
  L(P a_, P b_) : a(a_), b(b_) { }
};
 
P operator +(P a, P b) {
  return P(a.x + b.x, a.y + b.y);
}
 
P operator -(P a, P b) {
  return P(a.x - b.x, a.y - b.y);
}
 
P operator *(P a, D b) {
  return P(a.x*b, a.y*b);
}
 
P operator /(P a, D b) {
  return P(a.x/b, a.y/b);
}
 
P vec(P from, P to) {
  return to - from;
}
 
D inp(P a, P b) {
  return a.x*b.x + a.y*b.y;
}
 
D outp(P a, P b) {
  return a.x*b.y - a.y*b.x;
}
 
D norm(P p) {
  return inp(p,p);
}
 
P proj(L l, P p) {
  P a = vec(l.a, l.b);
  P b = vec(l.a, p);
  D t = inp(a,b) / norm(a);
  return l.a + a*t;
}
 
P refl(L l, P p) {
  return p + vec(p, proj(l, p)) * 2;
}
 
P cLL(L l, L m) {
  D d = outp(vec(m.a, m.b), vec(l.a, l.b));
  return l.a + vec(l.a, l.b) * outp(vec(m.a, m.b), vec(l.a, m.b)) / d;
}
 
enum Geo {
  LINE, POINT
};
 
struct Result {
  Geo type;
  P a,b;
};
 
Result compute(Result left, Result right) {
  Result r;
  if(left.type == POINT && right.type == POINT) {
    r.type = LINE;
    r.a = left.a;
    r.b = right.a;
  }
  if(left.type == POINT && right.type == LINE) {
    r.type = POINT;
    r.a = refl(L(right.a,right.b), left.a);
  }
  if(left.type == LINE && right.type == POINT) {
    r.type = POINT;
    r.a = refl(L(left.a,left.b), right.a);
  }
  if(left.type == LINE && right.type == LINE) {
    r.type = POINT;
    r.a = cLL(L(left.a, left.b), L(right.a, right.b));
  }
 
  return r;
}
 
Result expr(iter &p);
Result term(iter &p);
P point(iter &p);
int number(iter &p);
 
#define CALL(name) // cerr << #name << ": *p = " << *p << endl
 
Result expr(iter &p) {
  CALL(expr);
  Result r = term(p);
  while(true) {
    if(*p == '@') {
      ++p; // skip @
      Result rs = term(p);
      r = compute(r, rs);
    }
    else {
      break;
    }
  }
  return r;
}
 
Result term(iter &p) {
  CALL(term);
  if(isdigit(*(p + 1)) || *(p + 1) == '-') {
    ++p; // skip (
    Result r;
    r.type = POINT;
    r.a = point(p);
    ++p; // skip )
    return r;
  }
  else {
    ++p; // skip (
    Result r = expr(p);
    ++p; // skip )
    return r;
  }
}
 
P point(iter &p) {
  CALL(point);
  int a = number(p);
  ++p; // skip ,
  int b = number(p);
  return P(a,b);
}
 
int number(iter &p) {
  CALL(number);
  int sig = 1;
  if(*p == '-') {
    ++p; // skip -
    sig = -1;
  }
  int res = 0;
  while(isdigit(*p)) {
    res *= 10;
    res += *p - '0';
    ++p;
  }
  return sig * res;
}
 
int main() {
  cout.setf(ios::fixed);
  cout.precision(8);
  while(true) {
    string S; cin >> S;
    if(S == "#") break;
    S.push_back('$');
    iter begin = S.begin();
    Result r = expr(begin);
    cout << r.a.x << ' ' << r.a.y << endl;
  }
}

Measured memory_bytes: 1272
/*
Author : N_o_o_B
Created : April 22 2020 21:13:48 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    ll n,a,b;
    cin >> n >> a >> b;
    cout << n/(a+b)*a + min(n%(a+b),a) << endl;


    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int A,B,V,W,T;
int main(){
	A=read(),V=read();
	B=read(),W=read();
	T=read();
	if(1LL*(V-W)*T>=abs(A-B)){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a;
  string b,c,d;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b;
    c=c+b;
  }
  // cout<<"C "<<c<<"\n";
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b;
    d=d+b;
  }
  // cout<<"D "<<d<<"\n";
  if(c<d) cout<<"1\n";
  else cout<<"0\n";
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define eps 1e-7
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int ll
using pii = pair<int, int>;

int ans;
int32_t main()
{
    int L, R, d;
    cin >> L >> R >> d;
    for (int i = L; i<=R; i++)
    {
        if (i%d==0) ans++;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3632
#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() {
    string s;
    cin >> s;
    s = s.replace(3, 1, "8");
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>

int solve(int inputNum);

int main()
{
  int num = 0;
  std::cin >> num;
  int result = solve(num);
  std::cout << result << std::endl;
  return 0;
}

int solve(int inputNum)
{
  int input = inputNum;
  int result = 0;
  if(input <= 2)
  {
    result = 2;
  }
  else if((input & 0x1) != 1)
  {
    ++input;
  }
  int i;
  int j;
  char f = 1;
  if(result == 0)
  {
  	for(int i = input; i < 100004; i += 2)
  	{
      f = 1;
      for(j = 2; i > j * j; ++j)
      {
      	if(i % j == 0) f = 0;
      }
      if(f != 0)
      {
        result = i;
        break;
      }
    }
  }
  return result;
}

Measured memory_bytes: 256
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
    // printElems(&a[0], &a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 1LL<<60;

int done[1000005];
int a[200005];


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

    int ans = 0;
    rep(i,n){

        if(done[a[i]]==0) {
            if(a[i]!=a[i+1])ans++;
            int tmp = a[i];
            while(tmp<1000001){
                done[tmp] = 1;
                tmp+=a[i];
            }
        }
    }
    prints(ans);

    return 0;
}




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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n - 1);
    rep(i, n - 1) cin >> a[i];
    vector<int> cnt(n);
    rep(i, n - 1) a[i]--;
    rep(i, n - 1) cnt[a[i]]++;
    for (auto c : cnt)
        cout << c << endl;

    return 0;
}

Measured memory_bytes: 4844
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
const int mxn=100010;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
struct node{
	int x,y,id;
}a[mxn];
int cmp1(node a,node b){
	return a.x<b.x;
}
int cmp2(node a,node b){
	return a.y<b.y;
}
int n;
//
struct edge{
	int x,y,w;
	bool operator < (const edge &b)const{
		return w<b.w;
	}
}e[mxn*20];
int mct=0;
void add_edge(int u,int v,int w){
	e[++mct].x=u;e[mct].y=v;e[mct].w=w; return;
}
//
int fa[mxn];
int find(int x){
	return (fa[x]==x)?x:fa[x]=find(fa[x]);
}
int ans=0;
void kruskal(){
	for(int i=1;i<=n;i++)fa[i]=i;
	int cnt=1;
	sort(e+1,e+mct+1);
	for(int i=1;i<=mct;i++){
		int x=e[i].x,y=e[i].y;
		x=find(x);y=find(y);
		if(find(x)!=find(y)){
			fa[x]=y;
			cnt++;
			ans+=e[i].w;
		}
		if(cnt==n)break;
	}
	printf("%d\n",ans);
	return;
}
int main(){
	int i,j;
	n=read();
	for(i=1;i<=n;i++){
		a[i].x=read();a[i].y=read();
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp1);
	for(i=1;i<n;i++){
		add_edge(a[i].id,a[i+1].id,abs(a[i].x-a[i+1].x));
	}
	sort(a+1,a+n+1,cmp2);
	for(i=1;i<n;i++){
		add_edge(a[i].id,a[i+1].id,abs(a[i].y-a[i+1].y));
	}
	kruskal();
	return 0;
}

Measured memory_bytes: 6784
/*
ID: rajiv
TASK: test
LANG: C++14
*/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>
#include<sstream>
#include<iterator>
#include<random>
#include<chrono>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ONLINE_JUDGE

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
int rnd(int a, int b){ // including a and b
	return a+(rng()%(b-a+1));
}
#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sortr(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb push_back
#define endl '\n'

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

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

void solve(){
	int sum=15;
	int s=0;
	rep(i,5) {
		int x;
		cin>>x;
		s+=x;
	}
	cout<<(sum-s)<<endl;
	
	
}

int main(){
	fast_io
	#ifndef ONLINE_JUDGE
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	#endif 
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 3088
let () = Scanf.scanf "%d %d %d %d" @@ fun r g b n ->
  Printf.printf "%d\n" @@
  Array.fold_left ( + ) 0 @@ Array.init (1 + n / r) @@ fun i ->
    Array.fold_left ( + ) 0 @@ Array.init (1 + n / g) @@ fun j ->
      if
        n < r * i + g * j ||
        0 < (n - r * i - g * j) mod b
      then 0 else 1

Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

double dp[3010][3010];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
double p[3030];

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	rep(i, n) {
		cin >> p[i];
	}
	dp[0][0] = 1;
	rep(i, n) {
		for (ll j = 0;j <= i;++j) {
			dp[i + 1][j + 1] += dp[i][j] * p[i];
			dp[i + 1][j] += dp[i][j] * (1 - p[i]);
		}
	}
	double ans = 0;
	for (ll i = (n + 1) / 2;i <= n;++i) {
		ans += dp[n][i];
	}
	exout(ans);
	return 0;
}



Measured memory_bytes: 49900
#include <stdio.h>          // printf(), scanf()

int
main(int argc, char **argv)
{
	int y, m, d;

	while (scanf("%d %d %d", &y, &m, &d) != EOF)
	{
		if (y > 1989 || (y == 1989 && (m > 1 || (m == 1 && d >= 8))))
			printf("heisei %d %d %d\n", y - 1988, m, d);

		else if (y > 1926 || (y == 1926 && m == 12 && d >= 25))
			printf("showa %d %d %d\n", y - 1925, m, d);

		else if (y > 1912 || (y == 1912 && (m > 7 || (m == 7 && d >= 30))))
			printf("taisho %d %d %d\n", y - 1911, m, d);

		else if (y > 1868 || (y == 1868 && (m > 9 || (m == 9 && d >= 8))))
			printf("meiji %d %d %d\n", y - 1867, m, d);

		else
			printf("pre-meiji\n");
	}

	return 0;
}

Measured memory_bytes: 608
n,a,b,k = gets.chomp.split(" ").map(&:to_i)
ans = 0

$fact = Array.new(n+10,1)
$inv_fact = Array.new(n+10,1)
$mod = 998244353

for i in 1..n
  $fact[i] = ($fact[i-1]*i)%$mod
end

def exp(a,b)
  if b == 0
    1
  elsif b == 1
    a
  else
    temp = exp(a,b/2)
    b%2 == 0 ? (temp**2)%$mod : (a*temp**2)%$mod
  end
end

$inv_fact[n] = exp($fact[n],$mod-2)
n.downto(2) do |i|
  $inv_fact[i-1] = ($inv_fact[i]*i)%$mod
end

def combi(a,b)
  ($fact[a]*$inv_fact[b]*$inv_fact[a-b])%$mod
end

for i in 0..n
  temp = k-a*i
  j = temp/b
  if temp%b == 0 && j <= n && temp >= 0
    ans += combi(n,i)*combi(n,j)%$mod
    ans %= $mod
  end
end
p ans%$mod

Measured memory_bytes: 6524
n,t = map(int,input().split())
dish = []
for _ in range(n):
  a,b = map(int,input().split())
  dish.append([a,b])
dish.sort()
now = [0 for _ in range(t+1)]
for i in range(n):
  a,b = dish[i]
  for d in range(t)[::-1]:
    if d + a < t:
      now[d+a] = max(now[d+a],now[d]+b)
    else:
      now[-1] = max(now[-1],now[d]+b)
  #print(now)
print(now[-1])

Measured memory_bytes: 46056
#include"bits/stdc++.h"
#define fastio ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define ict int t; cin >> t
#define lct ll t; cin >> t;
#define in(a) int a; cin >> a
#define ln(a) ll a; cin >> a
#define loop(i,n) for (ll i = 0; i < n; ++i) 
#define looprev(i,n) for (ll i=n-1; i>=0 ; --i)
#define LOOP(i,k,n) for (ll i = k; i <= n; ++i) 
#define LOOPREV(i,k,n) for (ll i = k; i >= n; --i) 
#define mp make_pair 
#define pa pair <ll,ll>
#define vec vector<ll>
#define vecpa vector<pa>
#define vec2D vector <ll<ll>>
#define que queue<ll>
#define deq deque<ll> 
#define stk stack<ll>
#define iterate vector<ll>::iterator
#define pub push_back
#define pob pop_back
#define pof pop_front
#define puf push_front
#define emp emplace_back

using namespace std;

int main()
{
    fastio;
    cin.tie(NULL);
    cout.tie(NULL);

    ll k;
    cin >> k;
    ll count =1;
    int num = 7;

    if(k%2==0 || k%5==0){
        cout << -1;
        return 0;
    }
    if(k==1 || k==7){
        cout << 1;
        return 0;
    }

    while(1){
        
        num = (num * 10 + 7) % k; 
        count++;
        // If number is divisible by k 
        // then remainder will be 0 
        if (num == 0) {
            cout << count;
            return 0;
        } 

    }
}

Measured memory_bytes: 3612
#import sys
#import numpy as np
#from collections import defaultdict
import math


#input = sys.stdin.readline

def numbering(P,N):

    used = [1]*(N+1)
    all = math.factorial(N)
    ans =0
    for i in range(N):
        p = P.pop(0)
        used[p] =0
        all =int(all/(N-i))
        ans += all *(sum(used[0:p])-1)
 #       print("p {}:  all {} : ans {}".format(p,all,ans))

    return ans+1




def main():
    N = int(input())
    P = list(map(int,input().split()))
    ans = numbering(P,N)
    Q = list(map(int,input().split()))
    ans2 = numbering(Q,N)
    print(abs(ans - ans2))
if __name__ == "__main__":
    main()

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

int main() {
  string S;
  cin >> S;
  int tops = 0;
  if (S.at(0) == 'o') tops++;
  if (S.at(1) == 'o') tops++;
  if (S.at(2) == 'o') tops++;
  cout << 700 + tops * 100 << endl;
  return 0;
}


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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

constexpr li INF = 1ll << 50;

li n, m, r;

li rr[10];

li table1[222][222];

// {index, cost}
vector<pair<li, li>> edges[10];

li table2[11][11];

li dp[10][2020];

int main(void)
{
	cin >> n >> m >> r;

	rep(i, n) {
		rep(j, n) {
			table1[i][j] = INF;
		}
	}

	rep(i, r) {
		cin >> rr[i];
		rr[i]--;
	}
	rep(i, m) {
		li a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		table1[a][b] = table1[b][a] = c;
	}

	rep(k, n) {
		rep(i, n) {
			rep(j, n) {
				table1[i][j] = min(table1[i][j], table1[i][k] + table1[k][j]);
			}
		}
	}

	rep(i1, r) {
		rep(i2, r) {
			table2[i1][i2] = table1[rr[i1]][rr[i2]];
		}
	}

	rep(i, 10) {
		rep(j, 2020) {
			dp[i][j] = INF;
		}
	}
	rep(i, r) {
		dp[i][1 << i] = 0;
	}

	for (li i = 1; i < (1 << r); ++i) {
		bitset<10> state(i);
		rep(w1, r) {
			if (!state[w1]) {
				continue;
			}
			rep(w2, r) {
				if (state[w2]) {
					continue;
				}
				li new_state = (state.to_ullong() | (1 << w2));
				li new_cost = dp[w1][i] + table2[w1][w2];
				dp[w2][new_state] = min(dp[w2][new_state], new_cost);
			}
		}
	}

	li res = INF;
	rep(i, r) {
		res = min(res, dp[i][(1 << r) - 1]);
	}
	cout << res << endl;


	return 0;
}

Measured memory_bytes: 768
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
count = 0
for i in range(n):
    a = list(map(int, input().split()))
    p = 0
    for j in range(m):
        p += a[j] * b[j]
    p += c
    if p > 0:
        count += 1
print(count)

Measured memory_bytes: 3060
A,B=map(int,input().split())
if A!=1 and B!=1:
  if A>B:
    print('Alice')
  elif A<B:
    print('Bob')
  else:
    print('Draw')
elif A==1 and B!=1:
  print('Alice')
elif A!=1 and B==1:
  print('Bob')
else:
  print('Draw')
  

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void abc125_a(vector<vector<string>> v) {

    int a = atoi(v[0][0].c_str());
    int b = atoi(v[0][1].c_str());
    int t = atoi(v[0][2].c_str());
    
    
    cout << (t / a)*b<<endl;




}

int main() {

    vector<vector < string>> vec_arr_result;
    //    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata();

    abc125_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll n, k;
    cin >> n >> k;
    n %= k;
    cout << min(k-n, n) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
   int i,k,a;
  int hako[100];
   scanf("%d",&k);
  for ( i = 0; i < k; i++ ){
    scanf("%d",&a);
    hako[i] = a;
  }
  for(i = k - 1;i >= 0 ; i--){
      printf("%d", hako[i]);
      if ( i ) printf(" ");
  }
  printf("\n");
}

Measured memory_bytes: 1028
# frozen_string_literal: true

def nC2(n)
  n * (n - 1) / 2
end

n = gets.to_i
as = gets.split.map(&:to_i)

cs = Hash.new(0)
as.each do |a|
  cs[a] += 1
end

sum = cs.inject(0) do |r, (_k, v)|
  r + nC2(v)
end

as.each do |a|
  c = cs[a]

  puts sum - (nC2(c) - nC2(c - 1))
end


Measured memory_bytes: 28676
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            var ans = 0;

            for(var i = 0;i<input.Length;i++){
                if(input[i] == '1'){
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
from collections import defaultdict

def dfs(source, sink, flow, connect):
    if source == sink:
        return flow
    used[source] = 1
    for i, (target, cost, rev_i) in enumerate(connect[source]):
        if not used[target] and cost > 0:
            that_flow = dfs(target, sink, min(flow, cost), connect)
            if that_flow > 0:
                connect[source][i][1] -= that_flow
                connect[target][rev_i][1] += that_flow
                return that_flow
    return 0

v_num, e_num = (int(n) for n in input().split(" "))
connect = defaultdict(list)
for _ in range(e_num):
    s, t, cost = (int(n) for n in input().split(" "))
    connect[s].append([t, cost, len(connect[t])])
    connect[t].append([s, 0, len(connect[s]) - 1])

answer = 0
while True:
    used = [0 for n in range(v_num)]
    now_flow = dfs(0, v_num - 1, float("inf"), connect)
    if now_flow == 0:
        break
    answer += now_flow
print(answer)

Measured memory_bytes: 8392
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(x) cout << fixed << setprecision(x);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n,m; cin >> n >> m;
  vl popu(n); ll sum = 0;
  rep(i,n){ ll x; cin >> x; popu[i] = x; sum += x; }
  
  sort(all(popu));
  
  if(popu[n-m] >= double(sum)/double(4.0*m)) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,m,i,j;
	
	scanf("%d %d",&n,&m);
	
	int A[n][m],b[m],c[n];
	
	for(i=0;i<n;i++){
		c[i]=0;		
	}
	
	for(i=0;i<n;i++){
		
		for(j=0;j<m;j++){
			scanf("%d",&A[i][j]);
		}
	}
	
	for(i=0;i<m;i++){
		scanf("%d",&b[i]);		
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			c[i]+=A[i][j]*b[j];
		}
	}
	
	for(i=0;i<n;i++){
		printf("%d\n",c[i]);		
	}
	
	return 0;
}

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

int main() {
  int n;
  long long T;

  cin >> n >> T;
  vector<long long> ts;
  for (int i=0; i<n; i++) {
    long long t;
    cin >> t;
    ts.push_back(t);
  }

  long long ans=0;
  for (int i=1; i<n; i++) {
    if (ts[i]-ts[i-1] <= T) {
      ans += (ts[i]-ts[i-1]);
    } else {
      ans += T;
    }
  }

  ans += T;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2420
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <deque>
#include <unordered_set>
#include <functional>
 
using namespace std;

bool is_palindrome(string& s, int i, int j) {
    for (int k=0;k<j-i;++k){
        if (s[k+i]!=s[j-k-1])
            return false;
    }
    return true;
}

int main() {
    string s;
    cin>>s;
    int n = s.size();
    if (!is_palindrome(s, 0, n) || !is_palindrome(s, 0, (n-1)/2) || !is_palindrome(s, (n+3)/2-1, n)) {
        cout<<"No";
        return 0;
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    while(true){
    cin >> H >> W;
    if(H == 0 && W == 0){
           break;
    }
    for(int j=0;j<W;j++){
        cout << '#';
    }cout << endl;
    for(int i=1;i<H-1;i++){
        cout << '#';
        for(int j=1;j<W-1;j++){
            cout << '.';
        }
        cout << '#' << endl;
        }
        for(int j=0;j<W;j++){
        cout << '#';
    }
    cout << endl <<endl;
    }
}


Measured memory_bytes: 3080
N ,Q = map(int,input().split())
A =[]
B =[]
P =[]
X =[]
node_child = [[] for i in range(N)]
node_score = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(Q):
    p,x = map(int,input().split())
    P.append(p)
    X.append(x)
for i in range(N-1):
    node_child[A[i]-1].append(B[i])
for i in range(Q):
    node_score[P[i]-1].append(X[i])
score = [0]*N

for i in range(N):
    score[i] += sum(node_score[i])
    for j in node_child[i]:
        score[j-1] += score[i]
for i in score:
    print('{0} '.format(i),end='' )

Measured memory_bytes: 92152
<?php
    $dam_num = intval(fgets(STDIN));
    $input_line = rtrim(fgets(STDIN));
    $water = explode(' ', $input_line);

    $sum = array_sum($water);
    for($i = 0; $i < $dam_num; $i+=2){
        $rain[0] += $water[$i];
    }
    $rain[0] *= 2;
    $rain[0] -= $sum;
    
    for($i = 1; $i < $dam_num; $i++){
        $rain[$i] = 2 * $water[$i-1] - $rain[$i-1];
    }

    $ans = '';
    for($i = 0; $i < $dam_num; $i++){
        $ans .= $rain[$i].' ';
    }
    echo trim($ans);

Measured memory_bytes: 22128
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

typedef long long int64;

int64 digits(int64 n) {
    int64 res = 0;
    while(n != 0) {
        res++;
        n /= 10;
    }
    return res;
}

int64 f(int64 n) {
    int64 res = 1;
    if (n >= 2) {
        res = n * f(n-2);
    } else {
        res = 1;
    }

    return res;
}


int main() {
    int64 n;
    int64 ans = 0;
    cin >> n;
    if (n%2) {
        cout << 0 << endl;
        return 0;
    }

    for (int64 i=10; i<=n; i*=5) {
        ans += floor((long double)n / i);
    }


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

Measured memory_bytes: 256
N,Y = map(int,input().split())
import sys
for i in range(N+1):
    for j in range(N+1-i):
        k = N-i-j
        tmp = 10000*i+5000*j+1000*k
        if tmp == Y:
            print(*[i,j,k])
            sys.exit()
print(*[-1, -1, -1])

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

const int INF = 1 << 30;

int a[110];

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", a + i);
	int ans = INF;
	for(int i = 1; i <= 100; i++) {
		int sum = 0;
		for(int j = 0; j < n; j++) {
			sum += (i - a[j]) * (i - a[j]);
		}
		ans = min(ans, sum);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

vector<long long> divisor(long long n) {
	vector<long long> res;
	for (long long i = 1; i * i <= n; i++) {
  	if (n % i == 0) {
			res.push_back(i);
			if (i != n / i) res.push_back(n / i);
		}
	}
	return res;
}

int main(){	
	long long N;
	cin >> N;
	vector<ll> a(N);
	rep(i, N) cin >> a[i];
	vector<ll> b(N, 0), r(N, 0);
	for (ll i = N; i >= 1; i--) {
		// cout << i << ": ";
		// cout << a[i-1] << " " << b[i-1] << endl;
		if (b[i-1] != a[i-1]) {
			r[i-1] = 1;
			for (auto& p : divisor(i)) {
				b[p-1] = (b[p-1]+1)%2;
				// cout << p << " " << b[p-1] << "  ";
			}
			// cout << endl;
		}
	}
	ll cnt = 0;
	vector<ll> res;
	rep(i, N) {
		if (r[i] == 1) {
			cnt++;
			res.push_back(i+1);
		}
	}
	cout << cnt << endl;
	rep(i, cnt) {
		if (i != cnt-1) cout << res[i] << " "; else cout << res[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 6516
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
grid = [[0] * w for _ in range(h)]
cnt = 0
color = []
for i in range(n):
    for j in range(a[i]):
        color.append(i + 1)
for i in range(h):
    if i % 2 == 0:
        for j in range(w):
            grid[i][j] = color[cnt]
            cnt += 1
    else:
        for j in range(w - 1, -1, -1):
            grid[i][j] = color[cnt]
            cnt += 1
for i in range(h):
    print(*grid[i])

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <numeric>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i, n) for(int i = 1; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int a, b, c, d; cin >> a >> b >> c >> d;
	if (a + b > c + d) {
		cout << "Left" << endl;
	}
	else if (a + b == c + d) {
		cout << "Balanced" << endl;
	}
	else {	
		cout << "Right" << endl;
	}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    char c;
    cin >> c;
    if(c == 'A') cout << "T";
    if(c == 'T') cout << "A";
    if(c == 'C') cout << "G";
    if(c == 'G') cout << "C";
    return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N,M;
    cin >> N >> M;

    if(N==M) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int a,b;
    cin >> a >> b;
    if(a>9 || b>9){dame}
    cout << a*b <<endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, n, s) for (int i = s; i < n; i++)
using namespace std;
const double PI = acos(-1);
int main()
{
    int n;
    cin >> n;
    vector<vector<vector<int>>> info(4, vector<vector<int>>(3, vector<int>(10, 0)));
    int b, f, r, v;
    rep(i, n)
    {
        cin >> b >> f >> r >> v;
        info[b-1][f-1][r-1] += v;
    }

    rep(b, 4)
    {
        rep(f, 3)
        {
            rep(r, 10)
            {
                cout<<" "<<info[b][f][r];
            }
            cout<<endl;
        }
        if(b!=3){
        cout<<"####################"<<endl;
        }
    }
   // system("pause");
    return 0;
}


Measured memory_bytes: 3168
import itertools
n,k = map(int,input().split())
a = list(map(str,input().split()))
d = [str(i) for i in range(10)]

for c in a:
    d.remove(c)

res = -1
for l in itertools.product(d,repeat=len(str(n))):
    x = int(''.join(l))
    if x>=n and (res==-1 or x<res):
        res = x
if res != -1:
    print(res)
    exit(0)
for l in itertools.product(d,repeat=len(str(n))+1):
    x = int(''.join(l))
    if x>=n and (res==-1 or x<res):
        res = x
print(res)


Measured memory_bytes: 3188
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
sat = sum(B)
for i in range(N - 1):
    if A[i] + 1 == A[i + 1]:
        sat += C[A[i] - 1]

print(str(sat))


Measured memory_bytes: 3060
//Vol5 588
#include<stdio.h>
#include<string.h>
int main()
{
	int n,s=0;
	char c,l='+';
	while(1){
		scanf("%d\n",&n);
		scanf("%c",&c);
		if(l=='+'){
			s+=n;
		}else if(l=='-'){
			s-=n;
		}else if(l=='*'){
			s*=n;
		}else{
			s/=n;
		}
		l=c;
		if(c=='='){
			printf("%d\n",s);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 2704
MOD = 10**9 + 7

N, M = map(int, input().split())
setA = set([int(input()) for _ in range(M)])

dp = [0] * (N+3)
dp[0] = 1
for i in range(N):
    if i in setA: continue
    dp[i] %= MOD
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]

ans = dp[N] % MOD
print(ans)


Measured memory_bytes: 13216
#include <bits/stdc++.h>
#define vel vector<long long>
#define veb vector<bool>
#define vvel vector<vel>
#define int long long
#define pin pair<int,int>
#define ppin pair<int,pin>
#define mkp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define maxel(vec, j) *max_element(vec.begin(), vec.begin()+j)

using namespace std;
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
signed main() {
    int pr = 1000;
    pr *= pr * pr; pr += 7;
    int a, b, c;
    cin >> a >> b >> c;
    if(((a < c) && (c < b)) || ((a > c) && (c > b))){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


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

int wa(int n,int i){
    int t;
    int r=0;
    while(i>0){
        r+=i%10;
        i=i/10;
        }
        return r;
        }
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int ans=0;

    for(int i=1;i<=n;i++){
        int t;
        t=wa(n,i);
        if(t>=a&&t<=b){
            ans+=i;
            }
        }
    cout<<ans<<endl;
    return 0;
    }


Measured memory_bytes: 256