akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
 
 
long long beki(long long a,int n)
{
  long long s=1LL;
  while(n){
    if(n%2)s=s*a;
    a=a*a;
    n/=2;
  }
  return s;
}
 
int main(void) {
  ll n,i=1;
  cin>>n;
  while(beki(3,i)<n)i++;
  cout<<i<<endl;
}

Measured memory_bytes: 3076
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
ll a[maxn];
int main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	
	sort(a+1,a+1+n);
	if(n==2){
		cout<<a[n]<<endl;
		return 0;
	}
	for(int i=1;i*2<=n;i++){
		swap(a[i],a[n-i+1]);
	} 
	ll sum = 0;
	for(int i=2;i<=n;i++){
		sum+=a[(i+1)/2];
	//	cout<<sum<<endl;
	}
	cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 5212
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    // 5->6->5 ... で点数を得る
    // 二回振れば11点得られる
    ll x;
    cin >> x;
    ll a = x/11;
    x%=11;
    ll b;
    if (x == 0) b = 0;
    else if (x <= 6) b = 1;
    else b = 2;

    cout << a*2 + b << endl;
}

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


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

void solve(long long a) {
  cout << a + a * a + a * a * a << endl;
}

int main() {
    long long a;
    scanf("%lld", &a);
    solve(a);
    return 0;
}


Measured memory_bytes: 3648
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto s = sread();
    s[0 .. $ - "FESTIVAL".length].writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 2600
n, m, k = map(int, input().split())
a_books = list(map(int,input().split()))
b_books = list(map(int,input().split()))
sum1 = [0]
sum2 = [0]
for i in range(n):
 sum1.append(sum1[-1]+a_books[i])
for i in range(m):
 sum2.append(sum2[-1]+b_books[i])
ans=0
import bisect
for i in range(n+1):
    if sum1[i] > k:
        break
    j = bisect.bisect_right(sum2, k-sum1[i])-1
    ans = max(ans, i+j)
print(ans)


