akhauriyash/Code-Regression huggingface dataset:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    m = 100
    cnt = 0
    while True:
        #print(m)
        if m >= X:

            print(cnt)
            exit()
        else:
            m = int(m * 1.01)
            cnt += 1

if __name__ == '__main__':
  main()


Measured memory_bytes: 10964
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<LP> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;


void solve() {
	int p, r, t; cin >> p >> r >> t;
	vector<int> l(r);
	rep(i, r)cin >> l[i];
	vector<vector<int>> n(p);
	rep(i, p) {
		n[i].resize(r);
		rep(j, r)cin >> n[i][j];
	}
	vector<P> v(t);
	rep(i, t) {
		cin >> v[i].first >> v[i].second; v[i].first--; v[i].second--;
	}
	int le = 0, ri = t + 1;
	while (ri - le > 1) {
		int m = (le + ri) / 2;
		vector<vector<int>> c(p);
		rep(i, p) {
			c[i].resize(r, 0);
		}
		vector<int> rest = l;
		rep(i, m) {
			c[v[i].first][v[i].second]++;
			rest[v[i].second]--;
		}
		rep(i, p) {
			int d = mod;
			rep(j, r) {
				if (n[i][j] == 0)continue;
				d = min(d, c[i][j] / n[i][j]);
			}
			if (d > 0) {
				rep(j, r) {
					c[i][j] -= d * n[i][j];
					rest[j] += d * n[i][j];
				}
			}
		}
		vector<int> num(p, 0);
		vector<vector<P>> v(r);
		rep(i, p) {
			bool exi1 = false;
			rep(j, r) {
				if (c[i][j] > 0)exi1 = true;
			}
			if (!exi1) {
				num[i] = r; continue;
			}
			rep(j, r) {
				if (n[i][j] == c[i][j]) {
					num[i]++;
				}
				else {
					v[j].push_back({ n[i][j] - c[i][j],i });
				}
			}
		}
		rep(j, r)sort(v[j].begin(), v[j].end());
		vector<int> lid(r, 0);
		while (true) {
			vector<int> nex;
			rep(j, r) {
				while (lid[j] < v[j].size() && v[j][lid[j]].first <= rest[j]) {
					num[v[j][lid[j]].second]++;
					if (num[v[j][lid[j]].second] == r) {
						nex.push_back(v[j][lid[j]].second);
					}
					lid[j]++;
				}
			}
			if (nex.empty())break;
			rep(i, nex.size()) {
				rep(j, r) {
					rest[j] += c[nex[i]][j];
				}
			}
		}
		bool f = true;
		rep(j, p) {
			if (num[j] != r)f = false;
		}
		//cout << m << " " << f << endl;
		if (f) {
			le = m;
		}
		else {
			ri = m;
		}
	}
	if (ri == t + 1)ri = -1;
	cout << ri << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
		return 0;
}




Measured memory_bytes: 5400
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
 string s;
 cin>>s;
 ll len=s.size();
 vector<ll>data(len);
 for(ll i=0;i<len;i++){
   data[i]=s.at(i)-48;
  // cout<<data[i]<<endl;
 }

 //bit全探索
 ll ans=0;
 for(ll bit=0;bit<(1<<(len-1));bit++){
   ll tmp=data[0];
   for(ll i=0;i<len-1;i++){
     if(bit&(1<<i)){
       ans+=tmp;
       tmp=data[i+1];
     }else{
       tmp=tmp*10;
       tmp+=data[i+1];
     }
   }
   ans+=tmp;
 }
 cout<<ans<<endl;
}

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

typedef struct range{
  int l,r;
} range;

int cmp(const void *a,const void *b){
  range *p=(range *)a;
  range *q=(range *)b;
  return (p->r-p->l)-(q->r-q->l);
}

void add(int *bit,int x,int v){
  int n=bit[0];
  for(int i=x;i<=n;i+=i&-i) bit[i]+=v;
}

int sum(int *bit,int x){
  int res=0;
  for(int i=x;i>0;i-=i&-i) res+=bit[i];
  return res;
}

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  range *p=(range *)calloc(n,sizeof(range));
  int i;
  for(i=0;i<n;i++) scanf("%d%d",&p[i].l,&p[i].r);
  qsort(p,n,sizeof(range),cmp);
  int *bit=(int *)calloc(m+2,sizeof(int));
  bit[0]=m+1;
  int j=0;
  for(i=1;i<=m;i++){
    while(j<n && p[j].r-p[j].l+1<i){
      add(bit,p[j].l,1);
      add(bit,p[j].r+1,-1);
      j++;
    }
    int cnt=n-j;
    for(int k=i;k<=m;k+=i){
      cnt+=sum(bit,k);
    }
    printf("%d\n",cnt);
  }
}

