akhauriyash/Code-Regression huggingface dataset:
st = []
while(1):
    a1 = input()
    if a1 =='.':
        break
    a2 = input()
    b1 = a1.split('"')
    b2 = a2.split('"')
    cnt = 0
    if len(b1)==len(b2):
        for i in range(0,len(b1)):
            if i%2==0:
                if b1[i]!=b2[i]:
                    cnt+=10000
                    break
            if i%2!=0:
                if b1[i]!=b2[i]:
                    cnt+=1
    else:
        cnt+=10000
    
    if cnt>1:
        st.append("DIFFERENT")
    if cnt==1:
        st.append("CLOSE")
    if cnt==0:
        st.append("IDENTICAL")

for i in range(len(st)):
    print(st[i])


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

int main()
{
    cout << 29947 << endl;
    
    /* make 1 */
    cout << "< 2 0 5" << endl;  // should a++ b++?
    cout << "< 2 1 6" << endl;
    cout << "+ 5 6 7" << endl;
    cout << "< 2 7 100" << endl;    // a[100] = 1
    
    cout << "+ 0 100 3" << endl;    // a[3] = A + 1
    cout << "+ 1 100 4" << endl;    // a[4] = B + 1
    
    /* make 2 ^ k a[100] ~ a[129] */
    for(int i = 1; i < 30; i++){
        cout << "+ " << 100 + i - 1 << " " << 100 + i - 1 << " " << 100 + i << endl;
    }
    
    cout << "< 0 0 5" << endl;  // a[5] = 0
    
    /* specify A */
    for(int i = 29; i >= 0; i--){
        cout << "+ 5 " << 100 + i << " 6" << endl;  // a[5] = now A, a[6] = new A
        
        /* ith bit */
        cout << "< 6 3 " << 200 + i << endl;    // new A < A + 1 <=> ith bit stand
        
        /* a[7] = 2 ^ i or 0 */
        cout << "+ 99 " << 200 + i << " 7" << endl;
        for(int j = 0; j < i; j++){
            cout << "+ 7 7 7" << endl;
        }
        
        cout << "+ 5 7 5" << endl;  // renew A
    }
    
    cout << "< 0 0 5" << endl;  // a[5] = 0
    
    /* calc A * B */
    for(int i = 29; i >= 0; i--){
        cout << "+ 5 " << 100 + i << " 6" << endl;  // a[5] = now B, a[6] = new B
        
        /* ith bit */
        cout << "< 6 4 " << 300 + i << endl;    // new B < B + 1 <=> ith bit stand
        
        for(int j = 0; j < 30; j++){
            /* (flag (A & 2 ^ j)) & (flag (B & 2 ^ i)) */
            cout << "+ " << 300 + i << " " << 200 + j << " 8" << endl;
            cout << "< 100 8 7" << endl;
            
            for(int k = 0; k < i + j; k++){
                cout << "+ 7 7 7" << endl;
            }
            
            cout << "+ 2 7 2" << endl;
        }
        
        /* a[7] = 2 ^ i or 0 */
        cout << "+ 99 " << 300 + i << " 7" << endl;
        for(int j = 0; j < i; j++){
            cout << "+ 7 7 7" << endl;
        }
        
        cout << "+ 5 7 5" << endl;  // renew B
    }
}


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

int main()
{
    int N;
    char input;
    vector<char> S;
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> input;
        S.push_back(input);
    }

    int f = 0, b = 0;
    int f_add = 0, b_add = 0;
    for (char c : S) {
        if (c == '(') {
            f++;
        } else if (c== ')') {
            if (f == 0) {
                f_add++;
            } else {
                f--;
            }
        }
    }

    for (int i = 0; i < f_add; i++ ){
        cout << '(';
    }
    for (char c: S) {
        cout << c;
    }
    for (int i = 0; i < f; i++ ) {
        cout << ')';
    }

    cout << endl;
}


Measured memory_bytes: 256
Border = 1_000_000

until (n = $<.gets.to_i).zero?
  data = Hash.new(0)
  entry = []
  n.times do
    e, p, q = $<.gets.split.map(&:to_i)
    data[e] += p * q
    entry << e if data[e] >= Border
  end
  puts entry.empty? ? "NA" : entry
end


Measured memory_bytes: 6888
import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline
 
def main():
  n = int(input())
  ans = 0
  for i in range(1, n+1):
    res = n // i
    ans += i * res*(res+1) //2
  print(ans)