Measured memory_bytes: 47540
#include <iostream>
using namespace std;
int main(){
    int n, x, odd=0;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> x;
        if(x%2==1){
            odd++;
        }
    }
    if(odd%2==0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,y;
  bool ans=false;
  cin >> x >> y;
  for(int i=0;i<=x;i++){
    if(4*i+2*(x-i)==y){
      ans=true;
      break;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}  


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

bool prime[100010];
int like[100010];

void is_prime() {
    rep(i, 100010) prime[i] = true;
    prime[0] = prime[1] = false;
    repl(i, 2, 100010) {
        if (!prime[i]) continue;
        int j = i + i;
        while(j < 100010) {
            prime[j] = false;
            j += i;
        }
    }
}

bool is_like() {
    memset(like, 0, sizeof(like));
    repl(i, 1, 100010) {
        if (i % 2 == 0) continue;
        int n = i, m = (i + 1) / 2;
        if (prime[n] && prime[m]) like[i] = 1;
    }
    repl(i, 1, 100010) like[i] += like[i - 1];
}

int main(){
    cin.sync_with_stdio(false);
    is_prime();
    is_like();
    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << like[r] - like[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include<cstdio>
#include<cstring>

int main(){
    int n;
    
    scanf("%d", &n);
    
    int count[4][14];
    memset(count, 0, sizeof(count));
    
    int number;
    char ch;
    int ch_number;
    
    for(int i = 0; i < n; i++){
        scanf(" %c %d", &ch, &number);
        if(ch == 'S') ch_number = 0;
        if(ch == 'H') ch_number = 1;
        if(ch == 'C') ch_number = 2;
        if(ch == 'D') ch_number = 3;
        count[ch_number][number]++;
    }
    
    for(int i = 0 ; i < 4; i++){
        for(int j = 1; j <= 13; j++){
            if(count[i][j] != 1){
                if(i == 0) ch = 'S';
                if(i == 1) ch = 'H';
                if(i == 2) ch = 'C';
                if(i == 3) ch = 'D';
                printf("%c %d\n", ch, j);
            }
        }
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,x;
map<ll,ll>m;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=0;i<n;i++)
{
    cin>>x;
    m[x]++;
    if(m[x]==2){
        rc("NO");
    }
}
cout<<"YES"<<endl;
}





Measured memory_bytes: 12800
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

vector<bool> sieve(int N) {
    vector<bool> ret(N+1);
    int i;
    for (int z = 1; z <= 5; z += 4) {
        for (int y = z; y*y <= N; y += 6) {
            for (int x = 1; x*x <= N and (i = 4*x*x+y*y) <= N; ++x) {
                ret[i] = !ret[i];
            }
            for (int x = y+1; x*x <= N and (i = 3*x*x-y*y) <= N; x += 2) {
                ret[i] = !ret[i];
            }
        }
    }
    for (int z = 2; z <= 4; z += 2) {
        for (int y = z; y*y <= N; y += 6) {
            for (int x = 1; x*x <= N and (i = 3*x*x+y*y) <= N; x += 2) {
                ret[i] = !ret[i];
            }
            for (int x = y+1; x*x <= N && (i = 3*x*x-y*y) <= N; x += 2) {
                ret[i] = !ret[i];
            }
        }
    }
    for (int y = 3; y*y <= N; y += 6) {
        for (int z = 1; z <= 2; ++z) {
            for (int x = z; x*x <= N && (i = 4*x*x+y*y) <= N; x += 3) {
                ret[i] = !ret[i];
            }
        }
    }
    for (int i = 5; i*i <= N; ++i) {
        if (ret[i]) {
            for (int k = i*i; k <= N; k+=i*i) {
                ret[k] = false;
            }
        }
    }
    ret[2] = ret[3] = true;

    return ret;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int X; cin >> X;
    auto table = sieve(100005);

    while (true) {
        if (table[X]) {
            cout << X << ln;
            return 0;
        }
        X++;
    }
}

Measured memory_bytes: 256
/******************************************************************************

Coder :         rajath_pai
date :          17/05/2020
Contest :       AtCoder Beginner Contest 168
problem :       A - ∴ (Therefore)
link :          atcoder.jp/contests/abc168

*******************************************************************************/
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;

#define w(x)            int x;  cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,a,b)       for(int i = a; i < b; i++)
//int tc = 0;
//printf("Case #%d: %d\n",tc,);

/*
    string binary = bitset<8>(input number).to_string(); //to binary
    cout<<binary<<"\n";

    unsigned long decimal = bitset<8>(binary).to_ulong();   //binary to decimal
    cout<<decimal<<"\n";
*/
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main(){
    FIO;
    //w(t)
       //tc++;
       cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const long double pi = acos(-1.0L);
    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double theta = 2.0 * pi * m / 60.0 - 2.0 * pi * (h / 12.0 + m / 60.0 / 12.0);
    long double ret   = a * a + b * b - 2 * a * b * cos(theta);
    cout << fixed << setprecision(15) << sqrt(ret) << "\n";
    return 0;
}

Measured memory_bytes: 4188
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;

  string s1 = "";
  for(int i = 0;i < tx - sx;i++){
    s1 += "R";
  }
  for(int i = 0;i < ty - sy;i++){
    s1 += "U";
  }
  string s2 = "";
  for(int i = 0;i < s1.size();i++){
    if(s1[i] == 'R')s2 += "L";
    else s2 += "D";
  }
  string s3 = "";
  s3 += "D";
  for(int i = 0;i < tx - sx + 1;i++){
    s3 += "R";
  }
  for(int i = 0;i < ty - sy + 1;i++){
    s3 += "U";
  }
  s3 += "L";
  string s4 = "";
  s4 += "U";
  for(int i = 0;i < tx - sx + 1;i++){
    s4 += "L";
  }
  for(int i = 0;i < ty - sy + 1;i++){
    s4 += "D";
  }
  s4 += "R";

  cout << s1 + s2 + s3 + s4 << endl;
}


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

ll solve() {
    ll N;
    string X;
    cin >> N >> X;
    ll m0 = 0;
    for ( char c : X ) if ( c == '1' ) m0++;
    vector<ll> v(2);
    for ( int k = 0; k <= 1; k++ ) {
        ll m1 = m0 + 2*k-1;
        if ( m1 <= 0 ) continue;
        ll t = 0;
        for ( int i = 0; i < N; i++ ) {
            t *= 2;
            if ( X[i] == '1' ) {
                t += 1;
            }
            t %= m1;
        }
        v[k] = t;
    }
    auto get_n = [](ll n) {
        if ( n == 0 ) return 0LL;
        ll a = 0;
        while ( n > 0 ) {
            ll p = __builtin_popcountll(n);
            n = n % p;
            a++;
        }
        return a;
    };

    vector<ll> ans(N);
    vector<ll> u(2,1);
    for ( int j = 0; j < N; j++ ) {
        int i = N-1-j;
        if ( X[i] == '0' ) {
            ll x = (v[1] + u[1]) % (m0+1);
            ans[i] = get_n(x) + 1;
        } else {
            if ( m0 == 1 ) {
                ans[i] = 0;
            } else {
                ll x = (v[0] + (m0-1) - u[0]) % (m0-1);
                ans[i] = get_n(x) + 1;
            }
        }
        if ( m0-1 > 0 ) {
            u[0] *= 2;
            u[0] %= m0-1;
        }
        u[1] *= 2;
        u[1] %= m0+1;
    }

    for ( int i = 0; i < N; i++ ) {
        cout << ans[i] << "\n";
    }
    return 0;
}

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

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

int main()
{
	int d;

	while( cin >> d ){
		for( int i = 0; i < d; ++i ){
			if( i != 0 ) cout << endl;
			int n;
			cin >> n;

			int size = n + 4;
			char* map = new char[ size * size ]();
			for( int j = 0; j < size; ++j ){
				for( int k = 0; k < size; ++k ){
					map[ j * size + k ] = ' ';
				}
			}
			for( int j = 0; j < size; ++j ){
				map[ j ] = map[ ( size - 1 ) * size + j ] = map[ size * j ] = map[ ( j + 1 ) * size - 1 ] = '#';
			}
			for( int j = 2; j < size - 2; ++j ){
				map[ j * size + 2 ] = '#';
			}
			int x = 2, y = 2;
			int dir = 1;
			int dirCount = 0;
			int straightCount = 0;
			while( dirCount < 2 ){
				map[ y * size + x ] = '#';
				++straightCount;
				int nx, ny;
				switch( dir ){
					case 0: nx = x; ny = y - 2; break;
					case 1: nx = x + 2; ny = y; break;
					case 2: nx = x; ny = y + 2; break;
					case 3: nx = x - 2; ny = y; break;
				}
				if( map[ ny * size + nx ] == '#' ){
					if( straightCount < 3 ){
						break;
					}
					dir = ( dir + 1 ) % 4;
					++dirCount;
					straightCount = 0;
					continue;
				}else{
					dirCount = 0;
				}
				switch( dir ){
					case 0: y -= 1; break;
					case 1: x += 1; break;
					case 2: y += 1; break;
					case 3: x -= 1; break;
				}
			}

			for( int p = 2; p < size - 2; ++p ){
				for( int q = 2; q < size - 2; ++q ){
					cout << map[ p * size + q ];
				}
				cout << endl;
			}

			delete[] map;
		}
	}

	return 0;
}

Measured memory_bytes: 1196
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <functional>
#include <iterator>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end())
#define PSort(x) sort(begin(x), end(x), pairCompare)
#define ll long long
#define INF 2000000000
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.14159265358979
int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
using namespace std;

int main(){	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = min(b,d) - max(a,c);
	cout << ((x < 0) ? 0 : x) << endl;
	
	return 0;
}



Measured memory_bytes: 256
#ifdef HIRO
#include "../stdc++.h"
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#include <bits/stdc++.h>
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;

int main() {
#ifdef HIRO
  string file_path(QUIZ);
  ifstream cin(file_path + "/input.txt");
  std::cin.rdbuf(cin.rdbuf());
#endif
  int n;
  int m;
  cin >> n;
  cin >> m;
  int b, s;
  
  if(n >= m) {
    b = n;
    s = m;
  }
  else if(m >= n) {
    b = m;
    s = n;
  }
  for(;b--;){
    cout << s;
  }

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



Measured memory_bytes: 384
import math

def is_prime(a):
  if a == 2:
    return 1

  if 2 > a or a % 2 == 0:
    return 0
  
  v = 3
  while v <= math.sqrt(a):
    if a % v == 0:
      return 0
    v += 2
  return 1
  
num = int(input())
count = 0
while num > 0:
  i = int(input())
  count += is_prime(i)
  num -= 1
print(count)


Measured memory_bytes: 5672
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 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 COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
int par[114514], rrank[114514];//親、木の深さ
void init(int n) {
	rep(i, n) {
		par[i] = i;
		rrank[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rrank[x] < rrank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rrank[x] == rrank[y])rrank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
signed main() {
	int h, w, n;
	cin >> h >> w >> n;
	int p = max(h, w);
	if (n % p == 0)cout << n / p << endl;
	else cout << n / p + 1 << endl;
	ggr
}


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

using namespace std;

int main(void){
//string S;
long long N, A, B;

cin >> N;
cin >> A;
cin >> B;

if((B - A - 1)%2 == 1){
  cout << (B - A)/2 << endl;
}else if((A - 1) <= (N - B)){
  cout << (B + A - 1)/2 << endl;
}else if((A - 1) > (N - B)){
  cout << (2*N - B - A + 1)/2 << endl;
}
return 0;
}


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

int main() {

	int N, M;
	cin >> N >> M;

	int H[100000];
	int good[100000];
	for (int i = 0; i < N; i++) {
		cin >> H[i];
		good[i] = 1;
	}

	int A, B;
	for (int i = 0; i < M; i++) {
		cin >> A >> B;
		if (H[A - 1] <= H[B - 1]) good[A - 1] = 0;
		if (H[A - 1] >= H[B - 1]) good[B - 1] = 0;
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (good[i] == 1) ans++;
	}
	cout << ans;

	return 0;
}


Measured memory_bytes: 4416
a=input().split()
A=int(a[0])
B=int(a[1])
K=int(a[2])
time=0

while True:
    if K == time:
        break
    else:
        time += 1
        if time % 2 == 1:
            if A % 2 == 1:
                A -=1
            A = int(A / 2)
            B += A
        else:
            if B % 2 == 1:
                B -=1
            B = int(B / 2)
            A += B

print(A, B)

Measured memory_bytes: 3064
read k;echo -e "1\n1\n1\n2\n1\n2\n1\n5\n2\n2\n1\n5\n1\n2\n1\n14\n1\n5\n1\n5\n2\n2\n1\n15\n2\n2\n5\n4\n1\n4\n1\n51"|sed -ne "$k p"

Measured memory_bytes: 796
#include <stdio.h>
 
int main(void){
    int N, i, j;
    int count = 0, flag = 1, swap;
    
    scanf("%d", &N);
    
    int A[N];
    for(i = 0; i < N; i ++) scanf("%d", &A[i]);
    
    while(flag) {
        flag = 0;
        for(j = N-1; j > 0; j --) {
            if(A[j] < A[j-1]) {
                swap = A[j];
                A[j] = A[j-1];
                A[j-1] = swap;
                count ++;
                flag = 1;
            }
        }
    }
    
    for(i = 0; i < N-1; i ++) printf("%d ", A[i]);
    printf("%d\n", A[N-1]);
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 1812
from collections import Counter
n = int(input())
s = list(input() for _ in range(n))
ls = Counter(s).most_common()
a = []
a.append(ls[0][0])
for i in range(1, len(ls)):
    if ls[i][1] == ls[0][1]:
        a.append(ls[i][0])
for i in sorted(a):
    print(i)

Measured memory_bytes: 45052
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCatSnukeAndAVoyage solver = new CCatSnukeAndAVoyage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCatSnukeAndAVoyage {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Set<Integer> p = new HashSet<>(), q = new HashSet<>();
            int n = in.nextInt(), m = in.nextInt();
            for (int i = 0; i < m; i++) {
                int a = in.nextInt();
                int b = in.nextInt();
                if (a == 1) {
                    p.add(b);
                } else if (b == n) {
                    q.add(a);
                }
            }
            p.retainAll(q);
            out.println(p.isEmpty() ? "IMPOSSIBLE" : "POSSIBLE");
        }

    }
}



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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005
#define PI 3.1415926535897932384626433832795028841971
int main()
{
    _FastIO;
    cout.precision(20);
    int a , b , h , m;
    cin >> a >> b >> h >> m;
    double d = PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);
    double ans = a * a + b * b - 2 * a * b * cos(d);
    cout << fixed << sqrtl(ans) << endl;
    return 0;
}


Measured memory_bytes: 4164
import java.util.Scanner;
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int min = 0;
		
		for (int i = 1; i > 0;) {
			if (Math.abs(a-b) <= w){
				System.out.println(min);
				break;
			}else{
				min += i;
				w++;
			}
		}
	}
}

Measured memory_bytes: 23636
#include <stdio.h>

int n, q, com, x, y, bit[131073];

void add(int i, int x)
{
    while(i <= n)
    {
        bit[i] += x;
        
        i += i & -i;
    }
}

int sum(int i)
{
    int ret = 0;
    
    while(i > 0)
    {
        ret += bit[i];
        
        i -= i & -i;
    }
    
    return ret;
}

int main()
{
    scanf("%d", &n);
    scanf("%d", &q);
    
    for(int i = 0; i < q; i++)
    {
        scanf("%d", &com);
        scanf("%d", &x);
        scanf("%d", &y);
        
        if(com == 0)
        {
            add(x, y);
        }
        else
        {
            printf("%d\n", sum(y) - sum(x - 1));
        }
    }
    
    return 0;
}

Measured memory_bytes: 3116
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
 ll n,m;sc(n);sc(m);
 vector<ll>a;
 ll b;
 if(n>=m){
  puts("0");
  return 0;
 }
 rep(i,0,m){
  sc(b);push(a,b);
 }
 sort(a);
 ans=0;
 vector<ll>c;
 rep(i,0,m-1){
  push(c,abs(a[i]-a[i+1]));
  ans+=abs(a[i]-a[i+1]);
 }
 sort(c);
 rrp(i,m-1,m-n){
  ans-=c[i];
 //cout<<ans<<" "<<c[i]<<endl;
 }
 pr(ans);
return 0;}

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

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

int main() {
	ios::sync_with_stdio(false);
	int n, k;
	int c[1000];
	cin >> n >> k;
	rep(i, k) {
		int a, b;
		cin >> a >> b;
		if(a>n/2)a=n-a+1;
		if(b>n/2)b=n-b+1;
		if(a>b) {
			int c=a;
			a=b;
			b=c;
		}
		c[i]=a%3;
		if(!c[i])c[i]=3;
	}
	rep(i, k)cout << c[i] << endl;
	return 0;
}

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

struct REST {
  string S;
  int P;
  int a;
};

bool cmp(const REST &A, const REST &B) {
  if (A.S != B.S) return (A.S<B.S);
  else return (A.P > B.P);
};

int main() {
  int N;
  cin >> N;
  vector<REST> rest(N);
  for (int i=0; i<N; i++) {
    cin >> rest.at(i).S >> rest.at(i).P;
    rest.at(i).a=i;
  }
  sort(rest.begin(), rest.end(), cmp);
  for (int i=0; i<N; i++) {
    cout << rest.at(i).a+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    map<lli,lli> m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    lli ans=1;
    m[0]=3;
    while(n--)
    {
        cin>>in;
        ans=(ans*m[in])%mod;
        del(m,in);
        m[in+1]++;
    }

    cout<<ans<<endl;

}   aryanc403();
    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(string,s);
  int cnt = 15-s.size();
  EACH(si,s){
    if(si=='o') ++cnt;
  }

  OUT((cnt>=8?"YES":"NO"))BR;
  //debug(cnt);
  return 0;
}


Measured memory_bytes: 256
from itertools import accumulate
from operator import add

N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

A1 = list(accumulate(A1,add))
A2 = list(accumulate(A2,add))
S = A2[-1]
A3 = [0] * N
A3[0] = S

ans = 0

for i in range(1,N):
  A3[i] = S - A2[i - 1]

ans = max([i + j for i,j in zip(A1,A3)])

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }
 
