akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int A, B, C, K;

int main() {
    cin >> A >> B >> C >> K;
    if (K <= A) {
        cout << K << endl;
    } else if (K <= B) {
        cout << A << endl;
    } else {
        cout << A - (K - A - B) << endl;
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
  int x, y, a, b, c;
  vector<ll> p, q, r,s;
  cin >> x >> y >> a >> b >> c;
  p.resize(a);
  q.resize(b);
  r.resize(c);
  s.resize(x+y+c);
  
  for(int i=0;i<a;i++){
    cin>>p[i];
  }
  for(int i=0;i<b;i++){
    cin>>q[i];
  }
  for(int i=0;i<c;i++){
    cin>>r[i];
  }
  sort(p.begin(),p.end());
  sort(q.begin(),q.end());
  sort(r.begin(),r.end());
  int j = 0;
  for(int i=a-x;i<a;i++){
    s[j]=p[i];
    j++;
  }
  for(int i=b-y;i<b;i++){
    s[j]=q[i];
    j++;
  }
  for(int i=0;i<c;i++){
    s[j]=r[i];
    j++;
  }
  sort(s.begin(),s.end());
  ll ans=0;
  for(int i=c;i<x+y+c;i++){
    ans+=s[i];
  }
  cout<<ans;
  
}

Measured memory_bytes: 4864
/*
	Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1000000000;

#define pii pair < int, int >
#define vi vector < int >
#define vvi vector < vector < int > >
#define vpii vector < pair < int, int > >
#define vvpii vector < vector < pair < int, int > > >
#define pb push_back
#define f first
#define s second
#define mp make_pair

int main()
{
	ll a, b, ans = -1;
	cin >> a >> b;
	for(ll i=1; i<=10000; i++)
	{
		if(8*i/100 == a && 10*i/100 == b)
		{
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T,typename U> 
using gmap = cc_hash_table<T, U, hash<T> >;

//INSERT ABOVE HERE
signed AGC023_A(){
  using ll = long long;
  int n;
  scanf("%d",&n);
  vector<ll> a(n);
  for(int i=0;i<n;i++) scanf("%lld",&a[i]);

  gmap<ll, ll> m;
  ll ans=0,s=0;
  m[s]++;
  for(int i=0;i<n;i++){
    s+=a[i];
    ans+=m[s];
    m[s]++;
  }

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

signed main(){
  AGC023_A();
  return 0;
}


Measured memory_bytes: 12140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin >> N;
  map<int, int> A{};
  rep(i, 0, N) {
    int n;
    cin >> n;
    A[n] = abs(A[n] - 1);
  }
  int ans = 0;
  for (auto it = A.begin(); it != A.end(); it++) {
    ans += it->second;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
h,w=map(int,input().split());input();a,d,MAP,w1,h1=list(map(int,input().split())),[],[[0 for i in range(w)] for j in range(h)],0,0
for i,j in enumerate(a):
  for _ in range(j):
    if w1<w:
      MAP[h1][w1]= i+1
      w1+=1
      if w1==w:
        w1=0
        h1+=1
for i in range(h):
  if i%2!=0: MAP[i] = MAP[i][::-1]
[print(*i,sep=' ') for i in MAP]

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	string S; cin >> S; int N = S.size();
	vint U(N);
	int now = 0;
	int base = 1;
	for (int i = N-1; i >= 0; i--) {
		(now += base * (S[i]-'0')) %= 2019;
		U[i] = now;
		(base *= 10) %= 2019;
	}
	ll ans = 0;
	map<int, int> mp;
	for (int i = 0; i < N; i++) {
		ans += mp[U[i]];
		mp[U[i]]++;
	}
	ans += mp[0];
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define STDIO
#define mp make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front 
#define pb push_back
#define pp push
#define lb lower_bound 
#define ub upper_bound

inline void checkmin(int &x, int y){x = min(x, y);}
inline void checkmax(int &x, int y){x = max(x, y);}

ull n,m;

int main() 
{
	#ifndef STDIO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>n>>m;
    if(n==1LL||m==1LL)
    {
    	cout<<1LL<<endl;
    	return 0;
	}
    ull x=n*m;
    if(n%2LL&&m%2LL)
    {
    	cout<<(x+1)/2LL<<endl;
	}
	else
	{
		cout<<x/2LL<<endl;
	}
    /* end code */
	return 0;
}

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

using namespace std;

typedef long long LL;

