akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
	ll x;
	cin>>x;
	cout<<360/__gcd(x, 360ll)<<endl;
}

Measured memory_bytes: 3624
#include<stdio.h>
int main()
{

	long long a,i,n,f,min;
	scanf("%lld",&n);
for(i=1;i<=n;i++)
	{
	scanf("%lld",&a);
f=0;
while(a)
{
	if(a%2==0)
	f++;
			else break;
			a=a/2;

}
if(i==1)
min=f;
else if(min>f)
min=f;


}
printf("%lld",min);
	return 0;
}

Measured memory_bytes: 128
import heapq
n , m = map(int,input().split())
kouho = [[] for i in range(m)]
for i in range(n):
    a , b = map(int,input().split())
    if a <= m:
        kouho[a-1].append(-b)
ans = 0
p = []
heapq.heapify(p)

for i in range(m):

    for j in kouho[i]:
        heapq.heappush(p,j)
    if p:
        ans -= heapq.heappop(p)
print(ans)

Measured memory_bytes: 21964
n = int(input())
s = input().split() #s_1 s_2を分割して取得し、sに値を入れる

min = 1000000000000
s = [int(t) for t in s]
for i in range(n):
    s1 = 0
    s2 = 0
    for j in range(i):
        s1 = s1 + s[j]
    for k in range(i,n):
        s2 = s2 + s[k]
    if abs(s1-s2) < min:
        min = abs(s1-s2)
print(min)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

int main() {
	string S;
	cin >> S;
	int m = S.sz;
	FOR (i, S.sz) {
		int j = 0;
		int cc = 0;
		int currm = 0;
		while (j < S.sz) {
			if (S[j] == S[i])
				cc = 0;
			else
				cc++;
			currm = max(currm, cc);
			j++;
		}
		m = min(m, currm);
	}
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int line[15];

void init() {
    for (int i = 0; i < 14; i++) {
        line[i] = i+1;
    }
    line[14] = 0;
}

int main() {
    init();
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        int s, g; cin >> s >> g;
        vector<int> path;
        int as = s;
        int ag = g;
        if (1 <= s && s <= 5) as = 15 - s;
        if (1 <= g && g <= 5) ag = 15 - g;

        int c = s;
        while (c != g && c != ag) {
            path.push_back(c);
            c = line[c];
        }
        path.push_back(g);

        if (as != s) {
            vector<int> opath;
            c = as;
            while (c != g && c != ag) {
                opath.push_back(c);
                c = line[c];
            }
            opath.push_back(g);
            if (path.size() > opath.size()) {
                path.resize(opath.size());
                copy(opath.begin(), opath.end(), path.begin());
            }
        }

        if (path[0] >= 10) {
            cout << 15 - path[0];
        } else {
            cout << path[0];
        }
        for (int j = 1; j < path.size(); j++) {
            if (path[j] >= 10) {
                cout << ' ' << 15 - path[j];
            } else {
                cout << ' ' << path[j];
            }   
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 0
// Author : Rifayat Samee (Sanzee)
// Problem :
// Algorithm:

/*
*/

#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	while(b>0){
		a = a%b;
		a^=b;b^=a;a^=b;
	}
	return a;
}

int main(){
	int A[100005];
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	int mx,g = A[0];
	mx = A[0];
	for(int i=0;i<n;i++){
		g = gcd(g,A[i]);
		mx = max(mx,A[i]);
	}
	if(k%g==0 && k<=mx){
		printf("POSSIBLE\n");
	}
	else{
		printf("IMPOSSIBLE\n");
	}

}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CModuloSummation solver = new CModuloSummation();
        solver.solve(1, in, out);
        out.close();
    }

    static class CModuloSummation {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long ans = -n;
            for (int i = 0; i < n; i++) {
                ans += in.nextInt();
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 25648
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int> v(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;

		v.at(a - 1)++;
		v.at(b - 1)++;
	}

	for (int i = 0; i < N; i++) {
		cout << v.at(i) << endl;
	}
}

Measured memory_bytes: 3604
N = int(input())
l = [ int(x) for x in input().split()]


def oddProblem(l):
    count = 0
    for i in range(N):
        if (l[i] % 2 != 0 and (i+1) % 2 != 0):
            count += 1
    return count

print(oddProblem(l))

Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,k;cin>>a>>b>>k;
  ll ak=a-k;
  if(ak>=0)cout<<ak<<" "<<b<<endl;
  else if(b+ak>0)cout<<0<<" "<<b+ak<<endl;
  else cout<<0<<" "<<0<<endl;
  return 0;
}

