akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

const int MAX_N = 1555;
const int MAX_M = 1555;
int h[MAX_N + 1];
int w[MAX_N + 1];
int N, M;

int main()
{
  while(cin >> N >> M, N){
    rep(i, N) cin >> h[i + 1];
    rep(i, M) cin >> w[i + 1];

    rep(i, N) h[i + 1] += h[i];
    rep(i, M) w[i + 1] += w[i];

    vi l, r;
    rep(i, N + 1) rep(j, i) l.pb(h[i] - h[j]);
    rep(i, M + 1) rep(j, i) r.pb(w[i] - w[j]);
    sort(ALL(l));
    sort(ALL(r));

    int res = 0;
    vrep(v, l) res += upper_bound(ALL(r), *v) - lower_bound(ALL(r), *v);

    cout << res << endl;
  }

  return 0;
}

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

int main() {
    int n; cin >> n;
    vector<pair<int,int>> pr(n);
    
    for(int i=0; i < n; ++i){
        cin >> pr.at(i).first >> pr.at(i).second;
    }
    
    sort(pr.begin(),pr.end());
    for(int i=0; i < n; ++i){
        cout << pr.at(i).first << " " << pr.at(i).second << endl;
    }
    
}



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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll p1 = a * n, p2 = b;
    if (p1 < p2)
    {
        cout << p1 << endl;
    }
    else
    {
        cout << p2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    int flag = 0;
    vector<int> ind;
    for(int i = 0; i < N; i++){
        if(S[i] == 'A') {
            flag = 1;
        }
        else if(flag == 1 && S[i] == 'C'){
            flag = 0;
            ind.push_back(i);
        }
        else{
            flag = 0;
        }
    }
    for(int i = 0; i < Q; i++){
        int l, r;
        cin >> l >> r;
        l--;
        r--;
        int t = upper_bound(ind.begin(), ind.end(), r) - upper_bound(ind.begin(), ind.end(), l);
        cout << t << endl;
    }
}

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

int main(){
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);

    int count(0);
    if (A == 5) count++;
    if (B == 5) count++;
    if (C == 5) count++;
    if (count == 2){
        if (A == 7) count++;
        else if (B == 7) count++;
        else if (C == 7) count++;
    }
    else cout << "NO\n";
    if (count == 3) cout << "YES\n";
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i,0,n) cin >> a[i] >> b[i];
    ll base = 0;
    vector<ll> c(n);
    rep(i,0,n) {
        base += -b[i];
        c[i] = a[i]+b[i];
    }
    sort(all(c));
    reverse(all(c));
    for(int i=0; i<n; i+=2) base+=c[i];
    cout << base << "\n";
}


Measured memory_bytes: 2560
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
S = _S()
#Ap = np.array(A)
#C = np.zeros(N + 1)

last = ''
count = 0
for i in range(N):
    a = S[i]
    if not last == a:
        count += 1
        last = a
print(count)

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

#define ll long long
#define f(i,a,n) for (int i=a;i<n;i++)
typedef pair<ll, ll> pa;
const ll mod=1000000007;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll c = n;
    ll b = 0;
    while (c != 0) {
        c /= 10;
        b++;
    }

    ll ans = 0;
    if (n < 10) {
        ans = n;
    } else if (b % 2 == 0) {
        ans += 9;
        for (int i = 2; i < b; i += 2) {
            ans += 9*pow(10, i);
        }
    } else {
        ans += 9;
        for (int i = 2; i < b - 1; i += 2) {
            ans += 9*pow(10, i);
        }
        ans += n - pow(10, b - 1) + 1;
    }

    cout << ans;
    return 0;
}

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

int main() {
  int L, R, Y = 2019;
  cin >> L >> R;

  if (R - L > Y) return cout << 0 << "\n", 0;

  long ans = LONG_MAX;
  for (int i = L; i < R; i++) {
    for (int j = i + 1; j <= R; j++) {
      ans = min(ans, (long)i * j % Y);
    }
  }

  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 100000000;

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

int     main(void){
    int     n;
    cin >> n;
    vector<int> arr = vector<int>(n);
    int     i = 0;
    while (i < n)
        cin >> arr[i++];
    sort(arr.begin(), arr.end());
    i = 1;
    while (i < n){
        if (arr.at(i-1) == arr.at(i)){
            cout << "NO";
            return 0;
        }
        i++;
    }
    cout << "YES";
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace testtesttest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var list = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            int result = 0;
            for (int i = 0; i < list.Length; i++)
            {
                var targetIndex = list[i]-1;
                if (list[targetIndex]-1 == i)
                {
                    result++;
                }

            }
            Console.WriteLine(result/2);
            Console.Read();
        }
    }
}


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