int nrdiv(int x)
{
    int p=1;
    while(x%2==0)
        x/=2,
        ++p;
    for (int fact=3;fact*fact<=x;fact+=2)
    {
        int a=1;
        while (x%fact==0)
            x/=fact,
            ++a;
        p=p*a;
    }
    if (x>1)
        p*=2;
    return p;
}

int main()
{
//    ifstream cin("input.txt");
    int n;
    cin>>n;
    int s=0;
    for (int i=1;i<n;++i)
        s+=nrdiv(i);
    cout<<s;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair < int , pair < int , int > > mp;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
 
const ll N = 353456;
const ll mod = 1e18 + 7;
const ld eps = 1e-6;
const ld pi = 3.1415926535;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

    double a , b;
    cin >> a >> b;

    double x;
    cin >> x;

    double n = (x - (a * a * b) / 2.0) / (a * a / 2.0);
    ld ang;
    if(n > 0)
        ang = a / (b - n);
    else {
        ld temp = (2 * x) / (a * b);
        ang = temp / b;        
    }
  //  cout << a << " " << b - n << endl;
    ang = atan(1 / ang) * 180.0 / pi;
    cout << ang << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	int n, m;
	int a, b;
	int count[50] = { 0 };
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%d %d", &a, &b);
		count[a - 1] += 1;
		count[b - 1] += 1;
	}
	for (int i = 0; i < n; ++i) {
		printf("%d\n", count[i]);
	}

	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

#define ll long long


