akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    string S;
    cin >> S;
    char A = S[0],B = ' ';
    int a = 0,b = 0;
    rep(i,4){
        if(A==S[i]){
            a++;
            continue;
        }
        if(B==' ')B = S[i];
        if(B==S[i])b++;
    }
    if(a==2&&b==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

#ifndef ONLINE_JUDGE
freopen(cin, "r", stdin);
freopen(cout, "w", stdout);
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int temp;
	for (int i=1; i<=5; ++i) {
		cin >> temp;
		if (!temp) {
			cout << i << '\n';
			return 0;
		}

	}
}


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

int main(){
  int n,k;
  cin >> n >> k;
  long long int a[k+1];
  int p1,p2;
  p1 = 0;
  p2 = k;
  
  for(int i=0;i<k;i++){
    cin >> a[i];
  }
  
  for(int i=0; i<n-k;i++){
    cin >> a[p2];
    if(a[p1] < a[p2]){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
    p1 += 1;
    p2 += 1;
    if(p1 >= k+1)
      p1 = 0;
    if(p2 >= k+1)
      p2 = 0;
  }
}

Measured memory_bytes: 5192
#include<stdio.h>
#include<stdbool.h>

int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	bool result = true;

	//横
	if(! ( (0+r<=x) && (x+r<=W) ) ){
		result = false;
	}
	//縦
	if(! ( (0+r<=y) && (y+r<=H) ) ){
		result = false;
	}
	if(result){
		puts("Yes");
	}
	else{
		puts("No");
	}
	return 0;
}



Measured memory_bytes: 2112
#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
#ifndef CrafterKolyan
#define endl '\n'
#endif

pair<int, int> a[100000];

