akhauriyash/Code-Regression huggingface dataset:
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rep(I, N) for (ll I = 0; I < (N); ++I)
#define repp(I, a, B) for (ll I = (a); I <= (B); ++I)
#define inn ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);srand(time(NULL));cout<<fixed<<setprecision(10);clock_t clk;clk = clock();
#define outt clk=clock()-clk;cerr<<fixed<<setprecision(6)<<"Time: "<<((double)clk)/CLOCKS_PER_SEC<<"\n";return 0;
using namespace std;
#define TRACE
#ifdef TRACE
#define t(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define t(...)
#endif
const int N = 1e5 + 5;
const int MAX = 2e6 + 5;
const int MOD = 1000000007;

ll n, x;
ll arr[N];
int bit[45][N];

signed main()
{
    inn;

    ll num = 0;
    cin >> n >> x;
    repp(j,1,n)
    {
        cin >> arr[j];
        ll temp = arr[j];
        for(ll i = 42; i >= 0; i--)
        {
            if(temp & (1LL << i))
            {
                bit[i][j] = 1;
            }
        }
    }
    ll mx = -1;
    for(ll i = 42; i >= 0; i--)
    {
        if((1LL << i) & x)
        {
            mx = i;
            break;
        }
    }
    for(ll i = mx; i >= 0; i--)
    {
        int cnt = 0;
        for(int j = 1; j <= n; j++)
        {
            if(bit[i][j])
            {
                ++cnt;
            }
        }
        if(cnt < n - cnt) 
        {
            ll temp = (1LL << i);
            if(num + temp <= x) num += temp;
        }
    }
    ll sum = 0;
    for(ll i = 1; i <= n; i++)
    {
        ll tmp = arr[i];
        tmp ^= num;
        sum += tmp;
    }
    cout << sum << "\n";


    outt;
}

Measured memory_bytes: 17408
#include<bits/stdc++.h>
#define ll long long
#define F(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define i64 int64_t
#define fi first
#define se second
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	string s;
	cin>>s;
	string res=string(s.size(),'x');
	cout<<res;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<random>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e16;

lint N, K;
lint arr[2000];
int main() {
	cin >> N >> K;
	REP(i, N) {
		cin >> arr[i];
	}
	lint ans = 0;
	REP(i, N) {
		lint cnt1 = 0, cnt2 = 0;
		REP(j, N) {
			if (arr[i] > arr[j]) {
				cnt2++;
				if (i < j) {
					cnt1++;
				}
			}
		}
		(ans += cnt1 * K + cnt2 * ((K * (K - 1) / 2) % MOD)) %= MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>

void arr_printer(const int *arr, const int N) {
    char buf[11];
    int n;
    for(int i = 0; i < N-1; ++i) {
        n = arr[i];
        if(!n) {
            putchar_unlocked('0');
            putchar_unlocked(' ');
            continue;
        }
        int j = 0;
        while(n) buf[j++] = (char)(n % 10 + '0'), n /= 10;
        while(j--) putchar_unlocked(buf[j]);
        putchar_unlocked(' ');
    }
    n = arr[N-1];
    if(!n){
        putchar_unlocked('0');
        putchar_unlocked('\n');
        return;
    }
    int j=0;
    while(n) buf[j++] = (char)(n % 10 + '0'), n /= 10;
    while(j--) putchar_unlocked(buf[j]);
    putchar_unlocked('\n');
}

int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) {
        n = 10 * n + (c & 0xf);
        c = getchar_unlocked();
    }
    return n;
}
int cnt;
void merge(int *first, int *mid, int *last) {
    const int N1 = (int)(mid - first);
    const int N2 = (int)(last - mid);
    int *left = malloc(sizeof(int) * (N1 + 1));
    int *right = malloc(sizeof(int) * (N2 + 1));
    memcpy(left, first, sizeof(int) * (N1 + 1));
    memcpy(right, mid, sizeof(int) * (N2 + 1));
    left[N1] = right[N2] = 1000000000;
    for(int *it = first, i = 0, j = 0; it != last; ++it) {
        *it = left[i] <= right[j] ? left[i++] : right[j++];
    }
    free(left);
    free(right);
}
void merge_sort(int *first, int *last) {
    const int N = (int)(last - first);
    if(N < 2) return;
    int *mid = first + N / 2;
    merge_sort(first, mid);
    merge_sort(mid, last);
    merge(first, mid, last);
    cnt += N;
}
int main(int argc, char **argv) {
    int n = get_uint();
    int s[500001];
    for(int i = 0; i < n; ++i) s[i] = get_uint();
    merge_sort(s, s + n);
    arr_printer(s, n);
    printf("%d\n", cnt);
    return 0;
}