int main(){
    ll N;
    cin >> N;
    if (N%2==0) cout << N << "\n";
    else cout << N*2 << "\n";
}


Measured memory_bytes: 256
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.append(X)
y.append(Y)
xmax=max(x)
ymin=min(y)
if ymin<=xmax:
  print('War')
else:
  print('No War')

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>

int parent(int );
int left(int );
int right(int );

int main(){
  int T[250];
  int i,n;

  scanf("%d",&n);
  for(i=1 ; i<=n ; i++) scanf("%d",&T[i]);

  for(i=1; i<=n ; i++){
    printf("node %d: key = %d, ",i,T[i]);
    if(parent(i) >= 1) printf("parent key = %d, ",T[parent(i)]);
    if(left(i) <= n) printf("left key = %d, ",T[left(i)]);
    if(right(i) <= n) printf("right key = %d, ",T[right(i)]);
    printf("\n");
  }
  return 0;
}

int parent(int i){
  return floor(i/2);
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;

#define sync std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define loopi(n) for(int i=0;i<n;i++)
#define loopj(n) for(int j=0;j<n;j++)
#define loop(a,b,c) for(int i=a;i<=b;i=i+c)

#define     deb(x)      cout<<#x<<"="<<x<<endl
#define     all(x)      (x).begin(),(x).end()
#define     reset(a)    memset(a,0,sizeof(a))
#define     sz(x)       ((int)(x.size()))
#define     pb          push_back
#define     pf          push_front
#define     pob	        pop_back
#define     pof         pop_front
#define     ins         insert
#define     F           first
#define     S           second
#define     mkp         make_pair
#define     mkt         make_tuple
#define     bitcount(x) __builtin_popcountll(x)
#define     gcd(a,b)    (__gcd(a,b))
#define     lcm(a,b)    ((a*b)/gcd(a,b))
#define PI 3.1415926535897932384626
 
const int mod = 1e9+7;
const int N=2e5+5;
//============================================//
int ans=0;
int c;
vector<int> g[N];

void DFS(int v, bool vis[])
{
	vis[v]=true;
	c++;
	for(auto x: g[v])
		if(!vis[x])
			DFS(x,vis);
}
void solve()
{
	int n,m;
	cin>>n>>m;
	loopi(m)
	{
		int x,y;
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	}
	bool vis[n+1]={false};
	loop(1,n,1)
	{
		c=0;
		if(vis[i]==false)
			DFS(i,vis);
		ans=max(ans,c);
	}
	cout<<ans;
	
}
int main() 
{
	sync;

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
		cout<<endl;
	}
}



