akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second


ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t;
    ll h,w;
    cin >> h >> w  ;
    cin >> m ;
    ll row[h]={0},col[w]={0};
    set<pair<ll,ll>> ma;
    rep(i,m)
    {
          cin >> l >> r ;
          l--;
          r--;
          ma.insert({l,r});
          row[l]++;
          col[r]++;
    }
    vector<pair<ll,ll>> v1,v2;
    rep(i,h) v1.pb({row[i],i});
    rep(i,w) v2.pb({col[i],i});
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    ans=v1[h-1].fi+v2[w-1].fi-1;
    ll mx=ans+1;
    set<ll> s1,s2;
    for(i=h-1;i>=0;--i)
    {
          if(v1[i].fi==v1[h-1].fi) s1.insert(v1[i].se);
          else break;
    }
    for(i=w-1;i>=0;--i)
    {
          if(v2[i].fi==v2[w-1].fi) s2.insert(v2[i].se);
          else break;
    }
    f=0;
    for(auto it:s1)
    {
          for(auto it1:s2)
          {
                if(ma.find({it,it1})==ma.end()) 
                {
                      
                      f=1;
                      break;
                }
          }
          if(f) break;
    }
    if(f) cout << mx ;
    else cout << ans ;
    return 0;
}

Measured memory_bytes: 64200
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

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

//--------------------------

int main() {

  int a, b, c; cin >> a >> b >> c;
  int x, y; cin >> x >> y;
  ll cost = 0;

  int slice_min = min(x, y);

  if(a+b>2*c) {
    cost += 2*c*slice_min;
  }else {
    cost += a*slice_min + b*slice_min;
  }

  if(x-slice_min!=0) {
    if(a>2*c) cost += 2*c*(x-slice_min);
    else cost += a*(x-slice_min);
  }else {
    if(b>2*c) cost += 2*c*(y-slice_min);
    else cost += b*(y-slice_min);
  }

  cout << cost << endl;

  return 0;
}


Measured memory_bytes: 764
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e) int i; for(int i=s;i<=e;i++)
#define repd(i,s,e) int i; for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    read(n);
    
   int s=0;
   rep(i,1,n){
   	if(i%3==0 || i%5==0) continue;
   	s+=i;
   }
   cout<<s<<endl;
    
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it!= v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cout << #v << " = "; array_out(v , ##__VA_ARGS__);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >> (istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

random_device seed_gen; mt19937_64 mtrand(seed_gen());
#define MOD 1000000007
//////////////////////////////////////////

int main(){
  ins(S);
  int N = sz(S);
  int i = 0;
  while(S[i] != 'C'){
    i++;
    if(i == N) die("No");
  }
  int j = i + 1;
  if(j == N) die("No");
  while(S[j] != 'F'){
    j++;
    if(j == N) die("No");
  }
  out("Yes");
}

Measured memory_bytes: 256
W, H, N = [int(n) for n in input().split()]

sx = 0
ex = W
sy = 0
ey = H

for n in range(N):
  x, y, a = [int(w) for w in input().split()]
  if a == 1:
    sx = max(sx, x)
  elif a == 2:
    ex = min(ex, x)
  elif a == 3:
    sy = max(sy, y)
  else:
    ey = min(ey, y)

print(max(0,ex-sx)*max(0,ey-sy))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<vector<long>> data(N, vector<long> (26));
  char a;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 10; j++){
      cin >> a;
      data.at(i).at(a - 'a')++;
    }
  }
  sort(data.begin(), data.end());
  long count = 1, ans = 0, flag = 0;
  for(int i = 0; i < N - 1; i++){
    flag = 1;
    for(int j = 0; j < 26; j++){
      if(data.at(i).at(j) != data.at(i + 1).at(j)){
        flag = 0;
        break;
      }
    }
    if(flag == 1){
      count++;
    } else {
      ans += (count * (count - 1)) / 2;
      count = 1;
    }
  }
  ans += (count * (count - 1)) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 24576
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 10/06/2017 12:04:19
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ull unsigned long long
using namespace std;

