akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
ll prime_num[maxn],prime[maxn];
int dfs(int cur, int idx,int cnt,int sum)
{
    int ans=0;
    if(sum>=prime_num[idx]||cur>prime_num[idx])
    {
        if(sum==prime_num[idx])return cnt;
        else return 0;
    }
    ans=max(ans,dfs(cur+1,idx,cnt+1,sum+cur));
    ans=max(ans,dfs(cur+1,idx,cnt,sum));
    return ans;
}
int main()
{
    ll a;
    cin>>a;
    int cnt=0;
    int mid=sqrt(a+0.5);
    ll x=a;
    for(int i=2; i<=mid; i++)
    {
        if(x%i==0)
        {
            prime[++cnt]=i;
            while(x%i==0)
            {
                prime_num[cnt]++;
                x/=i;
            }
        }
    }
    if(x>1)
    {
        prime[++cnt]=x;
        prime_num[cnt]=1;
    }
    //cout<<cnt<<endl;
    int ans=0;
    for(int i=1; i<=cnt; i++)
    {
        ans+=dfs(1,i,0,0);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long lli;

const int MAXN = 10;
const int MAXS = 1005;
lli mem[MAXN][MAXS][101];

lli rec(lli n, lli s, lli p) {
  lli &res = mem[n][s][p];
  if(res != -1) return res;
  if(n == 0) {
    return res = (s == 0) ? 1 : 0;
  }
  res = 0;
  for(lli i = p+1; i <= 100 && s-i >= 0; ++i) {
    res += rec(n-1, s-i, i);
  }
  return res;
}

int main() {
  lli n, s;
  while(cin >> n >> s && (n|s)) {
    fill(mem[0][0], mem[MAXN][0], -1LL);
    cout << rec(n, s, -1) << endl;
  }
  return 0;
}

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

int main(){
	char a[2],b[2]; scanf("%s%s",a,b);
	if(a[0]<b[0]) printf("<");
	else if(a[0]==b[0]) printf("=");
	else printf(">");
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL a[1000000],n,sum=0;
int main(){
    cin>>n;
    for(int i=0;i<n*2;i++){
        cin>>a[i];
    }
    sort(a,a+n*2);
    for(int i=0;i<n*2;i++){
        sum+=a[i];
        i++;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7
flag=0

A.sort()

tmp1=1
tmp2=1

l=0
r=n-1
if k%2==1:
    tmp1=A[-1]%mod
    r-=1
    if A[-1]<0:
        flag=1
for i in range(k//2):
    vl=A[l]*A[l+1]
    vr=A[r]*A[r-1]
    if max(vl,vr)<0:
        flag=1
    if vl>vr:
        l+=2
        tmp1*=vl
    else:
        r-=2
        tmp1*=vr
    tmp1%=mod

from bisect import bisect_right
idx=bisect_right(A,0)
if idx==n:
    idx-=1
l=max(0,idx-1)
r=idx
for i in range(k):
    vl=A[l] if l>=0 else mod
    vr=A[r] if r<n else mod
    if abs(vl)<abs(vr) or r==n:
        l-=1
        tmp2*=vl
    else:
        r+=1
        tmp2*=vr
    tmp2%=mod

if flag==0:
    print(tmp1)
else:
    print(tmp2)



Measured memory_bytes: 32988
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
}
class test{
    public void solve(FastReader in, PrintWriter out) {
        //int t =in.nextInt();
       // while(t-->0){

        //}

        String s =in.next();
        String t=in.next();
        if(t.substring(0,t.length()-1).equals(s)){
            out.println("Yes");
        }else{
            out.println("No");
        }
    }


}

class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt(){
        return Integer.parseInt(next());
    }

    Long nextLong(){
        return Long.parseLong(next());
    }

    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    }
}



Measured memory_bytes: 32952
n, x = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()
ans = 0
for i in range(n):
  if a[i] <= x:
    ans += 1
    x -= a[i]
    if i == n-1 and x != 0:
      ans -= 1
  else:
    break
print(ans)

Measured memory_bytes: 3060
import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String []args) throws IOException
    {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int w1 = sc.nextInt();
        int h1 = sc.nextInt();
        System.out.println((w-w1)*(h-h1));
    }
}

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

struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    for(int i=0;i<n;++i) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};

