akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;
int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}
int sub(int a, int b) {
    int s = a -  b;
    if (s < 0) s += mod;
    return s;
}
const int maxN = 5005;
int dp[maxN][maxN];
int n;
int m;
int pw2[maxN];
string s;
int dpStart[maxN][maxN];
void upd(int& a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n;
    pw2[0] = 1;
    for (int i = 1; i <= n; i++) pw2[i] = mult(pw2[i - 1], 2);
    cin >> s;
    m = s.size();
    dpStart[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            if (!dpStart[i][j]) continue;
            int d = dpStart[i][j];
            if (j) {
                upd(dpStart[i + 1][j - 1], d);
            }
            else {
                upd(dpStart[i + 1][j], d);
            }
            d = sum(d, d);
            upd(dpStart[i + 1][j + 1], d);
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            if (!dp[i][j]) continue;
            int d = dp[i][j];
            if (j) {
                upd(dp[i + 1][j - 1], d);
            }
            upd(dp[i + 1][j + 1], d);
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int ways = dpStart[i][0];
        // one good move
        int lft = n - i - 1;
        if (lft < m - 1) continue;
        int c = dp[lft][m - 1];
        if (!c) continue;
        int bck_space = (lft - (m - 1)) / 2;
        ans = sum(ans, mult(ways, mult(c, pw2[bck_space])));
    }
    cout << ans;
    return 0;
}

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

int main() {
  ll n,m,c=0;

  cin >> n >> m;
  vector<ll> h(n);
  vector<vector<ll>> t(n);

  rep(i,n) {
    cin >> h[i];
  }
  rep(j,m){
    ll a,b;
    cin >> a >> b;
    a--;
    b--;
    t.at(a).push_back(b);
    t.at(b).push_back(a);
  }
  rep(i,n){
    int ts = t.at(i).size();
//    cout << "ts" << ts << endl;
    if (ts == 0){
      c++;
//      cout << "c1_" << c << endl;

      continue;
    }
    bool tr = true;
    for (ll j=0;j<ts;++j){
//    cout << h[i] << " " << h[t.at(i).at(j)] << endl;

      if (h[i]<=h[t.at(i).at(j)]) tr = false;
    }
    if (tr) c++;
//      cout << "c2_" << c << endl;
  }
  cout << c << endl;
  return 0;
}

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

using namespace std;