int main() {
	int n, m;
	int sum = 0;
	float chk;
	int count = 0;
	int i;

	cin >> n >> m;
	vector<int>a(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	chk = sum / (4.0 * m);
	for (i = 0; i < n; i++) {
		if (a[i] >= chk)count++;
	}
	if (count >= m)cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++) 

using namespace std;

int main() {
    long int x;
    cin >> x;
    int ans = 0;
    int a = x % 500;
    ans += 1000 * (x / 500);
    ans += (a / 5) * 5;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
mod = 1000000007

N = int(input())

A = 1
B = 1
C = 1
ans = 0

for _ in range(1,N+1):
  A *= 10
  A %= mod
  B *= 9
  B %= mod
  C *= 8
  C %= mod
  ans = A - (2*B - C)
  if ans < 0: ans += mod

if ans < 0: ans += mod

print(ans)


Measured memory_bytes: 8952
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int N,L,T,d,A[maxn];
int pre(int x) {return x == 1 ? N : x - 1;}
int nex(int x) {return x == N ? 1 : x + 1;}
int main(){
    #ifdef DMC
        freopen("DMC.txt","r",stdin);
    #endif

    cin >> N >> L >> T;
    for (int i = 1; i <= N; i++){
        int x,w; scanf("%d%d",&x,&w);
        if(w==1){
            int dt = T;
            if (L - x <= dt)
                dt -= (L - x),++d,x = 0;
            x += dt; d += dt / L; x %= L;
        }
        else{
            int dt = T;
            if (x + 1 <= dt)
                dt -= (x + 1),--d,x = L - 1;
            x -= dt; d -= dt / L; x %= L;
            if (x < 0) x += L;
        }
        A[i] = x; d %= N;
    }
    int pos = 1; d %= N;
    while (d < 0) pos = pre(pos),++d;
    while (d > 0) pos = nex(pos),--d;
    sort(A + 1,A + N + 1);
    for (int i = pos; i <= N; i++) printf("%d\n",A[i]);
    for (int i = 1; i < pos; i++) printf("%d\n",A[i]);
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

const int MOD = 998244353;

long long f[300005];

int poww(int base, int to){
    long long cur = base, res = 1;
    while(to){
        if(to&1) res *= cur, res %= MOD;
        cur *= cur, cur %= MOD;
        to >>= 1;
    }
    return (int)res;
}

long long choose(int a, int b){
    long long res = (f[a]*poww(f[b], MOD-2))%MOD;
    res = (res*poww(f[a-b], MOD-2))%MOD;
    return res;
}

int main(){
    int N;
    long long A, B, K;
    scanf("%d%lld%lld%lld", &N, &A, &B, &K);
    f[0] = 1;
    for(int i=1; i<=N; i++) f[i] = (f[i-1]*i)%MOD;
    long long res = 0;
    for(int A_cnt=0; A_cnt<=N; A_cnt++){
        long long cur = A_cnt*A;
        if(cur > K) break;
        cur = K-cur;
        if(cur%B == 0 && cur/B <= N){
            res += (choose(N, A_cnt)*choose(N, cur/B))%MOD;
            res %= MOD;
        }
    }
    printf("%lld", res);
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, ab, cd;
  cin >> a >> b >> c >> d;
  ab = a * b;
  cd = c * d;
  if (ab < cd) {
    cout << cd << endl;
  } else {
    cout << ab << endl;
  }
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		Eratosthenes er = new Eratosthenes(1000000);
		Map<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			Map<Integer, Integer> soinsu = er.bunkai(a[i]);
			for (Integer key : soinsu.keySet()) {
				if (map.containsKey(key)) {
					map.put(key, Math.max(map.get(key), soinsu.get(key)));
				} else {
					map.put(key, soinsu.get(key));
				}
			}
		}

		long lcm = 1;;
		for (Integer key : map.keySet()) {
			lcm *= power(key, map.get(key));
			lcm %= 1000000007;
		}
		BigInteger blcm = BigInteger.valueOf(lcm);
		BigInteger m = BigInteger.valueOf(1000000007);

		BigInteger ans = BigInteger.ZERO;
		for (int i = 0; i < n; i++) {
			ans = ans.add(blcm.multiply(BigInteger.valueOf(a[i]).modInverse(m))).mod(m);
		}
		System.out.println(ans);
	}

	static class Eratosthenes {
		int[] div;

		public Eratosthenes(int n) {
			div = new int[n + 1];
			div[0] = -1;
			div[1] = -1;
			int end = (int) Math.sqrt(n) + 1;
			for (int i = 2; i <= end; i++) {
				if (div[i] == 0) {
					div[i] = i;
					for (int j = i * i; j <= n; j+=i) {
						if (div[j] == 0) div[j] = i;
					}
				}
			}
			for (int i = end + 1; i <= n; i++) {
				if (div[i] == 0) {
					div[i] = i;
				}
			}
		}

		public Map<Integer, Integer> bunkai(int x) {
			Map<Integer, Integer> soinsu = new HashMap<>();
			while (x > 1) {
				Integer d = div[x];
				if (soinsu.containsKey(d)) {
					soinsu.put(d, soinsu.get(d) + 1);
				} else {
					soinsu.put(d, 1);
				}
				x /= d;
			}
			return soinsu;
		}
	}

	static long power(long x, long n) {
		if (n == 0) {
			return 1;
		}
		int mod = 1000000007;
		long val = power(x, n / 2);
		val = val * val % mod;
		if (n % 2 == 1) {
			val = val * x % mod;
		}
		return val;
	}
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#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())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N,K; cin >> N >> K;
    ll ans = 0;
    if(K == 0){
        cout << (ll)N*N << endl;
        return 0;
    }
    FOR(i,K+1,N+1){
        ans += (N+1)/i * (i-K);
        ans += max((ll)0,(N+1)%i - K);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
using ll = unsigned long long;
const ll mod = 1e9+7;
int main() 
{
    int n, k;
    cin >> n >> k;
    int a[2010] = {};
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    int cntl[2010] = {};
    int cntr[2010] = {};
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            if (a[i] < a[j]) cntl[i]++;
        }
        for (int j = i+1; j < n; j++)
        {
            if (a[i] < a[j]) cntr[i]++;
        }
        
    }

    ll ans = 0;
   for (int i = 0; i < n; i++)
        {
            ans = (ans + (ll)k*(2*cntl[i])/2%mod+((ll)k*(ll)(k-1))/2%mod*(cntl[i]+cntr[i])%mod) % mod;
            //ans = (ans + k%mod*(((k-1)%mod*(cntl[i]+cntrs[i]))/2+cntl[i])%mod) % mod;
            //ans = (ans + (ll)k * cntl[i] % mod  + ((ll)k*((ll)k-1)/2) % mod * (cntl[i]+cntr[i]))%mod;
            //ans = (ans + (ll)k * cntl[i] % mod  + ((ll)k*(ll)(k-1)/2) % mod * (cntl[i]+cntr[i]))%mod;
        }
    
    
    cout << ans << "\n";
    
    
    
    
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	l := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i])
	}

	sort.Ints(l)
	ans := 0
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			k := sort.Search(len(l), func(k int) bool { return l[k] >= l[i]+l[j] })
			if k <= j {
				continue
			} else {
				ans += k - 1 - j
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());

	long long ans = a[0];
	int rest = n - 2;
	int idx = 1;
	while (rest > 0) {
		if (rest >= 2) {
			ans += 2LL * a[idx];
			rest -= 2;
		} else {
			ans += a[idx];
			rest--;
		}
		idx++;
	}

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


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


