akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>
#include <ctime>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm> // #include <iostream> // using namespace std; srand(time(NULL))

int answer_result = 100000;

void bank(int N, std::vector<int> v, int i,int result,int x) {
  // iteratorの境界を決めている.
  int sub;
    for (int j = i; j >=0 ; j-- ) {
      if (v[0] >= N) {
        sub = 0;
        break;
      }
      if (v[j] <= N) {
        sub = j;
        break;
      }
    }
    i = sub;
    if (sub > 0) {
      // まずはそのまま無視するパターン 
      if (x==0){
        bank(N,v,sub-1,result,1);
      }
      // 次はjを採用するパターン
      sub = N/v[i];
      N = N - v[i]*sub;
      result = result + sub;
      bank(N,v,i,result,0);
      // if (sub > 1) {
      //   N = N + v[i];
      //   bank(N,v,i-1,(result-1),0);
      //   if (sub > 2) {
      //     N = N + v[i];
      //     bank(N,v,i-1,result-2,0);
      //   }
      //   if (sub > 3) {
      //     N = N + v[i];
      //     bank(N,v,i-1,result-3,0);
      //   }
      // }
      if (sub > 1) {
        for (int q = 1; q <= 3; q++) {
          if (sub < q){
            break;
          } 
          N += v[i];
          bank(N,v,i-1,result-q,0);
        }
      }
    }
    else {
      // 6以上の時
      if (N >= 6) {
        result = result + N - 5 ;
        answer_result = (answer_result <= result)?answer_result:result;        
        return ;
      }
      else {
        answer_result = (answer_result <= result + N) ? answer_result: result + N;
        return ;
      }
    }
}

int main () {
  int N;
  std::cin >> N;
  std::vector<int> pow_vector;

  int max_six = 6;
  int max_nine = 9;
  int push_answer = 6;
  for (int i = 0; i < 11; i++ ) {
    if (max_six < max_nine) {
      pow_vector.push_back(max_six);
      max_six = max_six * 6;
    }
    else {
      pow_vector.push_back(max_nine);
      max_nine = max_nine * 9;
    }
  }

  bank(N,pow_vector,10,0,0);
  std::cout << answer_result << std::endl;

}


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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    int len = 1;
    ll kek = 26;
    while (true) {  
        if (n - kek <= 0) {
            break;
        }
        n -= kek;
        len++;
        kek *= 26;
    }
    string ans;
    for (int i = 0; i < len; i++) {
        char orz = '#';
        kek /= 26;
        for (char c = 'a'; c <= 'z'; c++) {
            if ((1 + c - 'a') * kek >= n) {
                orz = c; 
                break;
            } 
        }
        ans += orz;
        n -= max(0, (orz - 'a')) * kek;
    } 
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3660
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {

    let n: usize = read();
    let a: Vec<usize> = (0..n).map(|_| read()).collect();
    let b: Vec<u32> = (0..n).map(|_| read()).collect();
    let c: Vec<u32> = (0..n - 1).map(|_| read()).collect();
    let mut manzoku: u32 = 0;

    for i in 0..n {
        manzoku += b[a[i] - 1];
        if i != 0 {
            if a[i - 1] + 1 == a[i] {
                manzoku += c[a[i - 1] - 1];
            }
        }
    }
    println!("{}", manzoku);
}

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

