akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;
typedef long long ll;

int main(void) {
  char c;
  cin >> c;
  if (c > 'Z') {
    cout << 'a' << endl;
  } else {
    cout << 'A' << endl;
  }
  return 0;
}

Measured memory_bytes: 3620
void main(){
	int a, b;
	readf("%d %d\n", &a, &b);
	max(a+b, a-b, a*b).writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


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

int main()
{
	long long  a , b ;
	long long x ;
	scanf("%lld %lld %lld" ,&a,&b,&x);
	long long sum=0;
	sum+=(b/x) - ((a)/x);

    if(a%x == 0)
    ++sum;
    printf("%lld\n",sum);
}


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

typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n,m;
	cin>>n>>m;
	cout<<n*(n-1)/2+m*(m-1)/2<<'\n';
	
	return 0;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

 class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintStream so = System.out;
	public static void main(String[] args) throws InterruptedException {
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] s = new int[h+2][w+2];
		for (int i = 1; i <= h; i++) {
			String line = sc.next();
			for (int j = 1; j <= w; j++) {
				s[i][j] = line.charAt(j-1) == '.' ? 0 : -1;
			}
		}
		
		int[] mx = {1, 0, -1, 0, 1, 1, -1, -1};
		int[] my = {0, 1, 0, -1, -1, 1, -1, 1};
		
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (s[i][j] == -1) {
					for (int m = 0; m < 8; m++) {
						if (s[i+mx[m]][j+my[m]] != -1) {
							s[i+mx[m]][j+my[m]] += 1;
						}
					}
				}
			}
		}
		
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				so.print(s[i][j] == -1 ? "#" : s[i][j]);
			}
			so.println();
		}
	}
}


Measured memory_bytes: 21844
// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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


char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n, m; cin >> n >> m;
    vector<string> lis(n);
    mf_graph<int> g(n * m + 2);
    int s = n * m, t = n * m + 1;
    REP(i, 0, n){
        cin >> lis[i];
    }
    REP(i, 0, n){
        REP(l, 0, m){
            if(lis[i][l] == '.'){
                int v = i * m + l;
                if((i + l) % 2 == 0){
                    g.add_edge(s, v, 1);
                }else{
                    g.add_edge(v, t, 1);
                }
            }
        }
    }

    REP(i, 0, n){
        REP(l, 0, m){
            if((i + l) % 2  == 0 && lis[i][l] == '.'){
                int v = i * m + l;
                REP(k, 0, 4){
                    int x = i + dx[k], y = l + dy[k];
                    if(x >= 0 && x < n && y >= 0 && y < m && lis[x][y] == '.'){
                        g.add_edge(v, x * m + y, 1);
                    }
                }
            }
        }
    }

    cout << g.flow(s, t) << endl;

    auto edges = g.edges();
    for(auto e : edges){
        if(e.from == s || e.to == t || e.flow == 0) continue;
        int i0 = e.from / m, l0 = e.from % m;
        int i1 = e.to / m, l1 = e.to % m;
        if (i0 == i1 + 1) {
            lis[i1][l1] = 'v';
            lis[i0][l0] = '^';
        } else if (l0 == l1 + 1) {
            lis[i1][l1] = '>';
            lis[i0][l0] = '<';
        } else if (i0 == i1 - 1) {
            lis[i0][l0] = 'v';
            lis[i1][l1] = '^';
        } else {
            lis[i0][l0] = '>';
            lis[i1][l1] = '<';
        }
    }

    REP(i, 0, n){
        cout << lis[i] << endl;
    }
}