Measured memory_bytes: 20908
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <string>

using namespace std;

int main() {
  string S, T;
  cin >> S >> T;

  bool result = (S == T.substr(0, S.size()));
  cout << (result ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#pragma GCC optimize "trapv"
#define endl '\n'
#define fi first
#define sec second
#define pb push_back 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define INF INT_MAX
#define LINF LONG_LONG_MAX
void solve(){
	int n;
	cin>>n;
	vector<ll> ans(n+1,0);
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				int num=i*i+j*j+k*k+i*j+j*k+k*i;
				if(num<=n){ans[num]++;}
			}
		}
	}
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<endl;
	}
	return;
}
int main(){
	fio;
    int test;
    //cin>>test;
    test=1;
    while(test--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
            
        int W =sc.nextInt();
        int H =sc.nextInt();
        int x =sc.nextInt();
        int y =sc.nextInt();
        int r =sc.nextInt();

        if((0 <=x-r && x+r <=W) && (0 <=y-r && y+r <=H)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

typedef long long ll;
typedef pair<int,int> p;

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

int N, Z, W;
int a[2010];

map<int, int> dp[2][2010];
int main(){
    ios::sync_with_stdio(false);
    cin >> N >> Z >> W;
    REP(i, N) cin >> a[i];
    function<int(int, bool, int, int)> score = [&](int used, int turn, int x, int y) {
        if (used == N) return abs(x - y);
        if (turn) {
            if (dp[turn][used].count(x)) return dp[turn][used][x];
            int res = INF;
            FOR(i, used + 1, N+1) {
                res = min(res, score(i, turn^1, x, a[i-1]));
            }
            return dp[turn][used][x] = res;
        } else {
            if (dp[turn][used].count(y)) return dp[turn][used][y];
            int res = 0;
            FOR(i, used + 1, N+1) {
                res = max(res, score(i, turn^1, a[i-1], y));
            }
            return dp[turn][used][y] = res;
        }
    };
    cout << score(0, 0, Z, W) << endl;;
    
    return 0;
}



Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int n;
        Int(n);
        int a=0,w=0,tl=0,r=0;
        while(n--){
          string s;
          cin>>s;

          if(s=="AC")++a;
          if(s=="WA")++w;
          if(s=="TLE")++tl;
          if(s=="RE")++r;
        }

        printf("AC x %d\n", a);
        printf("WA x %d\n", w);
        printf("TLE x %d\n", tl);
        printf("RE x %d\n", r);

        //printf("Case %d: ",++te);
    }
    return 0;
}






Measured memory_bytes: 3724
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        int even_n = sc.nextInt();
        int odd_n = sc.nextInt();
        int a = even_n*(even_n-1) + (odd_n)*(odd_n-1);
        a /=2;
        System.out.println(a);
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {

    int X;
    cin >> X;
    int K = 0;
    int d = 0;
    while (true) {
        d += X;
        d %= 360;
        K++;
        if (d == 0) break;
    }

    cout << K << endl;
    
    return 0;
}

Measured memory_bytes: 3632
fun main(args: Array<String>) {
    var a = "War"
    val (n, m, x, y) = readLine()!!.split(" ").map { it.toInt() }
    val e = readLine()!!.split(" ").map { it.toInt() }.sortedDescending()
    val w = readLine()!!.split(" ").map { it.toInt() }.sorted()
    for(i in e[0] until w[0])if(i > x && i < y) a = "No War"
    println(a)
}


Measured memory_bytes: 37860
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int n;cin>>n;
  int pos=0;
  rep(i, n){
  	int a;cin>>a;
    if(a==pos+1)pos++;
  }
  cout<<(pos==0?-1:n-pos)<<endl;
  return 0;
}