int main()
{
  for(int k = 0; k < 3; k++){
    int a = 0, b = 0;
    for(int i = 0; i < 2; i++){
      int h, m, s;
      cin >> h >> m >> s;
      (i == 0 ? a : b) = 3600*h + 60*m + s;
    }
    cout << (b-a)/3600 << " " << (b-a)%3600/60 << " " << (b-a)%3600%60 << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

struct Mod {
	static ll gcd(ll x, ll y, ll* out_cx, ll* out_cy) {
		if (x < 0) {
			ll d = gcd(-x, y, out_cx, out_cy);
			if (out_cx) {
				*out_cx *= -1;
			}
			return d;
		}
		if (y < 0) {
			ll d = gcd(x, -y, out_cx, out_cy);
			if (out_cy) {
				*out_cy *= -1;
			}
			return d;
		}
		if (x > y) {
			return gcd(y, x, out_cy, out_cx);
		}
		if (x == 0) {
			if (out_cx && out_cy) {
				*out_cx = 0;
				*out_cy = 1;
			}
			return y;
		}
		ll q = y / x;
		ll r = y % x;
		ll d = gcd(r, x, out_cy, out_cx);
		if (out_cx) {
			*out_cx -= q * *out_cy;
		}
		return d;
	}
	static ll BASE;
	ll value = 0;
	static ll residue(ll value) { return (value % BASE + BASE) % BASE; }
	Mod()
	: value(0) {}
	Mod(ll value)
	: value(residue(value)) {}
	Mod operator+(const Mod& rhs) const { return Mod(value + rhs.value); }
	void operator+=(const Mod& rhs) { *this = *this + rhs; }
	Mod operator-(const Mod& rhs) const { return Mod(value - rhs.value); }
	void operator-=(const Mod& rhs) { *this = *this - rhs; }
	Mod operator*(const Mod& rhs) const { return Mod(value * rhs.value); }
	void operator*=(const Mod& rhs) { *this = *this * rhs; }
	Mod operator/(const Mod& rhs) const { return *this * rhs.inv(); }
	void operator/=(const Mod& rhs) { *this = *this / rhs; }
	Mod inv() const {
		if (value == 0) {
			assert(false);
			throw "[Mod::inv] div by zero";
		}
		ll ans, sub;
		ll d = Mod::gcd(value, BASE, &ans, &sub);
		if (d != 1) {
			assert(false);
			throw "[Mod::inv] not invertible";
		}
		return ans;
	}
};
ll Mod::BASE = 1000000007;

int main() {
	ll N;
	cin >> N;
	string s1;
	string s2;
	cin >> s1 >> s2;
	Mod ans = 1;
	rep(i,0,N) {
		if (s1[i] == s2[i]) {
			if (i == 0) {
				ans *= 3;
			} else {
				if (s1[i-1] == s2[i-1]) {
					ans *= 2;
				} else {
					ans *= 1;
				}
			}
		} else {
			if (i == 0) {
				ans *= 6;
			} else {
				if (s1[i-1] == s2[i-1]) {
					ans *= 2;
				} else {
					ans *= 3;
				}
			}
			i++;
		}
	}
	cout << ans.value << endl;
}


Measured memory_bytes: 256
H,W=map(int,input().split())
P=10**9+7
a=[list(input()) for i in range(H)]
dp=[[0 for i in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if (i,j)==(0,0):
            dp[i][j]=1
        elif i==0:
            if dp[i][j-1]==1 and a[i][j]==".":
                dp[i][j]=1
            else:
                dp[i][j]=0
        elif j==0:
            if dp[i-1][j]==1 and a[i][j]==".":
                dp[i][j]=1
            else:
                dp[i][j]=0
        else:
            if a[i][j]=="#":
                dp[i][j]=0
            else:
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%P
print(dp[H-1][W-1])


Measured memory_bytes: 91612
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, p[300009];
vector<int> tor, tol;

bool fun(int a, int b)
{
	if ((b - a) % 2) return false;
	for (int i = a + 1; i < b; i += 2) {
		if (p[i] != i) return false;
	}
	tor.clear(); tol.clear();
	for (int i = a; i <= b; i += 2) {
		if (p[i] > i) tor.pb(p[i]);
		else tol.pb(p[i]);
	}
	for (int i = 1; i < (int)tor.size(); i++) {
		if (tor[i] < tor[i - 1]) return false;
	}
	for (int i = 1; i < (int)tol.size(); i++) {
		if (tol[i] < tol[i - 1]) return false;
	}
	return true;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	int from = 1, mx = 0;
	for (int i = 1; i <= n; i++) {
		mx = max(mx, p[i]);
		if (mx == i) {
			if (!fun(from, i)) {
				cout << "No" << E;
				return 0;
			}
			from = i + 1;
		}
	}
	cout << "Yes" << E;
	//system("pause");
	return 0;
}


Measured memory_bytes: 2748
n, x = map(int, input().split())
m = []
sum = 0
for i in range(n):
    a = int(input())
    m.append(a)
    sum += a
m = sorted(m)
#print(m)
x -= sum

#cnt = n
#while x >= m[0]:
#    cnt += 1
#    x -= m[0]
cnt = n + x // m[0]

print(cnt)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::string;
using std::vector;
using Grid = vector<string>;

constexpr char WALL   = '.';
constexpr char PASSED = '#';

int main() {
    short H, W;
    cin >> H >> W;
    Grid A(H);
    for (string &s : A) cin >> s;

    short pass_area_count = 1;
    for (const string &s : A) {
        for (int i = 0; i < W; ++i) {
            if (s.at(i) == PASSED) pass_area_count++;
        }
    }

    if (pass_area_count > H + W)
        cout << "Impossible\n";
    else
        cout << "Possible\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	lli x;
	cin >> x;
	lli nen=1;
	lli k=100;
	while(1){
		lli rishi = k/100; 
		k += rishi;
		if(k >= x){
			cout << nen << endl;
			return 0;
		}
		nen++;
	}
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define MAXN 100005
#define eps 1e-8
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 + c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
int a[MAXN],b[MAXN],N;
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    read(N);
    for(int i = 1 ; i <= N ; ++i) read(a[i]);
    for(int i = 1 ; i <= N ; ++i) read(b[i]);
    int64 all = 0;
    for(int i = 1 ; i <= N ; ++i) {
        if(a[i] > b[i]) all += a[i] - b[i];
        else all -= (b[i] - a[i]) / 2;
    }
    if(all > 0) puts("No");
    else puts("Yes");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int s[105];
int main()
{
    int n,sum=0;
    cin>>n;
    for(int i=0;i<n;i++) cin>>s[i],sum+=s[i];
    sort(s,s+n);
    if(sum%10!=0)
    {
        cout<<sum<<endl;
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        if(s[i]%10!=0)
        {
            sum-=s[i];
            cout<<sum<<endl;
            return 0;
        }
    }
    cout<<"0"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	string s1;
	int q,t,f;
	char c;
	cin>>s1>>q;
	deque<char> s;
	for(auto x:s1){
		s.push_back(x);
	}
	bool rev = 0;
	while(q--){
		cin>>t;
		if(t==1){
			rev = !rev;
		}
		else {
			cin>>f>>c;
			if(rev==(f-1)){
				s.push_front(c);
			}
			else {
				s.push_back(c);
			}
		}
	}
	if(rev){
		reverse(all(s));
	}
	for(auto x:s){
		cout<<x;
	}
}


Measured memory_bytes: 896
import sys
n, y = map(int, input().split())
dp = [[None for j in range(n+1)] for i in range(n+1)]

if y / n > 10000:
    print('-1 -1 -1')
    sys.exit()

# if y % 1000 == 0:
#     print(0, 0, y // 1000)
#     sys.exit()

for i in range(n+1):
    if i > n or i * 10000 > y:
        break
    for j in range(n+1):
        if i + j > n or i * 10000 + j * 5000 > y:
            break
        #z = y - (10000 * i + 5000 * j)
        z = n - i - j

        # if z < 0:
        #     continue
        if i * 10000 + j * 5000 + z * 1000 == y:
            print(i, j, z)
            sys.exit()

print('-1 -1 -1')

Measured memory_bytes: 74588
#include <iostream>

using namespace std;

#define ll long long int

int main()
{
	ll n;
	
	cin>>n;
	
	ll ans=1,cur=1;
	
	while(n>0)
	{
		if(n==1)	break;
		
		ans+=2*cur;
		
		cur=cur*2;
		
		n=n/2;
	}
	
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.dat", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){
		int res = 0;
		double vb;		
		stringstream ss(str);
		ss >> vb;
		int n;

		for (n = 1;; ++n){
			int h = 5*n - 5;
			double tt = (double)h/4.9;
			double t = sqrt(tt);
			double v = 9.8*t;
//			cout << "v: " << v << endl;
			if (v < vb){
				continue;
			}else{
				res = n;
				break;
			} // end if
		} // end for

		cout << res << endl;
	} // end for

	return 0;
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b;
char c;

main() {
    cin >> a >> c >> b;
    if (c == '+') ct(a+b)
    else ct(a-b)
}



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

using namespace std;

int erase(int H, vector<vector<int>> &p)
{
    int point = 0;
    for (int i = 0; i < H; i++) {        
        for (int j = 0; j < 5; j++) {
            int num = p[i][j], nj = j;
            if (num == -1) continue;
            for (int k = j + 1; k < 5; k++) {
                if (num != p[i][k]) {
                    break;
                }
                nj = k;
            }
            if (nj - j + 1 >= 3) {
                for (int k = j; k <= nj; k++) {
                    p[i][k] = -1;
                }
                point += num * (nj - j + 1);
            }
        }
    }
    return point;
}

void drop(int H, vector<vector<int>> &p)
{
    for (int i = H-1; i > 0; i--) {
        for (int j = 0; j < 5; j++) {
            if (p[i][j] == -1) {
                int k = i;            
                while (k > 0 && p[k][j] == -1) {
                    k--;
                }
                swap(p[i][j], p[k][j]);
            }
        }
    }
}

int get_point(int H, vector<vector<int>> &p)
{
    int point = 0;
    while (1) {
        int npoint = point + erase(H, p);
        if (point == npoint) break;
        drop(H, p);
        point = npoint;
    }
    return point;
}

int main()
{
    int H;
    while (cin >> H, H) {
        vector<vector<int>> p(H, vector<int>(5));
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < 5; j++) {
                cin >> p[i][j];
            }
        }
        cout << get_point(H, p) << endl;
    }
    return 0;
}

Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=1e6+10;
const int mod=1e9+7;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a;
	cin>>a;
	int ans=a+a*a+a*a*a;
	cout<<ans<<'\n';







}


Measured memory_bytes: 3612
#include<stdio.h>

bool search(int A[], int n, int key) {
    auto i = 0;
    A[n] = key;
    while(A[i] != key) {
        i++;
    }
    return i != n;
}

int main() {
    int i, n, A[10001], q, key;
    auto sum = 0;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &key);
        if (search(A, n, key)) {
            sum++;
        }
    }
    printf("%d\n", sum);

    return 0;
}



