akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
	int a[3], b[3];
	for(int i=0;i<3;++i) cin>>a[i]>>b[i];
	int p[4] = {0};
	for(int i=0;i<3;++i) p[a[i]-1]++, p[b[i]-1]++;
	bool ok = true;
	for(int i=0;i<4;++i) if(p[i]>=3) ok=false;
	cout<<(ok?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun modfactorial (n)
  (labels ((rec (n res)
             (if (zerop n)
                 res
                 (rec (- n 1) (mod (* res n) +mod+)))))
    (rec n 1)))

(defun main ()
  (let* ((n (read))
         (m (read)))
    (cond ((= (abs (- n m)) 1)
           (println (mod (* (modfactorial n) (modfactorial m)) +mod+)))
          ((= n m)
           (println (mod (* 2 (expt (modfactorial n) 2)) +mod+)))
          (t (println 0)))))

#-swank(main)


Measured memory_bytes: 18276
N = int(input())

A = []
xy = []
for i in range(N):
    A.append(int(input()))
    xy_tmp = []
    for j in range(A[i]):
        xy_tmp.append(list(map(int, input().split())))
    xy.append(xy_tmp)

ans = 0
for state in range(2 ** N):
    # print("#", '{:b}'.format(state))
    ans_tmp = 0
    state_tmp = state
    honest = [None] * N
    valid = True
    state_bin = [(state >> i) % 2 for i in range(N)]
    for i in range(N):
        if state_bin[i] > 0:
            xy_tmp = xy[i]
            for xj, yj in xy_tmp:
                if honest[xj - 1] == None:
                    honest[xj - 1] = yj
                elif honest[xj - 1] != yj:
                    valid = False
                    break
            ans_tmp += 1
        if valid == False: break
    if valid == False: continue
    #
    for i in range(N):
        if state_bin[i] == 1 and honest[i] == 0:
            valid = False
            break
        if state_bin[i] == 0 and honest[i] == 1:
            valid = False
            break
    #
    if valid:
        # print("##", honest)
        ans = max(ans, ans_tmp)

print(ans)