int main(void){
  run();
  return 0;
}


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  if(A==B && B==C){
    cout << "No" << endl;
  }
  else if(A==B || B==C || C==A){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
from functools import reduce

def m(l):
    result = 1
    for num in l:
        result *= num
        if result == 0:
            return 0
        elif result > 10**18:
            return -1
    return result

if __name__ == "__main__":
    input()
    aList = list(map(int, input().split()))
    aList.sort()
    print(m(aList))

Measured memory_bytes: 22724
#include <stdio.h>

int main() {

	int mat[3][3];
	
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			scanf("%d", &mat[i][j]);
		}
	}		
	int c[3][3] = {};
	int a;
		
		scanf("%d", &a);
	
	int b;
		
	for(int i = 0; i < a; i++) {
		
		scanf("%d", &b);
	
	for(int j = 0; j < 3; j++) {
		for(int k = 0; k < 3; k++) {
			if(b == mat[j][k]) {
				c[j][k]++;
				
				if((c[0][0] > 0 && c[0][1] > 0 && c[0][2] > 0) || (c[1][0] > 0 && c[1][1] > 0 && c[1][2] > 0) || (c[2][0] > 0 && c[2][1] > 0 && c[2][2] > 0) || (c[0][0] > 0 && c[1][0] > 0 && c[2][0] > 0) || (c[0][1] > 0 && c[1][1] > 0 && c[2][1] > 0) || (c[0][2] > 0 && c[1][2] > 0 && c[2][2] > 0) || (c[0][2] > 0 && c[1][1] > 0 && c[2][0] > 0) || (c[0][0] > 0 && c[1][1] > 0 && c[2][2] > 0)) {
			printf("Yes");
			return 0;
				}
			}
		}
	}
}
printf("No");
	return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    long long num1 = a * c;
    long long num2 = a * d;
    long long num3 = b * c;
    long long num4 = b * d;
    long long ans = max({num1, num2, num3, num4});
    cout << ans;

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
  int R, G, B, N;
  int result = 0;
  cin>>R>>G>>B>>N;
  for(int r=0; r<=N; r++) {
    for(int g=0; g<=N; g++) {
      int tmp = N - R*r - G*g;
      if(tmp >= 0 && tmp % B == 0) {
        result++;
      }
    }
  }
  cout<<result<<endl;
}

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

using namespace std;

/*
 * 解説に乗っ取ってやる
 * 計算量を落とす方法が多分imos法
 *		4K * 4Kに範囲を拡張して、
 *		i番目の条件を満たせるような左下マスの集合のうち、K*Kの正方形の区間になるものだけを貼って、+1する方針
 */



// 各条件について、条件を満たす左下マスの集合のうちK*Kの正方形になる区間を探す
int hidarisita(std::vector<std::vector<int>> v, int K){
	// i番目の要求が成立するような領域の左下を出す
	std::vector<std::vector<int>> xy;
	// 初期化
	xy.resize(4 * K);
	for (size_t i = 0; i < xy.size(); i++) {
		for (size_t j = 0; j < 4 * K; j++) {
			xy[i].push_back(0);
		}
	}

	// 重みの加算
	for (size_t i = 0; i < v.size(); i++) {
		// 全ての左下を求める
		for (size_t j = 0; j < 4 * K; j+=K) {
			for (size_t k = 0; k < 4 * K; k+=K) {
				int xx = v[i][0] % K + j + 1;
				int yy = v[i][1] % K + k + 1;
				if ((xx + yy) % (2 * K) == (v[i][0] + 1 + v[i][1] + 1) % (2 * K)) {
					// K * Kになるものだけを重みに加算する
					if (xx + K < 4 * K && yy + K < 4 * K) {
						xy[xx][yy]++;
						xy[xx][yy+K]--;
						xy[xx+K][yy]--;
						xy[xx+K][yy+K]++;
					}
				}
			}
		}
	}

	// 横方向への累積和
	for (size_t i = 0; i < xy.size(); i++) {
		for (size_t j = 1; j < xy[i].size(); j++) {
			xy[i][j] += xy[i][j-1];
		}
	}
	// 縦方向への累積和
	for (size_t i = 1; i < xy.size(); i++) {
		for (size_t j = 0; j < xy[i].size(); j++) {
			xy[i][j] += xy[i-1][j];
		}
	}

	// 最大値を調べる
	int banmax = -2000;
	for (size_t i = 0; i < xy.size(); i++) {
		for (size_t j = 0; j < xy[i].size(); j++) {
			banmax = max(banmax,xy[i][j]);
		}
	}

	return banmax;
}


int main(int argc, char const *argv[]) {
	int N,K;
	std::cin >> N >> K;
	std::vector<std::vector<int>> v;
	v.resize(N);
	for (size_t i = 0; i < N; i++) {
		int a,b;
		char c;
		std::cin >> a >> b >> c;
		v[i].push_back(a);
		v[i].push_back(b);
		if (c == 'B') {
			v[i].push_back(0);
		}
		else {
			v[i].push_back(1);
		}
	}

	// 入力条件を整える
	for (size_t i = 0; i < v.size(); i++) {
		// W を B に変換
		if (v[i][2] == 1) {
			v[i][2] = 0;
			v[i][1] += K;
		}
		// mod 2Kをとる
		v[i][0] %= (2*K);
		v[i][1] %= (2*K);
	}

	std::cout << hidarisita(v,K) << '\n';

	return 0;
}


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