const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};

mint c[4003][4003];
void init(){
    c[0][0] = 1;
    for(int i = 0; i <= 4000; ++i) {
        for(int j = 0; j <= i; ++j){
            c[i+1][j] += c[i][j];
            c[i+1][j+1] += c[i][j]; 
        }
    }
}

mint combination(int n, int k){
    return c[n][k];
}

mint f2(int n, int k){
    return combination(n+k-1, k-1);
}

mint f(int n, int k){
    if(n<k) return 0;
    if(n==0 && k==0) return 1;
    if(k<1) return 0;
    return f2(n-k, k);
}

int main() {
    init();
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= k; ++i) {
        mint b = f(k, i);
        mint r = 0;
        r += f(n-k, i-1);
        r += f(n-k, i);
        r += f(n-k, i);
        r += f(n-k, i+1);
        mint ans = b * r;
        cout << ans.x << endl;
    }
    return 0;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int mi = 0;
    rep(i, N) if(A[i] < A[mi]) mi = i;
    K--;
    int res = 0, rst = mi;
    int t = 0;
    while(t < mi) {
        res++;
        t += K;
    }
    if(t>mi) rst = t;
    while(rst < N-1) {
        res++;
        rst += K;
    }


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

Measured memory_bytes: 640
#include<cstdio>
using namespace std;
int main(){
  int a[10],b[4],i,h,br,a1,a2,a3,a4;
  while(scanf("%d%d%d%d",&a1,&a2,&a3,&a4)!=EOF){
    scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
    for(i=0,h=0,br=0;i<10;i++)a[i]=0;
    a[a1]=1,a[a2]=2,a[a3]=3,a[a4]=4;
    for(i=0;i<4;i++)if(a[b[i]]==i+1)h++;else if(a[b[i]])br++;
    printf("%d %d\n",h,br);
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}


int main (){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll ans=0;
    vi c_r(n,0);
    vi c_g(n,0);
    vi c_b(n,0);
    rep(i,n){
        if(s[i]=='R') c_r[i]=1;
        if(s[i]=='G') c_g[i]=1;
        if(s[i]=='B') c_b[i]=1;
    }
    vi rui_r(n,0);
    vi rui_g(n,0);
    vi rui_b(n,0);

    rep(i,n){
        if(i==0){
            rui_r[i]=c_r[i];
            rui_g[i]=c_g[i];
            rui_b[i]=c_b[i];
        }
        else{
            rui_r[i]=rui_r[i-1]+c_r[i];
            rui_g[i]=rui_g[i-1]+c_g[i];
            rui_b[i]=rui_b[i-1]+c_b[i];
        }
    }
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
            if(s[i]==s[j]) continue;

            if((s[i]=='R'&&s[j]=='G')||s[i]=='G'&&s[j]=='R'){
                ans+=rui_b[n-1]-rui_b[j];
                ll k=2*j-i;
                if(k<n){
                    if(s[k]=='B') ans--;
                }
            }
            else if((s[i]=='G'&&s[j]=='B')||s[i]=='B'&&s[j]=='G'){
                ans+=rui_r[n-1]-rui_r[j];
                ll k=2*j-i;
                if(k<n){
                    if(s[k]=='R') ans--;
                }
            }

            else if((s[i]=='R'&&s[j]=='B')||s[i]=='B'&&s[j]=='R'){
                ans+=rui_g[n-1]-rui_g[j];
                ll k=2*j-i;
                if(k<n){
                    if(s[k]=='G') ans--;
                }
            }

        }
    }

   
    cout << ans << endl;
    return 0;


}


Measured memory_bytes: 3696
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;
 