Measured memory_bytes: 47596
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	char ch=getchar();int f=0;
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){f=(f<<1)+(f<<3)+ch-'0';ch=getchar();}
	return f;
}
long long a[100005],b[100005],c[100005],fb[100005],fc[100005];long long ans;
int main()
{
	int n=read();
	for(int i=1;i<=n;i++)
	a[i]=read();
	for(int i=1;i<=n;i++) b[i]=read();
	for(int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	int ll=0;
	for(int i=1;i<=n;i++)
	{
		while(a[ll+1]<b[i]&&ll+1<=n) ll++;
		fb[i]=ll;
	}
	for(int i=1;i<=n;i++)
	fb[i]+=fb[i-1];
	ll=0;
	for(int i=1;i<=n;i++)
	{
		while(b[ll+1]<c[i]&&ll+1<=n) ll++;
		ans+=fb[ll];
	}
	cout<<ans;
}


Measured memory_bytes: 3328
#include<cstdio>
#include<vector>
const int N=600007;
int n,tot=1,head[N],ver[N],next[N],v1[N],v2[N],val[N];
int read(){int x;scanf("%d",&x);return x;}
void add(int u,int v){ver[++tot]=v,next[tot]=head[u],head[u]=tot,ver[++tot]=u,next[tot]=head[v],head[v]=tot;}
void work(int u,int v){if(u==v+n)val[v]=1;if(v==u+n)val[u]=-1;}
void dfs(int u){for(int&i=head[u],v;i;i=next[i])if(!v1[i])v1[i]=v1[i^1]=1,work(u,v=ver[i]),dfs(v);}
int main()
{
    n=read();
    for(int i=1,x;i<=n;++i) ~(x=read())? v1[x]^=1,v2[x]^=1,add(x,i):add(0,i);
    for(int i=1,x;i<=n;++i) ~(x=read())? v1[x]^=1,add(x+n,i+n):add(0,i+n);
    for(int i=1;i<=n;++i){if(v1[i])return puts("IMPOSSIBLE"),0;if(!v2[i])add(i,i+n);}
    puts("POSSIBLE"),dfs(1);
    for(int i=1;i<=n;++i) printf("%d%c",val[i]," \n"[i==n]);
}


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

using namespace std;

int main()
{
  int N, V[50][6];
  cin >> N;
  vector< int > press;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 3; j++) {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      V[i][j * 2] = a * 60 + b;
      V[i][j * 2 + 1] = c * 60 + d;
      press.emplace_back(V[i][j * 2]);
    }
  }
  sort(begin(press), end(press));
  press.erase(unique(begin(press), end(press)), end(press));

  int ret = 0;
  for(int i = 0; i < press.size(); i++) {
    for(int j = 0; j < i; j++) {
      for(int k = 0; k < j; k++) {
        int beet = 0;
        for(int l = 0; l < N; l++) {
          beet += V[l][0] <= press[k] && press[k] <= V[l][1] && V[l][2] <= press[j] && press[j] <= V[l][3] && V[l][4] <= press[i] && press[i] <= V[l][5];
        }
        ret = max(ret, beet);
      }
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 3140
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll a,b,m,ans; cin>>a>>b>>m;
    vector<ll> A(a,0),B(b,0);
    ll am=INF,bm=INF;
    rep(i,a){
        cin>>A[i];
        am=min(am,A[i]);
    }
    rep(i,b){
        cin>>B[i];
        bm=min(bm,B[i]);
    }
    ans=am+bm;
    rep(i,m){
        ll x,y,c; cin>>x>>y>>c;
        ans=min(ans,A[x-1]+B[y-1]-c);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4844
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;

vector<int> f[MAX];
int vis[MAX];
int comp[MAX];

int dfs(int s, int id)
{
    vis[s] = id;
    int sz = 1;
    for (auto nxt : f[s]) {
        if (vis[nxt]) continue;
        sz += dfs(nxt, id);
    }
    return sz;
}


int main()
{
    ios::sync_with_stdio(0);
    int n, m, k;
    cin >> n >> m >> k;
    int a, b;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        f[a].push_back(b);
        f[b].push_back(a);
    }
    int id = 1;
    for (int i = 1; i <= n; i++) {
        if (vis[i]) continue;
        int s = dfs(i, id);
        comp[id] = s;
        id++;
    }
    int rad[n + 1];
    memset(rad, 0, sizeof rad);
    for (int i = 0; i < k; i++) {
        cin >> a >> b;
        if (vis[a] == vis[b]) {
            rad[a]++;
            rad[b]++;
        }
    }
    for (int i = 1; i <= n; i++) {
        if (i > 1) cout << " ";
        int ans = comp[vis[i]] - rad[i] - f[i].size() - 1;
        cout << ans;
    }
    cout << "\n";
}


Measured memory_bytes: 7552
// ddcc_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int func(int x){
    if (x == 3){
        return 100000;
    } else if (x == 2){
        return 200000;
    } else if (x == 1){
        return 300000;
    } else {
        return 0;
    }

}
int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int X, Y;
    cin >> X >> Y;

    int ans = 0;
    ans += func(X);
    ans += func(Y);
    if (X == 1 && Y == 1) ans += 400000;

    print(ans);


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test(n) cout << "test" << n << endl;
#define fixsp(n) fixed << setprecision(n)
#define defsp(n) defaultfloat << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define vector3D(K, N, M, DP) vector<vector<vector<ll>>> DP(K, vector<vector<ll>>(N, vector<ll>(M)));
#define vector4D(K, N, M, O, DP) vector<vector<vector<vector<ll>>>> DP(K, vector<vector<vector<ll>>>(N, vector<vector<ll>>(M, vector<ll>(O))));
#define zenbu(a) a.begin(), a.end()
#define rzenbu(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}
template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};
template<typename T> ll comb(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}

/* ここからコード開始 */

int main(){
  kyopro;
  ll N, K;
  cin >> N >> K;
  ll aka = N-K;
  iikae ao = K;
  rep(i, 1, K+1){
    cout << comb(aka + 1, i) * comb(K - 1, i - 1) % MOD << rt;
  }
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (n != 26) {
    int cnt[26] = {};
    REP(i, n) cnt[s[i] - 'a']++;
    cout << s;
    REP(i, 26) {
      if (!cnt[i]) {
        cout << (char)(i + 'a') << endl;
        return 0;
      }
    }
  }
  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    puts("-1");
    return 0;
  }
  string t = s;
  next_permutation(ALL(t));
  REP(i, n) {
    cout << t[i];
    if (s[i] != t[i]) {
      cout << "\n";
      return 0;
    }
  }
  return 0;
}

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

int main() {
  int A,B;
  cin >> A >> B;
  vector<string>card(14);
  card.at(A)="Alice";
  card.at(B)="Bob";
  if(A==B){
    cout << "Draw" << endl;
  }else if((A-1)*(B-1)==0){
    cout << card.at(1) << endl;
  }else{
    cout << card.at(max(A,B)) << endl;
  }
}

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