signed main() {
#ifndef CrafterKolyan
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a, a + m);
    int cur = n + 1;
    int ans = 0;
    for (int i = m - 1; i >= 0; --i) {
        if (cur < a[i].second) {
            continue;
        }
        cur = a[i].first;
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

using pdi = pair<ld, int>;

int main(){
    int N, n = 0;
    cin >> N;
    vector<ld> x, y;
    vector<pdi> p;
    rep(i, N){
        ld a, b;
        cin >> a >> b;
        if(a != 0 || b != 0){
            x.pb(a), y.pb(b);
            p.pb(pdi(atan2(b, a), n));
            n++;
        }
    }
    sort(all(p));
    ld ans = 0;
    rep(i, n){
        ld sumx = 0, sumy = 0;
        rep(j, n){
            int k = p[(i+j)%n].second;
            sumx += x[k], sumy += y[k];
            ans = max(ans, sumx*sumx + sumy*sumy);
        }
    }
    cout << sp(15) << sqrt(ans) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
double distt (pair<int,int>n1, pair<int,int> n2)
{
  double d = sqrt((n1.first - n2.first) * (n1.first - n2.first) + (n1.second - n2.second) * (n1.second - n2.second));
  return d;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int perm = 1;
  for (int i = 1; i <=n; ++i)
    perm *= i;
  // n.first = x , n.second = y
  vector<pair<int,int>>a(n+1);
  for (int i = 1; i <= n; ++i){
    int x, y;
    cin >> x >> y;
    a[i] = {x, y};
  }
  map<pair<int,int>, double>dist;
  for (int i = 1; i < n; ++i)
  {
    for (int j = i+1; j <= n; ++j)
    {
      double d = distt(a[i], a[j]);
      dist[{i,j}] = d;
      dist[{j,i}] = d;
    }
  }
  double avg = 0;
  vector<int>tmp(n);
  iota(tmp.begin(), tmp.end(), 1);
  do{
    //for (auto e: tmp) cout << e << " ";
    //cout << '\n';
    for (int i = 0; i < n-1; ++i)
    {
      avg += dist[{tmp[i],tmp[i+1]}];
    }
  }while(next_permutation(tmp.begin(), tmp.end()));
  cout << fixed << setprecision(10)<< avg / (double)perm << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a1,a2,a3,tyouhou=0,hisigata=0;
	while(scanf("%d,%d,%d",&a1,&a2,&a3)!=EOF)
	{
		if(a1*a1+a2*a2==a3*a3)
			tyouhou++;
		else
		{
			if(a1==a2)
				hisigata++;
		}
	}
	printf("%d\n%d\n",tyouhou,hisigata);
	return 0;
}

Measured memory_bytes: 596
fun main(args: Array<String>) {
    val (N, M) = listOfInt()
    val A = listOfInt().sortedDescending()
    val total = A.sum()
    var good = A.subList(0, M).all { (it * 4 * M) >= total }
    val ans = if (good) "Yes" else "No"
    println(ans)
}


fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)



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

int main() {
    int N; cin >> N;
    vector<tuple<string,int,int>> res(N);
    for(int i=0; i<N; i++){
        string S; int P;
        cin >> S >> P;
        res.at(i)=make_tuple(S,100-P,i+1);
    }
    sort(res.begin(),res.end());
    for(int i=0; i<N; i++){
        int n;
        tie(ignore,ignore,n)=res.at(i);
        cout << n << endl;
    }
}

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

int main()
{
  int K, S;
  cin >> K >> S;

  int counter = 0;
  rep(i, K + 1)
  {
    rep(j, K + 1)
    {
      int tmp = S - i - j;
      if ((0 <= tmp) && (K >= tmp))
      {
        counter++;
      }
    }
  }

  cout << counter << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)



int main(){
    int N,K;
    cin>>N>>K;
    cout<<N-K+1<<endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll N, W, H;
    cin >> N >> W >> H;
    
    vector<ll> imos_x(W + 5, 0), imos_y(H + 5, 0);
    REP(i, N){
        ll x, y, w;
        cin >> x >> y >> w;
        
        imos_x[max(x - w, 0LL)]++;
        imos_x[min(x + w, W + 1)]--;
        imos_y[max(y - w, 0LL)]++;
        imos_y[min(y + w , H + 1)]--;
    }
    
    bool ok = true;
    if(imos_x[0] <= 0){
        ok = false;
    }
    for(ll i = 1; i < W; i++){
        imos_x[i] += imos_x[i - 1];
        if(imos_x[i] <= 0){
            ok = false;
        }
    }
    
    if(ok){
        cout << "Yes" << endl;
        return 0;
    }
    
    ok = true;
    if(imos_y[0] <= 0){
        ok = false;
    }
    for(ll i = 1; i < H; i++){
        imos_y[i] += imos_y[i - 1];
        if(imos_y[i] <= 0){
            ok = false;
        }
    }
    
    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 4420
#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define to_lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define to_upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define Mod 1000000007
using namespace std;

// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// print vector
template <typename T> 
inline ostream &operator<<(ostream &out, vector<T> &a) {
    for(auto &x : a) out << x <<" ";
    // return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}
ll power(ll x, unsigned ll y, ll p=Mod)  
{  
    ll res = 1;
    x = x % p;
    while (y > 0)  
    {    
        if (y & 1)  
            res = (res*x) % p;    
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 
ll modInverse(ll A,ll M=Mod)
{
    return power(A,M-2,M);
}
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;
}
int main()	
{
	#ifdef SANS
		freopen("ongoingin.txt","r",stdin);
		freopen("ongoingout.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		vector<ll> a(n),b(n);
		cin>>a;
		for(int i=0; i<n; i++)
			b[i]=LLONG_MAX;
		b[0]=0;
		b[1]=abs(a[0]-a[1]);
		for(int i=2; i<n; i++)
		{
			for(int j=1; j<=min(i,k); j++)
				b[i]=min(b[i],b[i-j]+abs(a[i]-a[i-j]));
		}
		cout<<b[n-1]<<endl;
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const long INF = 1L << 60;

int a[440];
long sum[440][440];
long dp[440][440];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++) {
		sum[i][i + 1] = a[i];
		for (int j = i + 2; j <= n; j++)
			sum[i][j] = sum[i][j - 1] + a[j - 1];
	}
	for (int i = 2; i <= n; i++) {
		for (int l = 0; l + i <= n; l++) {
			int r = l + i;
			dp[l][r] = INF;
			for (int m = l + 1; m < r; m++) {
				dp[l][r] = min(dp[l][r], dp[l][m] + dp[m][r] + sum[l][r]);
			}
		}
	}
	cout << dp[0][n] << endl;
}

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

long long int mod = 1000000007;

long long int f[1010100];
void init() {
    f[0] = 1;
    for(int i = 1; i < 1010100; i++) f[i] = (f[i - 1] * i) % mod;
}

long long int inv(long long int x) {
    long long int res = 1;
    long long int k = mod - 2;
    long long int y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}

long long int C(int n, int k) {
    long long int a = f[n]; // = n!
    long long int b = f[n-k]; // = (n-k)!
    long long int c = f[k]; // = k!

    long long int bc = (b * c) % mod;

    return (a * inv(bc)) % mod;
}

void Main() {
  int x, y;
  cin >> x >> y;
  // 1 * m + 2 * n = x; -> (1)
  // 2 * m + 1 * n = y; -> (2)
  // (2) * 2 - (1) -> 3 * m = y * 2 - x;
  // (1) * 2 - (2) -> 3 * n = x * 2 - y;
  int m = (y * 2 - x) / 3, n = (x * 2 - y) / 3;
  if ((x + y) % 3 != 0 || min(m, n) < 0) {
    cout << 0 << endl;
    return;
  }


  init();
  cout << C(m + n, min(m, n)) << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 8192
#include<iostream>

using namespace std;

int main() {
	int n, d, x, ans = 0;
	int a[100], p[100];

	cin >> n >> d >> x;

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

	for (int i = 0; i < n; i++) {
		p[i] = (d - 1) / a[i];
	}

	for (int i = 0; i < n; i++) {
		ans = ans + p[i];
	}

	cout << ans + n + x << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import deque

S = input()
Q = int(input())

t = deque(S)
reverse = False
for _ in range(Q):
    query = input()
    if query[0] == '1':
        reverse = not reverse
    elif query[0] == '2':
        _, F, C = query.split()
        if F == '1':
            if reverse:
                t.append(C)
            else:
                t.appendleft(C)
        elif F == '2':
            if reverse:
                t.appendleft(C)
            else:
                t.append(C)
result = ''.join(t)
if reverse:
    result = result[::-1]
print(result)

Measured memory_bytes: 75992
/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

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 repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a)
{ int sz = a.size(); for(int i=0;i<a.size();i++)cout << a[i] << (i < sz-1 ? ' ' : '\n'); }
void ioboost(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}
///////////////////////////////////////////////////////////

int n,m;
vi g[200020];
int used[200020];
vi res;
bool dfs(int x,int y){
  used[x]++;
  int update = 0;
  for(int i : g[x]){
    if(i != y && !used[i]){
      update = 1;
      if(dfs(i,y)){
        res.pb(x + 1);
        return true;
      }
    }
  }
  if(!update){
    res.pb(x+1);
    return true;
  }else return false;
}
int main(void){
  ioboost();

  cin >> n >> m;
  rep(i,m){
    int a,b;cin >> a >> b;
    a--,b--;
    g[a].pb(b);
    g[b].pb(a);
  }

  used[0] = used[g[0][0]] = 1;

  dfs(0,g[0][0]);
  vi p1 = res;

  res.clear();

  dfs(g[0][0],0);
  vi p2 = res;
  reverse(all(p2));

  int sz1 = p1.size();
  int sz2 = p2.size();
  cout << sz1 + sz2 << '\n';
  rep(i,sz1)cout << p1[i] << ' ';
  rep(i,sz2)cout << p2[i] << (i < sz2 - 1 ? ' ' : '\n');
  return 0; 
}


Measured memory_bytes: 17016
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

int ds(int n) {
  int r = 0;
  while (n > 0) {
    r += n % 10;
    n /= 10;
  }
  return r;
}

int main(void) {

  ll h;
  cin >> h;

  int d = 0;
  while ((1LL << d) <= h) d++;

  cout << (1LL << d) - 1LL << endl;
}


Measured memory_bytes: 256
N=int(input())
A=[int(i) for i in input().split()]
mod=10**9+7
Pinv=[1]*(N+1)
for i in range(1,N+1):
    Pinv[i]=pow(i,mod-2,mod)
aPinv=[1]*(N+1)
aPinv[0]=0
for i in range(1,N):
    aPinv[i+1]=aPinv[i]+Pinv[i+1]
    aPinv[i+1]%=mod
exc=[1]*(N+1)
nexc=1
for i in range(1,N+1):
    nexc*=i
    nexc%=mod
ans=0
for i in range(1,N+1):
    t=A[i-1]
    s=(aPinv[N-i+1]+aPinv[i]-1)
    t=(t*s)%mod
    t=(nexc*t)%mod
    ans+=t
    ans%=mod
print(ans)

Measured memory_bytes: 62576
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
using mint = ll;
const int NUM = 3000;
mint fact[NUM + 1], fact_inv[NUM + 1], inv[NUM + 1];
int p;
ll b[3000];
mint combi(long long N_, long long K_){
    static const int Mod_ = p;
    if(fact[0] == 0){
        inv[1] = fact[0] = fact_inv[0] = 1;
        for(int i = 2; i <= NUM; i++){
            inv[i] = inv[Mod_ % i] * (Mod_ - Mod_ / i) % Mod_;
        }
        for(int i = 1; i <= NUM; i++){
            fact[i] = fact[i - 1] * i % Mod_;
            fact_inv[i] = fact_inv[i - 1] * inv[i] % Mod_;
        }
    }
    if(K_ < 0 or K_ > N_) return 0;
    return fact_inv[K_] * fact[N_] % Mod_ * fact_inv[N_ - K_] % Mod_;
}
mint hcomb(long long N_, long long K_){
    return ((N_ | K_) == 0) ? 1 : combi(N_ + K_ - 1, K_);
}
int main(){
    cin >> p;
    rep(i,p){
        int a;
        cin >> a;
        if(a){
            b[0] += 1;
            ll t = 1;
            for(int j = p - 1; j >= 0; j--){
                b[j] -= combi(p-1,j) * t;
                t *= -i;
                t %= p;
            }
        }
    }
    rep(i,p)cout << (b[i] % p + p) % p<< " \n"[i == p - 1];
}

Measured memory_bytes: 384
//package TrackAndFieldCompetition;
import java.util.*;
public class Main {
	class Kiroku implements Comparable<Kiroku> {
		int number;
		Double time;
		Kiroku(int number, Double time) {
			this.number = number;
			this.time = time;
		}
		@Override
		public int compareTo(Kiroku k) {
			return time.compareTo(k.time);
		}
		@Override
		public String toString() {
			return number + " " + time;
		}
		
	}
	
	static void senshutsuIn(Kiroku[][] t, Kiroku[] h, Kiroku[] s) {
		int sidx = 0;
		int hidx = 0;
		for(int i = 0; i < 3; i++) {
			s[sidx] = t[i][0];
			sidx++;
			s[sidx] = t[i][1];
			sidx++;
		}
		for(int i = 0; i < 3; i++) {
			for(int j = 2; j < 8; j++) {
				h[hidx] = t[i][j];
				hidx++;
			}
		}
	}
	
	static void haisyaIn(Kiroku[] s, Kiroku[] h) {
		s[6] = h[0];
		s[7] = h[1];
	}
	
	//??¨24??? 1???8??? ?¨?3??? ????????????2??????????????? ??????????????????2?????????
	void doIt() {
		Scanner sc = new Scanner(System.in);
		Kiroku[][] table = new Kiroku[3][8];
		Kiroku[] haisya = new Kiroku[18];
		Kiroku[] senshutsu = new Kiroku[8];
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 8; j++) {
				table[i][j] = new Kiroku(sc.nextInt(), sc.nextDouble());
			}
		}
		Arrays.sort(table[0]); Arrays.sort(table[1]); Arrays.sort(table[2]);
		senshutsuIn(table, haisya, senshutsu);
		Arrays.sort(haisya);
		haisyaIn(senshutsu, haisya);
		for(int i = 0; i < 8; i++) {
			System.out.println(senshutsu[i].toString());
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}

}

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

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int i[n],p[n],q[n],r[n];
      for(int j=0;j<n;j++)
	cin>>i[j]>>p[j]>>q[j]>>r[j];
      int pp,qq,rr,cc;
      cin>>pp>>qq>>rr>>cc;
      bool flag=true;
      for(int j=0;j<n;j++)
	{
	  //	  cout<<p[j]<<" "<<q[j]<<" "<<r[j]<<" "<<p[j]*4+q[j]*4+r[j]*9<<endl;
	  if(p[j]<=pp &&q[j]<=qq &&r[j]<=rr &&p[j]*4+q[j]*9+r[j]*4<=cc)
	    {
	    cout<<i[j]<<endl;
	    flag=false;
	    }
	}
      if(flag)
	cout<<"NA"<<endl;

    }

}

Measured memory_bytes: 1176
import math
from functools import reduce
import itertools


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
l = list(range(1, K + 1))
ans = K * (K + 1) // 2
for i in itertools.combinations(l, 2):
    ans += 3*(gcd(i[0], i[0], i[1])+gcd(i[0], i[1], i[1]))
for i in itertools.combinations(l, 3):
    ans += 6*gcd(i[0], i[1], i[2])

print(ans)

Measured memory_bytes: 9628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int N;
        int[] a;
        HashMap<Integer, Integer> mp;
        boolean[] ps;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            mp = new HashMap<>();
            a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
                mp.putIfAbsent(a[i], 0);
                int v = mp.get(a[i]);
                mp.put(a[i], v + 1);
            }
            ps = new boolean[1000001];
            for (Map.Entry<Integer, Integer> entry : mp.entrySet()) {
                int v = entry.getKey();
                int tmp = v + v;
                while (tmp < 1000001) {
                    ps[tmp] = true;
                    tmp += v;
                }
            }

            int ans = 0;
            for (int i = 0; i < N; i++) {
                int v = a[i];
                if (!ps[v] && mp.get(v) == 1) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 67036
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var s string
	if sc.Scan() {
		s = sc.Text()
	}
	split := strings.Split(s, " ")
	l, _ := strconv.ParseFloat(split[0], 64)
	speed, _ := strconv.ParseFloat(split[2], 64)
	t, _ := strconv.ParseFloat(split[1], 64)
	if l/speed <= t {
		fmt.Printf("Yes")
	} else {
		fmt.Printf("No")
	}

}


Measured memory_bytes: 1744
N, T = map(int, input().split())
t = list(map(int, input().split()))

ans = 0
time = 0
if N == 1:
    ans = T
else:
    for i in range(0, N-1):
        tmp = t[i+1] - t[i]
        if tmp > T:
            ans += time + T
            time = 0
        else:
            time += tmp
        if i == N-2:
            ans += time + T
        
print(ans)

Measured memory_bytes: 26708
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        var S = ReadLine();
        if ((S.First() == S.Last() && S.Length % 2 == 0) || (S.First() != S.Last() && S.Length % 2 != 0))
        {
            WriteLine("First");
        }
        else
        {
            WriteLine("Second");
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

//Common
using namespace std;using f64 = double;using i64=long long;using u64=unsigned long long;
template<typename T> using Arr=vector<T>;template<typename T> using Func=function<T>;template<typename T> using Str=basic_string<T>;
#define hfor(v, s, e) for(int v=(s);(s)<=v&&v<(e);++v)//half-opened range
#define hfori(v, s, e) for(int v=(e)-1;(s)<=v&&v<(e);--v)//inversion
#define hforo(v, s, e) int v=(s);for(;(s)<=v&&v<(e);++v)//out declaration
#define hforoi(v, s, e) int v=(e)-1; for(;(s)<=v&&v<(e);--v)
#define cfor(v, s, e) hfor(v,(s),(e)+1)//closed range
#define cfori(v, s, e) hfori(v,(s),(e)+1)
#define cforo(v, s, e) hforo(v,(s),(e)+1)
#define cforoi(v, s, e) hforoi(v,(s),(e)+1)
#define rep(v,x) hfor(v,0,(x))
#define repi(v,x) hfori(v,0,(x))
#define repo(v,x) hforo(v,0,(x))
#define all(x) (x).begin(),(x).end()
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define empl emplace
#define emplb emplace_back
#define emplf emplace_front
#define fi first
#define se second
#define cxp constexpr
#define PQMIN(...) std::priority_queue<__VA_ARGS__,Arr<__VA_ARGS__>,greater<__VA_ARGS__>>
template<class... A>
auto ARR(auto n, A&&...a){
	if constexpr(sizeof...(a)==0) return n;
	else return vector(n,ARR(a...));
}

//Math
template<typename T> cxp T inf() { return numeric_limits<T>::max() / 2; }
template<typename T> inline T sq(T x){return x*x;}
cxp int lgc(int x){return 64-__builtin_clzll(x-1);}
cxp int lgf(int x){return 63-__builtin_clzll(x);}
int rd(int lb, int ub){static mt19937 rng(time(0)^i64(new int)); return uniform_int_distribution<int>(lb, ub-1)(rng);}
int rd(int ub=inf<int>()){return rd(0,ub);}
const f64 pi=acosl(-1), eps=1e-10;

//IO
template<typename T>ostream& operator<<(ostream& s, const Arr<T>& a) {for(auto i:a) cout<<i<<' '; return s;}
auto cinint(){i64 x;cin>>x;return x;}
auto cinchr(){char x;cin>>x;return x;}
auto cinints(int n){Arr<i64> a(n);for(auto&i:a)cin>>i;return a;}
#ifndef DEBUG
	//#pragma GCC optimize ("Ofast") //somtimes it become more slower
	auto __PRE_RUN__=(ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),(cout<<fixed<<setprecision(11)), 0);
#endif

//Misc
int sz(const auto& x){return x.size();}
auto split(auto s, auto p){
	Arr<decltype(s)> ret;
	auto it1=s.begin();
	for(auto it2=it1; (it2 = find(it1,s.end(),p)) != s.end(); it1=it2+1)
		ret.pushb({it1, it2});
	ret.pushb({it1,s.end()});
	return ret;
}
template<typename T> T rev(const T& a){return {a.rbegin(),a.rend()};}
Arr<int> range(int n){ Arr<int> ret(n); rep(i,n)ret[i]=i; return ret; }
struct defer{ defer(auto f):f(f){} ~defer(){f();} function<void()> f; };
#define defer(x) auto _##__COUNTER__ = defer([&](){x;});
#define lam(expr, ...) [&](__VA_ARGS__){return expr;}
#define reduce accumulate

#define endl '\n'//not interactive?
#define int i64//MLE?
using pint = pair<int,int>;
using tint = tuple<int,int,int>;

signed main(){
	int n; cin>>n;
	map<string,int> m;
	rep(i,n){
		string s; cin>>s;
		m[s]++;
	}
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;
	return 0;
}



Measured memory_bytes: 3668
n = int(input())

edge = [[] for i in range(n)]

for i in range(n-1):
    f,t = map(int,raw_input().split())
    f -= 1
    t -= 1

    edge[f].append(t)
    edge[t].append(f)

inf = float("inf")
dist1 = [inf for i in range(n)]

dist1[0] = 0
stk = []
for i in edge[0]:
    stk.append([i,1])

while stk:
    t,c = stk.pop()
    if dist1[t] == inf :
        dist1[t] = c
        for i in edge[t]:
            stk.append([i,c+1])

dist2 = [inf for i in range(n)]
dist2[n-1] = 0
for i in edge[n-1]:
    stk.append([i,1])
while stk:
    t,c = stk.pop()
    if dist2[t] == inf :
        dist2[t] = c
        for i in edge[t]:
            stk.append([i,c+1])

fennec = 0
snuke = 0

for i in range(n):
    if dist1[i] <= dist2[i]:
        fennec += 1
    else :
        snuke += 1


if fennec > snuke:
    print "Fennec"
else:
    print "Snuke"

Measured memory_bytes: 36604
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
  string s, t;
  cin >> s >> t;
  int count = 0;
  REP(i, 3) {
    if (s[i] == t[i]) count++;
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;

int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;

	int M = 0;
	for (int i = 1; i <= N; i++) {
		if (i <= K) {
			M += X;
		}
		else {
			M += Y;
		}
	}
	cout << M << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int s;
    io.read(s);
    map<int, int> mp;
    int m = 1;
    while(mp[s] == 0){
        mp[s]++;
        if(s % 2) s = 3 * s + 1;
        else s = s / 2;
        m++;
    }
    cout << m;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))