Measured memory_bytes: 256
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;
     
using namespace std;

int q, n, w, a[maxn], b[maxn], dp[105][maxn], ans;

void solve(){    
	cin >> n >> w;

	for (int i = 1; i <= n; i++)
		cin >> a[i] >> b[i];

	for (int i = 0; i <= n; i++)
		for (int j = 1e5; j >= 0; j--)
			dp[i][j] = inf;

	dp[0][0] = 0;

	for (int i = 1; i <= n; i++){
		for (int j = 1e5; j >= 0; j--){
			dp[i][j] = dp[i - 1][j];
			if (j - b[i] >= 0)
				dp[i][j] = min(dp[i][j], dp[i - 1][j - b[i]] + a[i]);
			if (dp[i][j] <= w)
				ans = max(ans, j);
		}
		/*for (int j = 1; j <= 20; j++)
			cout << dp[i][j] << " ";
		cout << endl;	*/
		//cout << dp[i][100000] << endl;
	}

	//cout << dp[n][100000] << " ";

	/*for (int i = 0; i <= w; i++)
		cout << dp[i] << " ";
	*/
	cout << ans;
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}


Measured memory_bytes: 80128
#include <iostream>
#include <string>

using namespace std;

struct Corr {
    int right;
    int left;
    int up;
    int down;
};