int main(){
	long long N,M,sum=0;
	cin >> N >> M;
	if(2*N<=M){
     sum=N+(M-2*N)/4;
  }else sum=M/2;
	cout << sum<< endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main(void)
{
    while (1){
        int y1, y2, m1, m2, d1, d2;
        scanf("%d %d %d %d %d %d", &y1, &m1, &d1, &y2, &m2, &d2);
        if (y1 < 0){
            break;
        }
        
        // ツツツェツδ可ーツづ個古カツ篠ョツ？ツづつゥツつ「ツつ、ツづ個使ツつ、ツづヲ
        if (m1 < 3){
            y1--;
            m1 += 12;
        }
        if (m2 < 3){
            y2--;
            m2 += 12;
        }
        
        int day1 = (y1 * 365) + (y1 / 4) - (y1 / 100) + (y1 / 400) + (m1 * 28) + (((m1 + 1) * 26) / 10) + d1 - 400;
        int day2 = (y2 * 365) + (y2 / 4) - (y2 / 100) + (y2 / 400) + (m2 * 28) + (((m2 + 1) * 26) / 10) + d2 - 400;
        int ans = day2 - day1;
        
        printf("%d\n", ans);
    }
}

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


int main(){
  
  
  long long x;
  cin>>x;
  int flag = 0;
  int A,B;
  for(int i=-120 ;i<=120;i++){
   for(int j=-120;j<=120;j++){
    long long a=i,b=j;
	A = a;
	B = b;
     for(int k=1;k<=4;k++){
      a = a*i;
       b = b*j;
     }
	 //A =a;
	 //B = b;
     if(a - b == x){
      cout<<A<<" "<<B<<endl;
       return 0;
     }
   }
  }
  //cout<<A<<" "<<B<<endl;
  
  
  
  
 //return 0; 
  
  
}

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]
    k = int(lines[1])

    return (s, k)


