akhauriyash/Code-Regression huggingface dataset:
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-O2")


using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 400 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int n, m, par[N], sz[N], res[N];
vector<int> num[N];
vector<pii> E;

void Clear(){
	for (int i = 1; i <= n; i++) par[i] = i, sz[i] = 1;
}

int getpar(int v){
	return (par[v] == v?v:par[v] = getpar(par[v]));
}

bool merge(int v, int u){
	v = getpar(v);
	u = getpar(u);
	if (v == u) return 0;
	if (sz[v] < sz[u]) swap(v, u);
	sz[v] += sz[u];
	par[u] = v;
	return 1;
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int v, u;
		cin >> v >> u;
		E.pb({v, u});
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++){
		Clear();
		for (int j = m - 1; j >= 0; j--){
			if (getpar(E[j].F) != getpar(i) && getpar(E[j].S) != getpar(i)) continue;
			if (merge(E[j].F, E[j].S) == 0) res[i] = 1;
			else num[i].pb(j); 
		}
	}
	for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++){
		if (res[i] + res[j] > 0) continue;
		int pnt = 0;
		Clear();
		merge(i, j);
		bool f = 1;
		for (int l = 0; l < num[i].size(); l++){
			while (pnt < num[j].size() && num[j][pnt] > num[i][l]){
				if (merge(E[num[j][pnt]].F, E[num[j][pnt]].S) == 0) f = 0;
				pnt++;
			}
			if (merge(E[num[i][l]].F, E[num[i][l]].S) == 0) f = 0;
		}
		if (f == 1) ans++;
	}
	cout << ans;









	return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

static const ull mod = 1000000007;
ull modpow(ull p, ull q, ull m=mod){
    ull ans = 1;
    p = p % m;
    for(ull i = 1ULL<<(sizeof(ull)*8-1); i>0; i>>=1){
        if(q&i) ans *= (ans*p)%m;
        else ans *= ans;
        ans %= m;
    }
    return ans;
}

#define MAX 2005
long long fac[MAX], finv[MAX], inv[MAX];