int main(){
  bool flg=0;
  string tap;
  cin >> tap;

  for(int i=0;i<tap.size();i++) {
    if(i%2) {
      if(tap[i]=='R') {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if(tap[i]=='L') {
        cout << "No" << endl;
        return 0;
      }
    }
  }
    cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

from itertools import accumulate

if N-min(A) <= K:
    print(*[N]*N)
    exit()
    
ans=[0]*(N+1)
for _ in range(K):
    for i,a in enumerate(A):
        ans[max(0,i-a)]+=1
        ans[min(i+a+1,N)]-=1
    A = list(accumulate(ans))[:-1]
    ans=[0]*(N+1)
    if all(i == N for i in A):
        break
print(*A)

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

int main() {
    int n;
    cin >> n;
    vector<int> dp(n), h(n);
    rep(i, n) cin >> h.at(i);
    dp.at(0) = 0;
    dp.at(1) = abs(h.at(1) - h.at(0));
    rep(i, n - 2) dp.at(i + 2) = min(dp.at(i) + abs(h.at(i + 2) - h.at(i)), dp.at(i + 1) + abs(h.at(i + 2) - h.at(i + 1)));
    cout << dp.at(n - 1) << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

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

	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	//どの節点の下にキーを格納するか探す//
	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	//上で決めた節点の左か右のどちらの子になるかをきめる
	z->parent = y;
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y ->key) {
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

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

int main() {
	int n, i, x;
	string com;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		cin >> com;
		if (com == "insert") {
			scanf("%d", &x);
			insert(x);
		}
		else if (com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}

	}

	return 0;
}


Measured memory_bytes: 26756
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ii pair < int, int >
#define iii pair < int, ii >
#define INF 987654321
#define LINF 987654321987654321

const int divid = 1000000007;
vector < ll > pos, neg;

int comp(int a, int b)
{
	return a > b;
}

int main()
{
	cio;

	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; i++)
	{
		ll inp;
		cin >> inp;

		if (inp > 0)
			pos.push_back(inp);
		if (inp <= 0)
			neg.push_back(-inp);
	}

	if (pos.size() == 0 && k % 2 == 1)
	{
		//  답이 유이하게 음수인 경우 ( 곱의 최솟값 구하기)
		sort(neg.begin(), neg.end());

		ll gop = 1;
		for (int i = 0; i < k; i++)
			gop = (gop * (divid - neg[i])) % divid;

		cout << gop;
		 
		return 0;
	}
	else if (n == k)
	{
		// 답이 유이하게 음수인 경우 (가능성)

		ll gop = 1;
		for (int i = pos.size() - 1; i >= 0; i--)
			gop = (gop * pos[i]) % divid;
		for (int i = neg.size() - 1; i >= 0; i--)
			gop = (gop * (divid - neg[i])) % divid;

		cout << gop;

		return 0;
	}

	// 곱의 최댓값 구하기
	neg.push_back(0);
	neg.push_back(0);
	neg.push_back(0);
	neg.push_back(0);

	sort(pos.begin(), pos.end(), comp);
	sort(neg.begin(), neg.end(), comp);

	int kp = k, kn = 0;
	if (kp >= pos.size())
	{
		kp = pos.size();
		kn = k - kp;

		if (kn % 2)
		{
			kp--;
			kn++;
		}
	}

	while (kp > 1)
	{
		ll posgop = pos[kp - 1] * pos[kp - 2];
		ll neggop = neg[kn] * neg[kn + 1];

		if (posgop < neggop)
		{
			kp -= 2;
			kn += 2;
		}
		else
			break;
	}

	ll gop = 1;
	for (int i = 0; i < kp; i++)
		gop = (gop * pos[i]) % divid;
	for (int i = 0; i < kn; i++)
		gop = (gop * neg[i]) % divid;

	cout << gop;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


// 約数列挙
vector<int> divisor(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
            }
    }
    sort(begin(ret), end(ret));
    sort(ret.begin(), ret.end());
    ret.pop_back();
    return (ret);
}

int main(){
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n) {
        int b;
        cin >> b;
        a.push_back(b);
    }
    
    map<int, int> mp;
    rep(i, n) mp[a[i]]++;

    sort(a.begin(), a.end());

    int ans = 0;
    rep(i, n){
        bool flag = 1;
        vector<int> div = divisor(a[i]);
        // rep(j, div.size()) cout << div[j] << " ";
        // cout << endl;
        rep(j, div.size()) if (binary_search(a.begin(), a.end(), div[j])) flag = 0;
        if (mp[a[i]] >= 2) flag = 0;
        if (flag) ans++;
    }

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


Measured memory_bytes: 13320
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String lastWeek = sc.nextLine();
        String thisWeek;
        if(lastWeek.equals("ARC")) {
            System.out.println("ABC");
        } else {
            System.out.println("ARC");
        }
    }
}

Measured memory_bytes: 35520
#include<cstdio>

int n, ans;
int s[101111];

int main() {
	scanf("%d", &n);
	ans = 0;
	for(int i=0;i<n;i++) {
		int x; scanf("%d", &x);
		if (x<=n) s[x]++; else ans++;
	}
	for(int i=1;i<=n;i++)
		if(s[i] >= i) ans += s[i]-i;
		else ans += s[i];
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		int X = Integer.parseInt(sc.get());
		int T = Integer.parseInt(sc.get());
		System.out.println(-Math.floorDiv(-N, X) * T);
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		new Solver().solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32600
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a,b) << " ";
    cout << max(0,a+b-n) << endl;
}

Measured memory_bytes: 256
import Data.List      -- sortBy
import Data.Ord       -- comparing
import Control.Monad  -- replicateM