int main(){
  int n;
  long long a[200000];
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort( a,a+n);
  for(int i=1;i<n;i++){
    if(a[i]==a[i-1]){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef long double ld;
 
int main() {
  int N;
  string S;
  cin>>N>>S;
  string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  rep(i,S.size()){
      for(int j=0;j<=30;++j){
          if(S[i]==ABC[j]){
              S[i]=ABC[j+N];
              break;
          }
      }
  }
  cout <<S<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int a, b;
    cin>>a>>b;
    if(a != b)
    {
        if(a == 1) cout<<"Alice"<<endl;
        else if(b == 1) cout<<"Bob"<<endl;
        else if(a > b) cout<<"Alice"<<endl;
        else cout<<"Bob"<<endl;
    }
    else cout<<"Draw"<<endl;
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

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

	ll n, wt;
	cin>>n>>wt;
	ll a[n], w[n];
	ll val=0;
	for(int i=0;i<n;i++){
		cin>>w[i]>>a[i];
		val+=a[i];
	}
	ll dp[val+1];
	
	for(ll i=val;i>=0;i--){
		dp[i] = INT_MAX;
	}
	dp[0] = 0;
	for(int i=0;i<n;i++){
		for(int j=val;j>=a[i];j--){
			dp[j] = min(dp[j], dp[j-a[i]] + w[i]);
		}
	}
	for(ll i=val;i>=0;i--){
		if(dp[i] <= wt){
			cout<<i;
			return 0;
		}
	}
	//cout<<dp[wt];

	return 0;
}




Measured memory_bytes: 1024
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	static int mod = (int) 1e9 + 7;
	static ArrayList<Integer> gr[];
	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	static long[][] dp;

	static int h[];

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {
			int n = sc.nextInt();
			s = sc.next();
			dp=new long[n+1][n+1];
			
			System.out.println(solve(n));
			
		}

	}

	static String s;

	static int[]v=new int [300000];
	public static long solve(int n) {
		char []ch=s.toCharArray();
		dp=new long[n+1][n+1];
		dp[1][1]=1;
		
		long []pre=new long[n+1];
		for(int i=2;i<=n;i++) {
			for(int j=1;j<=i;j++) {
				pre[j]=pre[j-1]+dp[i-1][j];
				pre[j]%=mod;
			}
	        if (ch[i-2] == '<')
	        {
	            for (int j = 1; j<=i; j++)
	                dp[i][j] = pre[j-1];
	        }
	        else
	        {
	        	
	            for (int j = 1; j<=i; j++)
	                dp[i][j] = (pre[i]-pre[j-1]+mod)%mod;
	        }
	    }
	    int ans = 0;
	    for (int i = 1; i<=n; i++)
	        ans = (int) ((ans+dp[n][i])%mod);
	    
	    return ans;
		}

}

Measured memory_bytes: 246220
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    int y = stoi(S.substr(0,4));
    int m = stoi(S.substr(5,2));
    int d = stoi(S.substr(8,2));
    if(y >= 2019){
        if(m >= 5){
            cout << "TBD" << endl;
        }else{
            cout << "Heisei" << endl;
        }
    }else{
        cout << "Heisei" << endl;
    }
}