typedef long long ll;

int main()
{
    int i,j;
    ll h, w;
    cin >> h >> w;
    if(h == 1 || w == 1){
        cout << 1 << endl;
        return 0;
    }
    ll ans = 0;
    if(w%2 == 0){
        ans = w*h/2;
    }else{
        if(h%2 == 0){
            ans = w*h/2;
        }else{
            ans = w*(h-1)/2 + (w+1)/2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[1000009];
map<long long,long long>mp;

int main(){
  int s;
  cin>>s;
  a[0]=s;
  mp[s]=1;
  for(int i=1;i<=1000001;i++){
    if(a[i-1]%2==0){
      a[i]=a[i-1]/2;
    }
    else{
      a[i]=a[i-1]*3+1;
    }
    if(mp.count(a[i])!=0){
      cout<<i+1<<endl;
      return(0);
    }
    mp[a[i]]=1;
  }  
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long int
#define pb push_back
#define endl "\n"
#define ff first
#define ss second
#define N 500009
#define NN 3000009
#define M 509
#define mod 1000000007
#define debug cout<<"There There\n";
#define debug1(x) cout<<"\nValue is "<<x<<endl
#define debug2(x,y) cout<<"\nValue is "<<x<<" "<<y<<endl
#define debug3(x,y,z) cout<<"\nValue is "<<x<<" "<<y<<" "<<z<<endl  
#define pq priority_queue<int>
#define mpq priority_queue<int,vector<int>,greater<int>>
#define pr pair<int,int>
#define mx INT_MAX
#define lmx LLONG_MAX
#define err return 0          
#define all(a) a.begin(),a.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string s,t;
vector<vector<int>> dp;
vector<vector<int>> go;
int n,m;

int32_t main()
{	
	IOS;
	cin>>s>>t;
	dp.resize(s.length()+9);
	go.resize(s.length()+9);	
	n = s.length();
	m = t.length();
	for(int i=0;i<s.length()+9;i++)
	{
		dp[i].resize(t.length()+9);
		go[i].resize(t.length()+9);
		for(int j=0;j<dp[i].size();j++)
		{
			dp[i][j]=0;
		}
	}	
	for(int i=0;i<s.length();i++)
	{
		for(int j=0;j<t.length();j++)
		{
			if(s[i]==t[j])
			{
				dp[i+1][j+1] = dp[i][j]+1;
				go[i+1][j+1] = 2;
				continue;
			}
			else
			{
				dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
				if(dp[i][j+1]>dp[i+1][j])
				{
					go[i+1][j+1] = 1;
				}
				else
				{
					go[i+1][j+1] = 0;	
				}
			}
		}
	}
	vector<char> ans;
	int nowi = n;
	int nowj = m;
	//cout<<dp[n][m]<<endl;
	while(!(nowi==0||nowj==0))
	{
		if(go[nowi][nowj]==2)
		{
			ans.pb(s[nowi-1]);
			nowi--;
			nowj--;
		}
		else if(go[nowi][nowj]==1)
		{
			nowi--;
		}
		else
		{
			nowj--;
		}
	}
	reverse(all(ans));
	string is = "";
	for(auto i:ans)
	{
		is+=i;
	}
	cout<<is<<endl;
	return 0;
}

Measured memory_bytes: 141952
// inputに入力データ全体が入る
function Main(input) {
	input = input.split(" "); // 1行目がinput[0], 2行目がinput[1], …に入る
	// ここに処理を書く
	var X = input[0];
	var A = input[1];
	var result = 0

	try {
		checkNumber(Number(X), Number(A))
		}
		catch (e) {
			console.log("エラー内容："　+ e);
		}
	
	// console.logは標準出力に1行出力します (自動的に最後に改行が入ります)
	// console.log(result);
}

function checkNumber (X, A) {
	
		if ((Number(X)>=0 && Number(X)<=9) || (Number(A)>=0 && Number(A)<=9)) {
			if (X<A) {
				result = 0
			} else if (X>=A) {
				result = 10
			}
		} else {
			throw "Invalid"
		}
	
	console.log(result);
}

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>

using namespace std;

const int MAXN=1e5+1e2;

int n;

struct rbt
{
	int x ; 
	int r ; 
} a [ MAXN ] ; 
inline bool cmp ( rbt x , rbt y )
{
	return x . r + x . x < y . r + y . x  ; 
}

int main ( )
{
	// freopen("testdata.in","r",stdin);
	// freopen("testdata.out","w",stdout);

	scanf("%d",&n);
	for ( int i = 1 ; i <= n ; i ++ ){
		scanf("%d%d",&a[i].x,&a[i].r);
	}

	sort ( a + 1 , a + n + 1 , cmp ) ; 

	int now = 0 , 
		end = a [ n ] . x + a [ n ] . r ; 
	int top = 1 ; 
	int joined = 0 ; 
	
	while ( now < end )
	{
		if ( top > n )
		{
			break ; 
		}
		if ( now <= ( a [ top ] . x - a [ top ] . r < 0 ? 0 : a [ top ] . x - a [ top ] . r ) )
		{
			now = a [ top ] . x + a [ top ] . r ; 
			++ joined ; 
		}
		else
		{
			++ top ; 
		}
	}

	printf ( "%d" , joined ) ; 

	printf ( "\n" ) ; 
	return 0 ; 
}

Measured memory_bytes: 1024
data class PC(val p: Int, val c: Int) {
    constructor(pc: List<Int>): this(pc[0], pc[1])
}
fun main(args: Array<String>) {
    var (D, G) = listOfInt()
    val pc = Array(D) { PC(listOfInt()) }
    var ans = Int.MAX_VALUE
    var mask = 0
    while(mask < (1 shl D)) {
        try {
            var s = 0
            var num = 0
            var rest_max = -1
            for (i in 0 until D) {
                if ((mask ushr i) and 1 != 0) {
                    s += 100 * (i + 1) * pc[i].p + pc[i].c
                    num += pc[i].p
                } else rest_max = i
            }
            if (s < G) {
                val s1 = 100 * (rest_max + 1)
                val need = (G - s + s1 - 1) / s1
                if (need >= pc[rest_max].p) continue
                num += need
            }
            ans = Math.min(ans, num)
        } finally {
            mask += 1
        }
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 37896
require 'prime'
n=gets.to_i
a=(1..n).reduce(:*).prime_division
r=0
f=->m{a.count{|x,y|y>=m-1}}
p f[75]+f[25]*~-f[3]+f[15]*~-f[5]+f[5]*~-f[5]*(f[3]-2)/2

Measured memory_bytes: 2044
# -*- coding: utf-8 -*-

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

diff_sum = 0
for i in range(N-1):
    if A[i+1] < A[i]:
        diff = A[i] - A[i+1] 
        diff_sum += diff
        A[i+1] += diff


print(diff_sum)



Measured memory_bytes: 32308
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    N = len(S)
    if S[N-1] == '1':
        print(-1)
        return -1

    if S[0] != '1':
        print(-1)
        return -1

    if S[N-2] != '1':
        print(-1)
        return -1


    for i in range(N//2):
        if S[i] != S[N-2-i]:
            print(-1)
            return -1

    p = [N]
    for i in range(N, 0, -1):
        if S[i-1] == '1':
            p.append(i)
        else:
            p.append(p[-1])
    p.reverse()
    e = []
    for i in range(1, N):
        e.append((i, p[i]))

    for u, v in e:
        print(u, v)


def main():
    S = read_str()
    (slv(S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 72408
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <cstring>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 100000;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

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

int main() {
	int n, a;
	cin >> n >> a;
	if (n % 500 <= a) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        M = new int[n][n];
        d = new int[n];
        p = new int[n];
        color = new int[n];

        for(int i = 0; i < n ; i ++){
            p[i] = -1;
            d[i] = INFTY;
        }

        for(int i = 0 ; i < n ; i ++){
            for(int j = 0 ; j < n; j ++){
                int e = sc.nextInt();
                M[i][j] = e == -1 ? INFTY : e;
            }
        }

        System.out.println(prime());
    }

    static int[][] M;
    static int[] color;
    static int[] d;
    static int[] p;
    static int n;
    static final int INFTY = 1 << 21;
    static final int WHITE = 0;
    static final int GRAY = 1;
    static final int BLACK = 2;



   static int prime(){
        d[0] = 0;
        int minv,u;
        while (true) {
            minv = INFTY;
            u = - 1;
            for(int i = 0 ; i < n ; i ++){
                if(color[i] != BLACK && minv > d[i]){
                   minv = d[i];
                   u = i;
                }
            }


            if(u == -1) break;

            color[u] = BLACK;

            for(int v = 0 ; v < n ; v ++){
                if(color[v] != BLACK && M[u][v] != INFTY){
                    if(d[v] > M[u][v]){
                        d[v] = M[u][v];
                        p[v] = u;
                        color[v] = GRAY;
                    }

                }
            }
        }


        int sum = 0;
        for(int i = 0 ; i < n ; i ++){
            if(p[i] > -1){
                sum += M[i][p[i]];
            }
        }
        return sum;
    }
}



Measured memory_bytes: 40596
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];

  int q; cin >> q;
  for (int i = 0; i < q; ++i) {
    int k; cin >> k;
    cout << distance(a.begin(), lower_bound(all(a), k)) << '\n';
  }

  return 0;
}


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

int main(){
  int E, Y;
  cin>>E>>Y;

  if(E == 0 && 1868 <= Y && Y <= 1911) cout<<"M"<<Y - 1867<<endl;
  if(E == 0 && 1912 <= Y && Y <= 1925) cout<<"T"<<Y - 1911<<endl;
  if(E == 0 && 1926 <= Y && Y <= 1988) cout<<"S"<<Y - 1925<<endl;
  if(E == 0 && 1989 <= Y && Y <= 2016) cout<<"H"<<Y - 1988<<endl;
  if(E == 1) cout<<1867 + Y<<endl;
  if(E == 2) cout<<1911 + Y<<endl;
  if(E == 3) cout<<1925 + Y<<endl;
  if(E == 4) cout<<1988 + Y<<endl;

  return 0;
}



Measured memory_bytes: 3100
import datetime 
  
# date in yyyy/mm/dd format 
date_entry = input()
year, month, day = map(int, date_entry.split('/'))

d1 = datetime.datetime(year, month, day) 
d2 = datetime.datetime(2019, 4, 30) 
  
# Comparing the dates will return 
# either True or False 

if d1<=d2:
  print("Heisei")
else:
  print("TBD")

Measured memory_bytes: 3312
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    map<int, int> mp;
    rep(i, n) mp[a[i]]++;
    int ans = 0;
    vi v;
    for(auto& p: mp) v.push_back(p.se);
    sort(all(v));
    rep(i, (int)(mp.size()) - k) ans += v[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11516
#include <iostream>

using namespace std;

const int N = 100005;
int n, m, t[8*N], cov[8*N], ed, st;

void clean(int l, int r, int x)
{
	t[x] += cov[x] * (r - l + 1);
	cov[x * 2] += cov[x];
	cov[x * 2 + 1] += cov[x];
	cov[x] = 0;
}

void add(int l, int r, int x, int p, int q)
{
	if (p <= l && q >= r)
	{
		cov[x]++;
		return ;
	}
	int mid = (l + r) / 2;
	if (p <= mid) add(l, mid, x * 2, p, q);
	if (q > mid) add(mid + 1, r, x * 2 + 1, p, q);
}

int ask(int l, int r, int x, int p, int q)
{
	clean(l ,r ,x);
	if (p <= l && q >= r)
	{
		return t[x];
	}
	int ret = 0;
	int mid = (l + r) / 2;
	if (p <= mid) ret += ask(l, mid, x * 2, p, q);
	if (q > mid) ret += ask(mid + 1, r, x * 2 + 1, p, q);
	return ret;
}

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		int ll, rr;
		cin >> ll >> rr;
		add(1, n, 1, ll, rr);
	}
	st = n;
	for (int i = 1; i <= n; i++)
	{
		if (ask(1, n, 1, i, i) == m)
		{
			st = i;
			break;
		}
	}
	ed = 1;
	for (int i = n; i >= 1; i--)
	{
		if (ask(1, n, 1, i, i) == m)
		{
			ed = i;
			break;
		}
	}
	if (ed - st + 1 > 0) cout << ed - st + 1 << endl;
	else cout << "0" << endl;
	return 0;
}

Measured memory_bytes: 6400
# include <bits/stdc++.h>
using namespace std;
#define int long long int
int mod = 1e9 + 7;
char mat[1005][1005];
int bottom(int n, int m)
{
	int dp[n][m] = {};
	dp[n - 1][m - 1] = 1;
	for (int i = n - 1; i >= 0; i--)
	{
		for (int j = m - 1; j >= 0; j--)
		{
			if (i == n - 1 and j == m - 1) continue;
			if (mat[i][j] == '#')
				dp[i][j] = 0;
			else
				dp[i][j] = (( (i == (n - 1)) ? 0 : dp[i + 1][j]) + ( (j == (m - 1)) ? 0 : dp[i][j + 1])) % mod;
			//cout << dp[i][j] << " ";
		}
		//cout << endl;
	}
	return dp[0][0];
}
int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> mat[i][j];
		}
	}
	cout << bottom(n, m);
}
// 3 8
// 3 30
// 4 50
// 5 60
// 5 5
// ..#..
// .....
// #...#
// .....
// ..#..

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int n;
#define LL long long
const LL INF = 100000000000000LL;
const int N = 600000;
vector <int> bi[N], ci[N];
LL V;
vector <pair <LL, LL> > L[N], c;
int comp(pair <LL, LL> a, pair <LL, LL> b)
{
    if (a.first != b.first) return a.first < b.first;
    return a.second < b.second;
}
void dfs(int t)
{
    L[t].clear();
    if (bi[t].size() == 0)
    {
        L[t].push_back(make_pair(0, 0));
    }
    else
    {
        dfs(bi[t][0]);
        dfs(bi[t][1]);
        if (L[bi[t][0]].size() < L[bi[t][1]].size())
        {
            swap(bi[t][0], bi[t][1]);
            swap(ci[t][0], ci[t][1]);
        }
        c.clear();
        for (int i = 0; i < L[bi[t][1]].size(); ++ i)
        {
            int v;
            v = upper_bound(L[bi[t][0]].begin(), L[bi[t][0]].end(), make_pair(V - ci[t][0] - ci[t][1] - L[bi[t][1]][i].first, INF)) - L[bi[t][0]].begin() - 1;
            if (v >= 0)
            {
                c.push_back(make_pair(L[bi[t][1]][i].second + ci[t][1], L[bi[t][0]][v].second + ci[t][0]));
                c.push_back(make_pair(L[bi[t][0]][v].second + ci[t][0], L[bi[t][1]][i].second + ci[t][1]));
            }
        }
        if (c.empty()) return;
        sort(c.begin(), c.end());
        L[t].push_back(c[0]);
        for (int i = 1; i < c.size(); ++ i)
            if (c[i].second < L[t][L[t].size() - 1].second)
                L[t].push_back(c[i]);
    }
}
int main()
{
    scanf("%d", &n);
    for (int i = 2; i <= n; ++ i)
    {
        int f, v;
        scanf("%d%d", &f, &v);
        bi[f].push_back(i);
        ci[f].push_back(v);
    }
    LL l = 0, r = INF;
    while (l < r)
    {
        V = (l + r) / 2;
        dfs(1);
        if (L[1].size()) r = V; else l = V + 1;
    }
    cout << l << endl;
}


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

int main() {
	string str;
	int q;
	cin >> str;
	cin >> q;
	string transform, t;
	int start, end;
	for (int i = 0; i < q; i++) {
		cin >> transform >> start >> end;
		
		if (transform == "replace") {
			cin >> t;
			str = str.substr(0, start) + t + str.substr(end + 1, str.size() - start - 1);

		} else if (transform == "reverse") {
			string s = str.substr(start, end - start + 1);
			reverse(s.begin(), s.end());
			str = str.substr(0,start) + s + str.substr(end + 1, str.size() - start - 1);	
		
		} else {
			cout << str.substr(start, end - start + 1) << endl;

		}

	}
	return 0;
}


Measured memory_bytes: 3196
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int mod = 1e9 + 7;

inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }

inline int sub(int a, int b) { return a >= b ? a - b : a - b + mod; }

inline int mul(int a, int b) { return llint(a) * b % mod; }

int powmod(int a, int b) {
  if (b == 0) return 1;
  if (b % 2) return mul(a, powmod(a, b - 1));
  return powmod(mul(a, a), b / 2);
}

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

  int N;
  cin >> N;

  vector<int> fact(N + 1);
  fact[0] = 1;
  for (int i = 1; i <= N; ++i) {
    fact[i] = mul(fact[i - 1], i);
  }

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

  int ret = 0;
  for (int it = 0; it < 2; ++it) {
    int sum = 0;
    for (int i = 0; i < N; ++i) {
      ret = add(ret, mul(sum, A[i]));
      sum = add(sum, mul(fact[N], powmod(i+2, mod-2)));
    }
    reverse(A.begin(), A.end());
  }

  for (int i = 0; i < N; ++i) {
    ret = add(ret, mul(fact[N], A[i]));
  }

  cout << ret << "\n";
  return 0;
}


