akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    string s[N];
    REP(i, N) cin >> s[i];

    REP(i, N) {
        sort(s[i].begin(), s[i].end());
    }
    sort(s, s + N);
    //REP(i, N) cout << s[i] << endl;
    ll c = 1;
    ll total = 0;
    string cur = s[0];
    REP(i, N - 1) {
        if (cur == s[i + 1]) c++;
        else {
            if (c > 1) {
                total += c * (c - 1) / 2;
            }
            cur = s[i + 1];
            c = 1;
        }
    }
    if (c > 1) {
        total += c * (c - 1) / 2;
    }
    cout << total << endl;
    return 0;
}


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

using namespace std;

int main() {
  int N, D;
  
  cin >> N >> D;
  
  vector<vector<int>> lists(N, vector<int>(D, 0));
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      int _in;
      
      cin >> _in;
      
      lists[i][j] = _in;
    }
  }
  
  int ans = 0;
  
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int sum = 0;
      
      for (int k = 0; k < D; k++) {
        sum += (lists[i][k] - lists[j][k]) * (lists[i][k] - lists[j][k]);
      }
      
      int l = -1, r = sum + 1;
      
      while (abs(r - l) > 1) {
        int mid = (r + l) / 2;
        
        if (mid * mid == sum) {
          ans++;
          break;
        }
        
        if (mid * mid < sum) {
          l = mid;
        }
        
        if (mid * mid > sum) {
          r = mid;
        }
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll x;
    cin>>x;
    fr(i,1,100000)
    {
        if((i*x)%360==0)
        {
            cout<<i<<endl;
            return;
        }
    }
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3540
#include <iostream>
#include <vector>
#include <cmath>
#include <string>

int main(){
  long long K;
  long long N;
  std::cin >> K >> N;
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    std::cin >> A[i];
  }
  int max = K - A[N - 1] + A[0];
  for(int i = 1 ; i < (int)A.size(); i++){
    int max_candi = A[i] - A[i - 1];
    if(max <= max_candi){
      max = max_candi;
    }
  }
  std::cout << K - max << std::endl;
  
  return 0;
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	int l,r,d;
	std::cin>>l>>r>>d;
	std::cout<<r/d-(l-1)/d<<std::endl;
	return 0;
}

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