Measured memory_bytes: 256
/*input
*/

// #include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <cstdint>
#include <tuple>
#endif
 
using namespace std;
long long mod=1e9+7;
long long INF=1e7;
double EPS = 1e-12;
const long long lim = 2e5+10;
typedef long long int lld;
typedef long long ll;

#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define mset(a, v) memset(a, v, sizeof(a))
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }


#define popcount __builtin_popcountll

ll powP(ll x, ll y) {
    ll ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}


ll Array[lim],BArray[lim],dp[lim];

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt 
    freopen("output.txt", "w", stdout);
    #endif

    lld T,i,p,j,l,e,r,b,c,k,q,a,d,w,x,y,u,v,z,t,curr,prev,sum=0,val,countA=0,indicator=0,pos,h,minA,maxA,type,n,m,ans=0,left,right;
    string A[3];
    val=0;
    cin>>A[0]>>A[1]>>A[2];
    while(1) {
        // Error(val,Array[0],Array[1],Array[2]);
        if(Array[val]==A[val].size()) { cout<<char(val+'A')<<endl; break; }
        Array[val]++;
        val = A[val][Array[val]-1] - 'a';
    }

    return 0;
}





Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  set<ll> g;
  ll n;std::cin >> n;
  for(int i=1;i<=9;i++) for(int j=0;j<=9;j++) g.insert(i*1000+i*100+i*10+j);
  for(int i=0;i<=9;i++) for(int j=1;j<=9;j++) g.insert(j*1000+i*100+i*10+i);
  if(g.find(n)!=g.end()) std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
}


