akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
#define MAX 1000000
typedef struct{ 
  int p, l, r;
}Node;
Node t[1000000];
int count,h,d[1000000];
void b(int); 
 
int main(){
  int n,id,k,c,l,r;
  cin>>n;
  for(int i=0;i<n;i++) {
    t[i].p=-1;
    t[i].l=-1;
    t[i].r=-1;
  }  
  for(int i=0;i<n;i++){
    cin>>id>>k;
    for(int j=0;j<k;j++){
      cin>>c;
      t[c].p=id;
      if(j==0)t[id].l=c;
      else t[r].r=c;
      r=c;
    }
  }
 
  for(int i=0;i<n;i++){
    b(i);
    d[i]=count;
  }
  for(int i=0;i<n;i++){
    if(t[i].p==-1)
    cout<<"node "<<i<<": parent = "<<t[i].p<<", depth = "<<d[i]<<", root, ";  
    else if(t[i].l==-1)
    cout<<"node "<<i<<": parent = "<<t[i].p<<", depth = "<<d[i]<<", leaf, ";         
    else
      cout<<"node "<<i<<": parent = "<<t[i].p<<", depth = "<<d[i]<<", internal node, ";
    int j=i;
    cout<<'[';
    if(t[j].l!=-1){
      cout<<t[j].l;
      if(t[t[j].l].r==-1) cout<<']'<<endl;
      else cout<< ", ";
        
      j=t[j].l;
      while(t[j].r!=-1){
    cout<<t[j].r;
      if(t[t[j].r].r==-1)cout<<']'<<endl;
      else cout<<", ";
      j=t[j].r;
      }
    }
    else cout<<']'<<endl; 
  }
  return 0;
}
 
void b(int x){
  count=0;
  while(t[x].p>=0){
    x=t[x].p; 
    count++;
  }
}



Measured memory_bytes: 4640
N = int(input())
ts = [int(input()) for i in range(N)]

def lcd(n, m):
    # 最小公倍数
    a = max(n,m)
    b = min(n,m)
    while b:
        a, b = b, a % b
    return n*m//a

ans = 1
for t in ts:
    ans = lcd(ans,t)
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

int N;
char S[333333];

int EcountLeft[333333], WcountLeft[333333];
int EcountRight[333333], WcountRight[333333];

int main(void) {
	int i;
	int kitamuraeri = 999999;
	if (scanf("%d", &N) != 1) return 1;
	if (scanf("%333332s", S) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (S[i] == 'E') EcountLeft[i] = EcountRight[i] = 1;
		if (S[i] == 'W') WcountLeft[i] = WcountRight[i] = 1;
	}
	for (i = 1; i < N; i++) {
		EcountLeft[i] += EcountLeft[i - 1];
		WcountLeft[i] += WcountLeft[i - 1];
	}
	for (i = N - 2; i >= 0; i--) {
		EcountRight[i] += EcountRight[i + 1];
		WcountRight[i] += WcountRight[i + 1];
	}
	for (i = 0; i < N; i++) {
		int notomamiko = WcountLeft[i] + EcountRight[i] - 1; /* リーダーの分-1 */
		if (notomamiko < kitamuraeri) kitamuraeri = notomamiko;
	}
	printf("%d\n", kitamuraeri);
	return 0;
}


Measured memory_bytes: 5376
import sys
for a,b,c,d,e,f,g,h in[map(float,l.split()) for l in sys.stdin]:
	A=(c-a)*(d-h)-(d-b)*(c-g)
	B=(e-c)*(f-h)-(f-d)*(e-g)
	C=(a-e)*(b-h)-(b-f)*(a-g)
	print "YES"if A*B>0 and B*C>0 and C*A>0 else"NO"

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

ll dp[105][100500];
ll weight[105];
ll value[105];

int main() {
    ll n, w;
    ll v = MAX_V;
    cin >> n >> w;
    rep(i, n) {
        cin >> weight[i] >> value[i];
    }

    rep(i, n) {
        rep(j, v) {
            dp[i][j] = INF;
        }
    }

    dp[0][0] = 0;

    rep(i, n) {
        rep(x, v) {
            if (x - value[i] >= 0)
                dp[i + 1][x] = min(dp[i][x], dp[i][x - value[i]] + weight[i]);
            else
                dp[i + 1][x] = min(dp[i + 1][x], dp[i][x]);

            // debug(i);
            // debug(x);
            // debug(dp[i][x]);
        }
    }

    ll ans = 0;
    rep(i, v) {
        if (dp[n][i] <= w)
            ans = i;
    }

    out(ans);
    return 0;
}


Measured memory_bytes: 80128
#include <iostream>
#include <ostream>
#include <vector>
#include <utility>

struct Card {
	int number;
	char suit;

	friend std::ostream& operator<<(std::ostream &os, const Card &c) {
		os << c.suit << c.number;
		return os;
	};
	bool operator !=(const Card c) {
		if (number != c.number || suit != c.suit)
			return true;
		else
			return false;
	}
};