struct edge{int u,v,cost;};

bool comp(const edge& e1, const edge& e2){
  return e1.cost < e2.cost;
}

//int MAX_E=100000;
edge es[100000];

int main(){
  int n,m;
  cin >> n >> m;
  for(int i=0;i<m;++i){
    int s,t,w;
    cin >> s >> t >> w;
    es[i].u=s;
    es[i].v=t;
    es[i].cost=w;
  }

  UnionFind tree(n);
  sort(es,es+m,comp);
  int res=0;
  for(int i=0;i<m;++i){
    edge e=es[i];
    if(!tree.same(e.u,e.v)){
      tree.unite(e.u,e.v);
      res+=e.cost;
    }
  }

  cout << res << endl;
  return 0;
}



Measured memory_bytes: 4364
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <math.h>
using namespace std;

const long long INF = 1LL << 60;  // どういう意味だろうか

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

long long dp[100100][3];

int main() {
	int N;
	int abc[100100][3];

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
	}

	for (int i = 0; i < 100100; i++) {
		for (int j = 0; j < 3; j++) {
			dp[i][j] = 0;
		}
	}

	dp[0][0] = abc[0][0];
	dp[0][1] = abc[0][1];
	dp[0][2] = abc[0][2];

	for (int i = 1; i < N; i++) {
		for (int j = 0; j < 3; j++) {
			chmax(dp[i][j],
					dp[i - 1][(j + 1) % 3] + abc[i][j]);
			chmax(dp[i][j],
					dp[i - 1][(j + 2) % 3] + abc[i][j]);
		}
	}

	long long int ans = dp[N-1][0];
	chmax(ans, dp[N-1][1]);
	chmax(ans, dp[N-1][2]);

	cout << ans << endl;

}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
//typedef __int128_t lll;
using namespace std;

int main(int argc, char const *argv[]) {
  vll d{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};
  ll k;std::cin >> k;
  std::cout << d[k-1] << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    double r;    
    scanf("%lf", &r);
    double pi = 3.141592653589;
    double area, circ;
    area = pi * r * r;
    circ  = 2 * pi * r; 
    printf("%f %f\n", area, circ);

    return 0;
}

Measured memory_bytes: 1076
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;

int N;
ll dp[3010][3010];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N;
  repeat(i,N){
    cin>>dp[i][i];
  }
  for(int i=1;i<N;i++){
    repeat(j,N-i){
      dp[j][j+i] = max(dp[j][j]-dp[j+1][j+i],dp[j+i][j+i]-dp[j][j+i-1]);
    }
  }
  cout<<dp[0][N-1]<<endl;
  return 0;
}