Measured memory_bytes: 2724
while 1:
	n=input()
	if n==0:break
	for i in range(n):
		a,b,c,d,x,y,z,w=map(int,raw_input().split())
		print a*x-b*y-c*z-d*w,a*y+b*x+c*w-d*z,a*z-b*w+c*x+d*y,a*w+b*z-c*y+d*x

Measured memory_bytes: 4216
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

R = I()

print(R*2*math.pi)


Measured memory_bytes: 71676
#include<utility>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<stack>
#include<complex>
#include<cmath>
#include<iostream>
#include<set>
#include<map>
#include<sstream>
#include<fstream>
#include<climits>
#include<chrono>
#include<random>
#include<functional>
#include<regex>

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

// ??§????????°INF
const int INF = (1 << 30);
// ?¨±?????????????????
const double EPS = (1e-10);
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)


int main()
{
	cin.tie(0);
	ios::ios_base::sync_with_stdio(false);
	int N, W, H;
	cin >> N >> W >> H;
	vector<bool> w((W << 1) + 1, false), h((H << 1) + 1, false);
	int x, y, r;
	for (int i = 0; i < N; ++i) {
		cin >> x >> y >> r;
		fill(w.begin() + max(0, (x - r) << 1), w.begin() + min(W << 1, (x + r) << 1) + 1, true);
		fill(h.begin() + max(0, (y - r) << 1), h.begin() + min(H << 1, (y + r) << 1) + 1, true);
	}
	for (int j = 1; j <= (W << 1) - 1; j += 2) {
		if (w[j])continue;
		for (int k = 1; k <= (H << 1) - 1; k += 2) {
			if (!h[k]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

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

    /*Solve*/

int main(){
    ll N,M,X,Y;
    cin >> N >> M >> X >> Y;
    vector<ll> x,y;
    rep(i,N){
        ll a;
        cin >> a;
        x.push_back(a);
    }
    rep(i,M){
        ll b;
        cin >> b;
        y.push_back(b);
    }
    x.push_back(X);
    y.push_back(Y);
    sort(x.begin(),x.end(),greater<>());
    sort(y.begin(),y.end());
    
    if(x[0]<y[0]){
        cout << "No War";
    }else
        cout << "War";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main (void)
{
   char A[11],B[11],C[11];
   int a,b,c;
   scanf("%s%s%s", A, B, C);
   a=strlen(A);
   b=strlen(B);
   if (A[a-1]==B[0]&&B[b-1]==C[0])
      printf("YES\n");
   else
      printf("NO\n");
   return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main() {

	char w[123];
	int w_long, abc[26] = { 0 }, flag = 1;

	scanf("%s", &w);

	w_long = strlen(w);

	for (int i = 0; i < w_long; i++) {
		switch (w[i]) {
		case 'a':
			abc[0]++;
			break;

		case 'b':
			abc[1]++;
			break;

		case 'c':
			abc[2]++;
			break;

		case 'd':
			abc[3]++;
			break;

		case 'e':
			abc[4]++;
			break;

		case 'f':
			abc[5]++;
			break;

		case 'g':
			abc[6]++;
			break;

		case 'h':
			abc[7]++;
			break;

		case 'i':
			abc[8]++;
			break;

		case 'j':
			abc[9]++;
			break;

		case 'k':
			abc[10]++;
			break;

		case 'l':
			abc[11]++;
			break;

		case 'm':
			abc[12]++;
			break;

		case 'n':
			abc[13]++;
			break;

		case 'o':
			abc[14]++;
			break;

		case 'p':
			abc[15]++;
			break;

		case 'q':
			abc[16]++;
			break;

		case 'r':
			abc[17]++;
			break;

		case 's':
			abc[18]++;
			break;

		case 't':
			abc[19]++;
			break;

		case 'u':
			abc[20]++;
			break;

		case 'v':
			abc[21]++;
			break;

		case 'w':
			abc[22]++;
			break;

		case 'x':
			abc[23]++;
			break;

		case 'y':
			abc[24]++;
			break;

		case 'z':
			abc[25]++;
			break;
		}
	}

	for (int i = 0; i < 26; i++) {
		if (abc[i] % 2 != 0) {
			flag = -1;
			break;
		}
	}

	if (flag == 1) { printf("Yes"); }
	else { printf("No"); }

	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
using namespace std;
int n,K,used[120][120];

int main(){
	scanf("%d%d",&n,&K);
	if(K>(n-1)*(n-2)/2){puts("-1");return 0;}
	int kk=(n-1)*(n-2)/2-K;
	cout<<kk+(n-1)<<endl;
	for(int i=2;i<=n;i++)cout<<1<<" "<<i<<endl;
	int x=2,y=3;
	while(kk){
		cout<<x<<" "<<y<<endl;
		kk--;
		y++;
		if(y>n)x++,y=x+1;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a,b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
  ll N,an=999999999;
  cin>>N;
 for(ll i=1;i<N;i++){
   ll c=i;
   ll d=0;
   rep(j,5){
     d+=c%10;
     c/=10;
   }
   c=N-i;
   rep(j,5){
     d+=c%10;
     c/=10;
   }
   
   an=min(an,d);
   
   
 }

cout<<an<<endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int comp(const int &a,const int &b)
{
  return a>b;
}
int main()
{
  int n;
  long long sum=0;
  cin>>n;
  vector<int>a(n);
  vector<int>b(n);
  vector<int>c;
  int count=0;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n;i++)
  {
    if(a[i]<b[i])
    {
		sum+=(b[i]-a[i]);
      	count++;
    }
  	if(a[i]>b[i])c.push_back(a[i]-b[i]);
  }
  sort(c.begin(),c.end(),comp);
  int p=0;
  int flag=0;
  while(sum>0)
  {
    sum-=c[p++];
    if(sum>0 && p==c.size())
    {
      flag=1;
      cout<<-1<<endl;
      break;
    }
  }
  if(!flag)cout<<count+p<<endl;
  return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(){
	int c,n,i,j,k,count;
	int x,y,w,h;
	long int x1,y1;
	
	scanf("%d\n",&c);
	
	for(i=0;i<c;i++){
		count = 0;
		scanf("%d %d %d %d\n",&x,&y,&w,&h);
		scanf("%d\n",&n);
		
		for(j=0;j<n;j++){
			scanf("%ld %ld\n",&x1,&y1);
			if(x1>=x&&x1<=(x+w)&&y1>=y&&y1<=(y+h)){
				count++;
			}
		}
		printf("%d\n",count);
	}
	
	
	return 0;
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
int main() {
    int n,ans = 0;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    for (int i = 0; i < n; ++i) {
        int cur = 0;
        while(a[i] == a[i+1]){
            cur++;
            i++;
        }
        if(cur %2 == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    int vec[] = {a, b, c, d, e};
    for (int i = 0; i < 5; ++i)
    {
        for (int j = 0; j < 5; ++j)
        {
            if (vec[j] - vec[i] > k)
            {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  int[] a = new int[200];
  int top;

  Main(){
    top = 0;
  }

  void push(int x){
    a[++top] = x;
  }

  int pop(){
    return a[top--];
  }

  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    String[] input = stdIn.nextLine().split(" ");
    Main stack = new Main();

    for(int i = 0; i < input.length; i++){
      String s = input[i];

      if(s.equals("+")){
        int a = stack.pop();
        int b = stack.pop();
        stack.push(a + b);
      }
      else if(s.equals("*")){
        int a = stack.pop();
        int b = stack.pop();
        stack.push(a * b);
      }
      else if(s.equals("-")){
        int b = stack.pop();
        int a = stack.pop();
        stack.push(a-b);
      }
      else
        stack.push(Integer.parseInt(s));

    }


    System.out.println(stack.pop());
  }
}

Measured memory_bytes: 26148
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll d,t,s;
    cin>>d>>t>>s;
    ll d0=s*t;
    if(d0>=d)
    {
        cout<<"Yes\n";
    }
    else cout<<"No\n";
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m), asum(n+1, 0), bsum(m+1, 0);
  rep(i, n){
    cin >> a[i];
    asum[i+1] = asum[i] + a[i];
  }
  rep(i, m){
    cin >> b[i];
    bsum[i+1] = bsum[i] + b[i];
  }
  
  ll ans = 0;
  rep(i, n+1){
    if (k < asum[i]) break;
    auto itr = upper_bound(bsum.begin(), bsum.end(), k - asum[i]);
    ans = max(ans, i + (itr - bsum.begin()) - 1);
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 9596
main :: IO()
main = do
  sx:sxs:_ <- lines <$> getContents
  let x = (read $ last $ words sx) in
    let xs  = (map (\y -> abs((x::Int) - ((read y):: Int)) :: Int) $ words sxs) :: [Int] in
      putStrLn $ show $ foldl1 gcd xs


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

using namespace std;

typedef long long ll;

const ll M=1e9+7;

ll myPow(ll a,ll n)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1)
        {
            ans=ans*a%M;
        }
        a=a*a%M;
        n>>=1;
    }
    return ans;
}

int main()
{
    int n,k;
    while(cin>>n>>k)
    {
        cout<<myPow(k,n)<<endl;
    }

    return 0;
}



Measured memory_bytes: 3104
n = int(input())
enda = 0
startb = 0
ba = 0
ans = 0
for i in range(n):
    s = input()
    if s[0] == "B" and s[-1] == "A":
        ba += 1
    elif s[0] == "B":
        startb += 1
    elif s[-1] == "A":
        enda += 1
    ans += s.count("AB")
if enda + startb > 0:
    print(ans + ba + min(startb, enda))
else:
    print(ans + max(0, ba - 1))

Measured memory_bytes: 3064
<?php
  fscanf(STDIN,"%d",$n);
  $a = preg_split("/ /",trim(fgets(STDIN)));
  $b = preg_split("/ /",trim(fgets(STDIN)));
  $count = 0;
  for($i=$n-1;$i>=0;$i--){
    if($b[$i]>=$a[$i+1]){
      $b[$i] = $b[$i]-$a[$i+1];
      $count += $a[$i+1];
      if($b[$i]>=$a[$i]){
        $count += $a[$i];
        $a[$i] = 0;
      }else{
        $a[$i] = $a[$i] - $b[$i];
        $count += $b[$i];
      }
    }else{
      $count += $b[$i];
      $b[$i] = 0;
    }
  }
  echo($count);

Measured memory_bytes: 39644
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    string s;
    cin >> s;
    int a, z;
    bool flagA = false;
    for (int i = 0; i < s.size(); i++) {
        if(s[i] == 'A' && !flagA){
            a = i;
            flagA = true;
        }
        if(s[i] == 'Z') z = i;
    }
    cout << z - a + 1 << endl;
    return 0;
}


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

void chmin(int &x, int y){ x = min(x, y); }

int solve(string a, string b, int ci, int ce, int cs, int cr){
	const int INF = 1010101010;

	int la = a.size();
	int lb = b.size();
	vector<vector<int> > dp;
	int ans = INF;
	for(int k = 0; k < la; ++k){
		dp.assign(la + 1, vector<int>(lb + 1, INF));
		dp[0][0] = 0;
		for(int i = 0; i <= la; ++i)
		for(int j = 0; j <= lb; ++j){
			if(i < la){
				int t = i < la - k ? ce : ce - cr;
				chmin(dp[i + 1][j], dp[i][j] + t);
			}
			if(j < lb){
				chmin(dp[i][j + 1], dp[i][j] + ci);
			}
			if(i < la && j < lb){
				int t = a[i] == b[j] ? 0 : cs;
				chmin(dp[i + 1][j + 1], dp[i][j] + t);
			}
		}
		chmin(ans, dp[la][lb] + k * cr);
		rotate(a.begin(), a.begin() + 1, a.end());
	}
	return ans;
}

int main(){
	string a, b;
	int ci, ce, cs, cr;
	while(cin >> a >> b >> ci >> ce >> cs >> cr){
		cout << solve(a, b, ci, ce, cs, cr) << endl;
	}
}


Measured memory_bytes: 3208
n, m = map(int, input().split())
hole = [0] * (n+10)
for i in range(m): hole[int(input())] = 1

dp = [0] * (n+10)
dp[0] = 1

for i in range(1, n+1):
    if hole[i]: dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[n])

Measured memory_bytes: 7668
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var nm = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            var ab = new long[nm[1], 2];
            var nodes = new List<long>[nm[0]];

            for(int i = 0; i < nodes.Length; i++) {
                nodes[i] = new List<long>();
            }

            for (int i = 0; i < nm[1]; i++) {
                var d = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
                ab[i, 0] = d[0] - 1;
                ab[i, 1] = d[1] - 1;
                nodes[d[0] - 1].Add(d[1] - 1);
                nodes[d[1] - 1].Add(d[0] - 1);
            }
            var num = 0;
            for(int i = 0; i < nm[1]; i++) {
                if(DFS(nodes, nodes.Length, ab[i, 0], ab[i, 1])) {
                    num++;
                }
            }

            Console.WriteLine(nm[1] - num);

            Console.Out.Flush();
        }

        public static bool DFS(List<long>[] maps, int nodes, long removeA, long removeB)
        { 
            var reachMaps = new bool[nodes];
            DFSCore(0, maps, reachMaps, removeA, removeB);

            foreach(var isReached in reachMaps) {
                if(isReached == false) {
                    return false;
                }
            }

            return true;
        }

        public static void DFSCore(long nodeIndex, List<long>[] maps, bool[] reachMaps, long removeA, long removeB)
        {
            if(reachMaps[nodeIndex] == false) {
                reachMaps[nodeIndex] = true;
                foreach(var next in maps[nodeIndex]) {
                    if (nodeIndex == removeA && next == removeB) {
                        continue;
                    }
                    if (nodeIndex == removeB && next == removeA) {
                        continue;
                    }

                    DFSCore(next, maps, reachMaps, removeA, removeB);
                }
            }
        }
    }
}


Measured memory_bytes: 13268
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = int(input())
ans = []
while n > 0:
    a = (n-1) % 26
    ans.append(chr(a + ord("a")))
    n = (n-1)//26

print("".join(ans[::-1]))


Measured memory_bytes: 68080
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int i = 1;
		do {
			int x = i;
			if (x % 3 == 0) {
				System.out.printf(" " + i);
			} else {
				while (true) {
					if (x % 10 == 3) {
						System.out.printf(" " + i);
						break;
					}
					x /= 10;
					if (x != 0)
						continue;
					else
						break;
				}
			}
		} while (++i <= n);

		System.out.println();
	}
}

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

int main(void)
{
    int n, m;
    cin >> n >> m;
    int h[n];
    for(int i = 0; i < n; i++)
        cin >> h[i];
    bool good[n];
    for(int i = 0; i < n; i++)
        good[i] = true;
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        --a; --b; //Using 0-based indexing.
        if(h[a] <= h[b])
            good[a] = false;
        if(h[b] <= h[a])
            good[b] = false;
    }
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        ans += good[i];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4132
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int dp[1010][10010];

int main(){
    int h, n;
    scanf("%d%d", &h, &n);
    vector<int> a(n), b(n);
    rep(i, n) scanf("%d%d", &a[i], &b[i]);
    rep(i, n+1)rep(j, h+1) dp[i][j]=mod;
    dp[0][0]=0;
    rep(i, n)rep(j, h+1)if(dp[i][j]<mod){
        chmin(dp[i+1][j], dp[i][j]);
        int k = min(h, j+a[i]);
        chmin(dp[i][k], dp[i][j]+b[i]);
    }
    printf("%d\n", dp[n][h]);
}

Measured memory_bytes: 39424
#include <iostream>
#include<string> 
#define maxn 1000000
 
using namespace std;
 
int paint[110][110];
int main()
{
    int h,w,n,x=0;
    cin>>h>>w>>n;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        for(int j=0; j<a[i]; j++)
        {
            if((x/w)%2==0) paint[x/w][x%w]=i+1;
            else paint[x/w][w-(x%w)-1]=i+1;
            x++;
        }
    }
    for(int i=0; i<h; i++)
    {
        for(int j=0; j<w; j++)
        {
            if(j==w-1) printf("%d\n",paint[i][j]);
            else printf("%d ",paint[i][j]);
        }
    }
    return 0;
} 

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

using ll = long long;

int N;
string S;

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

  cin >> N >> S;
  unordered_set<int> bidx;
  ll res = 0;
  ll bcnt = 0;
  for (int i = 0; i < N; ++i) {
    if (S[i] == 'B') {
      bidx.insert(i);
      ++bcnt;
    }
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      if (S[i] == 'R' && S[j] == 'G') {
        res += bcnt;
        res -= (bidx.find(max(i, j) + abs(i - j)) != bidx.end());
        res -= (bidx.find(min(i, j) - abs(i - j)) != bidx.end());
        if (abs(i - j) % 2 == 0) {
          res -= (bidx.find(min(i, j) + abs(i - j) / 2) != bidx.end());
        }
      }
    }
  }
  cout << res << '\n';
}

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

const int INF = 1<<30;

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

    int l[n];
    for(int i = 0; i < n; i++)  l[i] = INF;

    for(int i = 0; i < n; i++){
        cin >> a;
        *(lower_bound(l, l+n, a)) = a;
    }

    cout << (lower_bound(l, l+n, INF))-l << endl;

    return 0;
}