totalTime (c:ts) = (c, totalTime' ts)
totalTime' [] = 0
totalTime' (m:s:ts) = m * 60 + s + totalTime' ts

main = do
  n <- readLn
  if n == 0
    then return ()
    else do main' n
            main

main' n = do
  ls <- replicateM n getLine
  let ts     = map (totalTime . map read . words) $ ls
      sorted = map fst . sortBy (comparing snd) $ ts
  print (sorted !! 0)
  print (sorted !! 1)
  print (sorted !! (length sorted - 2))

Measured memory_bytes: 12332
A, B, K = map(int, input().split())

li = []
for i in range(A, A+K):
    if i <= B:
        li.append(i)
for j in range(B-K+1, B+1):
    if j >= A:
        li.append(j)
li = sorted(list(set(li)))
for a in li:
    print(a)

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


int main()
{
	double a, b, c, d, PI, S, L, h;
	cin >> a >> b >> c;
	PI = acos(-1);
	S = (a*b*sin(c * (2.00000 * PI)/360.00000))/2.0000;
	d = sqrt(a*a + b * b - 2.000000 * a*b*cos(c * 2.000000 * PI / 360.00000));
	L = a + b + d;
	h = 2.0000000 * S / a;
	printf("%.8lf\n", S);
	printf("%.8lf\n", L);
	printf("%.8lf\n", h);
    return 0;
}



Measured memory_bytes: 3436
N=int(input())
xyh=[]
for i in range(N):
    xyh.append(list(map(int,input().split())))
xyh.sort(key=lambda x: x[2])

for x in range(101):
    for y in range(101):
        flg = True
        H = xyh[-1][2] + abs(xyh[-1][0] - x) + abs(xyh[-1][1] - y)
        X = x
        Y = y
        
        for i in range(N):
            if xyh[i][2] != max(H - abs(xyh[i][0]-x) - abs(xyh[i][1] - y),0):
                flg=False
                break
        
        if flg:
            break
    if flg:
        break
print(X,Y,H)
    

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#define INF 1e16
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	ll a[4001], s[4001];
	s[0]=0;
	for(int i=0; i<n; i++){
		cin>>a[i];
		s[i+1]=s[i]+a[i];
	}
	vector<ll> dp[4001];
	vector<P> prev[4001];
	for(int i=0; i<=n; i++){
		for(int j=0; j<=i; j++){
			dp[i].push_back(INF);
          prev[i].push_back(P(0, 0));
		}
	}
	dp[0][0]=-INF;
	for(int i=1; i<=n; i++){
		int v[4001];
		fill(v, v+i+1, -1);
		for(int j=0; j<i; j++){
			int m1=lower_bound(dp[j].begin(), dp[j].end(), s[i]-s[j])-dp[j].begin();
			if(v[m1]==-1 || s[i]-s[v[m1]]>s[i]-s[j]) v[m1]=j;
		}
		for(int j=i; j>=1; j--){
          if(v[j]==-1) continue;
			if(dp[i][j]>s[i]-s[v[j]]){
				prev[i][j]=P(v[j], j-1);
				dp[i][j]=s[i]-s[v[j]];
			}
		}
      for(int j=i-1; j>=0; j--){
        dp[i][j]=min(dp[i][j], dp[i][j+1]);
      }
	}
	for(int i=n; i>=1; i--){
		if(dp[n][i]<INF){
			cout<<i<<endl;
			P p=prev[n][i];
          vector<int> v;
			while(p.first>0){
				v.push_back(p.first);
				p=prev[p.first][p.second];
			}
          if(v.empty()){
            cout<<endl;
            break;
          }
          for(int j=v.size()-1; j>=0; j--){
            cout<<v[j];
            if(j==0) break;
            cout<<" ";
          }
          cout<<endl;
          break;
		}
	}
    return 0;
}


Measured memory_bytes: 151652
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)

#define huge 1000000007
typedef long long ll;
ll gcd(ll a, ll b);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll X = 0;
	ll M = 0;
	ll Q = 0;
	//ll x[500][500] = {};
	//ll c[100000] = {};
	//ll v[100] = {};
	ll *a, *c, *d;
	string S[100],T,U;
	ll count = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;
	

	//char p;
	cin >> N >> X;
	a = (ll *)malloc(N * sizeof(ll));
	//d = (ll *)malloc(D * sizeof(ll));

	rep(i, 0, N) {
		cin >> a[i];
		sum += a[i];
	}

	
	sort(a,a+N);

	rep(i, 0, N) {
		
		 X -= a[i];
		// cout << a[i] << endl;
		// cout << X << endl;

		if(X == 0){
			i += 1;
			count = i;
			break;
		}

		if (X < 0) {
			i += 0;
			count = i;
			break;
		}
		count = i;
	}
	//count--;
//	cout << X << endl;
	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(is.begin(), is.end());
	

	
	cout << count << endl;

	return 0;

}

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

	return b;
}

Measured memory_bytes: 256
X,Y,A,B,C = [int(i) for i in input().split()]

def input_list(N):
  list = []
  for i in input().split():
    list.append(int(i))
  list.sort(reverse=True)
  return list

P = input_list(A)
Q = input_list(B)
R = input_list(C)
Top = P[:X] + Q[:Y] + R
Top.sort(reverse=True)
sum = 0
for i in range(X+Y):
  sum += Top[i]
print(sum)


Measured memory_bytes: 23200
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,k = [int(i) for i in readline().split()]
a = [int(i) for i in readline().split()]

memo = dict()
res = [0]*(2*n)
for i,c in enumerate(a*2):
    if c in memo: res[memo[c]] = i+1
    memo[c] = i

#print(res)

res2 = res[:n]

for i in range(n-1,-1,-1):
    if res2[i] < n:
        res2[i] = res2[res2[i]]

cycle = [0]
offset = 0
now = res2[0]-n

while now != 0:
    if now == n:
        offset = 1
        break
    else:
        cycle.append(now)
        now = res2[now]-n

#print(res2)
#print(cycle,offset)

l = len(cycle)
k-=1
k %= (l+offset)

#print("k =",k)

if k != l: ans = cycle[k]
else: exit()
while res[ans] < n:
    ans = res[ans]

"""
if k != l: ans = p = cycle[k]
else: ans = p = n+1
while p <= n:
    ans = p
    p = res[p]
#    print(ans,p)
"""


if ans >= n: exit()
else:
    s = []
    ss = set()
    for i in range(ans,n):
        if a[i] in ss:
            while a[i] in ss:
                c = s.pop()
                ss.remove(c)
        else:
            s.append(a[i])
            ss.add(a[i])
    
print(" ".join(map(str,s)))




Measured memory_bytes: 122312
#include<stdio.h>