int main() {
    int n, m;
    cin >> n >> m;
    pair<int, int> keys[m];
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        int cs = 0;
        for (int j = 0; j < b; j++) {
            int c;
            cin >> c;
            cs |= 1 << (c - 1);
        }
        keys[i] = pair<int, int>(a, cs);
    }

    int pow_n = 1 << n;
    int table[m + 1][pow_n];
    for (int i = 0; i <= m; i++) {
        fill(table[i], table[i] + pow_n, INF);
    }
    table[0][0] = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < pow_n; j++) {
            table[i + 1][j] = min(table[i + 1][j], table[i][j]);
            int index = j | keys[i].second;
            table[i + 1][index] = min(table[i + 1][index], table[i][j] + keys[i].first);
        }
    }
    cout << ((table[m][pow_n - 1] < INF) ? table[m][pow_n - 1] : -1) << endl;
    return 0;
}


Measured memory_bytes: 16256
n = int(input())
a = list(map(int, input().split()))

a.sort()

# 累積和は0を含んだ0-basedの半開区間でかく(1-indexed)
acum = [0] * (n+1)
for i in range(n):
    acum[i+1] += acum[i] + a[i]

ans = 1  # i = n-1 の時は必ず全て取り込めるので省いておく

for i in reversed(range(n-1)):
    if a[i+1] <= 2 * acum[i+1]:
        ans += 1
    else:
        break

print(ans)