Measured memory_bytes: 380
#include <iostream>
#include <string>

using namespace std;

const int MAX_N = 100;

int main(void) {
  int n;
  string w[MAX_N];
  char last;

  cin >> n;

  bool quit = false;

  for (int i = 0; i < n; i++) {
    cin >> w[i];
    for (int j = 0; j < i; j++) {
      if (w[i] == w[j]) {
        quit = true;
      }
    }
  }

  if (quit) {
    cout << "No" << endl;
    return 0;
  }

  last = w[0][w[0].size()-1];

  for (int i = 1; i < n; i++) {
    if (last != w[i][0]) {
      cout << "No" << endl;
      return 0;
    }

    last = w[i][w[i].size()-1];
  }

  cout << "Yes" << endl;

  return 0;
}



Measured memory_bytes: 256
N = int(input())
F = [''.join(list(map(str, input().split()))) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = [0]*((1<<10)-1)
for i in range(1, 1<<10):
    count = 0
    for j in range(N):
        count += P[j][format(int(F[j], 2)&i, 'b').count('1')]
    ans[i-1] = count
print(max(ans))

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

#define INF INT_MAX/2;
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long ;

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

   ll N;
   cin>>N;

   ll ans;
   for(ll i=1;i*i<=N;i++){
      if((i+1)*(i+1) > N){
         ans = i*i;
      }
   }
   cout<<ans;
   return 0; 
}