int main(){
	int n;
	int maxx = 0, minn = 1001;
	cin>>n;
	int x;
	for(int  i = 0; i < n; i++){
		cin>>x;
		maxx = max(maxx, x);
		minn = min(minn, x);
	}
	cout<<maxx - minn<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
int res[N*10];
int main(){
	int n;
	cin>>n;
	int r=sqrt(n);
	for(int i=1;i<=r;i++){
		for(int j=1;j<=r;j++){
			for(int k=1;k<=r;k++){
				int key=i*i+j*j+k*k+i*j+j*k+i*k;
				if(key>N)break;
				else res[key]++;
			}
		}
	}
	for(int i=1;i<=n;i++){
		printf("%d\n",res[i]);
	}
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        const int NUM = 55556;
        var bo = new bool[NUM];
        var prime = new List<int>();
        for (var i = 2; i < NUM; i++)
            if (!bo[i])
            {
                if(i%5==1)
                prime.Add(i);
                for (var j = 2 * i; j < NUM; j += i)
                    bo[j] = true;
            }
        WriteLine(string.Join(" ", prime.Take(num)));
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}

Measured memory_bytes: 13192
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void) {
  string str;
  while(getline(cin, str)) {
    for(int a = 0 ; a < 26 ; a++) {
      
      for(int i = 0 ; i < str.size() ; i++) {
	if('a' <= str[i] && str[i] <= 'z') 
	  str[i] = (str[i] == 'z')? 'a' : str[i] + 1;
      }
      
      if(str.find("the") != string::npos ||
	 str.find("this") != string::npos ||
	 str.find("that") != string::npos) cout << str << endl;
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > ret;
    // 小さい素数から順に試し割りしていく
    for (ll i = 2; i*i <= n; i++) {
        if (n % i != 0) { continue; }
        int e = 0;
        while (n % i == 0) {
            e++;
            n /= i;
        }
        ret.push_back(make_pair(i, e));
    }
    // 2 ~ sqrt(N) で試し割りして残ったものは必ず素数
    if (n != 1) {
        ret.push_back(make_pair(n, 1));
    }
    return ret;
}

ll extgcd(ll a, ll b, ll &x, ll &y) {
    ll d = a;
    if (b != 0) {
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    } else {
        x = 1; y = 0;
    }
    return d;
}

ll modinv(ll a, ll m) {
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

ll mod_comb(ll n, ll r, ll mod) {
    ll ans_mul = 1, ans_div = 1;

    for (int i = 0; i < r; i++) {
        ans_mul *= (n-i);
        ans_div *= (i+1);
        ans_mul %= mod;
        ans_div %= mod;
    }
    return ans_mul * modinv(ans_div, mod) % mod;
}

int main() {
    ll N, M;
    const ll MOD = ll(1e9+7);

    cin >> N >> M;

    vector<pair<ll, ll> > v = prime_factorize(M);

    ll ans = 1;

    for (int i = 0; i < v.size(); i++) {
        ans *= mod_comb(N+v[i].second-1, v[i].second, MOD);
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>
#include<iomanip>

using namespace std;
using ll = long long;

double solve(int n, int k, int now, vector<pair<double, double> >point, vector<int>used){
  if(n == k) return 0;
  double ret = 0.0;
  for(int i = 0; i < n; i++){
    if(!used[i]){
      used[i] = 1;
      ret += solve(n, k+1, i, point, used);
      ret += pow(pow(point[i].first - point[now].first, 2.0) + pow(point[i].second - point[now].second, 2.0), 0.5);
      used[i] = 0;
    }
  }
  return ret/(n-k);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n; cin >> n;
  double ans = 0.0;
  vector<pair<double, double> > point(n);
  for(int i = 0; i < n; i++) cin >> point[i].first >> point[i].second;
  vector<int> t(n, 0);
  for(int i = 0; i < n; i++){
    t[i] = 1;
    ans += solve(n, 1, i, point, t);
    t[i] = 0;
  }
  cout << fixed << setprecision(16) << ans/n << endl;
  // end-----------------------------------------------
  cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#define L 100005

typedef struct pp {
  char n[100];
  int t;
}P;

P Q[L];
int head,tail,n;
void enqueue(P x){
  Q[tail]=x;
  tail = (tail+1)%L;
}

P dequeue() {
  P x =Q[head];
  head = (head+1)%L;
  return x;
}
int min (int a, int b){return a < b ? a : b;}

int main(){
  int el = 0,c;
  int i,q;
  P u;
  scanf("%d %d",&n,&q);
  for(i=1;i <= n; i++){
    scanf("%s",Q[i].n);
    scanf("%d",&Q[i].t);
  }
  head = 1;
  tail = n+1;

  while(head != tail){
    
    u = dequeue();
    c = min(q,u.t);
    u.t -=c;
    el += c;
    if(u.t > 0)enqueue(u);
    else{
      printf("%s %d\n",u.n,el);
    }
  }
  return 0;
}

      



Measured memory_bytes: 11864
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
takashi=b[a[0]-1]
for i in range(1,n):
    takashi+=b[a[i]-1]
    if a[i]-a[i-1]==1:
        takashi+=c[a[i-1]-1]

print(takashi)


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

int main() {
  int A, B;
  cin >> A >> B;
  A = (A + 11) % 13;
  B = (B + 11) % 13;
  if (A == B) {
    cout << "Draw" << endl;
  }
  else if (A > B){
    cout << "Alice" << endl;
  }
  else {
    cout << "Bob" << endl;
  }
}


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

using namespace std;

int main() {
    int n, p;
    while (cin >> n >> p, n || p) {
        vector<int> v(n, 0);
        int bowl = p;
        int k = 0;
        while (1) {
            if (0 < bowl) {
                bowl --;
                v[k] ++;
                if (v[k] == p) {
                    cout << k << endl;
                    break;
                }
            } else {
                bowl = v[k];
                v[k] = 0;
            }
            k = (k + 1) % n;
        }
    }
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define ll long long
using namespace std;
template <typename T> void chkmax(T &x, T y) {x = x > y ? x : y;}
template <typename T> void chkmin(T &x, T y) {x = x < y ? x : y;}
template <typename T> void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); x *= f;
}
const int N = 1010, inf = 1e9;
int n, vis[N], col[N], a[N][N];
void dfs(int x, int c) {
	vis[x] = 1, col[x] = c;
	for (int y = 1; y <= n; y++) {
		if (!a[x][y]) continue;
		if (!vis[y]) dfs(y, c ^ 1);
			else if (col[y] == c) {cout << "-1\n"; exit(0);}
	}
}
int main() {
	read(n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) {
			char c = getchar();
			while (!isdigit(c)) c = getchar();
			a[i][j] = c - '0';
		}
	dfs(1, 0);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			if (!a[i][j]) a[i][j] = (i == j) ? 0 : inf;
	for (int k = 1; k <= n; k++)
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				chkmin(a[i][j], a[i][k] + a[k][j]);
	int ans = 0;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			chkmax(ans, a[i][j]);
	cout << ans + 1 << '\n';
	return 0;
}

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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent = false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);
// lambda: [](T1 x)->T2{return y;}
// simple lambda: [](T x){return x;}

LL solve(int N, int M) {
    VI H(N), W(M);
    rep(i, N) cin >> H[i];
    rep(i, M) cin >> W[i];

    VI wsums;
    rep(i, M) {
        int w = 0;
        REP(j, i, M) {
            w += W[j];
            wsums.PB(w);
        }
    }

    sort(ALL(wsums));

    LL cnt = 0;

    rep(i, N) {
        int h = 0;
        REP(j, i, N) {
            h += H[j];
            cnt += upper_bound(ALL(wsums), h) - lower_bound(ALL(wsums), h);
        }
    }

    return cnt;
}

int main(void) {
    int N, M;
    while (cin >> N >> M, N) cout << solve(N, M) << endl;

    return 0;
}

Measured memory_bytes: 15512
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
 int a,b,c,x,ans=0;
 cin>>a>>b>>c>>x;
 for(int i=0;i<=a;i++)
 for(int j=0;j<=b;j++)
 for(int k=0;k<=c;k++)
 {
  if((i*500+j*100+k*50)==x)
  ans++;        
 } 
 cout<<ans;
 return 0;   
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol k, x; cin >> k >> x;
    if(500*k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
    

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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define OKawaiiKoto ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2*1e18;
const ld PI=3.14159265358979323846;
int main()
{
    OKawaiiKoto
    ll n,cur=1,cnt=26,t=0;
    string s;
    cin>>n;
    while(cur<=n) cur+=cnt,cnt*=26,t++;
    cnt/=26,cur-=cnt;
    n-=cur;
    while(t--)
    {
        char c=n%26+'a';
        n/=26;
        s.insert(s.begin(),c);
    }
    cout<<s;
}


Measured memory_bytes: 3652
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out



def main():
    n = int(input())
    ans = 0
    
    for i in range(1, n):
        primes = get_prime_factors(i)
        num = 1
        for k, v in Counter(primes).items():
            num *= v+1
        ans += num
    print(ans)
        

if __name__ == "__main__":
    main()

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

int main() {
  string s;
  cin >> s;
  int N;
  N = s.size();
  
  int count = 0;
  
  for (int i = 0; i < N; i++) {
    if (i%2 == 0) {
      if (s.at(i) == 'L') {
        break;
      }
    }
    else if (s.at(i) == 'R') {
      break;
    }
    count++;
  }
  
  if (count == N) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" <<endl;
  }
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>

#define ll long long

using namespace std;

inline int read() {
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

int a[10][10],b[10][10];

int main() {
	int n=read(),m=read(),k=read();
	int ans=0;
	for (int i=1;i<=n;i++) {
		for (int j=1;j<=m;j++) {
			char ch=getchar();
			if (ch=='#') a[i][j]=1;
		}
		getchar();
	}
	for (int i=0;i<=(1<<n)-1;i++) {
		for (int j=0;j<=(1<<m)-1;j++) {
			for (int ii=1;ii<=n;ii++) {
				for (int jj=1;jj<=m;jj++) {
					b[ii][jj]=a[ii][jj];
				}
			}
			for (int k=0;k<=n;k++) {
				if (i&(1<<k)) {
					for (int jj=1;jj<=m;jj++) {
						b[k+1][jj]=0;
						//cout<<"a:  "<<k<<" "<<jj<<endl;
					} 
				}
			}
			for (int k=0;k<=m;k++) {
				if (j&(1<<k)) {
					for (int ii=1;ii<=n;ii++) {
						b[ii][k+1]=0;
					} 
				}
			}
			int cnt=0;
			for (int ii=1;ii<=n;ii++) {
				for (int jj=1;jj<=m;jj++) {
					if (b[ii][jj]) cnt++;
				}
			}
			if (cnt==k) {
				ans++;
				//for (int ii=1;ii<=n;ii++) {
				//	for (int jj=1;jj<=m;jj++) {
				//		cout<<b[ii][jj]<<" ";
				//	}
				//	cout<<endl;
				//}
				//cout<<i<<" "<<j<<endl;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

namespace ABC086_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int limit = int.Parse(Console.ReadLine());

            int now_x = 0;
            int now_y = 0;

            int[] time = new int[limit];
            int[] target_x = new int[limit];
            int[] target_y = new int[limit];
            string[] datas = new string[3];

            int interval = 0;
            bool can = true;

            for (int i = 0; i < limit; i++)
            {
                string input = Console.ReadLine();
                datas = input.Split(' ');
                time[i] = int.Parse(datas[0]);
                target_x[i] = int.Parse(datas[1]);
                target_y[i] = int.Parse(datas[2]);
            }

            for (int i = 0; i < limit; i++)
            {

                if (i != 0)
                {
                    interval = time[i] - time[i - 1];
                }
                else
                {
                    interval = time[0];
                }

                can = Search(interval, target_x[i], target_y[i], now_x, now_y);

                if (!can)
                {
                    Console.WriteLine("No");
                    return;
                }
                now_x = target_x[i];
                now_y = target_y[i];
            }
            Console.WriteLine("Yes");
        }

        public static bool Search(int time, int target_x, int target_y, int now_x, int now_y)  //timeには現在の時間と次回のゴールまでの時間の差を入力すること
        {
            int dis = Math.Abs(target_x - now_x) + Math.Abs(target_y - now_y);

            if (dis > time || dis % 2 != time % 2)
            {
                return false;
            }

            return true;
        }
    }
}


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

int main(void)
{
	long i, n;
	long taka = 1, aoki = 1;
	long cuntt, cunta; 
	long t[1000], a[1000];
	
	scanf("%ld", &n);
	for (i = 0; i < n; i++)
		scanf("%ld %ld", &t[i], &a[i]);
	
	for (i = 0; i < n; i++)
	{
		cuntt = taka / t[i];
		if (taka % t[i] != 0) cuntt++;
		cunta = aoki / a[i];
		if (aoki % a[i] != 0) cunta++;
	
		taka = ((cuntt <= cunta) ? cunta : cuntt) * t[i];
		aoki = ((cuntt <= cunta) ? cunta : cuntt) * a[i];
	}
	
	printf("%ld\n", taka + aoki);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

	string S; 
	cin >> S;

	set<char> exist;
	for (int i = 0; i < S.size(); i++) {
		exist.insert(S[i]);
	}

	for (char i = 'a'; i <= 'z'; i++) {
		if (exist.find(i) == exist.end()) {
			cout << i << endl;
			return 0;
		}
	}

	cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // float operations
#include <stack> // stack
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <regex> // regular expressions

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << std::setprecision(10) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,k;
	std::cin >> n >> k;
	std::vector<int> a(n);
	std::vector<int> f(n);
	rep(i,n) std::cin >> a[i];
	rep(i,n) std::cin >> f[i];
	std::sort(all(a));
	std::sort(all(f),std::greater<int>());

	int cost;
	int l = -1, r = 1e18+1;
	while(r-l>1) {
		int mid = (l+r)/2;
		int possible = true;
		int tk = k;
		rep(i,n) {
			if(a[i]*f[i]<=mid) continue;
			int newa = mid/f[i];
			if(tk>=a[i]-newa) {
				tk-=a[i]-newa;
				continue;
			}
			possible = false;
			break;
		}
		if(possible) r = mid;
		else l=mid;
	}
	print(r);

	return 0;
}


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

signed main(void)
{
	char c;
	cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    string s[2];

    while(cin >> s[0] >> s[1])
    {
        if(s[0] == "0") break;
        int h = 0, b = 0;

        //REP(4)if(s[0][i] == s[1][i]) h++;

        REP(4)rep(j,4)if(s[0][i] == s[1][j])
        {
            if(i == j ) h++;
            else b++;
        }
        cout << h << " " << b << endl;

    }
    return 0;
}

Measured memory_bytes: 912
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define chmax(x, y) x = max(x,y);

int main(){
ll n;
int k;
cin>>n>>k;
ll cnt=0;

while (n>0){
  n=n/k;
  cnt+=1;
}
cout<<cnt;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (std::abs(a - c) <= d) {
    cout << "Yes" << endl;
  } else if (std::abs(a - b) <= d && std::abs(b - c) <= d) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.range;
import std.conv;
import std.algorithm;
import std.string;
import std.array;
import std.conv;
import std.typecons;

void main()
{
    while (1)
    {
        int a, b, c;
        readf("%d %d %d\n", &a, &b, &c);
        if (a == -1 && b == -1 && c == -1)
        {
            break;
        }
        if (a == -1 || b == -1){writeln("F");continue;}
        if (a + b >= 80)
        {
            writeln("A");
            continue;
        }
        if (a + b >= 65)
        {
            writeln("B");
            continue;
        }
        if (a + b >= 50)
        {
            writeln("C");
            continue;
        }
        if (a + b >= 30)
        {
            if (c >= 50)
                writeln("C");else
            writeln("D");
            continue;
        }writeln("F");
    }
}



Measured memory_bytes: 2452
N,W=map(int,input().split())
w=[]
v=[]
for _ in range(N):
    ww,vv=map(int,input().split())
    w.append(ww)
    v.append(vv)
INF=float("inf")
max_v=max(v)*N +1
dp=[[INF for i in range(max_v)] for j in range(N+1)]
dp[0][0]=0
for i in range(N):
    for j in range(max_v):
        if j - v[i]>=0:
            dp[i+1][j]=min(dp[i+1][j],dp[i][j-v[i]]+w[i])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j])

for i in range(max_v):
    if dp[N][i] <=W:
        ans=i
print(ans)


Measured memory_bytes: 328628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    ll n;
    cin >> n;
    ll k;
    cin >> k;

    vector<ll> x(n);
    REP(i, n)
    {
        cin >> x[i];
    }

    ll chidx = lower_bound(all(x), 0) - x.begin();
    vector<ll> absx(n);
    REP(i, n)
    {
        x[i] = abs(x[i]);
    }

    ll st = max(0ll, chidx - k);

    ll tmin = LLINF;
    FOR(i, st, min(chidx+1,n-k+1))
    {
        if(i + k - 1 == chidx - 1){
            chmin(tmin, x[i]);
        }
        else if(i == chidx){
            chmin(tmin, x[i + k - 1]);
        }
        else{
            chmin(tmin, x[i] + x[i + k - 1] + min(x[i], x[i + k - 1]));
        }
    }
    cout << tmin << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<62;
constexpr double eps = (1e-9);

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

  int n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  // A だけに集中したときに何冊読めるか
  int idx = -1;
  ll time = 0;
  rep(i, n) {
    if (time + a[i] <= k) {
      time += a[i];
      idx = i;
    } else {
      break;
    }
  }

  ll ans = idx + 1;

  // a を諦めながら b を読む
  int idx_b = -1;
  ll tmp = ans;
  rep(i, m) {
    while (time + b[i] > k && idx >= 0) {
      time -= a[idx];
      idx--;
      tmp--;
    }
    if (time + b[i] <= k) {
      time += b[i];
      idx_b = i;
      tmp++;
    } else {
      break;
    }
    chmax(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int m=0;
  vector<int>a(n);
  vector<int>b(n);
  for (int i=0;i<n;i++) {
    cin >> a.at(i) >> b.at(i); 
  }
  for (int i=0;i<n;i++) {
    if(a[i]==b[i]){
    m++;
    }
    else{
    m=0;
    }
    if(m==3){
    cout << "Yes" << endl;
    return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll t[1010], a[1010];

ll solve() {
    ll rt = t[0], ra = a[0];
    for (int i = 1; i < n; i++) {
        ll m = max(rt / t[i] + (rt%t[i]!=0), ra / a[i] + (ra%a[i]!=0));
        rt = m * t[i];
        ra = m * a[i];
    }
    return rt + ra;
}

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

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

    input();
    cout << solve() << endl;
}

Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from collections import Counter
def resolve():
    n, m = map(int, input().split())
    E = [[] for _ in range(n)]

    for _ in range(m):
        u, v = map(int, input().split())
        u -= 1; v -= 1
        E[u].append(v)
        E[v].append(u)


    cnt = 0
    color = [-1] * n
    def dfs(v):
        if color[v] != -1:
            return False
        color[v] = cnt
        queue = [v]
        for v in queue:
            for nv in E[v]:
                if color[nv] == -1:
                    color[nv] = cnt
                    queue.append(nv)
        return True

    for v in range(n):
        cnt += dfs(v)

    print(Counter(color).most_common()[0][1])
resolve()

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

using namespace std;

#define mod 1000000007
#define sz(c)  (int) c.size()
#define all(c) c.begin(), c.end()
#define tr(container,it) for(__typeof(container.begin()) it = container.begin();it != container.end(); it++)
#define present(s,x) s.find(x) != s.end()
#define cpresent(c,x) find(all(c),x) != c.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,a,b) for(int i=a; i<b;i++)
#define ini(n) scanf("%d",&n)
#define opn printf("\n")

 
#define TRACE
 
#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
#else
 
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)    
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif 

typedef pair<int,int> pi;
typedef vector<pi> vp;
typedef vector<vp> vvp;
typedef vector<int> vi;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector< vi > vvi;
typedef priority_queue<int> pq;
typedef priority_queue<int, vi , greater<int> >minpq;
typedef priority_queue<pi,vp,greater<pi> > mpq;


int main(){
	//ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n;
	cin>>n;
	ll a[200003];
	rep(i,n){
		cin>>a[i+1];
		a[i+1] -= i+1;
	}
	
	sort(a+1,a+n+1);
	
	ll median;
	if(n&1){
		int mid = (n+1)/2;
		median = a[mid];
	}
	else{
		median = (a[(n/2)] + a[(n+1)/2])/2; 
	}
	ll ans = 0;
	for(int i=1; i<=n ;i++){
		ans = ans+abs(a[i]-median);
	}
	cout<<ans<<endl;
}

	

	



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

int main(){

    int n, k;
    string s;
    cin >> n >> k >> s;

    if(s[k - 1] == 'A' ){
        s[k - 1] = 'a';
    }else if(s[k - 1] == 'B'){
        s[k-1] = 'b';
    }else{
        s[k-1] = 'c';
    }

    cout << s;

    return 0;
}

Measured memory_bytes: 3120
#include"bits/stdc++.h"
using namespace std;
#define rep(i, N) for(int i=0; i<N; ++i)
using ul = unsigned long;
using ll = long long;

bool binarySearch(int t, vector<int>& S) {
    int i = 0;
    int j = S.size();
    int s;
    while (i < j) {
        s = (i+j)/2;
        if (S[s] == t) {
            return true;
        } else if(S[s] > t) {
            j = s;
        } else {
            i = s + 1;
        }
    }
    return false;
}

int main() {
    int n;
    cin >> n;
    vector<int> S(n);
    int s;
    for (int i=0; i<n; ++i) {
        cin >> s;
        S[i] = s;
    }
    int q;
    cin >> q;
    int t;
    int cnt = 0;
    for (int i=0; i<q; ++i) {
        cin >> t;
        if (binarySearch(t, S)) cnt++;
    }
    cout << cnt << endl;
}



Measured memory_bytes: 3104
s = input()

l = list(set(list(s)))

ans = 100

for x in l:
    a = [-1]
    for i in range(len(s)):
        if s[i]==x:
            a.append(i)
    a.append(len(s))
    b = 0
    for j in range(len(a)-1):
        b = max(b,a[j+1]-a[j]-1)
    ans = min(ans,b)

print(ans)


Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ




//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  vector<vector<int>> vec(3,vector<int>(3)) ;
  vector<vector<int>> vecvec(3,vector<int>(3)) ;

  
  REP(i,3){
    REP(j,3){
      vecvec.at(i).at(j) = 0 ;
    }
  }  
  
  REP(i,3){
    REP(j,3){
      cin >> vec.at(i).at(j) ;
    }
  }
  int n ;
  cin >> n ;
  REP(i,n){
    int a ;
    cin >> a ;
    REP(j,3){
      REP(k,3){
        if(vec.at(j).at(k)==a){
          vecvec.at(j).at(k) = 1 ;
        }
      }
    }
  }
  
  bool flag = false ;
  
  REP(i,3){
    if(vecvec.at(i).at(0)==1 && vecvec.at(i).at(1)==1 && vecvec.at(i).at(2)==1){
      flag = true ;
    }
  }

  REP(i,3){
    if(vecvec.at(0).at(i)==1 && vecvec.at(1).at(i)==1 && vecvec.at(2).at(i)==1){
      flag = true ;
    }
  }
  
  if(vecvec.at(0).at(0)==1 && vecvec.at(1).at(1)==1 && vecvec.at(2).at(2)==1){
    flag = true ;
  }
  
  if(vecvec.at(2).at(0)==1 && vecvec.at(1).at(1)==1 && vecvec.at(0).at(2)==1){
    flag = true ;
  }
  
  

  
  if(flag){
    cout << "Yes" <<endl ;
  }
  else{
    cout << "No" <<endl ;
  }
  
  
  return 0 ;
}

Measured memory_bytes: 256
#include <cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a<b?a:b
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i+1]=1e9;r(m*n)w=n-i%n,p[w]=m(p[w],p[w-1]+c[i/n]*d[w-1]);printf("%d\n",p[n]);}

Measured memory_bytes: 1036
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a - 1) * (b - 1) << endl;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            Console.WriteLine(N * N * N);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] s1 = s.split("");
        Arrays.sort(s1);
        String t = sc.nextLine();
        String[] t0 = t.split("");
        Arrays.sort(t0);
        String[] t1 = new String[t.length()];
        for(int i = 0;i<t.length();i++){
            t1[i] = t0[t.length()-i-1];
        }

        int min = Math.min(s.length(),t.length());
        int flag = 0;
        int flag2 = 0;
        for(int i = 0;i<min;i++){
            if(s1[i].compareTo(t1[i]) < 0){
                flag++;
                break;
            }
            if(s1[i].compareTo(t1[i]) == 0){
                flag2++;
            }
        }
        if(flag > 0){
            System.out.println("Yes");
        }else if(flag2 == s.length() && s.length() < t.length()){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23124
package main

import "fmt"

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

  S := make([]string,N)
  for i:=0;i<N;i++{
    fmt.Scan(&S[i])
  }
  m:= make(map[string]int)
  for i:=0;i<N;i++{
    first_char := S[i][0:1]
    if (first_char == "M" || first_char == "A" || first_char == "R" || first_char == "C" || first_char == "H"){
      m[first_char] += 1
    }
  }
  // fmt.Println(m)
  P := [10]string{"M","M","M","M","M","M","A","A","A","R"}
  Q := [10]string{"A","A","A","R","R","C","R","R","C","C"}
  R := [10]string{"R","C","H","C","H","H","C","H","H","H"}

  result :=0
  for i:=0;i<10;i++{
    // fmt.Println(m[P[i]]*m[Q[i]]*m[R[i]])
    result += m[P[i]]*m[Q[i]]*m[R[i]]
  }
  fmt.Println(result)
  // if len(m) <= 2{
  //   fmt.Println(0)
  // }
  // if len(m) == "C"{
  //   result := 1
  //   for _,v := range m{
  //     result *= v
  //   }
  //   fmt.Println(result)
  // }
  // if len(m) == 4{
  //   sum := 1
  //   for _,v := range m{
  //     sum *= v
  //   }
  //   result :=0
  //   for _,v := range m{
  //     result += (sum/v)
  //   }
  //   fmt.Println(result)
  // }
  // if len(m) == 5{
  //   result := 0
  //   for k1,v := range m{
  //     for k2,x := range m{
  //       for k3,y := range m{
  //         if k1 != k2 && k2 != k3{
  //           result += v*x*y
  //         }
  //       }
  //     }
  //   }
  //   fmt.Println(result)
  // }
}


Measured memory_bytes: 4736