akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var n = nk[0];
            var k = nk[1];

            var rsp = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var hands = Console.ReadLine().ToArray();
            var result = 0;
            for (var i = 0; i < 3; i++)
            {
                Calc(i);
            }

            Console.WriteLine(result);
            void Calc(int index)
            {
                var winHand = ' ';
                switch (index)
                {
                    case 0:
                        winHand = 's';
                        break;
                    case 1:
                        winHand = 'p';
                        break;
                    case 2:
                        winHand = 'r';
                        break;
                };
                var lastIndex = -k - 1;
                var indexes = new HashSet<int>();
                for (var i = 0; i < n; i++)
                {
                    if (hands[i] == winHand && !indexes.Contains(i - k))
                    {
                        result += rsp[index];
                        indexes.Add(i);
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 32128
#include<iostream>
using namespace std;
int solve(int,int);
int a,b,c,d;
int main(){
	int h1,h2,k1,k2;
	cin>>h1>>h2>>k1>>k2>>a>>b>>c>>d;
	int hirosi=solve(h1,h2),kenjiro=solve(k1,k2);
	if(hirosi==kenjiro){
		cout<<"even"<<endl;
	}else if(hirosi>kenjiro){
		cout<<"hiroshi"<<endl;
	}else{
		cout<<"kenjiro"<<endl;
	}
	return 0;
}

int solve(int i,int y){
	return i*a+(i/10)*c+y*b+(y/20)*d;
}

Measured memory_bytes: 3100
A, B, C = map(int, input().split())
max_num = max(A, B, C)
if max_num == A:
    res1 = (A // 2) * B * C
    res2 = (A - (A // 2)) * B * C
elif max_num == B:
    res1 = (B // 2) * A * C
    res2 = (B - (B // 2)) * A * C
elif max_num == C:
    res1 = (C // 2) * B * A
    res2 = (C - (C // 2)) * B * A
print(abs(res1 - res2))

Measured memory_bytes: 3316
N=int(input())
MOD=10**9+7
a=[[0 for i in range(64)] for j in range(101)]
a[3]=[1 for i in range(64)]
a[3][6],a[3][9],a[3][18]=0,0,0
for i in range(4,N+1):
  a[i][0]=(a[i-1][0]+a[i-1][16]+a[i-1][32]+a[i-1][48])%MOD
  a[i][1]=a[i][0]
  a[i][2]=a[i][0]
  a[i][3]=a[i][0]
  a[i][4]=(a[i-1][1]+a[i-1][17]+a[i-1][33]+a[i-1][49])%MOD
  a[i][5]=a[i][4]
  a[i][6]=0
  a[i][7]=a[i][4]
  a[i][8]=(a[i-1][2]+a[i-1][18]+a[i-1][34]+a[i-1][50])%MOD
  a[i][9]=0
  a[i][10]=a[i][8]
  a[i][11]=a[i][8]
  a[i][12]=(a[i-1][3]+a[i-1][19]+a[i-1][35]+a[i-1][51])%MOD
  a[i][13]=a[i][12]
  a[i][14]=a[i][12]
  a[i][15]=a[i][12]
  a[i][16]=(a[i-1][4]+a[i-1][20]+a[i-1][36]+a[i-1][52])%MOD
  a[i][17]=a[i][16]
  a[i][18]=0
  a[i][19]=a[i][16]
  a[i][20]=(a[i-1][5]+a[i-1][21]+a[i-1][37]+a[i-1][53])%MOD
  a[i][21]=a[i][20]
  a[i][22]=(a[i-1][21]+a[i-1][37]+a[i-1][53])%MOD
  a[i][23]=a[i][20]
  a[i][24]=(a[i-1][6]+a[i-1][22]+a[i-1][38]+a[i-1][54])%MOD
  a[i][25]=a[i][24]
  a[i][26]=a[i][24]
  a[i][27]=a[i][24]
  a[i][28]=(a[i-1][7]+a[i-1][23]+a[i-1][39]+a[i-1][55])%MOD
  a[i][29]=a[i][28]
  a[i][30]=(a[i-1][23]+a[i-1][39]+a[i-1][55])%MOD
  a[i][31]=a[i][28]
  a[i][32]=(a[i-1][8]+a[i-1][24]+a[i-1][40]+a[i-1][56])%MOD
  a[i][33]=a[i][32]
  a[i][34]=a[i][32]
  a[i][35]=a[i][32]
  a[i][36]=(a[i-1][9]+a[i-1][25]+a[i-1][41]+a[i-1][57])%MOD
  a[i][37]=a[i][36]
  a[i][38]=(a[i-1][25]+a[i-1][41]+a[i-1][57])%MOD
  a[i][39]=a[i][36]
  a[i][40]=(a[i-1][10]+a[i-1][26]+a[i-1][42]+a[i-1][58])%MOD
  a[i][41]=a[i][40]
  a[i][42]=a[i][40]
  a[i][43]=a[i][40]
  a[i][44]=(a[i-1][11]+a[i-1][27]+a[i-1][43]+a[i-1][59])%MOD
  a[i][45]=a[i][44]
  a[i][46]=a[i][44]
  a[i][47]=a[i][44]
  a[i][48]=(a[i-1][12]+a[i-1][28]+a[i-1][44]+a[i-1][60])%MOD
  a[i][49]=a[i][48]
  a[i][50]=a[i][48]
  a[i][51]=a[i][48]
  a[i][52]=(a[i-1][13]+a[i-1][29]+a[i-1][45]+a[i-1][61])%MOD
  a[i][53]=a[i][52]
  a[i][54]=(a[i-1][29]+a[i-1][45]+a[i-1][61])%MOD
  a[i][55]=a[i][52]
  a[i][56]=(a[i-1][14]+a[i-1][30]+a[i-1][46]+a[i-1][62])%MOD
  a[i][57]=a[i][56]
  a[i][58]=a[i][56]
  a[i][59]=a[i][56]
  a[i][60]=(a[i-1][15]+a[i-1][31]+a[i-1][47]+a[i-1][63])%MOD
  a[i][61]=a[i][60]
  a[i][62]=a[i][60]
  a[i][63]=a[i][60]
print(sum(a[N])%MOD)

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}

template<typename T>
T gcd(T x, T y){
    if (x == 0 || y == 0) {
        return 0;
    }

    while (x != y){
        if (x > y) {
            x -= y;
        }else{
            y -= x;
        }
    }
    return x;
}

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

ll lcm(ll a, ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

// }}}
/* vim:set foldmethod=marker: */

void solve(){
    ll N, x;
    cin >> N >> x;
    vi a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    sort(all(a));

    int ans=0;
    for (int i = 0; i < N-1; i++) {
        if (x >= a[i]) {
            ans++;
            x -= a[i];
        }
    }

    // if (x > 0 && ans != 0) {
    //     ans--;
    // }
    if (x - a[N-1] == 0) {
        ans++;
    }
    cout << ans << endl;


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
//     cout << "key" << itr->first << " value" << itr->second << endl;
// }

// 文字列の検索
// string s="abc";
// if (s.find('d') == string::npos){
//     cout << "find" << endl;
// }else{
//     cout << "not find" << endl;
// }


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
const LL mo=1e9+7;
const int N=1e6;
int n;
LL fac[N+10],inv[N+10],f[N+10];
LL mul(LL x,LL y) {
    LL z=1;
    while (y) {
	if (y&1) z=z*x%mo;
	x=x*x%mo;
	y>>=1;
    }
    return z;
}
void pre() {
    fac[0]=1;
    for (int i=1;i<=N;i++) fac[i]=fac[i-1]*i%mo;
    inv[N]=mul(fac[N],mo-2);
    for (int i=N-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mo;
}
LL C(int x,int y) {
    if (y>x) return 0;
    return fac[x]*inv[y]%mo*inv[x-y]%mo;
}
int main() {
    pre();
    scanf("%d",&n);
    for (int i=0;i<n;i++)
	f[i]=C(n-i-2,i)*fac[n-1-i]%mo*fac[i]%mo;
    LL ans=0;
    for (int i=0;i<n;i++) {
	LL nowx=f[i]-f[i+1];
	ans=(ans+nowx*(n-i-1))%mo;
    }
    ans=(ans%mo+mo)%mo;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 23680
#include <iostream>
#include <utility>

auto main () -> int
{
    int index = 1;
    int w;
    while (std::cin >> w && w)
    {
        int n;
        std::cin >> n;
        int dp [n + 1] [w + 1];
        int values [n];
        int weights [n];
        for (auto i = 0; i < n; ++ i)
        {
            std::scanf ("%d,%d" , values + i , weights + i);
        }
        
        for (auto j = 0; j <= w; ++ j)
        {
            dp [0] [j] = 0;
        }
        for (auto i = 1; i <= n; ++ i)
        {
            for (auto j = w; j >= 0; -- j)
            {
                dp [i] [j] = std::max (dp [i - 1] [j] , j + weights [i - 1] <= w ? dp [i - 1] [j + weights [i - 1]] + values [i - 1] : 0);
            }
        }
        auto res = std::make_pair (0 , 0);
        for (int j = 0; j <= w; ++ j)
        {
            if (res.first < dp [n] [j] || (res.first == dp [n] [j] && res.second > w - j))
            {
                res.first = dp [n] [j];
                res.second = w - j;
            }
        }
        
        std::cout << "Case " << index ++ << ":" << std::endl;
        std::cout << res.first << std::endl << res.second << std::endl;
    }
}

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

string w[110];

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> w[i];
  }

  bool ans = true;
  for (int i = 0; i < N - 1; i++) {
    if (w[i][w[i].length()-1] != w[i+1][0]) {
      ans = false;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < i; j++) {
      if (w[i] == w[j]) {
        ans = false;
      }
    }
  }

  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if ( A * N >= B ) {
    cout << B << endl;
  }
  else if ( B > A * N ) {
    cout << A * N << endl;   
  }
  
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
for h in range(n-m+1):
	for w in range(n-m+1):
		if all(a[h+y][w+x]==b[y][x] for y in range(m) for x in range(m)):
			print("Yes")
			exit()
print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
struct factoring
{
private:
	//素数
	vector<int>  prime;
	int find_SPF(int n){
		for(int i=0;prime[i]<=n/prime[i];i++)
			if(n%prime[i]==0)return prime[i];
		return n;
	}
public:
	vector<int> SPF;
	//前処理
	factoring(int max){
		//(素数列挙）
		bool num[max+1];
		num[0]=0;
		num[1]=0;
		for(int i=2;i<=max;i++)num[i]=1;
		//ふるい
		for(int i=2;i<=max/i;i++)
			if(num[i]==1)
				for(int j=2;i<=max/j;j++)
					num[i*j]=0;
		
		for(int i=0;i<max+1;i++)
			if(num[i]==1)prime.emplace_back(i);
		
		//SPFを求める
		SPF.emplace_back(0);
		SPF.emplace_back(1);
		for(int i=2;i<=max;i++)SPF.emplace_back(factoring::find_SPF(i));	
	}
};
ll inv[1000001];
void prepro(){
	inv[1]=1;
	rep(i,999999)inv[i+2]=mod-inv[mod%(i+2)]*(mod/(i+2))%mod;
	return;
}
int main(){
	factoring s(1000000);
	prepro();
	int n;
	cin>>n;
	int a[n];
	in(a,n);
	int num[1000001];
	init(num,1000001);
	int tmp,count,prime;
	rep(i,n){
		tmp=a[i];
		while(tmp!=1){
			prime=s.SPF[tmp];
			count=0;
			while(tmp%prime==0){
				count++;
				tmp/=prime;
			}
			num[prime]=max(num[prime],count);
		}
	}
	ll LCM=1,pow_prime_count;
	for(int i=2;i<=1000000;i++){
		pow_prime_count=1;
		rep(j,num[i])pow_prime_count=pow_prime_count*i%mod;
		LCM=LCM*pow_prime_count%mod;
	}
	ll sum=0;
	rep(i,n)sum=(sum+LCM*inv[a[i]]%mod)%mod;
	if(sum<0)sum+=mod;
	cout<<sum;
	return 0;
}

Measured memory_bytes: 20320
#include <stdio.h>

int main()
{
    int n,y,i,j,k;
    scanf("%d %d",&n,&y);
    y /= 1000;
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= n - i; j++)
        {
            k = n - i - j;
            if (((y - 10 * i - 5 * j) == k) && (k >= 0))
            {
                break;
            }
        }
        if (j != n - i + 1)
        {
            break;
        }
    }

    if (i != n + 1)
    {
        printf("%d %d %d\n",i,j,k);
    }
    else
    {
        printf("-1 -1 -1");
    }
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
    int s,t;
    cin >> s >> t;
    int p,q,m,y;
    cin >> p >> q >> m >> y;
    int aa = s^t;
    cout << (y^aa) << endl;
    return 0;
}


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

using namespace std;

const int MaxN = 4e3 + 43;
const int MOD = 1e9 + 7;

int cnk[MaxN][MaxN];

void fillCnk()
{
    cnk[0][0] = 1;
    for(int i = 1; i < MaxN; ++i)
    {
        cnk[i][0] = cnk[i][i] = 1;
        for(int j = 1; j < i; ++j)
            cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % MOD;
    }
}

int calculateDiv(int n, int k)
{
    if(k == 0)
    {
        if(n == 0)
            return 1;
        else
            return 0;
    }   
    int lft = n - k;
    return cnk[lft + k - 1][k - 1];
}

int main() {
    fillCnk();
    
    int n, k;
    cin >> n >> k;
    
    for(int i = 1; i <= k; ++i)
    {
        int ans = 0;
        
        for(int bok = 0; bok <= n - k; ++bok)
        {
            int lft = n - k - bok;
            if(lft < i - 1)
                break;
                
            //cout << i << ' ' << bok << ' ' << lft << ' ' << calculateDiv(k, i) << ' ' << calculateDiv(lft, i - 1) << '\n';
            //cout << lft << ' ' << i - 1 << ' ' << calculateDiv(lft, i - 1) << '\n';
                
            int toAdd = (long long) calculateDiv(k, i) * calculateDiv(lft, i - 1) % MOD;
            toAdd = (long long) toAdd * (bok + 1) % MOD;
            
            ans = (ans + toAdd) % MOD;
        }
        
        cout << ans << '\n';
    }
}

Measured memory_bytes: 62592
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int N, X, a, c, d;
	std::cin >> N >> X;
	std::vector<int> m(N);
	int b = 0;
	for (int i = 0;i < N;++i) {
		std::cin >> m[i];
		b += m[i];
	}
	a = *std::min_element(m.begin(), m.end());
	c = X - b;
	d = c / a;
	std::cout << d + N << std::endl;
	return 0;
}

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

using namespace std;
int main()
{
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  
  ll ans = max({a*c, a*d, b*c, b*d});
  cout << ans << endl;
  return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    i64 N;
    cin >> N;
    vector<vector<i64>> graph(N);
    rep(i,0,N-1){
        int x,y;
        cin >> x >> y;
        --x;
        --y;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }

    function<int(int,int)> rec=[&](int u,int p){
        if(p!=-1 and graph[u].size()==1) return 0;
        int res=0;
        for(auto v:graph[u]){
            if(v==p) continue;
            res^=rec(v,u)+1;
        }
        return res;
    };

    if(rec(0,-1)) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 13568
N, C, K = map(int, input().split())
t = list(int(input()) for _ in range(N))
t.sort()
ans = 0
s = t[0] + K
cnt = 0
cntF = True
for i in range(N):
    cntF = True
    if t[i] <= s:
        if cnt == C:
            cnt = 1
            ans += 1
            s = t[i] + K
            cntF = False
        else:
            cnt += 1
        continue

    cnt = 1
    s = t[i] + K
    ans += 1
if cntF:
    ans += 1

print(ans)

Measured memory_bytes: 7396
#include <iostream>

using namespace std;

int main()
{
    int d,cnt=1,n,x,L[100];
    cin>>n>>x;
    for(int i=0;i<n;i++){
        cin>>L[i];
    }
    for(int i=0;i<n;i++){
        d+=L[i];
        if(x<d){
            cnt+=i;
            break;
        }
        if(n-1==i){
            cnt+=n;
        }
    }
    cout<<cnt;
    return 0;
}

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

typedef long long ll;

int main()
{
    ll X;
    cin >> X;
    ll ans = 0;
    double init = 100;
    while (true)
    {
        ++ans;
        init = floor(init * 1.01);
        if (init >= X)
        {
            cout << ans << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3616
import bisect
n=int(input())
a,b=[int(i) for i in input().split()]
p=sorted([int(i) for i in input().split()])
print(min(bisect.bisect_right(p,a),bisect.bisect_right(p,b)-bisect.bisect_right(p,a),n-bisect.bisect_right(p,b)))

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
  int key;
  struct Node *right,*left,*parent;
};

struct Node *root,*NIL;

struct Node *find(struct Node *u, int k){
  while (u != NIL && k != u->key){
    if(k < u->key) u=u->left;
    else u=u->right;
  }
  return u;
}

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;

  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  

  while (x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }

  z->parent = y;
  
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key < y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(struct Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char com[10];

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    scanf("%s",com);
    if(com[0]=='f'){
      scanf("%d",&x);
      struct Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(com,"insert")==0){
      scanf("%d" ,&x);
      insert(x);
    }
    else if(strcmp(com,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 20460
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	cout <<fixed<< sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)) << endl;

	return 0;
}

Measured memory_bytes: 3256
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(int argc, const char * argv[]) {
    int N;
    cin >> N;

    vector<int> a(N);
    vector<vector<int>> s(N+1, vector<int>(22, 0));
    for (int i = 1; i <= N; i++) {
        unsigned int a; cin >> a;
        for (int j = 0; j < 22; j++) {
            s[i][j] = s[i-1][j] + (a >> j) % 2;
        }
    }

    ll count = 0;
    int right = 1;
    for (int left = 1; left <= N; left++) {
        int tmp_right = right;
        while (tmp_right <= N) {
            bool flag = true;
            for (int j = 0; j < 22; j++) {
                if (s[tmp_right][j] - s[left-1][j] > 1) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                tmp_right += 1;
            } else {
                break;
            }
        }
        right = tmp_right - 1;
        count += right - left + 1;
    }

    cout << count << endl;

    return 0;
}

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

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

  for (int i = 0; i < s.length(); i++) {
    s[i] += n;
    if (s[i] > 90) s[i] -= 26;
  }

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
/*===============================================================
*  Filename：D.cpp
*  Author：zhuyutian
*  Date：2018年01月21日
================================================================*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int maxn = 100005;
const int maxm = 2005;

int n,K;
struct Node
{
	int x,y;
	char c[3];
}p[maxn];
int W[maxm][maxm],B[maxm][maxm];

void init()
{
    scanf("%d%d",&n,&K);
	for(int i = 0; i < n; i++) 
		scanf("%d%d%s",&p[i].x,&p[i].y,&p[i].c[0]);
	for(int i = 0; i < n; i++) 
	{
		p[i].x %= 2 * K;
		p[i].y %= 2 * K;
		if(p[i].c[0] == 'W') W[p[i].x + 1][p[i].y + 1] += 1;
		else B[p[i].x + 1][p[i].y + 1] += 1;	
	}
	for(int i = 1; i <= 2 * K; i++)
		for(int j = 1; j <= 2 * K; j++)
		{
			W[i][j] += W[i - 1][j] + W[i][j - 1] - W[i - 1][j - 1];
			B[i][j] += B[i - 1][j] + B[i][j - 1] - B[i - 1][j - 1];
		}
}

int check(int x,int y)
{
	int cw = 0,cb = 0;
	for(int i = 0; ;i++)
	{
		int tx = x + i * K,ty = y;
		if(tx - K + 1 > 2 * K) break; 
		int t = i % 2;
		for(; ;ty += K,t ^= 1)
		{
			if(ty - K + 1 > 2 * K) break;
			int a = tx - K + 1,b = ty - K + 1,c = tx,d = ty;
			a = max(1,a);
			b = max(1,b);
			c = min(2 * K,c);
			d = min(2 * K,d);
			if(t == 0) 
				cw += W[c][d] - W[a - 1][d] - W[c][b - 1] + W[a - 1][b - 1];
			else
				cb += B[c][d] - B[a - 1][d] - B[c][b - 1] + B[a - 1][b - 1];
		}
	}
	//cout<<x<<" "<<y<<" "<<cw<<" "<<cb<<endl;
	return max(cw + cb,n - cw - cb);
}

void solve()
{
	//check(2,1);
	int ans = 0;
	for(int i = 0; i < K; i++)
		for(int j = 0; j < K; j++)
			ans = max(ans,check(K - i,K - j));
	printf("%d\n",ans);
}

int main()
{
    //freopen("D.in","r",stdin);
    //freopen("D.out","w",stdout);
	init();
	solve();
	return 0;
}



Measured memory_bytes: 32768
#include <iostream>

using namespace std;

int main() {
    int a, b, res;
    char op;
    while (true) {
        cin >> a >> op >> b;
        if (op == '?') break;
        else if (op == '+') res = a + b;
        else if (op == '-') res = a - b;
        else if (op == '*') res = a * b;
        else if (op == '/') res = a / b;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
a,b,c,d = input()
abcd = list(map(int,[a,b,c,d]))
op = [None]*3
for i in range(2**3):
    f = abcd[0]
    for j in range(3):
        if ((i >> j) & 1):
            f += abcd[j+1]
            op[j] = '+'
        else:
            f -= abcd[j+1]
            op[j] = '-'
    if f == 7:
        print(a+op[0]+b+op[1]+c+op[2]+d+'=7')
        exit()

Measured memory_bytes: 38384
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;

int n,k,s;

int main()
{
    scanf("%d%d%d",&n,&k,&s);
    for(int i=1;i<=k;++i)printf("%d%c",s,i==n?'\n':' ');
    for(int i=k+1;i<=n;++i)printf("%d%c",s==1000000000?1:1000000000,i==n?'\n':' ');
    return 0;
}


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

void trace(int *A, int n){
    for(int i=0;i<n;i++){
        if(i > 0) printf(" ");
        printf("%d",A[i]);
    }
    putchar('\n');
}


void insertionSort(int *A, int n){
    int v =0;
    int j =0;
    trace(A,n);
    for (int i=1;i<n;i++){
        v = A[i];
        j = i-1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }    
        A[j+1] = v;
        trace(A,n);
    }
}
int main(){
    int A[150];
    int n;
    scanf("%d",&n);
    for(int i =0;i<n;i++){
        scanf("%d",&A[i]);
    }
    insertionSort(A,n);
    return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#ifdef DEBUG
  #include "debug.hpp"
#else
  #define DUMP(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
using value_type = typename iterator_traits<FwdIter>::value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int /*argc*/, char ** /*argv*/) {
  ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

  size_t n;
  cin >> n;
  vector<pair<int64_t, int64_t>> a(n);
  cin >> a;

  const size_t shards = 100000U;
  long double dist = 0;

  for (size_t k = 0; k < shards; ++k) {
    const double t = 2.0 * M_PI * k / shards;
    const double x = std::cos(t);
    const double y = std::sin(t);
    pair<int64_t, int64_t> pos = {0, 0};
    for (const auto & pr: a) {
      if (pr.first * x + pr.second * y >= 0) {
        pos.first += pr.first;
        pos.second += pr.second;
      }
    }
    dist = std::max(dist, (long double) pos.first * pos.first +
                    pos.second * pos.second);
  }

  cout << std::fixed << setprecision(50) << std::sqrt(dist);

  return EXIT_SUCCESS;
}


Measured memory_bytes: 384
h, w, k = map(int, input().split())

c = [0] * h

for i in range(h):
    c[i] = input()

ans = 0
for rows in range(1 << h):
    for cols in range(1 << w):
        b_cnt = 0
        for _h in range(h+1):
            if not (rows >> _h) & 1:
                continue
            for _w in range(w+1):
                if not (cols >> _w) & 1:
                    continue
                if c[_h][_w] == '#':
                    b_cnt += 1
        if b_cnt == k:
            ans += 1

print(ans)

Measured memory_bytes: 68232
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(X, N: int, M: int, Q: int, L: "List[int]", R: "List[int]", p: "List[int]", q: "List[int]"):
    C = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(1, N+1):
        for j in range(1, N+1):
            C[i][j] = C[i][j-1] + X[i][j]
    for i in range(Q):
        su = 0
        for j in range(p[i], q[i]+1):
            su += C[j][q[i]] - C[j][p[i]-1]
        print(su)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]" 
    R = [int()] * (M)  # type: "List[int]" 
    X = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        X[L[i]][R[i]] += 1
    p = [int()] * (Q)  # type: "List[int]" 
    q = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        p[i] = int(next(tokens))
        q[i] = int(next(tokens))
    solve(X, N, M, Q, L, R, p, q)

if __name__ == '__main__':
    main()


Measured memory_bytes: 85208
#include<iostream>
#include<stdio.h>
#include<fstream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<set>
#include<string>
#include<queue>
#include<map>
#include<iomanip>
#include<cassert>
#include<complex>
#include<functional>
#include<list>
#include<cmath>
#include<stack>
#include<assert.h>
#define LL long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define F first
#define S second 
using namespace std;
PII a[111111];
bool visit[111111];
int main(){
  int n,m;
  int x=0,y;
  int ans=1;
  cin>>m>>n;
  for(int i=0;i<n;i++)
  	cin>>a[i].S>>a[i].F;
  sort(a,a+n);
  int k=a[0].F-1;
  for(int i=0;i<n;i++)
  	if(a[i].S>k){
  	  ans++;
  	  k=a[i].F-1;
  	  continue;
	}
  cout<<ans;
  return 0;
}

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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> c(26, 1);
    rep(i, N) c[S[i] - 'a']++;
    ll ans = 1;
    rep(i, 26) ans = (ans * c[i]) % MOD;
    cout << (ans + MOD - 1) % MOD << endl;
}

Measured memory_bytes: 512
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int n,m,sx,sy,ex,ey;
char c[1005][1005];
int d[1005][1005];
bool vis[1005][1005],used[1005][1005];
int fx[4][2]={
0,-1,
0,1,
1,0,
-1,0
};
int main(){
	cin>>n>>m;
	cin>>sx>>sy;
	cin>>ex>>ey;
	FOR(i,1,n){
		scanf("%s",c[i]+1);
	}
	if(c[sx][sy]=='#'){
		cout<<-1;RE 0;
	}
	deque<P<int,int> > q;
	q.emplace_back(MP(sx,sy));
	vis[sx][sy]=1;
	while(!q.empty()){
		P<int,int> cur=q.front();
		q.pop_front();
		if(used[cur.F][cur.S])continue;
		used[cur.F][cur.S]=1;
		if(cur.F==ex&&cur.S==ey){
			cout<<d[cur.F][cur.S];RE 0;
		}
		int tx,ty;
		for(int i=0;i<4;i++){
			tx=cur.F+fx[i][0];ty=cur.S+fx[i][1];
			if(tx>=1&&tx<=n&&ty>=1&&ty<=m&&c[tx][ty]=='.'&&!used[tx][ty]){
				d[tx][ty]=d[cur.F][cur.S];vis[tx][ty]=1;
				q.emplace_front(MP(tx,ty));
			}
		}
		FOR(i,-2,2){
			FOR(j,-2,2){
				int tx=cur.F+i,ty=cur.S+j;
				if(tx>=1&&tx<=n&&ty>=1&&ty<=m&&c[tx][ty]=='.'&&!used[tx][ty]){
					if(!vis[tx][ty]){
						d[tx][ty]=d[cur.F][cur.S]+1;
						vis[tx][ty]=1;
						q.emplace_back(MP(tx,ty));
					}
				}
			}
		}
	}
	cout<<-1;
	RE 0;
}


Measured memory_bytes: 10636
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N; cin >> N;
  vector<int> A(N), B(200001,0);
  int now = 0, tmp = 1;
  REP(i,N){
    cin >> A[i];
    B[A[i]]++; 
  }
  while(now <= N-1){
    if(A[now] == tmp){
      tmp++;
    }
    now++;
  }
  if(B[1] == 0){ cout << "-1"; return 0;}
  cout << N - tmp + 1 ;
  return 0;
}

Measured memory_bytes: 1792
import static java.lang.Integer.parseInt;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * School Road (DP)
 */
public class Main {

	static final int KEEPOUT = -1;

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0 0")) {

			// read
			int a = parseInt(line.substring(0, line.indexOf(' ')));
			int b = parseInt(line.substring(line.indexOf(' ') + 1));
			int n = parseInt(br.readLine());

			int[][] dp = new int[a + 1][b + 1];

			for (int i = 0; i < n; i++) {
				line = br.readLine();
				int x = parseInt(line.substring(0, line.indexOf(' ')));
				int y = parseInt(line.substring(line.indexOf(' ') + 1));
				dp[x][y] = KEEPOUT;
			}

			// solve
			dp[1][1] = 1;

			for (int i = 1; i <= a; i++) {
				for (int j = 1; j <= b; j++) {
					if ((i | j) != 1 && dp[i][j] != KEEPOUT) {
						int p = dp[i - 1][j] != KEEPOUT ? dp[i - 1][j] : 0;
						int q = dp[i][j - 1] != KEEPOUT ? dp[i][j - 1] : 0;
						dp[i][j] = p + q;
					}
				}
			}
			System.out.println(dp[a][b]);
		}

	}
}

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

using namespace std;

int main() {
  int N, K, X, Y, result;
  cin >> N >> K >> X >> Y;
  if (N <= K) {
    result = N * X;
  } else {
    result = K * X + (N-K) * Y;
  }
  cout << result << endl;
  return 0;
}
  

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

class DisjointSet {
public:
	vector<int> rank, p; // 木の高さと木

	DisjointSet() {};
	DisjointSet(int size) { // 配列サイズを要素数に合わせて決定する
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++) makeSet(i);
	}

	void makeSet(int x) {
		p[x] = x; // 添え字がそのまま配列の要素になる
		rank[x] = 0; // 木の高さは最初0
	}

	bool same(int x, int y) { // 根が同じかどうか判定
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) { // 引数x, yの根同士を連結
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) { 
		if (rank[x] > rank[y]) { // 木の高さが低いほうが高いほうに加わる
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) { // 木の高さが同じなら新根の高さを一つ上げる
				rank[y]++;
			}
		}
	}

	int findSet(int x) { // キーxの根を調べる
		if (x != p[x]) {
			p[x] = findSet(p[x]); // 再帰的に親を辿る
		}
		return p[x]; // 根を返す
	}
};

int main() {
	int n, q, a, b; // 要素数、クエリ数、要素a, b
	int t;

	cin >> n >> q; // 要素数とクエリ数
	DisjointSet ds = DisjointSet(n); // 要素xがただ一つである新しい集合を作る

	for (int i = 0; i < q; i++) {
		cin >> t >> a >> b;
		if (t == 0) ds.unite(a, b);
		else if (t == 1) {
			if (ds.same(a, b)) cout << "1" << endl;
			else cout << "0" << endl;
		}
	}

	return 0;
}


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i,j;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int64 *dp=(int64 *)calloc(n+1,sizeof(int64));
  dp[n-1]=a[n-1];
  dp[n-2]=a[n-2];
  for(i=n-3;i>=0;i--){
    int64 local=a[i];
    for(j=i+2;j<=n;j+=2) local=MAX(local,dp[j]+a[i]);
    dp[i]=local;
  }
  int max=0;
  for(i=1;i<n;i++) if(dp[max]<dp[i]) max=i;
  printf("%lld\n",dp[max]);
  int *q=(int *)calloc(n,sizeof(int));
  int cnt=n;
  int len=0;
  for(i=0;i<max;i++){
    q[len++]=1;
    cnt--;
  }
  int now=max;
  while(now<n-2 && a[now]!=dp[now]){
    for(i=now+2;i<n;i+=2){
      if(dp[now]==dp[i]+a[now]){
	q[len++]=2;
	now=i;
	cnt-=2;
	break;
      } else {
	q[len++]=3;
	cnt-=2;
      }
    }
  }
  for(i=now+1;i<n;i++){
    q[len++]=cnt--;
  }
  printf("%d\n",len);
  for(i=0;i<len;i++) printf("%d\n",q[i]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
bool dfs(int s,vector<vector<int>>& edge,vector<int>& d){
    int N = edge.size();
    bool res = false;
    for(auto to:edge[s]){
        if(d[to]!=INF) {
            if((d[s]-d[to]) %2 == 0) {
                return true; 
            }
            else continue;
        }
        d[to]=d[s]+1;
        bool b = dfs(to,edge,d);
        if(b){ return true;}
    }
    return res;
}
int bfs(int s,vector<vector<int>>& edge){
    int N = edge.size();
    vector<int> dist(N,INF);
    queue<int> q; q.push(s);
    vector<bool> visited(N,0);
    visited[s]=1;
    dist[s]=0;
    int res=0;
    while(!q.empty()){
        int v = q.front(); q.pop();
        for(auto u:edge[v]){
            if(dist[u]!=INF) continue;
            q.push(u); dist[u] = dist[v]+1;
            chmax(res,dist[u]+1);
        }
    }
    return res;
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string s;
    vector<vector<int>> edge(N);
    REP(i,N){
        cin >> s;
        REP(j,N){
            if(s[j]=='0') continue;
            int to = j;
            edge[i].push_back(j);
            edge[j].push_back(i);
        }
    }
    //奇閉路検出
    vector<int> d(N,INF);
    d[0]=0;
    bool b = dfs(0,edge,d);
    if(b){
        cout << -1 << endl;
        exit(0);
    }

    int ans=0;
    REP(i,N){
        chmax(ans,bfs(i,edge));
    }

    cout << ans << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<math.h>
#include <stdlib.h>
using namespace std;
int main(){
	int n;
	int x[100001],y[100001],t[100001];
	int q;
	cin >> n;
	for(int i=0;i<n;i++){
	cin >> t[i+1] >> x[i+1] >> y[i+1];
	}
	
	x[0]=y[0]=t[0]=0;
	
	for(int j=0;j<n;j++){
		if(abs(x[j+1]-x[j])+abs(y[j+1]-y[j])<=t[j+1]-t[j] && (x[j+1]-x[j]+y[j+1]-y[j]+t[j+1]-t[j])%2==0){
			q=0;
		}
		else{
			q=1;
			break;
		}
	}
	if(q==0){
	cout << "Yes";
	}
	else{
	cout << "No";
	}
	return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	std::string S;
	in >> S;

	LL ans = 0;
	rep(i, S.length())
	{
		if (S[i] != S[S.length() - 1 - i]) ++ans;
	}

	out << ans / 2 << std::endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (Character.isUpperCase(s.toCharArray()[0])) {
            System.out.println("A");
            return;
        }
        System.out.println("a");
    }

}


Measured memory_bytes: 35680
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, L;
    cin >> N >> L;
    int all = 0;
    rep(i, N) { all += L + i; }
    if(L > 0) {
        all -= L;
    } else if(L + N - 1 < 0) {
        all -= L + N - 1;
    } else {
    }
    cout << all << endl;
    return 0;
}

Measured memory_bytes: 256
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int n;
  cin>>n;

  vi a(n);
  cin>>a;

  sort(ALL(a));

  coutYn(a[n-1]<accumulate(a.begin(),a.end()-1,0));

  return 0;

}


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

int main()
{
	int n,m,x;
	cin >>  n >> m >> x;
	vector<int> a(m);
	for(int i = 0;i<m;i++)
	{
		cin >> a[i];
	}
	auto it = lower_bound(a.begin(),a.end(),x);
	cout<<min(it-a.begin(),a.end()-it)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <stdlib.h>
#include <fstream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

bool test = true;
#define log(x) cout << "#x" << " : " << x << "\n";

int main()
{
    FIO;
    int n;
    cin >> n;
    vector<int> v(n);
    int x = 0;
    for(int i=0; i<n; i++) {
        cin >> v[i];
        x = (x^v[i]);
    }
    for(int i=0; i<n; i++) {
        cout << (x^v[i]) << " ";
    }
    return 0;

}



Measured memory_bytes: 3988
/*
	author : Aryan Agarwal, IIT KGP
	created : 26-04-2020 17:53:20
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
#define int ll

int MOD = 1000000007; /*more than (10)^9*/  /*7 + 1e9*/
int PEG = 998244353; /*less than (10)^9*/   /*1 + 7*17*(2)^23*/
long double pie=acos(-1);

// for creating a 2d vector with n rows & m columns then initialise it with it 0
// vvi vec(n,vi(m,0));
// vector<vector<int> > vec( n , vector<int> (m, 0));
typedef vector< int > vi;
typedef vector< vi > vvi;
#define X first
#define Y second
#define pb push_back
#define sz(a) (ull)(a).size()
#define all(a) (a).begin(),(a).end()
 
#define F(i,a,b) for (ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define in1(a,n) F(i,1,n)cin>>a[i]
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<"\n"
#define out1(a,n) F(i,1,n)cout<<a[i]<<" ";cout<<"\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pfy cout<<"YES"
#define pfn cout<<"NO"
#define pfn1 cout<<"-1"  // printf negative 1
#define pf1 cout<<"1"
#define nl cout<<"\n"

#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name,Arg1&& arg1){std::cout<<name<<" : "<<arg1<<endl;}template <typename Arg1,typename... Args>void __f(const char* names,Arg1&& arg1,Args&&... args){const char* comma=strchr(names+1, ',');std::cout.write(names,comma-names)<<" : "<<arg1<<"\n";__f(comma+1,args...);}

ll binpow(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpow(n,p-2,p);}
ll popcount(ll n)/*__builtin_popcount doesn't work for big no.s*/{ll ans=0;while(n){if(n%2)ans++;n/=2;}return ans;}
ll gcd(ll a, ll b)/*__gcd doesn't work for big no.s*/{if (b == 0)return a;return gcd(b, a % b);}

signed main()
{
	#ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	#endif
	fast;

	int s,w;
	cin>>s>>w;
	if(w>=s)cout<<"unsafe";
	else cout<<"safe";

	return 0;
}

Measured memory_bytes: 3652
using System;
using System.Linq;
using static System.Console;

class P
{
    static void Main()
    {
        while (true)
        {
            var a = ReadLine().Split().Select(int.Parse).ToList();
            int m = a[0], f = a[1], r = a[2], s = m + f;
            if (m + f + r == -3) break;
            WriteLine(m == ~0 || f == ~0 || s < 30 ? "F" :
                      s < 50 ? r < 50 ? "D" : "C" :
                      s < 65 ? "C" :
                      s < 80 ? "B" : "A");
        }
    }
}


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

using ll = long long;
#define pq priority_queue
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int t[] = {500, 100, 50, 10, 5, 1};
   int n, cnt;
   while (cin >> n, n) {
      n = 1000 - n, cnt = 0;
      for (int i = 0; i < 6; i++) {
         cnt += n / t[i];
         n %= t[i];
      }
      cout << cnt << endl;
   }

   return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  map<char, int> mp;
  REP(i,(int)s.size()){
    mp[s[i]]++;
  }
  for(char c = 'a'; c<='z'; c++){
    if(mp[c]==0){
      cout << c << '\n';
	  return 0;
    }
  }
  puts("None");
  return 0;
}


Measured memory_bytes: 512