akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

vector<pair<char,int>> runLength(string s) {
  int n = sz(s);
  vector<pair<char,int>> res;
  rep(i,n) {
    int cnt = 1;
    while(i < n-1 && s[i] == s[i+1]) {
      cnt++;
      i++;
    }
    res.push_back(pair<char,int>(s[i],cnt));
  }
  return res;
}
  
int main() {
  string s;
  cin >> s;
  vector<pair<char,int>> res = runLength(s);
  int ans = 0;
  rep(i,sz(res)) {
    if(res[i].second == 0) continue;
    if(res[i].second == 1) {
      ans++;
      continue;
    }
    if(res[i].second == 2) {
      if(i != sz(res)-1) {
        ans += 2;
        res[i+1].second = res[i+1].second -1;
      } else {
        ans++;
      }
      continue;
    }
    if(res[i].second >=3) {
      if(res[i].second % 3 == 0) {
        ans += (2 * res[i].second) / 3;
      } else if (res[i].second % 3 == 1) {
        ans += (2 * res[i].second + 1) / 3;
      } else {
        if(i != sz(res) -1) {
          ans += (2 * res[i].second + 2) / 3;
          res[i+1].second = res[i+1].second -1;
        } else {
          ans += (2 * res[i].second + 1) / 3;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2808
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 16:47:54 2020

@author: liang
"""
N = int(input())
B = list(map(int,input().split()))

ans = B[0]

for i in range(1,N-1):
    ans += min(B[i-1], B[i])
ans += B[N-2]
print(ans)

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

using namespace std;
int main(){
    
    string str;
    getline(cin, str);
    
    for(int i = 0; i < (int)str.size(); i++){
        if(str[i] >= 'a' && str[i] <= 'z'){
            str[i] += 'A' - 'a';
        }
    }
    cout << str <<endl;
    
}

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
        int n; cin >> n;
        string s; cin >> s;
        ll res = 0, x = 0;
        for (int i = 0; i < s.length(); ++i)
        {
                if (s[i] == 'I') 
                {
                        x++;
                }
                else x--;
                res = max(res, x);
        }
        cout << res;
}

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


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define MP make_pair
#define PB push_back
#define fi first
#define se second

typedef long long LL;
typedef pair<int, int> PII;
const int N= 2e6 +10;

int a[N], b[N], n,k,q;
bool flag[N];
multiset<int> mb;
int main(){
	#ifdef che
	freopen("input.txt","rt",stdin);
//	freopen("output.txt","wt",stdout);
	#endif
	scanf("%d%d%d", &n, &k, &q);
	set<int> s;
	for (int i=0; i<n; i++) scanf("%d", &a[i]), s.insert(a[i]);
	sort(b,b+n);
	int ans= 2e9;
	for (auto lm:s){
		for (int i=0; i<n; i++) if ( a[i] < lm) flag[i] = false;	else flag[i] = true;
		
		int bn=0;
		for (int i=0,j; i<n; i=j){
			for (j=i+1; flag[i] && flag[j] && j<n; j++);
			if( !flag[i]) continue;
			int rn= max(j-i-k+1,0);
			mb.clear();
			for (int l=i; l<j; l++) mb.insert(a[l]);
			for (;rn--; mb.erase(mb.begin())) b[bn++] = *mb.begin();
		}
		if(bn < q) break;
		sort(b, b+bn);
		#ifdef che
		debug("lm=%d , b=",lm);
		for (int i=0; i<bn; i++) debug("%d\t", b[i]);
		debug("\n");
		#endif
		ans= min(ans, b[q-1]-b[0]);
	}
	printf("%d\n", ans);
	return 0;
}

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

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

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

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n, k, r, s, p;
string t;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k >> r >> s >> p >> t;

  ll sum = 0;
  vector<int> used(n, false);
  REP(i, n) {
    if(k <= i && t[i - k] == t[i] && used[i - k]) continue;
    
    if(t[i] == 'r') sum += p;
    else if(t[i] == 's') sum += r;
    else sum += s;
    used[i] = true;
  }

  cout << sum << endl;
}


Measured memory_bytes: 3832
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
  ll A;
  double B;
  cin >> A >> B;
  ll ans = A * (ll)(B * 100 + 0.6);
  cout << ans / 100 << endl;
  return 0;
}

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

//cubeÌzñðmÛ(³Í1/4)
unsigned char cube[501][501][130];

int main(){
	int i,j,n,a,b,h,m,k,x,y,z;
	char c[3];
	c[2]='\n';
	while(0<=scanf("%d%d",&n,&h)){
		if(n==0 && h==0) break;
		//zñÌú»
		memset(cube,0,sizeof(cube));
		
		//«ÌJ¢ÄécubeÌ
		m=0;
		i=h+1;
		while(--i){
			j=n+1;
			scanf(" %c %c %d%d ",&c[0],&c[1],&a,&b);
			if(c[0]=='x' && c[1]=='y'){
				while(--j){
					//cubeÌ³ª³k³êÄ¢éÌÅA2ÌÝæðgÁÄAÌLè³µð¯Ê
					if((cube[a][b][(j>>2)+1]>>(j%4))%2==1)continue;
					cube[a][b][(j>>2)+1]+=(1<<(j%4));
					++m;
				}
/*				for(x=1;x<=n;++x){
					for(y=1;y<=n;++y){
						for(z=1;z<=n;++z){
							printf("%d ",(cube[x][y][(z>>2)+1]>>(z%4))%2);
						}
						printf("\n");
					}
					printf("\n");
				}*/
				continue;
				
			}
			if(c[0]=='x' && c[1]=='z'){
//			printf("%c%c %d %d\n",c[0],c[1],a,b);
				while(--j){
					if((cube[a][j][(b>>2)+1]>>(b%4))%2==1)continue;
					cube[a][j][(b>>2)+1]+=(1<<(b%4));
					++m;
				}
/*				for(x=1;x<=n;++x){
					for(y=1;y<=n;++y){
						for(z=1;z<=n;++z){
							printf("%d ",(cube[x][y][(z>>2)+1]>>(z%4))%2);
						}
						printf("\n");
					}
					printf("\n");
				}
*/				
				continue;
			}
			if(c[0]=='y' && c[1]=='z'){
//			printf("%c%c %d %d\n",c[0],c[1],a,b);
				while(--j){
//					printf("cube[%d][%d][(%d>>2)+1]=%d\n",j,a,b,cube[j][a][(b>>2)+1]);
					if((cube[j][a][(b>>2)+1]>>(b%4))%2==1)continue;
					cube[j][a][(b>>2)+1]+=(1<<(b%4));
					++m;
			}
/*				for(x=1;x<=n;++x){
					for(y=1;y<=n;++y){
						for(z=1;z<=n;++z){
							printf("%d ",(cube[x][y][(z>>2)+1]>>(z%4))%2);
						}
						printf("\n");
					}
					printf("\n");
				}*/
				continue;
			}
		}
		//ÌJ¢Ä¢È¢cubeÌÂðoÍ
		printf("%d\n",n*n*n-m);
/*		for(i=1;i<=n;i++){
			for(j=1;j<=n;j++){
				for(k=1;k<=n;k++){
					printf("%d ",(cube[i][j][(k>>2)+1]>>(k%4))%2);
				}
				printf("\n");
			}
			printf("\n");
		}
		*/
	}
	return 0;
}

Measured memory_bytes: 31000
"use strict";
main(require("fs").readFileSync("/dev/stdin", "UTF-8"));

function main(input) {
  input = input.split("\n")[1].split(" ");

  let denominator = 0;
  for (const n of input) {
    denominator += 1 / parseInt(n);
  }
  console.log(1 / denominator);
}


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

bool isPrime(int x){
  if(x == 0 || x == 1) return false;
  for(int i = 2; i*i <= x; i++){
    if(x%i == 0) return false;
  }
  return true;
}

int main(void){
  int n;
  cin >> n;
  int i = 0;
  int m = 11;
  vector<int> a(n);
  while(i < n){
    if(isPrime(m)){
      a[i] = m;
      i++;
    }
    m += 5;
  }
  REP(j, n) printf("%d ", a[j]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

void solve()
{
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll ans = 0;
	ll x = min(k, a);
	ans += x;
	k -= x;
	if(k>0){
		x = min(k, b);
		k -= x;
	}
	if(k>0){
		x = min(k, c);
		ans -= x;
	}
	cout << ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}

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

using namespace std;

#define PB push_back
#define SZ(a) (int)a.size()
#define MP make_pair

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;

int main() {

	int N,M;
	scanf("%d%d", &N, &M);

	if(N==M) printf("Yes\n");
	else printf("No\n");

	return 0;
}


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

const int N=100010,M=100010;
int fa[N],n,m;
int findpa(int x){return fa[x]!=x?fa[x]=findpa(fa[x]):x;}


int main(){
	scanf("%d %d",&n,&m);
	int tot=n-1,x,y;
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++) scanf("%d %d",&x,&y),(findpa(x)!=findpa(y)?(tot--,fa[findpa(x)]=findpa(y)):0);
	printf("%d\n",tot);
}

Measured memory_bytes: 4216
#include <stdio.h>
#include <string.h>
int main(void){
    char s[12],buf[12]={0};
    scanf("%s",s);
    //cntは現時点でのbuf内の要素数
    int i,j,cnt=0;
    for(j=0;j<strlen(s);j++){
        if(s[j]=='0'){
            buf[cnt]='0';
            cnt++;
        }else if(s[j]=='1'){
            buf[cnt]='1';
            cnt++;
        }else{
            if(cnt!=0){
            buf[cnt-1]=0;
            cnt--;
            }
        }
    }
    printf("%s\n",buf);
    return 0;
}

Measured memory_bytes: 128
function Main(input) {
  input = input.split("\n");
  num = input[0].split(" ").map(Number);
  var p = [];
  for(var i=0;i<num[0];i++){
    p.push(0);
  }
  for(var j=0;j<num[2];j++){
    n = input[j+1].split(" ");
    p[n-1]++;
  }
  for(var k=0;k<num[0];k++){
    if(p[k]-num[2]+num[1]>0){
      console.log("Yes");
    }else{
      console.log("No");
    }
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 31708
#include <iostream>
#include <string>
#include <vector>

using namespace std;

char abacus[8][5];

void init() {
    for (int i = 0; i < 8; i++) {
        if (i == 2) {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = '=';
            }
        } else {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = ' ';
            }
        }
    }
}

int power(int n, int a) {
    int acc = 1;
    for (int i = 0; i < a; i++) {
        acc *= n;
    }
    return acc;
}

void set(int n) {
    for (int i = 4; 0 <= i; i--) {
        int index = 4 - i;
        int d = n / power(10, i);
//        cout << "i: " << i << endl;
//        cout << "d: " << d << endl;
        if (d < 5) {
            abacus[0][index] = '*';
            abacus[1][index] = ' ';
        } else {
            abacus[0][index] = ' ';
            abacus[1][index] = '*';
            d -= 5;
        }
        for (int j = 3; j < 8; j++) {
            abacus[j][index] = '*';
        }
        abacus[d+3][index] = ' ';
        n = n - n / power(10, i) * power(10, i);
    }
}

int main() {
    int n;
    cin >> n;
    init(); set(n);
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 5; j++) {
            cout << abacus[i][j];
        }
        cout << endl;
    }
    while (cin >> n) {
        init();
        set(n);
        cout << endl;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 5; j++) {
                cout << abacus[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 852
# 拡張ユークリッド互除法を用いて逆元を求める
def modinv(a, m):
    b = m; x0 = 1; x1 = 0
    while b:
        q = a//b
        a, b = b, a%b
        x0, x1 = x1, x0 - q*x1
    return x0%m 


x, y = map(int, input().split())
if (x + y)%3 != 0:
    print(0)
else:
    k = (x + y)//3
    if k <= x <= 2*k:
        i = min(x - k, 2*k - x)
        # 結局 コンビネーションkCiに帰着
        MOD = 10**9 + 7
        # まず階乗のmodを求める
        fac = [1]*(k + 1)
        for j in range(2, k + 1):
            fac[j] = fac[j - 1]*j%MOD
        # 次に階乗の逆元を求める
        finv = [0]*(k + 1)
        #finv[k] = pow(fac[k], MOD - 2, MOD) # fac[k]の逆元, フェルマーの小定理
        finv[k] = modinv(fac[k], MOD)
        for j in range(k, i, - 1):
            finv[j - 1] = finv[j]*j%MOD

        print(fac[k] * (finv[i] * finv[k - i] % MOD) % MOD)
    else:
        print(0)

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

int main() {
    ll A, B, M;
    cin >> A >> B >> M;
    vector<ll> a(A), b(B);
    rep(i, A) cin >> a.at(i);
    rep(i, B) cin >> b.at(i);

    ll minA = *min_element(a.begin(), a.end());
    ll minB = *min_element(b.begin(), b.end());
    ll ret = minA + minB;

    rep(i, M) {
        ll x, y, c;
        cin >> x >> y >> c;
        x--;
        y--;
        ret = min(ret, a[x] + b[y] - c);
    }

    cout << ret << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<vector<ll> > cnt(10, vector<ll>(10)); //cnt[x][y]:=「x...yなる数の個数」
  int ju = 1;
  for (int a = 1; a <= n; ++a) {
    if (a == 10 || a == 100 || a == 1000 || a == 10000 || a == 100000) ju *= 10;
    if (a % 10 == 0) continue; //0で終わるものを除く
    int start = (a / ju) % 10;
    int end = a % 10;
    cnt[start][end]++;
    // debug(a, start, end);
  }
  ll ans = 0;
  for (int start = 1; start <= 9; ++start) {
    for (int end = 1; end <= 9; ++end) {
      ans += cnt[start][end] * cnt[end][start];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
 * wafuIroha.cpp
 *
 *  Created on: 2020/02/23
 *      Author: black
 */
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n;
	long long k;
	cin >> n >> k;
	long long v[100001] = {0};

	int a, b;
	for (int i =0; i<n; ++i){
		cin >> a >> b;
		v[a] += b;
	}

	long long sum = 0;
	for (int i =1; i<100001; ++i){
		sum += v[i];
		if (sum >= k){
			cout << i << endl;
			break;
		}
	}

	return 0;
}



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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int i=0; i<n; i++)
#define FOR1(i, n) for(int i=1; i<=n; i++)
#define FORI(i, n) for(int i=n-1; i>=0; i--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    const int M = 1e6;
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(M+1);
    FOR(i, n){
        cin >> a[i];
        b[a[i]]+=1;
    }

    int d = a[0];
    FOR1(i, n-1) d = __gcd(d, a[i]);

    bool pcp = 1;
    FOR1(x, M){
        if (x > 1){
            int cnt = 0;
            for(int y = x; y <= M; y += x)
                cnt += b[y];
            if (cnt > 1){
                pcp = 0;
                break;
            }
        }
    }

    if (pcp)
        cout << "pairwise coprime" << endl;
    else if (d == 1)
        cout << "setwise coprime" << endl;
    else
        cout << "not coprime" << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}



Measured memory_bytes: 11080
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mo 1000000007
#define mems(a,x) memset(a,x,sizeof(a))
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}



int main() 
{ 
	ll x,y,z,k;
	cin>>x>>y>>z>>k;
	ll a[x],b[y],c[z];
	vector<ll>v;
	priority_queue<ll>p2;
	for(int i=0;i<x;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<y;i++)
	{
		cin>>b[i];
	}
	for(int i=0;i<z;i++)
	{
		cin>>c[i];
		
	}
	for(int i=0;i<x;i++)
		for(int j=0;j<y;j++)
			{
				v.push_back(a[i]+b[j]);
			}

	ll le=v.size();
	ll s=le;
	le=min(le,k);
	sort(v.begin(),v.end());
	// for(int i=0;i<le;i++)
	// 	cout<<v[s-i-1]<<" ";
	for(int i=0;i<le;i++)
	{
		for(int j=0;j<z;j++)
		{
			ll t=v[s-i-1]+c[j];
			p2.push(t);
		}
	}
	// vector<ll>v;
	// for(int i=0;i<x;i++)
	// {
	// 	for(int j=0;j<y;j++)
	// 	{
	// 		ll temp=a[i]+b[j];
	// 		v.push_back(temp);
	// 	}
	// }
	// sort(v.begin(),v.end(),greater<int>());
	// ll le=v.size();
	// le=min(k,le);
	// cout<<le<<endl;
	// for(int i=0;i<le;i++)
	// {
	// 	for(int j=0;j<z;j++)
	// 	{
	// 		p2.push(v[i]+c[j]);
			
	// 	}
	// }
	while(k--)
	{
		cout<<p2.top()<<endl;
		p2.pop();
	}


} 

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

int K;

int main() {
    cin >> K;
    int odd = 0;
    int even = 0;

    for (int i = 1; i <= K; i++) {
        if (i % 2 == 0) {
            even++;
        } else {
            odd++;
        }
    }

    cout << even * odd << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main() {
    int S;
    cin >> S;
    int pre = S/100;
    int la = S%100;
    if(pre > 0 && pre < 13){
        if(la > 0 && la < 13){
            cout << "AMBIGUOUS" << endl;
        }
        else{
            cout << "MMYY" << endl;
        }
    }
    else{
        if(la > 0 && la < 13){
            cout << "YYMM" << endl;
        }
        else{
            cout << "NA" << endl;
        }
    }
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e14;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;
    N++;

    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    reverse(ALL(A));

    ll dp[N][2];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = A[0];
    dp[0][1] = A[0];

    ll cc = 1;
    REP(i, N - 1) {
        if (cc > INF) break;
        cc *= 2;
    }

    if (cc < A[0]) {
        print(-1);
        return 0;
    }

    FOR(i, 1, N) {

        dp[i][0] = ceil(dp[i - 1][0] / float(2)) + A[i];

        ll can = 1;
        REP(j, N - i - 1) {
            if (can > INF) break;
            can *= 2;
        }

        if (dp[i][0] > can) {
            print(-1);
            return 0;
        }

        dp[i][1] = min(dp[i-1][1] + A[i], can);
    }

    ll ans = 0;
    ll car = 1;
    REP(i, N) {
        int j = N - i - 1;

        ll d = min(car * 2, dp[j][1]);
        ans += d;
        car = (d - A[j]);
    }
    print(ans);
}


Measured memory_bytes: 5556
#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;
    string s;
    cin >> a >> s;
    if(a<3200) cout << "red" <<endl;
    else cout << s << endl;


    return 0;
}

Measured memory_bytes: 256
K,S = map(int, input().split())
S1 = 0
counter = 0
for X in range(min(K,S)+1):
    S1 = S - X
    for Y in range(min(K,S1)+1):
        Z = S - X - Y
        if (Z >= 0 and Z <= K):
            counter += 1
            #print(X,Y,Z)
print(counter)

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

typedef long long ll;
typedef tuple<ll, ll, ll> mytuple;
const ll INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589793238;

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) { if (b == 0) {return a;} else {return GCD(b, a % b);} }
// a と b の最小公倍数を返す関数
long long LCM(long long a, long long b) { return a/GCD(a,b)*b; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) {a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) {a = b; return true; } return false; }

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

  int cnt[N+1] = {0};
  for(int i = 0; i < N-1; i++) {
    int a; cin >> a;
    cnt[a]++;
  }

  for(int i = 1; i <= N; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4420
from collections import deque
N=int(input())
AB=[list(map(int,input().split())) for i in range(N-1)]
P=[set() for i in range(N+1)]
C=[set() for i in range(N+1)]

for a,b in AB:
    P[a].add(b)
    P[b].add(a)
Cpath={}
stack=deque([1])
delset=set()
while stack:
    #print(C)
    #print(Cpath,"Cpath")
    a=stack[0]
    count=1
    for b in P[a]:
        #b=P[a][-1]
        while count in C[a]:
            count+=1
        C[a].add(count)
        C[b].add(count)
        Cpath[(a,b) if a<b else (b,a)]=count
        stack.append(b)
        #P[a].remove(b)
        P[b].remove(a)
    P[a].clear()
    stack.popleft()

print(max([Cpath[i] for i in Cpath]))
for a,b in AB:
    print(Cpath[(a,b)])


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

N, M = map(int, input().split())
AB = [[int(x) for x in input().split()] for n in range(N)]

# O(NlogN)
AB.sort(key=(lambda x:x[0]))

# O(M)
cnt = 0 # counter of drink
prc = 0 # price of drink
i = 0
while cnt < M:
    a, b = AB[i]
    if cnt+b <= M:
        cnt += b
        prc += a*b
    else:
        prc += a*(M-cnt)
        cnt = M
    i+=1

print(prc)


Measured memory_bytes: 22760
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
 
using namespace std;
 
typedef long long ll;
 
int mod;
int sub(int i, int j) { return ((i -= j) < 0 ? i += mod : i); }
int add(int i, int j) { return ((i += j) < mod ? i : i -= mod); }
int mult(int i, int j) { return (ll) i * j % mod; }
 
int A[200000];
int box[100000];
 
int main() {
    cin.tie(NULL) -> sync_with_stdio(false);
    int n; cin >> n >> mod;
    string line; cin >> line;
    reverse(line.begin(), line.end());
    for(char& c : line)
        c -= 48;
    
    if(mod == 2 || mod == 5) {
        ll mx = 0;
        for(int i = 0; i < n; ++i)
            if(line[i] % mod == 0)
                mx += n - i;
                
        cout << mx;
        return 0;
    }
     
    int r = 1;
    A[0] = line[0] % mod;
    for(int i = 1; i < n; ++i) {
        r = mult(r, 10);
        A[i] = add(mult(r, line[i]), A[i - 1]);
    }
    
    for(int i = 0; i < n; ++i)
        box[A[i]] += 1;
    
    int rx = 0;
    r = 1;
    ll res = 0;
    for(int i = 0; i < n; ++i) {
        res += box[rx];
        box[A[i]] -= 1;
        rx = A[i];
        r = mult(r, 10);
    }
    
    cout << res;
    return 0;
}

Measured memory_bytes: 1428
import Text.Printf(printf)
main = getLine >>= solve . map read . words

solve :: [Int] -> IO ()
solve (x:y:[]) = do
    printf "%d " (x `div` y)
    printf "%d " (x `mod` y)
    printf "%.5f\n" $ (fi x) / (fi y)
    where fi :: Int -> Double
          fi = fromIntegral


Measured memory_bytes: 3916
#pragma GCC optimize(2)
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define endl "\n"
const int MAX=1e6+7;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
ll a[MAX],b[MAX],c[MAX];
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
	ll n,ans=0;cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	//sort(a+1,a+n+1);
	b[n]=a[n];
	for(int i=n-1;i>=1;i--)b[i]=(b[i+1]+a[i])%mod;
	for(int i=1;i<=n;i++)c[i]=(c[i-1]+a[i]*(b[i+1]))%mod;
	cout<<c[n];
   return 0;
}  

Measured memory_bytes: 8340
#include<stdio.h>
int main(void)
{
	int a[3],cnt,i,j,wk;
	int ei,tyo,don;
	ei=0;	tyo=0;	don=0;	cnt=0;
	while(1)	{
		scanf("%d %d %d",&a[0],&a[1],&a[2]);
		for(i=0;i<3-1;i++)	{
			if(a[i]>a[2])	{
				wk=a[i];
				a[i]=a[2];
				a[2]=wk;
			}
		}
		if(a[0]+a[1]<=a[2])	{
			break;
		}
		if(a[0]*a[0]+a[1]*a[1]<a[2]*a[2])	{
			don++;
		}
		else if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])	{
			tyo++;
		}
		else {
			ei++;
		}
		cnt++;
	}
	printf("%d %d %d %d\n",cnt,tyo,ei,don);
	return 0;
}


Measured memory_bytes: 596
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.next());
		HashMap<Integer,Boolean> map=new HashMap<Integer,Boolean>();
		for(int i=0;i<n;i++){
			int a=Integer.parseInt(sc.next());
			Boolean t=map.get(a);
			if(t==null)
				map.put(a,true);
			else
				map.put(a,!t);
		}
		int ans=0;
		for(Integer k:map.keySet())
			if(map.get(k))
				ans++;
		System.out.println(ans);
	}
}

Measured memory_bytes: 47176
#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()
{
    int x;
    cin >> x;

    int d = 360;
    int rem;
    while (1) {
        rem = d % x;
        if (rem == 0) {
            cout << d / x << endl;
            return 0;
        }
        d += 360;
    }

    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }
    int maxbit = log(*max_element(a.begin(), a.end())) / log(2) + 1; //sqrt(4) = 2 4 = 100 3bits
    maxbit = 60;
    ll ans = 0;
    rep(i, maxbit){
        ll bits[2] = {};
        rep(j, n){
            if(a[j] & (1LL << i)){ //i番目のbitが1
                bits[1]++;
            }else{
                bits[0]++;
            }
        }
        //ans = (ans % MOD + (1LL * (bits[1] * bits[0]) % MOD * ((1LL << i) % MOD)) % MOD) % MOD;
        //ans +=((1LL*bits[0]*bits[1])%MOD*(1LL << i)%MOD) % MOD;
        ans %= MOD;
        ans += ((1LL*(bits[0]*bits[1])%MOD*((1LL<<i)%MOD))%MOD)%MOD;
        //ans %= MOD;
        //cout << i+1 << ":" << bits[0] << " " << bits[1] <<  endl;
    }
    cout << ans%MOD << endl;
}


Measured memory_bytes: 2560
#include<iostream>
#include<cmath>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{IOS;
	long long n;
	cin>>n;
	long long k=7,answer=0;
	if(n%2==0||n%5==0)
	cout<<-1;
	else
	{
		while(1)
		{
			k%=n;
			//cout<<k<<endl;
			answer++;
			if(k==0)
			break;
			k=k*10+7;
			//getchar();
		}
		cout<<answer;
	}
	
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isPossible(x) printf("%s\n",(x) ? "Possible" : "Impossible")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
// #define INF (1<<29)

const long long INF = 1LL<<50;

#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
// const int mod =(int)998244353;
const int mod =(int)1e9+7;

const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(a<0)a=-a;
    if(b<0)b=-b;
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
  if(a<0)a=-a;
  if(b<0)b=-b;
    ll g;g=gcd(a,b);
    return b/g*a;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
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;
}
int main() {
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    ll ans=0;
    int m=0;
    REP(i,N){
        if(A[i]<m){
            ans+=m-A[i];
        }
        if(A[i]>m){
            m=A[i];
        }
    }
    cout<<ans<<endl;
    return 0;
} 
 

Measured memory_bytes: 4048
s=input()
t=input()
i=0
if s[0]==t[0]:
  i+=1
elif s[0]!=t[0]:
  pass
if s[1]==t[1]:
  i+=1
elif s[1]!=t[1]:
  pass
if s[2]==t[2]:
  i+=1
elif s[2]!=t[2]:
  pass  
print(i)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define FOR(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
const int MAX = 101;

template<class T, class U>
void convert(T &t, U &u){
    stringstream ss;
    ss << t;
    ss >> u;
}

int dp[51];

int main(){
	int w[]={0, 2, 3, 5, 2*5, 3*4, 5*3};
	int m[]={1<<29, 380, 550, 850, 5*380*0.8, 4*550*0.85, 3*850*0.88};

	fill(dp+1, dp+51, 1<<29);

	for(int i = 1; i <= 50; i++){ 
		for(int j = 1 ; j <= 6; j++){
			if(i>=w[j]){
				dp[i] = min(dp[i], dp[i-w[j]]+m[j]);
			}
		}
	}

	int n;
	while(cin >> n && n!=0){
		cout << dp[n/100] << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
typedef long long ll;
int OO = 0x3f3f3f3f;

int n, k;
int arr[100005];
int mem[100005];

int solve(int x)
{
    if(x == n-1)
        return 0;

    if(mem[x] != OO)
        return mem[x];

    for(int i = 1; i <= k  && (x+i) <= n-1; i++)
    {
        mem[x] = min(mem[x], solve(x+i)+abs(arr[x] - arr[x+i]));
    }

    return mem[x];
}

int main()
{
    cin >> n >> k;
    memset(mem, OO, sizeof mem);
    for(int i = 0; i< n; i++)
    {
        cin >> arr[i];
    }
    cout << solve(0) << endl;
    return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll n;cin >> n;
	ll ans = 0;
	REP(i, n){
		ll a;cin >> a;
		if(i % 2 == 0 && a % 2)ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3604
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var r = int.Parse(Console.ReadLine());
            Console.WriteLine(r < 1200 ? "ABC" : r < 2800 ? "ARC" : "AGC");
        }
    }
}


Measured memory_bytes: 13140
n = int(input())
max = 0
sub_max = 0
max_index = 0
for i in range(n):
    a = int(input())
    if(a > max):
        sub_max = max
        max = a
        max_index = i
    elif(a > sub_max):
        sub_max = a
for i in range(n):
    if(i == max_index):
        print(sub_max)
    else:
        print(max)


Measured memory_bytes: 4540
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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 (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    vector<int> c(26);
    for (char ch : s) c[ch - 'a']++;
    cout << (all_of(all(c), [](int a){return !(a % 2);}) ? "Yes\n" : "No\n");
    return 0;
}

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

int main()
{
	string s;
	while(getline(cin, s)){
	
		while(s.find("the") == s.npos && s.find("this") == s.npos && s.find("that") == s.npos){
			for(size_t i=0;i<s.size();i++){
				if(s[i]>='a' && s[i]<='y'){
					s[i]++;
				}else if(s[i]=='z'){
					s[i] = 'a';
				}
			}
		}
		//whileを抜けたときにはtheかthisかthatが含まれている
		cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
typedef vector<int> vi;
//const int MAX=;

int ct[4];

int main(){
	rep(i,6){
		int a;
		cin>>a;
		a--;
		ct[a]++;
	}
	sort(ct,ct+4);
	if(ct[0]==1&&ct[1]==1&&ct[2]==2&&ct[3]==2)cout<<"YES";
	else cout<<"NO";
}

Measured memory_bytes: 256
import math

n = int(input())
s = input()

R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B

for i in range(n):
    for j in range(n):
        c1 = i
        c2 = i + j
        c3 = i + j * 2
        if c3 >= n: continue
        if c1 == c2 == c3: continue
        if s[c1] != s[c2] and s[c2] != s[c3] and s[c1] != s[c3]:
            ans -= 1

print(ans)
# 012 024 036 048
# 123 135 147 159

Measured memory_bytes: 73772
import qualified Data.Vector.Unboxed as V
import Control.Monad
import Data.Maybe
import Data.List
import qualified Data.ByteString.Char8 as BS
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine

tw :: (a -> Bool) -> [a] -> [a]
tw p (x:xs)
  | p x = x:tw p xs
  | otherwise =[x]
tw _ [] = []

main = do
  [n,k] <- getIntList
  p <- V.fromList . map (+(-1)) <$> getIntList
  c <- V.fromList <$> getIntList
  let acc i = tail $ scanl' (+) 0 $ map ((c V.!).(p V.!)) $ tw (/=i) (iterate (p V.!) (p V.! i))
      ans i = 
        if val > 0
          then
            if rem /= 0
              then num * val + maximum (take (fromIntegral rem) list)
              else (num-1) * val + maximum list
          else maximum list
        where list = acc i
              val = last list
              len = fromIntegral $ length list
              num = k `div` len
              rem = k `mod` len
  print $ maximum $ map ans [0..n-1]


Measured memory_bytes: 7152
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner scanner = new Scanner(System.in);
 
        int vacation = scanner.nextInt();
        int homeworkNumber = scanner.nextInt();
        int[] daysSpentInHomework = new int[homeworkNumber];
        int studyDay = 0;
 
        for (int i = 0; i < homeworkNumber; i++) {
            studyDay += scanner.nextInt();
        }
 
        int playable;
      
        playable = vacation - studyDay;
 
        if (playable >= 0) {
            
            System.out.println(playable);
        } else {
            System.out.println("-1");
        }
 
        scanner.close();
 
    }
 
}

Measured memory_bytes: 46676
#include<bits/stdc++.h>
using namespace std;
int main(){int N,K,d,x;cin>>N>>K;vector<int>a(N,1);x=N;
   for(int i=0;i<K;i++){cin>>d;for(int j=0;j<d;j++){int b;cin>>b;if(a.at(b-1)){a.at(b-1)=0;x--;}}}
           cout<<x<<endl;}


Measured memory_bytes: 3628
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

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

  Pll RL[N];
  for (int i = 0; i < N; i++){
    ll X, L; cin >> X >> L;
    RL[i].first = X + L;
    RL[i].second = X - L;
  }
  sort(RL, RL + N);

  ll ans = 1, nowR = RL[0].first;
  for (int i = 1; i < N; i++){
    if (nowR <= RL[i].second){
      ans++;
      nowR = RL[i].first;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
int64 dp[101][4][4][4];
void solve() {
	int n; cin >> n;
	dp[0][3][3][3] = 1;
	for (int len = 0; len < n; ++len) {
		for (int c1 = 0; c1 < 4; ++c1) {
			for (int c2 = 0; c2 < 4; ++c2) {
				for (int c3 = 0; c3 < 4; ++c3) {
					for (int a = 0; a < 4; ++a) {
						if (dp[len][c1][c2][c3] == 0) continue;
						if (c2 == 0 && c1 == 1 && a == 2) continue;
						if (c2 == 0 && c1 == 2 && a == 1) continue;
						if (c2 == 1 && c1 == 0 && a == 2) continue;
						if (c3 == 0 && c1 == 1 && a == 2) continue;
						if (c3 == 0 && c2 == 1 && a == 2) continue;
						dp[len + 1][a][c1][c2] += dp[len][c1][c2][c3];
						dp[len + 1][a][c1][c2] %= MOD;
					}
				}
			}
		}
	}
	int64 ans = 0;
	for (int c1 = 0; c1 < 4; ++c1) {
		for (int c2 = 0; c2 < 4; ++c2) {
			for (int c3 = 0; c3 < 4; ++c3) {
				ans += dp[n][c1][c2][c3];
				ans %= MOD;
			}
		}
	}
	cout << ans << endl;
	return;
}

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

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

int main() {
  int X;
  cin>>X;
  for(int i=1;i<=X/100;i++){
  int kosu=i;
  int hasu = X-kosu*100;
  if(kosu*5>=hasu){
    cout<<1<<endl;
    return 0;
  }
}
cout<<0<<endl;
}


Measured memory_bytes: 256