Measured memory_bytes: 256
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)*}
    };
}
 
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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }
 
// https://practice.contest.atcoder.jp/tasks/practice_1

use std::cmp;

fn main() {
    input!{
        s: chars,
    }
    let size = s.len();
    let mut ret = 999;
    for (i, _) in s.iter().enumerate() { 
        if i >= size-2 {
            break;
        } else {
            let mut triplet = String::from("");
            for c in s[i..i+3].iter() {
                triplet.push_str(&c.to_string()); 
            }
            //let triplet :String = s[i..i+3].into_iter().collect::<String>();
            let triplet_i :i32 = triplet.parse().unwrap();
            ret = cmp::min(ret, (triplet_i-753).abs());
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  int rousoku[n] = {};

  for(int i = 0; i < n; i++){
    cin >> rousoku[i];
  }

  long long ans = 1e10;

  //連続したろうそくを選択する方法がベスト
  for(int i = 0; i < n - k+1; i++){
    //右から辿る方と左から辿る方
    long long l,r = 0;
    l = abs(rousoku[i]) + abs(rousoku[i] - rousoku[i+k-1]);
    r = abs(rousoku[i+k-1]) + abs(rousoku[i] - rousoku[i+k-1]);
    long long temp = min(l, r);
    ans = min(temp, ans);

  }

  cout << ans << endl;

}


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

int main() {
  int N;
  cin >> N;
  int sum = 0;
  vector<bool> num(1);
  for (int i = 1; sum < N; i++) {
    sum += i;
    num.push_back(true);
  }
  num[sum - N] = false;
  for (int i = 1; i < num.size(); i++) if (num[i]) cout << i << endl;
}

Measured memory_bytes: 256
from collections import deque
import sys
readline = sys.stdin.readline
write= sys.stdout.write

N = int(readline())
s0 = map(int, readline().split())
s1 = map(int, readline().split())
st0 = []; st1 = []
que = deque()
q = next(s1, None)
j = -1
ans = []
for v in s0:
    while st1 and st1[-1] != j:
        ans.append(st1.pop())
    st1.append(v)

    st0.append(v)
    j = v
    while st0 and st0[-1] == q:
        j = st0.pop()
        q = next(s1, None)
while st1:
    ans.append(st1.pop())
print(*ans)




Measured memory_bytes: 6004
#include <stdio.h>

int max(int a, int b){
	return a>b?a:b;
}

int min(int a, int b){
	return a<b?a:b;
}

int main(){
	
	int n;
	scanf("%d",&n);
	int i,r,minv=2000000000,maxv=-1000000000;
	for(i=0;i<n;i++){
		scanf("%d",&r);
		maxv = max(maxv, r-minv);
		minv = min(minv, r);		
    }

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

Measured memory_bytes: 1856
#include <iostream>

using namespace std;

int main(void){
	long long p=1;
	int i,tmp,N;

	cin>>N;

	for(i=1;i<=N;i++){
		tmp = int(i % (1000000007) );
		p=(p*tmp)%1000000007;
	}
	cout<<p<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multiprecision/cpp_int.hpp>
#define lint long long

using namespace std;
using boost::multiprecision::cpp_int;

int main() {
	string s;
	cin >> s;
	int length = s.length();
	cpp_int allsum = 0;
	for (int bit = 0; bit < (1 << (length - 1)); bit++) {
		cpp_int sum = 0;
		string before = { s[0] };
		for (int i = 0; i < length - 1; i++) {
			if (bit & (1 << i)) {
				cpp_int x;
				x.assign(before);
				sum += x;
				before = "";
			} 
			before.push_back(s[i + 1]);
		}
		cpp_int y;
		y.assign(before);
		sum += y;
		allsum += sum;
	}
	cout << allsum << endl;
}

Measured memory_bytes: 256
from collections import deque
N = int(input())
A = deque(map(int, input().split()))
mod = 10**9 + 7
M = len(bin(max(A))) - 2
ans = 0
bitlist = [1]
anslist = [0 for _ in range(M)]
for k in range(M):
    bitlist.append(bitlist[-1]*2%mod)
counter = [0 for _ in range(M)]

for k in range(N):
    a = A.pop()
    c = 0
    while a:
        b = a & 1
        if b == 0:
            anslist[c] += counter[-c-1]
        else:
            anslist[c] += k - counter[-c-1]
            counter[-c-1] += 1
        c += 1
        a >>= 1
    while c < M:
        anslist[c] += counter[-c-1]
        c += 1
for k in range(M):
    ans += anslist[k]*bitlist[k]%mod
    ans %= mod
print(ans)


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

int main()
{
    int count, a;
    count = 1;
    while (cin >> a)
    {
        if (a > 0) {
            cout << "Case " << count << ": " << a << endl;
            count++;
            if (count > 10000) {
                break;
            }
        }
    }
    
    
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b)
{
    ll r = a % b;
    if (r == 0)
    {
        return b;
    }
    return gcd(b, r);
}

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

int main()
{
    ll a1, m1, a2, m2, a3, m3;
    while (cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3, a1)
    {
        ll c1, c2, c3;
        ll sum = 1;
        for (int i = 1; i < m1; i++)
        {
            sum = (sum * a1) % m1;
            if (sum == 1)
            {
                c1 = i;
                break;
            }
        }
        sum = 1;
        for (int i = 1; i < m2; i++)
        {
            sum = (sum * a2) % m2;
            if (sum == 1)
            {
                c2 = i;
                break;
            }
        }
        sum = 1;
        for (int i = 1; i < m3; i++)
        {
            sum = (sum * a3) % m3;
            if (sum == 1)
            {
                c3 = i;
                break;
            }
        }
        OP(lcm(lcm(c1, c2), c3));
    }

    return 0;
}


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


int main() {
  long N, K;
  cin >> N >> K;
  
  if (K%2==1){
  	cout << (N/K)*(N/K)*(N/K) << endl;
  }
  
  else{
    cout << (N/(K))*(N/(K))*(N/(K))+((N+K/2)/K)*((N+K/2)/K)*((N+K/2)/K) << endl;
  }
}


Measured memory_bytes: 256
from collections import deque

N = int(input())
routings = [[] for _ in range(N+1)]
colors = [0 for _ in range(N+1)]
vertexes = [tuple(map(int, input().split())) for _ in range(N-1)]

for a, b in vertexes:
  routings[a].append(b)
  routings[b].append(a)
  
edges = deque([1])
colors[1] = 0
answer = 0
while len(edges) > 0:
  edge = edges.pop()
  color = colors[edge]
  nc = 1
  answer = max(answer, len(routings[edge]))
  for ne in routings[edge]:
    if colors[ne] == 0 and ne != 1:
      if nc == color:
        nc += 1
      colors[ne] = nc
      edges.append(ne)
      nc += 1
print(answer)
for a, b in vertexes:
  print(colors[b])


Measured memory_bytes: 103868
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define mod 1000000007
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
#define google cout << "Case #" << ++it << ": " << ans << endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll it = 0, ans = 0;

ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (auto i=2; i<MAXN; i++)
  		spf[i] = i;
  	for (auto i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (auto i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (auto j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
	return;
}

vl getFactorization(ll x)
{
    vl ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}


void check()
{
	ll n;
	cin >> n;
	vl a(n), b(n);
	for(int i=0;i<n;i++) cin >> a[i] >> b[i];
	for(int i=0;i<n;i++) {
		ll cnt = 0;
		for(int j=i;j<i+3 and j<n;j++) {
			if(a[j]==b[j]) {
				cnt++;
			}
		}
		if(cnt==3) {
			cy;
			return;
		}
	}
	cn;
    return ;
}

int32_t main()
{
    fastio
    ll t = 1;
    // cin >> t;
    while(t--)
        check();
    return 0;
}


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

 using namespace std ;


const int N = 150000;

int  n,k,m,ans=1e6+2,x,t[N],a[N];
map <int , int > mp ;



int main(){
    cin>>n ;
    for (int i = 0  ; i<n ; i ++)
        cin>>t[i];
    int ans = 0 ;
    int x=0 ;
    for (int i = 0 ; i<n-1  ; i ++)
    {

        if (t[i]<t[i+1])
        {
            ans= max (x,ans);
            x=0 ;
        }
        else if (t[i]>=t[i+1])
            x++;
    }
    ans= max (x,ans);
    cout<<ans  ;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int i,a[10000],n;
int main() {
  cin>>n;
  for (int i=0;i<n;i++){
    cin>>a[i];
  }
  
  for (int i=0;i<n;i++){
    if (a[i]%2==0 && (a[i]%5!=0 && a[i]%3!=0)) {
      cout<<"DENIED";
      return 0;
    }
    }  
    cout<<"APPROVED";
    return 0;
  
}

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

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];
  ll ans = 0;
  int ma = a[0];

  for(int i = 1;i < n;++i){
    if(ma > a[i]){
      ans += ma - a[i];
    }
    chmax(ma,a[i]);
  }
  
  print(ans);

  return 0;
}

Measured memory_bytes: 4012
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      Set<String> said = new HashSet<>();
      
      char prevChar = '0';
      for(int i = 0; i < n; i++) {
        String word = sc.next();
        if(said.contains(word) || i > 0 && prevChar != word.charAt(0)) {
          System.out.println("No");
          return;
        }
        said.add(word);
        prevChar = word.charAt(word.length() - 1);
      }
      System.out.println("Yes");
  }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n;
	string s;
	cin>>n>>s;
	for(int i=0;i<s.size();i++){
		int x=s[i]-'A';
		x=(x+n)%26;
		s[i]='A'+x;
	}
	cout<<s<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define debug freopen("1.in","r",stdin),freopen("1.out","w",stdout);
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 10;

int n, k, q, score[maxn], test;
int main(){
    ios;
    cin >> n >> k >> q;
    for (int i = 1; i <= n; i ++)
        score[i] = k;
    for (int i = 1; i <= q; i ++){
        cin >> test;
        score[test] ++;
    }
    for (int i = 1; i <= n; i ++)
        if (score[i] > q)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1024
/**
*   @Author : MeGA
*   @InitTime :01/20/20 21:23:11
*   @Idea : 
*
*
*
*
*
*
*
**/
#include <bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
  // freopen("in","r",stdin);
  // freopen("out","w",stdout);
#endif
       long long n;
       cin>>n;
       cout<<n*(n+1)/2 - n<<endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int Digit(int x) {
  int counter=0;
  while(x>0) {
    x/=10;
    counter++;
  }
  return counter;
}

int main() {
  int N,M;
  scanf("%d%d",&N,&M);
  vector<pii> sc;
  rep(i,M) {
    int s,c;
    cin>>s>>c;
    sc.pb(make_pair(s,c));
  }
  int S;
  bool ok=true;
  for(auto p : sc) {
    for(auto q : sc) {
      if(p.fi==q.fi&&p.se!=q.se) ok=false;
      else if(p.fi>N) ok=false;
    }
  }
  if(M==0) {
      if(N==1) S=0;
      else if(N==2) S=10;
      else S=100;
  }
  else {
      if(N==1) {
    int a=1;
    for(auto p : sc) a=p.se;
    S=a;
  }
  else if(N==2) {
    int a=1, b=0;
    for(auto p : sc) {
      if(p.fi==1) a=p.se;
      else if(p.fi==2) b=p.se;
    }
    S=10*a+b;
    if(Digit(S)!=2) ok=false;
  }
  else {
    int a=1,b=0,c=0;
    for(auto p : sc) {
      if(p.fi==1) a=p.se;
      else if(p.fi==2) b=p.se;
      else if(p.fi==3) c=p.se;
    }
    S=100*a+10*b+c;
    if(Digit(S)!=3) ok=false; 
  }
  }
  if(!ok) S=-1;
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 string s;
  cin >> s;
 for(int i = 0; i < (int)s.size(); i++){
    char ch = s[i];
 }
 if( (s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2]) || (s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1]) ||
     (s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1]) ){
   cout << "Yes" << endl;
 }else{
   cout << "No" << endl;
 }
   
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define l(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
int main(){
		int n,m;
		cin>>n>>m;
		cout<<n*(n-1)/2 + m*(m-1)/2<<"\n";
}

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

vector<int> idx[2];

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

	string s;
	cin >> s;
	int N = s.size();
	for(int i = 0; i < N; i++) {
		if(s[i] == s.front()) {
			idx[0].push_back(i);
		}
		else if(s[i] == s.back()) {
			idx[1].push_back(i);
		}
	}

	int sum = 0;
	for(int i = 0; i < (int)idx[0].size() - 1; i++) {
		int rem = idx[0][i + 1] - idx[0][i] - 2;
		sum += rem;
	}
	if(idx[0].back() != N - 1) {
		sum += N - 2 - idx[0].back();
	}
	if(sum % 2 == 1) {
		cout << "First" << endl;
		return 0;
	}

	if(s.front() != s.back()) {
		sum = 0;
		for(int i = 0; i < (int)idx[1].size() - 1; i++) {
			int rem = idx[1][i + 1] - idx[1][i] - 2;
			sum += rem;
		}
		sum += idx[1].front() - 1;
		if(sum % 2 == 1) {
			cout << "First" << endl;
			return 0;
		}
	}

	cout << "Second" << endl;
}

Measured memory_bytes: 1024
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int a, b,ans;

int main()
{
    
    cin>>a>>b;
    if((a*b)%2==0){
        cout<<"Even"<<endl;
    }else{
        cout<<"Odd"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import logging
from collections import Counter
import math

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

def main():
    N = int(input())
    S_ = ["".join(sorted(list(input()))) for _ in range(N)]
    
    logging.info(S_)

    counters = dict(Counter(S_))

    logging.info(counters)
    
    ans = 0
    for key, val in counters.items():
        if val != 1:
            ans += C(val, 2)

    print(ans)
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 25144
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	long long n;
	cin >> n;
	vector<long long> a(n,0);
	long long cnt=1;
	for(long long i=0;i<n;i++){
		cin >> a[i];
		if(a[i]==cnt){
			cnt++;
			continue;
		}
	}
	cnt--;
	if(cnt==0){
		cout << "-1" << endl;
	}else{
		cout << n-cnt << endl;
	}
	return 0;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String[] str = stdR.readLine().split(" ");
        long A = Long.parseLong(str[0]);
        long B = Long.parseLong(str[1]);
        if(A % 2 == 0) {
            if(B % 2 == 0) {
                System.out.println(B ^ ((B - A) / 2 % 2));
            }else {
                System.out.println((B - A + 1) / 2 % 2);
            }
        }else {
            if(B % 2 == 0) {
                System.out.println(A ^ B ^ ((B - A - 1) / 2 % 2));
            }else {
                System.out.println(A ^ ((B - A) / 2 % 2));
            }
        }
    }
}

Measured memory_bytes: 22612
N, M = [int(x) for x in input().split()]
x = sorted([int(y) for y in input().split()])
sub = [x[i]-x[i-1] for i in range(1, M)]
if N >= M:
    print(0)
elif N == 1:
    print(sum(sub))
else:
    print(sum(sorted(sub)[:-(N-1)]))


Measured memory_bytes: 13840
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	if n % 2 == 0 {
		fmt.Println(float64(n)/2 / float64(n))
	} else {
		fmt.Println((float64(n) + 1)/2 / float64(n))
	}
}

Measured memory_bytes: 512
l, r = map(int, input().split())

ans = float('inf')
for i in range(l, min(r, l + 2019)):
    for j in range(i + 1, min(r, l + 2019) + 1):
        x = i * j % 2019
        ans = min(ans, x)
        
print(ans)

Measured memory_bytes: 9088
using System;
class abc154_a{
  public static void Main(){
	String[] color = Console.ReadLine().Split(' ');
    String[] numofballs = Console.ReadLine().Split(' ');
    String dec = Console.ReadLine();
    for(int i=0; i<color.Length; i++){
      if(!color[i].Equals(dec)){
        continue;
      }
      for(int j=0; j<color.Length; j++){
        if(i==j){
          if(j==(color.Length-1)){
            Console.WriteLine("{0}",int.Parse(numofballs[j])-1);
          }
          else{
            Console.Write("{0} ",int.Parse(numofballs[j])-1);
          }
        }
        else{
          Console.Write("{0} ",int.Parse(numofballs[j]));
        }
      }
      break;
    }
  }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> T gcd(T a, T b){return !b?a:gcd(b,a%b);}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
mt19937 R(chrono::system_clock().now().time_since_epoch().count());

const int N = 1e6+11;
int tot,ch[N][26],dp[N][26];
int n,id[N];char S[N];vector<char>a[N];ll res;
bool cmp(int x, int y){return SZ(a[x])>SZ(a[y]);}
void trans(int &u,int c){
	c-='a';if(!ch[u][c])ch[u][c]=++tot;u=ch[u][c];
}
int main() {
	read(n);
	rep(i,1,n){
		scanf("%s",S+1);int l=strlen(S+1);
	//	a[i].reserve(l);
		per(j,l,1)a[i].pb(S[j]);
		id[i]=i;
	}
	sort(id+1,id+n+1,cmp);
	rep(ttt,1,n){
		int cur=0,t=id[ttt];
	//	for(auto c:a[t])putchar(c);puts("");
		static int pos[N];
		rep(i,0,SZ(a[t])-2)trans(cur,a[t][i]),pos[i+1]=cur;
		res+=dp[cur][a[t].back()-'a'];
		trans(cur,a[t].back());pos[SZ(a[t])]=cur;
		bool exist[26]={0};
		per(i,SZ(a[t]),0){
			rep(j,0,25)dp[pos[i]][j]+=exist[j];
			if(i)exist[a[t][i-1]-'a']=1;
		}
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 233208
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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,
        p: [usize; n],
    }
    let mut max_index = 0;
    for i in 1..n {
        if p[i] > p[max_index] {
            max_index = i;
        }
    }
    let mut s = 0;
    for i in 0..n {
        s += if i == max_index {
            p[i] / 2
        } else {
            p[i]
        }
    }
    println!("{}", s);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  int h, n;
  cin >> h >> n;
  int sum = 0;
  rep(i, n)
  {
    int a;
    cin >> a;
    sum += a;
  }
  Yes(sum >= h);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 303, maxm = maxn * maxn, mod = 998244353;
int mul(long long a, long long b){
	return a * b % mod;
}
int f[maxn][maxm], g[maxn][maxm], a[maxn];
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	int S = accumulate(a, a + n, 0);
	f[0][0] = 1;
	g[0][0] = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= S; j++){
			if(f[i][j]){
				f[i+1][j] += mul(f[i][j], 2); if(f[i+1][j] >= mod) f[i+1][j] -= mod;
				f[i+1][j+a[i]] += f[i][j]; if(f[i+1][j+a[i]] >= mod) f[i+1][j+a[i]] -= mod;	
			}
			if(g[i][j]){
				g[i+1][j] += g[i][j]; if(g[i+1][j] >= mod) g[i+1][j] -= mod;
				g[i+1][j+a[i]] += g[i][j]; if(g[i+1][j+a[i]] >= mod) g[i+1][j+a[i]] -= mod;
			}
		}
	}
	int ans = 1;
	for(int i = 0; i < n; i++) ans = mul(3, ans);
	int bad = 0;
	for(int i = (S + 1)/2; i <= S; i++){
		bad += f[n][i];
		if(bad >= mod) bad -= mod;
	}
	if(S%2 == 0){
		bad += mod - g[n][S/2];
		if(bad >= mod) bad -= mod;
	}
	bad = mul(bad, 3);
	ans += mod - bad;
	if(ans >= mod) ans -= mod;
	cout << ans << endl;
	return 0;
}



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

int div_cnt(int a) {
  int cnt = 0;
  while (a % 2 == 0) {
    ++cnt;
    a /= 2;
  }
  return cnt;
}

int main() {
  int n; cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    cnt += div_cnt(a);
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
import sys
fin = sys.stdin.readline
from heapq import heappop, heappush, heapify

N = int(fin())
a_list = [int(elem) for elem in fin().split()]
left, right = a_list[:N], a_list[N:]

thrown_away = [False] * (2 * N)
discarded_items = []

# initialize
right_sum = sum(right)
for i, item in enumerate(right):
    if i < N:
        heappush(discarded_items, (item, i))
        thrown_away[i] = True
        right_sum -= item
    else:
        if item > discarded_items[0][0]:
            old_item, old_idx = heappop(discarded_items)
            thrown_away[old_idx] = False
            heappush(discarded_items, (item, i))
            thrown_away[i] = True
            right_sum += old_item - item


# move partitions and calculate a global maximum
left_sum = sum(left)
heapify(left)
# dirty trick
thrown_away.append(False)
max_score = left_sum - right_sum
for i, item in enumerate(right[:N]):
    if not thrown_away[i]:
        # update right
        updated_idx = -1
        # pick a item which has not moved to the left.
        while thrown_away[updated_idx] == False:
            updated_item, updated_idx = heappop(discarded_items)
        right_sum += updated_item - item
        thrown_away[updated_idx] = False
    else:
        # want to remove item from discarded_items, but it take O(N)
        # instead, set thrown_away[i] = False so as to know this is moved to the left.
        thrown_away[i] = False
    # update left
    if item > left[0]:
        old_item = heappop(left)
        heappush(left, item)
        left_sum += item - old_item
    max_score = max(max_score, left_sum - right_sum)

print(max_score)


Measured memory_bytes: 121640
function main()
	N,K=map(x->parse(Int,x),split(readline()))
	A=map(x->parse(Int,x),split(readline()))
	X=sum(A)
	ans=0
	function check(x)
		B=[a%x for a=A]
		sort!(B)
		T=0
		N=length(B)
		for i=1:N
			if T+B[i]<=K
				T+=B[i]
				B[i]=0
			end
		end
		for i=1:N
			if B[i]>0&&B[i]+T>=x
				T-=x-B[i]
				B[i]=0
			end
		end
		sum(B)==0
	end
	for i=1:isqrt(X)
		if X%i!=0
			continue
		end
		if check(i)
			ans=max(ans,i)
		end
		if check(div(X,i))
			ans=max(ans,div(X,i))
		end
	end
	println(ans)
end
main()

Measured memory_bytes: 171792
from bisect import bisect_left
from time import time
t0 = time()
def xorshift(seed=123456789):  # 31 bit xorshift
    y = seed
    def randint():
        nonlocal y
        y ^= (y & 0xffffff) << 7
        y ^= y >> 12
        return y# % (b-a+1) + a
    return randint
randint = xorshift()
D = int(input())
C = list(map(int, input().split()))  # 低下
S = [list(map(int, input().split())) for _ in range(D)]
Last = [-1] * 26
def calc_pena(day):
    res = 0
    for l, c in zip(Last, C):
        res += (day-l)*c
    return res
T2 = [[-1] for _ in range(26)]

def change(day, contest):
    diff = 0
    contest_old = T[day]
    T[day] = contest
    idx = bisect_left(T2[contest_old], day)
    #assert day in T2[contest_old]
    diff -= C[contest_old] * (T2[contest_old][idx+1] - day) * (day - T2[contest_old][idx-1])
    del T2[contest_old][idx]
    idx = bisect_left(T2[contest], day)
    diff += C[contest] * (T2[contest][idx] - day) * (day - T2[contest][idx-1])
    T2[contest].insert(idx, day)
    diff += S[day][contest] - S[day][contest_old]
    return diff
Check = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 9999]
idx_Check = 0
def check():
    global idx_Check, ans
    if Check[idx_Check] < time()-t0:
        idx_Check += 1
        print(ans, Check[idx_Check-1])

T = []
ans = 0
for day, s in enumerate(S):
    best_gain = -999999
    best_gain_contest = None
    pena = 0
    for cont, (l, c, s_) in enumerate(zip(Last, C, s)):
        p = (day-l)*c
        pena += p
        if best_gain < s_ + p:
            best_gain = s_ + p
            best_gain_contest = cont
    T.append(best_gain_contest)
    Last[best_gain_contest] = day
    ans += best_gain - pena
# print(T)
# print(ans)
# ans = 0
# Last = [-1] * 26
# for i, (s, t) in enumerate(zip(S, T)):
#     Last[t] = i
#     ans += s[t]
#     ans -= calc_pena(i)
#     T2[t].append(i)
for i, t in enumerate(T):
    T2[t].append(i)
for i in range(26):
    T2[i].append(D)  # 番兵

#from math import exp
#def prob(gain, remain_time):
#    return exp(-gain / remain_time)

t_now = time()-t0
while t_now < 1.9:
    r = randint()
    day = r % D
    r //= D
    contest = r % 26
    contest_old = T[day]
    ch = change(day, contest)
    r2 = randint()
    if ch >= 0 \
        or (t_now < 1.7 and -ch < r2&0x3ff) \
        or (t_now < 1.0 and -ch < r2&0xfff):
        ans += ch
        #print(ans, time()-t0)
        #check()
    else:
        change(day, contest_old)
    t_now = time()-t0
#print(ans)
print("\n".join(str(a+1) for a in T))


Measured memory_bytes: 82888
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;


void calc() {

	Int N; std::cin >> N;
	std::vector<Int> A(N);
	std::unordered_map<Int, Int> m;
	rep(i, N) {
		std::cin >> A[i];
		m[A[i]]++;
	}
	std::unordered_map<Int, Int> tmp_ans;
	Int total = 0;
	rep(i, N) {
		tmp_ans[A[i]] = m[A[i]] * (m[A[i]] - 1) / 2;
	}
	for (const auto elem : tmp_ans)total += elem.second;

	rep(i, N) {
		Int ans = tmp_ans[A[i]] * (m[A[i]] - 2) / m[A[i]];
		Int out = total - (tmp_ans[A[i]] - ans);
		std::cout << out << "\n";
	}

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 16072
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    ll m,n;
    cin>>m>>n;
    int cnt = 0;
    for(int i=0;i<m;i++)
    {
        ll a,b,y;
        cin>>a>>b;
        y = a*a+b*b;
        if(y<=n*n)
        {
            cnt++;
        }
    }
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//std::cout << std::fixed << std::setprecision(10)
constexpr long long MOD = 1000000007;

int main()
{
  int N;
  std::cin >> N;
  std::vector<long long> A(N + 1), B(N);
  for (auto& val: A)
    std::cin >> val;
  for (auto& val: B)
    std::cin >> val;
  long long ans = 0;
  long long remain = 0;
  for (int i = 0; i < N; ++i)
  {
    if (remain <= A[i])
    {
      ans += remain;
      A[i] -= remain;
      if (B[i] <= A[i])
      {
        ans += B[i];
        remain = 0;
      }
      else
      {
        ans += A[i];
        remain = B[i] - A[i];
      }
    }
    else
    {
      ans += A[i];
      remain = B[i];
    }
  }
  ans += std::min(remain, A[N]);
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin >> n;
   vector<int>a(n);
   for(int i=0;i<n;i++){
       cin >> a[i];
   }
   sort(a.begin(),a.end());
   for(int i=0;i<n;i++){
       if(a[i]==a[i+1]){
           cout <<"NO";
           return 0;
       }
   }
   cout << "YES";

}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  //貪欲法
  int n,k; cin>>n>>k;
  int x=1;
  for(int j=0;j<n;j++){
    if (x*2>x+k){
      x+=k;
    }
    else x*=2;
  }
  cout << x <<endl;
  return 0;
}

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

using namespace std ;
#define int long long
int n , m ;
const int N = 1 << 13 ;
int dp[N] ;

signed main() {
  ios :: sync_with_stdio(false) ;
  cin.tie(0) ;
  cout.tie(0) ;
  memset(dp , 0x3f , sizeof(dp)) ;
  cin >> n >> m ;
  for(register int i = 1 ; i <= m ; i ++) {
    int val , tot ;
    cin >> val >> tot ;
    int bit = 0 ;
    for(register int j = 1 ; j <= tot ; j ++) {
      int x ;
      cin >> x ;
      bit += (1 << (x - 1)) ;
    }
    dp[bit] = min(dp[bit] , val) ;
  }
  int s = (1 << n) - 1 ;
  for(register int i = 1 ; i <= s ; i ++)
    for(register int j = 1 ; j <= s ; j ++)
      dp[i | j] = min(dp[i | j] , dp[i] + dp[j]) ;
  if(dp[s] == 0x3f3f3f3f3f3f3f3f) cout << -1 << endl ;
  else cout << dp[s] << endl ;
  return 0 ;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

int d,n;
typedef tuple<int, int, int> C;//温度~温度,派手

int dp[201][201] = {0};

int main(void)
{
	while(cin >> d >> n && n && d)
	{
		memset(dp, 0, sizeof(dp));
		vector<C> cs(n);
		vector<int> atm(d);
		for (int i = 0; i < d; i++)
		{
			cin >> atm[i];
		}
		for (int i = 0; i < n; i++)
		{
			int a, b, c;
			cin >> a >> b >> c;
			cs[i] = make_tuple(a, b, c);
		}

		int ans = 0;
		for (int i = 1; i < d; i++)
		{
			for (int j = 0; j < n; j++)
			{
				int a = get<0>(cs[j]), b = get<1>(cs[j]), c = get<2>(cs[j]);
				if(atm[i] < a || atm[i] > b) continue;
				for (int k = 0; k < n; k++)
				{
					int pa = get<0>(cs[k]), pb=get<1>(cs[k]), pc=get<2>(cs[k]);
					if(atm[i-1] < pa || atm[i-1] > pb) continue;

					 dp[i][j] = max(dp[i][j], abs(c - pc) + dp[i-1][k]);
					 ans = max(dp[i][j],ans);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1360
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long ans = 0;
        int n = scanner.nextInt();
        int[][] f = new int[20][20];
        for (int i = 0; i < n; i++) {
            StringBuilder v = new StringBuilder(scanner.next());
            if (!v.toString().contains(".")) {
                v.append(".");
            }
//            System.out.println(v.lastIndexOf("."));
            for (int j = v.length() - v.lastIndexOf("."); j <= 9; j++) {
                v.append("0");
            }
            long vv = Long.valueOf(v.toString().replace(".", ""));
            int p = 0, q = 0;
            while (vv % 2 == 0) {
                p++;
                vv = vv / 2;
            }
            while (vv % 5 == 0) {
                q++;
                vv = vv / 5;
            }
            p = Math.min(18, p);
            q = Math.min(18, q);
            for (int j = 18 - p; j <= 18; j++) {
                for (int k = 18 - q; k <= 18; k++) {
                    ans = ans + f[j][k];
                }
            }
            f[p][q]++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 66140