Measured memory_bytes: 5372
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;

int n, k;
vector<int> books[11];
int dp[11][2001];
int main()
{
  //chap1
  for(int i = 1; i <= 10; i++)
    books[i].push_back(0);
  
  //chap2
  cin >> n >> k;
  for(int i = 0; i < n; i++){
    int c, g;
    cin >> c >> g;
    books[g].push_back(c);
  }

  //chap3
  for(int i = 1; i <= 10; i++)
    sort(books[i].begin() + 1, books[i].begin() + books[i].size(), greater<int>());  
  
  //chap4
  for(int i = 1; i <= 10; i++)
    for(int j = 2; j < books[i].size(); j++)
      books[i][j] += books[i][j - 1] + 2 * (j - 1);

  //chap4
  for(int i = 1; i <= 10; i++)
    for(int j = 0; j <= k; j++)
      for(int sell = 0; sell + j <= k && sell < books[i].size(); sell++)
	dp[i][j + sell] = max(dp[i][j + sell], dp[i - 1][j] + books[i][sell]);

  cout << dp[10][k] << endl;
  return 0;
}

Measured memory_bytes: 1316
num = list("0123456789")
large = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
small = list("abcdefghijklmnopqrstuvwxyz")

S = input()
if len(S) < 6:
    print("INVALID")
    exit()

flag_n, flag_l, flag_s = False, False, False
for s in S:
    if s in num:
        flag_n = True
    elif s in large:
        flag_l = True
    elif s in small:
        flag_s = True

if flag_n and flag_l and flag_s:
    print("VALID")
else:
    print("INVALID")


Measured memory_bytes: 5564
input1= []

try:
    while True:
        s = input()
        if s == '':
            break
        input1.append(s)

except EOFError:
    pass