Measured memory_bytes: 5528
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FF first
#define SS second

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = 1e9;
int N;

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

  while(cin>>N,N){
	VI T(N);
	vector<pair<PII,int>> p1(N), p2;
	REP(i,N){
	  cin >> p1[i].FF.FF >> p1[i].FF.SS;
	  p1[i].SS = i;
	  T[i] = p1[i].FF.FF;
	}

	int ans = 0;
	while(!p1.empty() || !p2.empty()){
	  int mt = INF;
	  REP(i,SZ(p1)) mt = min(mt, p1[i].FF.FF);
	  REP(i,SZ(p2)) mt = min(mt, p2[i].FF.FF);

	  REP(i,SZ(p1)) p1[i].FF.FF -= mt;
	  REP(i,SZ(p2)) p2[i].FF.FF -= mt;
	  ans += mt;

	  int Mt = 0;
	  REP(i,SZ(p2)) Mt = max(Mt, p2[i].FF.FF);
	  REP(i,SZ(p1)){
		if(p1[i].FF.FF == 0){
		  int idx = p1[i].SS;
		  p2.PB(MP(MP(max(Mt,T[idx]), p1[i].FF.SS), idx));
		  p1.erase(p1.begin() + i);
		  --i;
		}
	  }

	  Mt = 0;
	  REP(i,SZ(p1)) Mt = max(Mt, p1[i].FF.FF);
	  REP(i,SZ(p2)){
		if(p2[i].FF.FF == 0){
		  if(p2[i].FF.SS > 1){
			int idx = p2[i].SS;
			p1.PB(MP(MP(max(Mt,T[idx]), p2[i].FF.SS-1), idx));
		  }
		  p2.erase(p2.begin() + i);
		  --i;
		}
	  }
	}
	cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;

int main(){

	int* checkTable = new int[300001];
	int* ansTable = new int[300002];
	int N,Q,tmp;

	for(int i = 1; i <= 300000; i++){
		checkTable[i] = -1;
		ansTable[i] = -1;
	}

	scanf("%d %d",&N,&Q);

	for(int i = 0; i < N; i++){
		scanf("%d",&tmp);
		checkTable[tmp] = tmp;
		ansTable[tmp+1] = tmp;
	}

	int tmp_max;

	for(int i = 1; i <= 300000; i++){
		if(checkTable[i] == -1){
			checkTable[i] = checkTable[i-1];
		}
	}

	ansTable[1] = 0;
	for(int i = 2; i <= 300000;i++){
		if(ansTable[i] == -1){
			tmp_max = 0;
			for(int k = i-1; k <= 300000; k += i){
				tmp_max = max(tmp_max,checkTable[k]%i);
				if(tmp_max == i-1)break;
			}
			ansTable[i] = tmp_max;
		}
	}

	int q;
	for(int i = 0; i < Q; i++){
		scanf("%d",&q);

		printf("%d\n",ansTable[q]);
	}
	return 0;
}

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


#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

char s[25];
int n;

bool ok(int a, int x){
  if(x<10)return a==1;
  if(x<100)return a==2;
  return a==3;
}

int main(){
  scanf("%s",s);
  n = strlen(s);
  int ans = 0;
  FOR(a,1,4)FOR(b,1,4)FOR(c,1,4)FOR(d,1,4){
    if(a+b+c+d!=n)continue;
    int it = 0;
    int x = 0;
    x=0;REP(i,a){x*=10;x+=s[it++]-'0';}
    if(!ok(a,x))continue;
    if(x>255)continue;

    x=0;REP(i,b){x*=10;x+=s[it++]-'0';}
    if(!ok(b,x))continue;
    if(x>255)continue;

    x=0;REP(i,c){x*=10;x+=s[it++]-'0';}
    if(!ok(c,x))continue;
    if(x>255)continue;

    x=0;REP(i,d){x*=10;x+=s[it++]-'0';}
    if(!ok(d,x))continue;
    if(x>255)continue;

    ans++;
  }
  printf("%d\n",ans);
  return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m;
void solve(){
	cin >> n >> m;
	
	int cnt = 0;
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= n; j++){
			if(m < i+j) break;
			if(m-(i+j) <= n) cnt++;
		}
	}
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
0 1 2
1 2 1
1 3 3

output:
5
"""

import sys
from math import isinf
from collections import deque


def generate_adj_table(v_table, init_adj_table):
    for each in v_table:
        source, target, cost = map(int, each)
        init_adj_table[source][target] = cost
        init_adj_table[target][source] = cost

    return init_adj_table


def graph_bfs(current, v_num, adj_table):
    queue = deque()
    distance = [float('inf')] * v_num
    distance[current] = 0
    queue.appendleft(current)

    while queue:
        current = queue.popleft()
        for adj, cost in adj_table[current].items():
            if isinf(distance[adj]):
                distance[adj] = distance[current] + cost
                queue.append(adj)
    return distance


def calc_tree_diameter(v_num, adj_table):
    # init x -> bridge vertex
    init_v = 0
    distance_1 = graph_bfs(init_v, v_num, adj_table)
    diameter, bridge_v = 0, 0
    for v, dis_1 in enumerate(distance_1):
        if isinf(dis_1):
            continue
        elif diameter < dis_1:
            diameter = dis_1
            bridge_v = v

    # bridge vertex -> y
    distance_2 = graph_bfs(bridge_v, v_num, adj_table)
    diameter = 0
    for dis_2 in distance_2:
        if isinf(dis_2):
            continue
        diameter = max(diameter, dis_2)

    return diameter


def solve():
    _input = sys.stdin.readlines()
    v_num = int(_input[0])
    edges = map(lambda x: x.split(), _input[1:])

    init_adj_table = tuple(dict() for _ in range(v_num))
    adj_table = generate_adj_table(edges, init_adj_table)
    ans = calc_tree_diameter(v_num, adj_table)
    print(ans)
    return None


if __name__ == '__main__':
    solve()

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

using namespace std;

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

  int c[n], s[n], f[n];
  for(int i = 1; i <= n - 1; i++) {
    cin >> c[i] >> s[i] >> f[i];
  }

  for(int i = 1; i <= n-1; i++) {
    int sec = 0;
    for(int j = i; j <= n-1; j++) {
      if(sec < s[j]) {
	sec = s[j];
      }
      if(sec % f[j] != 0) {
	sec += f[j] - (sec % f[j]);
      }
      sec += c[j];
    }
    cout << sec << endl;
  }
  cout << "0" << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        k: usize,
    }
    println!("{}", if k != 1 {n-(k-1) - 1} else {0});
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define mod 1000000007
#define lng long long
#define inf 0x7fffffff
using namespace std;

const double PI = 3.141592;

int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0);
int n;
cin >>n;
n = n << 1;
vector<lng int> vec(n, 0);
for(int i=0; i<n; i++){
lng int a;
cin >> a;
vec[i]=a;
}

sort(vec.begin(), vec.end());
lng int ans = 0;
for(int i=0; i<n; i+=2){
ans += min(vec[i], vec[i+1]);
}
cout << ans;
	return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

ll N, X;
vector<tuple<ll, ll, ll, ll>> s(100010);
vector<ll> S(100010, 0);
ll Asum = 0;

bool win(ll canUse){
	if(canUse >= X * N) return 1;
  int r = canUse % X, p = canUse / X;
  for(int i = 0; i < N; i++){
    ll score = 0;
		score += max(r * get<3>(s[i]) - get<1>(s[i]) * (get<3>(s[i]) - get<2>(s[i])), r * get<2>(s[i]));
		if(score >= Asum && p == 0) return 1;
		if(i+1 <= p){
			score += S[p+1] - (X * get<3>(s[i]) - get<1>(s[i]) * (get<3>(s[i]) - get<2>(s[i])));
		}else{
			score += S[p];
		}
		if(score >= Asum) return 1;
  }
  return 0;
}

int main(void){
	cin >> N >> X;
	s.resize(N);
	S.resize(N+1);
	for(int i = 0; i < N; i++){
		cin >> get<1>(s[i]) >> get<2>(s[i]) >> get<3>(s[i]);
		get<0>(s[i]) = X * get<3>(s[i]) - get<1>(s[i]) * (get<3>(s[i]) - get<2>(s[i]));
		Asum += get<1>(s[i]) * get<2>(s[i]);
	}
	sort(s.begin(), s.end());
	reverse(s.begin(), s.end());
	for(int i = 1; i <= N; i++){
    S[i] = S[i-1] + get<0>(s[i-1]);
  }
	ll ng = -1, ok = N * X + 1;
	ll mid;
	while(ok - ng > 1){
		mid = (ng + ok) / 2;
		if(win(mid)){
			ok = mid;
		}else{
			ng = mid;
		}
	}
	cout << ok << endl;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"
int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>x>>y>>z>>k;
	if(k%2)ans=y-x;
	else ans=x-y;
	cout<<ans;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    string s,t;cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    rep(i,s.size()){
        if(s[i]-'0'<t[i]-'0'){
            cout<<"Yes"<<endl;
            return 0;
        }else if(s[i]-'0'>t[i]-'0'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s.size()<t.size()){
        cout<<"Yes"<<endl;
        return 0;
    }else if(s.size()>t.size()){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


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

int main(){
  int d,m,n,L=143,ans;
  cin>>d;
  while(d--){
    cin>>m>>n;
    ans=0;
    for(int i=-L;i<L;i++)
      for(int j=-L;j<L;j++){
	if(!i&&!j)continue;
	int a=i*i+j*j;
	if(!((i*m+j*n)%a)&&!((i*n-j*m)%a))ans++;
      }
    if(ans==8)cout<<"P"<<endl;
    else cout<<"C"<<endl;
  }
  return 0;
}

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

int main(){
    ll N, M;
    cin>>N>>M;

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

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

    ll ans = 0;
    for(int i=0; i<N; i++){
        if(M>=v[i].second){
            ans += v[i].first*v[i].second;
            M -= v[i].second;
        }else{
            ans += v[i].first*M;
            M = 0;
        }
        if(M == 0){
            break;
        }
    }

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

Measured memory_bytes: 4752
;;(declaim (optimize (speed 0) (safety 3) (debug 3)))
#+sbcl (declaim (sb-ext:unmuffle-conditions sb-ext:compiler-note))
(declaim (optimize (speed 3) (safety 0) (debug 0)))

(declaim (type fixnum *times*))
(defvar *times* (read))

(defvar *h* (make-hash-table :test #'equal
			     :size 10000))

(declaim (type fixnum *count*)) ;; *count* <= *times* < 2e5
(defvar *count* 0)

(dotimes (i *times*)
  (let ((line (read-line)))
    (unless (gethash line *h*)
      (incf *count*)
      (setf (gethash line *h*) t))))

(princ *count*)


Measured memory_bytes: 85232
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;

int main (){
   int n ;
   cin >> n ;
   int noguti ;
   if (n >= 1000 && n % 1000 == 0){
       noguti = n / 1000;
   }else noguti = n / 1000 + 1;
   int change = (noguti*1000) - n;
   cout << change << endl;
   return 0;
}

Measured memory_bytes: 3156
import java.io.*;

public class Main {

  public static void main(String[] args) throws IOException {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] in = br.readLine().split(" ");
    int n = Integer.parseInt(in[0]);
    int h = Integer.parseInt(in[1]);
    int w = Integer.parseInt(in[2]);

    int[] a = new int[n], b = new int[n];
    for(int i = 0; i < n; i++){
      in = br.readLine().split(" ");
      a[i] = Integer.parseInt(in[0]);
      b[i] = Integer.parseInt(in[1]);
    }
    
    br.close();

    int ans = 0;
    for(int i = 0; i < n; i++){
      if(a[i] >= h && b[i] >= w) ans++;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 24148
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}

int main(){
	init();
	string s;
	cin>>s;
	set<char>set;
	for(int i=0;i<s.length();i++){
		set.insert(s[i]);
	}
	for(char i='a';i<='z';i++){
		if(set.find(i)==set.end()){
			cout<<(char)i<<endl;
			return 0;
		}
	}
	
	cout<<"None"<<endl;
}


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

const int MAXN = 1e5 + 10;

int n, m;
long long a[MAXN];

int main() {
  	cin >> n >> m;
  	for (int i = 0; i < m; i++) {
     	int u, v;
      	cin >> u >> v;
      	a[u]++;
      	a[v]++;
    }
  	for (int i = 1; i <= n; i++) 
    	if (a[i] % 2)
          return cout << "NO" << '\n', 0;
  	cout << "YES" << '\n';
 	return 0; 
}

Measured memory_bytes: 1024
n = gets.to_i
number_counts = {}
count = 0

n.times do
  num = gets.to_i
  if (number_counts[num]).nil? || number_counts[num] == 0
    number_counts[num] = 1
  else
    number_counts[num] = 0
  end
end

number_counts.each_value do |i|
  if i == 1
    count += 1
  end
end

puts count

Measured memory_bytes: 8572
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val s = sc.next()

        for (i in 0 until 8) {
            var ss = s[0] - '0'
            val op1 = if (i and 1 > 0) '+' else '-'
            val op2 = if (i and 2 > 0) '+' else '-'
            val op3 = if (i and 4 > 0) '+' else '-'
            ss += (s[1] - '0') * (if (i and 1 > 0) 1 else -1)
            ss += (s[2] - '0') * (if (i and 2 > 0) 1 else -1)
            ss += (s[3] - '0') * (if (i and 4 > 0) 1 else -1)
            if (ss == 7) {
                println("${s[0]}$op1${s[1]}$op2${s[2]}$op3${s[3]}=7")
                return
            }
        }
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 38088
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)
vll yakusu(ll x){
    vll ret;
    for(ll i=1;i*i<=x;i++){
        if(x%i==0)
                ret.push_back(i);
    }
    return ret;
}
long long INF = 1LL<<60;
int main( ){
    ll x;
    cin>>x;
    rep(a,0,1000){
        rep(b,-1000,1000){
            if(llpow(a,5)-llpow(b,5)==x){
                cout<<a<<" "<<b<<endl;
                return 0;
            }
        }
    }
    return 0;
}




Measured memory_bytes: 3612
N=input()
A=list(map(int,input().split()))
s=1
t=0
if 0 in A:
  print(0)
else:
  for x in A:
    s *= x
    if s>10**18:
      t += 1
      print(-1)
      break
  if t==0:
    print(s)

Measured memory_bytes: 21712
#include <bits/stdc++.h> 
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    rep(i,n)cin>>p[i];
    int cnt=0;
    rep(i,n-2){
        if(p[i]<p[i+1]&&p[i+1]<p[i+2])cnt++;
        if(p[i]>p[i+1]&&p[i+1]>p[i+2])cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
	int ts[50]={0};
	int a,b,c,d,j;
	cin>>a>>b;
	for(int i=0;i<b;i++){
		cin>>c>>d;
		ts[c-1]=ts[c-1]+1;
		ts[d-1]=ts[d-1]+1;
	}
	for(j=0;j<a;j++){
		cout<<ts[j]<<endl;
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
const int MAXN=55;
int n,a,sum,dat[MAXN];
ll dp[MAXN][MAXN][MAXN*MAXN],res=0;

int main()
{
	scanf("%d%d",&n,&a);
	for(int i=1;i<=n;i++) scanf("%d",&dat[i]);
	
	dp[1][1][dat[1]]=1;sum=dat[1]+dat[2];
	for(int i=1;i<=n;i++) dp[i][0][0]=1;
	for(int i=2;i<=n;i++,sum+=dat[i])
		for(int j=1;j<=i;j++)
			for(int k=1;k<=sum;k++)
			{
				dp[i][j][k]=dp[i-1][j][k];
				if(k>=dat[i]) dp[i][j][k]+=dp[i-1][j-1][k-dat[i]];
			}
	
	for(int i=1;i<=n;i++) res+=dp[n][i][i*a];
	printf("%lld",res);
	return 0;
}

Measured memory_bytes: 65792
using System;
using System.Collections.Generic;

class Program{
    public static void Main(){
        var n=int.Parse(Console.ReadLine());
        var nodes=new bool[n, n];
        var distances=new int[n];
        for (var i=0; i<n; i++) {
            var s=Console.ReadLine().Split(' ');
            var id=int.Parse(s[0]);
            var k=int.Parse(s[1]);
            for (var j=0; j<k; j++) {
                nodes[id-1, int.Parse(s[j+2])-1]=true;
            }
            distances[id-1]=-1;
        }

        var queue=new Queue<int>();
        queue.Enqueue(0);
        distances[0]=0;
        while(queue.Count!=0){
            var id=queue.Dequeue();
            for (var i=0; i<n; i++) {
                if (nodes[id, i] && distances[i]==-1) {
                    distances[i]=distances[id]+1;
                    queue.Enqueue(i);
                }
            }
        }

        for (var i=0; i<n; i++) {
            Console.WriteLine((i+1)+" "+distances[i]);
        }
    }
}

Measured memory_bytes: 10172
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int a, b;
    char op;
    std::cin>>a>>op>>b;

    std::cout<<(op == '+' ? a + b : a - b)<<std::endl;
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int d[N];
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }
    int sum;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,i,j,mat[110][110];
int main()
{
    cin>>n;
    if(n<=2)
    {
        cout<<-1;
        return 0;
    }
    for(i=1;i<n;i++)
        mat[1][i]=i+1;
    for(i=n;i>2;i--)
        for(j=1;j<=i;j++)
            mat[i][j]=j;
    for(i=3;i<n;i++)
        mat[i][i]=n;
    mat[2][1]=n;
    mat[2][2]=1;
    for(i=1;i<=n;i++)
        for(j=1;j<n;j++)
            if(mat[i][j]==0)
                mat[i][j]=j;
    for(i=2;i<n;i++)
        mat[n][i]=i+1;
    mat[n][n-1]=2;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<n;j++)
            cout<<mat[i][j]<<" ";
        cout<<'\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h> 
#include <string.h> 	
  
int main(){ 
    char text[1008];
    char string[1008];
    
    scanf("%s", &text); 
    scanf("%s", &string); 
	
	long int length1 = strlen(string),j; 
    long int length2 = strlen(text); 
  
    for (long int i=0; i<=length2-length1; i++){ 
        for (j=0; j<strlen(string) ; j++)
        	if (text[i + j]!=string[j]){
                break; 
            }
  
            if (j==strlen(string)){
        	    printf("%ld\n", i); 
		    } 
	}
    return 0; 
} 


Measured memory_bytes: 2148
import sys
from collections import deque
from bisect import bisect_left

def main():
    input = sys.stdin.readline
    N = int(input())
    a = int(input())
    q = deque()
    q.append(a)
    ans = 1
    for _ in range(N-1):
        n = int(input())
        if n <= q[0]:
            q.appendleft(n)
            ans += 1
            continue

        if n > q[-1]:
            q[-1] = n
            continue

        pos = bisect_left(q, n)
        q[pos-1] = n
        min_ = q[0]

    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 7276
import sys
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    n, k, q = map(int, input().split())
    a = [int(input()) for _ in range(q)]
    cnt = Counter(a)
    for i in range(1, n + 1):
        print("Yes" if q - cnt[i] < k else "No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 16752
#include <bits/stdc++.h>
using namespace std;
string s;
int solve(){
  int sum = 0;
  for(int i=0 ; i+1<s.size() ; i++){
    if(s[i]==s[i+1]){
      if(s[i]=='0'){
        s[i+1] = '1';
      }else{
        s[i+1] = '0';
      }
      sum++;
    }
  }
  return sum;
}
int main(){
  cin >> s;
  cout << solve() << endl;
  return 0;

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int main()
{
  double a;
  cin >> a;
  cout << setprecision(20) << (a/3)*(a/3)*(a/3) << endl;
  
}


Measured memory_bytes: 256
using System;

class Program
{
  static void Main(string[] args)
  {
    var inputs = Console.ReadLine().Split(' ');
    int[] a = new int[3];

    for (int i = 0; i < a.Length; i++)
      a[i] = int.Parse(inputs[i]);

    Console.WriteLine((a[0] + a[1] + a[2]) >= 22 ? "bust" : "win");
  }
}

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

int main(){

    int a,b;
    cin >> a >> b;
    int sum = 0;
    for (int i = a; i < b + 1; i++){
        int c_1 = i / 10000;
        int c_2 = (i % 10000) / 1000;
        int c_3 = (i % 100) / 10;
        int c_4 = i % 10;
        if (c_1 == c_4 && c_2 == c_3){
            sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <math.h>

#define SQ(x) ((x) * (x))

int main(void)
{
	int s;
	int i;
	double x1, x2, x3;
	double y1, y2, y3;
	double a, b, c, d, e, f;
	double l, m, n;
	
	scanf("%d", &s);
	for (i = 0; i < s; i++){
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		
		a = (x1 - x2);
		b = (y1 - y2);
		c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
		d = (x1 - x3);
		e = (y1 - y3);
		f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));
		
		l = (c * e - b * f) / (e * a - b * d);
		m = (d * c - a * f) / (d * b - e * a);
		
		n = -1 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);
		
		printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, sqrt(SQ(l) + SQ(m) - 4 * n) / 2.0);
	}
	
	return (0);
}

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

int main() {
  int N, M, A, B, Sum=0;
  cin >> N >> M;
  vector<long long> H(N);
  vector<int> T(N,0);
  rep(i, N) cin >> H.at(i);
  rep(i, M){
    cin >> A >> B;
    if(H.at(A-1)>=H.at(B-1)) T.at(B-1)++;
    if(H.at(A-1)<=H.at(B-1)) T.at(A-1)++;
  }
  rep(i, N) if(T.at(i)==0) Sum++;
  cout << Sum << endl;
}

Measured memory_bytes: 4580
#include <iostream>
#include <iomanip>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <cstdint>

using namespace std;

typedef long long signed int ll;

ll n, a, b, v[50];

constexpr int bts = 8;
class int256 {
private:
public:
	int32_t d[bts];
	int256(int32_t n) {
		for (int i = 0; i < bts; i++) d[i] = 0;
		d[0] = n;
	}
	int256 operator+(int256 e) {
		int256 r(0);
		for (int i = 0; i < bts; i++) {
			int64_t j = d[i], k = e.d[i];
			if (r.d[i] + j + k > INT32_MAX) {
				r.d[i] += (j + k - INT32_MAX);
				if (i + 1 < bts) r.d[i + 1]++;
			}
			else r.d[i] += j + k;
		}
		return r;
	}
	int256 operator*(int256 e) {
		int256 r(0);
		for (int i = 0; i < bts; i++) for (int j = 0; j < bts; j++) {
			int256 p(0);
			int64_t s = d[i], t = e.d[j];
			int64_t u = s * t;
			if(i + j < bts) p.d[i + j] = u % INT32_MAX;
			if(i + j + 1 < bts) p.d[i + j + 1] = u / INT32_MAX;
			r = r + p;
		}
		return r;
	}
	int64_t to64() {
		int64_t r = d[1];
		r *= INT32_MAX;
		r += d[0];
		return r;
	}
};

int256 fac(long n) {
	int256 r(1);
	for (long i = 1; i <= n; i++) {
		r = (r * int256(i));
	}
	return r;
}
/*
ll comb(ll a, ll b) {
	return fac(a) / (fac(b) * fac(a - b));
}
*/

ll comb(ll a, ll b) {
	if (b == 0) return 1;
	return (comb(a - 1, b - 1) * a) / b;
}

int main() {
	cin >> n >> a >> b;
	for (ll i = 0; i < n; i++) cin >> v[i];
	sort(v, v + n,greater<ll>());
	ll sum = 0;
	for (ll i = 0; i < a; i++) sum += v[i];
	cout << setprecision(20) <<(double)sum / a << endl;
	if (b > a && v[a] * a == sum) {
		ll ci = 0, cj = a;
		while (cj < n && v[cj] == v[a - 1]) cj++;
		while (v[ci] != v[a - 1]) ci++;
		ll r = 0;
		for (ll i = a; i <= min(b, cj); i++)
			r += comb(cj - ci, i - ci);
		cout << r << endl;
	}
	else if (b > a && v[a] == v[a-1]) {
		ll ci = 0, cj = a;
		while (cj < n && v[cj] == v[a - 1]) cj++;
		while (v[ci] != v[a - 1]) ci++;
		ll r = 0; 
		r += comb(cj - ci, a - ci);
		cout << r << endl;
	}
	else cout << 1 << endl;
}

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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

int K;
double R, L, p, e, t;

double dfs(double r, double l, int k) {
  // [l, r] ??? [t-e, t+e] ?????????????????????????????°
  if(l < t - e || r > t + e) return 0;
  // K??????
  if(k == K) {
    // ???????????????e??\?????????ok
    if(abs((r+l)/2 - t) <= e) return 1;
    else return 0;
  }
  // [l, r]???[t-e, t+e]???????????????????????£????????°
  if(l <= t+e && t-e <= r) return 1;
  double ret;
  if((l+r)/2 >= t) ret = (1-p) * dfs(r, (r+l)/2, k+1) + p * dfs((r+l)/2, l, k+1);
  else ret = p * dfs(r, (r+l)/2, k+1) + (1-p) * dfs((l+r)/2, l, k+1);

  return ret;
}

signed main(void)
{
  cin >> K >> R >> L >> p >> e >> t;
  cout << fixed << setprecision(9) << dfs(R, L, 0) << endl;

  return 0;
}

Measured memory_bytes: 3276
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

typedef string::const_iterator State;
string s;

int factor(State&);
int number(State& begin) {
    int ret = 0;

    while (isdigit(*begin)) {
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }
    //cout << *begin << endl;
    //cout << ret << endl;
    return ret;
}
int expression(State& begin) {
    //cout << *begin << endl;
    vector<int> v;
    if(*begin != ']') v.push_back(factor(begin));

    for (;begin != s.end();) {
        if (*begin != ']') v.push_back(factor(begin));
        else break;
    }
    sort(v.begin(), v.end());
    int ret = 0;
    for (ll i = 0; i < (v.size() + 1) / 2; i++) {
        //cout << v[i] << endl;
        ret += v[i];
    }
    return ret;
}

int factor(State& begin) {
    //cout << *begin << endl;
    if (*begin == '[') {
        begin++; // '('を飛ばす。
        int ret = expression(begin);
        begin++; // ')'を飛ばす。
        return ret;
    }
    else {
        return (number(begin) + 1) / 2;
    }
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
    int N; scanf("%d", &N);
    while (N--) {
        cin >> s;
        State begin = s.begin();
        cout << expression(begin) << "\n";
    }
	return 0;
}


Measured memory_bytes: 3272
from collections import Counter
N=int(input())
ll=[]
for i in range(N):
    ll.append(input())
c=Counter(ll)
print("AC x {}".format(c['AC']))
print("WA x {}".format(c['WA']))
print("TLE x {}".format(c['TLE']))
print("RE x {}".format(c['RE']))

Measured memory_bytes: 16608
main :: IO ()
main = do
    [n,m,c] <- map read . words <$> getLine :: IO [Int]
    b <- map read . words <$> getLine :: IO [Int]
    a <- map (map read . words) . lines <$> getContents :: IO [[Int]]
    let a' = map ((+c) . sum . zipWith (*) b) a
    print . length $ filter (0<) a'

Measured memory_bytes: 1020
#include <iostream>

using namespace std;

int main( void ){
  string a, b;
	int x;
	bool flag  = false;
	
	cin >> a >> b;

	x = stoi( a + b );

	for( int i = 0; i <= 1000; i++){
		if( x == i * i ){
			flag = true;
		}
	}

	if( flag == true ){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}



	

Measured memory_bytes: 256
#include <stdio.h>
int main (void){
   
	int a,b;

	scanf("%d %d",&a,&b);
	
	if(a<b)
	{
		printf("a < b\n");
	}
	if(a>b)
	{
		printf("a > b\n");
	}
	if(a==b)
	{
		printf("a == b\n");
	}

	
	 
     return 0;
}

Measured memory_bytes: 580
import  itertools as it

N,*A = map(int,open(0).read().split())

cnt = 0
for Z in it.product(range(3),repeat=N):
  t = 1
  for z,a in zip(Z,A):
    t*=(a+z-1)
  if t%2 == 0:
    cnt+=1
print(cnt)

Measured memory_bytes: 9140
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int K, X;
    cin >> K >> X;
    int l = max(-1000000, X - K + 1);
    int r = min( 1000000, X + K - 1);
    for (int i = l; i <= r; i++){
        cout << i;
        if (i != r){
            cout << " ";
        }
    }
    cout << endl;
}


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

ll gcd(ll C, ll D) {
    ll R = C % D;
    while (R > 0) {
        C = D;
        D = R;
        R = C % D;
    }
    return D;
}

ll lcm(ll C, ll D) {
    return C*D/gcd(C, D);
}

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    A = A - 1;
    ll AC = A/C;
    ll BC = B/C;
    ll AD = A/D;
    ll BD = B/D;
    ll ACD = A/lcm(C, D);
    ll BCD = B/lcm(C, D);
    cout << B - (BC + BD - BCD) - (A - (AC + AD - ACD)) << endl;
    return 0;
}

Measured memory_bytes: 256
while 1:
    n=int(input())
    if n==-1:break
    w=1150
    if n>30:
        w+=(n-30)*160
        n-=n-30
    if n>20:
        w+=(n-20)*140
        n-=n-20
    if n>10:
        w+=(n-10)*125
    print(4280-w)

Measured memory_bytes: 7672
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int n;
    double m;
    while(cin>>n>>m){
            int a[n];
            double sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        double x=a[i];
        sum=sum+x;
    }
    double q=(sum/(4*m));
    q=ceil(q);
    int ck=0;
    for(int i=0;i<n;i++){
        int x=a[i];
        if(x>=q){
            ck++;
        }
            if(ck>=m){
             cout<<"Yes";
             break;
            }
    }
    if(ck<m){
        cout<<"No";
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;

void ansYes(bool flag) {
    if (flag) cout << "Yes" << endl; else cout << "No" << endl;
}

void ansYES(bool flag) {
    if (flag) cout << "YES" << endl; else cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

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

struct datas {
    Int max;
    Int size;
};

class ContainChecker {
protected:
    Int minx, miny, maxx, maxy;
public:
    ContainChecker(Int minx, Int miny, Int maxx, Int maxy) : minx(minx), miny(miny), maxx(maxx), maxy(maxy) {};

    bool in(Int x, Int y) {
        return (minx <= x && miny <= y && x <= maxx && y <= maxy);
    }
};


int main(void) {
    while (1){
        Int n,m,p;
        cin >> n >> m >> p;
        if (n == 0) break;
        vector<Int> a(n);
        double sum = 0;
        REP(n,i){
           cin >> a.at(i);
           sum += a.at(i) * 100;
        }
        sum = sum / 100 * (100-p);
        m--;
        if (a.at(m) == 0) {
            cout << 0 << endl;
        }else {
            cout << floor(sum / a.at(m)) << endl;
        }
    }
}





Measured memory_bytes: 3204
N = int(input())
sum0 = 0

p1 = N // 2
p2 = N % 2

if(p2==1):
    sum0 = (N + 1) * p1 + (p1 + 1)

else:
    sum0 = (N + 1) * p1

Fizz = N // 3
Buzz = N // 5
FizzBuzz = N // 15

sum1 = 0
sum2 = 0
sum3 = 0

if(Fizz != 0):
    for i in range(Fizz):
        sum1 += 3 * (i + 1)
    

if(Buzz != 0):
    for j in range(Buzz):
        sum2 += 5 * (j + 1)
    

if(FizzBuzz != 0):
    for k in range(FizzBuzz):
        sum3 += 15 * (k + 1)
    

ans = sum0 + sum3 - (sum1 + sum2)

print(ans)


Measured memory_bytes: 9212