akhauriyash/Code-Regression huggingface dataset:
def f(n, x):
  if x <= 0:
    return 0
  if x >= 2**(n+2) - 3:
    return 2**(n+1) - 1
  return f(n - 1, x - 1) + f(0, x - 2**(n+1) + 2) + f(n - 1, x - 2**(n+1) + 1)

n, x = map(int, input().split())
print(f(n, x))


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

int c1,c5,c10,c50,c100,c500;
int all = 0;

int main() {
  cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
  all = c1*1+c5*5+c10*10+c50*50+c100*100+c500*500;
  if( 1000 <= all ) {
    cout << 1 << endl;
  }else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 3088
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
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; }

const int num=26;

int main(){
    int D;
    int c[num];
    cin >> D;
    vector<vector<int>> s(D, vector<int>(num));
    rep(i,num) cin >> c[i];
    rep(i,D) rep(j,num) cin >> s[i][j];
    
    vector<int> last(num);

    rep(d,D){
        int best=0, tm=-1E-9;
        rep(i,num){
            if(chmax(tm, s[d][i] + c[i] * (d+1 - last[i]))) best=i;
        }
        last[best]=d;
        cout << best+1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define cst() int __t;scanf("%d",&__t);while(__t--)
#define rep(i,s,t) for(int i=s;i<t;++i)
#define repb(i,s,t) for(int i=s;i<=t;++i)
#define lepb(i,s,t) for(int i=s;i>=t;--i)
#define mst(a,b) memset(a,b,sizeof(a))
#define mcpy(des,sor) memcpy(des,sor,sizeof(sor))
#define pt(x) cout<<#x<<"="<<x<<" "
#define ptl(x) cout<<#x<<"="<<x<<endl
#define sz(x) (int)(x.size())
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lson n<<1,L,M
#define rson n<<1|1,M+1,R
template<class T> void Max(T &a,T b){a<b?a=b:0;}
template<class T> void Min(T &a,T b){a>b?a=b:0;}
typedef long long ll;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const ll mod = 998244353;
#define maxn 300006

int a[maxn];
pii T[2][maxn*4];

void update(int o,int n,int L,int R,pii vp)
{
    if(L==R){T[o][n]=vp;return;}
    int M=(L+R)/2;
    if(vp.se<=M)update(o,lson,vp);
    else update(o,rson,vp);
    T[o][n]=min(T[o][n<<1],T[o][n<<1|1]);
}

pii query(int o,int n,int L,int R,int l,int r)
{
    if(l<=L&&R<=r)return T[o][n];
    int M=(L+R)/2;
    pii ret=mp(inf,inf);
    if(l<=M)ret=min(ret,query(o,lson,l,r));
    if(r>M)ret=min(ret,query(o,rson,l,r));
    return ret;
}

struct itv
{
    itv(){};
    int l,r;
    vector<int> xy;
    bool operator<(const itv&i)const
    {return a[xy[0]]>a[i.xy[0]];} 
};

int main()
{
//	freopen("1.txt","r",stdin);
    int n;
    pii l,r;
    itv t,s;
    vector<int> ans;
    mst(T,inf);
    priority_queue<itv> q;
    cin>>n;
    repb(i,1,n)
    {
        cin>>a[i];
        update(i&1,1,1,n,mp(a[i],i));
    }
    l=query(1,1,1,n,1,n);
    r=query(0,1,1,n,l.se+1,n);
    t.l=1;t.r=n;t.xy.pb(l.se);t.xy.pb(r.se);
    q.push(t);
    while(!q.empty())
    {
        t=q.top();q.pop();
        ans.pb(t.xy[0]);ans.pb(t.xy[1]);
        if(t.l!=t.xy[0])
        {
            s.xy.clear();
            s.l=t.l;
            s.r=t.xy[0]-1;
            l=query(s.l&1,1,1,n,s.l,s.r);
            r=query(!(s.l&1),1,1,n,l.se+1,s.r);
            s.xy.pb(l.se);s.xy.pb(r.se);
            q.push(s);
        }
        if(t.xy[0]+1!=t.xy[1])
        {
            s.xy.clear();
            s.l=t.xy[0]+1;
            s.r=t.xy[1]-1;
            l=query(s.l&1,1,1,n,s.l,s.r);
            r=query(!(s.l&1),1,1,n,l.se+1,s.r);
            s.xy.pb(l.se);s.xy.pb(r.se);
            q.push(s);
        }
        if(t.xy[1]!=t.r)
        {
            s.xy.clear();
            s.l=t.xy[1]+1;
            s.r=t.r;
            l=query(s.l&1,1,1,n,s.l,s.r);
            r=query(!(s.l&1),1,1,n,l.se+1,s.r);
            s.xy.pb(l.se);s.xy.pb(r.se);
            q.push(s);
        }
    }
    rep(i,0,sz(ans))cout<<a[ans[i]]<<" ";
}

Measured memory_bytes: 25072
M,D=map(int,input().split())
cnt=0
for i in range(M):
    for j in range(D):
        a1=(j+1)//10
        a2=(j+1)%10
        if (a1>=2)and(a2>=2)and(a1*a2==(i+1)):
            cnt=cnt+1
print(cnt)

Measured memory_bytes: 38896
#include<iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>

using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	int sum = 0;
	for (char &c : s){
		sum += c - '0';
	}
	if (sum % 9)cout << "No";
	else cout << "Yes";

	//system("pause");
	return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

template <typename T>
inline T gi()
{
	T f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 3003, M = N << 1;

char s[N], t[N];
int dp[N][N];

int main()
{
	//File("");
	scanf("%s", s + 1); scanf("%s", t + 1);
	int n = strlen(s + 1), m = strlen(t + 1);
	for (int i = 1; i <= n; i+=1)
		for (int j = 1; j <= m; j+=1)
		{
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if (s[i] == t[j]) dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
		}
	int now = dp[n][m], x = n, y = m;
	string ans = "";
	while (now > 0)
	{
		if (s[x] == t[y])
		{
			--now;
			ans = s[x] + ans;
			--x, --y;
		}
		else if (dp[x][y] == dp[x][y - 1]) --y;
		else --x;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 38924
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 16:34:41 2020

@author: shinba
"""

a = input()
b = input()

if len(a) > len(b):
    print("GREATER")
elif len(b) > len(a):
    print("LESS")
else:
    for i in range(len(a)):
        if int(a[i]) > int(b[i]):
            print("GREATER")
            break
        elif int(b[i]) > int(a[i]):
            print("LESS")
            break
    else:
        print("EQUAL")
        


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#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++)
using namespace std;

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a; string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}

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

#define pb push_back
#define For(i, j, k) for (int i = j; i <= k; i++)
#define Forr(i, j, k) for (int i = j; i >= k; i--)

using namespace std;

typedef pair<int, int> PII;

const int N = 25;

int L;
vector<PII> G[N];

int main() {

	scanf("%d", &L);
	For(i, (L & (1 << 19) ? 1 : 2), 19) G[i].pb(PII(i + 1, 1 << (19 - i))), G[i].pb(PII(i + 1, 0));

	int cur = 0;
	Forr(i, 19, 0) if (L & (1 << i)) {
		if (i != 19) G[1].pb(PII(20 - i, cur));
		cur |= 1 << i;
	}
	
	int sum = 0;
	For(i, 1, 20) sum += G[i].size();
	printf("20 %d\n", sum);
	For(i, 1, 20) for (PII s : G[i]) printf("%d %d %d\n", i, s.first, s.second);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    
    int A,B,C;
    cin >> A >> B >> C;
    
    if((A == B && A != C) || (A == C && A != B)||(B==C && B!=A) ){
        cout << "Yes" << endl;
    }
     else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
from sys import stdin
from collections import deque
def main():
    #入力
    readline=stdin.readline
    N,Q=map(int,readline().split())
    g=[[] for _ in range(N)]
    for _ in range(N-1):
        a,b=map(lambda x:int(x)-1,readline().split())
        g[a].append(b)
        g[b].append(a)
    count=[0]*N
    for _ in range(Q):
        p,x=map(int,readline().split())
        p-=1
        count[p]+=x
    
    #累積和を根から
    d=deque([[0,0]])
    is_searched=[False]*N
    is_searched[0]=True
    while len(d)>=1:
        now=d.popleft()
        x=now[0]
        s=now[1]
        s+=count[x]
        count[x]=s
        for nex in g[x]:
            if is_searched[nex]==False:
                is_searched[nex]=True
                d.append([nex,s])

    print(*count)

if __name__=="__main__":
    main()

Measured memory_bytes: 64784
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

// const int N = ;
int n;

int main() {
	ios_base::sync_with_stdio(false);
  cin >> n; cout << fixed << setprecision(6) << 1. * ((int)(n + 1) / 2)  / n;
}	

	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	int b=a%10;
	int c=a/10%10;
	int d=a/100%10;
	int e=a/1000%10;
	if(b==c||c==d||d==e)
		cout<<"Bad";
	else
		cout<<"Good";
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {

    

    int n,m;
    cin>>n>>m;
    ll ans=0;
    ll pena=0;
    vi num(n+10,0);
    for(int i=0;i<m;i++){
        int p;
        string s;
        cin>>p>>s;
        if(s=="AC"){
            if(num[p]==-1){
                continue;
            } else {
                ans++;
                pena+=num[p];
                num[p]=-1;
            }
        } else {
            if(num[p]!=-1){
                num[p]++;
            }
        }
    }
    cout<<ans<<" "<<pena<<endl;
}

Measured memory_bytes: 640
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define inf 1000000000

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}



void solve(){
    
    string s;
    cin >> s;

    //string m[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    map<string,int> pos;

    pos["SUN"] = 7;
    pos["SAT"] = 1;
    pos["FRI"] = 2;
    pos["THU"] = 3;
    pos["WED"]= 4;
    pos["TUE"] = 5;
    pos["MON"] = 6;

    cout << pos[s] <<endl; 
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct edge
{
    ll v,w;
}e1;
vector<edge>E[100005];
ll check[100005]={0},n,k;
ll color[100005];
void dfs(ll s,ll len=0)
{
    check[s]=1;
    ll sz=E[s].size();
    for(ll i=0;i<sz;i++)
    {
        ll v=E[s][i].v;
        if(check[v]==0)
        {  ll w=E[s][i].w;
            if((len+w)%2==0)
                color[v]=0;
            else
                {color[v]=1;}

                dfs(v,len+w);
                check[v]=1;
        }
    }


}
int main()
{
   ll i,u,v,w;
   cin>>n;
   for(i=0;i<n-1;i++)
   {
       cin>>u>>v>>w;
       k=u;
       e1.v=v;
       e1.w=w;
       E[u].push_back(e1);
       e1.v=u;
       E[v].push_back(e1);


   }
   color[1]=0;
   dfs(1);
   for(i=1;i<=n;i++)
    cout<<color[i]<<endl;

}


Measured memory_bytes: 14768
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 ll c,d,n,x,y;
 c=0;
 cin >> n >> d;
 d=d*d;
 while(n--)
 {
  cin >> x >> y;
  x=(x*x)+(y*y);
  c+=(x<=d);
 }
 cout << c;
 return 0;
}

Measured memory_bytes: 3632
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}

module Main where

import qualified Data.ByteString.Char8 as B8
import Data.Maybe (fromJust)
import Data.Char (toUpper,isDigit)
import Data.List
import qualified Data.Map as M
import Data.Array.IO
import Data.IORef
import Data.Ix (range)
import Control.Monad
import Control.Applicative
import Text.Printf
import Data.Time.Calendar
import Debug.Trace

readDigits = map read <$> words <$> getLine :: IO [Int]
readDigits' = map read <$> lines <$> getContents :: IO [Int]

--
main :: IO ()
main = do
    r <- readLn :: IO Double
    let a = pi * r * r
    let b = 2 * pi * r
    printf "%.6f %.6f\n" a b

Measured memory_bytes: 4072
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

int n;
int x[10], y[10];

int main(){
    cin >> n;
    REP(i, n)cin >> x[i] >> y[i];
    vector<int> v;
    REP(i, n)v.emplace_back(i);
    double ans = 0.0;
    do{
        REP(i, n){
            if(i){
                ans += sqrt(abs(x[v[i]] - x[v[i - 1]]) * abs(x[v[i]] - x[v[i - 1]]) + abs(y[v[i]] - y[v[i - 1]]) * abs(y[v[i]] - y[v[i - 1]]));
            }
        }
    }while(next_permutation(ALL(v)));
    for(double i = 1;i <= n;i += 1)ans /= i;
    cout << ans << endl;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, N):
        self.rank = [0] * N
        self.parent = [i for i in range(N)]
        self.n = N
        self.size = [1 for i in range(N)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if (x == y):
            return

        if (self.rank[x] < self.rank[y]):
            self.parent[x] = y
            self.size[y] += self.size[x]
        else:
            self.parent[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)

    def get_parents(self):
        count = 0
        for i in range(self.n):
            if self.find(i) == i:
                count += 1

        return count

    def get_size(self, x):
        root = self.find(x)
        return self.size[root]

N,M = map(int,input().split())
XYZ = [list(map(int,input().split())) for _ in range(M)]
U = UnionFind(N)
for i in range(M):
    U.unite(XYZ[i][0]-1,XYZ[i][1]-1)
ans = set()
for i in range(N):
    ans.add(U.find(i))
print(len(ans))

Measured memory_bytes: 41920
import sys
readline = sys.stdin.readline
write = sys.stdout.write

D = [
    (1, 5, 2, 3, 0, 4), # 'U'
    (3, 1, 0, 5, 4, 2), # 'R'
    (4, 0, 2, 3, 5, 1), # 'D'
    (2, 1, 5, 0, 4, 3), # 'L'
]
p_dice = (0, 0, 0, 1, 1, 2, 2, 3)*3

def enumerate_dice(L0):
    L = L0[:]
    for k in p_dice:
        yield L
        L[:] = (L[e] for e in D[k])

L = [1, 2, 3, 4, 5, 6]
LS = []
for l in enumerate_dice(L):
    LS.append(l[:])

def solve():
    T = [list(map(int, readline().split())) for i in range(3)]
    F = [list(map(int, readline().split())) for i in range(3)]

    T0 = [[-1]*3 for i in range(3)]
    F0 = [[-1]*3 for i in range(3)]
    R0 = [[-1]*3 for i in range(3)]
    res = set()
    def dfs(i, s):
        if i == 27:
            res.add(s)
            return
        x = i % 3; y = (i // 3) % 3; z = (i // 9) % 3
        t0 = T0[y][x]
        f0 = F0[z][x]
        r0 = R0[z][y]
        for l in LS:
            if t0 == -1:
                e = T[y][x]
                if e != 0 and e != l[0]:
                    continue
                T0[y][x] = l[0]
            else:
                if l[0] != t0:
                    continue
            if f0 == -1:
                e = F[z][x]
                if e != 0 and e != l[1]:
                    continue
                F0[z][x] = l[1]
            else:
                if l[1] != f0:
                    continue
            if r0 == -1:
                R0[z][y] = l[2]
                s0 = s + l[2]
            else:
                if l[2] != r0:
                    continue
                s0 = s
            dfs(i+1, s0)
        if t0 == -1:
            T0[y][x] = -1
        if f0 == -1:
            F0[z][x] = -1
        if r0 == -1:
            R0[z][y] = -1
    dfs(0, 0)
    if res:
        ans = sorted(res)
        write(" ".join(map(str, ans)))
        write("\n")
    else:
        write("0\n")

N = int(readline())
for i in range(N):
    solve()


Measured memory_bytes: 5636
#include <vector>
#include <bits/stdc++.h>
#include <iomanip>
#include <stdio.h>
using namespace std;

int main(){
    string S;
    int ans = 0;
    cin >> S;
    for(int i = 0;i < S.size();i++){
        if(S[i] == 'o'){
            ans++;
        } 
    }
    if(ans+(15 - S.size()) >= 8){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
    }

    let exec_time = 100 * n + 1800 * m;

    let count = 2_usize.pow(m as u32);
    println!("{}", exec_time * count);
}


Measured memory_bytes: 2176
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=5*1e5+5;

int n,q,D,x,a[N];
ll sum[N],f[N];

int main() {
	scanf("%d%d",&n,&D);
	sum[0]=D;
	fo(i,1,n) {
		scanf("%d",&a[i]);
		sum[i]=min(sum[i-1],abs(sum[i-1]-a[i]));
	}
	f[n+1]=1;
	fd(i,n,1) {
		f[i]=f[i+1];
		if (a[i]<=2*f[i+1]-1) f[i]=f[i+1]+a[i];
	}
	for(scanf("%d",&q);q;q--) {
		scanf("%d",&x);
		if (sum[x-1]>=f[x+1]) puts("YES");
		else puts("NO");
	}
}

Measured memory_bytes: 11648
// https://atcoder.jp/contests/abc162/tasks/abc162_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  string S;
  cin >> N >> S;

  map<char, VL> total;
  total['R'] = VL(N + 1);
  total['G'] = VL(N + 1);
  total['B'] = VL(N + 1);

  rep(i, N) {
    total['R'][i + 1] = total['R'][i] + (S[i] == 'R');
    total['G'][i + 1] = total['G'][i] + (S[i] == 'G');
    total['B'][i + 1] = total['B'][i] + (S[i] == 'B');
  }

  auto get_other = [](char a, char b) {
    string cur = "";
    cur.push_back(a);
    cur.push_back(b);
    sort(all(cur));

    if (cur == "BG") return 'R';
    if (cur == "BR") return 'G';
    if (cur == "GR") return 'B';
  };

  ll res = 0;

  rep(k, N) rep(j, k) {
    if (S[j] == S[k]) continue;

    ll ct = 0;
    ct += total[get_other(S[j], S[k])][j];

    ll i_index = j - (k - j);
    if (0 <= i_index && get_other(S[j], S[k]) == S[i_index]) ct--;

    res += ct;
  }

  cout << res << "\n";
}


Measured memory_bytes: 3724
import java.util.Scanner;

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

        while(true){
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();

            if ("?".equals(op)) break;

            switch (op) {
                case "+":
                    System.out.println(a+b);
                    break;
                case "-":
                    System.out.println(a-b);
                    break;
                case "*":
                    System.out.println(a*b);
                    break;
                case "/":
                    System.out.println(a/b);
                    break;
            }
        }
    }
}


Measured memory_bytes: 26432
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;

int main() {
    double a, b, x,t;
    cin >> a >> b >> x;
    double pi = acos(-1);
    if (x >= a * a * b / 2) t= atan((2 * b - 2 * x / a / a) / a)/pi*180;
    else t = atan(a * b * b / 2/x)/pi*180;
    printf("%.6f\n", t);
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
static const int N_MAX=100010;

using namespace std;

int N,M;
vector<int>G[N_MAX];
int H[N_MAX];



void solve(){
  
  int res=0;
  
  for(int i=1;i<=N;i++){
    bool highest=true;
    for(int j=0;j<G[i].size();j++){
      if(H[i]<=H[G[i][j]]){highest=false; break;}
    }
    if(highest==true) res+=1;
  }
  printf("%d",res);
}

int main(){
  
  cin>>N>>M;
  int h;
  for(int i=1;i<=N;i++){
    cin>>h;
    H[i]=h;
  }
  int u,v;
  for(int i=0;i<M;i++){
    cin>>u>>v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  solve();
  return 0;
}
    

Measured memory_bytes: 9232
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;


int main() {
    
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    int q;
    cin>>q;
    rep(_,q){
        int x;
        cin>>x;
        int t=distance(v.begin(),lower_bound(all(v),x));
        int s=distance(v.begin(),upper_bound(all(v),x));
        cout<<t<<" "<<s<<endl;
    }
}


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

using namespace std;

int main(){

	int n;
	long long int ans = 0;

	cin>> n;

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

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================

bool judge(ll x)
{
	string y = to_string(x);
	bool z = true;
	rep(i, sz(y) - 1)
	{
		if (abs(y[i] - y[i + 1]) > 1)
		{
			z = false; break;
		}
	}
	return z;
}

int a = 0, b = 0, c, d, n, k = 0, ans = 0;
string s, t;

int main()
{
	ll a, b, k, ans = 0, flag = 1,coin=0; cin >> k >> a >> b;
	if (b - a <= 2 || k - a + 1 < 2)
		ans = k + 1;
	else
	{
		flag = (k - a + 1) / 2;
		ans = a + (b - a) * flag + (k - a + 1) % 2;
	}
		
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

	
	int a,b,c,x,i;
	cin>>a>>b>>c;
	
	i=0;
	for(int x=a;x<=b;x++){
		
		if(c%x==0){
			i+=1;
		}
		
	}
cout<<i<<endl;
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define REP(name, stop) for (ll(name) = 0; (name) < (stop); (name)++)
using ll = long long;
using vi = vector<ll>;

int main(void) {
    ll S, W;
    cin >> S >> W;
    string ans;
    if (S > W)
        ans = "safe";
    else
        ans = "unsafe";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vi a;

vi f(){
	vi b(n);
	int t=0;
	for(int i=0;i<n;i++){
		t=max(t-1,0);
		if(a[i]<0) t=min(t,-a[i]);
		if(a[i]==0) t=inf;
		b[i]=t;
	}
	reverse(a.begin(),a.end());
	return b;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	a=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	vi b=f(),c=f();
	int res=0;
	for(int i=0;i<n;i++) if(a[i]>0) res+=min(a[i],max(b[i],c[n-i-1]));
	cout<<res<<endl;
}


Measured memory_bytes: 4164
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<=n;i++)
#define RIP(i,a,b) for(int i=a;i<b;i++)
#define all(V) V.begin(),V.end()
#define sec  setprecision;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops");
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
using ll = long long;
using ld = long double;
using Pa = pair<int, int>;
ll mod = 1000000007;
ll MOD = 998244353;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x) % mod, n / 2) % mod);
	else
		return (x * pow(x, n - 1)) % mod;
}
signed main() {
	int a; cin >> a;
	cout << 10 - (a / 200) << endl;
}

Measured memory_bytes: 3628
from math import sqrt

N = int(input())


def is_prime(x):
    if x == 2:
        return True
    for i in range(2, int(sqrt(x)) + 1):
        if x % i == 0:
            return False
    return True


ans = []
n = 2
while len(ans) < N:
    if is_prime(n):
        ans.append(n)
    n += 5

print(' '.join(list(map(str, ans))))


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T>
struct twodimBIT{
    private:
        vector<vector<T>> array;
        const int n;
        const int m;
    public:
        twodimBIT(int _n, int _m) : array(_n+1, vector<T>(_m+1, 0)), n(_n), m(_m) {}
        T sum(int x, int y){
            T s = 0;
            for(int i = x; i > 0; i-=i&(-i)){
                for(int j = y; j > 0; j-=j&(-j)){
                    s += array[i][j];
                }
            }
            return s;
        }
        T sum(int x1, int y1, int x2, int y2){
            return sum(x2, y2) - sum(x1-1, y2) - sum(x2, y1-1) + sum(x1-1, y1-1);
        }
        void add(int x, int y, T k){
            for(int i = x; i <= n; i+=i&(-i)){
                for(int j = y; j <= m; j+=j&(-j)){
                    array[i][j] += k;
                }
            }
        }
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, q;
	cin >> n >> m >> q;
	twodimBIT<int> train(n+1, n+1);
	rep(i,m){
		int l, r;
		cin >> l >> r;
		train.add(l, r, 1);
	}
	rep(i,q){
		int p, q;
		cin >> p >> q;
		cout << train.sum(p, p, q, q) << endl;
	}
	return 0;
}

Measured memory_bytes: 4244
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val ab = sc.nextInt()
    val bc = sc.nextInt()
    val cd = sc.nextInt()
    println(problem116a(ab, bc, cd))
}

fun problem116a(ab: Int, bc: Int, cd: Int): Int {
    return ab * bc / 2
}

Measured memory_bytes: 31516
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pri = lambda x: print(*x, sep='\n')

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

def check(ny, nx):
    if 0<=ny<H and 0<=nx<W and S[ny][nx]=='#':
        return True
    else:
        return False

ddy = [-1, 0, 1, 0]
ddx = [0, -1, 0, 1]

def dfs(y, x, S):
    deq = deque()
    deq.append([(y, x)]) # insert indices
    S[y][x] = '.'
    found = False
    while deq[0]:
        nqueue = []
        cqueue = deq.pop()
        for val in cqueue:
            y, x = val
            for dy, dx in zip(ddy, ddx):
                ny, nx = y+dy, x+dx
                if check(ny, nx):
                    found = True
                    S[ny][nx] = '.'
                    nqueue.append((ny, nx))
        if found == False:
            print('No')
            exit()
        deq.append(nqueue)

for y in range(H):
    for x in range(W):
        if S[y][x] == '#':
            dfs(y, x, S)
else:
    print('Yes')



Measured memory_bytes: 42604
int main(){
    int a,b,i,max=0,ans;
    int c[200000],d[200000];
    scanf("%d%d\n",&a,&b);
    for(i=0;i<b;i++)
        scanf("%d",&c[i]);
    for(i=0;i<b-1;i++){
        d[i]=c[i+1]-c[i];
        if(max<d[i])max=d[i];
    }
    if(max<c[0]+a-c[b-1])
        max=c[0]+a-c[b-1];
    ans=a-max;
    printf("%d",ans);
    
    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
#define MAX 100000000
#define INF 1000000
#define M 1000000007
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main(){
  fast_io
   string s,s1;
   cin>>s;
   cin>>s1;
   ll ans = 0;
   for(ll i = 0;i<s.length();i++){
     if(s[i] != s1[i]){
       ans++;
     }
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 3792
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <limits>
#include <stack>
#define ll long long
using namespace std;
int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    int j=1,ans=0;
    while(1){
        if(j==1){
            if(c>0){
                c = c-1;
                ans++;
            }else{
                cout << ans+b << endl;
                return 0;
            }
            j=0;
        }else{
            if(b>0){
                b = b-1;
                ans++;
            }else{
                if(a>0){
                    a = a-1;
                }else{
                    cout << ans << endl;
                    return 0;
                }
            }
            j=1;
        }
    }
}

Measured memory_bytes: 384
def cumsum(n,A):
    s = [0]*(n+1)
    s[0] = A[0]
    for i in range(len(A)):
        s[i+1] = (s[i] + A[i])/2
    return s

n = int(input())
v = sorted(list(map(int,input().split())))

for i in range(n-1):
    s = cumsum(n,v)
print(s[-1])

Measured memory_bytes: 9084
#!/usr/bin/env python3
import sys


def solve(N: "List[int]", K: int):
    print(dfs(N, False, 0, K, 0))


def dfs(N: "List[int]", f: bool, num: int, K: int, idx: int):
    if num == K:
        return 1
    if K - num > len(N) - idx:
        return 0
    else:
        if f:
            return dfs(N, True, num, K, idx + 1) + dfs(N, True, num + 1, K, idx + 1) * 9
        else:
            s = 0
            for i in range(N[idx] + 1):
                if i == N[idx]:
                    if i == 0:
                        s += dfs(N, False, num, K, idx + 1)
                    else:
                        s += dfs(N, False, num + 1, K, idx + 1)
                else:
                    if i == 0:
                        s += dfs(N, True, num, K, idx + 1)
                    else:
                        s += dfs(N, True, num + 1, K, idx + 1)
            return s


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = list(map(int, next(tokens)))  # type: List[int]
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
use std::io;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n: usize = read();
    let mut taro = 0;
    let mut hanako = 0;
    for _i in 0..n {
        let s: String = read();
        let mut spl = s.split_whitespace();
        let s1 = spl.next().unwrap();
        let s2 = spl.next().unwrap();
        if s1 > s2 {
            taro += 3;
        } else if s1 < s2 {
            hanako += 3;
        } else {
            taro += 1;
            hanako += 1;
        }
    }
    println!("{} {}", taro, hanako);
}



Measured memory_bytes: 5032
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := nextInt()
	var list = make([]int, n)
	for i := 0; i < n; i++ {
		list[i] = nextInt()
	}

	for i := n - 1; i >= 0; i-- {
		fmt.Fprintf(out, "%d", list[i])
		if i != 0 {
			fmt.Fprintf(out, " ")
		}
	}
	fmt.Fprintf(out, "\n")
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}



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

int main()
{
  int n, a;
  cin >> n >> a;
  int waru = n % 500;
  // cout << waru;

  if(waru<=a)
    cout << "Yes";
  else
  {
    cout << "No";
  }

}


Measured memory_bytes: 3644
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    v = f()

    a = [ v[i] for i in range(n) if i%2 == 0]
    b = [ v[i] for i in range(n) if i%2 == 1]

    cnt_a = {}
    cnt_b = {}
    for i in a:
        if i in cnt_a:
            cnt_a[i] += 1
        else:
            cnt_a[i] = 1
    
    for i in b:
        if i in cnt_b:
            cnt_b[i] += 1
        else:
            cnt_b[i] = 1

    ncnt_a = sorted(cnt_a.items(), key = lambda x:-x[1])
    ncnt_b = sorted(cnt_b.items(), key = lambda x:-x[1])

    

    if ncnt_a[0][0]!=ncnt_b[0][0]:
        print(n -ncnt_a[0][1]- ncnt_b[0][1])
    else:
        ans1 = n - ncnt_b[0][1] - (ncnt_a[1][1] if len(ncnt_a)>1 else 0)
        ans2 = n -ncnt_a[0][1]- (ncnt_b[1][1] if len(ncnt_b)>1 else 0)
        print(min(ans1, ans2))



solve()


Measured memory_bytes: 21568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args) {
            var ngo = Console.ReadLine().Split().Select(select => int.Parse(select)).ToArray();
            if (ngo[0] + ngo[1] >= ngo[2]) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13268
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size() / 2; ++i) {
        if (s[i] != s[s.size() - 1 - i]) cnt++;
    }
    cout << cnt;
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,e){function t(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,l=r[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){var e=t(r[0].split(" ").map(function(r){return Number(r)}),2),n=e[0],o=e[1];hk=o/2;var u=Math.floor(n/o),i=Math.floor(n/o);n%o>o-1&&(u+=1),n%o>=hk&&(i+=1);var l=u*u*u;o%2==0&&(l+=i*i*i),console.log(l)}},function(r,e){r.exports=require("fs")}]);

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
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
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

void enu(int n,vector<int> &div){
    for(int i = 1;i*i<=n;i++){
        if(n%i==0){
            div.pb(i);
            if(n/i!=i) div.pb(n/i);
        }
    }
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    Sort(a);

    if(n==1){
        cout << 1 << endl;
        return 0;
    }

    // a[i]より前のaを入れておく
    set<int> st;
    // a[i]の約数を入れる
    vector<int> div;
    int ans = 0;
    rep(i,n){
        // 同じ数字があるときの処理
        if(i!=n-1 && a[i]==a[i+1]){
            st.insert(a[i]);
            continue;
        }

        div.clear();
        // 約数列挙
        enu(a[i],div);
        bool f = true;
        for(auto v : div){
            // a[i]の約数がa[i]より前にあるか
            if(st.count(v)==1) f=false;
        }
        if(f) ans++;
        st.insert(a[i]);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    int ret;
    ret = c - a + b;
    if (ret < 0)
    {
        ret = 0;
    }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Data.List

main=do
    _<-getLine
    (a:as)<-map read.words<$>getLine::IO[Int]
    print $ if a /= 0
        then
            min (sum.snd $ mapAccumL f a as)
              ((+) (1 + (abs a)) $ sum $ snd $ mapAccumL f (a`div`(abs a)*(-1)) as)
        else
            min ((+) 1 $ sum $ snd $ mapAccumL f 1 as) ((+) 1 $ sum $ snd $ mapAccumL f (-1) as)


f a b
    | signum a * signum (a+b) < 0 = (a+b,0)
    | a < 0 = (1, 1-(a+b))
    | otherwise = ((-1), 1+(a+b))


Measured memory_bytes: 54652