void run(void){
  int n,q;
  scanf("%d%d",&n,&q);
  while(q--){
    int v,w;
    scanf("%d%d",&v,&w);
    if(n==1){
      printf("%d\n",v);
      continue;
    }
    while(v!=w){
      if(v>w){
	v=((v-1)+n-1)/n;
      } else {
	w=((w-1)+n-1)/n;
      }
    }
    printf("%d\n",v);
  }
}

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


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define int long long 
#define andl "\n"
using namespace std;

signed main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int x,a;
	cin>>x>>a;
	cout<<(x<a?0:10)<<andl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<b){
        if(b<c){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }else{
        cout<<"No"<<endl;
    }
        return 0;
}

Measured memory_bytes: 3088
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
    static int MAX_INF = Integer.MAX_VALUE;
    
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        String line;
        int[] a = new int[4];
        int r = 0, l = 0;
        while ((line = in.readLine()) != null) {
            st = new StringTokenizer(line, ",");
            a[0] = Integer.parseInt(st.nextToken());
            a[1] = Integer.parseInt(st.nextToken());
            a[2] = Integer.parseInt(st.nextToken());
            if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) {
                r++;
            } 
            if (a[0] == a[1]) {
                l++;
            }
        }
        
        System.out.println(r);
        System.out.println(l);
    }
}


Measured memory_bytes: 24176
#include <iostream>

using namespace std;

int main()
{
  int num1,num2,num3,num4;
  cin >> num1;
  cin >> num2;
  cin >> num3;
  cin >> num4;

  int sum = num1 + num2 + num3 + num4;

  int total_minute,total_second;

  total_minute = sum/60;
  total_second = sum%60;

  cout << total_minute << '\n';
  cout << total_second << '\n';

  return 0;
}

Measured memory_bytes: 3088
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	ans := 0
	for i := 0; i < N; i++ {
		for a[i]%2 == 0 {
			a[i] /= 2
			ans++
		}
	}
	out(ans)
}


Measured memory_bytes: 896
dish = []
for _ in range(5):
    dish.append(int(input()))

dish1 = [x for x in dish if x % 10 == 0]
dish2 = [x for x in dish if x % 10 != 0]
dish2 = sorted(dish2, key=lambda x: x % 10, reverse=True)

score = sum(dish1)
for i, d in enumerate(dish2):
    if i < len(dish2) - 1:
        score += d + (10 - d % 10)
    else:
        score += d

print(score)

Measured memory_bytes: 3064
N = int(input())
s = [input() for i in range(N)]

ans = 0
n_a = 0
n_b = 0
n_ab = 0
A_count = 0
B_count = 0
for i in range(N):
	ans += s[i].count("AB")
	if s[i][0] == "B" and s[i][-1] == "A":
		n_ab += 1
	if s[i][0] == "B" and s[i][-1] != "A":
		n_b += 1
	if s[i][0] != "B" and s[i][-1] == "A":
		n_a += 1
if n_ab == 0:
	ans += min(n_a,n_b)
if n_ab != 0:
	ans += n_ab-1
	if n_a == 0 and n_b == 0:
		ans += 0
	if n_a == 0 and n_b != 0:
		ans += 1
	if n_a != 0 and n_b == 0:
		ans += 1
	if n_a != 0 and n_b != 0:
		ans += 2+min(n_a-1,n_b-1)

print(ans)

Measured memory_bytes: 3700
#include<cstdio>
const int MOD = 998244353;
const int MAXN = 4000;
int C[MAXN + 5][MAXN + 5];
int pw2[MAXN + 5];
void init() {
	C[0][0] = 1; pw2[0] = 1;
	for(int i=1;i<=MAXN;i++) {
		C[i][0] = 1;
		for(int j=1;j<=i;j++) {
			C[i][j] = (C[i-1][j] + C[i-1][j-1]) % MOD;
		}
		pw2[i] = pw2[i-1] * 2 % MOD;
	}
}
int solve(int x, int y, int z) {
	int ret = 0;
	for(int i=0;i<=z;i++) {
		if( i > x ) break;
		int p = 1LL * pw2[i] * C[x][i] % MOD;
		if( y+i-1 >= 0 ) ret = (ret + 1LL*p*C[z+y-1][y+i-1]%MOD) % MOD;
	}
	return ret;
}
int main() {
	init();
	int N, K;
	scanf("%d%d", &K, &N);
	for(int i=2;i<=2*K;i++) {
		int cnt = 0;
		for(int j=1;j<=K;j++)
			if( 1 <= i-j && i-j <= K ) cnt++;
		if( i % 2 == 0 ) {
			printf("%d\n", (solve((cnt-1)/2, K-cnt, N) + solve((cnt-1)/2, K-cnt, N-1)) % MOD);
		}
		else {
			printf("%d\n", solve(cnt/2, K-cnt, N));
		}
	}
}

Measured memory_bytes: 61312
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(), t = sc.nextInt(), A = sc.nextInt();
        int ans = 0;
        double min = 1e9, T = (double)t;
        for (int n = 0; n < N; n++) {
            double h = sc.nextDouble();
            double f = Math.abs(A - (T - h * 0.006));
            if (min > f) { min = f; ans = n + 1; }
        }
        sc.close();
        System.out.println(ans);
    }
}

