akhauriyash/Code-Regression huggingface dataset:
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        switch (scanner.next().charAt(0)) {
            case 'A':
                System.out.println('T');
                return;
            case 'C':
                System.out.println('G');
                return;
            case 'G':
                System.out.println('C');
                return;
            case 'T':
                System.out.println('A');
        }
    }
}

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

int main(int argc, const char * argv[]) {
    uint32_t N;
    cin >> N;
    
    uint32_t a;
    cin >> a;
    for (uint32_t i = 1; i < N; i++) {
        int tmp;
        cin >> tmp;
        a = a ^ tmp;
    }
    
    if (a != 0) {
        cout << "No" << endl;
    }else {
        cout << "Yes" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out)
            throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        double x = 0.0;
        double y = 0.0;
        int direction = 0;
        while (true) {
            String line = reader.readLine();
            if (line.equals("0,0")) {
                break;
            }
            String[] values = line.split(",");
            int distance = Integer.parseInt(values[0]);
            int angle = Integer.parseInt(values[1]);
            double rad = Math.toRadians(direction);
            x += distance * Math.sin(rad);
            y += distance * Math.cos(rad);
            direction += angle;
        }
        out.println((int) x);
        out.println((int) y);
    }
}

Measured memory_bytes: 9360
#include <bits/stdc++.h>
using namespace std;
using lli=long long int;
using vi=vector<int>;  using vs=vector<string>; using gi=greater<int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define soao(c) sort((c).begin(),(c).end()) //昇順
#define sodo(c) sort((c).begin(),(c).end(),gi()) //降順
#define rev(c) reverse((c).begin(), (c).end())