void trace(std::vector<Card> c) {
	for (int i = 0; i < c.size() - 1; i++)
		std::cout << c[i] << " ";
	std::cout << c[c.size() - 1] << std::endl;
}

void bubble_sort(std::vector<Card> &c) {
	for (int i = 0; i < c.size(); i++) {
		for (int j = c.size() - 1; j > i; j--) {
			if (c[j].number < c[j - 1].number)
				std::swap(c[j], c[j - 1]);
		}
	}
}

void selection_sort(std::vector<Card> &c) {
	for (int i = 0; i < c.size(); i++) {
		int min = i;
		for (int j = i; j < c.size(); j++){
			if (c[j].number < c[min].number)
				min = j;
		}
		std::swap(c[i], c[min]);
	}
}



int main() {
	int n;
	std::cin >> n;

	std::vector<Card> c,c_b, c_s;
	c.resize(n);


	for (int i = 0; i < n; i++) {
		std::cin >> c[i].suit;
		std::cin >> c[i].number;
	}
	
	c_b.resize(n);
	c_s.resize(n);

	c_b.assign(c.begin(), c.end());
	c_s.assign(c.begin(), c.end());

	bubble_sort(c_b);
	selection_sort(c_s);

	trace(c_b);
	std::cout << "Stable" << std::endl;
	trace(c_s);
	bool is_stable = true;
	for (int i = 0; i < n; i++) {
		if (c_b[i] != c_s[i]) {
			is_stable = false;
			break;
		}
	}
	if (is_stable)
		std::cout << "Stable" << std::endl;
	else
		std::cout << "Not stable" << std::endl;

	return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main() {
  int n;
  cin >> n;
  vector<int>num(n);
  for (int i = 0; i < n; i++) {
    cin >> num.at(i);
  }
  sort(num.begin(),num.end());
  int x = num.at(n/2 -1);
  int y = num.at(n/2);

  cout << y - x << endl;
}  

Measured memory_bytes: 640
use whiteread::parse_line;

use std::collections::HashMap;

fn main() {
    let n: u64 = parse_line().unwrap();
    let upper = (n as f64).sqrt() as u64 + 1;
    let mut frequency: HashMap<u64, u64> = HashMap::new();
    for x in 1..upper {
        for y in 1..upper {
            for z in 1..upper {
                let m = x * x + y * y + z * z + x * y + z * x + z * y;
                *frequency.entry(m).or_insert(0) += 1;
            }
        }
    }
    for i in 1..=n {
        println!("{}", frequency.get(&i).unwrap_or(&0))
    }
}


Measured memory_bytes: 3932
#include <iostream>

int calc_reverse_number(int x) {
    int ret = 0;
    while (x) {
        ret *= 10;
        ret += x % 10;
        x /= 10;
    }

    return ret;
}

bool is_palindromic_number(int x) {
    return x == calc_reverse_number(x);
}

int main() {
    int A, B;
    std::cin >> A >> B;

    int ret = 0;
    for (int i = A; i <= B; ++i) {
        if (is_palindromic_number(i)) {
            ++ret;
        }
    }

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main()
{
  long w, h, x, y;
  cin >> w >> h >> x >> y;
  int i = 0;
  if(w  == x * 2 && h == y * 2){
    i = 1;
  }
  cout << setprecision(9) << w * h * 0.5 << " " << i;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        int c0 = 0;
        int c1 = 0;
        for(int i = 0; i < input.Length; i++)
        {
            if (input[i] == '0')
                c0++;
            else
                c1++;
        }
        Console.WriteLine(Math.Min(c0, c1) * 2);
    }
}


Measured memory_bytes: 11232
#include <iostream>
#include <string>
#include <queue>
#include <cmath>
#include <algorithm>


using namespace std;

bool is_prime(int x) {
    if (x <= 1) return false;
    for (int i=2; i*i<x; i++) {
        if (x%i==0) return false;
    }
    return true;
}

int main () {

    int X;
    cin >> X;

    while (!is_prime(X)) X++;

    cout << X;

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}

char ma[50][51];
int d[50][50];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  int cnt = 0;
  fi(0, n) {
    cin >> ma[i];
    fj(0, m) {
      if(ma[i][j] == '.') ++cnt;
    }
  }
  qp q;
  negative(d);
  d[0][0] = 0;
  q.push(pii(0, 0));
  while(q.size()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop();
    fk(0, 4) {
      int ni = i + di[k];
      int nj = j + dj[k];
      if(ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
      if(ma[ni][nj] == '#' || d[ni][nj] >= 0) continue;
      q.push(pii(ni, nj));
      d[ni][nj] = d[i][j] + 1;
    }
  }
  if(d[n - 1][m - 1] < 0) {
    cout << "-1\n";
    return 0;
  }
  cout << cnt - d[n - 1][m - 1] - 1 << endl;
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
k, n = gets.chomp.split.map(&:to_i)
as = gets.chomp.split.map(&:to_i)

ds = []
(n-1).times do |i|
  ds.push as[i+1] - as[i]
end
ds.push k - as[n-1] + as[0]

puts k - ds.max


Measured memory_bytes: 18316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e6 + 10;
ll s[ 41 ];
int a[ N ];
int n , cnt;
map< int, int > e;
int check1( int x ){//二分寻找第一个比他大的2次幂 
   int l = 0 , r = 32;
   while( l < r ){
   	int mid = ( l + r )/2;
   	if( s[ mid ] > x ) r = mid  ;else
   	l = mid + 1 ;
   }
   return l;
}
int main( ){
//	freopen("powers.in" , "r" , stdin );
//	freopen("powers.out" , "w" , stdout );
	scanf("%d" , &n );
	s[ 0 ] = 1;
	for( int i = 1 ; i <= 32 ; i ++ ) s[ i ] = s[ i - 1 ] * 2; 
	for( int i = 1 ; i <= n ; i ++ ){
	 scanf("%d" , &a[ i ] );
	 e[ a[ i ] ]++;
    }
	sort( a + 1  , a + n + 1 );
    for( int i = n ; i >= 1 ; i -- ){
     if( e[ a[ i ] ] == 0 ) continue;
	 int p = check1( a[ i ] );
//	 cout<<p << " "<<i <<" "<<a[ i ]<<" "<<e[ a[ i  ]]<<endl;
	 int q = s[ p ] - a[ i ];
	 if( q == a[ i ] ){
	  if( e[ q ] >= 2 ){
	  	cnt ++;
	  	e[ q ] -= 2;
	  }
	 }else
	 if ( e[ q ] >= 1 ){
	 	cnt++;
	 	e[ q ]--;
	 	e[ a[ i ] ]--;
	 }
   }
	cout<<cnt;    
} 

Measured memory_bytes: 19712
N,K = map(int,input().split())
S = input()
one = [0]
zero = [0]
if S[0] == '0':
    one.append(0)
cnt = 1
for i in range(1,len(S)):
    if S[i] != S[i-1]:
        if S[i-1] == '1':
            one.append(cnt+one[-1])                
        else:
            zero.append(cnt+zero[-1])                
        cnt = 1
    else:
        cnt += 1
else:
    if S[-1] == '1':
        one.append(cnt+one[-1])                
    else:
        zero.append(cnt+zero[-1])                
        one.append(one[-1])                
window_size = min(len(zero)-1,K)
MAX = 0
for i in range(len(zero)-window_size):
    if MAX < (zero[i+window_size] - zero[i]) + (one[i+window_size+1] - one[i]):
        MAX = (zero[i+window_size] - zero[i]) + (one[i+window_size+1] - one[i])

print(MAX)


Measured memory_bytes: 45040
program main

  implicit none
  integer(8) :: a, b, k

  read(*,*) a,b,k

  if ( a >= k ) then
    a = a - k
    b = b
  else
    if ( b >= ( k - a ) ) then
      b = b - ( k - a )
      a = 0
    else
      a = 0
      b = 0
    end if
  end if

  print*, a, b

end program main

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long fact(long long n)
{
    if (n <= 1)
        return 1;
    return n * fact(n - 1);
}
long long nCr(long long n, long long r)
{
    return fact(n) / (fact(r) * fact(n - r));
}
long long  nCrModp(long long n, long long r, long long  p)
{
    long long C[r+1];
    memset(C, 0, sizeof(C));
 
    C[0] = 1;
    for (long long i = 1; i <= n; i++)
    {
        for (long long j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}
int main()
{long long a,b;cin>>a>>b;
 if(a<2)a=0;
 if(b<2)b=0;
 if(a!=0)
 {a=nCrModp(a,2,1000000007);}
 if(b!=0)b=nCrModp(b,2,1000000007);
cout<<a+b;
 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
const double INF3 = 900000000000000;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()



int main() {
	while (true) {
		int a, b;
		cin >> a >> b;
		if (a == 0 && b == 0)return 0;
		int n, dp[1000][1000] = {0};
		cin >> n;
		for (int i = 1;i <= a;i++)dp[i][1] = 1;
		for (int i = 1;i <= b;i++)dp[1][i] = 1;
		for (int i = 0;i < n;i++) {
			int x, y;
			cin >> x >> y;
			dp[x][y] = -1;
			if (x == 1) {
				for (int j = y;j <= b;j++)dp[1][j] = -1;
			}
			if (y == 1) {
				for (int j = x;j <= a;j++)dp[j][1] = -1;
			}
		}
		for (int i = 2;i <= a;i++) {
			for (int j = 2;j <= b;j++) {
				if (dp[i][j] == -1)continue;
				else if (dp[i - 1][j] == -1 && dp[i][j - 1] == -1)dp[i][j] = -1;
				else if (dp[i - 1][j] == -1)dp[i][j] = dp[i][j - 1];
				else if (dp[i][j - 1] == -1)dp[i][j] = dp[i - 1][j];
				else dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			}
		}
		cout << dp[a][b] << endl;
	}
}


Measured memory_bytes: 7000
from numba import njit


@njit
def solve(n: int):
    div = [1] * n  # div[n] = n + 1の約数の個数
    for i in range(2, n + 1):
        for j in range(i, n + 1, i):
            div[j - 1] += 1

    ans = 0
    for i in range(n):
        ans += (i + 1) * div[i]

    return ans


print(solve(int(input())))


Measured memory_bytes: 188632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
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;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    ll out=1;
    for(int i=1;i<=N;i++){
        out *= i;
        out = out % MOD;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin


def main():
    _ = int(input())
    l_lst = [int(x) for x in stdin.readline().split()]
    l_lst.sort(reverse=True)
    if l_lst[0] < sum(l_lst)-l_lst[0]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll n = in(); scanf("%*c", nullptr);
	map<char, ll>mp;
	REP(i, n) {
		char c; scanf("%c", &c);
		++mp[c];
	}
	ll ans = 1;
	REPC(i, mp) {
		ans *= i.second + 1;
		ans %= MOD;
	}
	cout << ans - 1 << endl;
}

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

int main(){
  string w;
  cin >> w;
  int n[26];
  for(int i=0;i<26;i++) n[i] = 0;
  for(int i=0;i<w.length();i++){
    n[w[i]-'a']++;
  }
  for(int i=0;i<26;i++){
    if(n[i]%2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
// Problem : C - Sum of gcd of Tuples (Easy)
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound		// first element >= val(itr) 
#define ub              upper_bound		// first element >  val(itr)
#define vll							vector<ll>
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))	//x can be 0 or -1

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#ifdef LOCAL_TEST
#include"/home/shrey/debug.h"
#endif

const ll inf = 1e18;
const int nax = 1e5 + 5;

void SolveTestCase()
{
	ll ans = 0;
	ll n;
	cin>>n;
	
	forn(i,1,n+1)
	{
		forn(j,1,n+1)
		{
			forn(k,1,n+1)
			{
				ans += gcd(gcd(i,j),k);
			}
		}
	}
	
	cout<<ans;
}

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	forn(i, 0, t)
	{
		SolveTestCase();
	}

	return 0;
}


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

using namespace std;
typedef long long ll;

int main(void)
{
    int n;
  cin >>n;
    vector<int> a;
    for (int i = 0; i < n; i++){
        int t;
        cin >> t;
        a.push_back(t);
    }
  sort(a.begin(),a.end());

    for (int i = 0; i < n-1;i++){
            if(a.at(i)==a.at(i+1)){
                cout << "NO" << endl;
              	return 0;
        }
    }
        cout << "YES" << endl;

    return 0;
}

Measured memory_bytes: 1400
#include<iostream>
using namespace std;
static const int MAX=500;
static const int MAX_ANS=2e5+5;
bool a[MAX][MAX];


bool change(bool t){return t?false:true;}
int main(void)
{
	int h,w;
		cin >> h >> w;
	
	
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			int f;
			cin >> f;
			if(f%2)
				a[i][j]=true;
		}
	}
	
	int x_1[MAX_ANS],x_2[MAX_ANS],y_1[MAX_ANS],y_2[MAX_ANS];
	int n=0;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<w;j++)
		{
			if(a[i][j])
			{
				x_1[n]=i;
				x_2[n]=i;
				y_1[n]=j;
				y_2[n]=j+1;
				n++;
				a[i][j]=false;
				a[i][j+1]=change(a[i][j+1]);
			}
		}
	}
	for(int i=0;i<h;i++)
	{
		if(a[i][w])
		{
			x_1[n]=i;
			x_2[n]=i+1;
			y_1[n]=w;
			y_2[n]=w;
			n++;
			a[i][w]=true;
			a[i+1][w]=change(a[i+1][w]);
		}
	}
	
	cout << n << endl;
	for(int i=0;i<n;i++)
		cout << x_1[i] << " " << y_1[i] << " " << x_2[i] << " " << y_2[i] << endl;
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int n;
bool f;
char ch; 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		ch=getchar();
		if(ch=='Y') f=true;
	}
	if(f) cout<<"Four"<<endl;
	else cout<<"Three"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;

int main() {
    while (1) {
        int n, m, l, k, a, h;
        cin >> n >> m >> l >> k >> a >> h;
        if (!n) return 0;
        vector<int> fr(l + 2);
        for (int i = 0; i < l; ++i) {
            cin >> fr[i];
        }
        fr[l] = a;
        fr[l + 1] = h;

        vector<vector<int>> d(n, vector<int>(n, M));
        for (int i = 0; i < k; ++i) {
            int x, y, t;
            cin >> x >> y >> t;
            d[x][y] = t;
            d[y][x] = t;
        }
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                for (int k = 0; k < n; ++k)
                    d[j][k] = min(d[j][k], d[j][i] + d[i][k]);

        vector<vector<int>> dist(n, vector<int>(n, M));
        for (int i : fr)
            for (int j : fr)
                if (d[i][j] <= m)
                    dist[i][j] = d[i][j];

        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                for (int k = 0; k < n; ++k)
                    dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);

        if (dist[a][h] >= M) cout << "Help!\n";
        else cout << dist[a][h] + max(dist[a][h] - m, 0) << "\n";
    }
}