void Com_init(){ //##O(MAX)##
    fac[0] = fac[1] = 1; // x!
    finv[0] = finv[1] = 1; // (x!)^-1
    inv[1] = 1; //x^-1
    for(int i=2;i<MAX;i++){
        fac[i] = (fac[i-1] * i) % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}
long long Combination(int n, int k){ //calc nCk, max=n, ##O(1)##
    if(n<k || (n<0||k<0))return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

ll bell_number(ll n, ll k){ // 区別できるn個のボールを区別できないk個以下の箱に分割する方法の数
    if(n==0) return 1;
    k = min(k,n);
    Com_init();
    ll ret = 0;
    std::vector<ll> pref(k+1);
    pref[0] = 1;
    for(int i=1;i<=k; i++){
        if(i&1) pref[i] = pref[i-1] - finv[i];
        else pref[i] = pref[i-1] + finv[i];
        pref[i] = (pref[i] + mod) % mod;
    }
    for(int i=1; i<=k; i++){
        ret += (((modpow(i,n) * finv[i]) % mod) * pref[k-i])%mod;
        ret %= mod;
    }
    return ret;
}

int main(){
    Com_init();
    ll n,k;
    cin>>n>>k;
    if(n<=k)cout<<"1"<<endl;
    else cout<<"0"<<endl;
    return 0;
}


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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;


signed main() {
    //while(1) {
        int n;
        cin >> n;
        vector<string> u(n);
        for(int i=0; i<n; i++) cin >> u[i];
        int m;
        cin >> m;
        vector<string> t(m);
        for(int i=0; i<m; i++) cin >> t[i];

        bool isOpen = false;
        for(int i=0; i<m; i++) {
            bool isUnknown = true;
            for(int j=0; j<n; j++) {
                if(t[i]==u[j]){
                    isUnknown = false;
                    if(isOpen){
                        cout << "Closed by " << t[i] << endl;
                        isOpen = false;
                        break;
                    } else {
                        cout << "Opened by " << t[i] << endl;
                        isOpen = true;
                        break;
                    }
                }
            }
            if(isUnknown) {
                cout << "Unknown " << t[i] << endl;
            }
        }
    //}
}


Measured memory_bytes: 3216
n = int(input())
a = list(map(int, input().split()))
 
for i in range(n-1):
    if a[i] == a[i+1]:
        continue
    if a[i] < a[i+1]:
        a[i+1] -= 1
    else:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 63984
#include <stdio.h>

int
main()
{
	int t;
	scanf("%d", &t);

	int h = t/3600; t = t%3600;
	int m = t/60;   t = t%60;
	int s = t;
	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)

vector<int> v1;
vector<int> v2;
vector<int> ans;


ll a[500000] = {};
int main() {
	string s; cin >> s;
	rep(i, 0, s.size()) {
		if (s[i] == '<') {
			a[i+1] = a[i] + 1;
		}
	}
	rep_re(i, 0, s.size()) {
		if (s[i] == '>') {
			a[i] = max(a[i],a[i+1] + 1);
		}
	}
	ll ans = 0;
	repe(i, 0, s.size()) {
		ans += a[i];
	}

	cout << ans << endl;

}


Measured memory_bytes: 4740
#include<stdio.h>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x<y)?x:y)

int prime[30000];	//soinsuu_分解用に素数を求めておく.
int count;
int soinsuu_A[30000],soinsuu_B[30000];	//soinsuu_を入れる。

int GetPrime(int num);	//num以下の素数をprime[i]に保存
void DevPrime(int *p,int num);	//numをsoinsuu_分解。soinsuu_prime[i]の数を*(p+i)に保存。
int GetLCM(int *pa,int *pb);
int GetGCD(int *pa,int *pb);

int pwd(int tei,int sisuu){
	int ans = 1;
	for(int i = 0;i < sisuu;i++)
		ans *= tei;
	return ans;
}

int main(){
	count = GetPrime(50000); 

	int a,b;
	int LCM[200],GCD[200],cor = 0;
	while(~scanf("%d%d",&a,&b)){
		DevPrime(soinsuu_A,a);
		DevPrime(soinsuu_B,b);
		LCM[cor] = GetLCM(soinsuu_A,soinsuu_B);
		GCD[cor] = GetGCD(soinsuu_A,soinsuu_B);
		cor++;
	}
	for(int i = 0;i < cor;i++)
		printf("%d %d\n",GCD[i],LCM[i]);
	return 0;
}

int GetPrime(int num){
	int count = 0,i,j;
	for(i = 2;i <= num;i++){
		for(j = 0;j < count;j++){
			if(i%prime[j] == 0)                                                                                                                                                                                                                                               
				break;
		}
		if(j < count)
			continue;
		prime[count] = i;
		count++;
	}
	return count;
}
void DevPrime(int *p,int num){
	int i;
	for(i = 0;i < count;i++){
		//保存したい配列を初期化
		p[i] = 0;
		//割りきれなくなるまでその素数で割る。
		while(num%prime[i]==0){
			num /= prime[i];
			p[i]++;
		}
	}
}
int GetLCM(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MAX(pa[i],pb[i]));
	}
	return ans;
}
int GetGCD(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MIN(pa[i],pb[i]));
	}
	return ans;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (0 < a && 0 < c) {
        if (0 < a) {c -= b;}
        if (0 < c) {a -= d;}
    }
    if (0 >= a) {cout << "No" << endl;}
    if (0 >= c) {cout << "Yes" << endl;}
}

Measured memory_bytes: 3652
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T

main :: IO ()
main = do
  let
    f :: Int -> Int -> Int
    f k m = (2 * k) `min` (m - 1)
  [n, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    step :: Char -> [Bool] -> [Bool]
    step 'L' rest = False : rest
    step 'R' rest = True : rest
    step _ _ = []
  ds <- foldr step [] <$> getContents :: IO [Bool]
  let
    (m, s) = foldl step (1, 0) . (zipWith (==) <$> id <*> tail) $ ds :: (Int, Int)
      where
        step :: (Int, Int) -> Bool -> (Int, Int)
        step (m, s) b | b         = (m, s + 1)
                      | otherwise = (m + 1, s)
  print $ s + f k m

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 4912
N=int(input())
A=list(map(int,input().split()))
A.sort()
if A[0]==0:
    print(0)
else:
    ok=bool(True)
    ans=int(1)
    for i in A:
        ans*=i
        if ans>1000000000000000000:
            ans=0
            ok=False
    if ok:
        print(ans)
    else:
        print(-1)

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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void solve() {
    string s, t, u;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    cin >> u;
    if (u == s) cout << a - 1 << " " << b << endl;
    else cout << a << " " << b - 1 << endl;
}

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


Measured memory_bytes: 256
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,K=map(int,input().split())
l=list(map(int,input().split()))

cnt=0
cnt2=0
p=10**9+7
for i in range(N):
	for j in range(N):
		if l[i]>l[j] and j>i:
			cnt+=1
for k in range(N):
	for m in range(N):
		if l[k]>l[m] and k>m:
			cnt2+=1
Cn=K*(K+1)//2*cnt+(K-1)*K//2*cnt2
print(Cn%p)


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

int gcd(int a,int b) {
	int r;
	while (1) {
	
			r = a%b;
			if (r == 0) {
				break;
			}
			a = b;
			b = r;	
	}
	return b;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		int c;
		c = gcd(a, b);
		int d, e;
		d = a / c;
		e = b / c;
		int lcm = d*e*c;
		cout << c << " " << lcm << endl;
	}
	return 0;
}

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int):
    return YES if '7' in str(N) else NO