int main(){
    int X; cin>>X;
    if(X>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3676
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC
{
    class QuestionE
    {
        public class HW
        {
            public long H;
            public long W;

            public HW(long[] hw)
            {
                H = hw[0];
                W = hw[1];
            }
        }

        public static void Main(string[] args)
        {
            var hwm = Console.ReadLine().Split(" ").Select(z => long.Parse(z)).ToArray();
            var h = hwm[0];
            var w = hwm[1];
            var m = hwm[2];

            var arrayMax = 300000;

            var hlineBombs = new long[arrayMax];
            var wlineBombs = new long[arrayMax];

            var bombs = new HW[arrayMax];

            //それぞれの行列での爆弾の個数を求める
            for (int i = 0; i < m; i++) {
                var hw = new HW(Console.ReadLine().Split(" ").Select(z => long.Parse(z)).ToArray());
                var y = --hw.H;
                var x = --hw.W;
                bombs[i] = hw;

                hlineBombs[y]++;
                wlineBombs[x]++;
            }

            var hMax = hlineBombs.Max();
            var wMax = wlineBombs.Max();

            //最大数の爆弾を保持する行列のIndex
            var hIndexes = new HashSet<long>();
            var wIndexes = new HashSet<long>();

            for (int i = 0; i < h; i++) {
                if (hlineBombs[i] == hMax) {
                    if (hIndexes.Contains(i) == false) {
                        hIndexes.Add(i);
                    }
                }
            }

            for (int i = 0; i < w; i++) {
                if (wlineBombs[i] == wMax) {
                    if (wIndexes.Contains(i) == false) {
                        wIndexes.Add(i);
                    }
                }
            }

            var max = hMax + wMax;

            //爆破したいマスの候補数
            var remain = ((long)hIndexes.Count) * wIndexes.Count;

            for (int i = 0; i < m; i++) {
                //なるべく爆弾のない候補マスを爆破したいので
                //候補マスに爆弾が存在していた時は候補数を減らす
                if (hIndexes.Contains(bombs[i].H) && wIndexes.Contains(bombs[i].W)) {
                    remain--;
                }
            }

            //すべての爆弾を調べた後、爆破するマスの候補が残っていなければ、仕方なく爆弾のあるマスを爆破する
            if (remain <= 0) {
                max--;
            }

            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 78572
import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def AST(exp: bool, msg: str = ""): assert exp, msg
def TAST(exp: bool, msg = ""):
    if exp is False: print("TAssertionError:", msg)
    while exp is False:
        pass
def EPR(msg): print(msg, file=sys.stderr)
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    N, K = ILI()

    ans = 0.0
    for i in range(1,N+1):  # サイコロの出た目
        scr = i  # 現在のスコア
        pb = 1.0  # 現在のスコアとなる確率
        if K <= scr:  # 最初から勝っていたら
            ans += pb/N
            continue

        # n 回コインを投げて勝ち続けると得点は
        # scr * 2**n
        # 勝ちとなるのは
        # scr * 2**n >= K
        n = ceil(log(K/scr, 2))
        
        ans += pow(0.5, n) / N

    print("{:.12}".format(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 5548
#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef pair<int, int> P;
struct UF{
    vector<int> par, rank, size;

    void init(int n){
        par.assign(n, 0);
        rank.assign(n, 0);
        size.assign(n, 1);
        for(int i=0;i<n;i++){
            par[i] = i;
        }
    }

    int find(int x){
        if(par[x] == x) return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x != y){
            if(rank[x] < rank[y]){
                par[x] = y;
                size[y] += size[x];
            }else{
                par[y]=x;
                size[x] += size[y];
                if(rank[x]==rank[y]) rank[x]++;
            }
        }
    }

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

    int get_size(int x){
        return size[find(x)];
    }
};
int main(void){
    int n, k, l;
    UF road, train;
    map<P, int> p;
    cin >> n >> k >> l;
    road.init(n);
    train.init(n);
    for(int i=0;i<k;i++){
        int p, q;
        cin >> p >> q;
        road.unite(--p, --q);
    }
    for(int i=0;i<l;i++){
        int r, s;
        cin >> r >> s;
        train.unite(--r, --s);
    }
    for(int i=0;i<n;i++){
        p[P(road.find(i), train.find(i))]++;
    }
    for(int i=0;i<n;i++){
        cout << p[P(road.find(i), train.find(i))] << " ";
    }
    cout << endl;
}


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

#define D_MAX 1000000000
#define N_MAX 100000
#define M_MAX 10000

int d;
int n;
int m;

int ad[N_MAX+1];
int ak[M_MAX+1];
int temp[N_MAX+1]; 
/*
void MergeSort(int array[],int left,int right){
  int awork[N_MAX+1];
  int mid;
  int i;
  int j;
  int x;
  int y;
  
  if( left >= right ){
    return;
  }
  
  mid = (left + right) / 2;
  MergeSort( array, left, mid);
  MergeSort( array, mid+1, right);
  
  for( i=left; i<=mid; i++){
    awork[i] = array[i];
  }
  
  j = right;
  for( i=mid+1; i<=right; i++){
    awork[i] = array[j];
    j--;
  }
  
  x = left;
  y = right;
  
  for( i=left; i<=right; i++){
    if(awork[x] <= awork[y]){
      array[i] = awork[x];
      x++;
    }else{
      array[i] = awork[y];
      y--;
    }
  }
}
*/

 /* 配列 x[ ] の left から right の要素のマージソートを行う */
void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;

    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */
    
      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (temp[i] <= temp[j])        /* ここでソートされる */
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
}

int calcDist(int k){
  int i;
  int diff;
  int preDiff = 0;
  int minDist = d;
  int tmpDist;
  int halfDist = d >> 1;
  
  for( i=0; i<=n; i++){
    diff = ad[i] - k;
    if( minDist > abs(diff) ){
      minDist = abs(diff);
    }
    /*
    if( (diff * preDiff) < 0 ){
      break;
    }
    */
    preDiff = diff;
  }
  return minDist;
}

void input(void){
  int i;
  scanf("%d",&d);
  if( d != 0){
    scanf("%d",&n);
    scanf("%d",&m);
    ad[0] = 0;
    for( i=1; i<=n-1; i++){
      scanf("%d",&ad[i]);
    }
    ad[n] = d;
    for( i=1; i<=m; i++){
      scanf("%d",&ak[i]);
    }
  }
}

int main(void){
  int i;
  int sumDist = 0;
  while( 1 ){
    input();
    if( d == 0 ){
      break;
    }
    MergeSort( ad, 0, n);
    for( i=1; i<=m; i++){
      sumDist += calcDist(ak[i]);
    }
    printf("%d\n",sumDist);
    sumDist = 0;
  }
}




Measured memory_bytes: 2508
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define vll vector<ll>
#define sz size()
#define pb emplace_back
#define mp make_pair
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL))
const int N = 100005;

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=a+b+c;
    if(ans<22)
    cout<<"win";
    else
    cout<<"bust";
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

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

	rep(i, n) {
		in(a);
		cnt += a;
	}

	out(cnt >= h ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int N, M;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];
    cin >> M;
    vector<string> T(M);
    REP(i, M) cin >> T[i];

    int ans = 0;

    REP(i, N) {
        int scr = 0;
        REP(j, N) if (S[i] == S[j]) scr++;
        REP(j, M) if (S[i] == T[j]) scr--;
        ans = max(ans, scr);
    }

    cout << ans << endl;

    return 0;
}

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, a, b) for (int i = a; i <= (int)(b); i++)
#define FORD(i, a, b) for (int i = a; i >= (int)(b); i--)

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
using Lint = long long;
#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define PB push_back
#define MP make_pair
using P=pair<int, int>;
using V=vector<double>;
using M=map<int, int>;
using S=set<int>;
#include <math.h>
#define COUT(x) cout << (x) << endl
#define SCOUT(x) cout << (x) << " "

#define DUMP(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
template <class T>bool chmax(T &a, const T &b){if (a < b){a = b;return 1;}return 0;}
template <class T>bool chmin(T &a, const T &b){if (b < a){a = b;return 1;}return 0;}
/* vector<T>のイテレータはvector<T>::iterator型
vector<int>::iterator it = vc.begin();  // begin()はvectorの最初の要素を指すイテレータを返す
vector<int>::iterator endIt = vc.end(); // end()はvectorの終端位置を指すイテレータを返す
while (it != endIt)
{
  cout << *it << '\n'; // イテレータの指す要素は、ポインタのように*演算子でアクセス
  it++;                // インクリメントすることで次の要素を指します。
}
}*/
int main(){
int n,d,cnt=0;
cin >> n>>d ;
  vector<double> x(n),y(n);
REP(i,n) {cin >> x[i]>>y[i];
         }
  REP(i,n){
    double a= (double)(sqrt((x[i]*x[i]+y[i]*y[i])));
  	if(d>=a ){
  		cnt++;
     // cout<<(x[i])/2<<endl;
  	}
 //   COUT(a);
  }
  COUT(cnt);
}


Measured memory_bytes: 6424
n = int(input())
s = [input() for i in range(n)]
d = {}
c = 0

for i in s:
  tmp = "".join(sorted(i))
  if tmp not in d:
    d[tmp] = 0
  else:
    d[tmp] += 1
  c += d[tmp]
  
print(c)

Measured memory_bytes: 24976
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


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

    V(V(P)) ev(N);
    rep(i, N) {
        int a;
        cin >> a;
        rep(j, a) {
            int x, y;
            cin >> x >> y;
            ev[i].pb(P(x, y));
        }
    }

    int res = 0;
    rep(i, 1<<N) {
        int temp = 0;
        bool can = true;
        for(int j=0; j<N; j++) {
            if(i&(1<<j)) {
                temp++;
                rep(k, ev[j].size()) {
                    if(ev[j][k].se) {
                        if(!(1<<(ev[j][k].fi-1)&i)) {
                            //cout << "A" << endl;
                            can = false;
                            break;
                        }
                    } else {
                        if((1<<ev[j][k].fi-1)&i) {
                            can = false;
                            break;
                        }
                    }
                }        
            } 
            if(!can) break;
        }
        //cout << i << temp << endl;
        if(can) res = max(res, temp);
    }

    cout << res << endl;
    
    return 0;
}

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