Measured memory_bytes: 70016
#[allow(dead_code)]
fn main() {
    let w = i::s();
    let mut ss = HashMap::new();
    for c in w {
        *ss.entry(c).or_insert(0) += 1;
    }
    for (_, i) in ss {
        if i % 2 != 0 {
            println!("{}", "No");
            return;
        }
    }
    println!("{}", "Yes");
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  int W,H,N;
  cin >> W >> H >> N;
  vector<int>x(N);
  vector<int>y(N);
  vector<int>a(N);
  for (int i = 0; i < N; i++) {
    cin >> x.at(i) >> y.at(i) >> a.at(i);
  }
  int minX = 0;
  int maxX = W;
  int minY = 0;
  int maxY = H;
  for (int i = 0; i < N; i++) {
    if (a.at(i) == 1){
      if (x.at(i) > minX){
        minX = x.at(i);
      }
    }
    else if (a.at(i) == 2){
      if (x.at(i) < maxX){
        maxX = x.at(i);
      }
    }
    else if (a.at(i) == 3){
      if (y.at(i) > minY){
        minY = y.at(i);
      }
    }
    else if (a.at(i) == 4){
      if (y.at(i) < maxY){
        maxY = y.at(i);
      }
    }
  }
  cout << max(maxX-minX,0) * max(maxY-minY,0) << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
 
#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)
#define modd 998244353
#define umap unordered_map<ll,ll>
double dp[301][301][301];
ll n;

double fun(ll x,ll y,ll z){
  if(x==0 and y==0 and z==0)return 0;
  if(dp[x][y][z]!=-1)return dp[x][y][z];
  
  double ans=0;
  if(x!=0)ans+=x*fun(x-1,y,z);
  if(y!=0)ans+=y*fun(x+1,y-1,z);
  if(z!=0)ans+=z*fun(x,y+1,z-1);

  return dp[x][y][z]=(n+ans)/(x+y+z);
}

int32_t main() 
{ 
  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    

   cin>>n;
   ll one=0,two=0,three=0;

   for(int i=0;i<301;i++)
    for(int j=0;j<301;j++)
      for(int r=0;r<301;r++)dp[i][j][r]=-1;


   fori(0,n){
    ll x;
    cin>>x;
    if(x==1)one++;
    else if(x==2)two++;
    else three++;
   }

   cout<<setprecision(16)<<fun(one,two,three);



    







    
    
 
 
return 0;
}    

Measured memory_bytes: 216812
#include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std;
using Edge = pair<int, int>;
using Graph = vector<vector<int>>;

int main() {
    int N; cin >> N;
    Graph G(N);
    vector<Edge> vp;
    for(int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
        vp.push_back(Edge(a, b));
    }
    
    int K = 0;
    map<Edge, int> ma;
    
    queue<int> que;
    vector<int> dist(N, -1); // dist[v] := 頂点 v とその親を結ぶ辺の色
    
    dist[0] = 0;
    que.push(0);
    
    while(!que.empty()) {
        int v = que.front(); que.pop();
        int cur = 1;
        for(auto nv : G[v]) {
            if(dist[nv] != -1) continue;
            if(cur == dist[v]) ++cur;
            dist[nv] = cur;
            ma[Edge(v, nv)] = cur;
            K = max(K, cur);
            ++cur;
            
            que.push(nv);
        }
    }
    
    cout << K << endl;
    for(auto e : vp) cout << ma[e] << endl;
}


Measured memory_bytes: 13428
from math import*
from collections import*
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return fct

def fil(num):
    return len([1 for k,v in l.items() if v>=num-1])

l=[]
for i in range(2,int(input())+1):
    l.extend(factorize(i))
    
l=Counter(l)
#print(l)

print(fil(75)+fil(25)*(fil(3)-1)+fil(15)*(fil(5)-1)+fil(5)*(fil(5)-1)*(fil(3)-2)//2)


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = Cin();
        String[] Name = new string[N];
        ulong M = 0;
        ulong A = 0;
        ulong R = 0;
        ulong C = 0;
        ulong H = 0;
        for (int i = 0; i < N; i++)
        {
            Name[i] = Console.ReadLine();
            if (Name[i][0] == 'M') M += 1;
            if (Name[i][0] == 'A') A += 1;
            if (Name[i][0] == 'R') R += 1;
            if (Name[i][0] == 'C') C += 1;
            if (Name[i][0] == 'H') H += 1;
        }
        ulong ans = 0;
        ans += M * A * R;
        ans += M * A * C;
        ans += M * A * H;
        ans += M * R * C;
        ans += M * R * H;
        ans += M * C * H;

        ans += A * R * C;
        ans += A * R * H;
        ans += A * C * H;

        ans += R * C * H;
        Console.WriteLine(ans);
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


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

int main() {
  ll N;
  cin >> N;
  ll m = 2000000000000000;
  for (int i = 0; i < 5; i++) {
    ll x;
    cin >> x;
    m = min(m,x);
  }
  cout << 5 + (N-1)/m << endl;
}

Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, input())))
    return li

""" input template
S = input()
N = int(input())
L = list(map(int, input().split()))
a, b = list(map(int, input().split()))
SL = list(input())
"""

# --------------------------------------------

dp = None

def main():
    N = int(input())
    A = list(map(int, input().split()))

    Alice = 0
    Bob = 0

    while len(A) != 0:
        Alice += max(A)
        A.remove(max(A))

        if len(A) == 0:
            break

        Bob += max(A)
        A.remove(max(A))

    print(Alice - Bob)

main()


Measured memory_bytes: 5060
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    int ans = 0;
    rep(a, 10) {
        rep(b, 10) {
            rep(c, 10) {
                int flagA = 0, flagB = 0, flagC = 0;
                rep(i, n) {
                    if(!flagA && s[i] - '0' == a) {
                        flagA = 1;
                    }
                    else if(flagA && !flagB && s[i] - '0' == b) {
                        flagB = 1;
                    }
                    else if(flagA && flagB && !flagC && s[i] - '0' == c) {
                        flagC = 1;
                        break;
                    }
                }
                if(flagC) {
                    ans++;
                }
            }
        }
    }

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

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