Measured memory_bytes: 26876
program example
	implicit none

	integer(8) H,W
    
    read(*,*) H,W
    
    if(W==1 .or. H==1) then
    	write(*,*) 1
        
    else if (mod(H,2)==0) then
    	write(*,*) W*(H/2)
        
    else

    	write(*,*) (W*(H/2))+(W/2)+mod(W,2)

    end if

end program example

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int max = -1000000;
        int min = 1000000;
        long total = 0;
        int a;
        int n = sc.nextInt();
        sc.nextLine();
        for (int i=0 ; i<n ; i++){
            a = sc.nextInt();
            if (max < a) max = a;
            if (min > a) min = a;
            total += a;
        }
        sc.close();
        System.out.println(min+" "+max+" "+total);
    }
}


Measured memory_bytes: 41948
import sys
import math
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
a=0
for i in range(N):
    if A[i]==1:
        a=i
        break
if a <=K-1:
    print(math.ceil((N-K)/(K-1))+1)
    sys.exit()
if N-K<=a:
    print(math.ceil((N-K)/(K-1))+1)
    sys.exit()
print(math.ceil((N-K)/(K-1))+1)

Measured memory_bytes: 13812
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll a[1000000];
ll b[1000000];
ll c[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
bool Visited[200];
vector<ll> r;
ll g[200][200];
void DFS(ll nowpos,ll cost,ll count){
	if(Visited[nowpos])return;
	Visited[nowpos]=true;
	rep(i,0,r.size()){
		DFS(r[i],cost+g[nowpos][r[i]],count+1);
	}
	if(count==R)ans=min(ans,cost);
	Visited[nowpos]=false;
}
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
int main() {
	cin>>N>>M>>R;
	rep(i,0,R){
		ll num;
		cin>>num;
		num--;
		r.push_back(num);
	}
	rep(i,0,200)rep(j,0,200){
		g[i][j]=INF;
		if(i==j)g[i][j]=0;
	}
	rep(i,0,M){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--;
		b[i]--;
		g[a[i]][b[i]]=c[i];
		g[b[i]][a[i]]=c[i];
	}
	rep(i,0,N){
		rep(j,0,N){
			rep(k,0,N){
				g[j][k]=min(g[j][i]+g[i][k],g[j][k]);
			}
		}
	}
	ans=INF;
	rep(i,0,r.size()){
		DFS(r[i],0,1);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;


int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i)a[i]+=a[i-1];
        a[i]%=m;
    }
    sort(a,a+n);
    ll num=0,ans=0;
    for(int i=0;i<n;i++){
        if(i){
            if(a[i]==a[i-1])num++;
            else num=0;
        }
        ans+=num;
        if(a[i]==0)ans++;
    }
    cout << ans<<endl;
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)
ll num[200000+5];
ll A[200000+5];

int main(){
    ll N;
    cin >> N;
    FOR(i,1,N) {
        cin >> A[i];
        num[A[i]] += 1;
    }
    
    ll all_sum = 0;
    FOR(i,1,N) {
        all_sum += (num[i]-1)*num[i]/2;
    }
    
    FOR(i,1,N) {
        ll ans = all_sum - (num[A[i]]-1)*num[A[i]]/2 + (num[A[i]]-2)*(num[A[i]]-1)/2;
        cout << ans << endl;
    }
}

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

ll a[100005];
ll vis[100005];
ll sum[100005];
int main()
{
    ll n;
    scanf("%lld",&n);
    ll x,m;
    scanf("%lld%lld",&x,&m);
    a[1]=x;
    vis[x]=1;
    ll len=0;
    sum[1]=a[1];
    ll ans=0;
    int flag=0;
    ll num=0;
    ll cnt=0;
    for(ll i=2;i<=100005;i++)
    {
        ll y=(a[i-1]*a[i-1])%m;

        if(vis[y]==0)
        {
            vis[y]=i;
            a[i]=y;
            sum[i]=a[i]+sum[i-1];
        }
        else
        {
            len=i-vis[y];
            cnt=vis[y]-1;
            num=sum[i-1]-sum[vis[y]-1];
            break;
        }
    }
   // cout<<"sss"<<endl;
  //  cout<<len<<endl<<sum[len]<<endl;
//  cout<<flag<<endl;
  /*  if(flag==1)
    {
        if(n>=len)
        {
            ans=sum[len];
        }
        else
        {
            ans=sum[n];
        }
         printf("%lld\n",ans);
         return 0;
    }*/
    ans+=sum[cnt];
    ll l=(n-cnt)/len;
    ans+=l*num;
    ll p=(n-cnt)%len;
    ans+=sum[p+cnt]-sum[cnt];
    printf("%lld\n",ans);
}