Measured memory_bytes: 14508
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,p[maxn],pos[maxn];
int c[maxn];
inline int lowbit(int x){return x&(-x);}
inline void add(int x){	
	for(;x<=n;x+=lowbit(x))c[x]++;
}
inline int sum(int x){
	int ans=0;
	for(;x;x-=lowbit(x))ans+=c[x];
	return ans;
}
set<int> alfa,beta;
int main(){
	//freopen("5.in","r",stdin);
//	freopen("5.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++){p[i]=read();pos[p[i]]=i;}
	long long ans=0;
	int l1=0,l2=0,r1=n+1,r2=n+1;
	beta.insert(0),alfa.insert(n+1);
	for(int i=n;i>=1;i--){
		int l1=*beta.lower_bound(-pos[i]),l2=-1;
		int r1=*alfa.lower_bound(pos[i]),r2=-1;
		l1=-l1;
		if(l1!=0){
		l2=*beta.upper_bound(-l1);l2=-l2;}
		if(r1!=n+1)
		r2=*alfa.upper_bound(r1);
		
		//printf("%d %d %d %d %d %d\n",l1,r1,l2,r2,pos[i],i);
		alfa.insert(pos[i]);
		beta.insert(-pos[i]);
		if(l1==0&&r1==n+1)continue;
		if(l2==-1&&r1==n+1){
			ans+=1ll*i*(pos[i]-l1)*(r1-pos[i]);
			continue;
		}
		if(l1==0&&r2==-1){
			ans+=1ll*i*(pos[i]-l1)*(r1-pos[i]);
			continue;
		}
		if(r2==-1&&l2==-1){
			ans+=1ll*i*(pos[i]-l1)*(n+1-r1);
			ans+=1ll*i*(l1)*(r1-pos[i]);
			continue;
		}
		if(l2==-1){
			ans+=1ll*i*(pos[i]-l1)*(r2-r1);
			ans+=1ll*i*(r1-pos[i])*l1;
			continue;
		}
		if(r2==-1){
			ans+=1ll*i*(pos[i]-l1)*(n+1-r1);
			ans+=1ll*i*(r1-pos[i])*(l1-l2);
			continue;
		}
		ans+=1ll*i*(pos[i]-l1)*(r2-r1);
		ans+=1ll*i*(r1-pos[i])*(l1-l2);
		//printf("%lld\n",ans);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 10368
main :: IO ()
main = do
    n <- readLn :: IO Int
    a <- map read . words <$> getLine :: IO [Int]
    let r = fst $ foldl f (0,1) a
    print $ if r == n then -1 else r
  where
    f (c,i) a = if i == a
                   then (c,i+1)
                   else (c+1,i)

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < s.size(); i++) {
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from itertools import product
INF = 10**9
MOD = 10**9 + 7

def main():
    n = int(input())
    a = list(map(int,input().split()))

    ans , right = 0 , 0 
    cnt_1 = [0] * 20
    power = [pow(2,i) for i in range(20)]
    keta = [[0]*20 for _ in range(n)]

    for left in range(n):
        flag = False
        while right < n:
            for i in range(20):
                if (a[right]>>i)&1:
                    cnt_1[i] += 1
                    keta[right][i] = 1
                    a[right] ^= power[i]
                if cnt_1[i] == 2:
                    flag = True
            
            if flag:
                break
            else:
                right += 1

        for i in range(20):
            if keta[left][i]:
                cnt_1[i] -= 1
        ans += right - left
        if right - left == 1:
            right += 1
    
    print(ans)
if __name__=='__main__':
    main()


Measured memory_bytes: 59568
#include <iostream>
#include<vector>
#define MAX 100000
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int N,M;
    int w[1500],h[1500];
    //int x[MAX]={0};
    while((cin>>N>>M)&&N)
    {
        int tt=0;
        //w.resize(M);
       // h.resize(N);
        for(int i=0;i<N;i++)
        {
            cin>>h[i];
        }

        for(int j=0;j<M;j++)
        {
            cin>>w[j];
        }
        map< int, int > x, y;
        for(int i=0;i<N;i++)
        {
            int p=0;
            for(int j=i;j<N;j++)
            {
                p+=h[j];
                x[p]++;
            }
        }
        for(int i=0;i<M;i++)
        {
            int p=0;
            for(int j=i;j<M;j++)
            {
                p+=w[j];
                y[p]++;
                //tt+=x[p];
            }
        }
        for(map< int , int >::iterator it = x.begin(); it != x.end(); it++){
            tt += it -> second * y[it -> first];
        }
        cout<<tt<<endl;
    }
    return 0;
}



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


def compute(a, b, c, k):
    res = 0
    num_a = min(k, a)
    res += num_a
    k -= num_a
    num_b = min(k, b)
    k -= num_b
    num_c = min(k, c)
    res -= num_c
    return res


def main():
    a, b, c, k = (int(z) for z in input().split())
    res = compute(a, b, c, k)
    print(res)


if __name__ == '__main__':
    main()

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

int main()
{
	int a;
	cin >> a;
	if (a / 10 == 9) {
		cout << "Yes" << endl;
	}
	else if (a %10 == 9) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
    return 0;
}

Measured memory_bytes: 256
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            for (var i = 0; i <= N / 4; i++)
            {
                for (var j = 0; j <= N / 7; j++)
                {
                    int sum = 4 * i + 7 * j;
                    if (sum == N)
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
	char s[100000];
	
	scanf("%s",s);
	
	int i;
	i = 0;
	while (s[i] != '\0'){
		if (i % 2 == 0){
			printf("%c",s[i]);
		}
		i++;
	}
	
	printf("\n");
	
	return (0);
}

Measured memory_bytes: 256
n, m = list(map(int, input().split(" ")))

c = [set([]) for i in range(n)]

d = [n for i in range(n)]
d[0] = 0
dist = [set([]) for i in range(n+1)]
dist[0].add(1)
ans = [n for i in range(n)]
ans[0] = 0

for i in range(m):
    a,b = list(map(int, input().split(" ")))
    c[a-1].add(b)
    c[b-1].add(a)
    if a==1:
        d[b-1] = 1
        dist[1].add(b)
        ans[b-1] = 1
    if b==1:
        d[a-1] = 1
        dist[1].add(a)
        ans[a-1] = 1

for i in range(1, n):
    for one in dist[i]:
        #print("dist", i, one)
        #print(c[one-1])
        for one2 in c[one-1]:
            #print(i, d[one2-1])
            if i<d[one2-1]:
                dist[i+1].add(one2)
                d[one2-1] = i+1
                ans[one2-1] = one

if n in d:
    print("No")
else:
    print("Yes")
    for i, one in enumerate(ans):
        if i!=0:
            print(one)

Measured memory_bytes: 93244
import java.io.*;
import java.math.*;
import java.util.*;

public class Main{
	public static void main(String[] args) throws IOException{
		Scanner r = new Scanner(System.in);
		int N;
		int total;
		int zero;
		int flag;
		while(r.hasNext()){
			N = r.nextInt();
			if(N == 0)break;
			int[] gatya = new int[N];
			total = 0;
			zero = 0;
			flag = 0;
			for(int i=0;i<N;i++){
				gatya[i] = r.nextInt();
				if(gatya[i] == 0) zero++;
				if(gatya[i] >= 2) flag=1;
			}
			if(flag == 0) System.out.println("NA");
			else System.out.println(N-zero+1);
		}
	}
}

Measured memory_bytes: 158640
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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

	cout << n / 3 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#define PI acos(-1)
#define fs first
#define sc second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug freopen("1.in","r",stdin),freopen("1.out","w",stdout);

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;

int f[maxn],arr[maxn],ans[maxn],n,m,k;
int find(int x) {
    return x == f[x] ? x : f[x] = find(f[x]);
}
void merge(int x,int y) {
    int xx = find(x);
    int yy = find(y);
    if(xx != yy) {
        f[xx] = yy;
        arr[yy] += arr[xx];
    }
}
int main() {
    ios;
   
    cin >> n >> m >> k;
    for(int i = 1;i <= n; ++i) f[i] = i,arr[i] = 1;
    int x,y;
    while(m --) {
        cin >> x >> y;
        ans[x] ++;
        ans[y] ++;
        merge(x,y);
    }
    while(k --) {
        cin >> x >> y;
        if(find(x) == find(y)) {
            ans[x] ++;
            ans[y] ++;
        }
    }
    for(int i = 1;i <= n; ++i) {
        cout << arr[find(i)] - ans[i] - 1 <<' ';
    }
    return 0;
}

Measured memory_bytes: 9984
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class Main {

  static class Solver {
    final FastScanner sc;
    final PrintWriter writer;

    Solver(final FastScanner sc, final PrintWriter writer) {
      this.sc = sc;
      this.writer = writer;
    }

    void run() {
      int x = sc.nextInt();
      writer.println(x == 0 ? "1" : "0");
    }
  }

  public static void main(final String[] args) {
    final FastScanner sc = new FastScanner();
    try (final PrintWriter w = new PrintWriter(System.out)) {
      new Solver(sc, w).run();
      w.flush();
    }
  }

  // FastScanner
  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    public FastScanner() {
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (final IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte())
        return buffer[ptr++];
      else
        return -1;
    }

    private boolean isPrintableChar(final int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr]))
        ptr++;
      return hasNextByte();
    }

    public String next() {
      if (!hasNext())
        throw new NoSuchElementException();
      final StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext())
        throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      final long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
        throw new NumberFormatException();
      return (int) nl;
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(final int n) {
      final int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(final int n) {
      final long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }
}