def solve(s, k):

    compress = []
    previous_c = None
    cnt = 1
    for c in s:
        if c == previous_c:
            cnt = cnt + 1
        else:
            if previous_c:
                compress.append((previous_c, cnt))
                cnt = 1
        previous_c = c
    compress.append((previous_c, cnt))
    if debug:
        log("compress=%s" % compress)

    if len(compress) == 1:
        return compress[0][1] * k // 2
    elif len(compress) == 2:
        return (compress[0][1] // 2 + compress[1][1] // 2) * k
        
    head = compress[0]
    if len(compress) > 1:
        body = compress[1:-1]
    else:
        body = []
    tail = compress[-1]
    if debug:
        log("head=%s" % (head,))
        log("body=%s" % (body,))
        log("tail=%s" % (tail,))
    
    body_count = 0 
    for b in body:
        body_count = body_count + b[1] // 2

    total_replace_count = 0
    if head[0] == tail[0]:
        length = head[1] + tail[1]
        replace_count = length // 2 * (k-1)
        total_replace_count = total_replace_count + head[1] // 2 + replace_count + tail[1] // 2
        total_replace_count = total_replace_count + body_count * k
    else:
        total_replace_count = total_replace_count + (head[1] // 2 + body_count + tail[1] // 2) * k

    return total_replace_count


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, a, c = 0;
    cin >> N;
    bool color[8];
    REP(i, 8) color[i] = false;
    REP(i, N) {
        cin >> a;
        if (a >= 3200) c++;
        else color[a / 400] = true;
    }
    int ans = 0;
    REP(i, 8) if (color[i]) ans++;
    cout << max(1, ans) << " " << ans + c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-8;

const ll INF = 1e15;

class BIT
{
public:
	vector<int> bit;
	int M;

	BIT(int M) :
		bit(vector<int>(M + 1, 0)), M(M) {}

	int sum(int i) {
		if (!i) return 0;
		return bit[i] + sum(i - (i&-i));
	}

	int sum(int l, int r) {
		return sum(r) - sum(l);
	}

	void add(int i, int x) {
		if (i > M) return;
		bit[i] += x;
		add(i + (i&-i), x);
	}
};

int main() {
	ll N;
	cin >> N;
	vector<ll> x(N);
	for (int i = 0;i < N;i++)
		cin >> x[i];
	ll lb = 1, ub = 1000000001;
	ll allnum = N * (N + 1) / 2;
	while (ub - lb > 1) {
		ll m = (lb + ub) / 2;
		vector<ll> h(N+1);
		for (int i=0;i < N;i++) {
			if (x[i] >= m)
				h[i + 1] = h[i] + 1;
			else
				h[i + 1] = h[i] - 1;
		}
		ll num = 0;
		BIT bit(2e5 + 10);
		ll offset = 1e5 + 5;
		for (int i = N;i >= 1;i--) {
			if (x[i-1] < m) {
				bit.add(h[i] + offset, 1);
				num += bit.sum(h[i] + offset);
			}
			else {
				bit.add(h[i] + offset, 1);
				num += bit.sum(h[i] + offset - 2);
			}
		}
		if (num * 2 > allnum)
			ub = m;
		else
			lb = m;
	}
	cout << lb << endl;
	return 0;
}


Measured memory_bytes: 2656
N,M = map(int,input().split())
H = [int(x) for x in input().split()]
A = []
for i in range(M):
    A.append(list(map(int,input().split())))
B = [0] * N
count = 0

for i in range(M):
    if H[A[i][0]-1] < H[A[i][1]-1]:
        B[A[i][0]-1] = 1
    elif H[A[i][0]-1] > H[A[i][1]-1]:
        B[A[i][1]-1] = 1
    else:
        B[A[i][0]-1] = 1
        B[A[i][1]-1] = 1


for i in range(N):
    if B[i] == 0:
        count = count + 1

print(count)


Measured memory_bytes: 31900
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define pf pop_front
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod=1e9+7;
const ll maxn=100005;
const ll inf=1e9+7;
ll dp[maxn];
ll n,W;
ll w[maxn],c[maxn];
int main()
{
    //IOS;
    while(cin>>n>>W)
    {
        memset(dp,0,sizeof(dp));
        rep(i,n) cin>>w[i]>>c[i];
        rep(i,n)
        {
            for(int j=W;j>=w[i];j--)
            {
                dp[j]=max(dp[j],dp[j-w[i]]+c[i]);
            }
        }
        cout<<dp[W]<<"\n";
    }
}


Measured memory_bytes: 1152
t = int(input())
u = "Good"

if t % 10 == (t//10) % 10:
  u = "Bad"

if (t//10) % 10 == (t//100) % 10:
  u = "Bad"
  
if (t//100) % 10 == (t//1000) % 10:
  u = "Bad"
print(u)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;
int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    cout << a * (n / (a + b)) + min(a, n % (a + b)) << endl;
    return 0;
}

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

class ITP1
{
    static void Main()
    {
        for (; ; )
        {
        var a = Console.ReadLine();
        int b = int.Parse(a.Split(' ')[0]);
        int c = int.Parse(a.Split(' ')[1]);
            if (b == 0 && c == 0) { break; }
            for (int i = 0; i < b; i++)
            {
                for (int j = 0; j < c; j++)
                {
                    if (i == 0 || i == b - 1 || j == 0 || j == c - 1)
                    {
                        Console.Write('#');
                    }
                    else
                    {
                        Console.Write('.');
                    }
                }
                Console.Write('\n');
            }
            Console.Write('\n');
        }
    }
}

Measured memory_bytes: 5280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
using graph = vector<vector<int>>;

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, m, x, y; cin >> n >> m >> x >> y;
	int mx = x, my = y;
	rep(i,n){
		int a; cin >> a;
		mx = max(mx, a);
	}
	rep(i,m){
		int a; cin >> a;
		my = min(my, a);
	}
	if(mx < my) cout << "No War" << endl;
	else cout << "War" << endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1<<20)
#define PI (acos(-1))
#define MAX 10000
#define WHITE  0
#define GRAY  1
#define BLACK  2

int N;
vector< pair<int, int> > G[MAX]; // targetの先と、重みのペアが保存されている

void dijkstra(int s) { // sはスタート地点
    priority_queue<pair <int, int> > PQ;
    int color[MAX];
    int d[MAX]; // 最短距離を保存する

    for(int i=0; i<N; i++) {
        d[i] = INF;
        color[i] = WHITE;
    }

    d[0] = 0;
    PQ.push(make_pair(0, 0)); // d, vの順で入っている
    color[0] = GRAY;

    while (!PQ.empty()) {
        pair<int, int> f = PQ.top(); PQ.pop();
        int u = f.second;
        color[u] = BLACK;

        if (d[u] < f.first * (-1) ) continue;

        for (int j=0; j< G[u].size(); j++) {
            int v =  G[u][j].first; //　隣接する頂点の取り出し
            if ( color[v] == BLACK) continue;
            if ( d[v] > d[u] + G[u][j].second ) {
                d[v] = d[u] + G[u][j].second;
                PQ.push( make_pair(d[v] * (-1), v ));
                color[v] = GRAY;
            }
        }
    }
    for(int i=0; i<N; i++) {
        cout << i << " " << (d[i] == INF ? -1 : d[i])  << endl;
    }
}

int main() {
    int u, k, v, c;

    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> u >> k;

        for(int j=0; j<k; j++) {
            cin >> v >> c;
            G[u].push_back(make_pair(v, c));
        }
    }

    dijkstra(0);
    return 0;
}



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

int main() {
	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
    int sum = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			sum += d[i] * d[j];
		}
	}

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

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef unsigned int uint;
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

const int MX = 200005;

struct UF{
	int t[MX], c1[MX], c2[MX];
	int find(int x){ return t[x] ? t[x] = find(t[x]) : x; }
	int merge(int a, int b){ // a <- b
		a = find(a), b = find(b);
		if(a == b) return false;
		t[b] = a; c1[a] += c1[b]; c2[a] += c2[b];
		return true;
	}
}uf;

int dp[MX], tdp[MX];

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	set<pii> L;
	for(int i = 1; i <= N; i++){
		for(int j = i+1; j <= N; j++) L.emplace(i, j);
	}
	for(int i = 1; i <= M; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		if(a > b) swap(a, b);
		L.erase(pii(a, b));
	}
	for(int i = 1; i <= N; i++) uf.c1[i*2] = uf.c2[i*2+1] = 1;
	for(pii c : L){
		uf.merge(c.second*2, c.first*2+1);
		uf.merge(c.first*2, c.second*2+1);
	}

	for(int i = 1; i <= N; i++) if(uf.find(i*2) == uf.find(i*2+1)) return !printf("-1\n");
	for(int i = 1; i <= N; i++){
		if(uf.find(i*2) != uf.find(i*2+1)) uf.t[uf.find(i*2)] = uf.find(i*2+1);
	}

	dp[0] = 1;
	for(int i = 2; i <= 2*N+1; i ++){
		if(uf.find(i) != i) continue;
		for(int i = 0; i <= N; i++) tdp[i] = 0;
		
		int c = uf.c1[i];
		for(int t = N; t >= c; t--) tdp[t] |= dp[t-c];
		
		c = uf.c2[i];
		for(int t = N; t >= c; t--) tdp[t] |= dp[t-c];
		
		for(int i = 0; i <= N; i++) dp[i] = tdp[i];
	}
	int ans = 1e9;
	for(int i = 1; i < N; i++) if(dp[i]) ans = min(ans, i*(i-1)/2 + (N-i)*(N-i-1)/2);
	if(ans == 1e9) ans = -1;
	printf("%d\n", ans);
}


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