int main() {
	// your code goes here
	int l,r,d;
	cin>>l>>r>>d;
	int count=0;
	for(int i=l;i<=r;i++)
	{
	    if(i%d==0)
	    {
	        count++;
	    }
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3636
N = int(input())
L = []
for _ in range(N):
    l = list(map(int,input().split()))
    L.append(l)
 
now_x = 0
now_y = 0
now_time = 0
for x in L:
    if x[0] % 2 != (x[1] + x[2]) % 2:
        print("No")
        quit()
    if abs(now_x-x[1]) + abs(now_y-x[2]) > x[0] - now_time:
        print("No")
        quit()
    now_time = x[0]
    now_x = x[1]
    now_y = x[2]
print("Yes")

Measured memory_bytes: 60376
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m),b(m);
  vector<pair<int,int>> c(m);
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i];
    c[i]=make_pair(b[i],a[i]);
  }
  sort(c.begin(),c.end());
  int cnt=1;
  int x=c[0].first;
  for(int i=1;i<m;i++){
    if(c[i].second>=x){
      cnt++;
      x=c[i].first;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1792
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

s = list(ns())
s.sort()
if s[0] == s[1] and s[1] != s[2] and s[2] == s[3]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
n,m,x = map(int,input().split())
c = []
A = []
INF = float("inf")
ans = INF

for i in range(n):
    tmp = list(map(int, input().split()))
    c.append(tmp[0])
    A.append(tmp[1:])

for i in range(2**n):
  cost = 0
  skill = [0]*m
  for j in range(n):
     if ((i >> j) & 1) :
        cost += c[j]
        for k in range(m):
          skill[k] += A[j][k]
          if min(skill) >=x:
            ans = min(ans, cost)
if ans == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9124
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,a[100005],r[100005],R;
vector<int> v[100005];
void dfs(int x,int y){
    if(v[x].size()==1){
        r[x]=a[x];
        return;
    }
    int cnt=0,mx=0;
    for(int i=0;i<v[x].size();++i){
        int z=v[x][i];
        if(z!=y){
            dfs(z,x);
            cnt+=r[z];
            mx=max(mx,r[z]);
        }
    }
    if(cnt<a[x]||a[x]*2<cnt||mx>a[x]){
        puts("NO");
        exit(0);
    }
    r[x]=a[x]*2-cnt;
    return;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i);
    for(int i=1;i<n;++i){
        int x,y;
        scanf("%d%d",&x,&y);
        v[x].pb(y),v[y].pb(x);
    }
    if(n==2){
        if(a[1]==a[2])puts("YES");
        else puts("NO");
        return 0;
    }
    for(int i=1;i<=n;++i)if(v[i].size()>1)R=i;
    dfs(R,0);
    if(r[R])puts("NO");
    else puts("YES");
    //system("pause");
    return 0;
}


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

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

int main(){
    int N, A[1<<20];
    cin >> N;
    for(int i=0; i<(1<<N); i++) cin >> A[i];
    int ans = 0;
    for(int i=0; i<(1<<N); i++){
        if(A[i]){
            bool mn = true;
            for(int k=0; k<N; k++) if(nth_bit(i, k) && A[i-(1<<k)]) mn = false;
            if(mn) ans++;
        }else{
            for(int k=0; k<N; k++) if(nth_bit(i, k) && A[i-(1<<k)]){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 7204
X, Y = list(map(int, input().split())) # 匹数, 足の本数
kame = 4
turu = 2

def flag():
    if Y % 2 != 0:
        return False
    
    for i in range(X + 1): #単調増加
        kame_num = i
        turu_num = X - i
        temp_sum = turu_num * turu + kame_num * kame
        if temp_sum == Y:
            return True
        elif temp_sum > Y:
            break
    return False

flag = flag()
print('Yes') if flag else print('No')

Measured memory_bytes: 9196
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(1,n-1):
    if p[i] != max(p[i-1],p[i],p[i+1]) and p[i] != min(p[i-1],p[i],p[i+1]):
        count += 1
print(count)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
using namespace std;


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

ll z(ll a,ll b) {
    ll g = gcd(a,b);

    return a / g * b;
}


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

    ll ans = 1LL;
    for (int i=0;i<n;i++){
        ll m;
        cin >> m;
        ans=z(ans,m);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

vector<int> val(10000001,0);
int main(void) {
	int s,res;

	cin >> s;
	val[s]++;
	for (int i = 1; i <= 1000000;i++) {
		if (s % 2 == 0) {
			res = s / 2;
		}
		else {
			res = 3 * s + 1;
		}
		val[res]++;
		if (val[res] == 2) {
			cout << i+1 << endl;
			return 0;
		}
		s = res;
	}
	return 0;
}



Measured memory_bytes: 39296
#include "bits/stdc++.h"

using namespace std;

vector<int> parents;
vector<int> sizes;

void init(int n) {
    parents = vector<int>(n, 0LL);
    sizes = vector<int>(n, 1LL);
    for (int i = 0; i < n; ++i) {
        parents[i] = i;
    }
}

int find(int x) {
    if (parents[x] == x) {
        return x;
    }
    else {
        parents[x] = find(parents[x]);
        return parents[x];
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
        return;
    }
    int total = sizes[x] + sizes[y];
    if (sizes[x] > sizes[y]) {
        parents[y] = x;
    }
    else { // (sizes[y] >= sizes[x])
        parents[x] = y;
    }
    sizes[x] = total;
    sizes[y] = total;
}

bool same(int x, int y) {
    return find(x) == find(y);
}

void Main() {
    int N, M;
    cin >> N >> M;

    init(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        unite(a, b);
    }

    int ans = *max_element(sizes.begin(), sizes.end());
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 4780
from itertools import permutations

n = int( input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

a = [i for i in range(1,n+1)]



x = list(permutations(a,n))

y = x.index(p)
z = x.index(q)

print(abs(y-z))




Measured memory_bytes: 71476
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const LL MOD = 1e9 + 7;
const int LIMIT = 101010;
LL cMultiple[LIMIT], cDivisor[LIMIT];

// Fermat's little theorem から, 大きな冪乗の計算を行う.
// @param a: べき乗したい正整数.
// @param b: 指数.
// @return:  べき乗した計算結果(mod版).
LL mPow(LL a, LL b){
    LL t = 1;
    while(b){
        if(b & 1) t = (t * a) % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return t % MOD;
}

int main(){
    
    // 1. 入力情報.
    int N, K;
    scanf("%d %d", &N, &K);
    
    // 2. 倍数の個数を集計.
    repx(i, 1, K + 1) cMultiple[i] = mPow((LL)(K / i), (LL)N);
    // repx(i, 1, K + 1) printf("%lld ", cMultiple[i]);
    // puts("");
    
    // 3. i の 倍数であって, i * 2, i * 3, ..., i * n の 倍数でないものは？
    repr(i, K, 1){
        cDivisor[i] = cMultiple[i];
        repx(j, 2, K + 1){
            int ij = i * j;
            if(ij > K) break;
            cDivisor[i] -= cDivisor[ij];
        }
    }
    // repx(i, 1, K + 1) printf("%lld ", cDivisor[i]);
    // puts("");
    
    // 4. 最大公約数ごとに集計.
    // ex.
    // 3 6
    // -> 267 と 予想.
    // GCD = 1: 181通り.
    // GCD = 2: 222, 224, 242, 244, 422, 424, 442, 
    //               226, 262, 266, 622, 626, 662, 
    //               446, 464, 466, 644, 646, 664, 
    //               246, 264, 426, 462, 624, 642 の 25通り.
    // GCD = 3: 333, 336, 363, 366, 633, 636, 663 の 7通り
    // GCD = 4: 444
    // GCD = 5: 555
    // GCD = 6: 666
    // 1 * 181 + 2 * 25 + 3 * 7 + 4 * 1 + 5 * 1 + 6 * 1 = 267
    LL ans = 0;
    repx(k, 1, K + 1){
        ans += (LL)k * cDivisor[k];
        ans %= MOD;
    }
    
    // 5. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 5320
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

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

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


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	string s;
	cin >> s;
	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		if (s.at(i) == '1') cnt++;
	}
	dump(cnt)
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int C =sc.nextInt();
		int[][] ar=new int[C][100001];
		for(int i = 0; i<n; i++){
			int s = sc.nextInt()-1;
			int t = sc.nextInt()-1;
			int c = sc.nextInt()-1;
			for(int j=s; j<=t; j++){
				ar[c][j]=1;
			}
		}
		int ans=0;
		for(int i = 1; i<100001; i++){
			int max=0;
			for(int j = 0; j<C; j++){
				max+=ar[j][i];
			}
			ans=Math.max(ans,max);
		}
		System.out.println(ans);
	}
}

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

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

class State{
public:
	int n;
	int sum;
	int lastnum;
	State(int nn,int s,int l):n(nn),sum(s),lastnum(l){};
};

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

	int n,s;
	while(scanf("%d %d",&n,&s) != EOF && n != 0){
		vector<State> v;	//first:?????¨?????°,second:????¨????
		v.push_back(State(0,0,0));
		int ans = 0;
		while(v.size() > 0){
			int nn = v.back().n;
			int sum = v.back().sum;
			int lsn = v.back().lastnum;
			v.pop_back();
			if(nn == n){
				if(sum == s){
					ans++;
				}
				continue;
			}
			for(int i = lsn;i <= 9;i++){
				v.push_back(State(nn+1,sum+i,i+1));
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3212
#include<cstdio>  
    #include<cstring>  
    #include<iostream>  
    #include<algorithm>  
    #define LL long long  
    using namespace std;  
      
    struct good  
    {  
        int w,v;  
    }g[110];  
      
    bool cmp(good a,good b)  
    {  
        return a.v > b.v;  
    }  
    good A[110],B[110],C[110],D[110];  
      
    LL swa[110],swb[110],swc[110],swd[110];//重量的前缀和  
    LL sva[110],svb[110],svc[110],svd[110];//价值的前缀和  
      
    int main(void)  
    {  
        int n,w,i,j,k,l;  
        int a,b,c,d;  
        while(scanf("%d%d",&n,&w)==2)  
        {  
            a = b = c = d = 0;  
            for(i=1;i<=n;i++)  
            {  
                scanf("%d%d",&g[i].w,&g[i].v);  
                if(g[i].w == g[1].w)  
                    A[++a] = g[i];  
                if(g[i].w == g[1].w + 1)  
                    B[++b] = g[i];  
                if(g[i].w == g[1].w + 2)  
                    C[++c] = g[i];  
                if(g[i].w == g[1].w + 3)  
                    D[++d] = g[i];  
            }  
            sort(A+1,A+a+1,cmp);  
            sort(B+1,B+b+1,cmp);  
            sort(C+1,C+c+1,cmp);  
            sort(D+1,D+d+1,cmp);  
            swa[0] = swb[0] = swc[0] = swd[0] = 0;  
            sva[0] = svb[0] = svc[0] = svd[0] = 0;  
            for(i=1;i<=a;i++)  
            {  
                swa[i] = swa[i-1] + A[i].w;  
                sva[i] = sva[i-1] + A[i].v;  
            }  
            for(i=1;i<=b;i++)  
            {  
                swb[i] = swb[i-1] + B[i].w;  
                svb[i] = svb[i-1] + B[i].v;  
            }  
            for(i=1;i<=c;i++)  
            {  
                swc[i] = swc[i-1] + C[i].w;  
                svc[i] = svc[i-1] + C[i].v;  
            }  
            for(i=1;i<=d;i++)  
            {  
                swd[i] = swd[i-1] + D[i].w;  
                svd[i] = svd[i-1] + D[i].v;  
            }  
            int sumv = 0;  
            int ans = 0;  
            for(i=0;i<=a;i++)  
            {  
                for(j=0;j<=b;j++)  
                {  
                    for(k=0;k<=c;k++)  
                    {  
                        for(l=0;l<=d;l++)  
                        {  
                            LL sum = swa[i] + swb[j] + swc[k] + swd[l];  
                            if(sum <= (LL)w)  
                            {  
                                ans = max((LL)ans,sva[i]+svb[j]+svc[k]+svd[l]);  
                            }  
                        }  
                    }  
                }  
            }  
            cout << ans << endl;  
        }  
      
        return 0;  
    }  

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
#define MOD 1000000007
#define MAXN 200001
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
using namespace std;


int main() {
    ll n,m;
    cin >> n >> m;
    if((n%m)<=(m/2)){
        cout << n%m;
    }else{
        cout << m-(n%m);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define num(a) a-'0'
#define maxself(a,b) if(b>a)a=b
#define minself(a,b) if(b<a)a=b;
#define debug(x) cout<<#x<<":"<<x<<" "
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"	
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	int n,k;
	cin>>n>>k;
	vi h(n);
	rep(i,0,n){
		cin>>h[i];
	}
	sort(all(h));
	ll ans=0;
	for(int i=0;i<n;i++){
		if(i<n-k){
			ans+=h[i];
		}
	}
	cout<<ans<<ln;
}

int main(){
	boost_io;
	solve();
	return 0;
}

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

int main(){
int N;
cin>>N;
vector<int> dp(N);
vector<int> h(N);
for(int i=0;i<N;++i)
{
	cin>>h[i];
}
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for(int i = 2; i < N; i++)
{
  dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
}
cout<<dp[N - 1]<<endl;
}



Measured memory_bytes: 1024
#include <array>
#include <iostream>
#include <vector>

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

  // 累積
  std::vector<std::array<int, 3>> sum(n + 1);
  for (int i = n - 1; i >= 0; --i) {
    int c;
    if (s[i] == 'R')
      c = 0;
    else if (s[i] == 'G')
      c = 1;
    else if (s[i] == 'B')
      c = 2;

    sum[i][c] = sum[i + 1][c] + 1;
    sum[i][(c + 1) % 3] = sum[i + 1][(c + 1) % 3];
    sum[i][(c + 2) % 3] = sum[i + 1][(c + 2) % 3];
  }

  long long res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (s[i] == s[j])
        continue;

      int c;
      if (s[i] == 'R' && s[j] == 'G')
        c = 2;
      else if (s[i] == 'G' && s[j] == 'R')
        c = 2;
      else if (s[i] == 'G' && s[j] == 'B')
        c = 0;
      else if (s[i] == 'B' && s[j] == 'G')
        c = 0;
      else if (s[i] == 'B' && s[j] == 'R')
        c = 1;
      else if (s[i] == 'R' && s[j] == 'B')
        c = 1;

      res += sum[j + 1][c];

      int k = j + (j - i);
      if (k < n) {
        if (s[k] == 'R' && c == 0)
          res -= 1;
        if (s[k] == 'G' && c == 1)
          res -= 1;
        if (s[k] == 'B' && c == 2)
          res -= 1;
      }
    }
  }
  std::cout << res << std::endl;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(){
    int a[3];
    for(int i=0;i<3;i++) cin >> a[i];
    if(a[0] > a[1]){
        int c = a[0];
        a[0] = a[1];
        a[1] = c;
    }
    if(a[1] > a[2]){
        int c = a[1];
        a[1] = a[2];
        a[2] = c;
    }
    if(a[0] > a[1]){
        int c = a[0];
        a[0] = a[1];
        a[1] = c;
    }
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

class dice {
    private:
    vector<int> face;
    int back = 6;
    unordered_map<string, int> change;

    vector<vector<int>> apper = {
        {-1, 5, -1},
        {4, 1, 3},
        {-1, 2, -1},
    };

    vector<vector<int>> top_and_front = {
        {0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0},
    };

    public:
    void input() {
        face.push_back(0);
        for (int i = 0; i < 6; i++) {
            int temp;
            cin >> temp;
            face.push_back(temp);
            change[to_string(temp)] = i + 1;
        }

        for (int i = 0; i <= 64; i++) {
            rotation('S');
            for (int j = 0; j <= 3 + (i / 4); j++) {
                rotation('W');
                top_and_front[apper[0][1]][apper[1][1]] = apper[1][2];
                // cerr << apper[0][1] << " " << apper[1][1] << " " << apper[1][2] << endl;
            }
        }

    }

    void rotation(char S) {
        if (S == 'S') {
            int temp = apper[2][1];
            apper[2][1] = apper[1][1];
            apper[1][1] = apper[0][1];
            apper[0][1] = back;
            back = temp;
        } else if (S == 'W') {
            int temp = apper[1][0];
            apper[1][0] = apper[1][1];
            apper[1][1] = apper[1][2];
            apper[1][2] = back;
            back = temp;
        } else if (S == 'N') {
            int temp = apper[0][1];
            apper[0][1] = apper[1][1];
            apper[1][1] = apper[2][1];
            apper[2][1] = back;
            back = temp;
        } else {
            int temp = apper[1][2];
            apper[1][2] = apper[1][1];
            apper[1][1] = apper[1][0];
            apper[1][0] = back;
            back = temp;
        }
        // cout << back << endl;
    }

    int result(int a, int b) {
        return face[top_and_front[change[to_string(a)]][change[to_string(b)]]];
    }
};


signed main() {
    dice dice_one;
    dice_one.input();
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int a, b;
        cin >> a >> b;
        cout << dice_one.result(a, b) << endl;
    }
}



Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
#define ll long long
ll n;
ll arr[100005], brr[100005];
int main(){
	scanf("%lld", &n);
	for (int i = 0; i < n; i++){
		scanf("%lld%lld", &arr[i], &brr[i]);
	}
	ll curinc = 0;
	ll answer = 0;
	for (int i = n - 1; i >= 0; i--){
		if (((arr[i] + curinc)%brr[i]) == 0) continue;
		ll cc = brr[i] - ((arr[i] + curinc)%brr[i]);
		answer += cc;
		curinc += cc;
	}
	printf("%lld\n", answer);
	
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, C, K;
    cin >> N >> C >> K;

    vector<ll> T(N);
    rep (i, N) {
        cin >> T[i];
    }

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

    ll ans = N;
    ll cnt = C-1;
    ll t = T[0];
    for (ll i = 1; i < N; i++) {
        if (T[i]-t <= K && cnt > 0) {
            ans--;
            cnt--;
        } else {
            cnt = C-1;
            t = T[i];
        }
    }

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

Measured memory_bytes: 1024
import scala.io.StdIn
import Math.{sin,cos,pow,sqrt}
/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {
    val in = StdIn.readLine().split(" ").map(_.toDouble)
    val a = in(0)
    val b = in(1)
    val C = in(2)

    val RadinanC = Math.toRadians(C)
    val h = b * sin(RadinanC)
    val S = a * h / 2
    val L = a + b + sqrt(pow(a,2) + pow(b,2) - 2 * a * b * cos(RadinanC))

    println("%.8f".format(S))
    println("%.8f".format(L))
    println("%.8f".format(h))
  }
}

Measured memory_bytes: 43900
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if(A == B && C  != A || B == C && A != B || C == A && B != C) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}
}

Measured memory_bytes: 35684
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
char s[111];
int main(){
	scanf("%s",s+1);
	cout<<s[1]<<s[2]<<s[3];
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;

/* [💭] [💡] [🎈] */

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

    map<string, int> mp;

    int n;
    cin >> n;
    while (n--) {
        string str;
        cin >> str;
        mp[str]++;
    }

    for (auto s : {"AC", "WA", "TLE", "RE"}) {
        cout << s << " x " << mp[s] << '\n';
    }

    return 0;
}

Measured memory_bytes: 3664
#include <iostream>

using namespace std;

unsigned long N, x, a[100000];

int main()
{
	cin >> N >> x;
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
	}

	unsigned long n = 0;

	for (int i = 0; i < N; ++i)
	{
		if (a[i] > x)
		{
			n += a[i] - x;
			a[i] = x;
		}
	}

	for (int i = 1; i < N; ++i)
	{
		if (a[i - 1] + a[i] > x)
		{
			unsigned long count = a[i - 1] + a[i]  - x;
			if (a[i] >= count)
			{
				n += count;
				a[i] -= count;
			}
			else
			{
				n += a[i];
				a[i] = 0;
			}
		}
	}

	cout << n << endl;
}

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

class IntVector : public std::vector<int>
{
public:
	void Input(int Count);
	bool Search(int Target);
};

void IntVector::Input(int Count)
{
	for(int i=0;i<Count;i++)
	{
		int Input;
		std::cin >> Input;
		push_back(Input);
	}
}

bool IntVector::Search(int Target)
{
	for(unsigned int i=0;i<size();i++)
	{
		if(at(i) == Target) return true;
	}
	return false;
}

int main()
{
	int n = 0;
	std::cin >> n;
	IntVector S;
	S.Input(n);
	int q = 0;
	std::cin >> q;
	int Count = 0;
	for(int i=0;i<q;i++)
	{
		int T;
		std::cin >> T;
		Count += S.Search(T);
	}
	
	std::cout << Count << std::endl;
	return 0;
}

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

int main(){
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
	}
  }
  
  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; i++){
    cin >> b[i];
  }
  
  for (int k = 0; k < n; k++){
    for (int i = 0; i < 3; i++){
      for (int j = 0; j < 3; j++){
        if (a[i][j] == b[k]){
          a[i][j] = 1;
        }
      }
    }
  }
	
    int ans = 0;
	if (a[0][0] == 1 && a[0][1] == 1 && a[0][2] == 1){
      ans++;
    }
	if (a[1][0] == 1 && a[1][1] == 1 && a[1][2] == 1){
      ans++;
    }
	if (a[2][0] == 1 && a[2][1] == 1 && a[2][2] == 1){
      ans++;
    }
	if (a[0][0] == 1 && a[1][1] == 1 && a[2][2] == 1){
      ans++;
    }
	if (a[0][0] == 1 && a[1][0] == 1 && a[2][0] == 1){
      ans++;
    }
	if (a[0][1] == 1 && a[1][1] == 1 && a[2][1] == 1){
      ans++;
    }
	if (a[0][2] == 1 && a[1][2] == 1 && a[2][2] == 1){
      ans++;
    }
	if (a[0][2] == 1 && a[1][1] == 1 && a[2][0] == 1){
      ans++;
    }
	
  if (ans >= 1){
	cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int a[5];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  fill(a, a + 5, 0);
  REP(i, n) {
    string s;
    cin >> s;
    if(s[0] == 'M') a[0]++;
    else if(s[0] == 'A') a[1]++;
    else if(s[0] == 'R') a[2]++;
    else if(s[0] == 'C') a[3]++;
    else if(s[0] == 'H') a[4]++;
  }

  ll ans = 0;
  REP(i, 5) {
    FOR(j, i + 1, 5) {
      FOR(k, j + 1, 5) {
        ans += 1LL * a[i] * a[j] * a[k];
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
li=input().split(" ")
a=int(li[0])
b=int(li[1])
c=int(li[2])
d=int(li[3])
stop=0
while stop==0:
    c-=b
    if c<=0 and stop == 0:
        stop=2
    a-=d
    if a<=0 and stop == 0:
        stop=1
    
if stop ==1:
    print("No")
if stop==2:
    print("Yes")

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(15);
#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif
    long long a[6];
    long long ans=0;
    for(long long i=1;i<=5;i++){
        cin>>a[i];
        if(a[i]==0){
            ans=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = int64_t;

// 素因数分解 O(√N)
//
// for (const auto &e : divisors) {
//    tmp *= pow(e.first, e.second);
//}
// tmp == n
//
map<ll, int> pf(ll n) {
    map<ll, int> res;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i], n /= i;
        }
    }
    if (n != 1) {
        res[n]++;
    }
    return res;
}

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

    ll a, b;

    cin >> a >> b;

    map<ll, int> divsa, divsb;

    divsa = pf(a);
    divsb = pf(b);

    int ctr = 1;
    for (const auto &e : divsa) {
        if (divsb.find(e.first)->first == e.first) {
            ctr++;
        }
    }

    cout << ctr;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN=200010;
int n,ans,mn,p[MAXN];
int main () {
	scanf("%d",&n);
	mn=n+1;
	for (int i=1;i<=n;i++) {
		scanf("%d",&p[i]);
		mn=min(mn,p[i]);
		if (p[i]==mn) {ans++;}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
(defun iota (start end &optional lst (c start))
  (if (= c end)
      (reverse lst)
      (iota start end (cons c lst) (1+ c))))

(defun solve (k x)
  (iota (1+ (- x k)) (+ x k)))

(defun main ()
  (let ((k (read))
        (x (read)))
    (let ((ans (solve k x)))
      (dotimes (i (length ans))
        (princ (elt ans i))
        (princ #\Space)))
    (fresh-line)))

(main)


Measured memory_bytes: 24244
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int main(void){
    int N,K;
    cin >> N >> K;
    int f[N];
    rep(i,N){
        f[i]=1;
    }
    rep(i,K){
        int d;
        cin >> d;
        rep(j,d){
            int tmp;
            cin >> tmp;
            f[tmp-1]=0;
        }
    }
    int ans=0;
    rep(i,N){
        if(f[i]==1)ans++;
    }
    cout  << ans<<endl;
    return 0;
}


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

int main() {
  int x, n, p;
  cin >> x >> n;
  vector<int> pp(101);
  rep(i, n) {
    cin >> p;
    pp[p] = 1;
  }
  int diff = 0;
  while (true) {
    if (pp[x - diff] == 0) {
      cout << x - diff << endl;
      break;
    } else if (pp[x + diff] == 0) {
      cout << x + diff << endl;
      break;
    }
    diff++;
  }
  return 0;
}


Measured memory_bytes: 3624
let id x = x
let n = Scanf.scanf "%d\n" id

let rec lucas n =
  let rec lucas_pair n =
    match n with
    | 0 -> (2,0)
    | 1 -> (1,2)
    | m -> let (i,j) = lucas_pair (n-1) in (i+j,i)
  in let (i,_) = lucas_pair n in i

let ans = lucas n

let () =
  Printf.printf "%d\n" ans

Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5+5;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    int sum=0;
    for(int i=1;i<=n;i++) sum+=a[i];
    int tmp=sum/n;
    long long ans=0;
    long long maxx=INF;
    for(int j=tmp-1;j<=tmp+1;j++)
    {
        ans=0;
        for(int i=1;i<=n;i++) ans+=1LL*(j-a[i])*(j-a[i]);
        maxx=min(maxx,ans);
    }
    printf("%lld\n",maxx);
    return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
inp=[list(map(int,input().split())) for i in range(M)]
P=[[] for i in range(N)]

for i in range(0,len(inp)):
    P[inp[i][0]-1]+=[inp[i][1]]
for i in range(N):
    P[i].sort()

for i in range(0,len(inp)):
    a=P[inp[i][0]-1]
    b=inp[i][1]
    max=len(a)
    min=-1

    while(max>=min):
        mid=int((max+min)/2)
        if(a[mid]==b):
            print(str(inp[i][0]).zfill(6)+str(mid+1).zfill(6))
            break
        elif(a[mid]<b):
            min=mid+1
        else:
            max=mid-1



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

// 正しいとは限らない括弧列で()を相殺していくと)..)(..(になることと同じ発想
int main(){
  string S;
  cin >> S;


  int cumsum= 0;
  int cs_min= 0;
  for(auto c:S){
    if(c=='S'){ cumsum++; }
    else      { cumsum--; }

    cs_min= min(cs_min, cumsum);
  }
  
  int ans= 2*(0- cs_min);

  cout << ans << endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n,x,t;cin>>n>>x>>t;

  cout<< (n/x*t)+(n%x > 0 ? 1 : 0)*t << endl;

  return 0;
}

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

int main() {
    ll N, D;
    cin >> N >> D;
    vector<ll> X(N);
    vector<ll> Y(N);
    for (ll i=0; i<N; i++) {
        cin >> X.at(i) >> Y.at(i);
    }
    vector<ll> L(N);
    for (ll i=0; i<N; i++) {
        L.at(i) = pow(X.at(i),2) + pow(Y.at(i),2);
    }
    ll count = 0;
    for (ll i=0; i<N; i++) {
        if(pow(D,2)>=L.at(i)) {
            count++;
        }
    }
    cout << count << endl;
}

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

long long gcd(long x, long y)
{
    if (y == 0)
        return x;

    return gcd(y, x % y);
}
long long lcm(long x, long y)
{
    return x * y / gcd(x, y);
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}

int main()
{
    string A, B, C;
    char x = 'a';
    int a = 0, b = 0, c = 0;
    cin >> A >> B >> C;

    while (1)
    {
        if (x == 'a')
        {
            if (A.length() == a)
            {
                cout << "A" << endl;
                break;
            }
            x = A[a];
            a++;
        }
        else if (x == 'b')
        {
            if (B.length() == b)
            {
                cout << "B" << endl;
                break;
            }
            x = B[b];
            b++;
        }
        else
        {
            if (C.length() == c)
            {
                cout << "C" << endl;
                break;
            }
            x = C[c];
            c++;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    string t;int num;cin >> t >> num;
    int n = t.size();
    vector<vector<vl>> dp(n+10, vector<vl>(2,vl(num,0)));
    dp[0][0][0] = 1;
    for(int i=0;i<n;++i){
        int D = t[i] - '0';
        for(int k=0;k<num;++k){
            for(int j=0;j<2;++j){
                for(int d=0;d<=(j?9:D);++d){
                    dp[i+1][j || (d<D)][(k+d)%num] += dp[i][j][k];
                    dp[i+1][j || (d<D)][(k+d)%num] %= MOD;
                }
            }
        }
    }
    cout << (dp[n][0][0] + dp[n][1][0] - 1 + MOD) % MOD << endl;
}

Measured memory_bytes: 17024
#include<stdio.h>
	int main(){
		int i,k,l,a[5],b[5];
		while(1){
			scanf("%d %d",&a[0],&b[0]);
			if(a[0]==0&&b[0]==0)break;
			l=a[0]+b[0];
			k=0;
			for(i=1;i<5;i++){
				scanf("%d %d",&a[i],&b[i]);
				if(l<a[i]+b[i]){
				k=i;
				l=a[i]+b[i];
				}
			}
			printf("%c %d\n",'A'+k,a[k]+b[k]);
		}
		return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}

/*------------------------------------------------------------------------*/

constexpr ll MOD = 1e9 + 7;

void solve();

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

    solve();
}

void solve() {
    ll n, a, b;
    std::cin >> n >> a >> b;

    auto modpow = [](ll x, ll n, ll mod) -> ll {
        ll k = 1;
        for (; n > 1; n /= 2) {
            if (n & 1) (k *= x) %= mod;
            (x *= x) %= mod;
        }

        return (k * x) % mod;
    };

    auto modcomb = [=](ll n, ll r, ll mod) -> ll {
        chmin(n - r, r);

        ll mul = 1, div = 1;
        for (ll i = 0; i < r; i++) {
            (mul *= n - i) %= mod;
            (div *= i + 1) %= mod;
        }

        return (mul * modpow(div, mod - 2, mod)) % mod;
    };

    ll ans = (modpow(2, n, MOD) - 1 - (modcomb(n, a, MOD) + modcomb(n, b, MOD)) % MOD + MOD) % MOD;

    std::cout << ans << '\n';
}


Measured memory_bytes: 3576
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll a, b, c;

int main() {
	cin >> a >> b >> c;
	if (a + b + c >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
	return 0;
}

Measured memory_bytes: 256