Measured memory_bytes: 1024
X, Y = input().split()
a = ["A", "B", "C", "D", "E", "F"]
b = [10, 11, 12, 13, 14, 15]
for i in range(6):
    if X == a[i]:
        x = b[i]
for j in range(6):
    if Y == a[j]:
        y = b[j]
if int(x) == int(y):
    print("=")
elif int(x) > int(y):
    print(">")
else:
    print("<")

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

int main(){
  int N;
  cin >> N;
  vector<int> ws(N);
  int sum = 0;
  for(int i = 0; i< N; i++){
    cin >> ws.at(i);
    sum += ws.at(i);
  }
  
 // sort(ws.begin(), ws.end());
  
  int s1 = 0;
  int pre = sum;
  for(int i = 0; i < N; i++){
    s1 += ws.at(i);
    if(pre < abs(s1 * 2 - sum)){ cout <<pre << endl; break;}
    else pre = abs(s1 * 2 - sum);
  }

  
  
  
  return 0; 
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.string, std.array;

void main()
{
  const N = readln.chomp.to!long;
  
  auto ans = long.max;
  for (long i = 1; i*i <= N; ++i) {
    if (N%i == 0) ans = ans.min(i+N/i-2);
  }
  ans.writeln;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define MOD 1000000007
#define PI 3.14159265358979

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

using namespace std;

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
int main() {
	cin >> N;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	map< int, int > M;
	vector< int > B(N);
	vector< int > C = A;
	sort(C.begin(), C.end());
	rep(i, N) {
		M.insert(make_pair(C[i], i));
	}
	rep(i, N) {
		map< int, int >::iterator it = M.find(A[i]);
		B[i] = (*it).second;
	}
	int ans = 0;
	rep(i, N) if (i % 2 != B[i] % 2) ans++;
	cout << ans / 2 << endl;
	return 0;
}

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

using namespace std;

void solve() {
    long long n, total, total2, cnt, cnt2;
    total2 = total = cnt2 = cnt = 0;
    cin >> n;
    for (int i=0;i<n;++i) {
        long long ai;
        cin >> ai;
        total2 += ai;
        total += ai;
        if (i % 2 == 0) {
            if (total <= 0) {
                cnt += -total + 1;
                total = 1;
            }
            if (total2 >= 0) {
                cnt2 += total2 + 1;
                total2 = -1;
            }
        } else {
            if (total >= 0) {
                cnt += total + 1;
                total = -1;
            }
            if (total2 <= 0) {
                cnt2 += -total2 + 1;
                total2 = 1;
            }
        }
    }
    cout << ((cnt < cnt2) ? cnt : cnt2);
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
 
const int INF = 2000000000;
const int N = 100000 + 10;
lld arr[N], cnt[N], sm[N];
 
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m;cin>>n>>m;
	for(int i=0;i<n;i++) cin>>arr[i];
	lld sumL=0, sumR=0;
	for(int i=0;i<n-1;i++) sumL+=arr[i];
	for(int i=1;i<n;i++) sumR+=arr[i]+m*(arr[i-1]>arr[i]);
	for(int i=1;i<n;i++){
		if(arr[i-1]>arr[i]){
			cnt[arr[i-1]+1]+=1;
			cnt[m+1]-=1;
			cnt[1]+=1;
			cnt[arr[i]+1]-=1;
			sm[arr[i-1]+1]+=arr[i-1];
			sm[m+1]-=arr[i-1];
			sm[1]+=arr[i-1]-m;
			sm[arr[i]+1]-=arr[i-1]-m;
		}else{
			cnt[arr[i-1]+1]+=1;
			cnt[arr[i]+1]-=1;
			sm[arr[i-1]+1]+=arr[i-1];
			sm[arr[i]+1]-=arr[i-1];
		}
	}
	for(int i=1;i<=m+1;i++) cnt[i]+=cnt[i-1];
	for(int i=1;i<=m+1;i++) sm[i]+=sm[i-1];
	lld val=sumR-sumL;
	for(int i=1;i<=m;i++){
		lld curV=sumR-sumL-cnt[i]*(i-1)+sm[i];
		if(curV < val) val=curV;
	}
	cout<<val<<'\n';
	return 0;
}

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

using ld=long double;
int main(){
    int n;
    ld r;
    while(cin>>r>>n,n!=0 || r!=0){
        vector<ld> xl(n);
        vector<ld> xr(n);
        vector<ld> h(n);
        for(int i=0;i<n;i++) cin>>xl[i]>>xr[i]>>h[i];

        vector<vector<int>> field(50,vector<int>(30,false));
        for(int i=0;i<n;i++){
            for(int j=xl[i];j<xr[i];j++){
                for(int k=0;k<h[i];k++){
                    field[j+20][k]=true;
                }
            }
        }
        ld res=1e9;
        
        function<ld(ld,ld)> height=[&](ld x,ld hei){
            if(abs(x)>=r) return ld(1e9);
            return hei-sqrt(double(r*r-x*x));
        };
        for(int i=0;i<50;i++){
            int j=0;
            for(;j<30;j++){
                if(!field[i][j]) break;
            }
            ld hei=j;
            ld l=i;
            ld r=i+1;
            res=min(res,ld(height(l-20,hei)));
            res=min(res,ld(height(r-20,hei)));
        }
        cout<<fixed<<setprecision(7);
        cout<<(res==1e9 ? 0 : res+r)<<endl;
    }
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define bzero(p, n) memset(p, 0, n)
#define all(a) begin(a),end(a)
template<class T> inline void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class K, class V> void cout_v(map<K, V>& m)
{ for(auto it=m.begin();it!=m.end();it++)cout<<it->first<<":"<<it->second<<endl;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
inline ll powll(ll x,ll y) {ll p=1; while(y--) p*=x; return p;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    ll N; cin >>N;
    vector<ll> A(N+1); cin >> A;
    vector<ll> B(N); cin >> B;
    
    ll ans = 0;

    rep(i, N) {
        if (A[i] >= B[i]) {
            ans += B[i];
        } else {
            ans += A[i];
            ll rest = min(B[i] - A[i], A[i + 1]);
            A[i + 1] -= rest;
            ans += rest;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define 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;
}

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

int main()
{
    int n;
    cin >> n;
    int d[n][2];
    rep(i, n)
    {
        rep(j, 2)
        {
            cin >> d[i][j];
        }
    }
    int count = 0;
    rep(i, n)
    {
        if (d[i][0] == d[i][1])
        {
            if (count == 2)
            {
                out("Yes");
                return 0;
            }
            else
            {
                count++;
            }
        }
        else
        {
            count = 0;
        }
    }
    out("No");
}

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

int main() {
  int n;
  string s, t;
  cin >> n;
  cin >> s;
  cin >> t;
  if (s == t) {
    cout << n << endl;
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    string u = t.substr(n - i, i);
    string tmp = s + u;
    if (tmp.substr(i, n) == t) {
      ans = n + i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

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

bool check(vector<char> c){
  bool res = 1;
  rep(i,c.size()/2){
    //cout << c[i] << " " << c[c.size()-i-1] << endl;
    if(c[i]!=c[c.size()-i-1])res=0;
  }
  return res;
}

int main(){
  string s;
  cin >> s;
  vector<char> c;
  rep(i,s.size())if(s[i]!='x')c.push_back(s[i]);
  //cout << check(c) << endl;
  if(check(c)==0)cout << -1 << endl;
  else{
    int left = 0;
    int right = s.size()-1;
    int ans = 0;
    while(left<right){
      //cout << left << ' ' << right << endl;
      if(s[left]==s[right])left++,right--;
      else if(s[left]=='x')ans++,left++;
      else ans++,right--;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <climits>

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> c(m);
  for (int i=0; i<m; i++) std::cin >> c[i];
  
  std::vector<int> table(n+1, INT_MAX);
  table[0] = 0;
  for (int i=1; i<=n; i++) {
    for (int j=0; j<m; j++) {
      if (i-c[j] >= 0 && table[i-c[j]]+1 < table[i]) {
        table[i] = table[i-c[j]] + 1;
      }
    }
  }
  std::cout << table[n] << std::endl;
}


Measured memory_bytes: 3152
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

w = l()

cnt = 0
w.sort()
if len(w) == 1:
	print("No")
else:
	for i in range(len(w) - 1 ):
		if w[i] == w[i+1]:
			cnt += 1
			if  cnt%2 == 0 and i == len(w) - 2:
				print("No")
				exit()
		elif w[i] != w[i+1]:
			if cnt%2 == 0:
				print("No")
				exit()
			cnt = 0
	print("Yes")

Measured memory_bytes: 9188
n = gets.to_i
sum = 0
s = Array.new
n.times do ||
    ss = gets.to_i
    s.push(ss)
    sum += ss
end
s.sort!

def calc(s,sum)
    if s.empty? || sum % 10 != 0
        return sum
    end
    array = Array.new
    s.each do |ss|
        array.push((sum-ss)%10==0?0:sum-ss)
    end
    if array.empty?
        s.each_with_index do |ss,index| 
            array.push(calc(index == 0 ? s[index+1..array.length-1] : s[0..index-1]+s[index+1..array.length-1],sum-ss))
        end
    end
    return array.max
end

puts calc(s,sum)

Measured memory_bytes: 3836
N, K = map(int, input().split())

P = 10**9+7

def modpow(a, p):
    if p==0:
        return 1
    else:
        if p%2==0:
            return (modpow(a, p//2)**2)%P
        else:
            return (a*modpow(a, p-1))%P
        
def comb(n, k):
    if n<k:
        return 0
    elif n==k or k==0:
        return 1
    else:
        mul = 1
        div = 1
        for i in range(1, min(k, n-k)+1):
            mul *= n-i+1
            div *= i
            mul %= P
            div %= P
        
    return mul*modpow(div, P-2)%P

for i in range(1, K+1):
    cnt = comb(N-K+1, i)*comb(K-1, i-1)
    print(cnt%P)

Measured memory_bytes: 3316
require 'prime'

n = gets.chomp.to_i

def divisor_list(i)
  return [1] if i == 1
  i.prime_division.map do |e|
    Array.new(e[1]+1).map.with_index do |element, i|
      e[0]**i
    end
  end.inject{|p,q| p.product(q)}.map do |a|
    [a].flatten.inject(&:*)
  end.sort
end

min = Float::INFINITY
divisor_list(n).each do |d|
  a = n / d
  min = [min, a + d - 2].min
end

puts min


Measured memory_bytes: 3708
from math import ceil

N = int(input())
res = N / 1.08

if res != 0:
    up = ceil(N / 1.08)
    down = int(N / 1.08)
    up2   = int(up * 1.08)
    down2 = int(down * 1.08)

    if down2 == N:
        print(down)
    elif up2 == N:
        print(up)

    else:
        print(":(")

else:
    print(res)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

int main(){
	
	int N;
	
	int a[500][5];
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < 3; j++){
			cin >> a[i][j];
		}
	}
	
	bool checker;
	
	int ans;
	
	for(int i = 0; i < N; i++){
		ans = 0;
		for(int j = 0; j < 3; j++){
			checker = true;
			for(int k = 0; k < N; k++){
				if(i == k){
					continue;
				}
				if(a[i][j] == a[k][j]){
					checker = false;
					break;
				}
			}
			if(checker){
				ans += a[i][j];
			}
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

int main(void)
{
  char o[51],e[51];
  int i=0;
  scanf("%s %s",o,e);
  while(o[i] != '\0')
    {
      if(e[i] != '\0')
	{
	  printf("%c%c",o[i],e[i]);
	}
      else
	{
	  printf("%c",o[i]);
	}
      i++;
    }
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    map<lint, int> a;
    for(int i = 0; i < N; i++){
        lint num;
        cin >> num;
        a[num]++;
    }
    if(a[0] == N){
        cout << "Yes" << endl;
        return 0;
    }else if(N % 3){
        cout << "No" << endl;
        return 0;
    }
    lint sum = 0;
    for(auto i: a){
        lint x = i.first;
        int cnt = i.second;
        if(cnt % (N / 3)){
            cout << "No" << endl;
            return 0;
        }
        for(int j = 0; j < cnt / (N / 3); j++){
            sum ^= x;
        }
    }
    Yes(!sum);
}


Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int  H = 0;
	int W = 0;
	cin >> H >> W;
	
	vector<string> mass(H);
	for (int i = 0; i < H; i++)
	{
		cin >> mass.at(i);
	}

	bool flag = true;
	for (int i = 0; i < H -1; i++)
	{
		for (int j = 0; j < W - 1; j++)
		{
			if (mass.at(i).at(j) == '.') { continue; }
			if(( i > 0 && mass.at(i -1).at(j) == '.') &&
				( j > 0  && mass.at(i).at(j-1) == '.') &&
				( i < H - 1 && mass.at(i + 1).at(j) == '.') &&
				( j < W - 1 && mass.at(i).at(j + 1) == '.') )
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using lint = long long;

int main() {
    lint N, M; std::cin >> N >> M;
    std::vector<std::string> A(N);
    std::vector<std::string> B(M);
    for (auto& r : A)std::cin >> r;
    for (auto& r : B)std::cin >> r;
    if (N == M) {
        bool flag = true;
        for (int i = 0; i < N; ++i) {
            if (A[i] != B[i])
                flag = false;
        }
        if (flag == true) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
        else {
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    for (int h = 0; h < N - M; ++h) {
        for (int w = 0; w < N - M; ++w) {
            bool flag = true;
            for (int j = 0; j < M; ++j) {
                if (A[h + j].substr(w, M) != B[j]) {
                    flag = false;
                    break;
                }
            }
            if (flag == true) {
                std::cout << "Yes" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "No" << std::endl;
}

Measured memory_bytes: 3632
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        double a = double.Parse(input[0]);
        double b = double.Parse(input[1]);
        double h = double.Parse(input[2]);
        double m = double.Parse(input[3]);
        Console.WriteLine(Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2)
                          - 2 * a * b * Math.Cos((h * 30 + m * 0.5 - m * 6) * Math.PI / 180)));
    }
}

Measured memory_bytes: 27860
#include <stdio.h>
#include <inttypes.h>

int main(void) {
	int L, N;
	char snake[128];
	int i;
	uint64_t asumi;
	uint64_t iguti = 0;
	if (scanf("%d%d", &L, &N) != 2) return 1;
	if (scanf("%127s", snake) != 1) return 1;
	asumi = L;
	for (i = 1; i < L; i++) {
		if (snake[i - 1] == 'o' && snake[i] == 'o') iguti++;
	}
	for (i = 0; i < N; i++) {
		asumi += 3 * iguti;
		iguti += iguti;
	}
	printf("%" PRIu64 "\n", asumi);
	return 0;
}



Measured memory_bytes: 2144