akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>

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

using namespace std;

int idx;
char s[501];

int variable(){
	int res=s[idx];
	idx++;
	return res;
}

int literal(){
	int sgn=1;
	if(s[idx]=='~') sgn*=-1, idx++;
	return sgn*variable();
}

bool clause(){
	int a,b,c;
	a=literal(); idx++;
	b=literal(); idx++;
	c=literal();
	return !(a+b==0 || b+c==0 || c+a==0);
}

bool expr(){
	bool res;
	idx++;
	res=clause();
	idx++;
	while(s[idx]=='|'){
		idx+=2;
		res|=clause();
		idx++;
	}
	return res;
}

bool parse(){
	idx=0;
	return expr();
}

int main(){
	for(;scanf("%s",s),s[0]!='#';) puts(parse()?"yes":"no");
	return 0;
}

Measured memory_bytes: 0
import numpy as np
H, W = map(int, input().split())
m = np.zeros((H,W))
bomb = []
for h in range(H):
  row = list(str(input()))
  for w in range(W):
    if row[w] == "#":
      bomb.append((h, w))

for h, w in bomb:
  if h!=0 and w!=0:
    m[h-1, w-1] += 1
  if h!=0:
    m[h-1, w] += 1
  if h!=0 and w!=W-1:
    m[h-1, w+1] += 1
    
  if w!=0:
    m[h, w-1] += 1
  if w!=W-1:
    m[h, w+1] += 1
  
  if h!=H-1 and w!=0:
    m[h+1, w-1] += 1
  if h!=H-1:
    m[h+1, w] += 1
  if h!=H-1 and w!=W-1:
    m[h+1, w+1] += 1

for h in range(H):
  for w in range(W):
    if (h, w) in bomb:
      print("#", end="")
    else:
      print(int(m[h, w]), end="")
  print("", end="\n")

Measured memory_bytes: 12892
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	char buf[2];
	int length;
	bool erased;
};

struct Data{
	Data(int arg_index,int arg_length){
		index = arg_index;
		length = arg_length;
	}
	bool operator<(const struct Data &arg) const{
		if(length != arg.length){
			return length > arg.length;
		}else{
			return index > arg.index;
		}
	};

	int index,length;
};