// clang-format off
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define endl '\n'
#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
    i32 N = input(), K = input();

    cout << (N % K != 0) << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long STATES;

int main( void )
{
	STATES free_days[31], dp[51], goal_state, next;
	STATES* p;
	int i, j, n, free_day, k;
	short answer;

	while ( scanf( "%d", &n ) == 1 && n )
	{
		memset( free_days, 0, sizeof(free_days) );
		memset( dp, 0, sizeof(dp) );

		goal_state = 0;
		for ( i = 0; i < n; i++ ) goal_state |= 1LL << i;

		for ( i = 0; i < n; i++ )
		{
			scanf( "%d", &k );
			for ( j = 0; j < k; j++ )
			{
				scanf( "%d", &free_day );
				free_days[free_day] |= 1LL << i;
			}
		}

		answer = -1;
		for ( i = 0; i < n; i++ ) dp[i] = 1LL << i;
		p = free_days + 1;
		for ( i = 1; i <= 30; i++, p++ )
		{
			next = 0;
			for ( j = 0; j < n; j++ ) if ( *p & 1LL << j ) next |= dp[j];
			if ( next == goal_state )
			{
				answer = i;
				break;
			}
			for ( j = 0; j < n; j++ ) if ( *p & 1LL << j ) dp[j] |= next;
		}

		printf( "%d\n", answer );
	}

	return 0;
}