# 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 = int(next(tokens))  # type: int
    print(solve(N))

if __name__ == '__main__':
    main()


Measured memory_bytes: 9148
import java.util.*;

class Main{
   public static void main(String[] args)
   {
      Scanner scan  = new Scanner(System.in);
      int     X     = scan.nextInt();
      int     Y     = scan.nextInt();
      int     count = 0;

      if(X % 500 > Y){
         System.out.println("No");
         }
      else{
          System.out.println("Yes");
          }
   }
}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e3 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
int N, K, vis[10];
inline int check(int x)
{
    int tmp[10], tot = 0;
    while (x) {
        tmp[++tot] = x % 10, x /= 10;
        if (vis[tmp[tot]]) {
            return false;
        }
    }
    return true;
}
signed main()
{
    N = read(), K = read();
    for (ri i = 1; i <= K; ++i) {
        vis[read()] = 1;
    }
    for (ri i = N; i <= 10 * N + 9; ++i) {
        if (check(i)) {
            writeln(i);
            return 0;
        }
    }
    return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> d(13,0);
  int dd;
  for(int i=0;i<n;i++){
    cin >> dd;
    d[dd]++;
  }
  d[0]++;
  if(d[0]>1||d[12]>1){
    cout << 0 << endl;
    return 0;
  }
  for(int i=1;i<=11;i++){
    if(d[i]>2){
      cout << 0 << endl;
      return 0;
    }
  }
  int ans=0,tmp;
  for(int i=0;i<(1<<10);i++){
    vector<int> a;
    if(d[0]>0) a.push_back(0);
    for(int j=1;j<=11;j++){
      if(d[j]>=2){
        a.push_back(j);
        a.push_back(24-j);
      }else if(d[j]==1){
        if(i&(1<<(j-1))){
          a.push_back(j);
        }else{
          a.push_back(24-j);
        }
      }
    }
    if(d[12]>0) a.push_back(12);
    sort(all(a));
    tmp=min(a[a.size()-1]-a[0],24-(a[a.size()-1]-a[0]));
    // cout << a[0];
    for(int j=0;j<a.size()-1;j++){
      tmp=min(tmp,min(a[j+1]-a[j],24-(a[j+1]-a[j])));
      // cout << " " << a[j+1];
    }
    // cout << tmp << endl;
    ans=max(ans,tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
x = int(input())
if x<600:
  print('8')
elif x<800:
  print('7')
elif x<1000:
  print('6')
elif x<1200:
  print('5')
elif x<1400:
  print('4')
elif x<1600:
  print('3')
elif x<1800:
  print('2')
else:
  print('1')
  


Measured memory_bytes: 9168
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e9+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(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 bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

int main()
{
	ll ans = 0;
	int n;
	cin >> n;

	vector<string> v(n);
	for (int i = 0; i < n; ++i)
	{
		string s;
		cin >> s;
		sort(ALL(s));
		v[i] = s;
	}

	unordered_map<string, ll> mp;

	for (int i = 0; i < n; ++i)
	{
		auto itr = mp.find(v[i]);
		if (itr != mp.end())
		{
			++itr->second;
			ans += (itr->second - (ll)1);
		}
		else
		{
			mp[v[i]] = (ll)1;
		}
	}

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

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

typedef pair<int, int> PII;
const int INF = 10e+9;

struct Edge {
  int to, dist, cost;
  Edge(int t, int d, int c) : to(t), dist(d), cost(c) {}
};

int solve(int N, int M, vector<int>& u, vector<int>& v, vector<int>& d, vector<int>& c) {
  vector<vector<Edge> > G(N);
  for (int i = 0; i < M; i++) {
    G[u[i]-1].push_back(Edge(v[i]-1, d[i], c[i]));
    G[v[i]-1].push_back(Edge(u[i]-1, d[i], c[i]));
  }

  vector<bool> used(N, false);
  priority_queue<pair<int, PII>, vector<pair<int, PII> >, greater<pair<int, PII> > > que;

  int total_cost = 0;

  que.push(make_pair(0, make_pair(0, 0)));
  while (!que.empty()) {
    int city = que.top().second.first;
    int cost = que.top().second.second;
    int dist = que.top().first;
    que.pop();

    if (!used[city]) {
      used[city] = true;
      total_cost += cost;

      for (int i = 0; i < G[city].size(); i++) {
        Edge& e = G[city][i];
        if (!used[e.to]) {
          que.push(make_pair(dist + e.dist, make_pair(e.to, e.cost)));
        }
      }
    }
  }
  return total_cost;
}

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

  while (true) {
    int N, M; cin >> N >> M;
    if (N == 0 && M == 0) break;

    vector<int> u(M), v(M), d(M), c(M);
    for (int i = 0; i < M; i++) cin >> u[i] >> v[i] >> d[i] >> c[i];

    int ans = solve(N, M, u, v, d, c);
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void) {
    int N, K, i;
    int n = 1;

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

    for (i = 0; i < N; i++) {
        if (2 * n < n + K) {
            n = 2 * n;
        } else {
            n += K;
        }
    }

    printf("%d", n);

    return 0;
}

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

#include <cmath>    //floor ceil
#include <cstdlib>  //abs
#include <cstdio>
#include <climits>  //INT_MAX
#include <cstring>
#define endl "\n"
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define lli long long int
#define lui long unsigned int
//#define int long long
#define MOD 1000000007
#define input(a,n) for (int i=0;i<n;i++) scanf("%d",&a[i]);
#define output(a,n) for (int i=0;i<n;i++) printf("%d ",a[i]);
#define rajnikant bool ios_base::sync_with_stdio(false); cin.tie(0);
#include <vector>
#define pb push_back
#define vi vector<int>
#include <map>
#define mp make_pair
#define mii map<int,int>
mii m,m1;
#include <set>
set<int>::iterator its;
#define f first
#define s second
#define all(v) v.begin(),v.end()
#include <stack>
/*---------------------------------------------------CODE STARTS FROM HERE---------------------------------------------------*/

int main () {
    int tt=1,t;
    //cin >> tt;
    while(tt--) {
        int n,c=0,b=0;
        cin >> n;
        int a[n][2];
        for (int i=0;i<n;i++) {
            cin >> a[i][0] >> a[i][1];
        }
        for (int i=0;i<n;i++) {
            if(a[i][0]==a[i][1]) c++;
            else c=0;
            if(c==3) {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var H = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var ok = true;

        H[0]--;

        for (int i = 1; i < N; i++)
        {
            if (H[i - 1] < H[i])
                H[i]--;
            else if (H[i - 1] == H[i])
                continue;
            else
            {
                ok = false;
                break;
            }
        }

        var ans = ok ? "Yes" : "No";

        WriteLine(ans);
    }
}


Measured memory_bytes: 39704
// start fold
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define enter putchar('\n')
#define size(x) ((int)x.size())
#define mem0(x) memset(x,0,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; short f=1; 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();
	x*=f;
}
template <typename T,typename ...Args>il void in(T &x, Args &...args)
{
	in(x); in(args...);
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30];
	short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template <typename T,typename ...Args>il void out(const T &x,const Args &...args)
{
	out(x,' '); out(args...);
}
template<class T>il void print(T a[],int n)
{
	if(n<=0) return;
	for(ri i=0; i<n; ++i) out(a[i],' ');
	enter;
}
namespace i207M
{
// end fold
int a,b,c;
multiset<string>s;
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
#endif
	in(a,b,c);
	for(ri i=1; i<=a; ++i) s.insert("a");
	for(ri i=1; i<=b; ++i) s.insert("b");
	for(ri i=1; i<=c; ++i) s.insert("c");
	while(size(s)>1)
	{
		string t=*s.begin()+*s.rbegin();
		s.erase(s.begin()),s.erase(--s.end());
		s.insert(t);
	}
	cout<<*s.begin();
	return 0;
}
// start fold
}
signed main()
{
	i207M::main();
	return 0;
}
// end fold

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

vector<int> binaryConvert(int x, int digit){
    vector<int> binary(1);

    while(x > 0){
        binary.insert(binary.begin(), x%2);
        x = x/2;
    }

    binary.pop_back();

    while (binary.size() < digit)
    {
        binary.insert(binary.begin(), 0);
    }
    

    return binary;
}

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

    int *k = new int[m];
    int s[10][10] = {-1};
    int *p = new int[m];

    for (int i = 0; i < m; i++){
        cin >> k[i];

        for (int j = 0; j < k[i]; j++){
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < m; i++){
        cin >> p[i];
    }

    // printf("--------\n");
    // for (int i = 0; i < m; i++){
    //     printf("%d ", k[i]);
    //     for (int j = 0; j < k[i]; j++){
    //         printf("%d ", s[i][j]);
    //     }
    //     printf("\n");
    // }
    

    int ans = 0;
    int count = 0;
    bool flag = true;
    int swichOnSum = 0;
    for (int i = 0; i < 1 << n; i++){
        flag = true;
        vector<int> swichStatus = binaryConvert(i, n);
        for (int j = 0; j < m; j++){
            for(int h = 0; h < k[j]; h++){
                swichOnSum += swichStatus[s[j][h] - 1];
            }
            if (swichOnSum%2 != p[j]){
                flag = false;
            }
            swichOnSum = 0;
        }
        if(flag){
            ans += 1;
        }
    }  

    cout << ans << endl;

    // vector<int> bina = binaryConvert(3, 5);
    // for(int i=0;i<bina.size();i++){
    //     printf("%d",bina[i]);
    // }

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    string s;
    cin >> s;
    if(s=="RRR") cout<<3<<endl;
    else if(s=="SSS") cout<<0<<endl;
    else if(s=="RSS") cout<<1<<endl;
    else if(s=="SRS") cout<<1<<endl;
    else if(s=="SSR") cout<<1<<endl;
    else if(s=="RSR") cout<<1<<endl;
    else cout<<2<<endl;
}

Measured memory_bytes: 3648
fun main(args: Array<String>) {
    val (x1, y1,  x2, y2) = listOfInt()
    val (dx, dy) = listOf(x2 - x1, y2 - y1)
    val (x3, y3) = listOf(x2 - dy, y2 + dx)
    val (x4, y4) = listOf(x3 - dx, y3 - dy)
    println("${x3} ${y3} ${x4} ${y4}")
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }

Measured memory_bytes: 37776
fn main() {
  let s: String = read();

  let s = s.chars().collect::<Vec<_>>();
  let l = s.len();
  let s = s.into_iter().take(l-8).collect::<String>();
  println!("{}", s);
}

fn read<T: std::str::FromStr>() -> T {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().parse::<T>().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int a[10000];
int main(){
	int n,ans=0;
	scanf("%d",&n);
	n *= 2;
	for(int i = 0;i<n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	for(int i = 0;i<n;i+=2){
		ans += a[i];
	}
	printf("%d\n",ans);
	return 0;
} 

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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const int INF = (1LL<<30);
#else
const ll INF = (1LL<<60);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

VI g[100010];
int color[100010];

bool dfs(int v, int c) {
  color[v] = c;
  for(int i=0; i<g[v].size(); ++i) {
    if(color[g[v][i]] == c) return false;
    if(color[g[v][i]] == 0 && !dfs(g[v][i], -c)) return false;
  }
  return true;
}

signed main(void)
{
  int n, m;
  cin >> n >> m;
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].PB(b);
    g[b].PB(a);
  }

  REP(i, n) {
    if(color[i] == 0) {
      if(!dfs(i, 1)) {
        cout << n*(n-1)/2 - m << endl;
        return 0;
      }
    }
  }

  int black = 0, white = 0;
  REP(i, n) {
    if(color[i] == 1) black++;
    else if(color[i] == -1) white++;
    else assert(false);
  }

  int ret = 0;
  REP(i, n) {
    if(color[i] == 1) ret += white - g[i].size();
    else ret += black - g[i].size();
  }
  if(ret%2) assert(false);
  cout << ret/2 << endl;

  return 0;
}


Measured memory_bytes: 7424
#include <algorithm>
#include <stack>
#include <map>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int a[n+1]; for (int i = 0; i < n; i++) cin >> a[i+1];
    a[0] = 0;
    stack<int> s;
    s.push(0);
    for (int i = 1; i <= n; i++) if (a[s.top()] < a[i]) s.push(i);
    map<int, int> mp;
    vector<long long> ans(n+1, 0);
    for (int i = 1; i <= n; i++) mp[a[i]]++;
    while (s.size() > 1) {
        int i = s.top();
        s.pop();
        int j = s.top();
        for (auto it = mp.upper_bound(a[j]); it != mp.end(); it = mp.erase(it)) {
            mp[a[j]] += it->second;
            ans[i] += (long long)(it->first - a[j]) * it->second;
        }
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << endl;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	int n, m; cin >> n >> m;
	if (n==m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	cin >> n;
	ll p[n];
	for(ll i = 0; i < n; i++){
		cin >> p[i];
	}
	ll count = 0;
	for(ll j = 1; j < n-1; j++){
		if((p[j] < p[j + 1] && p[j - 1] < p[j]) || (p[j] > p[j + 1] && p[j - 1] > p[j])){
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int MOD = 1000000007;

LL N,M;
LL a,b,c,d;
string s;

int main(){
    cin>>a>>b>>c;
    int cnt=0;
    while(1){
        if(a%2==1 || b%2==1 || c%2==1){
            cout<<cnt<<endl;
            return 0;
        }
        else if(a==b&& b==c){
            cout<<"-1"<<endl;
            return 0;
        }
        cnt++;
        LL A=a,B=b,C=c;
        a=(B+C)/2;
        b=(A+C)/2;
        c=(B+A)/2;
        

    }

    return 0;
}


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

#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define x first
#define y second
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

#define ll long long
#define ld long double

const ld EPS = 10e-9;
const int INF = 1e9 + 5;
const long long INFLL = (ll)INF * (ll)INF;
const ll MOD = 1e9 + 7;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "[";
    for (int i = 0; i < (int)v.size(); ++i) {
        os << v[i];
        if (i != (int)v.size() - 1)
            os << ", ";
    }
    os << "]\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const unordered_set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{
    os << "(";
    os << v.first << ", "
       << v.second << ")";
    os << "\n";
    return os;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define debug(...)
#endif


// __gcd(x, y)

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

    int N;
    cin >> N;

    int d = N % 10;

    if(d == 2 || d == 4 || d == 5 || d == 7 || d == 9)
        cout << "hon" << endl;
    else if(d == 0 || d == 1 || d == 6 || d == 8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;

    return 0;
}


Measured memory_bytes: 3640
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

N = int(input())
D = make_divisors(N)
L = len(D)
if L%2==0:
    print(len(str(D[L//2])))
else:
    print(len(str(D[L//2])))

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<double> A(N+1);
  for(int i = 0; i < N; ++i) cin >> A[i+1];
  for(int i = 0; i < N; ++i) A[i+1] += A[i];
  const double INF = 1e9;
  vector<vector<double>> dp(N+1,vector<double>(M+1,-INF));
  dp[0][0] = 0;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < M; ++j){
      for(int k = i+1; k <= N; ++k){
        double h = (A[k]-A[i])/(k-i);
        dp[k][j+1] = max(dp[k][j+1],dp[i][j]+h);
      }
    }
  }
  printf("%.12f\n",*max_element(dp[N].begin()+1, dp[N].end()));
}



Measured memory_bytes: 5112
#include <stdio.h>
int main(void)
{
	int n,i;
	long long int l[87];
	l[0]=2; l[1]=1;
	scanf("%d",&n);
	for(i=2; i<=n; i++){
		l[i]=l[i-1]+l[i-2];
	}
	printf("%lld\n",l[n]);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll N;
  cin >> N;
  vector<ll> a(N+1) , b(N);
  rep(i,N+1)
  {
    cin >> a[i];
  }
  rep(i,N)
  {
    cin >> b[i];
  }
  ll sum = 0;
  for(int i=0;i<N;i++)
  {
    if(b[i]-a[i]<=0)
    {
      sum += b[i];
    }
    else
    {
      if(b[i]-a[i]-a[i+1]>=0)
      {
        sum += a[i]+a[i+1];
        a[i+1] = 0;
      }
      else
      {
        sum += b[i];
        a[i+1] -= b[i]-a[i];
      }
      
    }
    
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1792
N, M = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
ys = gets.split.map(&:to_i)
MOD = 10**9+7

sumx, sumy = 0, 0
(N-1).times do |i|
    sumx += (xs[i+1] - xs[i]) * (i+1) * (N-i-1)
    sumx %= MOD
end
(M-1).times do |i|
    sumy += (ys[i+1] - ys[i]) * (i+1) * (M-i-1)
    sumy %= MOD
end
puts sumx * sumy % MOD

Measured memory_bytes: 15396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		double r = Double.parseDouble(line);
		double pi = Math.PI;
		double menseki = r * r * pi;
		double enshuu = 2 * r * pi;
		System.out.printf("%.8f", menseki);
		System.out.print(" ");
		System.out.printf("%.8f", enshuu);
	}

}

Measured memory_bytes: 26316
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;
use std::cmp::{min, max};
use itertools::Itertools;
use std::ops::{Add, AddAssign};
use num_integer::Integer;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}

fn read_tuple3<T: FromStr, S: FromStr, R: FromStr>() -> (T, S, R) {
    let a = read();
    let b = read();
    let c = read();
    (a, b, c)
}

fn lower_bound<T: Copy, F>(v: &Vec<T>, f: F) -> Option<usize> where
    F: Fn(T) -> bool
{
    let mut left = 0;
    let mut right = v.len() - 1;
    if !f(v[left]) {
        return None;
    }
    if f(v[right]) {
        return Some(right);
    }
    loop {
        if right - left == 1 {
            return Some(left);
        }
        let mid = (left + right) / 2;
        if f(v[mid]) {
            left = mid;
        } else {
            right = mid;
        }
    }
}

fn main() {
    let n: u64 = read();
    let alist: Vec<u64> = (0..n).map(|_| read()).collect();
    let mut two_count = 0;
    let mut not_two_count = 0;
    let mut four_count = 0;
    for a in alist {
        if a % 4 == 0 {
            four_count += 1;
        } else if a % 2 == 0 {
            two_count += 1;
        } else {
            not_two_count += 1;
        }
    }
    if two_count % 2 != 0 {
        not_two_count += 1;
    }

    let is_ok = not_two_count - four_count <= 1;
    println!("{}", if is_ok { "Yes" } else { "No" });
}



Measured memory_bytes: 2808
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val s = sc.next()
        val f = Array(n) { 0 }
        for (i in 0 until n - 1) {
            f[i + 1] = f[i]
            if (s[i] == 'W') f[i + 1]++
        }

        val b = Array(n) { 0 }
        for (i in n - 1 downTo 1) {
            b[i - 1] = b[i]
            if (s[i] == 'E') b[i - 1]++
        }

        var ans = Int.MAX_VALUE
        for (i in 0 until n) {
            ans = Math.min(ans, f[i] + b[i])
        }
        println(ans)
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]
}

Measured memory_bytes: 41360
import java.io.*;

class Main{
	static char[] dice;
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		try{
				while(true){
					String line = reader.readLine();
					int n = Integer.parseInt(line);
					if(n==0)break;
					int sum = 1;
					dreset();

					for(int i = 0;i < n;++i){
						line = reader.readLine();
						sum += move(line.charAt(0));
						//System.out.println(sum);
					}
					System.out.println(sum);
				}	
				
		}catch(IOException e){
				System.out.println(e);
		}
	}

	public static void dreset(){
		dice = new char[7];
		dice[1] = 'T';
		dice[2] = 'S';
		dice[3] = 'E';
		dice[4] = '0';
		dice[5] = '0';
		dice[6] = '0';
	}

	public static int move(char direct){
		int t=0,s=0,e=0;
		switch(direct){
			case 'N':
				for(int i = 1; i < 7;++i){
					if(dice[i]=='T'){
						t = i;break;
					}
				}
				for(int i = 1; i < 7;++i){
					if(dice[i]=='S'){
						dice[i]='T';
						dice[7-i]=dice[t]='0';
						dice[7-t]='S';
						return i;
					}
				}
				break;
			case 'E':
				for(int i = 1; i < 7;++i){
					if(dice[i]=='T'){
						t = i;break;
					}
				}
				//for(int i = 1; i<7;++i)System.out.println(dice[i]);
				for(int i = 1; i < 7;++i){
					if(dice[7-i]=='E'){
						dice[i]='T';
						dice[7-i]=dice[7-t]='0';
						dice[t]='E';
						return i;
					}
				}
				break;
			case 'W':
				for(int i = 1; i < 7;++i){
					if(dice[i]=='T'){
						t = i;break;
					}
				}
				for(int i = 1; i < 7;++i){
					if(dice[i]=='E'){
						dice[i]='T';
						dice[7-i]=dice[t]='0';
						dice[7-t]='E';
						return i;
					}
				}
				break;
			case 'S':
				for(int i = 1; i < 7;++i){
					if(dice[i]=='T'){
						t = i;break;
					}
				}
				//for(int i = 1;i < 7;++i)System.out.println(dice[i]);
				for(int i = 1; i < 7;++i){
					if(dice[7-i]=='S'){
						dice[i]='T';
						dice[7-i]=dice[7-t]='0';
						dice[t]='S';
						return i;
					}
				}
				break;
			case 'R':
				for(int i = 1;i < 7;++i){
					if(dice[i]=='E'){
						e = i;
					}
					if(dice[i]=='T'){
						t = i;
					}
				}
				for(int i = 1;i < 7;++i){
					if(dice[i]=='S'){
						dice[i]=dice[7-e]='0';
						dice[7-i]='E';
						dice[e]='S';
						return t;
					}
				}
				break;
			case 'L':
				for(int i = 1;i < 7;++i){
					if(dice[i]=='S'){
						s = i;
					}
					if(dice[i]=='T'){
						t = i;
					}
				}
				for(int i = 1;i < 7;++i){
					if(dice[i]=='E'){
						dice[i]=dice[7-s]='0';
						dice[7-i]='S';
						dice[s]='E';
						return t;
					}
				}
				break;
			default:
				System.out.println("ERROR HAS OCCURED");
		}
		return 0;
	}
}

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

int N, M, arr[100005];

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		arr[a] = !arr[a];
		arr[b] = !arr[b];
	}
	for (int i = 1; i <= N; i++) {
		if (arr[i] != 0) {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;

int main(){

    int N;
    int tmp;
    cin >> N;

    set<int> d;
    for(int i = 0; i  < N; ++i){
        cin >> tmp;
        d.insert(tmp);
    }

    cout << d.size() << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string S, T;
	cin >> S >> T;
	int a = 0, b = 0;
	rep(i, S.size() + T.size()) {
		if (i % 2 == 0) {
			cout << S[a];
			a++;
		}
		else {
			cout << T[b];
			b++;
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

int main(void){
  string s;
  map<char,string> table1;
  map<string,char> table2;
  for(char c='A';c<='Z';++c){
    int a = c-'A';
    for(int j=0;j<5;++j){
      table1[c] = ((a%2)?'1':'0')+table1[c];
      a/=2;
    }
  }
  table1[' ']="11010";
  table1['.']="11011";
  table1[',']="11100";
  table1['-']="11101";
  table1['\'']="11110";
  table1['?']="11111";
  
  table2["101"]=' ';
  table2["000000"]='\'';
  table2["000011"]=',';
  table2["10010001"]='-';
  table2["010001"]='.';
  table2["000001"]='?';
  table2["100101"]='A';
  table2["10011010"]='B';
  table2["0101"]='C';
  table2["0001"]='D';
  table2["110"]='E';
  table2["01001"]='F';
  table2["10011011"]='G';
  table2["010000"]='H';
  table2["0111"]='I';
  table2["10011000"]='J';
  table2["0110"]='K';
  table2["00100"]='L';
  table2["10011001"]='M';
  table2["10011110"]='N';
  table2["00101"]='O';
  table2["111"]='P';
  table2["10011111"]='Q';
  table2["1000"]='R';
  table2["00110"]='S';
  table2["00111"]='T';
  table2["10011100"]='U';
  table2["10011101"]='V';
  table2["000010"]='W';
  table2["10010010"]='X';
  table2["10010011"]='Y';
  table2["10010000"]='Z';
  
  while(getline(cin,s),!cin.eof()){
    string decoded,result;
    for(int i=0;i<s.size();++i){
      decoded+=table1[s[i]];
    }
    string tmp;
    //cerr<<decoded<<endl;
    for(int i=0;i<decoded.size();++i){
      tmp += decoded[i];
      if(table2.find(tmp) != table2.end()){
        result+=table2[tmp];
        tmp="";
      }
    }
    cout<<result<<endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include <cstdio>

int
main(void)
{
  int a, b, c, i, cnt;

  std::scanf("%d %d %d", &a, &b, &c);

  cnt = 0;
  for (i = a; i <= b; i++) {
    if (c % i == 0) {
      cnt++;
    }
  }

  std::printf("%d\n", cnt);

  return 0;
}



Measured memory_bytes: 2728
// AtCoder Regular Contest 072
// D - Alice&Brown

#include <cstdio>
#include <cmath>
using namespace std;
typedef long long int ll;


int X, Y;

int main() {

  scanf("%d%d", &X, &Y);
  printf("%s\n", abs(X - Y) <= 1 ? "Brown" : "Alice");

  return 0;

}




Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    if(n==3){
    	cout << 2<<" "<<5<<" "<<63<<endl;
    	return 0;
    }
    vector<int> v;
    int m=n/8,index=1;
    for(int i=0;i<m;i++)for(int j=1;j<=12;j++)if(j%2==0||j%3==0)v.pb(12*i+j);
    index=12*m;
    n%=8;
    if(n==1)v.pb(index+6);
    else if(n==2){v.pb(index+2);v.pb(index+4);}
    else if(n==3)for(int i=2;i<=6;i+=2)v.pb(index+i);
    else if(n==4){v.pb(index+2);v.pb(index+4);v.pb(index+3);v.pb(index+9);}
    else if(n==5){v.pb(index+2);v.pb(index+4);v.pb(index+3);v.pb(index+9);v.pb(index+6);}
    else if(n==6){v.pb(index+2);v.pb(index+4);v.pb(index+3);v.pb(index+9);v.pb(index+8);v.pb(index+10);}
    else if(n==7){v.pb(index+2);v.pb(index+4);v.pb(index+3);v.pb(index+9);v.pb(index+8);v.pb(index+10);v.pb(index+6);}
    for(auto& i:v)cout << i<<" ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 640