Measured memory_bytes: 3484
/**
 *	author: Bektemir Srazhdinov
 *	created: 29.09.2017
**/
#include <iostream>
#include <string>
using namespace std;
const int N=1234567;
int main()
{
    long long a,b;
    cin>>a>>b;
    cout<<(a*a)-b<<endl;
 	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	vint a(n), b(n);
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	double ans1 = 0;
	rep(i, n) {
		ans1 += abs(a[i] - b[i]);
	}
	printf("%.15f\n", ans1);
	double ans2 = 0;
	rep(i, n) {
		ans2 += pow(a[i] - b[i], 2);
	}
	printf("%.15f\n", (double)pow(ans2, (double)1 / 2));
	double ans3 = 0;
	rep(i, n) {
		ans3 += pow(abs(a[i] - b[i]), 3);
	}
	printf("%.15f\n", (double)pow(ans3, (double)1 / 3));
	double ans4 = 0;
	rep(i, n) {
		ans4 = max(ans4, (double)abs(a[i] - b[i]));
	}
	printf("%.15f\n", ans4);
	return 0;
}


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

using ld = long double;

int main() {
    int N;
    cin >> N;
    vector<ld> x(N), y(N);
    for(int i=0; i<N; ++i) {
        cin >> x[i] >> y[i];
    }
    if(N & 1) {
        cout << "NA" << endl;
        return 0;
    }
    bool ok = true;
    ld cx = (x[0] + x[N/2]) / 2, cy = (y[0] + y[N/2]) / 2;
    for(int i=0; i<N; ++i) {
        ok &= (x[i] + x[(N/2+i)%N]) / 2 == cx && (y[i] + y[(N/2+i)%N])/2 == cy;
    }
    if(ok) {
        cout << fixed << setprecision(10) << cx << ' ' << cy << endl;
    } else {
        cout << "NA" << endl;
    }
}