Measured memory_bytes: 256
N, M = map(int, input().split())
L = [list(map(str, input().split())) for _ in range(M)]

ac_list = [0 for _ in range(N)]
wa_list = [0 for _ in range(N)]

for i in range(M):
    if ac_list[int(L[i][0]) - 1] != 1:
        if L[i][1] == 'AC':
            ac_list[int(L[i][0]) - 1] = 1
        else:
            wa_list[int(L[i][0]) - 1] += 1

wrong = 0
for i in range(N):
    if ac_list[i] == 1:
        wrong += wa_list[i]

print(sum(ac_list), wrong)



Measured memory_bytes: 33772
#include<bits/stdc++.h>
#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 each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  int w = tx-sx, h = ty-sy;

  //s -> t
  rep(i,h) cout << 'U';
  rep(i,w) cout << 'R';

  //t -> s
  rep(i,h) cout << 'D';
  rep(i,w) cout << 'L';

  //s -> t
  cout << 'L';
  rep(i,h+1) cout << 'U';
  rep(i,w+1) cout << 'R';
  cout << 'D';

  //t -> s
  cout << 'R';
  rep(i,h+1) cout << 'D';
  rep(i,w+1) cout << 'L';
  cout << 'U';

  cout << endl;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:1024000000,1024000000")