Measured memory_bytes: 760
#include <iostream>
#include<string>
#include <vector>
int main() {
	int s;
	std::cin >> s;
	std::vector<int> pts;
	pts.reserve(2);
	while (s--)
	{
		std::string a, b;
		std::cin >> a >> b;
		if (a == b)
		{
			pts[0] += 1;
			pts[1] += 1;
		}
		else if (a > b)
		{
			pts[0] += 3;
		}
		else
		{
			pts[1] += 3;
		}
	}
	std::cout << pts[0] << " " << pts[1] << std::endl;
	return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll fac[1000010];
ll binpow(ll a, ll b,ll MOD) {
    ll res = 1;
    a%=MOD;
    while (b > 0) {
        if (b & 1)
            res = res * a %MOD;
        a = a * a%MOD;
        b >>= 1;
    }
    return res;
}
void cal_fac(ll n,ll MOD){
    fac[0]=1;
    for(ll i=1;i<=n;i++){
        fac[i]=fac[i-1]*i;
        fac[i]%=MOD;
    }
}
ll nCr(ll n,ll r,ll MOD){
    // MOD is a prime
    cal_fac(n,MOD);
    //n!*(r!)^-1*((n-r)!)^-1
    //inverse mod (a^-1 = a^(MOD-2) mod MOD
    return fac[n]* binpow(fac[n-r],MOD-2,MOD)%MOD * binpow(fac[r],MOD-2,MOD)%MOD ;
}

int main(){
    ll x,y;
    cin>>x>>y;
    if((x+y)%3==0){
        ll n = y-(x+y)/3;
        ll m = x-(x+y)/3;
        if(n>=0&&m>=0)
            cout<<nCr(n+m,n,1000000007);
        else
            cout<<"0";
    }else
        cout<<"0";

}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    int l_max, r_min;
    cin >> l_max >> r_min;
    for (int i = 1; i < M; i++)
    {
        int l, r;
        cin >> l >> r;
        if (l > l_max)
        {
            l_max = l;
        }
        if (r < r_min)
        {
            r_min = r;
        }
    }
    int ans;
    if (r_min >= l_max)
    {
        ans = r_min - l_max + 1;
    }
    else
    {
        ans = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()


money = []
pow6 = 1
while pow6 <= N:
    money.append(pow6)
    pow6 *= 6
pow9 = 9
while pow9 <= N:
    money.append(pow9)
    pow9 *= 9
lm = len(money)
dp = [[INF for _ in range(N+1)] for _ in range(lm+1)]
dp[0][0] = 0
for i in range(lm):
    for j in range(N+1):
        dp[i+1][j] = dp[i][j]
        if j - money[i] >= 0:
            dp[i+1][j] = min(dp[i+1][j], dp[i+1][j-money[i]]+1)
print(dp[lm][N])


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



int main()
{
	map<long long, bool> mp;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long a;
		cin >> a;
		auto itr = mp.find(a);
		if (itr == mp.end()) {
			mp.emplace(a, true);
		}
		else {
			mp.erase(a);
		}
	}
	cout << mp.size() << endl;
	return 0;
}



Measured memory_bytes: 6528
line1 = input()
line2 = input()
n, k = line1.split(" ")
h_list = line2.split(" ")
k = int(k)
h_list = [int(h) for h in h_list]

ans = 0

for h in h_list:
    if h >= k:
        ans = ans + 1
print(ans)

Measured memory_bytes: 12276
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
   ll x; cin >> x;
   if(x==1){
      cout << 1 << " " << 0 << endl;
      return 0;
   }

   vector<ll> a;
   for(int i=1; i<=sqrt(x); i++){
      if(x%i==0){
         if(i==(x/i)){
            a.push_back(i);
         }
         else{
            a.push_back(x/i);
            a.push_back(i);
         }
      }
   }

   for(int i=-100000; i<=100000; i++){
      for(auto b:a){
         ll tmp = i + b;
         ll tmp2 = pow(tmp, 5) - pow(i, 5);
         if(tmp2==x){
            cout << tmp << " " << i << endl;
            return 0;
         }
      }
   }
   return 0;
}


Measured memory_bytes: 4268
#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 per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    VI vi;
    rep(i, 3){
        cii(a);
        vi.pb(a);
    }
    SORT(vi);
    auto ans = vi[2] - vi[0];
    co(ans);
    return 0;
}

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

int main() {
  string od, ev, pas;
  cin >> od >> ev;
  for (int i = 0; i < ev.size(); i++) {
    pas = pas + od[i] + ev[i];
  }
  
  if (od.size() != ev.size()) {
    pas += od[od.size()-1];
  }
  
  cout << pas << endl;
}

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

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

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

using namespace std;

int main() {
  string s;
  cin >> s;
  cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    ll n;
    cin >> n;
    ll nakami = 10000000000;
    rep(i,1,sqrt(n)+1){
        if(n%i==0){
            ll other = n/i;
            nakami = min(nakami,other);
        }
    }
    int keta = 0;
    while(nakami!=0){
        nakami/=10;
        keta++;
    }
    cout<<keta<<endl;
    return 0;
}


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

int main(){
  int a,b,c;
  cin >>a >>b >>c;
  if(a==b && a!=c) cout << "Yes" << endl;
  else if(a==c && a!=b) cout << "Yes" << endl;
  else if(b==c && a!=b) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256