Measured memory_bytes: 3204
n = int(input())

def check(num):
    for i in range(2, 33):
        j = i * i
        while j < num:
            j *= i
        else:
            if j == num:
                return True
    return False

if n == 1:
    print(1)
    exit()

while True:
    if check(n):
        print(n)
        exit()
    n -= 1
    if n == 1:
        break

print(1)


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

using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back


typedef long long ll;
typedef long double ld;


const ll inf = 2e9;
const ll base = 998244353;
ll mod = 1e9 + 7;




int main() {
//    srand(time(NULL));
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    auto start = clock();


    int n; cin >> n;
    vector<ll> a(n);
    for (int  i = 0; i < n; ++i) cin >>a[i];
    map<ll, ll> cnt;
    for (auto c : a) {
        ll cur = 0;
        while (c > 0) {
            cnt[cur] += c & 1;
            c /= 2 ;
            ++cur;
        }
    }
    ll ans = 0;
    for (auto c : cnt) {
        ll key = c.first;
        ll val = c.second;

        ans += (((1LL << key) % mod)  * ((val * (ll(n) - val)) %  mod)) % mod;
        ans %= mod;
    }
    cout << ans  << endl;


    std::cerr << double(clock() - start) / CLOCKS_PER_SEC << std::endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, M;
  cin >> N >> M;
  cout << ((N == M) ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		
		int c=a+b,d=a*b;
		
		if (c==15){
			System.out.println("+");
		}else if (d==15){
			System.out.println("*");
		}else{
			System.out.println("x");
		}
		
	}
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long X){
    lint x, y;
    for(x = -2000; x <= 2000; x++){
        for(y = -2000; y <= 2000; y++){
            if ( (x*x*x*x*x - y*y*y*y*y) == X){
                cout << x << " " <<  y << endl;
                return;
            }
        }
    }
}