int main() {
    int H, W;
    cin >> H >> W;

    string s[H];
    for(int i=0; i<H; i++) cin >> s[i];

    Corr n[H][W];

    for(int i=0; i<H; i++) {
        if(s[i][W-1]=='#') n[i][W-1].right=0;
        else n[i][W-1].right=1;
        if(s[i][0]=='#') n[i][0].left=0;
        else n[i][0].left=1;
    }

    for(int i=0; i<W; i++) {
        if(s[0][i]=='#') n[0][i].up=0;
        else n[0][i].up=1;
        if(s[H-1][i]=='#') n[H-1][i].down=0;
        else n[H-1][i].down=1;
    }

    for(int i=0; i<H; i++) {
        for(int j=1; j<W; j++) {
            if(s[i][j]=='#') n[i][j].left = 0;
            else n[i][j].left = n[i][j-1].left + 1;
        }
    }

    for(int i=1; i<H; i++) {
        for(int j=0; j<W; j++) {
            if(s[i][j]=='#') n[i][j].up = 0;
            else n[i][j].up = n[i-1][j].up + 1;
        }
    }

    for(int i=0; i<H; i++) {
        for(int j=W-2; j>=0; j--) {
            if(s[i][j]=='#') n[i][j].right = 0;
            else n[i][j].right = n[i][j+1].right + 1;
        }
    }

    for(int i=H-2; i>=0; i--) {
        for(int j=0; j<W; j++) {
            if(s[i][j]=='#') n[i][j].down = 0;
            else n[i][j].down = n[i+1][j].down + 1;
        }
    }

    int max=0;
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            int sum = n[i][j].right + n[i][j].left + n[i][j].up + n[i][j].down - 3;
            if(max < sum) max = sum;
        }
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 66816
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int ans = 0;
    long long N,D; cin >> N >> D;

    for(int i=0; i<N; i++){
        long long X,Y; cin >> X >> Y;
        long long dist = X*X + Y*Y;
        if(dist <= D*D){
            ans++;
        } 
    }
    cout << ans << endl;

}

Measured memory_bytes: 3632