if __name__=='__main__':
  main()

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
    for (int i = 0; i < n; ++i) cin >> s[i];
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (s[i][j] == '#') continue;
            vector<vector<bool>> visited(n, vector<bool>(m, false));
            queue<pair<pair<int, int>, int>> Q;
            Q.push(make_pair(make_pair(i, j), 0));
            visited[i][j] = true;
            int res = 0;
            while (!Q.empty()) {
                pair<pair<int, int>, int> e = Q.front();
                Q.pop();
                res = max(res, e.second);
                for (int i = 0; i < 4; ++i) {
                    int nx = e.first.first + dx[i], ny = e.first.second + dy[i];
                    if (nx >= 0 && nx < n && ny >= 0 && ny < m && visited[nx][ny] == false && s[nx][ny] == '.') {
                        Q.push(make_pair(make_pair(nx, ny), e.second + 1));
                        visited[nx][ny] = true;
                    }
                }
            }
            ans = max(ans, res);
        }
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

long long n,sh[2];
priority_queue<long long> pq[2];

int main()
{
	long long i,ii,k,l,e,u,w,z=0;
	
	scanf("%lld",&n);
	for(i=0;i<n;i++)
	{
		scanf("%lld%lld",&k,&l);
		sh[0]+=l-k;
		if(i)
		{
			z+=max(pq[0].top()-sh[0]-k,0ll)+max(k+pq[1].top()-sh[1],0ll);
		}
		e=i&&k>pq[0].top()-sh[0];
		u=!e*2-1;
		for(ii=0;ii<2;ii++)
		{
			pq[e].push(k*u+sh[e]);
		}
		w=(pq[e].top()-sh[e])*u;
		pq[!e].push(w*-u+sh[!e]);
		pq[e].pop();
		sh[1]+=l-k;
	}
	printf("%lld\n",z);
}

Measured memory_bytes: 2036
#include <stdio.h>