/* vim: set fdm=marker */
//{{{
#define __ return
int ATTENTION() {
	/* pls IGNORE this function and go down and HACK me
	 * read this AFTER contest
	 * this function is empty and it will not be called !
	 */

	http://codeforces.com/group/Pmz2A2x7ES
	/* I created a group there.
	 * I hope with the group, people can finish
	 * past contests, which is important for 
	 * increasing rating.
	 * I am still getting familiar with this function.
	 */
	 __ 0;
}
// deprecated because mac doesn't support this...
/* #include <bits/stdc++.h> */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < 0) return gcd(-a, b);
	if(b < 0) return gcd( a,-b);
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}

ll qpow(ll a, ll n, ll mod) {
	a %= mod;
	ll ans = 1LL;
	while(n) {
		if(n & 1) ans = (ans*a % mod);
		a = (a*a % mod);
		n >>= 1;
	}
	return ans;
}

inline ll rev(ll a, ll p) {
	return qpow(a, p - 2, p);
}

#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define rep(x, st, en) for(int x = st; x < en; x++)
#define rer(x, st, en) for(int x = st; x >= en; x--)
#define pb push_back
#define mp make_pair
#define dbgm(msg, var) cerr<<#msg<<" "<<#var<<" = "<<var<<endl; 
#define dbg(var) cerr<<#var<<" = "<<var<<endl;
#define X first
#define Y second
// build prefix sum
template<typename T>
inline void BPS(T* DST, T* SRC, int N, int s = 0) {
	DST[s] = SRC[s];
	rep(i, 1, N) DST[s + i] = DST[s + i - 1] + SRC[s + i];
}
inline int in() { int x; cin>>x; return x; }
#ifdef ALNDBG
namespace alndbg {
	clock_t s, e;
}
#endif