int main(){

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

	Info info[N];

	priority_queue<Data> Q;

	for(int i = 0; i < N; i++){
		scanf("%s %d",info[i].buf,&info[i].length);
		info[i].erased = false;

		if(info[i].buf[0] == 'y'){
			Q.push(Data(i,info[i].length));
		}
	}

	int ans = 0,index;

	while(!Q.empty()){
		index = Q.top().index;
		Q.pop();

		if(info[index].erased)continue;

		info[index].erased = true;
		ans++;

		for(int upper = index-1; upper >= 0; upper--){
			if(info[upper].buf[0] == 'n' && info[upper].length >= info[index].length)break;
			else if(info[upper].buf[0] == 'y' && info[upper].erased == false && info[upper].length >= info[index].length){
				info[upper].erased = true;
			}
		}

		for(int under = index+1; under <= N-1; under++){
			if(info[under].buf[0] == 'n' && info[under].length >= info[index].length)break;
			else if(info[under].buf[0] == 'y' && info[under].erased == false && info[under].length >= info[index].length){
				info[under].erased = true;
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 3232
package main

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

func main() {
	var h, w, x, y int64
	sc := bufio.NewScanner(os.Stdin)
	if sc.Scan() {
		line := sc.Text()
		arr := strings.Fields(line)
		w, _ = strconv.ParseInt(arr[0], 10, 32)
		h, _ = strconv.ParseInt(arr[1], 10, 32)
		x, _ = strconv.ParseInt(arr[2], 10, 32)
		y, _ = strconv.ParseInt(arr[3], 10, 32)
	}

	area := float64(w*h) / 2.0
	var flag int
	if 2*x == w && 2*y == h {
		flag = 1
	} else {
		flag = 0
	}
	fmt.Printf("%f %d\n", area, flag)
}


Measured memory_bytes: 640
z[75][75];s,d,t,a,*p,j;main(i){for(;scanf("%d%d",&s,&d)*d++;printf("%d\n",s)){for(memset(z,t=9,2e4);s--;)for(j=i=d;--i;a?*p=*p<a?*p:a,*z[t]>*p?t=i:0:0)scanf("%d",&a),p=z[i];for(;--j;)for(s=j;--s;a?z[s][j]=z[j][s]=a:0)scanf("%d",&a);for(s=i=0;d+~i++;t=a)for(s+=*z[t],*z[t]=0,a=j=d;--j;*p&&*z[a]>*p?a=j:0)p=z[j],*p=fmin(*p,p[t]);}}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
using std::string;
using std::cin;
using std::cout;
typedef long long ll;
using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    int N, M;
    cin >> N >> M;
    
    vector<bool> koware(N+1, false);
    for (int i = 0; i < M; i++) {
        int a;
        cin >> a;
        koware[a] = true;
    }
    vector<ll> dp(N+1);
    dp[0] = 1;
    if (koware[1]) {
        dp[1] = 0;
    } else {
        dp[1] = 1;
    }
    for (int next = 2; next <= N; next++) {
        if(!koware[next-1]) dp[next] += dp[next-1];
        if(!koware[next-2]) dp[next] += dp[next-2];
        dp[next] %= MOD_BIG;
        //cout << dp[next] << std::endl;
    }
    cout << dp[N] << std::endl;
    
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
int32_t main() 
{
    fio
	ll t,l,r,c,w,h,k,m,maxi,d,x;
	ll i,j,n;
	string s;
	cin>>n;
	cin>>s;
	r=0;w=0;
	for(j=0;j<n;j++)
	{
		if(s[j]=='R')
			r++;
		else
			w++;
	}
	c=0;
	for(j=0;j<r;j++)
	{
		if(s[j]=='W')
			c++;
	}
	cout<<c;
}


	

		

Measured memory_bytes: 3748
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    char c;cin>>c;
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------




Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define HpOut(S) cout << setprecision(20) << S << endl;
#define print(x) cout << (x) << endl;
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


// res は答え
vector<ll> ans;
vector<vector<ll>> G;

void dfs(ll v, ll p=-1) {
    for (auto e : G[v]) {
        if (e == p) continue;
        ans[e] += ans[v];
        dfs(e, v);
    }
}

int main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N,Q;
    cin >> N >> Q;
    G.assign(N, vector<ll>());
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b; 
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ans.resize(N);
    for (int q = 0; q < Q; ++q) {
        int p, x; cin >> p >> x; --p;
        ans[p] += x;
    }
    dfs(0);
    rep(i,N) cout << ans[i] << " ";
}


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

/* 繰り返し自乗法. */
int modPow(long long a, long long n, long long p) {
	if (n == 0) return 1; // 0乗にも対応する場合.
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}

signed main() {
    int X;
    int N = 101000;
    int arr[N];

    cin >> X;

	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for(int i = 2; i < N; i++){
		if(arr[i]){
			if (X <= i) {
                cout << i << endl;
                return 0;
            }
		}
	}
}



Measured memory_bytes: 3992
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::fastout;
use proconio::input;
use proconio::marker::Chars;
use proconio::marker::Usize1;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

#[fastout]
fn main() {
    input! {
        S: String,
    }

    let N = S.len();
    let mut ans: usize = 0;
    for i in 0..N {
        for j in i..N {
            let s: &str = &S[i..=j];
            let cand: usize = s.len();

            let is_ok = s
                .chars()
                .all(|c| c == 'A' || c == 'T' || c == 'C' || c == 'G');
            if is_ok {
                ans = max(ans, cand);
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2152
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define vi vector < ll  int >
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007
    using namespace std;

    #define MAXN 100001
    int spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

    vector<int> gf(int x)
    {
        vector<int> ret;
        while (x != 1)
        {
            ret.push_back(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }
    int BIT[100050];
    void upd(int x) { ++x;  while(x<=MAXN)  {  BIT[x]++;  x+=(x&-x);  } }
    int cal(int x) {  ++x;  int res=0;  while(x>0)  {  res+=BIT[x];  x-=(x&-x);  } return res; }

    void solve()
    {
    ll i,j=0,r=200,p,q,k=0,d,y=0,n,h=100000000000000,flag=0,m=0,a=hell,b=hell,id,h1,h2,a1,b1,a2,w,x,u,f,l,c=0,e,ans=0;
     cin>>n>>m;
     vector < ll > v(n+2,0),cnt(n+2,0);
     rep(i,0,m)
     {
         string s;
         cin>>p>>s;
         if(v[p]) continue;
         else if(s=="AC") v[p]=1,y++;
         else if(s=="WA") cnt[p]++;
     }
     rep(i,1,n+1) if(v[i]) k+=cnt[i];
     cout<<y<<" "<<k;


    }



    signed main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
         //cin>>t;
        while(t--)
        solve();

    }


Measured memory_bytes: 1792
#include<bits/stdc++.h>
    using namespace std;
    int d[100050];
    int main(){
    	int n,x=0;
    	cin >> n;
    	for(int i=0;i<n+1;i++){
    		cin >> d[i];
    	}
    	sort(d,d+n+1);
    	x=n/2;
    	cout << d[x+1]-d[x] << '\n';
    return 0;
    }

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

using namespace std;

#define long long long
#define INF ((long) 2e18)
#define MOD ((long) (1e9 + 7))
#define umap unordered_map

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

    long t = 1;
    //cin >> t;

    while (t--) {
        long n;
        cin >> n;

        for (long k = 1; k <= 9; k++) {
            if (n % k == 0) {
                long l = n/k;
                if (l >= 1 and l <= 9) {
                    puts("Yes");
                    return 0;
                }
            }
        }
        puts("No");
    }
}


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

d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = A[i]
    result = s
    result -= d[t] * (d[t] - 1) // 2
    result += (d[t] - 1) * (d[t] - 2) // 2
    print(result)


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

int main(int n, int a) {
    cin >> n >> a;
    int min = a;
    int max = a;
    long long sum = a;
    for (int i = 1; i < n; i++) {
        cin >> a;
        if (a < min) {
            min = a;
        }
        else if (a > max) {
            max = a;
        }
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
typedef long long int64;
int main(){
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false),cout.tie(0),cin.tie(0);
  int n;
  cin>>n;
  vector<int> A(n);
  for(int &i:A)cin>>i;
  int tot=0;
  sort(A.begin(),A.end());
  for(int i=0;i<SZ(A);++i){
    for(int j=i+1;j<SZ(A);++j){
      if(A[j]==A[i])continue;
      for(int k=j+1;k<SZ(A);++k){
        if(A[k]==A[j])continue;
        if(A[i]+A[j]>A[k])tot++;
      }
    }
  }
  cout<<tot;
  
  return 0;
}
//2020.08.15 20:03:15


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

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
constexpr int loose = 0;
constexpr int tight = 1;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll dp[101010];
ll dp2[101010];
ll m;

void dfs(Graph& g, int v, int p){
	dp[v]=1;
	for(auto e:g[v]){
		if(e.to==p) continue;
		dfs(g,e.to,v);
		(dp[v]*=dp[e.to])%=m;
	}
	dp[v]++;
	dp[v]%=m;
}

void dfs2(Graph& g, int v, int p, ll pval){
	dp2[v]=1;	
	for(auto e:g[v]){
		if(e.to==p) (dp2[v]*=pval)%=m;
		else (dp2[v]*=dp[e.to])%=m;
	}

	ll gn=g[v].size();
	Array suml(gn+1,1),sumr(gn+1,1);
	REP(i,gn){
		if(g[v][i].to==p) suml[i+1] = suml[i]*pval%m;
		else suml[i+1] = suml[i]*dp[g[v][i].to]%m;
	}
	REP2(i,gn){
		if(g[v][i].to==p) sumr[i] = sumr[i+1]*pval%m;
		else sumr[i] = sumr[i+1]*dp[g[v][i].to]%m;
	}
	
	REP(i,gn){
		if(g[v][i].to==p) continue;
		dfs2(g,g[v][i].to,v,(suml[i]*sumr[i+1]+1)%m);
	}
}

void solve(){
	ll n;
	cin>>n>>m;
	Graph g(n);
	REP(i,n-1){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		add_edge(g,x,y,1,true,1);
	}
	dfs(g,0,-1);
	dfs2(g,0,-1,1);
	REP(i,n){
		cout<<dp2[i]<<en;
	}
}

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

    solve();
    return 0;
}

Measured memory_bytes: 22912
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	string s[3];
	for(int i=0;i<3;i++) cin >> s[i];
	
	string ans;
	ans.resize(3);
	for(int i=0;i<3;i++) ans[i] = s[i][i];
	cout << ans << endl;
	
    return 0;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
ans = 0
for i in range(10*B + 11,1,-1):
    if A <= i * 0.08 < A+1 and B <= i * 0.1 < B+1:
        ans = i
if ans == False:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 2940
// garnab27
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ll int64_t
#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
ll modex(ll a,ll b,ll p){ll res=1;a%=p;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b>>=1;}return res;}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
 
vector<int > g[200010];
int cnt[200010];

void dfs(int u, int p) {
	cnt[u] = 0;
	for(int v:g[u]) {
		if(v!=p) {
			cnt[u]++;
			dfs(v,u);
		}
	}
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(NULL);cout.tie(NULL);	
 
	int n;
	cin>>n;

	for(int i=1;i<n;i++) {
		int a;
		cin>>a;
		a--;
		g[i].PB(a);
		g[a].PB(i);
	}

	dfs(0, 0);
 	
 	for(int i=0;i<n;i++) {
 		cout<<cnt[i]<<"\n";
 	}
 
	return 0;
}

Measured memory_bytes: 27840
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main() {
	int n;
	long long int a[105000];
	scanf("%d",&n);
	int cnt=0,cnt1=0,cnt2=0;
	for(int i=0; i<n; i++) {
		scanf("%lld",&a[i]);
		if(a[i]%4==0){
			cnt++;
		}else if(a[i]%4==2){
			cnt2++;
		}else{
			cnt1++;
		}
	}
	if(cnt>=cnt1){
		printf("Yes");
	}else{
		if(cnt==cnt1-1&&cnt2==0){
			printf("Yes");
		}else{
			printf("No");
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
  char s[11];
  int i,count,ans;

  count=0;
  ans =0;

  scanf("%s",s);

  for (i=0; i<11; i++){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
      count++;
    }
    else{
      if(ans<count){
        ans = count;
      }
      count=0;
    }
  }

  if(ans<count){
    ans = count;
  }
  printf("%d\n", ans);
  return 0;
}


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


int main(){
    int N;cin>>N;
    ll c[510],s[510],f[510];
    rep(i,0,N-1)cin>>c[i]>>s[i]>>f[i];
    ll tm=0;
    rep(i,0,N-1){
        tm=s[i]+c[i];
        rep(j,i,N-2){
            if(j==N-2){
                tm+=c[i];
                break;
            }
            if(tm>s[j+1]&&tm%f[j+1])tm+=f[j+1]-(tm%f[j+1]);
            else if(tm<s[j+1])tm=s[j+1];
            tm+=c[j+1];
        }
        cout<<tm<<endl;
    }
    cout<<0<<endl;
}







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

int main(){
    ll n,l,t;
    cin>>n>>l>>t;
    V x(n),w(n);
    rep(i,n)cin>>x[i]>>w[i];
    ll num=0;
    for(int i=1;i<n;i++){
        if(w[0]!=w[i]){
            if(w[0]==1){
                ll d=(x[i]-x[0]+l)%l;
                if(2*t>=d){
                    num++;
                    num+=(2*t-d)/l;
                }
            }else{
                ll d=(x[0]-x[i]+l)%l;
                if(2*t>=d){
                    num++;
                    num+=(2*t-d)/l;
                }
            }
        }
    }
    ll label;
    if(w[0]==1){
        label=(num+n)%n;
    }else{
        label=(-num%n+n)%n;
    }
    vector<ll> f(n);
    ll first;
    rep(i,n){
        ll dist;
        if(w[i]==1){
            dist=((x[i]+t)%l+l)%l;
        }else{
            dist=((x[i]-t)%l+l)%l;
        }
        f[i]=dist;
    }
    first=f[0];
    sort(f.begin(),f.end());
    ll st=lower_bound(f.begin(), f.end(),first)-f.begin();
    if(upper_bound(f.begin(), f.end(), first)-lower_bound(f.begin(), f.end(),first)==2){
        if(w[0]==1){
            label--;
        }else{
            label++;
            st++;
        }
    }
    rep(i,n){
        cout<<f[(st-label+i+n)%n]<<endl;
    }
}


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

typedef long long ll;
int a,b;
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> a >> b;
    a+=b;
    a%=24;
    cout << a;
    return 0;                             
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int r;
    int count=0;
    cin>>r;
    double n1 = 3.14;
    double n2 = 3.14*r*r;
    double q3 = n2/n1;
    cout<<q3<<endl;

    return 0;
}


Measured memory_bytes: 256
def examA():
    S = SI(); N = len(S)
    T = "CODEFESTIVAL2016"
    ans = 0
    for i in range(N):
        if S[i]!=T[i]:
            ans +=1
    print(ans)
    return

def examB():
    return

def examC():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,ALPHABET, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 1e-9
alphabet = [chr(ord('a') + i) for i in range(26)]
ALPHABET = [chr(ord('A') + i) for i in range(26)]

if __name__ == '__main__':
    examA()


Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;

int main()
{
    int n;

    while (cin >> n, n) {
        vector<P> v(2 * n);
        int m, a, b;

        while (n--) {
            cin >> m >> a >> b;
            
            v.push_back(P(a, m));
            v.push_back(P(b, -m));
        }
        sort(v.begin(), v.end());

        bool flag = true;
        int w = 0;
        for (int i = 0; i < v.size(); i++) {
            w += v[i].second;

            if (w > 150) {
                flag = false;
                break;
            }
        }
        if (flag)
            cout << "OK" << endl;
        else
            cout << "NG" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1196
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		int p = 0;
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == 'p') {
				p++;
			}
		}

		System.out.println((n / 2) - p);
	}
}


Measured memory_bytes: 13740
import java.util.Scanner;
class Main{
public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  int[] in = new int[n];
  String input = sc.next();
  int cnt = 0;
  for(int i = 0; i < n; i++){
    in[i] = input.charAt(i);
    if(i == 0){
      cnt++;
    }else{
      if(in[i] != in[i - 1]){
        cnt++;
      }
    }
  }
  System.out.println(cnt);
}
}

Measured memory_bytes: 28900
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline ostream& operator<<(ostream& is, vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "" : " "); return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
inline void print() { cout << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }

int main() {
    init();

    int n; cin >> n;
    vector<pair<ll, ll>> ab(n); cin >> ab;
    rSORT(ab, [](auto x, auto y) {return x.second < y.second; });

    ll now = 0;
    each(i, ab) {
        now += i.first;
        if (i.second < now) {
            print("No");
            return 0;
        }
    }
    print("Yes");
}

Measured memory_bytes: 3328
a, b, c, x, y = map(int,input().split())

price = a * x + b * y
for i in range(max(x,y)+1):
    new_price = c * 2 * i + max(a * (x - i),0) + max(b * (y - i),0)
    price = min(price,new_price)

print(price)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
bool T=false;
int main(){
    int X;cin>>X;
    if(X<600)cout<<8;
    else if(X<800)cout<<7;
    else if(X<1000)cout<<6;
    else if(X<1200)cout<<5;
    else if(X<1400)cout<<4;
    else if(X<1600)cout<<3;
    else if(X<1800)cout<<2;
    else cout<<1;
}


Measured memory_bytes: 3628
/*
    CCBESTGIRL
*/

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a , b , c;
    cin>>a>>b>>c;
    swap(a , b);
    swap(a , c);
    cout<<a<<" "<<b<<" "<<c;


    return 0;
}


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

int main(void)
{
    int x, y;

    while (1){
        cin >> x >> y;
        
        if (x == 0 && y == 0){
            break;
        }

        if (x > y){
            swap(x, y);
        }

        cout << x << " " << y << "\n";
    }

    return (0);
}



Measured memory_bytes: 3088
#include <iostream>
typedef long long int ll;
using namespace std;
#define P 998244353
#define N_MAX 300000
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}

int main(){
    init();
    ll N, A, B, K, ans =0;
    std::cin >> N >> A >> B >> K;
    for(ll i=0;i<N+1;i++){
      ll j = (K - A * i)/B;
      if((K-A*i)%B == 0 && j <= N && j >= 0){
        ans = (ans + comb(N, i) * comb(N, j))%P;
      }
    }
    std::cout << ans << '\n';
}


Measured memory_bytes: 7296
#include <stdio.h>

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N-1], dneg[2 * N-1];
int A[N][N];