int main() {
  rep(i, 5) {
    int a;
    cin >> a;
    if (a == 0)
      cout << i + 1 << endl;
  }
}

Measured memory_bytes: 3604
using System;

namespace _2_D {
    class Program {
        static void Main (string[] args) {
            var input = Console.ReadLine ().Split ();
            var W = Convert.ToInt32 (input[0]);
            var H = Convert.ToInt32 (input[1]);
            var x = Convert.ToInt32 (input[2]);
            var y = Convert.ToInt32 (input[3]);
            var r = Convert.ToInt32 (input[4]);

            if ((x + r <= W && x - r >= 0) && (y + r <= H && y - r >= 0)) {
                Console.WriteLine ("Yes");
            } else {
                Console.WriteLine ("No");
            }
        }
    }
}


Measured memory_bytes: 18120
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,m,a,b;
	cin>>n>>m>>a>>b;
	int num[n],num1[m];
	for(int i=0;i<n;i++)
		cin>>num[i];
	for(int j=0;j<m;j++)
		cin>>num1[j];
	sort(num,num+n);
	sort(num1,num1+m);
	for(int i=num[n-1]+1;i<=num1[0];i++){
		if(i>a && i<=b){
			cout<<"No War";
			return 0;
		}
	}
	cout<<"War";
	return 0;
}