int main(){

    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}



Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define int long long int
void test()
{
    int n;
    cin>>n;
    int temp=n;
    int sum=0;
    while(n!=0)
    {
        sum+=n%10;
        n=n/10;
    }
    cout<<((temp%sum)?"No":"Yes")<<endl;
}
int32_t main()
{

    int t = 1;
    // cin >> t;
    while (t--)
    {
        test();
    }

    return 0;
}

Measured memory_bytes: 256
fn main(){
  let xy: Vec<i32> = read_vec();
  let x = xy[0];
  let y = xy[1];
  let a = 4 * x - y;
  let b = y - 2 * x;

  println!("{}", if a % 2 == 0 && b % 2 == 0 && a >= 0 && b >= 0 {"Yes"} else {"No"});
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}


Measured memory_bytes: 2080
# import sys
# import math #sqrt,gcd
# import decimal
import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    k = int(input())
    q = queue.Queue()
    for i in range(1,10):
        q.put(i)
    while not q.empty():
        x = q.get()
        k -= 1
        if k==0:
            print(x)
            return
        if x%10==0:
            q.put(x*10+(x%10))
            q.put(x*10+(x%10+1))
        elif x%10==9:
            q.put(x*10+(x%10-1))
            q.put(x*10+(x%10))
        else:
            q.put(x*10+(x%10-1))
            q.put(x*10+(x%10))
            q.put(x*10+(x%10+1))
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 13144
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}

void YNout(bool check){
	if(check)cout << "Yes" << endl;
	else cout << "No" << endl;
}

signed main(){
	ll n,cnt = 0;
	string s;
	
	cin >> n >> s;
	
	rep(i,0,n)if(s[i] == 'R')cnt++;
	
	YNout(cnt > n-cnt);
	return 0;

}


Measured memory_bytes: 256