int main(void)
{
	int debt=100000, interest;
	int i, week;
	scanf("%d", &week);

	for(i=0; i<week; i++)
	{
		interest = debt*5/100;
		if(interest%1000)
		{
			interest -= interest%1000;
			interest += 1000;
		}
		debt += interest;
	}
	printf("%d\n", debt);
	return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
 int main()
{
 int n,i,x;
 scanf("%d",&n);
 for(i=1;i<=n;i++){
         x=i;
         if(i%3==0||i%10==3||i/10%10==3||i/100%10==3||i/1000==3)
               printf(" %d",i);
                   }
  printf("\n");
 return 0;

}
               



Measured memory_bytes: 2100
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

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

a = readInt()
print(a+a**2+a**3)

Measured memory_bytes: 9460
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define LL long long
using namespace std;
const LL Maxn = 1010;
const LL Mod = 1e9+7;
LL jc[Maxn*Maxn], inv[Maxn*Maxn];
LL n, m;
LL a[Maxn], b[Maxn];
LL c[Maxn<<1], cl;
bool ba[Maxn*Maxn], bb[Maxn*Maxn];
LL C(LL x, LL y) {
	if(x < y) return 0;
	return jc[x]*inv[y]%Mod*inv[x-y]%Mod;
}
int main() {
	LL i, j, k;
	scanf("%lld%lld", &n, &m);
	jc[0] = 1;
	for(i = 1; i <= n*m; i++) jc[i] = jc[i-1]*i%Mod;
	inv[0] = inv[1] = 1;
	for(i = 2; i <= n*m; i++) inv[i] = inv[Mod%i]*(Mod-Mod/i)%Mod;
	for(i = 2; i <= n*m; i++) inv[i] = inv[i-1]*inv[i]%Mod;
	for(i = 1; i <= n; i++){
		scanf("%lld", &a[i]), c[++cl] = a[i];
		if(ba[a[i]] == true){ printf("0\n"); return 0; }
		ba[a[i]] = true;
	}
	for(i = 1; i <= m; i++){
		scanf("%lld", &b[i]), c[++cl] = b[i];
		if(bb[b[i]] == true){ printf("0\n"); return 0; }
		bb[b[i]] = true;
	}
	sort(a+1, a+n+1);
	sort(b+1, b+m+1);
	sort(c+1, c+cl+1);
	cl = unique(c+1, c+cl+1) - (c+1);
	LL nn = n, mm = m, used = 0;
	i = 1; j = 1;
	LL ans = 1;
	for(k = 1; k <= cl && ans > 0; k++){
		if(a[i] == c[k] && b[j] == c[k]){
			LL p = nn+mm-1;
			nn--; mm--; i++; j++;
			ans = ans*C(c[k]-used-1, p-1)%Mod*jc[p-1]%Mod;
			used += p;
		} else if (a[i] == c[k]){
			LL p = mm;
			nn--; i++;
			ans = ans*C(c[k]-used-1, p-1)%Mod*jc[p]%Mod;
			used += p;
		} else {
			LL p = nn;
			mm--; j++;
			ans = ans*C(c[k]-used-1, p-1)%Mod*jc[p]%Mod;
			used += p;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 16000
module ArrayL = ArrayLabels
module ListL = ListLabels

let dbg = Printf.printf "[debug]%s"

let max_num = 1_000_000_000

let id = fun x -> x
let tuple2 x y = (x,y)
let tuple3 x y z = (x,y,z)
let succ x = x + 1
let pred x = x - 1

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scan fmt f = Scanf.sscanf (read_line ()) fmt f

let scan_lines n fmt f =
  List.map (fun _ -> scan fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let between n x m = n <= x && x < m

let string_to_list s =
  List.map (String.get s) (0 ++^ String.length s)

let (v,e,r) = scan "%d %d %d" tuple3
let ls = scan_lines e "%d %d %d" tuple3
let edges =
  let arr = Array.make v [] in
  ListL.iter ls ~f:(fun (s,t,d)->
      arr.(s) <- (t,d)::arr.(s));
  arr

let dists = Array.make v max_num
let visited = Array.make v false

module Heap = Set.Make(struct
    type t = int*int
    let compare (x0, y0) (x1,y1) =
      match compare y0 y1 with
      | 0 -> compare x0 x1
      | c -> c
  end)

let rec solve h =
  if Heap.is_empty h then ()
  else
    let (t, dist) = Heap.min_elt h in
    if visited.(t) then solve @@ Heap.remove (t, dist) h
    else
      begin
        visited.(t) <- true; dists.(t) <- dist;
        solve @@ ListL.fold_left edges.(t)
          ~init:(Heap.remove (t, dist) h) ~f:(fun h (s, d) ->
              if not visited.(s) then Heap.add (s, dists.(t) + d) h
              else h)
      end

let () =
  solve @@ (Heap.empty |> Heap.add (r,0));
  ArrayL.iter dists ~f:(fun v ->
      if v = max_num then print_string "INF\n"
      else Printf.printf "%d\n" v)



Measured memory_bytes: 120456
n,x = gets.split.map(&:to_i)
L = gets.split.map(&:to_i)
count = 0
D = []
D[0] = 0
(1..n).each do |i|
  D[i] = D[i-1] + L[i-1]
end
D.each do |d|
  if d <= x
    count += 1
  end
end
p count

Measured memory_bytes: 1788
N = int(input())
D = list(map(int,input().split()))
mod = 998244353 
flg = True

if D[0] != 0:
    flg = False
    
D.sort()
T = [0 for _ in range(N + 1)]

for i in range(N):
    T[D[i]] += 1

i = 0
ans = 1
if T[i] != 1:
    flg = False

pre = T[i]
i += 1
while T[i] != 0:
    ans *= pow(pre,T[i])
    ans %= mod
    pre = T[i]
    i += 1

while i < N:
    if T[i] > 0:
        flg = False
    i += 1

ans %= mod
if flg:
    print(ans)
else:
    print(0)

Measured memory_bytes: 56176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
ll n;
ll c[200020];
vector<vector<int>> v(200200);
bool used[200020]={};
 
ll x[200020];
 
void dfs(int p, ll d){
    used[p] = true;
    d+=x[p];
    c[p] += d;
    for(auto i:v[p]){
        if(!used[i]){
            dfs(i,d);
        }
    }
}
 
signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    ll q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    while(q--){
        ll a,y;
        cin>>a>>y;
        a--;
        x[a]+=y;
    }
    dfs(0,0);
    ll ans = 0;
    for(int i=0;i<n;i++){
        cout << c[i] << " ";
    }
    cout<<endl;
 
 
 
}

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

int main(){
    int n[10];
    int temp = 0;
	for (int i = 0; i < 10; i++) {
		cin >> n[i];
	}
	for (int i = 0; i < 10; i++) {
	    for (int j = i; j < 10; j++) {
            if(n[j] > n[i]){
                temp = n[i];
                n[i] = n[j];
                n[j] = temp;
            }
	    }
	}
	for (int i = 0; i < 3; i++) {
		cout << n[i] << endl;
	}

    return 0;
}

Measured memory_bytes: 3116
#include <vector>
#include <algorithm>
#include <iostream>
int main(void) {
	int N = 0;
	std::cin >> N;
	std::vector<int> A(N);
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
	}
	std::sort(A.begin(), A.end());
	std::cout << A[N - 1] - A[0];
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

ll dp[110][4][4][4];

int main()
{
    ll n;
    cin >> n;

    dp[0][3][3][3] = 1;

    rep(len, 0, n + 1)
    rep(c1, 0, 4)
    rep(c2, 0, 4)
    rep(c3, 0, 4)
    rep(now, 0, 4)
    {
        if (now == 2 and c1 == 1 and c2 == 0) continue;
        if (now == 2 and c1 == 1 and c3 == 0) continue;
        if (now == 2 and c1 == 0 and c2 == 1) continue;
        if (now == 1 and c1 == 2 and c2 == 0) continue;
        if (now == 2 and c2 == 1 and c3 == 0) continue;

        dp[len + 1][now][c1][c2] += dp[len][c1][c2][c3];
        dp[len + 1][now][c1][c2] %= MOD;
    }

    ll ans = 0;
    rep(c1, 0, 4)
    rep(c2, 0, 4)
    rep(c3, 0, 4)
    {
        ans += dp[n][c1][c2][c3];
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
Program PanasonicC
   Implicit none
   Integer(8)::a,b,c

      Read(*,*) a,b,c
      If (4*a*b<(c-a-b)**2.AND.c-a-b>0) then
         Write(*,*) 'Yes'
      Else
         Write(*,*) 'No'
      End If
      Stop

   End Program PanasonicC

Measured memory_bytes: 384
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;
using Debug = System.Diagnostics.Debug;

static class P
{
    const long MAX = 1000000000;
    static void Main()
    {
        long s = long.Parse(Console.ReadLine());
        if (s == 1000000000000000000)
        {
            Console.WriteLine($"0 0 0 {MAX} {MAX} 0");
            return;
        }
        Console.WriteLine($"1 0 0 {MAX} {s / MAX + 1} {s % MAX}");
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
int main(void)
{
    int r,c;
    int i,j,k;
    int sum;
    int sheet[101][101];
    scanf("%d %d",&r,&c);
    for(;;)
    {
            for(i=0;i<r;i++)
            {
                for(j=0;j<c;j++)
                scanf("%d",&sheet[i][j]);
    }
    for(i=0;i<r;i++)
        {
            int sum = 0;
    for(j=0;j<c;j++)
        {
            sum += sheet[i][j];
    } sheet[i][j] = sum;
    }
    for(i=0;i<=c;i++)
    {
            sum = 0; for(j=0;j<r;j++)
            {
                sum += sheet[j][i];
    }
    sheet[j][i] = sum;
    }
    for(i=0;i<=r;i++)
        {
            for(j=0;j<=c;j++)
            {
                if(j) printf(" ");
    printf("%d",sheet[i][j]);
    }
    printf("\n");
    }
    return 0;
    }
    }



Measured memory_bytes: 2104
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second

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

int n,a,b;

int main(){
    ios_base::sync_with_stdio(false);

    cin>>n;
    if(n==1)cout<<"Hello World\n";
    else if(n==2){
        cin>>a>>b;
        cout<<a+b<<"\n";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll MOD = 1000000007;

int nums[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    int k;
    cin >> k;
    cout << nums[k - 1] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const int int_max = 2147483647;

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 / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

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

	ll ans = 0;
	ll tmp = 0;
	rep(i, 0, S.size()) {
		if (S[i] == 'R') {
			tmp++;
		}
		else {
			ans = max(ans, tmp);
			tmp = 0;
		}
	}
	ans = max(ans, tmp);
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}





int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    
    int N, K;
    while (cin >> N >> K) {
        vector<long long> H(N);
        for (int i = 0; i < N; ++i) cin >> H[i];
        sort(H.begin(), H.end(), greater<long long>());
        for (int i = 0, j = 0; i < N && j < K; ++i, ++j) {
            H[i] = 0;
        }
        long long res = 0;
        for (int i = 0; i < N; ++i) res += H[i];
        cout << res << endl;
    }
}


















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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define pb push_back

using namespace std;

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

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

void solve() {

}

int main() {
  /*
    a-k = b-k -> 2k = b-a -> k = (b-a)/2
    a-k = k-b -> a+b = 2k -> k = (a+b)/2
  */
  int a,b;
  cin >> a >> b;
  if( (a+b)%2 == 0 ) cout << (int)((a+b)/2) << endl;
  else if( (b-a)%2 == 0 ) cout << (int)((b-a)/2) << endl;
  else puts("IMPOSSIBLE");
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }



int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t = 1;
	//cin >> t;
	while (t--) {
		int x;
		cin >> x;
		int ans = 1, num = 1800;
		while (x < num) num -= 200, ans++;
		cout << ans << endl;
	}


	return 0;
}


Measured memory_bytes: 3688
from collections import defaultdict

def meguru_bisect(ng, ok):
    """
    初期値のng,okを受け取り, check=>Trueを満たす最大値(最小値)を返す
    条件を満たす最大値を求める場合、初期値は(ng:上限の外, ok:下限の外)   例) 10**9+1, -1
    条件を満たす最小値を求める場合、初期値は(ng:下限の外, ok:上限の外)   例) -1, 10**9+1
    上限の外や下限の外が返ってくる場合は条件を満たす値が範囲内になかったことを示すので、例外処理が必要
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok

def check(x):
    index = defaultdict(int)
    disused = set()
    while True:
        count = defaultdict(int)
        for i in range(n):
            while A[i][index[i]] in disused:
                index[i] += 1
                if index[i] >= m:
                    return False
            count[A[i][index[i]]] += 1
        max_count = max(count.values())
        if max_count <= x:
            return True
        else:
            disused.add([key for key, value in count.items() if value == max_count][0])

n, m = (int(x) for x in input().split())
A = [list(int(x) for x in input().split()) for _ in range(n)]
ans = meguru_bisect(0, n + 1)
print(ans)


Measured memory_bytes: 76016
s = input()

p1 = s[0:2]
p2 = s[2:4]

m = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]

if (p1 not in m and p2 in m):
	print("YYMM")
elif (p1 in m and p2 in m):
	print("AMBIGUOUS")
elif (p1 not in m and p2 not in m):
	print("NA")
else:
	print("MMYY")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(auto& e : v) cin >> e;
  int res = 0;
  for(int i = 0; i < n; ++i)
    for(int j = i + 1; j < n; ++j) res += v[i] * v[j];
  std::cout << res << std::endl;
  return 0;  
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
int const MAXN=100100;
int n, m, dp[MAXN];
vector<int> g[MAXN];
int dfs(int node){
	if(dp[node]!=-1)
		return dp[node];
	int best=0;
	for(int x:g[node])
		best=max(best,1+dfs(x));
	return dp[node]=best;
}
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a, b;
		cin>>a>>b;
		g[a].push_back(b);
	}
	memset(dp,-1,sizeof(dp));
	int ans=0;
	for(int i=1;i<=n;i++)
		if(dp[i]==-1)
			ans=max(ans,dfs(i));
	cout<<ans;
}


Measured memory_bytes: 7552
def prime_fact(n):
    a=[]
    while n%2==0:
        a.append(2)
        n //=2
    f=3
    while f**2<=n:
        if n%f==0:
            a.append(f)
            n //=f
        else:f +=2
    if n!=1:a.append(n)
    return a

a,b=map(int,input().split())
a_key=set(prime_fact(a))
b_key=set(prime_fact(b))
print(len(a_key&b_key)+1)

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

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

int H,W;
int fld[10][10];
int lim;
void change(int y,int x,int c,int f){
    fld[y][x]=c;
    for(int d=0;d<4;d++){
        int ny=y+dy[d],nx=x+dx[d];
        if(ny<0||ny>=H||nx<0||nx>=W||fld[ny][nx]!=f)continue;
        change(ny,nx,c,f);
    }
}

bool dfs(int t=0){
    bool ok=true;
    for(int i=0;i<H;i++)for(int j=0;j<W;j++){
        if(fld[0][0]!=fld[i][j])ok=false;
    }
    if(ok)return true;
    if(t==lim)return false;

    int _fld[10][10];
    for(int i=0;i<H;i++)for(int j=0;j<W;j++){
        _fld[i][j]=fld[i][j];
    }

    bool ret=false;
    for(int k=0;k<3;k++)if(k!=fld[0][0]){
        change(0,0,k,fld[0][0]);
        ret|=dfs(t+1);
        for(int i=0;i<H;i++)for(int j=0;j<W;j++){
            fld[i][j]=_fld[i][j];
        }
    }

    return ret;
}
int main(){
    while(cin>>W>>H,W||H){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                char c;
                cin>>c;
                switch(c){
                case 'R':fld[i][j]=0;break;
                case 'G':fld[i][j]=1;break;
                case 'B':fld[i][j]=2;break;
                }
            }
        }

        for(lim=0;;lim++)if(dfs())break;
        cout<<lim<<endl;
    }

    return 0;
}

Measured memory_bytes: 1168
a1,b1,m1 = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)
b = gets.split(' ').map(&:to_i)

m = m1.times.map{gets.split(' ').map(&:to_i)}

ans = []
vouchers = []
ans << a.min + b.min

m1.times do |i|
	vouchers << a[m[i][0]-1] + b[m[i][1]-1] - m[i][2]
end

ans << vouchers.min

puts ans.min

Measured memory_bytes: 18956
n = int(input())
s = input()
a = len(s)
ans = []
#a=65,b=66,z=90
for i in range(a):
    j = ord(s[i])
    j += n
    if j>90:
        j -= 26
    s = s[:i] + chr(j) + s[i+1:]
print(s)


Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e18+7;
const ll MOD=1e9+7;
const ll N = 1007;

int main(){
	ll n,m;
	cin>>n>>m;
	vector<ll> a(n),b(n);
	FOR(i,0,n)cin>>a[i];
	b[0]=a[0]%m;
	FOR(i,1,n)b[i]=(b[i-1]+a[i])%m;
	ll ans = 0;
	SORT(b);
	FOR(i,0,n){
		ll k = NUM(b,b[i]);
		if(b[i]==0)k++;
		ans += (k*(k-1))/2;
		i += k-1;
		if(b[i]==0)i--;
	}
	pri(ans);
}

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

int a[30];
int b[30];
int dp[31][1 << 16];

int main()
{
	int n, c;
	while (scanf("%d %d", &n, &c), n){
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		memset(dp, -1, sizeof(dp));
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 16; j++){
				int x;
				scanf("%d", &x);
				a[i] |= (x << j);
			}
		}
		for (int i = 0; i < c; i++){
			for (int j = 0; j < 16; j++){
				int x;
				scanf("%d", &x);
				b[i] |= (x << j);
			}
		}
		
		dp[0][0] = 0;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < (1 << 16); j++){
				if (dp[i][j] == -1) continue;
				int x = a[i] | j;
				for (int k = 0; k < c; k++){
					int y = x & b[k];
					int cnt = 0;
					
					int z = y;
					while (z & -z){
						cnt++;
						z -= (z & -z);
					}
					dp[i + 1][x - y] = max(dp[i + 1][x - y], dp[i][j] + cnt);
				}
			}
		}
		
		int res = 0;
		for (int i = 0; i < (1 << 16); i++){
			res = max(res, dp[n][i]);
		}
		printf("%d\n", res);
	}
	return 0;
}

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define ll          long long int
#define pii         pair<int,int>
#define uu          first
#define vv          second
#define fastIO      ios::sync_with_stdio(0);cin.tie(0);
using namespace std;

const int MAX = 2e5 + 5;
const int MOD = 1e9 + 7;
int main()
{
    fastIO;
    int h, w;
    cin>>h>>w;
    
    vector< vector<int> > grid(h+1, vector<int>(w+1));
    auto dp = grid;
    
    for(int i =1 ; i <=h ; i++ ) {
        string s;
        cin>>s;
        s = '*' + s;
        for(int j = 1; j <= w ; j++) {
            if(s[j] == '#') grid[i][j] = -1;
        }
    }
    dp[1][1] = 1;
    
    for(int i =1 ;i<= h ; i++ ) {
        for(int j =1  ; j <= w; j++ ) {
            if(i ==1 && j ==1 ) continue;
            if(grid[i][j] ==-1 ) continue;
            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
        }
    }
    cout<<dp[h][w]<<'\n';
    return 0;
}

Measured memory_bytes: 11480
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;             \
                               c > 0 ? i < b : i > b; \
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x) 
#endif

#else
const bool test = false;
#define dump(x) 
#endif

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while (getline(ss, buffer, sep))
    {
        v.push_back(buffer);
    }
    return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
    return accumulate(begin, end, 0ll);
}

void solve();

class Solver {
    public:
    int N;
    int a[MAX];
    void solve() {
        cin >> N;
        rep(i, N) cin >> a[i];
        int sum_v1 = a[0];
        int sum_v2 = sum(a, a + N) - a[0];
        int res = abs(sum_v1 - sum_v2);
        rep2(i, 1, N) {
            res = min(res, abs(sum_v1 - sum_v2));
            sum_v1 += a[i];
            sum_v2 -= a[i];
        }
        cout << res << endl;
    }
};

signed main()
{
    cout << fixed << setprecision(20);
    auto ptr = new Solver();
    ptr->solve();
    delete ptr;
    // while (true) {    
    //     auto ptr = new Solver();
    //     ptr->solve();
    //     delete ptr;
    // }
    return 0;
}

// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'




Measured memory_bytes: 1792
<?php
$N = fgets(STDIN);
$d = fgets(STDIN);
$arrayD =  explode(" ", $d);

$result = 0;
for ($i = 0; $i < $N - 1; $i ++) {
    for ($j = $i + 1; $j < $N; $j ++) {
        $result += $arrayD[$i] * $arrayD[$j];
    }
}
echo $result;

Measured memory_bytes: 3828
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    X, Y = NMI()
    if (2*Y - X)%3 or (2*X - Y)%3:
        print(0)
        exit()

    A = (2*Y - X) // 3
    B = (2*X - Y) // 3
    if A < 0 or B < 0:
        print(0)
        exit()
    print(combinations_mod(A+B, A))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  int N;
  cin >> N;
  ll x[N],y[N],dist[N];
  for(int i=0;i<N;i++){
    cin >> x[i] >> y[i];
    dist[i] = abs(x[i]) + abs(y[i]);
  }

  int cnte=0;
  int cnto=0;
  for(int i=0;i<N;i++){
    if(dist[i]%2 == 0) cnte++;
    else cnto++;
  }

  if(cnte>0 && cnto>0){
    cout << -1 << endl;
    return 0;
  }

  ll beki[32]; // ={1,2,4,8,...,2^30,1}
  for(int i=0;i<=30;i++) beki[i]=1LL << i;
  beki[31] = 1LL;

  //ずげての点が奇数
  if(cnte==0){
    cout << 31 << endl;

    for(int i=0;i<=30;i++) cout << beki[i] << " ";
    cout << endl;

    for(int i=0;i<N;i++){
      char mode[31];
      ll xnow=x[i];
      ll ynow=y[i];
      for(int j=30;j>=0;j--){
        if(abs(xnow)>abs(ynow)){
          if(xnow<0){
            xnow+=beki[j];
            mode[j]='L';
          }else{
            xnow-=beki[j];
            mode[j]='R';
          }
        }else{
          if(ynow<0){
            ynow+=beki[j];
            mode[j]='D';
          }else{
            ynow-=beki[j];
            mode[j]='U';
          }
        }
      }

      for(int j=0;j<=30;j++) cout << mode[j];
      cout << endl;
    }
    return 0;
  }

  //すげての点が偶数
  if(cnto==0){
    cout << 32 << endl;

    for(int i=0;i<=31;i++) cout << beki[i] << " ";
    cout << endl;

    for(int i=0;i<N;i++){
      char mode[32];
      ll xnow=x[i];
      ll ynow=y[i];
      for(int j=31;j>=0;j--){
        if(abs(xnow)>abs(ynow)){
          if(xnow<0){
            xnow+=beki[j];
            mode[j]='L';
          }else{
            xnow-=beki[j];
            mode[j]='R';
          }
        }else{
          if(ynow<0){
            ynow+=beki[j];
            mode[j]='D';
          }else{
            ynow-=beki[j];
            mode[j]='U';
          }
        }
      }

      for(int j=0;j<=31;j++) cout << mode[j];
      cout << endl;
    }
    return 0;
  }

  return 0;
}

Measured memory_bytes: 256
def g;gets.split.map &:to_i;end
while(m,_,o,d=g;m>0)
l=g
h=Hash.new{|i,k|i[k]={}}
d.times{
a,b,c=gets.split
h[a][b]=h[b][a]=c.to_i
}
q=[[?H,[],0],[0,0,1e9]]
x=1e9
e={}
while(a,b,c=q.shift;a)
e[t=[a,b]]&&e[t]<=c&&next
e[t]=c
a==?D&&x>c&&x=c
h[a].each{|k,v|
b.index(k)||(
u=k[0]==?C?[k,(b+[k]).sort,c+v*o-l[k[1].to_i-1]]:[k,b,c+v*o]
q[(0...q.size).bsearch{|i|q[i][2]>u[2]},0]=[u]
)
}
end
p x
end

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

int main(){
  int N,X,d,count;
  cin>>N>>X;
  vector<int> l(N);
  for (int i=0; i<N ; i++)
    cin>>l[i];
  
  d=0;
  count=1;
  
  for (int i=0; i<N ; i++){
    
    d+=l[i];
    if (d<=X)
      count++;
    else
      break;
  }
  cout<<count<<endl;
}
  

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

int main(){
	int w,h,a,b,k,n;
	cin >> w >> h >> n;
	
	int x=0,y=0,x2=w,y2=0,x3=0,y3=h;
	for(int i=0;i<n;i++){
		cin >> a >> b >> k;
		if(k==1){
			x=max(x,a);
		}
		else if(k==2){
			x2=min(x2,a);
		}
		else if(k==3){
			y=max(y,b);
		}
		else if(k==4){
			y3=min(y3,b);
		}
	}
	int X=x2-x;
	int Y=y3-y;
	if(X>0&&Y>0) cout << X*Y << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#define ll long long
using namespace std;

int main() {
	char inp[16];
	scanf("%s", inp);
	int len = strlen(inp);
	int cnt = 0;
	for (int i = 0; i < len; i++) {
		if (inp[i] == 'o')
			cnt++;
	}
	if ((15 - len) + cnt >= 8)
		printf("YES\n");
	else
		printf("NO\n");
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
   public static void main(String[] args) {  
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] num = new int[n];
      for(int i = 0; i < n; i++){
         num[i] = sc.nextInt();
      }
      Arrays.sort(num);
      int alice = 0;
      for(int i = n - 1; i >= 0; i-=2){
         alice += num[i];
      }
      int bob = 0;
      for(int i = n - 2; i >= 0; i-=2){
         bob += num[i];
      }
      System.out.println(alice-bob);
   }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i, 0, n){
        cin >> a[i];
        sum += a[i];
    }
    int t = n * (n + 1) / 2;
    if(sum % t != 0){
        cout << "NO" << endl;
        return 0;
    }
    int c = sum / t;    
    int cnt = 0;
    bool f = true;
    rep(i, 0, n){
        if(a[(i + 1) % n] - a[i] != c){
            int d = a[(i + 1) % n] - a[i];
            int r = (c - d) % n;
            int q = (c - d) / n;
            if(r == 0) cnt += q;
            if(r != 0 || q <= 0 || c < q){
                f = false;
            }
        }
    }
    if(cnt != c) f = false;
    cout << (f ? "YES" : "NO") << endl;
}

Measured memory_bytes: 1152
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    while(true){
	int n = readln().chomp().to!int;
	if(n==0) break;
	int a,b;
	for(int i=0;i<n;i++){
	    auto s = readln().split().to!(int[]);
	    if(s[0] > s[1]) a += s[0] + s[1];
	    else if(s[0] < s[1]) b += s[0] + s[1];
	    else {
		a += s[0];
		b += s[1];
	    }
	}
	writeln(a," ",b);
    }

}

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

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


Measured memory_bytes: 256
function main(input)
{
 var total_damage = input[1].split(' ').reduce(function(total, damage){
   return total += Number(damage)
 },0)
 var hp = input[0].split(' ')[0];
  
  if(hp - total_damage <= 0){
  	console.log('Yes');
  } else {
    console.log('No');
  }
}


main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))

Measured memory_bytes: 20812
#include <stdio.h>
int main(void){
char a[10];
  scanf("%s",&a);
  if(a[0]=='9'){a[0]='1';}
  else{a[0]='9';}
    if(a[1]=='9'){a[1]='1';}
    else{a[1]='9';}
    if(a[2]=='9'){a[2]='1';}
    else{a[2]='9';}
  printf("%s",a);
return 0;
 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define pb(x) push_back((x))
#define line() cerr << "DEBUG @" << __LINE__ << endl;
#define debug(x) \
  cerr << "DEBUG @" << __LINE__ << " -> " << #x << " = " << x << endl;
using namespace std;

ll dp[2001];
const int mod = 1e9 + 7;

void fast_mod(ll &a, ll b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

ll solve(ll sum) {
  if (sum == 0) {
    return 1;
  }
  ll &mem = dp[sum];
  if (~mem) return mem;
  ll ans = 0;
  for (int i = 3; i <= sum; i++) {
    fast_mod(ans, solve(sum - i));
  }
  return mem = ans;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  memset(dp, -1, sizeof(dp));
  ll ans = solve(n);
  cout << ans << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define rep1(i,n) for(i=1;i<=n;i++)

int main(){
 int n;
 int i,j;
 bool exist = false;
 
 cin >> n;
 rep1(i,9){
   rep1(j,9){
     if(i*j == n){
       exist = true;
     }
   }
 }
 if(exist==true)
   cout << "Yes" << endl;
 else
   cout << "No"  << endl;
   
 
 
  
}

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

int main() {
  int n;
  std::cin >> n;
  uint64_t sum = 0;

  for (int i = 0; i < n; i++) {
    uint64_t a;
    std::cin >> a;
    sum += a - 1;
  }

  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;

    int num = 0;
    while (a >= b)
    {
        ++num;
        b *= 2;
    }
    while (b >= c)
    {
        ++num;
        c *= 2;
    }

    if (num > k) cout << "No\n";
    else cout << "Yes\n";

    return 0;
}



Measured memory_bytes: 3648
# Nは十分大きく偶数
N = int(input())
nums = list(map(int, input().split()))

# ソートして半分の位置にあるP, Qの値を見つけて、Q-Pすればいい
sorted_nums = sorted(nums)

# たとえば6個なら範囲が0-5なので2,3がPQになる
Q = int(N / 2)
P = Q - 1

print(sorted_nums[Q] - sorted_nums[P])

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
    ll n;
    cin >> n;
    cout << (n-1)*n/2 << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N;
	cin >> N;
	vector<int> L(N);
	rep(i,N)cin >> L[i];
	int ans = 0;
	for(int i = 0; i < N; ++i){
		for(int j = i + 1; j < N; ++j){
			for(int k = j + 1; k < N; ++k){
				int a = L[i], b = L[j], c = L[k];
				if(a != b && b != c && c != a && a + b > c && b + c > a && c + a > b)++ans;
			}
		}
	}
	cout << ans << endl;
		return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha() scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb() scanf("%d",&t);while(t--)
#define debug(x) cout<<"LBWNB    "<<x<<"---\n"
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define p() puts("")
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
using namespace std;
typedef long long ll;
const int mod=998244353;
const int inf=1e9+7;
const int maxn=1e6+10;
int t,n,m;
int a[maxn];
int main(){
    scanf("%d%d",&n,&m);
    printf("%d\n",(n-1)*n/2+(m-1)*m/2);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		double r = sc.nextDouble();

		double area = r * r * Math.PI;
		double circumference = r * 2 * Math.PI;

		System.out.printf("%.6f %.6f\n", area, circumference);

		//System.out.println(String.format("%.6f", area) + " " + String.format("%.6f", circumference));
	}
}


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }



int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int x, n; cin >> x >> n;

    if(n == 0){
        cout << x << endl;
        return 0;
    }

    set<int> p;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        p.insert(a);
    }

    int dif = 1000;
    int ans = -1;
    for(int i = 0; i <= 101; i++){
        if(p.count(i) == 1) continue;
        if(dif > abs(x-i)){
            dif = abs(x-i);
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3656