Measured memory_bytes: 256
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}

int gcd (int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm (int a, int b) {
    return (a / gcd (a, b)) * b;
}

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int par[maxx];
int Find(int x) {
    return par[x] < 0 ? x : (par[x] = Find(par[x]));
}
void Union(int x, int y) {
    x = Find(x), y = Find(y);
    if (x == y) return;
    if (-par[x] < -par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
}

int arr[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    memset(par, -1, sizeof(par));
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    for (int i = 1; i <= m; i++) {
        int a, b; cin >> a >> b;
        Union(a, b);
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (Find(arr[i]) == Find(arr[arr[i]])) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second 

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

double cost[22][22];
double tlimit[22];
int xx[22];
int cx[22], cy[22];
int n;

bool DFS(int pos, int vis, double dis){
	if(vis == ((1<<(n+1))-1))return true;
	//枝狩り
	FOR(i, 1, n+1)if((vis&xx[i])==0 && (dis+cost[pos][i] > tlimit[i]+EPS))return false;
	FOR(i, 1, n+1){
		if((vis&xx[i])==0 && (dis+cost[pos][i]+EPS < tlimit[i])){
			if(DFS(i, vis|xx[i], dis+cost[pos][i])){
				return true;
			}
		}
	}
	return false;
}

int main(){
	REP(i,22)xx[i] = 1<<i;
	while(1){
		int dx,dy;
		cin>>n>>cx[0]>>cy[0]>>dx>>dy;
		if(n==0)return 0;
		FOR(i,1,n+1)cin >> cx[i] >> cy[i];
		REP(i, n+1){
			tlimit[i] = sqrt(pow(cx[i]*1.0-dx*1.0,2.0)+pow(cy[i]*1.0-dy*1.0,2.0));
			REP(j,n+1){
				cost[i][j] = sqrt(pow(cx[i]*1.0-cx[j]*1.0,2.0)+pow(cy[i]*1.0-cy[j]*1.0,2.0));
			}
		}
		if(DFS(0, 1, 0.0))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if ( a == b ) {
    cout << a + b << endl;
  } else if ( a > b ) {
    cout << a * 2 - 1 <<endl;
  } else {
    cout << b * 2 - 1 << endl;
  }
}

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

bool isPrime(long long num) {
    if (num == 2) {
        return true;
    }
    if (num % 2 == 0) {
        return false;
    }
    for (long long i = 2; i * i <= num; i++) {
        if (num % i == 0) {
            return false;
        }
    }
    return true;
}

void solve(long long X) {
    for (long long i = X;; i++) {
        if (isPrime(i)) {
            cout << i << endl;
            return;
        }
    }
}

// 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)
int main() {
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	int n,k,i,ans=0;cin>>n>>k;ans=n;
	vector<int>kosu(n);
	for(i=0;i<n;i++){
		int q;cin>>q;
		kosu[q-1]++;
	}
	sort(kosu.rbegin(),kosu.rend());
	for(i=0;i<k;i++){ans-=kosu[i];}
	cout<<ans<<endl;
	return 0;
}

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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

//AGC33 C
template<class E>
struct treediameter{
	const vvc<E>&g;
	int r1,r2;
	vi d1,d2;
	int dia;
	void dfs(int v,int p,int cur,vi&d){
		d[v]=cur;
		for(auto e:g[v])if(e!=p)
			dfs(e,v,cur+1,d);
	}
	treediameter(const vvc<E>&gg):g(gg),d1(g.size()),d2(g.size()){
		dfs(0,-1,0,d1);
		r1=max_element(all(d1))-d1.bg;
		dfs(r1,-1,0,d1);
		r2=max_element(all(d1))-d1.bg;
		dfs(r2,-1,0,d2);
		dia=d1[r2];
	}
};

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	
	int n;cin>>n;
	vvc<int> g(n);
	rep(_,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	int dia=treediameter<int>(g).dia+1;
	if(dia%3!=2)
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;
}


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

#define  int        long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int n,x,y;
    cin>>n;
    int a[n],b[n];
    f(i,0,n-1)
        cin>>a[i]>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    if(n%2)
        x=b[n/2]-a[n/2]+1;
    else
        x=b[n/2]+ b[n/2-1] - a[n/2] - a[n/2 -1]+1;
        
    if(x<0)
            x=1;
    cout<<x;
}

Measured memory_bytes: 6772
a , b = map(int , input().split())
 
def fun(a,b):
    adds = a+b
    subs = a-b
    muls = a*b
 
    if adds > subs:
        if adds > muls:
            return adds
        else:
            return muls
    else:
        if subs > muls:
            return subs
        else:
            return muls
 
#a,b = -13,3
 
print(fun(a,b))

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

using namespace std;

bool cmp(pair<int, int> &a, pair<int, int> &b) {
    return atan2(a.second, a.first) < atan2(b.second, b.first);
}

int main ()
{
    int n;
    cin >> n;
    vector<pair<int, int>> a;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        if (x || y) {
            a.emplace_back(x, y);
        }
    }
    long double ans = 0.0;
    sort(a.begin(), a.end(), cmp);
    for (int i = 0; i < (int) a.size(); i++) {
        long double curX = 0.0, curY = 0.0;
        for (int j = 0; j < (int) a.size(); j++) {
            int ind = (i + j) % a.size();
            curX += a[ind].first;
            curY += a[ind].second;
            ans = max(ans, sqrt(curX * curX + curY * curY));
        }
    }
    cout << setprecision(15) << fixed << ans;
    return 0;
}


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

int main(void) {
  ll A, B;
  cin >> A >> B;

  ll d = A + B;
  if (d % 2 == 0) {
    cout << d / 2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}

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

using namespace std;

int main()
{
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    long double ans=0;
    for(int i=0;i<n;i++){
        long double a;
        cin >> a;
        ans+=1/a;
    }
    cout << 1/ans << endl;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);
/*
class UnionFind{
private:
	std::vector<int> par; //�e
	std::vector<int> rank; //�؂̐[��

public:
	//�R���X�g���N�^
	UnionFind(int n){ 
		par.resize(n);
		rank.resize(n);
		for(int i = 0; i < n; i++){
			par[i] = i;
			rank[i] = 0;
		}

		cout << "ok" << endl;
	}
	//�؂̍������߂�
	int find(int x){
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	//x��y�̑�����W���𕹍�
	void unite(int x,int y){
		x = find(x);
		y = find(y);
		//if(x == y) return;
		//if(rank[x] < rank[y]) par[x] = y;
		//else par[y] = x;
		//if(rank[x] == rank[y]) par[x]++;
	}
	//x��y�������W���ɑ����邩�ۂ�
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	//x��������W���̗v�f��
	int size(int x) {
		return -par[find(x)];
	}
};

int main()
{
	int n,m;
	cin >> n >> m;
	vi a(m),b(m);
	rep(i,m){
		a[i]--,b[i]--;
		cin >> a[i] >> b[i];
	}
	UnionFind uni(n);
	vector<ll> ans(m);
	ans[m-1] = (ll)n*(n+1)/2;
	for(int i = m-1; i >= 1; i--){
		ans[i] = ans[i+1];
		if(uni.same(a[i],b[i])) ans[i]--;
		else{
			ans[i-1] -= (ll)uni.size(a[i])*uni.size(b[i]);
			uni.unite(a[i],b[i]);
		}
		cout << i << endl;
		cout << ans[i] << endl;
	}
	rep(i,m) cout << ans[i] << endl;
	return 0;
}*/

int main(){
	int n;
	cin >> n;
	cout << (n%2 ? n*2 : n) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pro {
    char name[100];
    int t;
} P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
    Q[tail] = x;
    tail = (tail + 1)%LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head + 1)%LEN;
    return x;
}

int min(int a,int b){
    return a < b ? a : b;
}

int main(){
    int elaps = 0,c,i,q;
    P u;
    
    scanf("%d %d",&n,&q);
    
    for(i = 1;i<=n;i++){
        scanf("%s",Q[i].name);
        scanf("%d",&Q[i].t);
    }
    head = 1;
    tail = n +1;
    
    while(head != tail){
        u = dequeue();
        c = min(q,u.t);
        u.t -= c;
        elaps += c;
        if(u.t > 0){
            enqueue(u);
        }
        else {
            printf("%s %d\n",u.name,elaps);
        }
    }
    return 0;
}




Measured memory_bytes: 11868
#include <bits/stdc++.h>
using namespace std;
int main () {
    int H, N, sum = 0;
    cin >> H >> N;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        sum += A;
    }
    if (sum >= H) {
        puts("Yes");
    }
    else {
        puts("No");
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a, b, c, d;
	int x, y;
	cin >> a >> b >> c >> d;
	x = a*b;
	y = c*d;
	if (x < y){
		cout << y << endl;
	}
	else{
		cout << x << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;
const int inf = 1e9;
int main(){
    int n; cin >> n;
    int dp[n][3], va[n][3];
    rep(i,n)rep(j,3){
        cin >> va[i][j];
        if(i == 0)dp[i][j] = va[i][j];
    }
    
    REP(i,1,n)rep(j,3){
        int ma = -1;
        rep(k,3)if(j != k)ma = max(ma, dp[i-1][k]);
        dp[i][j] = ma + va[i][j];
    }
    
    int ma = -1;
    rep(i,3)ma = max(ma, dp[n-1][i]);
    cout << ma << endl;

    //rep(i,n)rep(j,3)cout << dp[i][j] << ((j < 2)?" ":"\n");
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;

ll f(ll x) {
  ll loop = 2;
  ll res = 0;
  rep(i, 50) {
    ll cnt = (x / loop) * (loop / 2);
    ll remain = x % loop;
    cnt += max(0LL, remain - loop / 2 + 1);
    if(cnt % 2) res += pow(2, i);
    loop *= 2;
  }
  return res;
}

int main() {
  ll a, b;
  cin >> a >> b;
  --a;
  ll fa = f(a);
  // cout << fa << endl;
  ll fb = f(b);
  // cout << fb << endl;
  ll ans = fb^fa;

  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
string S;

void solve() {
    //cout.precision(10);
    int ans = 0;
    cin >> N >> S;
    for(int i = 0; i < S.size(); i++) {
        string T = S.substr(i, S.size());
        vector<int> A(T.size());
        A[0] = T.size();
        int j = 1;
        int k = 0;
        while(j < T.size()) {
            while(j + k < T.size() && T[k] == T[j+k]) k++;
            A[j] = k;
            if(k == 0) {
                j++;
                continue;
            }
            int l = 1;
            while(j + l < T.size() && l + A[l] < k) A[j+l] = A[l], l++;
            j += l;
            k -= l;
        }
        for(int m = 0; m < T.size(); m++) {
            chmax(ans, min(m, A[m]));
        }
    }
    cout << ans << endl;
    return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,t;
	cin >> n >> t;
	int ans = 0;
	int rtime = 0;
	int stime = 0;
	REP(i,n){
		int it;
		cin >> it;
		if(it >  rtime){//シャワーが止まっている。
			ans += rtime - stime;
			stime = it;
		}
		rtime = it + t;
	}
	ans += rtime - stime;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
while True:
    a,b,c=map(int,input().split())
    if a==-1 and b==-1 and c==-1:
        break
    elif a==-1 or b==-1:
        print("F")
    elif a+b>=80:
        print("A")
    elif a+b>=65:
        print("B")
    elif a+b>=50:
        print("C")
    elif a+b>=30 and c<50:
        print("D")
    elif a+b>=30 and c>=50:
        print("C")
    elif a+b<30:
        print("F")
    


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

using namespace std;
map<string, int>a, b;
int main()
{
    string x, y;
    int n, m;
    cin >> n;
    while (n--)
        cin >> x, a[x]++;
    cin >> m;
    while (m--)
        cin >> y, b[y]++;
    map<string, int>::iterator it, io;
    int sum = -1;
    for (it = a.begin(); it != a.end(); it++) {
        if (b.find(it -> first) == b.end())
            sum = max(sum, it -> second);
        else {
            io = b.find(it -> first);
            //cout << it ->second << " " << io ->second << endl;
            int x = (it -> second) - (io -> second);
            if (x > 0)
                sum = max(sum, x);
        }
    }
    if (sum == -1)
        sum = 0;
    cout << sum << endl;
    return 0;
}


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

#define F(i, a, b) for (LL i = a; i <= b; i ++)
#define G(i, a, b) for (LL i = a; i >= b; i --)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define mx(a, b) ((a) = max(a, b))
#define mn(a, b) ((a) = min(a, b))
#define mem(a, b) memset(a, b, sizeof a)
#define mec(a, b) memcpy(a, b, sizeof a)
#define sf scanf
#define pf printf

#define LL long long

using namespace std;

const LL N = 1e2 + 10;

char s[N], t[N];
LL k, Ans;

int main() {
	sf("%s %lld", s + 1, &k), mec(t, s);
	int len = strlen(s + 1);
	LL cnt = 0;
	int Lef = 1;
	while (s[Lef + 1] == s[Lef]) Lef ++;
	int Rig = len;
	while (s[Rig - 1] == s[Rig]) Rig --;
	F(i, 1, len - 1)
		if (s[i] == s[i + 1])
			cnt ++, s[i + 1] = '.';
	cnt = cnt * k;
	if (s[len] == s[1] && (Lef & 1) && ((len - Rig + 1) & 1))
		cnt += k - 1;
	if (Lef == len) {
		pf("%lld\n", k * len >> 1);
		return 0;
	}
	pf("%lld\n", cnt);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

string a[7] = {
	"Monday",
	"Tuesday",
	"Wednesday",
	"Thursday",
	"Friday",
	"Saturday",
	"Sunday"
};

int b[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };

int main() {
	for (int m, d; cin >> m >> d&&m;) {
		while (m)
			d += b[--m];
		cout << a[(d - 1 + 3) % 7] << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int a;
	cin >> a;
	string s;
	cin >> s;
	cout << (a >= 3200?s:"red") << '\n';
}


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

using namespace std;

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

    ll i,j,n,t=1,k=0,cnt=0,mini=LLONG_MAX,maxi=LLONG_MIN,ans=0;
    ll m;
    cin>>n;
    string s;
    cin>>s;
    ll e[n],w[n];
    w[0]=0,e[n-1]=0;
    rep(i,1,n)
    {
        if(s[i-1]=='W')
            w[i]=w[i-1]+1;
        else w[i]=w[i-1];
    }
    for(i=n-2;i>=0;i--)
    {
        if(s[i+1]=='E')
            e[i]=e[i+1]+1;
        else e[i]=e[i+1];
    }
    rep(i,0,n)
        mini=min(mini,e[i]+w[i]);
    ret(mini)
    return 0;

}


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

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

int main() {
  int N;
  int ans = 0;
  cin >> N;
  for(int i = 1; i <= N; i++) {
    if(i % 2 == 0) continue;
    int count = 0;
    for(int j = 1; j <= i; j++) {
      if(i%j == 0) count++;
    }
    if(count == 8) ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
import itertools

a = [3,5,7,11,13]
b = []
c = list(itertools.combinations([0, 1, 2, 3 , 4], 3))
for j in range(len(c)):
    b.append(a[c[j][0]] * a[c[j][1]] * a[c[j][2]])
c = list(itertools.combinations([0, 1, 2, 3 , 4], 2))
for j in range(len(c)):
    b.append(a[c[j][0]]**3 * a[c[j][1]])

ans = 0
for i in b:
    if n >= i:
        ans += 1
print(ans)

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

int  main(void) {
  int n;
  cin >> n;
  pair<ll, ll> sl[n];
  rep (i, n) {
    ll x, l;
    cin >> x >> l;
    sl[i] = make_pair(x + l, x - l);
  }
  sort(sl, sl + n);
  int ans = 0;
  int t = -2000000005;
  rep (i, n) {

    if (t <= sl[i].second) {
      ans++;
      t = sl[i].first;
    }

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

Measured memory_bytes: 1792
/** Bismillahir Rahmanir Rahim **/
    #include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define pb push_back
    #define endl '\n'
    #define fi first
    #define se second
    #define Fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define debug(x) cerr << #x << " "<< x << endl
     
    int main()
    {
        string s;
        cin >> s;
        for (int i = 0; i < s.size(); i++) {
            if (s[i] == '7') {
                cout << "Yes\n";
                return 0;
            }
        }
        cout << "No\n";
     
        return 0;
    }

Measured memory_bytes: 3628
s=list(map(int,input()))
lis=[]
for i in range(len(s)):
    if i%2==0:
        lis.append(0)
    else:
        lis.append(1)
cnt=0
for i in range(len(s)):
    if s[i]!=lis[i]:
        cnt+=1
print(min(cnt,len(s)-cnt))

Measured memory_bytes: 48492
l = int(input())
a = [int(input()) for _ in range(l)]

INF = float('inf')
dp = [[INF] * 5 for _ in range(l+10)]
dp[0][0] = 0

for i in range(l):
    for j in range(4):
        dp[i][j+1] = min(dp[i][j+1], dp[i][j])

    dp[i + 1][0] = min(dp[i + 1][0], dp[i][0] + a[i])
    dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + a[i] % 2 if a[i] > 0 else dp[i][1] + 2)
    dp[i + 1][2] = min(dp[i + 1][2], dp[i][2] + (a[i] + 1) % 2)
    dp[i + 1][3] = min(dp[i + 1][3], dp[i][3] + a[i] % 2 if a[i] > 0 else dp[i][3] + 2)
    dp[i + 1][4] = min(dp[i + 1][4], dp[i][4] + a[i])

ans = float('inf')
for j in range(5):
    ans = min(ans, dp[l][j])

print(ans)

Measured memory_bytes: 61468
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define start() int t;cin>>t;while(t--) 
#define pb push_back
#define mp make_pair
using namespace std;

int32_t main()
{
    int n;
    cin>>n;
    if(n%10 == 2 ||n%10 == 9 ||n%10 == 4 ||n%10 == 5 ||n%10 == 7)cout<<"hon"<<endl;
    else if(n%10 == 0 ||n%10 == 1 ||n%10 == 6 ||n%10 == 8 )cout<<"pon"<<endl;
    else cout<<"bon"<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long;
#define dbg(x) cout<<#x<<"--------------"<<x<<endl;
#define dl cout<<"LINE"<<__LINE__<<endl;
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	char s[3];
	cin>>s;
	for(int i=0;i<=2;i++){
		if(s[i]=='7'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	
	
		
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int main()
{
	ll n;
	cin>>n;
	string s;
	ll c=0;
	cin>>s;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C' && i+2<n)
			c++;
	}
	cout<<c<<"\n";
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
    }

    a.reverse();

    let ans = lis(&a, 100001);
    println!("{}", ans);
}

fn lis(v: &Vec<usize>, max_n: usize) -> usize {
    let inf = 10usize.pow(10);
    let mut dp = vec![inf; max_n];

    for i in 0..v.len() {
        let index = upper_bound(&dp, v[i]);
        dp[index] = v[i];
    }

    lower_bound(&dp, inf)
}

fn upper_bound<T>(v: &Vec<T>, n: T) -> usize 
where T: PartialEq + PartialOrd
{
    let mut left = -1;
    let mut right = v.len() as isize;
    
    while right - left > 1 {
        let mid = (left + right) / 2;
        if v[mid as usize] <= n {
            left = mid;
        } else {
            right = mid;
        }
    } 
    right as usize
}
fn lower_bound<T>(v: &Vec<T>, n: T) -> usize
where
    T: PartialEq + PartialOrd,
{
    let mut left = -1;
    let mut right = v.len() as isize;

    while right - left > 1 {
        let mid = (left + right) / 2;
        if v[mid as usize] < n {
            left = mid;
        } else {
            right = mid;
        }
    }
    right as usize
}


Measured memory_bytes: 4516
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
 
int main(){
  char c;
  cin>>c;
  cout<<char(c+1)<<endl;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

bool G[100][100];

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

    rep(i, N) {
        int u, k, v;
        cin >> u >> k;
        rep(j, k) {
            cin >> v;
            G[u-1][v-1] = true;
        }
    }

    rep(i, N) {
        rep(j, N) {
            if (j > 0) cout << " ";
            cout << G[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3080