int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  rep(i, n) { cin >> l[i]; }
  int ans = INT_MAX;
  rep(i, 1 << (2 * n)) {
    vector<int> k(3);
    int knum = 0;
    int itemp = i;
    rep(j, n) {
      if (itemp % 4 <= 2) {
        k[itemp % 4] += l[j];
        knum++;
      }
      itemp /= 4;
    }
    if (k[0] == 0 || k[1] == 0 || k[2] == 0) continue;
    sort(k.begin(), k.end(), std::greater<int>());
    ans = min(ans,
              (knum - 3) * 10 + abs(a - k[0]) + abs(b - k[1]) + abs(c - k[2]));
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define f(i,st,n) for(i=st;i<n;i++)
#define vec vector
#define mst(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define sfl(x) scanf("%lld",&x)
#define pfl(x) printf("%lld\n",x)
#define pf(x) printf("%lld",x)
#define mpr make_pair
#define fs first
#define se second
#define inf LLONG_MAX
#define nnf LLONG_MIN
 
 
 
 
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }                     
    return gcd(b%a,a);
}
ll power(ll x,ll y){            
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=(res*x);
        }
        x=(x*x);
        y=y/2;
    }
    return res;
}

int main(){
 
 /*#ifndef ONLINE_JUDGE
    
    freopen("input.txt", "r", stdin);
   
   freopen("output.txt", "w", stdout);
   #endif
*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,i;
    cin>>n;
    if(n==1)cout<<"0";
    else{
          ll ans=0;
          vec<ll>v;
        for(i=2;i*i<=n;i++){

              ll c=0;
              while(n%i==0){
                c++;
                n/=i;
              }
              if(c)
              v.pb(c);
        }
        if(n>1)v.pb(1);
        for(auto z:v){
            for(i=60;i>0;i--){
                if((i*(i+1))/2<=z){
                    ans+=i;
                    break;
                }
            }
        }
        cout<<ans;
    }
   return 0;
 }


Measured memory_bytes: 3636
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;


int main()
{
    
    double T,X;
    cin >> T >> X;
    cout << T/X << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T>
map<T, Int> factorize(T x){
  map<T, Int> res;
  for(Int i=2;i*i<=x;i++){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n;
  cin>>n;

  auto mp=factorize(n);
  Int ans=0;
  for(auto p:mp){
    Int x=p.second;
    for(Int e=1;e<=x;e++){
      ans++;
      x-=e;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3624
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstring>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using i32 = int32_t;
using u32 = uint32_t;
using f32 = float;
using f64 = double;
using i64 = int64_t; 
using u64 = uint64_t; 

#define SELECTER(_1, _2, _3, _4, _5, _6, _7, _8, SELECT, ...) SELECT

#define _FC1(func, type, _1)      func(type, _1);
#define _FC2(func, type, _1, ...) func(type, _1); _FC1(func, type, __VA_ARGS__);
#define _FC3(func, type, _1, ...) func(type, _1); _FC2(func, type, __VA_ARGS__);
#define _FC4(func, type, _1, ...) func(type, _1); _FC3(func, type, __VA_ARGS__);
#define _FC5(func, type, _1, ...) func(type, _1); _FC4(func, type, __VA_ARGS__);
#define _FC6(func, type, _1, ...) func(type, _1); _FC5(func, type, __VA_ARGS__);
#define _FC7(func, type, _1, ...) func(type, _1); _FC6(func, type, __VA_ARGS__);
#define _FC8(func, type, _1, ...) func(type, _1); _FC7(func, type, __VA_ARGS__);

#define _FCN(func, type, ...) SELECTER(__VA_ARGS__, _FC8, _FC7, _FC6, _FC5, _FC4, _FC3, _FC2, _FC1)(func, type, __VA_ARGS__);

constexpr const char *type2fmt(const char *fmt) {
  if(strcmp(fmt, "i32")) return "%d";
  if(strcmp(fmt, "u32")) return "%u";
  if(strcmp(fmt, "f32")) return "%f";
  if(strcmp(fmt, "f64")) return "%lf";
  if(strcmp(fmt, "i64")) return "%lld";
  if(strcmp(fmt, "u64")) return "%llu";
  if(strcmp(fmt, "char*")) return "%s";
  return "";
}

#define _R(type, _1) type _1; { type _t; scanf(type2fmt(#type), &_t); _1 = _t; }
#define _P(type, _1) { const type _t = (_1); printf(type2fmt(#type), _t); putchar('\n'); }

#define RI(...)   _FCN(_R, i32, __VA_ARGS__);
#define RUI(...)  _FCN(_R, u32, __VA_ARGS__);
#define RF(...)   _FCN(_R, f32, __VA_ARGS__);
#define RD(...)   _FCN(_R, f64, __VA_ARGS__);
#define RLL(...)  _FCN(_R, i64, __VA_ARGS__);
#define RULL(...) _FCN(_R, u64, __VA_ARGS__);

#define PI(...)   _FCN(_P, i32, __VA_ARGS__);
#define PUI(...)  _FCN(_P, u32, __VA_ARGS__);
#define PF(...)   _FCN(_P, f32, __VA_ARGS__);
#define PD(...)   _FCN(_P, f64, __VA_ARGS__);
#define PLL(...)  _FCN(_P, i64, __VA_ARGS__);
#define PULL(...) _FCN(_P, u64, __VA_ARGS__);
#define PS(...)   _FCN(_P, char*, __VA_ARGS__);

#define REP(n) for (int _i = 0; _i < n; _i++)

const u64 mod = 1000000007;

int main() {
  string s;
  cin >> s;
  for (i32 i = 0; i < s.size(); i += 2) cout << s[i];
  cout << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	llint n;
	cin >> n;
	llint power = 1;
	for (int i = 1; i <= n; i++) {
		power %= mod;
		power *= i;
		power %= mod;
	}
	cout << power << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"

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


class AABC333 {
public:
    void solve(std::istream &in, std::ostream &out) {
      int a, b;
      in >> a >> b;
      REP(i, 3) {
        if ((a * b * (i + 1)) % 2 == 1) {
          out << "Yes" << endl;
          return;
        }
      }
      out << "No" << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  AABC333 solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        string N = Console.ReadLine();
        int ans = 0;
        foreach(var x in N)
        {
            if (x == '2') ans++;
        }
        Console.WriteLine(ans);
        Console.ReadLine();
    }

}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<ll,ll> &a,
               const pair<ll,ll> &b)
{
    return (a.second > b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
ll sumofdigit(ll n)
{
    ll c=0,d=0,sum=0,i;
    while(n>0)
    {
        c=n%10;
        sum+=c;
        n/=10;
    }
    return sum;
}

int main()
{
     fast;
     int t=1;
     //cin>>t;
     while(t--)
     {
        ll  k,i,j,c=0,d=0,sum=0,e=0,f=0,g=0,h=0,n,maxi=0;
        cin>>n;
        set<string> a;
        while(n--)
        {
            string b;
            cin>>b;
            a.insert(b);
        }
        cout<<a.size();




     }

}


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

#define ll long long

int main()
{
    int n;
    cin >> n;
    
    int arr[n];
    for (int i = 0; i < n; ++i)
        cin >> arr[i];
        
    sort(arr, arr + n);
    
    int l = 1, r = n - 1;
    
    deque<int> seq;
    seq.push_back(arr[0]);
    
    while (l <= r)
    {
        int a = abs(arr[l] - seq.front());
        int b = abs(arr[r] - seq.front());
        int c = abs(arr[l] - seq.back());
        int d = abs(arr[r] - seq.back());
        
        int mx = max({a, b, c, d});
        
        if (mx == a)
            seq.push_front(arr[l++]);
        else if (mx == b)
            seq.push_front(arr[r--]);
        else if (mx == c)
            seq.push_back(arr[l++]);
        else 
            seq.push_back(arr[r--]);
    }
    
    ll ans = 0;
    for (int i = 0; i < n - 1; ++i)
    {
        int k = seq.front();
        seq.pop_front();
        
        ans += abs(seq.front() - k);
    }
    
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#define maxn 100005
using namespace std;
typedef long long ll;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = getchar();c < '0' || c > '9';c = getchar()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = getchar()) res = res * 10 + (c - '0');
  return res * sig;
}
int n,m,par[maxn << 1];
void ini(){
  for(int i = 0;i < (n << 1);i++){
    par[i] = i;
  }
}
int fin(int u){
  if(par[u] == u) return u;
  return par[u] = fin(par[u]);
}
void uni(int u,int v){
  u = fin(u), v = fin(v);
  if(u == v) return;
  par[u] = v;
}
int main(){
  n = getint(), m = getint();
  ini();
  for(int i = 1;i <= m;i++){
    int u = getint() - 1, v = getint() - 1, z = getint();
    if(z & 1){
      uni(u << 1,(v << 1) | 1);
      uni((u << 1) | 1,v << 1);
    }else{
      uni(u << 1,v << 1);
      uni((u << 1) | 1,(v << 1) | 1);
    }
  }
  int ans = 0;
  for(int i = 0;i < (n << 1);i++) ans += (par[i] == i);
  printf("%d\n",ans >> 1);
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    ll P;
    cin >> P;
    ll P_copy = P;
    vector<ll> isdiv(1000001, 0);
    for (ll i = 2; i < 1000001; i++){
        while(true){
            if (P % i != 0){
                break;
            }
            else{
                P /= i;
                isdiv[i]++;
            }
        }
    }
    ll max_div = 1;
    for (ll i = 2; i < 1000001; i++){
        ll times = isdiv[i] / N;
        rep(j,times) max_div *= i;
    }
    if (N == 1) cout << P_copy << endl;
    else cout << max_div << endl;
}

Measured memory_bytes: 11076
#include<stdio.h>
int main(void){
  int l,i;
  scanf("%d",&l);
  int num[l];
  double sum=0;
  for(i=0;i<l;i++){
    scanf("%d",&num[i]);
    sum+=(double)1/num[i];
  }
  printf("%lf",1/sum);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

int H, W;
int N;
int INF = 1e9;

void warshall_floyd(vector<vector<int>>& dist) {
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
}

int main() {
    cin >> H >> W;
    N = H * W;
    vector<vector<int>> dist(N, vector<int>(N, INF));
    for (int i = 0; i < N; i++) {
        dist[i][i] = 0;
    }
    string s;
    vector<string> S(H);
    for (int i = 0; i < H; i++) {
        cin >> S[i];
        for (int j = 0; j < W; j++) {
            if (j) {
                if(S[i][j] == '.' & S[i][j - 1] == '.') {
                    dist[i * W + j][i * W + j - 1] = 1;
                    dist[i * W + j - 1][i * W + j] = 1;
                }
            }
            if (i) {
                if(S[i][j] == '.' && S[i - 1][j] == '.') {
                    dist[i * W + j][(i - 1) * W + j] = 1;
                    dist[(i - 1) * W + j][i * W + j] = 1;
                }
            }
        }
    }
    warshall_floyd(dist);
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            if (dist[i][j] < INF) ans = max(ans, dist[i][j]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define ii pair <int, int>
#define x first
#define y second
#define db(x) cerr << #x << " = " << x << endl;
#define _ << " _ " <<

using namespace std;

const int N = 1e5 + 7;

int n;
int a[N][3], f[N][3];

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

	if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout);

	cin >> n;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 3; j++)
			cin >> a[i][j];

	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 3; j++)
			for (int k = 0; k < 3; k++)
				if (k != j)
					f[i][j] = max(f[i][j], f[i - 1][k] + a[i][j]);
	cout << max({f[n][0], f[n][1], f[n][2]});
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

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

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n; ll x;
    cin >> n >> x;
    ll a[n];
    rep(n){
        cin >> a[i];
        a[i] = abs(a[i]-x);
    }

    ll ans = a[0];
    rep(n){
        ans = gcd(ans, a[i]);
    }

    cout << ans << endl;
    
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

ll K;
ll a[50];

int main() {
	cin >> K;
	
	ll N = 50;
	ll d = K / N;
	ll q = K % N;
	
	REP(i, N) a[i] = N - 1;
	
	REP(i, N) a[i] -= K;
	REP(i, q) a[i] += (N + 1);
	REP(i, N) a[i] += (N + 1) * d;
	
	cout << N << endl;
	REP(i, N) printf("%lld%c", a[i], i == N - 1 ? '\n' : ' ');
	
	
	return 0;
}


Measured memory_bytes: 256
n=int(input())
a={}
for i in range(n):
  s=input()
  if s in a:
    a[s]+=1
  else:
    a[s]=1
m=int(input())
for i in range(m):
  s=input()
  if s in a:
    a[s]-=1
max=0
for i in a:
  if a[i]>max:
    max=a[i]
print(max)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N, u, v; cin >> N >> u >> v; u--, v--;
    vector<vector<int>> G(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> D(N, -1);
    auto recur1 = [&](auto&& recur1, int node, int dist) -> void {
        if (D[node] >= 0) return;
        D[node] = dist;
        for (auto next : G[node]) {
            recur1(recur1, next, dist + 1);
        }
    };
    recur1(recur1, v, 0);
    int limit = D[u] / 2 + 1;
    vector<bool> A(N);
    auto recur2 = [&](auto && recur2, int node) -> void {
        if (D[node] < limit) return;
        if (A[node]) return;
        A[node] = true;
        for (auto next : G[node]) {
            recur2(recur2, next);
        }
    };
    recur2(recur2, u);
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (A[i]) ans = max(ans, D[i] - 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
//#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 300000;
const int K = 19;
int used[N], c[N], d[N], ans[N], u[N], v[N], in[N], deg[N];
vector < pair < int, pair < int, int > > > g[N];
void dfs(int v, int color = 0){
    used[v] = 1;
    c[v] = color;
    for (auto i: g[v]){
        int u = i.F;
        if (used[u]) continue;
        if (i.S.S == 0) ans[i.S.F] = d[u] - d[v];
        dfs(u, color ^ i.S.S);
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> d[i];
    vector < pair < pair < int, int >, int > > e;
    for (int i = 1; i <= m; i++){
        cin >> u[i] >> v[i];
        if (d[u[i]] < d[v[i]]){
            g[u[i]].pb({v[i], {i, 0}});
            in[v[i]]++;
        }
        else
        if (d[v[i]] < d[u[i]]){
            g[v[i]].pb({u[i], {i, 0}});
            in[u[i]]++;
        }
        else{
            e.pb({{u[i], v[i]}, i});
            ans[i] = d[u[i]];
            deg[u[i]]++;
            deg[v[i]]++;
        }
    }
    for (int i = 1; i <= n; i++){
        if (in[i] == 0 && deg[i] == 0){
                cout << -1;
                return 0;
        }
    }
    for (auto i: e){
        if (in[i.F.S] == 0){
            g[i.F.F].pb({i.F.S, {i.S, 1}});
            if (in[i.F.F] != 0) in[i.F.S]++;
        }
        if (in[i.F.F] == 0){
            g[i.F.S].pb({i.F.F, {i.S, 1}});
            if (in[i.F.S] != 0) in[i.F.F]++;
        }
    }
    for (int i = 1; i <= n; i++){
        if (!used[i] && in[i] == 0){
            dfs(i);
        }
    }
    for (int i = 1; i <= n; i++){
        if (c[i] == 0) cout << 'W'; else cout << 'B';
    }
    cout << endl;
    for (int i = 1; i <= m; i++){
        if (ans[i] == 0) cout << 1000000000 << endl; else cout << ans[i] << endl;
    }
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

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


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

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

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

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

template< typename T1, typename T2 >
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); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

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

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int N;
  cin >> N;
  vector< int > P(N);
  cin >> P;
  vector< int > inv(N + 1);
  for(int i = 0; i < N; i++) inv[P[i]] = i;
  int64 ret = 0;
  multiset< int64 > v;
  v.emplace(-1);
  v.emplace(-1);
  v.emplace(N);
  v.emplace(N);
  for(int i = N; i >= 1; i--) {
    auto nxt = v.upper_bound(inv[i]);
    auto pre = nxt;
    --pre;
    ret += (*next(nxt) - *nxt) * (inv[i] - *pre) * i;
    ret += (*pre - *prev(pre)) * (*nxt - inv[i]) * i;
    v.emplace(inv[i]);
  }
  cout << ret << endl;
}






Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    int A[2][N];
    rep(i, 2){
        rep(j, N){
            cin >> A[i][j];
        }
    }
    int mx = 0;
    for(int i = 0; i < N; i++){
        int sum = 0;
        int line = 0;
        for(int j = 0; j < N; j++){
            sum += A[line][j];
            if(i == j){
                line++;
                sum += A[line][j];
            }
        }
        mx = max(mx, sum);
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void){
	int n,i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(i%3==0) printf(" %d",i);
		else {
			j = i;
			while(j>0){
				if(j%10==3) {
				printf(" %d",i); break;
				}
				j /=10;
			}
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const ll INF=1e9+7;
int main()
{
  ll h;
  cin>>h;
  ll n;cin>>n;
  vector< vector<ll> > v(n+1,vector<ll> (2));
  
  for(ll i=1;i <= n;i++)
     cin>>v[i][0] >> v[i][1];
  vector<vector< ll> > dp(h+1,vector<ll>( n+1));
  for(ll i=0;i<=h;i++)
    dp[i][0]=INF;
  for(ll i=1;i <= h;i++)
    {
    	for(ll j=1;j <= n;j++)
    	 {
    	 	if(i < v[j][0] ) 
    	 	     dp[i][j]=min(v[j][1],dp[i][j-1]);
    	    else
    	    dp[i][j]=min(dp[i][j-1],dp[i-v[j][0]][j]+v[j][1]);
    	 }
    }
 cout<<dp[h][n];
  
  
  return 0;
}

Measured memory_bytes: 78848
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<vector>
#define ll long long
#define N 201000
#define ls (now<<1)
#define rs ((now<<1)|1)
#define RG register
using namespace std;

inline int read(){
    RG int x=0,o=1; RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=((x<<3)+(x<<1))+ch-'0',ch=getchar();
    return x*o;
}

int n,a[N],t[N],Max1,Max2,Maxn1,Maxn2,Maxid1,Maxid2;

int main(){
	n=read(); for(RG int i=1;i<=n;++i) a[i]=read();
	for(RG int i=1;i<=n;i+=2) t[a[i]]++;
	for(RG int i=1;i<=100000;++i){
		if(t[i]>Max1) Maxn1=Max1,Max1=t[i],Maxid1=i;
		else if(t[i]>Maxn1) Maxn1=t[i];
		t[i]=0;
	}
	for(RG int i=2;i<=n;i+=2) t[a[i]]++;
	for(RG int i=1;i<=100000;++i){
		if(t[i]>Max2) Maxn2=Max2,Max2=t[i],Maxid2=i;
		else if(t[i]>Maxn2) Maxn2=t[i];
		t[i]=0;
	}   if(Maxid1!=Maxid2) return cout<<n-Max1-Max2<<endl,0;
	cout<<n-max(Max1+Maxn2,Max2+Maxn1); return 0;
	
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,e,f,answ=1,anss=0;
    cin>>a>>b>>c>>d>>e>>f;
    for(int i=0;i*100*a<=f;i++){
        for(int j=0;j*100*b+i*100*a<=f;j++){
            int w=j*100*b+i*100*a;
            for(int k=0;k*c+w<=f;k++){
                for(int l=0;w+k*c+l*d<=f;l++){
                    int s=k*c+l*d;
                    if(anss*(s+w)<answ*s&&(100+e)*s<=e*(s+w)){answ=s+w;anss=s;}
                }
            }
        }
    }
    if(answ==1){
        for(int i=0;i*a*100<=f;i++){
            for(int j=0;i*100*a+j*b*100<=f;j++){
                answ=max(answ,i*100*a+j*b*100);
            }
        }
    }
    cout<<answ<<' '<<anss;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A(N);
    for(auto&& i : A)cin >> i;
    unsigned long Amax{1 + *max_element(begin(A), end(A))};
    vector<unsigned long> B(Amax);
    for(const auto& i : A)++B[i];
    vector<unsigned long> sieve(Amax, 1);
    for(unsigned long i{2}; i < Amax; ++i)if(sieve[i])for(unsigned long j{1}; j * i < Amax; ++j){
        sieve[j * i] = 0;
        B[j * i] += B[j];
    }
    unsigned long ans{0};
    for(const auto& i : A)if(B[i] == 1)++ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20344
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

int ma[4][4];
int tnt ,ans;

int main()
{
	for(int i = 1 ; i <= 3 ; i++){
		for(int j = 1 ; j <= 3 ;j++ ){
			cin >> ma[i][j];
			tnt += ma[i][j];
		}
	}
	ans = ma[1][1] + ma[2][2] + ma[3][3];
	ans *= 3;
	if(ans != tnt )cout << "No" << endl;
	else cout << "Yes" << endl;
}


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

int main(void){
    int N,sum = 0;
    cin >> N;
    int A[N + 2];
    A[0] = A[N + 1] = 0;
    for(int i = 1;i <= N;i++)
    cin >> A[i];
    
    for(int i = 0;i <= N;i++){
        sum += abs(A[i] - A[i+1]);
    }
    
    for(int i = 1;i <= N;i++){
        int ans = 0;
        ans += sum + abs(A[i-1] - A[i+1]) -(abs(A[i-1] - A[i]) + abs(A[i] - A[i+1]));
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std ;
int a[2010] ;
bool ok[2010] ;
int pos[2010] , d[2010] ;
struct Node{
       int id , val ;
}no[2010] ;
int XG ;
bool cmp( Node a , Node b ){
    if ( a.val == b.val ){
        if ( b.id == XG ) return 0 ;
        return a.id < b.id ;
    }
    return a.val < b.val ;
}
int main(){
    int n , k , q ;
    cin >> n >> k >> q ;
    for( int i = 1 ; i <= n ; i++ )
        scanf( "%d" , &a[i] ) ;
    for( int i = 1 ; i <= n - k + 1 ; i++ ){
        int minx = a[i] ;
        for( int j = i ; j <= i + k - 1 ; j++ )
            minx = min( minx , a[j] ) ;
        for( int j = i ; j <= i + k - 1 ; j++ )
            if ( a[j] == minx ) ok[j] = true ;
    }
    for( int i = 1 ; i <= n ; i++ ){
        no[i].id = i ; no[i].val = a[i] ;
    }
    int ans = 0x3f3f3f3f ;
    for( int i = 1 ; i <= n ; i++ ){
        if ( !ok[i] ) continue ;
        int cnt = 0 ;
        int res = 0 ;
        for( int j = 1 ; j <= n ; j++ ){
            if ( a[j] < a[i] ){
                res = 0 ; continue ;
            }
            if ( j != i ){
                res++ ;
                if ( res == 1 ) cnt++ ;
                pos[j] = cnt ; d[cnt] = res ;
            }
        }
        XG = i ;
        sort( no + 1 , no + 1 + n , cmp ) ;
        int p ;
        for( int j = 1 ; j <= n ; j++ )
            if ( no[j].id == i ) p = j ;
        int x = a[i] ;
        int y = a[i] ;
        int qaq = 0 ;
        for( int j = p + 1 ; j <= n ; j++ ){
            int r = no[j].id ;
            if ( d[pos[r]] < k ) continue ;
            qaq++ ; d[pos[r]]-- ; y = no[j].val ;
            if ( qaq == q - 1 ) break ;
        }
        if ( qaq != q - 1 ) continue ;
        ans = min( ans , y - x ) ;
    }
    cout << ans << endl ;
    return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
int main()
{
    string s;
    cin>>s;
    if((s[0]==s[1] && s[1]==s[2]) || (s[2]==s[3] && s[1]==s[2]))
        printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int n,k;
	ll now = 1;
	int ans=0;
	
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		if(now<k)
		{
			now*=2;
		}else{
			now+=k;
		}
	}
	cout<<now<<endl;
	return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    lli x ; 
  cin >> x ;
  cout << (x < 1200 ? "ABC" : "ARC");
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,n,a=2;
  while(scanf("%d %d",&i,&n),i||n){
    if(a-2)printf("\n");
    for(a=1;i<=n;i++){
      if(i%4==0&&(i%100||i%400==0)){
	printf("%d\n",i);
	a=0;
      }
    }
    if(a)printf("NA\n");
  }
  return 0;
}

Measured memory_bytes: 616
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    map<int, ll> mp;
    rep(i, n) {
        ll a;
        cin >> a;
        ++mp[a];
    }
    ll max_num = 0;
    ll second_max_num = 0;
    for ( auto tmp_mp : mp ) {
        if ( tmp_mp.first > max_num && tmp_mp.second >= 2 ) {
            second_max_num = max_num;
            max_num = tmp_mp.first;
        }
        else if ( tmp_mp.first > second_max_num && tmp_mp.second >= 2 ) {
            second_max_num = max_num;
        }
    }
    if ( mp[max_num] >= 4 ) {
        cout << max_num * max_num << endl;
    }
    else { 
        cout << max_num * second_max_num << endl;
    }
}


Measured memory_bytes: 6528
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};

use std::io::prelude::*;

fn input<T>() -> T
    where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let x: i64 = input();
    let mut m: Vec<i64> =
        (0..n).map(|_| input()).collect();
    let mut s = m.clone();
    if s[0] > x {
        s[0] = x;
    }

    for i in 0..s.len() - 1 {
        if s[i] + s[i + 1] > x {
            if s[i+1] >= s[i+1] + s[i] - x {
                s[i+1] -= s[i+1] + s[i] - x;
            } else {
                s[i] -= s[i+1] + s[i] - x - s[i+1];
                s[i+1] = 0;
            }
        }
    }
    let mut r = 0;
    for i in 0..s.len() {
        r += m[i] - s[i];
    }
    println!("{}", r);
}

Measured memory_bytes: 6396
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstdint>
const uint32_t MOD = 1e9 + 7;

int main() {
	int h;
	std::cin>>h;
	int w;
	std::cin>>w;
	int wall[h][w];
	memset(wall, 0, sizeof(wall));
	long long dp[h][w];
	memset(dp, 0, sizeof(dp));

	for (int i = 0; i < h; ++i) {
		std::string c;
		std::cin>>c;
		for (int j = 0; j < c.size(); ++j) {
			if (c[j] == '#') {
				wall[i][j] = -1;
			} else {
				wall[i][j] = 1;
				dp[i][j] = 1;
			}
		}
	}
	for(int i = 1; i < w; i++)
		dp[0][i] = (dp[0][i] == 1 && dp[0][i-1] == 1)?dp[0][i-1]:0;
	for(int i = 1; i < h; i++)
		dp[i][0] = (dp[i][0] == 1 && dp[i-1][0] == 1)?dp[i-1][0]:0;
	for (int i = 1; i < h; ++i) {
		for (int j = 1; j < w; ++j) {
			if (dp[i][j] == 1)
				dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
		}
	}
	printf("%lld\n", dp[h-1][w-1]);
	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int K,N;
  cin>>K>>N;
  int A[N];
  REP(i,N)cin>>A[i];
  int ans=K;
  REP(i,N-1){
    ans=min(ans,K-A[i+1]+A[i]);
  }
  ans=min(ans,-A[0]+A[N-1]);
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  string S, T;
  cin >> S >> T;
  int m = -1;
  rep(i, S.size() - T.size() + 1) {
    bool ok = true;
    rep(j, T.size()) {
      if (S[j + i] != '?' && S[j + i] != T[j]) {
        ok = false;
      }
    }
    if (ok) {
      m = i;
    }
  }
  if (m != -1) {
    string ans = "";
    rep(i, m) {
      if (S[i] != '?') {
        ans += S[i];
      } else {
        ans += "a";
      }
    }
    ans += T;
    for (int i = m + T.size(); i < S.size(); i++) {
      if (S[i] != '?') {
        ans += S[i];
      } else {
        ans += "a";
      }
    }
    cout << ans << endl;
  } else {
    cout << "UNRESTORABLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using D = double;
using LD = long double;
const int mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int main(){
    int h,n; cin >> h >> n;
    vector<int> a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    vector<vector<int>> dp(1005, vector<int> (10005));
    rep(j,h+1){
        dp[0][j] = 1e9;
    }
    dp[0][0] = 0;
    rep(i,n){
        rep(j,h+1){
            if(j < a[i]) dp[i+1][j] = min(dp[i][j], dp[i+1][0] + b[i]);
            else{
                dp[i+1][j] = min(dp[i][j], dp[i+1][j-a[i]] + b[i]);
            }
        }
    }
    cout << dp[n][h] << endl;
}


Measured memory_bytes: 39552