Measured memory_bytes: 5388
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	ll ans = 0;
	rep(bit, (1 << (n - 1))) {
		ll tmp = 0;
		ll now = 0;
		rep(i, n) {
			if (i == 0) {
				now += int(s[i] - '0');
			}
			else {
				if (bit & (1 << (i - 1))) {
					tmp += now;
					now = int(s[i] - '0');
				}
				else {
					now *= 10;
					now += int(s[i] - '0');
				}
			}
		}
		tmp += now;
		ans += tmp;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int D;
    cin >> D;
    vector<int>c(26);
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    vector<vector<int>>s(D,vector<int>(26));
    for(int i = 0; i < D; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int>t(D);
    for(int i = 0; i < D; i++) {
        t[i] = rand()%26+1;
    }
    int ans = 0;
    vector<int>Last(26);
    for(int i = 0; i < D; i++) {
        ans+=s[i][t[i]-1];
        Last[t[i]-1] = i+1;
        for(int j = 0; j < 26; j++) {
            ans-=c[j]*(i+1-Last[j]);
        }
    }
    int M = 100000;
    for(int i = 0; i < M; i++) {
        int d = rand()%D+1;
        int q = rand()%26+1;
        int ord = ans;
        int X = 0;
        int Y = 0;
        int A = 0;
        int B = 0;
        ans+=s[d-1][q-1]-s[d-1][t[d-1]-1];
        for(int j = 0; j < D; j++) {
            if(t[j] == t[d-1]) {
                if(j == d-1) {
                    Y = j+1;
                }
                else {
                    X = j+1;
                }
                A = j+1;
            }
            if(t[j] == q) {
                Y = j+1;
                B = j+1;
            }
            ans-=c[t[d-1]-1]*(j+1-X)-c[t[d-1]-1]*(j+1-A);
            ans+=c[q-1]*(j+1-B)-c[q-1]*(j+1-Y);
        }
        if(ans > ord) {
            ord = ans;
            t[d-1] = q;
        }
        else {
            ans = ord;
        }
    }
    for(int i = 0; i < D; i++) {
        cout << t[i] << endl;
    }
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;

const int nmax = 8;
bool graph[nmax][nmax];
int n, m;

int dfs(int v, vector<bool> visited) {
  bool pass = true;
  rep(i, n) if (visited[i] == false) pass = false;
  if (pass) return 1;

  int ret = 0;
  rep(i, n){
    if (graph[v][i] == false) continue;
    if (visited[i] == true) continue;
    visited[i] = true;
    ret += dfs(i, visited);
    visited[i] = false;
  }
  return ret;
}

int main(){
  cin >> n >> m;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    graph[a-1][b-1] = graph[b-1][a-1] = true;
  }

  vector<bool> visited(nmax);
  rep(i, nmax) visited[i] = false;
  visited[0] = true;
  cout << dfs(0, visited) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
typedef unsigned long long ULL;
const int nMax=1e6+1, MOD=1e9+7;
ULL inv[nMax], fct[nMax], ivf[nMax];
ULL Comb(int n, int r){ return (((fct[n]*ivf[r])%MOD)*ivf[n-r])%MOD; }
ULL Perm(int n, int r){ return (fct[n]*ivf[n-r])%MOD; }

int main(){
inv[1]=fct[0]=fct[1]=ivf[0]=ivf[1]=1;
for(int i=2; i<nMax; i++){ 
  inv[i]=((MOD-MOD/i)*inv[MOD%i])%MOD;
  fct[i]=(fct[i-1]*i)%MOD; ivf[i]=(ivf[i-1]*inv[i])%MOD;
}
int N, M; cin >> N >> M; long t, ans=0;
REP(i, N+1){
  t=(Comb(N, i)*Perm(M, i))%MOD;t=(t*Perm(M-i, N-i))%MOD;t=(t*Perm(M-i, N-i))%MOD;
  if(i%2){ ans=(ans+MOD-t)%MOD; }else{ ans=(ans+t)%MOD; }
}
cout << ans << "\n";
}

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

using namespace std;

typedef long long ll;

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

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

	map<ll, int, greater<ll>> mp;
	rep(i, N){
		ll a;
		cin >> a;

		auto itr = mp.find(a);
		if(itr == mp.end()){
			mp[a] = 0;
		}

		mp[a]++;
	}

	rep(i, M){
		int b, c;
		cin >> b >> c;

		auto itr = mp.find(c);
		if(itr == mp.end()){
			mp[c] = 0;
		}

		mp[c] += b;
	}

	ll ans = 0;
	int cnt = 0;
	for(auto kv : mp){
		ll k = kv.first;
		ll v = kv.second;

		if(cnt + v >= N){
			ans += k * (N - cnt);
			break;
		}

		ans += k * v;
		cnt += v;
	}

	cout << ans << endl;
}


Measured memory_bytes: 12800
#include <stdio.h>
void SimpleSelectionSort(int* array,int n){
    int temp=0;
    int i = 0;
    int j = 0;

    for(i = 0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            if(array[i] < array[j]){
                temp = array[i];
                array[i] = array[j];
                array[j] = temp;
            }
        }
    }

    return;

}

int main(void){
    int array[10];
    int i = 0;
    for(i=0;i<10;i++){
        scanf("%d" ,&array[i]);
    }

    SimpleSelectionSort(array , 10);

    for(i = 0;i<3;i++){
        printf("%d\n",array[i]);
    }

    return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int a, b, i;
  cin >> a;
  vector<int> vec(a);
  for(i = 0;i < a;i++){
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end()); 
  for(i = 0;i < a; i++){
      if(vec[i] == vec[i + 1]){
        cout << "NO" << endl;
        return 0;
    }
  }
    cout << "YES" << endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
     
int main() {
  ll n, m, k, x, y , z = 0, h,w, sum = 0, Max = -1, Min = 3e9+1;
  string u;
  bool ok=true;
  cin >> n >> m;
  VL a(m),b(m); VB ans(m,false);
  rep(i,m){
    cin >> a[i] >> b[i];
  }
  // 1 から行ける場所
  rep(i,m){
    if(a[i]==1){
      ans[b[i]]=true;
    }
  }
  //1から行ける場所 からnに行ける場所
  rep(i,m){
    if(b[i]==n && ans[a[i]]){
      pri("POSSIBLE");
      return 0;
    }
  }
  pri("IMPOSSIBLE");
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n)(for i=0;i<n;++i);
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int main() {
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << i + 1;
    }
  }
}