void intialize()
{
  for(int i=0;i<N;i++){row[i]=FREE; col[i]=FREE;}
  for(int i=0; i<2*N-1; i++){dpos[i]=FREE; dneg[i]=FREE;}
}

void printboard()
{
  for(int i=0;i<N;i++)
  {
    for(int j=0;j<N;j++)//クイーンが実際に置かれた　かつ　調べたパターンとは一致しない　なら表示しない
    {
      if( A[i][j] )  { if( row[i]!=j )return; }
    }
  }
  for(int i=0;i<N;i++)
  {
    for(int j=0;j<N;j++)
    {
      if( row[i]==j ) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void putQueen(int i)//i行目から
{
  int j;
  if(i == N)//最後までたどり着いたら表示
  {
    printboard();
    return;
  }
  for( j=0;j<N;j++ )
  {
    if( col[j] == NOT_FREE ||dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE )
    continue;
    //(i, j)にクイーンを置く
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    //次の行を試す
    putQueen(i+1);
    //バックトラッキングのために　(i, j)のクイーンを消す
    col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
  //失敗した失敗した失敗した失敗した・・・
}


int main()
{
  int n,r,c;
  for(int i=0;i<N;i++){A[i][i]=0;}

  intialize();
  for(int i=0;i<N;i++)
  {
    for(int j=0;j<N;j++)A[i][j]=0;
  }
  scanf("%d",&n);
  for(int i=0;i<n;i++)
  {
    scanf("%d%d",&r,&c);//i番目に入力された座標情報
    A[r][c]=1;
  }
  putQueen(0);

  return 0;
}



Measured memory_bytes: 2112
using System;
using System.Linq;

namespace A___Five_Antennas
{
    class Program
    {
        static void Main(string[] args)
        {
            var abcde = new int[5].Select(_ => int.Parse(Console.ReadLine())).ToArray();
            int k = int.Parse(Console.ReadLine());

            Console.WriteLine(abcde.Max() - abcde.Min() <= k ? "Yay!" : ":(");
        }
    }
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/23  Problem: 080_arc_b / Link: https://abc069.contest.atcoder.jp/tasks/arc080_b?lang=en  ----- */
/* ------問題------

縦 H 行、横 W 列のマス目があります。 すぬけ君は、このマス目を色 1, 2, …, N で塗り分けようとしています。 このとき、次の条件が成り立つようにします。
各 i (1≤i≤N) について、色 i のマスはちょうど ai 個存在する。 ただし、a1+a2+…+aN=HW である。
各 i (1≤i≤N) について、色 i のマスは上下左右に連結である。 すなわち、どの色 i のマスからどの色 i のマスへも、上下左右に隣り合う色 i のマスのみを辿って行き来できる。
条件を満たす塗り分け方をひとつ求めてください。 解は必ず存在することが示せます。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL H, W, N;
inline void next(int &y, int &x) {
	if (y % 2 == 0) {
		if (x == W - 1) { y++; }
		else { x++; }
	}
	else { // % 2 ==1
		if (x == 0) { y++; }
		else { x--; }
	}
}

void go(VVI &masu, VI &a) {
	int y = 0, x = 0, id = 0;
	FOR(i, 0, H) {
		FOR(j, 0, W) {
			while (a[id] == 0)id++;
			masu[y][x] = id + 1;
			a[id]--;
			next(y, x);
		}
	}
}


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

	cin >> H >> W >> N;
	VI a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	VVI masu(H, VI(W, 0));

	go(masu, a);

	FOR(i, 0, H) {
		FOR(j, 0, W) {
			cout << masu[i][j] << (j != W - 1 ? ' ' : '\n');
		}
	}

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll N;
    cin>>N;
    if(N%10==3) cout<<"bon"<<endl;
    else if(N%10==0 || N%10==1 || N%10==6 || N%10==8)
        cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
    return 0;
}


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

int h,w;
char s[55][55];
int map[55][55];
int main()
{
	for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) s[i][j]='-1';
	for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) map[i][j]=0;
	cin>>h>>w;
	for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) cin>>s[i][j];
	for(int i=1;i<=h;i++) for(int j=1;j<=w;j++)
	{
		if(s[i][j]=='#')
		{
			if(s[i-1][j-1]=='.') map[i-1][j-1]++;
			if(s[i-1][j]=='.') map[i-1][j]++;
			if(s[i-1][j+1]=='.') map[i-1][j+1]++;
			if(s[i][j-1]=='.') map[i][j-1]++;
			if(s[i][j+1]=='.') map[i][j+1]++;
			if(s[i+1][j-1]=='.') map[i+1][j-1]++;
			if(s[i+1][j]=='.') map[i+1][j]++;
			if(s[i+1][j+1]=='.') map[i+1][j+1]++;
		}
	}
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			if(s[i][j]=='.') cout<<map[i][j];
			if(s[i][j]=='#') cout<<s[i][j];
		}
		cout<<endl;
	} 
	return 0;
 } 

Measured memory_bytes: 256
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        if (n == 1) { Console.WriteLine("1\n1"); goto exit; }
        var count = 0;
        for (int i = 0; i < n - 1; i++)
        {
            if (a[i + 1] > a[i]) continue;
            else count++;
        }
        Console.WriteLine(count + 1);
        Console.WriteLine(n);
    exit:;
    }
}



Measured memory_bytes: 16752
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

int main() {
  int n;
  while(cin >> n && n) {
    vector<PP> teams;
    rep(i, n) {
      int i, u, a, p;
      cin >> i >> u >> a >> p;
      teams.push_back(PP(P(-a, p), P(i, u)));
    }
    sort(ALL(teams));

    vector<int> ans;
    map<int, int> count;
    rep(i, n) {
      int c = ans.size();
      PP &e = teams[i];
      int id = e.second.first, u = e.second.second,
          a = -e.first.first, p = e.first.second;
      count[u] += 1;
      if(c < 10) {
        if(count[u]<=3) {
          ans.push_back(id);
        }
      }else if(c < 20) {
        if(count[u]<=2) {
          ans.push_back(id);
        }
      }else if(c < 26) {
        if(count[u]<=1) {
          ans.push_back(id);
        }
      }
    }
    rep(i, ans.size()) {
      cout << ans[i] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1228
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
  if(dist[N-1]==2)cout <<"POSSIBLE"<<endl;
  else  cout <<"IMPOSSIBLE"<<endl;
}



Measured memory_bytes: 22260
N = int(input())
flag = True
while flag:
  if N==2 or N==3:
    print(N)
    flag=False
    break
  n = N**0.5
  for i in range(2,int(n//1)):
    if N%i==0:
      break
    if i==n//1-1:
      flag=False
      print(N)
      break
  N+=1

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

int main() {

int N, R, Rn;
cin >> N >> R;

if ( N >= 10 ) Rn = R;
else if ( N < 10 ) Rn = R + (100*(10-N));

    // 出力
    cout << Rn << endl;
}

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

// to:どこの頂点に向かっているのか
// id:色の番号
struct Edge {
  int to, id;
};

int main() {

  int N;
  cin >> N;

  vector<vector<Edge>> graph(N);
  vector<int> answer(N - 1);

  for(int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    // 配列では0から数えるため-1する
    --a;
    --b;
    graph[a].push_back(Edge{b,i});
    graph[b].push_back(Edge{a,i});

  }

  // 探索用
  queue<int> q;

  // 頂点に色がついたか否か
  vector<int> used(N);

  // 初期設定
  q.push(0);
  used[0] = 1;

  // 探索
  while (!q.empty()) {

    int v = q.front();
    q.pop();
    
    // 色
    int c = -1;

    // qと繋がっている親を探して、親に繋がっている色を取得する
    for (int i = 0; i < graph[v].size(); i++) {

      int u = graph[v][i].to;
      int ei = graph[v][i].id;
      
      // used[u]に値が入っている頂点は唯一色が決まっている親となる
      if (used[u]) {
        c = answer[ei];
      }

    }

    // 色を1から考える
    int k = 1;

    // 色が決まっていない辺について色を決めていく
    for (int i = 0; i < graph[v].size(); i++) {
      
      int u = graph[v][i].to;
      int ei = graph[v][i].id;

      // すでに繋がっている場合は次の辺を見る
      if (used[u]) {
        continue;
      }

      // 親へ繋がっている線の色と同じ場合は色を変える
      if (k == c) {
        ++k;
      }
      
      // 色決定
      answer[ei] = k;
      
      // 色を変える
      ++k;

      // 次の頂点を調べる
      q.push(u);

      // 調査終わり
      used[u] = 1;

    }
  }

  // 色数＝最大次数を探して、出力
  int mx = 0;
  for (int i = 0; i < N; i++) {
    mx = max(mx, int(graph[i].size()));
  }
  cout << mx << endl;
  
  // 塗り分け例を出力
  for (int i = 0; i < N - 1; i++) {
    cout << answer[i] << endl;
  }

  return 0;

}

Measured memory_bytes: 7296
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007

int A,B,C,X,Y;
signed main(){
    
    scanf("%lld %lld %lld %lld %lld",&A,&B,&C,&X,&Y);
    int ans=0;
    if(2*C<A+B){
        ans=min(X,Y)*2*C;
        if(X-min(X,Y)>0){//Aがもう少し必要
            if(A<2*C)ans+=A*(X-min(X,Y));//一枚ずつ買う
            else ans+=2*C*(X-min(X,Y));
        }
        if(Y-min(X,Y)>0){
            if(B<2*C)ans+=B*(Y-min(X,Y));//一枚ずつ買う
            else ans+=2*C*(Y-min(X,Y));
        }
    }else{
        ans=X*A+Y*B;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

ll gcb(ll a, ll b){/// ユークリッドの互除法: O(log)
    
    if(b == 0) return a;
    
    return gcb(b,a%b);
}


ll lcm(ll a, ll b){
    
    return  a/gcb(a,b) * b; ///gcbは約数
}

int getDigit(ll num){
    return log10(abs(num))+1;
}


int main() {
    int n;cin>>n;
    int minv = INF;
    for(auto a = 1; a<n;a++){
        int b = n-a;
        
        string as = to_string(a);
        string bs = to_string(b);
        
        int temp = 0;
        for(auto i:as)temp+=i-'0';
        for(auto i:bs)temp+=i-'0';
        
        minv = min(minv,temp);
    }
    
    cout<<minv<<endl;

    return 0;
}










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

int main() {
  int n, l;
  cin >> n >> l;
  vector<int> t(n);
  rep(i, n) { cin >> t[i]; }
  double ansx = 0;
  double ansy = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ansx += -cos(2.0 * PI * (t[i] + t[j]) / 2.0 / l) * (j - i - 1);
      ansy += -sin(2.0 * PI * (t[i] + t[j]) / 2.0 / l) * (j - i - 1);
      ansx += cos(2.0 * PI * (t[i] + t[j]) / 2.0 / l) * ((n - 2) - (j - i - 1));
      ansy += sin(2.0 * PI * (t[i] + t[j]) / 2.0 / l) * ((n - 2) - (j - i - 1));
    }
  }

  ansx /= (ll)n * (n - 1) * (n - 2) / 6;
  ansy /= (ll)n * (n - 1) * (n - 2) / 6;
  cout << setprecision(15) << ansx << " " << ansy << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=998244353;
int n,m;
ll fact[500005],inv[500005],pn[500005],pm[500005];
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
int main()
{
	scanf("%d%d",&n,&m);
	fact[0]=1;
	for(int i=1;i<=max(n,m);i++)fact[i]=fact[i-1]*i%MOD;
	inv[max(n,m)]=quick_pow(fact[max(n,m)],MOD-2);
	for(int i=max(n,m);i>=1;i--)inv[i-1]=inv[i]*i%MOD;
	pn[0]=pm[0]=1;
	for(int i=1;i<=max(n,m);i++)
	{
		pn[i]=pn[i-1]*(n+1)%MOD;
		pm[i]=pm[i-1]*(m+1)%MOD;
	}
	ll ans=0;
	for(int i=0;i<=min(n,m);i++)
	{
		if(i&1)ans-=fact[n]*inv[i]%MOD*inv[n-i]%MOD*fact[m]%MOD*inv[m-i]%MOD*pm[n-i]%MOD*pn[m-i]%MOD;
		else ans+=fact[n]*inv[i]%MOD*inv[n-i]%MOD*fact[m]%MOD*inv[m-i]%MOD*pm[n-i]%MOD*pn[m-i]%MOD;
	}
	ans%=MOD;
	if(ans<0)ans+=MOD;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 15744