int main(){
  long long N;
  cin>>N;
  long long ans=100000000000000;
  for(int i=1;i<=sqrt((double)N);i++){
    if(N%i==0){
      ans=min(ans,i+N/i-2);
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {
	
	static Integer NULL = 2000000001;
	
	static class CompleteBinaryTree {
		public void cbt (InputReader ir) {
			
			int n = ir.nextInt();
			Node[] node = new Node[n + 1];
			
			for ( int i = 1; i <= n; i++) {
				node[i] = new Node ();
				node[i].key = ir.nextInt();
			}
			
			Heaps (node, n);		
			
			StringBuilder sb = new StringBuilder ();
			
			for (int i = 1; i <= n; i++) {
				sb.append("node ").append(i)
				.append(": key = ").append(node[i].key).append(", ");
				
				if (node[i].parent != NULL)
					sb.append("parent key = ").append(node[i].parent).append(", ");
				if (node[i].left != NULL)
					sb.append("left key = ").append(node[i].left).append(", ");
				if (node[i].right != NULL)
					sb.append("right key = ").append(node[i].right).append(", ");
				sb.append("\n");	
			}
			
			System.out.print(sb);
			
		}
		
		static void Heaps (Node[] node, int n) {
			
			for (int i = 1; i <= n; i++) {
				if (i / 2 > 0) node[i].parent = node[i / 2].key;
				if ( i * 2  <= n) node[i].left = node[ i * 2].key;
				if ( i * 2 +1 <= n) node[i].right = node[ i * 2 + 1].key;
			}
			
		}
		
	}
	
	static class Node {
		int key;
		int parent;
		int left;
		int right;
		Node () {
			key = NULL;
			parent = NULL;
			left = NULL;
			right = NULL;
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		CompleteBinaryTree obj = new CompleteBinaryTree();
		obj.cbt(in);
	}
	
	
}


Measured memory_bytes: 24400
#include <stdio.h>
 
int main(void){
    int i,num,x;
    scanf("%d",&num);
    for(i=1;i<=num;i++){
        x=i;
        if(x%3 == 0)
            printf(" %d",i);
        else{
            for(;x && x%10 != 3;)
                x/=10;
            if(x%10 == 3)
                printf(" %d",i);
        }
    }
    puts("");
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<algorithm>
#define INF (1<<24)
using namespace std;
int t[8],x,y,z;
int ans,mini;
int s[]={4,1,4,1,2,1,2,1};

void change(){
  int tmp;
  tmp=s[0];
  for(int i=0;i<7;i++)s[i]=s[i+1];
  s[7]=tmp;
}

int compute(){
  int res=0;
  for(int i=0;i<8;i++){
    res+=max(0,t[i]-s[i]);
  }
  return res;
}

int main(){
  
  while(cin>>t[0]){
    ans=mini=INF;
    for(int i=1;i<8;i++)cin>>t[i];
    
    for(int i=0;i<8;i++){
      change();
      x=compute();
      y=0;
      for(int i=0;i<8;i++){
	y+=s[i];
	y*=10;
      }
      if(mini>x){
	mini=x;
	ans=y;
	
      }else if(mini==x&&y<ans){
	ans=y;
      }
    }
    //cout<<ans<<endl;
    z=100000000;
    for(int i=0;i<8;i++){
      if(i)cout<<" ";
      cout<<ans/z%10;
      z/=10;
    }
    
    cout<<endl;
    
  }
  return 0;
}

Measured memory_bytes: 1160
N = int(input())

mod = 10**9 +7

def powmod(x,y):
    res = 1
    for i in range(0,y,1):
        res = (res*x) % mod
    return res


ans = (powmod(10,N) - powmod(9,N) - powmod(9,N) + powmod(8,N)) % mod

print(ans)

Measured memory_bytes: 9172
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
vector<int> graph[220];

void ae(int a, int b)
{
	graph[a].push_back(b);
	graph[b].push_back(a);
}

pair<int, i64> best;
int branch[220];

void dfs(int p, int rt, int d)
{
	//printf("%d %d %d\n", p, rt, d);
	int deg = graph[p].size() - (rt == -1 ? 0 : 1);
	branch[d] = max(branch[d], deg);
	for (int q : graph[p]) if (q != rt) dfs(q, p, d + 1);
}

const i64 kMax = 0x7fffffffffffffffLL;

i64 sat_mul(i64 a, i64 b)
{
	if (a == 0 || b == 0) return 0;
	if (a < kMax / b) return a * b;
	return kMax;
}

void solve(int root)
{
	for (int i = 0; i < 2 * N; ++i) branch[i] = 0;
	dfs(root, -1, 0);

	i64 leaf = 1;
	int col = 0;
	for (int i = 0; i < 2 * N; ++i) {
		if (branch[i] > 0) {
			++col;
			leaf = sat_mul(leaf, branch[i]);
		}
	}

	best = min(best, { col / 2 + 1, leaf });
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N - 1; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		--x; --y;
		ae(x, N + i);
		ae(y, N + i);
	}

	best = make_pair(1001001, 1LL);

	for (int i = 0; i < 2 * N - 1; ++i) {
		solve(i);
	}

	printf("%d %lld\n", best.first, best.second);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int N,K;cin >> N >> K;
    rep(i,N){
        int a;cin >> a;
    }
    cout << 1+ceil((N-K)/(double)(K-1)) << endl;
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"

	"strconv"
)

func Calc(a, b, c, x int64) int64 {
	if x == 0 {
		return 0
	}

	var cnt int64 = 0
	var amax int64 = a
	var amin int64 = 0
	var bmax int64 = b
	var bmin int64 = 0
	var cmax int64 = c
	var cmin int64 = 0

	for i := amax; i >= amin; i-- {
		for j := bmax; j >= bmin; j-- {
			for k := cmax; k >= cmin; k-- {
				if i*500+j*100+k*50 == x {
					cnt++
				}
			}
		}
	}

	return cnt
}

func Run(in io.Reader, out io.Writer) error {
	sc := bufio.NewScanner(in)

	sc.Scan()
	a, _ := strconv.ParseInt(sc.Text(), 0, 64)
	sc.Scan()
	b, _ := strconv.ParseInt(sc.Text(), 0, 64)
	sc.Scan()
	c, _ := strconv.ParseInt(sc.Text(), 0, 64)
	sc.Scan()
	x, _ := strconv.ParseInt(sc.Text(), 0, 64)

	cnt := Calc(a, b, c, x)
	fmt.Fprintf(out, "%d\n", cnt)

	return nil
}

func main() {
	err := Run(os.Stdin, os.Stdout)

	if err != nil {
		log.Fatal(err)
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int a[200000];

int main(){
	int n, k;
	while(true){
		cin >> n >> k;
		if(n == 0 && k == 0){
			break;
		}
		
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		
		long long int max;
		long long int sum;
		
		sum = 0;
		
		for(int i = 0; i < k; i++){
			sum += a[i];
		}
		
		max = sum;
		
		for(int i = k; i < n; i++){
			sum += a[i];
			sum -= a[i - k];
			if(max < sum){
				max = sum;
			}
		}
		
		printf("%lld\n", max);
	}
	return 0;
}

Measured memory_bytes: 1532
int n,a,b,M[1<<20]={1},i,k;
main(){
    scanf("%d%d%d",&n,&a,&b);
    if(n>1LL*a*b||n<a+b-1) puts("-1");
    else{
        int N=b,C=n;
        while(1){
            for(i=0;i<b;++i) {
                if(a==C){
                    for(k=0;k<=n;++k) if(!M[k]) printf("%d ",k);
                    exit(0);
                }
                C--;printf("%d ",N-i);M[N-i]=1;
            }
            a--;
            N=n<N+b?n:N+b;
        }
    }
}


Measured memory_bytes: 2944
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
int digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

ll cnt[502][502];

int main() {
	int n, m;
	cin >> n;
	m = digisum(n);

	cout << (n % m == 0 ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
import math
N =int(input())
temp_gcd=0
ans_gcd=0
ans=0
for i in range(1,N+1):
  for j in range(1,N+1):
    temp_gcd=math.gcd(i,j)
    for k in range(1,N+1):
      ans_gcd=math.gcd(temp_gcd,k)
      ans+=ans_gcd
print(ans)

Measured memory_bytes: 9192
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
}
const int MOD = 1000000007;

int main() {
    int N;
    int d[51];
    cin >> N;
    rep(i, 0, N) { cin >> d[i]; }
    long long res = 0;
    rep(i, 0, N) {

        rep(r, i + 1, N) { res += d[i] * d[r]; }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
n = int(input())
A = input().split()
A = [int(t) for t in A]

d = 10**9 + 7
s = sum(A)
ans = 0
for i in range(len(A) - 1):
    s = s - A[i]
    ans += A[i] * (s)

print(ans % d)

Measured memory_bytes: 31404
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] t = new long[n];
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextLong();
        }

        long gcm = t[0];
        for (int i = 1; i < n; i++) {
            long lcm = calcLcm(gcm, t[i]);
            gcm = gcm  / (lcm) * t[i];
        }
        System.out.println(gcm);
    }

    private static long calcLcm(long a, long b) {
        if (b == 0) {
            return a;
        }

        return calcLcm(b, a%b);
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    int k;
    string s;
    cin>>k>>s;
    if(s.length()<=k)cout<<s;
    else
    {
        s=s.substr(0,k);
        s.append("...");
        cout<<s;
    }
    
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

Measured memory_bytes: 3656
N=int(input())
A=[int(i) for i in input().split()]

Alice=0
Bob=0

for j in range(N):
    if j%2==0:
        Alice+=max(A)
        A.remove(max(A))
    
    else:
        Bob+=max(A)
        A.remove(max(A))
 
    
print(Alice-Bob)

Measured memory_bytes: 9128
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

H,W=get_i
a=array(H)
H.times do|i|
    a[i]=get_nsp
end
ans=Array.new(H+2){Array.new(W+2)}

(W+2).times do|i|
    ans[0][i]="#"
    ans[H+1][i]="#"
end
(H+2).times do|i|
    ans[i][0]="#"
    ans[i][W+1]="#"
end
H.times do|i|
    W.times do|j|
      ans[i+1][j+1]=a[i][j]
    end
end

(H+2).times do|i|
    puts ans[i].join("")
end

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

using namespace std;
typedef long long ll;

void YesNo(bool x) {
    cout << (x ? "Yes" : "No") << endl;
}

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = 1000; i >= 0; i--) {
        if (a % i == 0 && b % i == 0)k--;
        if (k == 0) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int dp[100005];

int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	dp[0] = 1;
	for (int i=0 ; i<n ; i++) {
		int x;
		scanf("%d", &x);
		int sum = 0;
		for (int j=k ; j>=max(0, k-x) ; j--) {
			sum = (sum + dp[j]) % MOD;
		}
		for (int j=k ; j>=0 ; j--) {
			int o = dp[j];
			dp[j] = sum;
			sum -= o;
			if (sum < 0) sum += MOD;
			if (j-x-1 >= 0) sum=(sum+dp[j-x-1]) % MOD;
		}
		/*for (int j=0 ; j<=k ; j++) {
			cout <<dp[j]<<" ";
		}
		cout <<"\n";*/
	}
	printf("%d\n", dp[k]);
	return 0;
}

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

int main(){
  long N, min = 1000000000, tot = 0, count = 0, re;
  cin >> N;
  
  vector<long> A(N), h(N);
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
    int a = fabs(A.at(i));
    if(A.at(i) < 0){
      count++;
    }
    if(a < min){
      min = a;
    }
    tot += a;
  }
  
  if(count%2 == 0){
    re = tot;
  } else {
    re = tot - 2*min;
  }
  
  cout << re << endl;
  return 0;
}

Measured memory_bytes: 1792
import scala.io.StdIn.{readLine,readInt}
import scala.language.postfixOps

object Main {
  var cnt = 0
  val l = new Array[Int](260000)
  val r = new Array[Int](260000)

  def merge(a:Array[Int],left:Int,mid:Int,right:Int) = {
    val n1 = mid-left
    val n2 = right-mid
    Array.copy(a,left,l,0,n1)
    l(n1) = Int.MaxValue
    Array.copy(a,mid,r,0,n2)
    r(n2) = Int.MaxValue
    var i=0
    var j=0
    for(k<-left until right) {
      if(l(i)<=r(j)){
        a(k) = l(i)
        i += 1
      } else  {
        a(k)=r(j)
        j += 1
      }
      cnt += 1
    }
  }

  def getSortIndex(n:Int):Iterator[IndexedSeq[(Int,Int)]] = {
    var w = n
    var h = 0
    while(w>1) {
      h += 1
      w /= 2
    }

    def scan(h:Int,l:List[IndexedSeq[(Int,Int)]]):List[IndexedSeq[(Int,Int)]] = {
      if(h==0) l
      else
        scan(h-1,(for(i<-l.head;j<-List((i._1,(i._2+i._1)/2),((i._2+i._1)/2,i._2))) yield j)::l)
    }
    scan(h-1,List(IndexedSeq((0,n/2),(n/2,n)))).to[Iterator]
  }

  def main(args:Array[String]) = {
    val n = readInt
    val l = getSortIndex(n)
    val a = readLine.split(" ").map(_.toInt)

    for(e2<-l) {
      for(e<-e2) {
        val mid = (e._2+e._1)/2
        if(e._2-e._1>1)
          merge(a,e._1,mid,e._2)
      }
    }
    merge(a,0,n/2,n)
    println(a.mkString(" "))
    println(cnt)
  }
}

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

using namespace std;

int otosu(vector<deque<int>> &c,int h,int w,int k) {

	int point=0;
	for (int i = 0; i < h; i++) {
		int j = 0;
		while (j <w-1) {
			int rensa = 1;
			if (c[j].at(i)!=0 && c[j].at(i) == c[j+1].at(i)) {

				rensa = 2;

				while (j + rensa < w) {
					if (c[j + rensa].at(i) == c[j].at(i)) {
						rensa++;
					}
					else {
						break;
					}
				}

				if (rensa >= k) {
					for (int m = 0; m < rensa; m++) {
						point += c[j + m].at(i);
						c[j + m].at(i) = -1;
					}
				}

			}

			j=j+rensa;
		}
		
	}

	for (int j = 0; j < w; j++) {
		for (int i = h - 1; i >= 0; i--) {
			if (c[j].at(i) == -1) {
				c[j].erase(c[j].begin() + i);
				c[j].push_back(0);
			}
		}
	}

	return point;
}

int main() {

	int h, w, k;
	cin >> h >> w >> k;

	vector<deque<int>> c(w, deque<int>());
	vector<deque<int>> corg(w, deque<int>());

	int summ=0;
	string in1;
	for (int i =0; i <h; i++) {
		cin >> in1;
		for (int j = 0; j < w; j++) {
			c[j].push_front(in1[j]-'0');
			summ += c[j].front();
		}
	}

	if (k == 0 || k == 1) {
		cout << summ << endl;
		return 0;
	}

	corg = c;
	int score=0;
	for (int j = 0; j < h; j++) {
		for (int i = 0; i < w; i++) {

			c = corg;

			c[i].erase(c[i].begin() + j);
			c[i].push_back(0);

			int scoret = 0;
			int counter = 0;
			int point;
			do {
				point = 0;
				point = otosu(c, h,w, k);
				scoret += point * (int)pow(2, counter);
				counter++;
			} while (point != 0);
			score = max(score, scoret);
		}
	}
	cout << score << endl;
	return 0;
}

Measured memory_bytes: 4136
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;


int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  ll M; cin >> M;
  vector<ll> D(M), C(M);
  for(int i = 0; i < M; ++i) cin >> D[i] >> C[i];

  ll ans = 0, cnt = 0;
  for(int i = 0; i < M; ++i) {
    ans += C[i];
    cnt += D[i] * C[i];
  }
  cout << ans-1 + (cnt-1) / 9;

  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";


signed main()
{
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//#endif
	/************************************/
	
	
	int a, b; cin>>a>>b;
	if((a+b) & 1) cout<<"IMPOSSIBLE\n";
	else cout<< (a+b)/2 <<"\n";
	
	
	
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {

   int v[50]{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 k;
   cin >> k;

   cout << v[k - 1]<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
const int N=100005;
const int mod=1e9+7;

int main()
{
    std::ios::sync_with_stdio(false);
    char a[201];
    scanf("%s",a);
    stack<char> s;
    int len=strlen(a);
    for(int i=0;i<len;i++)
        s.push(a[i]);
    s.pop();
    int t,flag;
    while(1){
        if(s.size()%2==1) s.pop();
        else {
            t=s.size();
            t/=2;
            flag=1;
            for(int i=0;i<t;i++){
                if(a[i]!=a[i+t]){
                    flag=0;
                    break;
                }
            }
            if(flag){
                cout<<t*2<<endl;
                break;
            }
            else s.pop();
        }
    }
    return 0;
}

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

int main(void) {
  string S, T;
  cin >> S >> T;
  vector<int> v1(26, 0), v2(26, 0);
  for (int i = 0; i < S.length(); i++) {
    v1[S[i] - 'a']++;
    v2[T[i] - 'a']++;
  }

  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());

  bool flag = true;
  for (int i = 0; i < 26; i++) {
    if (v1[i] != v2[i]) {
      flag = false;
      break;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <list>
#include <iterator>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
typedef  pair<int,int> P;

int n;
int a[1000005];
int cnt[1000005];
bool pairwise=true;

int gcd(int x,int y)
{
if(y==0)return x;
return gcd(y,x%y);
}


//pairwise=trueから始めて重複があればfalseにする。trueであればpairwise
//pairwiseでないならばgcdを求める


int main()
{
cin>>n;
rep(i,n)
{
    cin>>a[i];
    cnt[a[i]]++;
}

for(int i=2;i<1000005;i++)
{
int t=0;
for(int j=i;j<1000005;j+=i)
t+=cnt[j];
if(t>1)pairwise=false;
}

if(pairwise==true){cout <<"pairwise coprime";return 0;}

int ans=a[0];
for(int i=1;i<n;i++)
ans=gcd(ans,a[i]);
if(ans>1)
{cout<<"not coprime";return 0;}
else cout <<"setwise coprime";return 0;
}


Measured memory_bytes: 11260
#include <iostream>

using namespace std;

unsigned long long int N, M;
 
int main() {
	cin >> N >> M;
	
	unsigned long long int Scc = 0;
	
	if (2 * N > M) {
		Scc += M / 2;
		cout << Scc;
		return 0;
	}
		
	if (2 * N <= M) {
		Scc += N;
			
		M -= 2 * N;
		N = 0;
	}
		
	if (N == 0 && M > 1) {
		N = M / 4;
		M /= 2;
	}
	
	if (2 * N <= M) {
		Scc += N;
			
		M -= 2 * N;
		N = 0;
	}		
	cout << Scc;
	
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  A.at(0) = 0;
  for (int i = 1; i < N; i++){
    cin >> A.at(i);
  }
  vector<int> result(N);
  for (int i = 1; i < N; i++){
    result.at(A.at(i) - 1) ++;
  }
  for (int i = 0; i < N; i++){
    cout << result.at(i) << endl;
  }
}

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

int main()
{
	int a, b, s=0, t=0, i;

	for (i = 0; i < 4; i++){
		cin >> a;
		s += a;
	}

	for (i = 0; i < 4; i++){
		cin >> b;
		t += b;
	}

	if (s > t){ cout << s << endl; }
	else{ cout << t << endl; }

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};

int main()
{
    ll n, m, l, r, k, b, c, d, ans = 0ll;
    string s, t;
    cin>>n;
    VI a(n);
    REP(i,n) {
        cin>>a[i];
        if (i % 2 == 0 && a[i] % 2 == 1)
            ans++;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3600
#include <cmath>
#include <cstdio>
#include <iostream>

using namespace std;

inline double radian(int C) {
  return C * M_PI / 180.0;
}

inline double area(int a, int b, double theta) {
  return 0.5 * a * b * sin(theta);
}

inline double calc_L(int a, int b, double theta) {
  // law of cosines                                                                                                                                                       
  const double c =
      sqrt(static_cast<double>(a * a + b * b) - 2.0 * a * b * cos(theta));
  return a + b + c;
}

inline double height(int a, double S) {
  return 2.0 * S / static_cast<double>(a);
}

int main() {
  int a, b, C;

  cin >> a >> b >> C;

  const double theta = radian(C);
  const double S = area(a, b, theta);
  printf("%.8f\n", S);
  printf("%.8f\n", calc_L(a, b, theta));
  printf("%.8f\n", height(a, S));

  return 0;
}

Measured memory_bytes: 3372