Measured memory_bytes: 3632
//IN THE NAME OF GOD;
//Test By Dev-C++5.11
#include<bits/stdc++.h>
#define ll  long long
#define isc ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ld long double
#define ss string
#define ww while
#define vl vector<ll>
#define pb push_back
#define in insert
#define itr iterator
#define gt goto
#define rep(i,n,j) for(ll i=n;i<j;i++)
#define tep(i,n,j) for(ll i=n;i>=j;i--)
#define co(n) cout << n ;
#define pll pair<ll,ll>
#define bft bool f=true
#define bff bool f=false
using namespace std;

ll bmm(ll a, ll b) {
	if (b == 0) return a;
	else return bmm(b, a%b);
}
ll kmm(ll a, ll b) {
	return(a*b) / bmm(a, b);
}

ll ebiii(ll a,ll b, ll c[], ll i){
	ll x=0;
	ww(a-b<c[i]){
		i--;
		x++;
	}
	return x; 
}
const ll mod = 1e9 + 7;
const ll MAXN = 1e5+5;

ll n,x=0,a[MAXN];

int main() {
	isc;
	cin >> n;
	rep(i,0,n){
		cin >> a[i];
	}
	sort(a,a+n);
	tep(i,n-1,2){
		tep(j,i-1,1){
			x+=ebiii(a[i],a[j],a,j-1);	
		}
	}
	
	cout << x;
	return 0;
}


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

#define INF 1000000010
#define INFLL ((1LL<<62)-5)
#define FO(i,a,b) for (int (i) = (a); (i) < (b); ++(i))
#define sz(v) int(v.size())

using namespace std;
//PAIRS:
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pii;
typedef long long ll;

/*~~~~TEMPLATE END~~~~*/

int a, b;

int main() {
    scanf ("%d %d", &a, &b);
    if (a <= 0 && b >= 0) {
        printf ("Zero\n");
        return 0;
    }
    if (a > 0) {
        printf ("Positive\n");
        return 0;
    }
    b -= a;
    if (b % 2) {
        printf ("Positive\n");
    } else {
        printf ("Negative\n");
    }
    return 0;
}


Measured memory_bytes: 256
<?php
$s=trim(fgets(STDIN));
$n=strlen($s);
if($n<4){
  echo 0;
  exit;
}
$i=0;
$r=array_fill(0,2019,0);
$sum=0;
$m=1;
while($n>0){
  --$n;
  $m*=10;
  $m%=2019;
  $sum+=($s[$n]*$m)%2019;
  $sum%=2019;
  ++$r[$sum];
  ++$i;
}
$ans=$r[0];
rsort($r);
foreach($r as $v){
  if($v<2){
    break;
  }
  $ans+=$v*($v-1)/2;
}
echo $ans;