inline void tic() {
#ifdef ALNDBG
	alndbg::s = clock();
#endif
}

inline void toc() {
#ifdef ALNDBG
	alndbg::e = clock();
	cerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<" ms"<<endl;
#endif
}



//}}}

// -------------------- Spliters ------------------------
// BFS求最短路小心vis可能访问过
const int maxn = 1111;

int main() {
	ios::sync_with_stdio(0);
  string s; int w; cin>>s>>w;
  for(int i =0 ;i < s.size(); i+=w) {
    cout<<s[i];
  }
  cout<<endl;
	return 0;
}
// --USE C++11
// *-USE O2



Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順

using namespace std;
using ll = long long int;

int main(){
    int N;cin>>N;
    vector<string> s(N);
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(),s.end()),s.end());
    cout << s.size() << endl;
}

Measured memory_bytes: 9604
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1e5, A = 1e9 + 7;
int n;
P a[MAX_N + 1];
int per[MAX_N + 2];
int inv[MAX_N + 2];

int po(int x, int y) {
    long ans = 1;
    while (y > 0) {
        if (y & 1) ans = ans * x % A;
        x = static_cast<long>(x) * x % A;
        y >>= 1;
    }
    return static_cast<int>(ans);
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i <= n; i++) {
        scanf("%d", &a[i].first);
        a[i].second = i;
    }
    sort(a, a + n + 1);
    
    P ip = P(0, 0);
    for (int i = 0; i < n; i++) {
        if (a[i].first == a[i + 1].first) ip = P(a[i].second, a[i + 1].second);
    }

    per[0] = 1;
    for (int i = 1; i <= n + 1; i++) per[i] = static_cast<long>(per[i - 1]) * i % A;
    inv[n + 1] = po(per[n + 1], A - 2);
    for (int i = n; i >= 0; i--) inv[i] = static_cast<long>(inv[i + 1]) * (i + 1) % A;
    
    for (int i = 1; i <= n + 1; i++) {
        int ans = static_cast<long>(per[n + 1]) * inv[i] % A * inv[n + 1 - i] % A;
        if (n - ip.second + ip.first - i + 1 >= 0) {
            ans -= static_cast<long>(per[n - ip.second + ip.first]) * inv[i - 1] % A
                                         * inv[n - ip.second + ip.first - i + 1] % A; 
        }
        if (ans < 0) ans += A;
        printf("%d\n", ans);
    }
    
    return 0;
}


Measured memory_bytes: 2688