for s in input1:

 list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

 print(list[int(s)-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n)  for (int i = 0; i <  (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
const int MOD = 1000000007;

int main() {
  int Ans = 0;  // 回答：
  int N; cin >> N;  // 夏休み日数：1～10^5
  vector<vector<int>> A(N,vector<int>(3,0));  // 各日程の楽しさ
  rep(i,N){
    cin >> A.at(i).at(0); // A:泳ぐ
    cin >> A.at(i).at(1); // B:虫取り
    cin >> A.at(i).at(2); // C:宿題
  }
  vector<vector<int>> DP(N,vector<int>(3,0)); // 各日程での作業別楽しさ最大値

  // 初日の楽しさ設定
  rep(i,3){
    DP.at(0).at(i) = A.at(0).at(i); // 初日の楽しさは、それぞれをそのまま
  }

  rep1(i,N-1){      // i日目の楽しさ算出
    rep(j,3){       // jをした場合の累積楽しさ最大値算出
      rep(k,3){     // 前日に k をした場合、毎に加算元が異なる。
        if(j!=k) {  // 但し、前日と同じ事はしない
          DP.at(i).at(j) = max(DP.at(i).at(j), DP.at(i-1).at(k)+A.at(i).at(j) );
        }
      }
    }
  }

  // 最終日の最大の楽しさ判定
  rep(i,3){
    Ans = max(Ans , DP.at(N-1).at(i));
  }

  cout << Ans << endl;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;

//二項係数
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll N,M,K;
    cin>>N>>M>>K;
    COMinit();
    ll P=COM(N*M-2,K-2);
    ll Q1=0,Q2=0;
    for(ll i=1;i<=N;i++){
        Q1+=(i-1)*i/2+(N-i)*(N-i+1)/2;
        Q1%=MOD;
    }
    Q1*=M;
    Q1%=MOD;
    Q1*=M;
    Q1%=MOD;
    for(ll i=1;i<=M;i++){
        Q2+=(i-1)*i/2+(M-i)*(M-i+1)/2;
        Q2%=MOD;
    }
    Q2*=N;
    Q2%=MOD;
    Q2*=N;
    Q2%=MOD;
//cout<<Q1<<" "<<Q2<<endl;
    ll Q=Q1+Q2;
    Q%=MOD;
    Q*=finv[2];
    Q%=MOD;
    Q*=P;
    Q%=MOD;
    cout<<Q<<endl;
}

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

int main(){
  int N; cin >>N;
  string S;cin >>S;
  
  int ans = 1;
  
  for(int i=1;i<N;i++){
    if(S[i] != S[i-1]){
      ans ++;
    }
  }
  
  cout << ans << endl;
}

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

#define ll long long
#define ld long double
#define debug(x) \
	//    (cout << #x << ": " << (x) << endl)
#define eb emplace_back
#define fi first
#define se second

using namespace std;

const int nm = 200002;

int n;
pair<ll, bool> a[2 * nm];

pair<ll, ll> get(int k) {
	int o = 0, c = 0, cur = 0;
	ll x1 = -1, x2 = -1;
	for (int i = 1; i <= 2 * n; ++i) {
		if (!a[i].se) {
			o++;
			cur++;
		}
		if (o >= k && c < k && cur > 0) {
			if (x1 == -1) {
				x1 = a[i].fi;
			}
			x2 = a[i].fi;
		}
		if (a[i].se) {
			c++;
			cur--;
		}
	}
	return {x1, x2};
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld%lld", &a[2 * i - 1].fi, &a[2 * i].fi);
		a[2 * i - 1].se = 0;
		a[2 * i].se = 1;
	}
	sort(a + 1, a + 2 * n + 1);
	if (n & 1) {
		auto p = get(n / 2 + 1);
		cout << p.se - p.fi + 1 << "\n";
		return 0;
	}
	auto p1 = get(n / 2), p2 = get(n / 2 + 1);
	cout << (p2.se + p1.se - p2.fi - p1.fi + 1) << "\n";
}


Measured memory_bytes: 10012
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    if a == 0:
        sum += k * k
        continue
    else:
        for b in range(k):
            if b == 0:
                sum += k
                continue
            else:
                for c in range(k):
                    if c == 0:
                        sum += 1
                    else:
                        sum += gcd3(a+1,b+1,c+1)
print(sum)

Measured memory_bytes: 67868
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int n;
int p[11];
int main() {
	cin >> n;
	rep(i, n)cin >> p[i];
	sort(p, p + n);
	p[n - 1] /= 2;
	int ans = 0;
	rep(i, n)ans += p[i];
	cout << ans << endl;
	getchar();getchar();
	return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D){
    while(true){
        if(C - B <= 0){
            cout << YES << endl;
            break;
        }else if(A - D <= 0){
            cout << NO << endl;
            break;
        }
        A -= D;
        C -= B;
    }
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


Measured memory_bytes: 3768
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for i in B:
  ans += bisect.bisect_left(A, i) * (n - bisect.bisect_right(C, i))
print(ans)

Measured memory_bytes: 23092
#include <stdio.h>
int main(){
  int S,h,m,s;
  scanf("%d",&S);
  h=S/3600;
  m=(S-h*3600)/60;
  s=S-h*3600-m*60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

Measured memory_bytes: 1020
//#include "gap.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <fstream>
#include <bitset>
#include <time.h>
#include <queue>
#define int long long
using namespace std;
int32_t main(){
    int n, k;
    cin >> k >> n;
    if (k % 2 == 0){
        cout << k / 2 << " ";
        for (int i=1; i < n; i++){
            cout << k << " ";
        }
        return 0;
    }
    vector<int> v;
    int K = k/2 + 1;
    for (int i=0; i < n; i++){
        v.push_back(K);
    }
    int sdv = n/2;
    int l = -1;
    for (int i=0; i < sdv; i++){
        if (l == -1){
            v[n-1]--;
            if (v[n-1] == 0) l = n-1;
        }
        else{
            if (v[l-1] == 1){
                v[l-1] = 0;
                l--;
            }
            else{
                v[l-1]--;
                for (int j=l; j < n; j++) v[j] = k;
                l = -1;
            }
        }
    }
    for (int i=0; i < n; i++){
        if (v[i] == 0) break;
        cout << v[i] << " ";
    }
    return 0;
}


Measured memory_bytes: 6256
#include <stdio.h>
#include <vector>
using namespace std;

vector<int> road[200005];
vector<int> way[200005];
int id[200005];
int cnt[200005];
int vs[200005], vs2[200005], vs3[200005];
int res[200005];

int ptr;

void dfs(int v){
    if(id[v]) return;
    id[v] = ptr;
    for(int i=0; i<road[v].size(); i++) dfs(road[v][i]);
    return;
}

void initialize(int v){
    if(vs[v]) return;
    vs[v] = 1;
    cnt[id[v]]++;
    for(int i=0; i<way[v].size(); i++) initialize(way[v][i]);
    return;
}

void run(int v){
    if(vs2[v]) return;
    vs2[v] = 1;
    res[v] = cnt[id[v]];
    for(int i=0; i<way[v].size(); i++) run(way[v][i]);
    return;
}

void rem(int v){
    if(vs3[v]) return;
    vs3[v] = 1;
    cnt[id[v]]--;
    for(int i=0; i<way[v].size(); i++) rem(way[v][i]);
    return;
}

int main(){
    int N, K, L;
    scanf("%d%d%d", &N, &K, &L);
    for(int i=0; i<K; i++){
        int p, q;
        scanf("%d%d", &p, &q);
        road[p].push_back(q);
        road[q].push_back(p);
    }
    for(int i=1; i<=N; i++) ptr = i, dfs(i);
    for(int i=0; i<L; i++){
        int r, s;
        scanf("%d%d", &r, &s);
        way[r].push_back(s);
        way[s].push_back(r);
    }
    for(int i=1; i<=N; i++){
        initialize(i);
        run(i);
        rem(i);
    }
    for(int i=1; i<=N; i++) printf("%d ", res[i]);
    return 0;
}

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

template<typename T>
struct BIT {
    int n;
    vector<T> d;
    BIT(int n = 0) : n(n), d(n + 1) {}
    void add(int i, T x = 1) {
        for(i++; i <= n; i += i & -i) {
            d[i] += x;
        }
    }

    T sum(int i) {
        T x = 0;
        for(i++; i; i -= i & -i) {
            x += d[i];
        }
        return x;
    }

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

int main()
{
    int n, q;
    cin >> n >> q;
    BIT<long long> tree(n);
    for(int i = 0; i < n; i++) {
        long long x;
        cin >> x;
        tree.add(i, x);
    }
    for(int i = 0; i < q; i++) {
        long long x, a, b;
        cin >> x >> a >> b;
        if(x == 0) tree.add(a, b);
        else cout << tree.sum(a, b) << endl;;
    }
    return 0;
}


Measured memory_bytes: 8224
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		std::vector<int> num;
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (; x; x /= 10) {
			num.push_back(x % 10);
		}
		while (!num.empty()) {
			putchar(num.back() ^ '0');
			num.pop_back();
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

int n, k;

int main() {
	read(n), read(k);
	std::vector<std::pair<int, int>> ans;
	int p1 = 0, p2 = (n - 1) / 2;
	while (p1 < n) {
		ans.push_back({p1, p2 + n});
		p1 += 2, --p2;
	}
	p1 = 1, p2 = n - 1;
	while (p1 < n) {
		ans.push_back({p1, p2 + n});
		p1 += 2, --p2;
	}
	for (int i = 0; i < (int)ans.size(); ++i) {
		int x = ans[i].first, y = ans[i].second;
		if (x + y > 2 * n + i - k) {
			print(-1);
			return 0;
		}
	}
	for (int i = 0; i < (int)ans.size(); ++i) {
		int x = ans[i].first, y = ans[i].second;
		print(x + k, ' '), print(y + k, ' '), print(2 * n + i + k);
	}
}


Measured memory_bytes: 5504
def checker(m, f, r):
    if score >= 80:
        print('A')
    elif score < 30:
        print('F')
    elif score >=65 and score < 80:
        print('B')
    elif score >=30 and score < 50 and r < 50:
        print('D')
    else:
        print('C')

while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    else:
        score = m + f
        checker(m, f, r)





Measured memory_bytes: 5600
N = int(input())
S = [input() for i in range(N)]
num = [0] * 5
ans = 0

for i in range(N):
    if S[i][0] == 'M':
        num[0] += 1
    elif S[i][0] == 'A':
        num[1] += 1
    elif S[i][0] == 'R':
        num[2] += 1
    elif S[i][0] == 'C':
        num[3] += 1
    elif S[i][0] == 'H':
        num[4] += 1

for i in range(3):
    for j in range(i+1, 4):
        for k in range(j+1, 5):
            ans += num[i]*num[j]*num[k]
    
print(ans)

Measured memory_bytes: 9772
#include <bits/stdc++.h>
using namespace std;
template<typename T>
inline T read(T&x){
	x=0;int f=0;char ch=getchar();
	while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
	while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x=f?-x:x;
}
const int N=2000+10;
int n,K,q,i,j,k,cnt,a[N],b[N],res[N];
int main(){
	read(n),read(K),read(q);
	for (i=1;i<=n;i++) read(a[i]);
	int ans=1000000000+7;
	for (i=1;i<=n;i++){
		int l=0;
		for (cnt=0,j=1;j<=n+1;j++){
			if (a[j]<a[i]){
				if (!l) continue;
				int r=j-1;
				for (k=l;k<=r;k++) b[k]=a[k];
				sort(b+l,b+r+1);
				for (k=l;k+K-1<=r;k++) res[++cnt]=b[k];
				l=0;
			}
			else if (!l) l=j;
		}
		if (cnt<q) continue;
		sort(res+1,res+cnt+1);
		ans=min(ans,res[q]-a[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int n;
vector<int> w(310);

int main(){
    int n;
    while (cin >> n,n){
        rep(i,n) cin >> w[i];
        vector<vector<int>> dp(n,vector<int>(n,0));
        rep(j,n){
            for (int i=0;i+j<n;i++){
                rep(k,j) chmax(dp[i][i+j],dp[i][i+k]+dp[i+k+1][i+j]);
                if (j!=0&&abs(w[i]-w[i+j])<=1&&(j==1||dp[i+1][i+j-1]==j-1)){
                    chmax(dp[i][i+j],dp[i+1][i+j]+2);
                }
            }
        }
        cout << dp[0][n-1] << endl;
    }
}


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

int main(void) {
    int n[101][101] = {};
    int r, c;
    
    cin >> r >> c;
    
    for(int i = 0; i < r; ++i) {
        for(int j = 0; j < c; ++j) {
            cin >> n[i][j];
        }
    }
    for(int i = 0; i < r; ++i) {
        for(int j= 0; j < c; ++j) {
            n[i][c] += n[i][j];
        }
    }
    for(int i = 0; i < c + 1; ++i) {
        for(int j = 0; j < r; ++j) {
            n[r][i] += n[j][i];
        }
    }
    for(int i = 0; i < r + 1; ++i) {
        cout << n[i][0];
        for(int j = 1; j < c + 1; ++j) {
            cout << ' ' << n[i][j];
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3120
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>
using namespace std;
typedef pair<int,int> _P;
typedef pair<_P,int> P;
char M[10][10];
int dx[]={-1,0,1,2,2,2,1,0,-1,-2,-2,-2};
int dy[]={2,2,2,1,0,-1,-2,-2,-2,-1,0,1};
int main() {
	int px,py,n,sx,sy;
	while(scanf("%d %d",&px,&py),px) {
		memset(M,0,sizeof(M));
		scanf("%d",&n);
		for(int i=1;i<=n;i++) {
			scanf("%d %d",&sx,&sy);
			M[sx][sy]=i;
		}
		queue<P> Q;
		Q.push(P(_P(px,py),1));
		bool OK=false;
		while(!Q.empty()) {
			P p=Q.front();Q.pop();
			if(p.second==(n+1)) {OK=true;break;} 
			for(int i=0;i<12;i++) {
				int nx=p.first.first+dx[i],ny=p.first.second+dy[i];
				if(0>nx||nx>=10||0>ny||ny>=10)continue;
				bool OK=false;
				for(int i=-1;i<=1;i++) {
					for(int j=-1;j<=1;j++) {
						if(0>(nx+i)||(nx+i)>=10||0>(ny+j)||(ny+j)>=10)continue;
						if(M[nx+i][ny+j]==p.second)OK=true; 
					}
				}
				if(OK) {
					Q.push(P(_P(nx,ny),p.second+1));
				}
			}
		}
		printf("%s\n",OK?"OK":"NA");
	}
}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, s, p;
  in(n);
  vector<ll> a(n), b(n);
  rep(i, n){
    in(a[i]);
    b[a[i]]++;
  }
  s = 0;
  if(n % 2 == 1){
    rep(i, n){
      if(i == 0){
        if(b[i] != 1)
          s++;
      }
      else if(i % 2 == 0){
        if(b[i] != 2)
          s++;
      }
      else{
        if(b[i] != 0)
          s++;
      }
    }
  }
  else{
    rep(i, n){
      if(i % 2 == 1){
        if(b[i] != 2)
          s++;
      }
      else{
        if(b[i] != 0)
          s++;
      }
    }
  }
  if(s != 0){
    out(0);
    memi;
    return 0;
  }
  s = 0;
  rep(i, n){
    if(b[i] == 2)
      s++;
  }
  p = 1;
  rep(i, s)
    p = p * 2 % mei;
  out(p);
  memi;
}


Measured memory_bytes: 1792
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            String line = br.readLine();
            String[] dataArray = line.split(" ");
            int x = Integer.parseInt(dataArray[0]);
            int y = Integer.parseInt(dataArray[1]);
            if(x<y) System.out.println(Result.LessThan.getValue());
            if(x==y) System.out.println(Result.Equal.getValue());
            if(x>y) System.out.println(Result.GreaterThan.getValue());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

   public enum Result{
    	LessThan("a < b"),
    	Equal("a == b"),
    	GreaterThan("a > b");

	   private String name;

	   private Result(String name) {
	        this.name = name;
	    }
	    
        public String getValue() {
            return this.name;
        }
   };
}

Measured memory_bytes: 24160
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <list>

#define mp make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 1000;
const int inf = 1e9;
const long double eps = 1e-8;
const int Q = 1e9 + 7;

void add(map<int, int> &m, int x) {
    if (m.find(x) != m.end())
        m[x]++;
    else
        m.insert(mp(x, 1));
}

void remove(map<int, int> &m, int x) {
    if (m.find(x) != m.end()) {
        m[x]--;
        if (m[x] == 0)
            m.erase(x);
    }
}

int a[MAXN][MAXN];

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

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

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

    if (a[n - 1] - a[0] > 1) {
        cout << "No";
        return 0;
    }

    if (a[0] == a[n - 1]) {
        if (a[0] * 2 <= n || a[0] == n - 1)
            cout << "Yes";
        else
            cout << "No";
    } else {
        int count = 0;
        for (int i = 0; i < n; i++)
            if (a[i] == a[0])
                count++;
            else
                break;

        if (a[0] < count) {
            cout << "No";
            return 0;
        }

        if (2 * (a[n - 1] - count) <= n - count)
            cout << "Yes";
        else
            cout << "No";
    }

    return 0;
}

Measured memory_bytes: 640
use proconio::input;

fn main() {
    input! {
        n: usize,
        q: usize,
//        a: [u64; n],
    }

    let mut t = FenwickTree::new(n);
    for i in 0..n {
        input! { a: u64 }
        let v = t.v[i] + a;
        t.v[i] = v;
        let p = i + FenwickTree::<u64>::lsb(i + 1);
        if p < n {
            t.v[p] += v;
        }
    }
//    let mut t = FenwickTree::from_vec(a);
    for _ in 0..q {
        input! { f: usize };
        if f == 1 {
            input! { l: usize, r: usize }
            println!("{}", t.sum(l, r));
        } else {
            input! { p: usize, x: u64 }
            t.add(p, x);
        }
    }
}

struct FenwickTree<T> {
    v: Vec<T>,
}

use std::ops::AddAssign;
use num::{Integer, zero};

impl<T: Copy + AddAssign + Integer> FenwickTree<T> {
    fn new(n: usize) -> Self {
        Self {
            v: vec![zero(); n],
        }
    }

    fn from_vec(v: Vec<T>) -> Self {
        let n = v.len();
        let mut t = Self::new(n);
        for i in 0..n {
            let v = t.v[i] + v[i];
            t.v[i] = v;
            let p = i + Self::lsb(i + 1);
            if p < n {
                t.v[p] += v;
            }
        }
        t
    }

    fn add(&mut self, i: usize, v: T) {
        let mut i = i;
        while i < self.v.len() {
            self.v[i] += v;
            i += Self::lsb(i + 1);
        }
    }

    fn sum(&self, l: usize, r: usize) -> T {
        self.get(r) - self.get(l)
    }

    fn get(&self, mut i: usize) -> T {
        let mut v = zero();
        while i > 0 {
            v += self.v[i - 1];
            i -= Self::lsb(i);
        }
        v
    }

    fn lsb(i: usize) -> usize {
        i & i.wrapping_neg()
    }
}


Measured memory_bytes: 21448
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main()
{
  int k;
  vector<int> atoE(5);
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    atoE[i] = a;
  }
  cin >> k;
  sort(atoE.begin(), atoE.end());
  if (atoE[4] - atoE[0] > k) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define LLINF (1<<30)
#define MOD 1000000007
# define rep(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int main() {
    int n, c, d[30][30], t[3][30] = {};
    cin >> n >> c;
    rep(i, c)rep(j, c)cin >> d[i][j];
    rep(i, n)rep(j, n) {
        int tt;
        cin >> tt;
        t[(i + j) % 3][tt - 1]++;
    }
    ll ans = LLINF;
    rep(i, c)rep(j, c)if (i != j)rep(k, c)if (i != k && j != k) {
        ll tt = 0;
        rep(l, c)tt += d[l][i] * t[0][l];
        rep(l, c)tt += d[l][j] * t[1][l];
        rep(l, c)tt += d[l][k] * t[2][l];
        ans = min(tt, ans);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive.lib
{

    internal class Solution
    {
        public int N;
        public List<int> primes;

        public void Run()
        {
            N = Input.ReadInt();
            primes = new List<int>();
            for (int i = 2; i <= 55555; i++)
            {
                bool flag = true;
                for(int j = 0; j < primes.Count; j++)
                    if (i % primes[j] == 0)
                    {
                        flag = false;
                        break;
                    }

                if(flag) primes.Add(i);
            }

            var primes2 = primes.Where(e => e % 5 == 1).ToList();

            for (int k = 0; k < N; k++)
            {
                Console.Write(primes2[k]);
                if(k < N - 1) Console.Write(" ");
                else Console.WriteLine();
            }
        }
    }

    // libs ----------


    // common ----------

    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

char s[500005];
ll y,m,d;

bool solve(){
	cin >> s;
	if(s[0] == '#'){
		return false;
	}
	cin >> y >> m >> d;
	if((y >= 31 && m >= 5) || y >= 32){
		cout << "?" << " " << y - 30 << " " << m << " " << d;
	}else{
		cout << s << " " << y << " " << m << " " << d;
	}
	cout << endl;
	return true;
}




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


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  int n, k;
  cin >> n >> k;
  double ans = 0;
  rep(i, n) {
    double p = (double)1/n; 
    for (int j = i+1; j < k; j *= 2) {
      p *= 0.5;
    }
    ans += p;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }

//CODE


void solve(void)
{
  int N,K;
  cin>>N>>K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  N--;
  K--;
  cout<<N/K + (int)(N%K>0)<<endl;

  
  


  return;
}


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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 1024
#include  <stdio.h>

int main(void)
{
	int bango;
	float sin, tai;
	
	while (scanf("%d, %f, %f", &bango, &tai, &sin) != EOF){
		if (tai / (sin * sin) >= 25.0){
			printf("%d\n", bango);
		}
	}
	
	return (0);
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dmp(x) cerr << __LINE__ << " " << #x << " " << x << endl;
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
// true : min, false : max
template<class T,bool Comptype = true>
struct LiChaoTree{
	using Line = pair<T,T>;	
	int sz = 1;
	vector<Line> seg;
	vector<T> xs;
	LiChaoTree(){}
	void init(vector<T>& x,T id){
		xs = x;
		int n = x.size();
		while(sz<n)sz<<=1;
		xs.resize(sz,x.back());
		seg.resize(sz*2,Line(T(0),id));
	}
	void dump_tree(){
		for(int i=0;i<seg.size();i++){
			cout << i << ':' << seg[i].fi << ' ' << seg[i].sec << endl;
		}
		// dump(xs);
	}
	static inline T f(Line l,ll x){
		return l.fi*x+l.sec;
	}	
	void add(Line line,int k,int l ,int r){
		// cout << line.fi << ' ' << line.sec << ' ' << k << ' ' << l << ' ' << r << endl;		
		int mid = (l+r)/2;
		T lx = xs[l];
		T mx = xs[mid];
		T rx = xs[r-1];
		bool lb = (f(line,lx)<f(seg[k],lx));
		bool mb = (f(line,mx)<f(seg[k],mx));
		bool rb = (f(line,rx)<f(seg[k],rx));
		// cout << boolalpha << lb << ' ' << mb << ' ' << rb << endl;
		if((lb==Comptype)&&(rb==Comptype)){
			seg[k] = line;
			return;
		}else if((lb!=Comptype)&&(rb!=Comptype)){
			return;
		}else{
			if(mb==Comptype)swap(seg[k],line);
			if(lb!=mb){
				add(line,2*k+1,l,mid);
			}else{
				add(line,2*k+2,mid,r);
			}
		}
	}
	void add(Line line){
		add(line,0,0,sz);
	}
	T query(int k){
		T x = xs[k];
		k += sz-1;
		T ret = f(seg[k],x);
		// cout << "x " << x << endl;
		while(k>0){
			k = (k-1)/2;
			T tmp = f(seg[k],x);
			// cout << k << ':' << tmp << endl;
			if((tmp<ret)==Comptype)ret = tmp;
		}
		// cout << "result :" << ret << endl;
		return ret;
	}
};
int N;
ll C;
vector<ll> h;
ll dp[200100];
LiChaoTree<ll> seg;
int main(){
	cin >> N >> C;
	input(h,N);
	dp[0] = 0ll;
	seg.init(h,LLINF);
	seg.add(make_pair(-2*h[0],dp[0]+h[0]*h[0]));
	for(int i=1;i<N;i++){
		// seg.dump_tree();
		dp[i] = h[i]*h[i]+C+seg.query(i);
		// cout << i << ' ' << dp[i] << endl;
		seg.add(make_pair(-2ll*h[i],h[i]*h[i]+dp[i]));
	}
	cout << dp[N-1] << endl;
	return 0;
}


Measured memory_bytes: 14584
import java.util.Scanner;

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();
		long k = sc.nextLong();
		
		int dif = a - b;
		dif *= k % 2 == 1 ? -1 : 1;
		
		System.out.println(dif);

	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int c[205], y[205], cnt[205];
int n;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> n;
    for(int i = 1, a, b; i <= n; i++){
        cin >> a >> b;
        c[a] = 0;
        y[a] = b;
    }
    for(int i = 1, a, b; i <= n; i++){
        cin >> a >> b;
        c[a] = 1;
        y[a] = b;
    }
    int m = 0;
    for(int i = 0; i < n + n; i++){
        if(c[i]){
            for(int j = y[i]; j--;){
                if(cnt[j]){
                    --cnt[j];
                    ++m;
                    break;
                }
            }
        }else{
            ++cnt[y[i]];
        }
    }
    cout << m << '\n';
}


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

    int main() {
        
        int k;
        cin >> k;
        int a = 7%k;
        
        for(int i=1; i<=k; i++){
            
            if(a%k==0){
                cout << i <<' ';
                return 0;
            }
            
            a*=10;
            a+=7;
            a%=k;
            
        }
        
        cout << -1 <<' ';
        
        return 0;
        }

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main() {
	double D, T, S; std::cin >> D >> T >> S;
	if (D <= T * S) std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;

	return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
string a[101];int n,i;

int main(){
    scanf("%d%*d",&n);
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0;i<n;i++)
        cout<<a[i];
    return 0;
}

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

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int main() {
	int N;
	cin >> N;
	vector<ll> A(N), B(N);
	rep(i, N) cin >> A[i] >> B[i];

	ll result = 0;
	for(int i = N-1; i >= 0; i--) {
		if ((A[i] + result) % B[i] == 0) continue;
		result += B[i] - (A[i]+result) % B[i];
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,m;

	int ans = 0;
	cin >>n>>m;
	VPi path(m);
	cin >> path;
	dsu tri(n);
	rep(i, m) { tri.merge(path[i].F-1, path[i].S-1); }
	ans = (tri.groups()).size();
	cout<<ans-1<<endl;
}

Measured memory_bytes: 9008
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

int kaijo(int n) {
    if (n == 0) {
        return 1;
    }
    int ans = kaijo(n - 1) * n;
    return ans;
}

int count(vector<int> vec, vector<bool> &bit, int N) {
    int ans = 1;
    int num;
    for (int i = 0; i < N; i++) {
        num = 0;
        for (int j = 0; j < vec.at(i) - 1; j++) {
            if (bit.at(j)) {
                num++;
            }
        }
        ans += num * kaijo(N - i - 1);
        bit.at(vec.at(i) - 1) = false;
    }
    return ans;
}

int sub(int a, int b) {
    if (a < b) {
        return b - a;
    }
    return a - b;
}

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N; i++) {
        cin >> P.at(i);
    }
    vector<int> Q(N);
    for (int i = 0; i < N; i++) {
        cin >> Q.at(i);
    }
    vector<bool> bitp(N, true);
    int p = count(P, bitp, N);
    vector<bool> bitq(N, true);
    int q = count(Q, bitq, N);
    int ans = sub(p, q);
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

int main() {
	int a, b, t;
	cin >> a >> b >> t;
	cout << (t / a) * b << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int hotel(int n, int k, int x, int y){
    int i;
    int tmp = 0;

    for(i = 0; i < n; i++){
        if(i < k){
            tmp += x;
        }
        if(i >= k){
            tmp += y;
        }
    }
    return tmp;
}

int main(void){
    int n, k, x, y;

    scanf("%d", &n);

    scanf("%d", &k);

    scanf("%d", &x);

    scanf("%d", &y);

    printf("%d\n", hotel(n, k, x, y));

    return 0;
}

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

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

#pragma GCC optimize("Ofast")



using namespace std;

bool is_integer( float x ){
    return floor(x) == x;
}
bool is_integer(double x){
    return floor(x) == x;
}


int main() {

    int n; cin >> n;
    vector<ll> a(n);
    vector<ll> c(n);
    vector<ll> b(200001);
    vector<pair<ll,ll>> m;
    int p = 0;
    ll ans = 0;

    rep(i,n){
        cin >> a[i];
        c[i] = a[i];
    }
    sort(a.begin(),a.end());

    rep(i,n){
        if(m.empty()) m.push_back(make_pair(a[i],1));
        else if(a[i] == m[p].first) m[p].second ++;
        else{
            m.push_back(make_pair(a[i],1));
            p ++;
        }
    }

    rep(i,m.size()){
        b[m[i].first] = m[i].second;
        ans += ((m[i].second)*(m[i].second-1))/2;
    }

    rep(i,n){
        cout << ans - (b[c[i]]-1) << endl;
    }




    return 0;
}











Measured memory_bytes: 9972