Measured memory_bytes: 32632
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int i, j;

	int N;
	int K;
	int Q;
	int si, si1;
	int pt[1000000];
	// int *pt;
	// char *pt;

	scanf("%d %d %d", &N, &K, &Q);

	// pt = (int *)calloc(N, sizeof(int));
	// pt = (char *)calloc(N, sizeof(char));

	for (i = 0; i < N; i++) {
		pt[i] = K;
	}

	for (i = 0; i < Q; i++) {
		scanf("%d", &si);
		si1 = si - 1;
		// sc[i] = si;
		pt[si1]++;
		// for (j = 0; j < N; j++) {
		// if (!pt[j] || !(j - si1))
		// continue;
		// pt[j]--;
		// }
	}

	for (i = 0; i < N; i++) {
		// printf("%s\n", ));
		(pt[i]-Q > 0 ? puts("Yes") : puts("No"));
	}

	// return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i )
typedef std::pair<int,int> pint;

using namespace std;
typedef long long ll;

int main(){
    int X; cin >> X;
    if ((X >= 400) && (X <= 599)){
        cout << "8" << endl;
    }
    if ((X >= 600) && (X <= 799)){
        cout << "7" << endl;
    }
    if ((X >= 800) && (X <= 999)){
        cout << "6" << endl;
    }
    if ((X >= 1000) && (X <=1199)){
        cout << "5" << endl;
    }
    if ((X >= 1200) && (X <= 1399)){
        cout << "4" << endl;
    }
    if ((X >= 1400) && (X <= 1599)){
        cout << "3" << endl;
    }
    if ((X >= 1600) && (X <= 1799)){
        cout << "2" << endl;
    }
    if ((X >= 1800) && (X <= 1999)){
        cout << "1" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
  int n;
  int i;
  int card[4][13]={{}};
  cin >> n;
  char a;
  int b;
  for(i=0;i<n;i++) {
    cin >> a >> b;
    switch(a){
    case 'S':
      card[0][b-1]=1;
      break;
    case 'H':
      card[1][b-1]=1;
      break;
    case 'C':
      card[2][b-1]=1;
      break;
    case 'D':
      card[3][b-1]=1;
      break;
    }
  }
  for(i=0;i<52;i++) {
    switch(i/13){
    case 0:
      if(card[0][i%13]==0) cout << "S " << i+1 << endl;
      break;
    case 1:
      if(card[1][i%13]==0) cout << "H " << i%13+1 << endl;
      break;
    case 2:
      if(card[2][i%13]==0) cout << "C " << i%13+1 << endl;
      break;
    case 3:
      if(card[3][i%13]==0) cout << "D " << i%13+1 << endl;
      break;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3100
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

ll n, d, a;
pair<ll, ll> p[200000];;
ll sb[200001];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    n = gi();
    d = gi();
    a = gi();
    for (ll i = 0; i < n; i++) {
        p[i].first = gi();
        p[i].second = gi();
    }

    sort(p, p+n);
    memset(sb, 0, sizeof(sb));
    ll s = 0;
    ll j = 0;
    ll r = 0;
    for (ll i = 0; i < n; i++) {
        s -= sb[i];
        p[i].second -= s*a;
        if (p[i].second > 0) {
            ll b = (p[i].second + a - 1) / a;
            r += b;
            s += b;
            while (j < n && p[j].first <= p[i].first + 2LL*d)
                j++;
            sb[j] += b;
        }
    }

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n, m;
 
  cin >> n;
  string s[n];
  for (auto& ss : s)
  {
    cin >> ss;
  }
 
  cin >> m;
  string t[m];
  for (auto& tt : t)
  {
    cin >> tt;
  }
 
  int ans = 0;
  for (int i=0; i<n; ++i) {
    string word = s[i];
    int point = 0;
    for (int j=0; j<n; ++j) {
      if (s[j] == word) ++point;
    }
    for (int j=0; j<m; ++j) {
      if (t[j] == word) --point;
    }
    ans = max(ans, point);
  }
 
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
let a = read_line ()
let b = read_line ()
let n = max (String.length a) (String.length b)
let f s = String.make (n - String.length s) '0' ^ s
let _ = print_endline @@ match compare (f a) (f b) with 1 -> "GREATER" | -1 -> "LESS" | _ -> "EQUAL"

Measured memory_bytes: 4480
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import math
import sys


def solve(values, nb, max_jump_size):
    max_jump_size = min(nb, max_jump_size)
    cost_to = [0]
    for i in range(1, nb):
        j = max(0, i - max_jump_size)
        value_i = values[i]
        new_cost = min(
            prev_cost + abs(value_i - prev_value)
            for prev_cost, prev_value in zip(cost_to[j:i], values[j:i])
        )
        cost_to.append(new_cost)
    return new_cost


def do_job():
    "Do the work"
    # first line is number of test cases
    R = int(input().strip())
    result = 2 * math.pi * R
    print("{:f}".format(result))


def print_output(testcase, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {:f}".format(testcase + 1, result))


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


Measured memory_bytes: 17324
#include <stdio.h>
#include <stdlib.h>
int main()
{
int S[100];
int i;
int z,ans=0;
char a[20];
int s_top =0;
for(i=0;i<200;i++)
{
z=scanf("%s",a);
if(z==EOF) break;
if (a[0]== '+' ) 
{
S[s_top-2]= S[s_top-2]+S[s_top-1];
//printf("tasu   %d",S[s_top-2]);
s_top--;
}
else if (a[0]== '-' )
{
S[s_top-2]=S[s_top-2]-S[s_top-1];
//printf("mainasu   %d",S[s_top-2]);
s_top--;
}
else if (a[0]== '*' ) 
{
S[s_top-2] = S[s_top-2]*S[s_top-1];
//printf("kakezan   %d",S[s_top-2]);
 s_top--;
}
else if (a[0]== '/' ) 
{
	S[s_top-2]=S[s_top-2]/S[s_top-1];
s_top--;
}
else
{
S[s_top]=atoi(a);
s_top++;
}
}  
printf("%d\n",S[s_top-1]);
return 0;
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
using vc = vector<char>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

vector<int> par;
//vector<Edge> Edges;
//vector<vector<Edge>> MinTree;
vector<bool> seen;
vector<int> cnt;

struct Edge{
  int from;
  int to;
  long cost;

  bool operator<(const Edge& o) const {
    return cost < o.cost;
  }
};

void Initpar(int n){
  par = vector<int>(n); 
  for(int i=0; i<n; i++) par.at(i) = i;
}

int root(int x){
  if(x == par.at(x)) return x;
  else par.at(x) = root(par.at(x));
}

void unite(int x, int y){
  int rx = root(x);
  int ry = root(y);
  if(rx == ry) return;
  par.at(ry) = rx;
}

bool same(int x, int y){
  return root(x) == root(y);
}

long Kruskal(vector<vector<Edge>> &MinTree, vector<Edge> &Edges){
  sort(Edges.begin(), Edges.end());
  int m = Edges.size();
  long sum_cost = 0;
  for(int i=0;i<m;i++){
    Edge ed = Edges.at(i);
    int v = ed.from;
    int nv = ed.to;
    if(same(v, nv)) continue;
    unite(v, nv);
    sum_cost += ed.cost;
    MinTree.at(v).push_back({v, nv, ed.cost});
    MinTree.at(nv).push_back({nv, v, ed.cost});
    seen.at(i) = true;
  }
  return sum_cost;
}

void dfs(vector<vector<Edge>> &MinTree, int v, int pv){
  for(Edge ed : MinTree.at(v)){
    int nv = ed.to;
    if(nv == pv) continue;
    dfs(MinTree, nv, v);
  }
  if(v == 0) return;
  if(cnt.at(v) % 2 == 0){
    cout << pv+1 << " " << v+1 << endl;
    cnt.at(pv)++;
  }else{
    cout << v+1 << " " << pv+1 << endl;
    cnt.at(v)++;
  }
  return;
}

int main(){
  int n,m;
  cin >> n >> m;
  if(m % 2 == 1){
    cout << -1 << endl;
    return 0;
  }
  vector<Edge> Edges;
  vector<vector<Edge>> MinTree(n);
  Initpar(n);
  seen = vector<bool>(m, false);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--;b--;
    Edges.push_back({a,b,1});
  }
  Kruskal(MinTree, Edges);
  cnt = vector<int>(n, 0);
  rep(i,m){
    if(seen.at(i)) continue;
    cout << Edges.at(i).from+1 << " " << Edges.at(i).to+1 << endl;
    cnt.at(Edges.at(i).from)++;
  }
  dfs(MinTree, 0, -1);
}

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

using namespace std;
typedef long long ll;
#define tr(container, it) \
    for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;

int A[300000];
 void _(){
    int n;string s;
    cin >> n >>s;
    int num0=0;
    int num1=0;
    int mx=123333333;
     for (int i = 0; i < n; ++i) {
         A[i]=num1;
         if(s[i]=='W')num1++;
         else num0++;
     }

     for (int i = 0; i < n-1; ++i) {
         mx=min(mx,2*A[i]+num0-i);
     }
     mx=min(mx,num1);
     cout << mx;




 }
int main() {
#if __MINGW32__
    freopen("E:\\Workspace\\Desktop\\cpp\\IO\\Input.txt", "r", stdin);
    freopen("E:\\Workspace\\Desktop\\cpp\\IO\\Output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}








Measured memory_bytes: 1812
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-1][0]<=latest:
    a,b=AB.pop()
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)


Measured memory_bytes: 28080
import math
def trial_division(n):
    a = []
    for i in range(2,int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    if n != 1:
        a.append(n)
    return a
N = int(input())
MOD = 10**9 + 7
ans_arr = [1]*(N+1)
for i in range(2,N+1):
    for item in trial_division(i):
        ans_arr[item] += 1
ans = 1
for item in ans_arr:
    ans *= item
    ans %= MOD
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 300'009;

int a[N];
int b[N];
int c[N];

int main() {
  int x, y, n, m, k;
  scanf("%d%d%d%d%d", &x, &y, &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", b + i);
  }
  sort(a, a + n);
  for (int i = 0; i < x; ++i) {
    c[i] = a[n - 1 - i];
  }
  sort(b, b + m);
  for (int i = 0; i < y; ++i) {
    c[x + i] = b[m - 1 - i];
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d", c + x + y + i);
  }
  sort(c, c + x + y + k);
  long long ans = 0;
  for (int i = 0; i < x + y; ++i) {
    ans += c[x + y + k - 1 - i];
  }
  printf("%lld\n", ans);
}


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

const int MAXN = int(5e4) + 2;
const int MAXM = int(1.1e5);
int N, M;
int T;
pair<int, int> X[MAXM];

bool ansUp[MAXM];

using bs = bitset<MAXN>;

namespace uniforming {
bs canReach[MAXN];
bool vis[MAXN];
bool findUniforming() {
	for (int t = 0; t < N; t++) canReach[t][t] = true;

	for (int i = M-1; i >= 0; i--) {
		int x = X[i].first, y = X[i].second;
		canReach[x] |= canReach[y];
		canReach[y] = canReach[x];
	}

	bs isGood;
	for (int t = 0; t < N; t++) {
		isGood[t] = true;
	}
	for (int s = 0; s < N; s++) {
		isGood &= canReach[s];
	}

	for (int t = 0; t < N; t++) {
		if (isGood[t]) {
			vis[t] = true;
			for (int i = M-1; i >= 0; i--) {
				int x = X[i].first, y = X[i].second;
				if (vis[x] || vis[y]) {
					if (!vis[y]) {
						ansUp[i] = true;
						vis[y] = true;
					}
					if (!vis[x]) {
						ansUp[i] = false;
						vis[x] = true;
					}
					assert(vis[x] && vis[y]);
				}
			}
			for (int s = 0; s < N; s++) assert(vis[s]);
			return true;
		}
	}
	return false;
}
}

namespace nonUniforming {
bool findNonUniforming() {
	if (N == 2 && M >= 1) {
		return false;
	}
	int badState = 0;
	for (int i = M-1; i >= 0; i--) {
		int x = X[i].first, y = X[i].second;
		if (y >= 3) {
			ansUp[i] = true;
			continue;
		}
		if (x == 0 && y == 1) {
			if (badState == 1) ansUp[i] = false;
			else if (badState == 2) ansUp[i] = true;
			badState = 0;
		} else if (x == 0 && y == 2) {
			if (badState == 0) ansUp[i] = false;
			else if (badState == 2) ansUp[i] = true;
			badState = 1;
		} else if (x == 1 && y == 2) {
			if (badState == 0) ansUp[i] = false;
			else if (badState == 1) ansUp[i] = true;
			badState = 2;
		} else assert(false);
	}
	return true;
}
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M >> T;
	for (int i = 0; i < M; i++) {
		cin >> X[i].first >> X[i].second;
		X[i].first--, X[i].second--;
	}

	bool found;
	if (T == 1) {
		found = uniforming::findUniforming();
	} else if (T == 2) {
		found = nonUniforming::findNonUniforming();
	} else assert(false);
	if (found) {
		for (int i = 0; i < M; i++) {
			cout << "v^"[ansUp[i]];
		}
		cout << '\n';
	} else {
		cout << -1 << '\n';
	}

	return 0;
}


Measured memory_bytes: 306816
#include <iostream>
#include <math.h>
#include <string>

using namespace std;
int main()
{
    int h,a,sum=0;
    cin>>h>>a;
    for(int i =1; h > 0;i++){
        h= h-a;
        sum++;
    }
    cout<<sum;

    return 0;
}

Measured memory_bytes: 3568
#include <iostream>

int main()
{
	std::string S;
	int K;
	std::cin >> K >> S;
	if (S.size() <= K) {
		std::cout << S;
	}
	else {
		S=S.substr(0, K);
		S += "...";
		std::cout << S;
	}
}

Measured memory_bytes: 3596
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            int N = cin.ReadInt;
            int resultInt = 0;
            int beforeCounter = 0;
            int afterCounter = 0;
            int tempInt;

            for(int i = N - (N-1); i <= N; i++)
            {
                tempInt = i;
                while (true)
                {
                    if (tempInt % 2 == 0)
                    {
                        beforeCounter++;
                        tempInt = tempInt / 2;
                        continue;
                    }
                    break;
                }
                if(afterCounter == 0 || beforeCounter > afterCounter)
                {
                    afterCounter = beforeCounter;
                    resultInt = i;
                }

                beforeCounter = 0;

            }
            Console.WriteLine(resultInt);

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <string>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CC(a) memset(a,0,sizeof(a))
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define VI vector<int>
#define VII vector<PII>
#define VLL vector<PLL>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second

template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}

struct TT{
	LL a,b;
}tt,ss;
LL t,n,m,ans;
LL MOD=1e9+7;

int main()
{
//	ios_base::sync_with_stdio(false);cin.tie(0);
	LL i,j,k,l,res;
	cin>>n;
	cout<<(n+1)*n/2<<endl;
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 

const int MAX_N = 100;
const int MAX_W = 10000;

int dp[MAX_N + 1][MAX_W + 1];
int v[MAX_N], w[MAX_N];
int N,W;

int solve() {
	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= W; j++){
			if(j < w[i]) {
				dp[i + 1][j] = dp[i][j];
			}
			else{
				dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
			}
		}
	}
	return dp[N][W];
}



int main(){
	cin>>N>>W;
	rep(i,N) cin>>v[i]>>w[i];
	cout<<solve()<<endl;
}

Measured memory_bytes: 5072
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		int a=0;
		int b=x;
		boolean jud = false;

		for(int i=0;i<=x;i++) {
			if(y==2*a+4*b) {
				jud = true;
			}
			a++;
			b--;
		}
		if(jud) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 35804
package main

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

func main() {
	scanner := makeScanner(1024)
	s := eGetLine(scanner)
	if s[0] == s[1] && s[0] == s[2] && s[0] == s[3] {
		fmt.Println("No")
	} else if s[0] == s[1] && s[2] == s[3] {
		fmt.Println("Yes")
	} else if s[0] == s[2] && s[1] == s[3] {
		fmt.Println("Yes")
	} else if s[0] == s[3] && s[1] == s[2] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}

func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


Measured memory_bytes: 640