Measured memory_bytes: 16604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200025,inf=0x3f3f3f3f;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,a[N],ans;
map<int,int> f;
int main(){
//	freopen("balance.in","r",stdin);
//	freopen("balance.out","w",stdout);
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	for (int i=n;i;i--){
		int fl=0;
		for (int k=1;k<=30;k++){
			int t=(1<<k)-a[i];
			if (f.count(t)){f[t]--;if (!f[t]) f.erase(t);fl=1;break;}
		}
		if (!fl) f[a[i]]++;
		else ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 10368
L, R = list(map(int, input().split()))
if R / 2019 - L / 2019 > 1:
    print(0)
else:
    mn = 2019
    for i in range(L, R + 1):
        for j in range(L, R + 1):
            if (i != j):
                if (mn > (i * j) % 2019):
                    mn = (i * j) % 2019
    print(mn)



Measured memory_bytes: 2940
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	int now=1;
	while(now<=n){
		k--;
		if(k<=0)break;
		now+=2;
	}
	if(now<=n&&k==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

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

namespace Competitive
{
    internal class Solution
    {
        public void Run()
        {
            int H, W, D;
            {
                int[] tmp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                H = tmp[0];
                W = tmp[1];
                D = tmp[2];
            }

            int[] X = Enumerable.Range(0, H * W + 1).Select(i => 0).ToArray();
            int[] Y = Enumerable.Range(0, H * W + 1).Select(i => 0).ToArray();
            for (int y = 0; y < H; y++)
            {
                int[] line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                for (int x = 0; x < W; x++)
                {
                    int a = line[x];
                    X[a] = x;
                    Y[a] = y;
                }
            }

            int Q = int.Parse(Console.ReadLine());
            int[] DD = Enumerable.Range(0, H * W + 1).Select(i => 0).ToArray();

            for (int m = 1; m <= D; m++)
            {
                int d = 0;
                int i = m;
                DD[i] = d;

                while (true)
                {
                    i += D;
                    if (i > H * W) break;
                    d += Math.Abs(X[i] - X[i - D]) + Math.Abs(Y[i] - Y[i - D]);
                    DD[i] = d;
                }
            }
            
            for (int q = 0; q < Q; q++)
            {
                int[] line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                int start = line[0];
                int end = line[1];
                Console.WriteLine(DD[end] - DD[start]);
            }
        }

    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

typedef long long ll;
typedef unsigned long long ull;

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int n, d, l = -1, r;
    cin >> n;
    vector<ll> f(n + 2, 1);
    ll MOD = 1e9 + 7;
    rep(i, n + 1) f[i + 1] = (f[i] * (i + 1)) % MOD;
    vector<int> a(n + 1), c(n, 0);
    rep(i, n + 1) {
        cin >> a[i];
        c[a[i] - 1]++;
        if (c[a[i] - 1] == 2) d = a[i];
    }
    rep(i, n + 1) {
        if (a[i] == d) {
            if (l == -1) l = i;
            else r = i;
        }
    }
    int m = n + 1 - (r - l + 1);
    //cout << "m=" << m << "\n";
    rep(i, n + 1) {
        ll ans = f[n + 1] * mod_pow(f[i + 1], MOD - 2, MOD);
        ans %= MOD;
        ans *= mod_pow(f[n - i], MOD - 2, MOD);
        ans %= MOD;
        ll x;
        if (i > m) x = 0;
        else {
            x = f[m] * mod_pow(f[i], MOD - 2, MOD);
            x %= MOD;
            x *= mod_pow(f[m - i], MOD - 2, MOD);
            x %= MOD;
        }
        //cout << "ans=" << ans << " x=" << x << "\n";
        cout << (ans - x + MOD) % MOD << "\n";
    }
}

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

int main() {
    int n, m, l, i, j, k;
    long long cnt;
    cin >> n >> m >> l;
    int a[n][m], b[m][l];

    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    for (i = 0; i < m; i++) {
        for (j = 0; j < l; j++) {
            cin >> b[i][j];
        }
    }

    for (i = 0; i < n; i++) {
        for (k = 0; k < l; k++) {
            cnt = 0;
            for (j = 0; j < m; j++) {
                cnt += a[i][j] * b[j][k];
            }
            cout << cnt;
            if (k == l-1) {
                cout << endl;
            } else {
                cout << " ";
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define uint unsigned long long
#define ll long long
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}

int main() 
{
	int A = read();
	int B = read();
	int C = read();
	int X = read();
	int Y = read();
	C <<= 1;
    int ans = 0;
    if (A + B > C) 
    {
        int t = min(X, Y);
        ans += t * C;
        X -= t; 
        Y -= t;
    }
    if (C < A) ans += X * C, Y -= X; 
    else ans += A * X;
    if (C < B) ans += Y * C; 
    else ans += B * Y;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
    int y, m, d;
    scanf("%d/%d/%d", &y, &m, &d);

    if(y < 2019){
        cout << "Heisei" << endl;
    }
    else{
        if(m <= 4){
            cout << "Heisei" << endl;
        }
        else{
            cout << "TBD" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 5;
const double eps = 1e-8;
int n,x;
int main()
{
    scanf("%d", &n);
    int ans = 0;
    for (int i = 0; i < n; ++i)
        scanf("%d", &x), ans ^= x;
    if (ans)
        puts("No");
    else
        puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int l, r;
	while (cin >> l >> r){
		int ans = 0;
		for (int i = l; i <= r; i++){
			int q = i;
			while (q % 2 == 0)q /= 2;
			while (q % 3 == 0)q /= 3;
			while (q % 5 == 0)q /= 5;
			if (q == 1)ans++;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2996
#include <iostream>

using namespace std;

int c[4][4];

int main(void) {

	for (int i = 1; i <= 3; i++) {
		for (int j = 1; j <= 3; j++) {
			cin >> c[i][j];
		}
	}

	bool ans = true;

	int A[3], B[3];

	A[0] = 0;
	A[1] = c[2][1] - c[1][1];
	A[2] = c[3][1] - c[2][1];

	B[0] = 0;
	B[1] = c[1][2] - c[1][1];
	B[2] = c[1][3] - c[1][2];

	int C[4][4];
	C[1][1] = c[1][1];                     C[1][2] = c[1][1] + B[1];  C[1][3] = c[1][1] + B[1] + B[2];
	C[2][1] = c[1][1] + A[1];              C[2][2] = c[1][1] + A[1] + B[1]; C[2][3] = c[1][1] + A[1] + B[1] + B[2];
	C[3][1] = c[1][1] + A[1] + A[2];       C[3][2] = c[1][1] + A[1] + A[2] + B[1]; C[3][3] = C[1][1] + A[1] + A[2] + B[1] + B[2];

	for (int i = 1; i <= 3; i++) {
		for (int j = 1; j <= 3; j++) {
			if (C[i][j] != c[i][j]) { ans = false; }
		}
	}

	/*for (int i = 1; i <= 3; i++) {
		for (int j= 1; j <= 3; j++)
		{
			cout << " " << C[i][j];
		}cout << endl;
	}*/

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

Measured memory_bytes: 256