Measured memory_bytes: 3068
import sys

X, N = map(int, input().split(" "))
try:
    P = list(map(int, input().split(" ")))
except:
    P = []

def check(n, X, P):
    if not X - n in P:
        print(X - n)
        sys.exit()
    
    if not X + n in P:
        print(X + n)
        sys.exit()

for n in range(0, 101):
    check(n, X, P)

Measured memory_bytes: 9204
n, m = map(int, input().split())
if n >= m:
  print(0)
else:
  x = sorted(list(map(int, input().split())))

  y = []
  for i in range(m-1):
    y.append(x[i+1] - x[i])

  y_sorted = sorted(y, reverse=True)

  ans = 0
  for _y in y_sorted[n-1:]:
    ans += _y
  print(ans)

Measured memory_bytes: 13968
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;

int main(){
  ll ans=1;
  bool flag=true;
  int N,data,A[110000]={0};
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>data;
    A[data]++;
  }
  int j;
  if(N%2==0) j=1;
  else{
    j=2;
    if(A[0]!=1) flag=false;
  }
  for(;j<N;j+=2){
    if(A[j]!=2) flag=false;
  }
  if(flag){
    for(int i=0;i<N/2;i++){
      ans*=2;
      ans%=1000000007;
    }
  }else ans=0;
  cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
  // input
  int a, b;
  cin >> a >> b;

  int add = a+b;
  int sub = a-b;
  int mul = a*b;

  cout << max({add, sub, mul}) << endl;


  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";

    int N;
    void Solve()
    {
        N = cin.Nextint;
        var A = cin.Scanint;
        var L = new LinkedList<int>();
        for (int i = 0; i < N; i++)
        {
            if (N % 2 == 0)
            {
                if (i % 2 == 1) L.AddFirst(A[i]);
                else L.AddLast(A[i]);
            }
            else
            {
                if (i % 2 == 1) L.AddLast(A[i]);
                else L.AddFirst(A[i]);
            }
        }
        foreach (var item in L)
        {
           
            Write(item);
            Write(" ");
        }
        WriteLine();

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 44488
#include <stdio.h>

int main(){

    int i,k,l;
    int data[10];
    
    for (i=0;i<3;++i) {
		scanf("%d",&data[i]);
     }
   
    for (i=0;i<3;++i) {
	  for(k=i+1;k<3;++k){
		if (data[i]>data[k]){
			l=data[i];
			data[i]=data[k];
			data[k]=l;
	     }
	    }
	 }

		printf("%d %d %d\n",data[0],data[1],data[2]);

    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
char s[100100];
int a[100100];

int main(){
	while(~scanf("%s",s)){
		int l=strlen(s);
		int mi[2];
		mi[0]=mi[1]=l;
		int sum=1;
		int r=0;
		for(int i=1;i<l;i++)
			if(s[i]!=s[i-1]) a[r++]=sum,sum=1;
			else sum++;
		a[r++]=sum;
		sum=0;
		int my=(l+1)/2;
		int x=0;
		int y=l;
		for(int i=0;i<r;i++){
			sum+=a[i];
			if(sum<my) x=sum;
			if(sum>=my) y=min(y,sum);
		}
		y=min(y,sum);
		x=l-x;
		printf("%d\n",min(x,y));
	}
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
void printvec(list<int> a){
  if(a.empty()){
    cout << endl;
    return;
  }
  for(auto itr=a.begin();itr!=a.end();++itr){
    auto itr2 = itr;
    itr2++;
    if(itr2==a.end()) cout << *itr << endl;
    else cout << *itr << " ";
  }
}
signed main(){
  int n;
  cin >> n;
  vector<list<int>> v(n);
  int q;
  cin >> q;
  REP(i,q){
    int d,t;
    cin >> d >> t;
    if(d==0){
      int x;
      cin >> x;
      v[t].eb(x);
    }else if(d==1){
      printvec(v[t]);
    }else{
      int s;
      cin >> s;
      v[s].splice(v[s].end(),v[t]);
      v[t].clear();
    }
  }
}



Measured memory_bytes: 34348
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n,k; cin >> n >> k;
	vector<int> a(n); rep(i,n) cin >> a[i];
	
	sort(all(a));
	
	int l=n-k+1;
	
	vector<int> b(l); rep(i,l) b[i]=a[i+k-1]-a[i];
	
	//rep(i,l) cout << b[i] << endl;
	
	sort(all(b));
	
	
	
	
	cout << b[0] << endl;
	
	return 0;
}



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



int main(){
	int n;
	cin >> n;
	ll ans = 1;
	rep(i,n){
		ll a;
		cin >> a;
		if(ans == -1){
			if(a == 0) ans = 0;
		}else{
			if(a ==0 || ans == 0) {ans *= a;continue;}
			if(a > 1'000'000'000'000'000'000 / ans){
				ans = -1;
				continue;
			}else{
				ans *= a;
			}
		}
	}
	if(ans==-1) cout << to_string(ans) << endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
using System;

public class p0009
{
	private const int mx = 1000001;
	p0009(){
		string str;
		int n, cnt;
		bool[] prime = new bool[mx];
		prime[0] = prime[1] = false;
		for(int i = 2; i < mx; ++i)
			prime[i] = true;
		
		for(int i = 2; i < mx; ++i)
			if(prime[i])
				for(int j = i*2; j < mx; j+=i)
					prime[j] = false;
		
		while((str = Console.ReadLine()) != null){
			n = int.Parse(str);
			cnt = 0;
			for(int i = 2; i <= n; ++i)
				if(prime[i]) ++cnt;
			Console.WriteLine("{0}", cnt);
		}
	}
	
	public static int Main(string[] args){
		new p0009();
		return 0;
	}
}

Measured memory_bytes: 6548
def resolve():
	s = input()
	k = 0
	for i in range(1 << len(s) - 1):
		ts = s
		seq = 1
		for j in range(len(s) - 1):
			if (i >> j) & 1:
				k += int(ts[:seq])
				ts = ts[seq:]
				seq = 1
			else:
				seq += 1
		k += int(ts or 0)
	print(k)
resolve()

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

int main(){
	long n,k;
	cin >> n >> k;
	map<int,int> a;
	vector<int> b;
	long ans=0;
	for(int i=0;i<n;i++){
		int t;
		cin >> t;
		a[t]++;
	}
	if(a.size()<=k){
		cout << 0;
	}else{
		for(auto i=a.begin();i!=a.end();i=next(i,1)){
			b.push_back(i->second);
		}
		sort(b.begin(),b.end());		
		ans=accumulate(b.begin(),b.begin()+b.size()-k,0);
		cout << ans;
	}
	

	return 0;
}


Measured memory_bytes: 10748
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<set>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<stack>
#include<tuple>
#include<utility>
#define rep0(i,n) for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n) for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;
/*ビットxにi番目のフラグが立っているかどうか
if(x & (1 << i))
↑ a << b == a*pow(b,2)
/*{0, 1, ..., n-1} の部分集合の全探索
for (int bit = 0; bit < (1 << n); ++bit)
*/

int main(){
  char b;  cin >> b;
  if(b == 'A'){
    cout << 'T';
  }else if(b == 'T'){
    cout << 'A';
  }else if(b == 'C'){
    cout << 'G';
  }else if(b == 'G'){
    cout << 'C';
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int x,y;
	while(1)
	{
		scanf("%d%d",&x,&y);
		if(x == 0 && y == 0)
		{
			break;
		}
		if(x > y)
		{
			printf("%d %d\n",y,x);
		}else
		{
			printf("%d %d\n",x,y);
		}
	}
}

Measured memory_bytes: 600
r,c=map(int,input().split())
q=range
b=[]
for i in q(r):
    w=[int(i) for i in input().split()]
    w.append(sum(w))
    b.append(w)
    print(*w)
l=[]
for i in q(c+1):
    x=0
    for a in b:x+=a[i]
    l.append(x)
print(*l)

Measured memory_bytes: 7856
from sys import stdin
input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


n = int(input())
arr = lmi()
for i in range(1, n):
    arr[i] = gcd(arr[i], arr[i-1])
print(arr[n-1])

Measured memory_bytes: 14168
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>

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

template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& v) {
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}

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

int main()
{
    ll h;
    cin >> h;
    ll acc = 1;
    ll op = 0;

    while (acc * 2 <= h) {
        acc *= 2;
        op = 2 * op + 1;
    }

    cout << acc + op << endl;
    return 0;
}

Measured memory_bytes: 3628
// 2020-07-17 00:56:53
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int n;
  cin >> n;
  vector<ll> s(n);
  rep(i, n) cin >> s[i];
  ll ans = 0;
  REP(c, 1, n/2) {
    ll cur = 0;
    int l = 0, r = n-1;
    for(;;) {
      l += c, r -= c;
      bool ok = [&]() {
        if((n-1) % c) {
          return l < n-1 && c <= r;
        } else {
          return l < r;
        }
      }();
      if(!ok) break;
      cur += s[l] + s[r];
      chmax(ans, cur);
    }
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3964
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
void Sort(string A[], int P[], int N) {
	vector<int> NUM(N);
	for (int i = 1; i <= N; i++) {
		NUM[i - 1] = i;
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N - 1; j++) {
			if (A[j] > A[i]) {
			    swap(A[j], A[i]);
			    swap(P[i], P[j]);
				swap(NUM[i], NUM[j]);
			}
			else if (A[j] == A[i]) {
				if (P[i] > P[j]) {
				    swap(A[i], A[j]);
				    swap(P[i], P[j]);
				    swap(NUM[i], NUM[j]);
				}
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cout << NUM[i] << endl;
	}
}

int main() {
	int N; cin >> N;
	string S[N];
	int P[N];
	for (int i = 0; i < N; i++) {
		cin >> S[i] >> P[i];
	}
	Sort(S, P, N);
}

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

int main(void){
    int q,n = 0;
    cin >> q;
    int l[q],r[q];
    for(int i = 0;i < q;i++){
        cin >> l[i] >> r[i];
        n = max(n,r[i]);
    }
    
    int is_prime[100005] = {},num[100005] = {};
    
    for(int i = 2;i <= 100000;i++){
        if(!is_prime[i]){
            for(int j = 2*i;j <= 100000;j += i)is_prime[j] = 1;
        }
    }
    for(int i = 3;i <= n;i++){
        if(is_prime[i] == 0 && is_prime[(i+1)/2] == 0)num[i] += num[i-1] + 1;
        else num[i] += num[i-1];
    }
    
    for(int i = 0;i < q;i++)cout << num[r[i]]-num[l[i]-1] << endl;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
#include <iomanip>
 
int main() {
  int l;
  double m,ans;
 
  cin >> l;
  
  m=(double)l/3;
  ans=m*m*m;
 
  cout << setprecision(20) << ans << endl;
 
  return 0;
}

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

int main(){
   int i,j,l;
   char s[101];
 
   scanf("%s",s);
   l=strlen(s)-1;
   for (i=j=0;i<l;i++,l--)
      if (s[i]!=s[l]) j++;
   printf("%d\n",j);
   return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int k;
    cin >> k;

    int a; //偶数の数
    int b; //奇数の数
    if(k % 2 == 0){
        a = k/2;
        b = a;
        cout << a * b;
        return 0;
    }else{
        k--;
        a = k /2;
        b = a + 1;
        cout << a * b;
        return 0;
    }
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b){
    ll r;
    while(b!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

int main() {
    ll A,B,C,D;cin >> A >> B >> C >> D;
    ll cnt_b=0;
    ll cnt_a=0;
    ll t_a=0,t_b=0;
    ll g=gcd(C,D);
    ll l=C*D/g;
    t_b=B/l;
    t_a=(A-1)/l;
    ll num_c=B/C;
    ll num_d=B/D;
    cnt_b=B-num_c-num_d+t_b;
    ll c=(A-1)/C;
    ll d=(A-1)/D;
    cnt_a=A-1-c-d+t_a;
    cout << cnt_b-cnt_a << endl;
   
    return 0;

}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var N = input[0];
        var M = input[1];
        var K = input[2];

        var A = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var B = Console.ReadLine().Split().Select(long.Parse).ToArray();

        var a = new long[N + 1];
        for (int i = 1; i <= N; i++)
        {
            a[i] = a[i - 1] + A[i - 1];
        }

        var b = new long[M + 1];
        for (int i = 1; i <= M; i++)
        {
            b[i] = b[i - 1] + B[i - 1];
        }

        var j = M;
        var answer = 0L;
        for (int i = 0; i <= N; i++)
        {
            if (a[i] > K)
            {
                break;
            }
            while (b[j] > K - a[i])
            {
                j--;
            }
            answer = Math.Max(answer, i + j);
        }
        Console.WriteLine(answer);
    }
}


Measured memory_bytes: 72992
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int N, MA, MB;
  cin >> N >> MA >> MB;

  int a[N], b[N], c[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }

  int dp[N + 1][N * 10 + 1][N * 10 + 1];
  for (int i = 0; i <= N; i++) {
    for (int aa = 0; aa <= N * 10; aa++) {
      for (int bb = 0; bb <= N * 10; bb++) {
        dp[i][aa][bb] = 100 * 100;
      }
    }
  }
  dp[0][0][0] = 0;

  for (int i = 0; i < N; i++) {
    for (int aa = 0; aa <= N * 10; aa++) {
      for (int bb = 0; bb <= N * 10; bb++) {
        if (dp[i][aa][bb] == 100 * 100) continue;
        dp[i + 1][aa][bb] = min(dp[i + 1][aa][bb], dp[i][aa][bb]);
        dp[i + 1][aa + a[i]][bb + b[i]] = min(dp[i + 1][aa + a[i]][bb + b[i]], dp[i][aa][bb] + c[i]);
      }
    }
  }

  int ans = 100 * 100;
  for (int aa = 1; aa <= N * 10; aa++) {
    for (int bb = 1; bb <= N * 10; bb++) {
      if (aa * MB == bb * MA) {
        ans = min(ans, dp[N][aa][bb]);
      }
    }
  }

  if (ans == 100 * 100) ans = -1;
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}




Measured memory_bytes: 25984
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define mp make_pair
using namespace std;
const int MX = 1e5+5;
int n,a[MX];
int main(){
    cin >> n;
    for(int i=0 ; i<n ; ++i)
        cin >> a[i];
    for(int i=n-2 ; i>=0 ; --i){
        if(a[i] <= a[i+1])continue;
        if(a[i]-1 <= a[i+1]){
            a[i]--;
            continue;
        }
        puts("No");
        return 0;
    }
    puts("Yes");
}

Measured memory_bytes: 640
import math
#import numpy


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


n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
# print(x)
a = 0
for i in range(0, n-1):
    for j in range(i+1, n):
        sum = 0
        for k in range(d):
            #print(i, j, k)
            sum += ((x[i][k]-x[j][k])**2)
        sum = sum**0.5
        # print(sum)

        if sum == int(sum):
            a += 1

print(a)


Measured memory_bytes: 3188
import sys
x,y=map(int,input().split())
n=(x+y)//3
a,b=-1,-1
if (n*3)!=(x+y):
	print(0)
	sys.exit()
for i in range(n+1):
	#print(i*2+(n-i),i+(n-i)*2)
	if i*2+(n-i)==x and i+(n-i)*2==y:
		a,b=i,n-i
#a:x+1 y+2
#b:x+2 y+1
if a<0 or b<0:
	print(0)
	sys.exit()

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
print(cmb(a+b,a)%(10**9+7))

Measured memory_bytes: 102540
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N;
LL s[100001];
bool used[100001];
vector<LL>v;
void divide(LL x){
   LL temp=x*x*x;
   REP(i,N){
       while(s[i]%temp==0)s[i]=s[i]/temp;
   }
}
 
//エレナんちゃら
void erenamchara(){
     REP(i,100001)used[i]=false;
     for(LL i=2;i*i*i<10000000001;i++){
         if(used[i])continue;
         divide(i);
         for(LL j=i;j*j*j<10000000001;j+=i){
             used[j]=true;
         }
     }
}

//鰓何茶ら２
void erenamchara2(){
     REP(i,100001)used[i]=false;
     for(LL i=2;i*i<10000000001;i++){
         if(used[i])continue;
         v.push_back(i);
         for(LL j=i;j*j<10000000001;j+=i){
             used[j]=true;
         }
     }
}

 
map<LL,int>m;
 
int main(){
    cin>>N;
    REP(i,N){
       cin>>s[i];
    }
    erenamchara();
    REP(i,N){
        if(m.find(s[i])!=m.end()){
           m[s[i]]=m[s[i]]+1;
        }else{
           m[s[i]]=1;
        }
    }
    erenamchara2();
    //ダメなケース
    //同じの3つ
    //1が2つ以上
    //ab^2*a^2*b
    //REP(i,N)cout<<s[i]<<endl;
    LL ans=0;
    if(m.find(1)!=m.end())ans++;
    REP(i,N){
        if(s[i]==1)continue;
        //if(s[i]>100000)continue;
        if(m.find(s[i])==m.end())continue;
        LL first=1;
        LL second=1;
        LL temp=s[i];
        REP(j,v.size()){
            while(temp%(v[j]*v[j])==0){
               second*=v[j];
               temp/=(v[j]*v[j]);
            }
            while(temp%v[j]==0){
               first*=v[j];
               temp/=v[j];
            }
            if(temp<v[j]*v[j]){
               first*=temp;
               temp=1;
               break;
            }
            if(first*first>10000000001){
               temp=2;break;
            }
        }
        //cout<<first<<" "<<second<<endl;
        //cout<<s[i]<<" "<<first*first*second<<endl;
        //cout<<endl;
        if(temp!=1){
           ans+=m[s[i]];
        }else if(m.find(first*first*second)!=m.end()){
           ans+=max(m[first*first*second],m[s[i]]);
           m.erase(first*first*second);
        }else{
           ans+=m[s[i]];
        }
        m.erase(s[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 9628
#include <stdio.h>
#include <math.h>
int main()
{
    int i,j,a,b,x=0,y;
    scanf("%d%d",&a,&b);
    if(b<=9)
        x=a*10+b;
    else if(b<=99)
        x=a*100+b;
    else
        x=a*1000+100;
    if((int)(sqrt(x))*(int)(sqrt(x))==x)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

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

#define testcase            int t; cin>>t; while (t--)
#define FOR(i,x,y)          for(int i=x;i<y;i++)
#define RFOR(i,x,y)         for(int i=x;i>=y;i--)
#define vout(v)             for(int ind=0;ind<v.size();ind++){ cout<<v[ind]; if(ind<v.size()-1) cout<<' '; else cout<<endl;}
#define sc(a)               scanf("%lld",&a)
#define sc2(a,b)            scanf("%lld %lld",&a,&b)
#define pb                  push_back
#define reversed(s)         reverse(s.begin(), s.end())
#define asort(s)            sort(s.begin(), s.end())
#define dsort(s)            sort(s.begin(), s.end(),greater<ll>())
#define gtl(x)              getline(cin, (x))
#define PI                  acos(-1)
#define CLR(x, y)           memset(x, y, sizeof(x))
#define Precision(a)        cout << fixed << setprecision(a)
#define FasterIo            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                "\n"
#define MAXP                2000006
#define MOD                 10000007
#define EPS                 1e-7

template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}

bool cmp(pair<int , int>a, pair<int, int>b){
    return (a.first<b.first);
}
int main()
{
    FasterIo
    string s, x;
    cin >> s;
    x=s;
    if((s[s.size()-1])=='s') cout << x << "es" << endl;
    else cout << s << "s\n";
    return 0;
}



Measured memory_bytes: 3604