akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    if (r < 1200) PRINT("ABC");
    else if (r < 2800) PRINT("ARC");
    else PRINT("AGC");
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  rep(i,m) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].emplace_back(y);
  }

  vector<int> dp(n, 0);

  auto dfs = [&](auto& f, int u, int p)->void{
    if (dp[u]) return ;
    for (auto v : g[u]) {
      if (v == p) continue;
      f(f, v, u);
      dp[u] = max(dp[u], dp[v] + 1);
    }
  };

  int res = 0;
  for (int i = 0; i < n; i++) {
    if (!dp[i]) dfs(dfs, i, -1);
    res = max(res, dp[i]);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 13116
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  string s;
  scan(s);
  int n = s.length();
  rep (i, n) {
    if (s[i] == 'U' || s[i] == 'D') {
      continue;
    }
    if (i % 2 == 0 && s[i] == 'R') {
      continue;
    }
    if (i % 2 == 1 && s[i] == 'L') {
      continue;
    }
    print("No");
    return 0;
  }
  print("Yes");

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

int main()
{
        ll N, Y; cin >> N >> Y;

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

                for (int j = 0; j <= N; ++j) {

                        int k = N - i - j;
                        if (k < 0) continue;

                        ll ans = i * 10000 + j * 5000 + k * 1000;
                        if (ans == Y) {
                                cout << i << " " << j << " " << k << endl;
                                exit(0);
                        }

                }
        }
        cout <<"-1 -1 -1" << endl;


}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    int n=s.length(),sum=0;
    if(s[0]=='A' && s[1]>='a' && s[1]<='z' && s[n-1]>='a' && s[n-1]<='z'){
        for(int i=2;i<n-1;i++){
            if(s[i]!='C' && s[i]>='A' && s[i]<='Z')
                break;
            if(s[i]=='C')sum++;
        }
        if(sum==1) cout<<"AC";
        else cout<<"WA";

    }
    else cout<<"WA";
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>//..1..2..3:Correct:Solved by F2tekkz:)
#define ll long long
#define str string
#define sonic ios_base::sync_with_stdio(0)
using namespace std;
ll n , m , k , i , j , t , q , cnt , cnt1 , cnt2 , cnt3;
ll cnt4 , cnt5 , ans , ans1 , ans2 , ans3 , sum , sum1 , sum2;
ll mini = 1e9 , maxi = -999;
int main(){
	sonic;
	str s1 , s2 , s3;
	cin >> s1 >> s2;
	cin >> n >> m;
	cin >> s3;
	if(s3 == s2){
		cout << n << " " << m - 1;
	}
	else{
		cout << n - 1 << " " << m;
	}
}
//     *    *  *  ****    *    *   *
//    *	*   * *   *      * *   *   *
//   *****  **    ****  *****  *****
//   *   *  * *      *  *   *      *
//   *   *  *  *  ****  *   *  *****

//   *  *  *****  *
//   * *     *    *
//   **      *    *
//   * *     *    *
//   *  *    *    ****

//   ****  ****  *       *
//   *      **   *      * *
//   ****   **   *     *****
//      *   **   *     *   *
//   ****  ****  ****  *   *



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
#define INF 1e9
int main() {
    int N,M; cin>>N>>M;
    vi cost(M);
    vi key_spec(M,0);
    for (int i = 0; i < M; i++){
        int a,b; cin>>a>>b;
        cost[i]=a;
        for (int j = 0; j < b; j++){
            int c; cin>>c;
            key_spec[i]+=(1 << (c-1));
        }
    }
    
    vector<vi> dp(M,vi((1 << N), INF));
    dp[0][0]=0;
    for (int i = 0; i < M; i++){
        for (int j = 0; j < (1 << N); j++){
            if(i==0){
                if(j==key_spec[0])dp[i][j]=cost[i];
            }else{
                dp[i][j | key_spec[i]]=min(dp[i][j | key_spec[i]],dp[i-1][j]+cost[i]);
                dp[i][j]=min(dp[i][j],dp[i-1][j]);
            }
        }
    }
    if(dp[M-1][(1<<N)-1]==INF)dp[M-1][(1<<N)-1]=-1;
    cout<<dp[M-1][(1<<N)-1]<<endl;
}

Measured memory_bytes: 19320
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

struct point
{
	double x;
	double y;
};

void koch(int d, point p1, point p2)
{
	if (d == 0)
	{
		return;
	}
	double th = M_PI * 60.0 / 180.0;
	point s, t, u;
	s.x = (2.0 * p1.x + p2.x) / 3.0;
	s.y = (2.0 * p1.y + p2.y) / 3.0;
	t.x = (p1.x + 2.0 * p2.x) / 3.0;
	t.y = (p1.y + 2.0 * p2.y) / 3.0;
	u.x = s.x + (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th);
	u.y = s.y + (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th);
	koch(d - 1, p1, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(d - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(d - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(d - 1, t, p2);
}


void solve()
{
	int n;
	cin >> n;
	point p1, p2;
	p1.x = 0.0;
	p1.y = 0.0;
	p2.x = 100.0;
	p2.y = 0.0;
	printf("%.8f %.8f\n", p1.x, p1.y);
	koch(n, p1, p2);
	printf("%.8f %.8f\n", p2.x, p2.y);
}

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

Measured memory_bytes: 1200
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	scanf("%lld",&n);
	if(n==100000)
	printf("90909");
	else if(n>=10000)
	printf("%d",n-10000+910);
	else if(n>=1000)
	printf("909");
	else if(n>=100)
	printf("%d",n-90);
	else if(n>=10)
	printf("9");
	else
	printf("%d",n);
 } 

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

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

#define lim 1000000000000000000
long long exp(long long a)
{
    long long n=0;
    while(a>0)
    {
        n++;
        a/=10;
    }
    return n;
}
int main()
{
    long long prev,i,N,ans,zerc=0;
    cin>>N;
    long long ar[100005];
    fr(i,N)
    {
        cin>>ar[i];
        if(ar[i]==0) zerc++;
    }
    if(zerc>0) ans=0;
    else{
    ans=1;
    prev=1;
    fr(i,N)
    {
        if(ans>1&&ar[i]>=lim) {
            ans=-1;
            break;
        }
        else if(ans==lim&&ar[i]>1)
        {
            ans=-1;
            break;
        }
        prev=ans;
        ans*=ar[i];
        if(ans>lim||ans<prev)
        {
            ans=-1;
            break;
        }
    }
    }
    cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, total; 
  cin >> N;
  
  vector<int>takoyaki(N);
  for(int i = 0;i < N;i++){
  cin >> takoyaki.at(i);
  }
  
  for(int i = 0;i < N;i++){
    for(int j = 0;j < N;j++){
      total = total + takoyaki.at(i) * takoyaki.at(j);
    }
  }
  
  for(int i = 0;i < N;i++){
  total = total - takoyaki.at(i) * takoyaki.at(i);
  }
  
  cout << total / 2 << endl;
}

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

#define LEN 100005

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

P Q[LEN];

int head, tail, n;

void enqueue(P);

P dequeue(void);

int min(int,int);

int main(){
  int elaps = 0;
  int c,i,q;
  P u;

  scanf("%d%d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }

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

void enqueue(P x){
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}

P dequeue(void){
  P x;
  x = Q[head];
  head = (head + 1) % LEN;
  return x;
}

int min(int x, int y){
  if(x<y)return x;
  else return y;
}



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

int main(){
  vector<int> A={1,2,3,5,6,9,10,13,17};
  int N;
  cin>>N;
  for(int i:A)
    if(N==i){
      cout<<"No"<<endl;
      return 0;
    }
  cout<<"Yes"<<endl;
}

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

// 比較関数
bool my_compare(pair<pair<string, int>,int> a, pair<pair<string, int>,int> b) {
    // 基本はfirstで比較
    if(a.first.first != b.first.first){
        // return a.first < b.first; // 昇順
        return a.first.first < b.first.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.first.second != b.first.second){
        return a.first.second > b.first.second;
    }else{
        // どちらも同じ
        return true;
    }
}

int main(){
  int N;
  cin>>N;
  vector<string>S(N);
  vector<int>P(N);
  vector<pair<pair<string,int>,int>>pair1(N);
  rep(i,N){
    cin>>S.at(i);
    cin>>P.at(i);
    //pair.push_back(make_pair(S.at(i),P.at(i)));
    pair1.at(i).first.first=S.at(i);
    pair1.at(i).first.second=P.at(i);
    pair1.at(i).second=i;
  }
  sort(pair1.begin(),pair1.end(),my_compare);
  //reverse(pair.begin(), pair.end());
  rep(i,N){
    //cout<<pair1.at(i).first.first<<" "<<pair1.at(i).second<<endl;
    cout<<pair1.at(i).second+1<<endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(int argc, char const *argv[]) {
  char s[101];
  long k;
  scanf("%s %ld", s, &k);
  for (long i = 0; ; i++) {
    if (s[i] == 0) {
      break;
    }
    if (s[i] != '1') {
      if (k <= i) {
        printf("1\n");
        return 0;
      }
      printf("%c\n", s[i]);
      return 0;
    }
  }
  printf("1\n");
  return 0;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  map<int,int> color;
  multiset<int> s;
  int cur = 1;
  int n;
  cin >> n;
  int ans = 0;
  int v[n];
  for(int i=n-1; i>=0; i--){ 
    cin >> v[i];
  }
  for(int i=0; i<n; i++){
    int x = v[i];
    auto it = s.lower_bound(-x);
    if(s.size() == 0 || it == s.begin()){
      color[x] = cur;
      ans++;
      cur++;
      s.insert(-x);
    }
    else{
      it--;
      color[x] = color[-(*it)];
      s.insert(-x);
      s.erase(it);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 11776
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long Max = 0;
            int cnt = 2;
            if (N != 1)
            {

                for (int i = 0; i < Math.Sqrt(N); i++)
                {
                    long keep = cnt;
                    while (true)
                    {
                        keep *= cnt;
                        if (N < keep)
                        {
                            break;
                        }
                        Max = Math.Max(Max, keep);
                    }
                    cnt++;
                }
            }
            else
            {
                Max = 1;
            }
            Console.WriteLine(Max);

        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 27196
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(l[k-1])

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#define PAPER_C 10
#define PAPER_R 10
using namespace std;
void drop(int p[PAPER_C][PAPER_R], int x,int y){
	if(0<=x && x<PAPER_R && 0<=y && y<PAPER_C){
		p[y][x]++;
	}
	return;
}
int main(){
	int paper[PAPER_C][PAPER_R] = {0};
	int i, j, x, y, size, cnt, max;
	max = 0;
	cnt = PAPER_C * PAPER_R;
	while(scanf("%d,%d,%d", &x, &y, &size) != EOF){
		if(size == 1){
			drop(paper, x, y);
			drop(paper, x-1, y);
			drop(paper, x+1, y);
			drop(paper, x, y-1);
			drop(paper, x, y+1);
		}else if(size == 2){
			for(i=-1;i<2;i++){
				for(j=-1;j<2;j++){
					drop(paper, x+j, y+i);
				}
			}
		}else if(size == 3){
			for(i=-1;i<2;i++){
				for(j=-1;j<2;j++){
					drop(paper, x+j, y+i);
				}
			}
			drop(paper, x-2, y);
			drop(paper, x+2, y);
			drop(paper, x, y-2);
			drop(paper, x, y+2);
		}
	}
	for(i=0;i<PAPER_C;i++){
		for(j=0;j<PAPER_R;j++){
			if(paper[i][j] != 0){
				cnt--;
				if(paper[i][j] > max){
					max = paper[i][j];
				}
			}
		}
	}
	cout << cnt << endl;
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 1208
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
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; }

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    std::ifstream in(string(argv[0]) + ".txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    string s, t, u;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    cin >> u;

    if (s == u) {
        a -= 1;
    }
    if (t == u) {
        b -= 1;
    }

    cout << a << " " << b;

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

template<class T> inline bool chmin(T& a, T b) {if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if(a<b){a=b;return true;}return false;}

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  vector<vector<int>> C(3, vector<int>(3));
  REP(i,3){
    REP(j,3) IN(C[i][j]);
  }
  Vi A(3);
  Vi B(3);
  A[0] = 0;
  B[0] = C[0][0];
  B[1] = C[0][1];
  B[2] = C[0][2];
  A[1] = C[1][0] - B[0];
  A[2] = C[2][0] - B[0];
  bool ok = true;
  REP(i,3){
    REP(j,3){
      if(C[i][j] != A[i] + B[j]) ok=false;
    }
  }
  Yes(ok);
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
template <typename T>
T gcd(T m, T n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
         r %= 1000000007;
         rr %= 1000000007;
    }
    r /= rr;
     r %= 1000000007;
    return r;
}
#define rep(a,b,c) for(ll a = b; a < c; ++i)
ll mod = 1000000007;
//---------------------------------------------------------------------------------------------------
ll f[101010];
void init() {
    f[0] = 1;
    rep(i, 1, 101010) f[i] = (f[i - 1] * i) % mod;
}
//---------------------------------------------------------------------------------------------------
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}
//---------------------------------------------------------------------------------------------------
ll C(int n, int k) {
    ll a = f[n]; // = n!
    ll b = f[n-k]; // = (n-k)!
    ll c = f[k]; // = k!

    ll bc = (b * c) % mod;

    return (a * inv(bc)) % mod;
}
ll pow2_(ll n){
  
  ll div = 1000000007ll;
  ll ans = 0,k=2;
  {
    bitset<48> b(n);
    FOR(i,32){
      ans+=b[i]*k%div;
      ans%=div;
      k*=k;
      k%=div;
    }
  }
  return ans;
}
int main(){
  ll N,M;
  cin>>N>>M;
  vector<ll> A(N);
  ll sum=0;
  FOR(i,N){
    cin>>A[i];
    sum+=A[i];
  }
  sort(A.begin(),A.end(),greater<ll>());
  putYN(A[M-1]*(4*M)>=sum);
  return 0;
}


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

using namespace std;

int read()
{
	int sum = 0, flag = 1;
	char c = getchar();
	for (;c  < '0' ||c >  '9' ;  c= getchar() )
	 if ( ! (c ^ '-') ) flag = - 1;
	for (;c  >= '0' && c <= '9' ; c = getchar() )
	 sum = (sum << 3) + (sum << 1) + (c ^ 48);
	return sum * flag;
} 

int n = read();

int a[1000005];

inline bool cmp(int a, int b)
{
	return a > b;
}

inline void init()
{
	for (int i = 1; i <= n ; i ++)
	 a[i] = read();
	sort(a + 1, a + n + 1, cmp);
}

inline void work()
{
	int cheak = 1;
	for (int i = 1; i <= n ; i++)
	 if (i >= a[i + 1])
	  {
	    for (int j = i + 1 ; ! ( a[j] ^ i ) ; j ++)
		 cheak ^= 1;
		cheak &= (a[i] - i + 1);
		printf(  cheak ? "Second\n" : "First\n"  );
		break;
	  } 
	return;
}

int main()
{
	init();
	work();
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
for(;;){
int n=sc.nextInt();
int m=sc.nextInt();
if(n==0&&m==0)break;
int map[]= new int[n];int me[]= new int[m];
for(int i=0;i<n;i++)map[i]=sc.nextInt();
for(int i=0;i<m;i++)me[i]=sc.nextInt();
int now=0,ans=0;
while(true){
	now+=me[ans];
	ans++;
	if(now>n-2)break;
	now+=map[now];
	if(now>n-2)break;  
}
System.out.println(ans);
 }
}
}

Measured memory_bytes: 27732
package main

import "fmt"

func main() {
	var H, W int
	fmt.Scan(&H, &W)
	pict := make([][]byte, H)
	pictL := make([][]byte, H*2)
	for i := range pict {
		pict[i] = make([]byte, W)
		fmt.Scan(&pict[i])
		for j := 0; j < 2; j++ {
			pictL[i*2+j] = make([]byte, W)
			copy(pictL[i*2+j], pict[i])
		}
	}
	// fmt.Println("H", H, "W", W, "pict", pict, "pictL", pictL)
	for i := 0; i < len(pictL); i++ {
		fmt.Println(string(pictL[i]))
	}
}


Measured memory_bytes: 640
N, K = map(int, input().split())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7
plus = []
lz = 0
minus = []
ans = 1

for k in range(N):
  if A[k] > 0:
    plus.append(A[k])
  elif A[k] < 0:
    minus.append(A[k])
  else:
    lz += 1
plus.sort(reverse = True)
minus.sort()
lp = len(plus)
lm = len(minus)

def main(mp, mm, plus, minus):
  mod = 10 ** 9 + 7
  ans = 1
  for k in range(mp):
    ans = ans * plus[k] % mod
  for k in range(mm):
    ans = ans * minus[k] % mod
  print(ans)
  exit()

if lz + K > N:
  print(0)
  exit()
elif lp == 0: 
  if K % 2 == 1:
    if lz > 0:
      print(0)
      exit()
    else:
      for k in range(K):
        ans = ans * minus[- k - 1] % mod
      print(ans)
      exit()
  else:
    main(0, K, plus, minus)
elif lm == 0:
  main(K, 0, plus, minus)

p = 0
m = 0
for _ in range(K):
  if plus[p] >= -1 * minus[m]:
    p += 1
    if p == lp:
      m = K - p
      break
  else:
    m += 1
    if m == lm:
      p = K - m
      break

if m % 2 == 0:
  main(p, m, plus, minus)
else:
  if p == lp:
    if m != lm:
      main(p - 1, m + 1, plus, minus)
    else:
      if lz > 0:
        print(0)
        exit()
      else:
        main(p, m, plus, minus)
  elif m == lm:
    main(p + 1, m - 1, plus, minus)
  elif p == 0:
    main(p + 1, m - 1, plus, minus)
  else:
    if plus[p] * plus[p - 1] > minus[m - 1] * minus[m]:
      main(p + 1, m - 1, plus, minus)
    else:
      main(p - 1, m + 1, plus, minus)

Measured memory_bytes: 31744
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

struct MyStruct {
	int num, honsu;
};

bool comp(const MyStruct& s, const MyStruct& t) {
	if (s.honsu != t.honsu)
		return s.honsu < t.honsu; // 昇順
	return s.num > t.num;
}

int N, A, B, C;
int v[10];
int INF = pow(10, 9);

int min3(int a, int b, int c) {
	return min(min(a, b), c);
}

int min4(int a, int b, int c, int d) {
	return min(min(a, b), min(c, d));
}

int dfs(int cur, int a, int b, int c) {
	if (cur == N) {
		if (min3(a, b, c) > 0) {
			return abs(A - a) + abs(B - b) + abs(C - c) - 30;
		}
		else {
			return INF;
		}
	}
	else {
		int ret0 = dfs(cur + 1, a, b, c);
		int ret1 = dfs(cur + 1, a + v[cur], b, c) + 10;
		int ret2 = dfs(cur + 1, a, b + v[cur], c) + 10;
		int ret3 = dfs(cur + 1, a, b, c + v[cur]) + 10;
		return min4(ret0, ret1, ret2, ret3);
	}
}


int main() {
	cin >> N >> A >> B >> C;
	REP(i, N) {
		cin >> v[i];
	}

	ANS(dfs(0, 0, 0, 0));


	return 0;
}


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

int main() {
	int A, B;
	cin >> A >> B;
	if (A < 10 && B < 10) {
		cout << A * B << endl;
	}
	else {
		cout << -1 << endl;
	}

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <deque>
#include <set>
using namespace std;
#define MOD 1000000007
long long kaizyo(int N);
long long P(int N, int M);
long long pow(int a, int n) {
	long long result = 1;
	for (int i = 0; i < n; i++) {
		result *= a;
		result = result % MOD;
	}
	return result;
}
int main()
{
	string S, T;
	cin >> S >> T;
	int result = INT32_MAX;
	for (int i = 0; i <= S.size() - T.size(); i++) {
		int tmp = 0;
		for (int j = 0; j < T.size(); j++) {
			if (S[i + j] != T[j]) {
				tmp++;
			}
		}
		if (tmp < result) {
			result = tmp;
		}
	}
	cout << result;
	return 0;
}
long long kaizyo(int N) {
	long long result = 1;
	for (int i = 2; i <= N; i++) {
		result *= i;
		result = result % MOD;
	}
	return result;
}
long long P(int N, int M) {
	long long result = 1;
	for (int i = (N - M + 1); i <= N; i++) {
		result *= i;
		result = result % MOD;
	}
	return result;
}


Measured memory_bytes: 3592
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,m=map(int, input().split())
    if n==1 and m==1:
        ans=1
    elif m==1:
        ans=max(0,n-2)
    elif n==1:
        ans=max(0,m-2)
    else:
        ans=(n-2)*(m-2)
    print(ans)
resolve()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vec t(n),v(n);
  for(ll i=0;i<n;i++) cin >> t[i],t[i]*=2;
  for(ll i=0;i<n;i++) cin >> v[i],v[i]*=2;
  for(ll i=0;i<n-1;i++) t[i+1]+=t[i];
  ll ct=0;
  ll cv=0;
  vec lim(8e4+10);
  for(ll i=0;i<n;i++) {
    if(i) ct--,cv--;
    while(ct<=t[i]) {
      lim[ct]=min(cv,v[i]);
      cv=lim[ct]+1;
      ct++;
    }
  }
  cv=0;
  ct--;
  double ans=0;
  while(ct) {
    cv=min(lim[ct],cv);
    ans+=cv;
    ct--;
    cv++;
  }
  ans*=1/4.0;
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s;
		
		s = sc.next();
		
		sc.close();
		int count[], n = s.length();
		count = new int[27];
		boolean d = true;
		
		for(int i = 0; i < n; ++i) {
			int tmp = s.charAt(i) - 'a';
			count[tmp]++;
		}		
		for(int i = 0; i < 26; ++i) {
			if(count[i] > 1) {
				d = false; 
				break;
			}
		}
		
		if(d)System.out.println("yes");
		else System.out.println("no");
	}

}


Measured memory_bytes: 22868
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    int[] inputArray;
    Set<String> set = new HashSet<>();
    int K;

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int s = sc.nextInt();
        int count=0;

        for(int x=0; x<=k; x++){
            for(int y=0; y<=k; y++){
                int z = s - x - y;
                if(z>=0 && z<=k){
                    count++;
                }
            }
        }

        System.out.println(count);
    }

    double manhattan(Ten point1, Ten point2){
        return Math.abs(point1.getX() - point2.getX()) + Math.abs(point1.getY() - point2.getY());
    }

    void substring(String s, int num){
        for(int i=1; i<=num; i++){
            if(i > K){
                break;
            }
            for(int j=0; j<num; j++){
                if(j + i-1 < num){
//                    System.out.println(s.substring(j, j+i));
                    set.add(s.substring(j, j+i));
                } else {
                    break;
                }
            }
        }
    }

    void permutation(String s, String ans){
        if(s.length() <= 1){
            System.out.println(ans + s);
        } else {
            for(int i=0; i<s.length(); i++){
                permutation(s.substring(0, i) + s.substring(i + 1), ans + s.charAt(i));
            }
        }
    }
}

class Ten{
    private int x;
    private int y;

    Ten(int x, int y){
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Number= Integer.parseInt(sc.next());
		Dice[] dice = new Dice[Number];
		boolean bool=true;
		for(int cnt=0;cnt<Number;cnt++){
			int[] N=new int[6];
			for(int i=0;i<6;i++)N[i]=Integer.parseInt(sc.next());
			dice[cnt]=new Dice(N);
		}
		for(int i=0;i<Number;i++){
			for(int j=0;j<Number;j++){
				if(i!=j) bool=bool&&!(dice[i].equals(dice[j]));
			}
		}
		
		//String order = sc.next();
		//char[] charOrder = order.toCharArray();
		
		
		
			System.out.println(bool?"Yes":"No");
		
		sc.close();
	}

}

class Dice{
	private int[] roll=new int[6];
	private int[] nowRoll= new int[6];
	Dice(int[] N){
		for(int i = 0;i<6;i++){
			this.roll[i]=N[i];
			this.nowRoll[i]=N[i];
		}
	}

	public int getRoll(int i){
		return nowRoll[i];
	}

	public void roll(char c){
		//int dir;
		int[] tmpRoll=new int[6];
		for(int i=0;i<6;i++)tmpRoll[i]=this.nowRoll[i];
		int[][] mapRoll={{3,1,0,5,4,2},{1,5,2,3,0,4},{4,0,2,3,5,1},{2,1,5,0,4,3},{0,2,4,1,3,5},{0,3,1,4,2,5},{5,1,3,2,4,0}};
		int dir=0;
		if(c=='E') dir=0;
		if(c=='N') dir=1;
		if(c=='S') dir=2;
		if(c=='W') dir=3;
		if(c=='R') dir=4;
		if(c=='L') dir=5;
		if(c=='X') dir=6;
		
		for(int i=0;i<6;i++)this.nowRoll[i]=tmpRoll[mapRoll[dir][i]];
	}
	public int getRightRoll(int roll,int front){
		int[][] a={{-1,2,4,1,3,-1},{3,-1,0,5,-1,2},{1,5,-1,-1,0,4},{4,0,-1,-1,5,1},{2,-1,5,0,-1,3},{-1,3,1,4,2,-1}};
		int r=a[roll][front];
		return this.nowRoll[r];
	}
	public boolean equals(Dice d){
		int[] N= new int[6];
		for(int i=0;i<6;i++) N[i]=d.getRoll(i);
		Dice d1 = new Dice(N);
		boolean bool=false;
		
		for(char c: "RRRERRRERRREERRRWRRRWRRRX".toCharArray()){
			boolean eachBool=true;
			for(int i=0;i<6;i++) eachBool=eachBool&&(this.getRoll(i)==d1.getRoll(i));
			d1.roll(c);
			bool=bool||eachBool;
		}	
		return bool;
	}
}

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

int main() {
	int N; cin >> N;
	for(ll h=1LL; h<=3500LL; h++) for(ll n=1LL; n<=3500LL; n++) {
		if ((4LL*h*n-n*N-h*N)!=0 && (h*n*N)%(4LL*h*n-n*N-h*N)==0LL && (4*h*n-n*N-h*N)>0LL) {
			cout << h << " " << n << " " << (h*n*N)/(4LL*h*n-n*N-h*N) << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int az[26];
    for(int i=0; i<26; i++) az[i] = 0;
    char tmp;
    while(scanf("%c", &tmp)!=EOF){
        if(tmp >= 'a' && tmp <= 'z') az[tmp-'a']++;
        else if(tmp >= 'A' && tmp <= 'Z') az[tmp-'A']++;
    }
    for(int i=0; i<26; i++) printf("%c : %d\n", 'a'+i, az[i]);
    return 0;
}


Measured memory_bytes: 2024
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
 
struct node {
 
  int key;
  struct node *left;
  struct node *right;
  struct node *parent;
};
 
typedef struct node* Node;
Node root;
 
Node treeSearch(Node x,int k) {
  if(x == NIL || k == x-> key)
    return x;
  if(k < x->key)
    return treeSearch(x->left,k);
  else return treeSearch(x->right,k );
}
 
void insert(int k) {
   
  Node y = NIL;
  Node x = root;
  Node z; 
   
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
    
 while(x != NIL) {
    y = x;
  if(z->key < x->key)
    x = x->left;
   
  else x = x->right;
 }
  z->parent = y;
   
  if(y == NIL)
    root = z;
   
  else if(z->key < y->key)
    y->left = z;
   
  else
    y->right = z;
   
}
 
void inorder(Node u) {
   
  if(u->left != NIL)
    inorder(u->left);
  printf(" %d",u->key);
  if(u->right != NIL) 
    inorder(u->right);
}
 
void preorder(Node u) {
  printf(" %d",u->key);
  if(u->left != NIL)
    preorder(u->left);
  if(u->right != NIL)
    preorder(u->right);
}
 
int main(void) {
   
  int i,n,x;
  char c[5];
   
  scanf("%d",&n);
   
  for(i=0;i<n;i++) {
  scanf("%s",c);
  if(c[0] == 'f') {
    scanf("%d",&x);
    if(treeSearch(root,x) != NIL)
      printf("yes\n");
    else printf("no\n");
  }
  else if(c[0] == 'i') {
    scanf("%d",&x);
    insert(x);
  }
  else if(c[0] == 'p') {
    if(root != NIL)  
      inorder(root);
    printf("\n");
    if(root != NIL)
      preorder(root);
    printf("\n");
     
  }
 }
return 0;
}

Measured memory_bytes: 19364
from collections import deque


n = int(input())

l = deque()
for _ in range(n):
    command = input().split()
    if command[0] == 'insert':
        l.appendleft(command[1])
    elif command[0] == 'delete':
        if command[1] in l:
            l.remove(command[1])
    elif command[0] == 'deleteFirst':
        l.popleft()
    else:
        l.pop()

print(' '.join(l))



Measured memory_bytes: 69732
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
c=[0]
ci=0
for i in range(1,10**5+1):
  if is_prime(i) and is_prime((i+1)//2):
    ci+=1
  c.append(ci)
q=int(input())
lr=[list(map(int,input().split())) for _ in range(q)]
for lri in lr:
  print(c[lri[1]]-c[lri[0]-1])

Measured memory_bytes: 28992
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <string>
#include <cmath>
using namespace std;

int main(void){
	string a, b, c;
	cin >> a >> b >> c;
	if((a[a.length() - 1] == b[0]) && (b[b.length() - 1] == c[0])){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
    int N;
    cin >> N;

    int A[110];
    for (int i=0; i < N; i++){
        cin >> A[i];
    }
    
    int max = 0;
    int min = 1000000000;
    for (int i=0; i < N; i++){
        if (A[i] > max) {
            max = A[i];
        }
        if (A[i] < min){
            min = A[i];
        }
    }
    cout << (max - min) << endl;
}

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

int main()
{
    int n;
    cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    for (int i = 2; i <= n; i++)
        F[i] = F[i - 1] + F[i - 2];

    cout << F[n] << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<cmath>

#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e10

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; }
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef std::pair<ll, ll> P;

using namespace std;

bool pairCompare(const P& f, const P& s){
    return f.first < s.first;
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<P> p(n);

    rep(i, n){
        cin >> p[i].first;
        cin >> p[i].second;
    }
    sort(all(p), pairCompare);

    ll k = m;
    ll ans = 0;
    rep(i, n){
        ll val;
        val = min(p[i].second, k);
        ans += p[i].first*val;
        k -= val;
        if(k == 0) break;
    }
    cout << ans;
}

Measured memory_bytes: 1792
N = int(input())
H = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0 #初期化
ans = max(cnt, ans)
print(ans)

Measured memory_bytes: 20480
#include<bits/stdc++.h>
using namespace std;
struct Node{
  int key;
  Node *right,*left,*parent;
};
Node *root,*NIL;
Node * find(Node *u,int k){
  while(u != NIL && k!=u->key){
    if(k<u->key)u=u->left;
    else u = u -> right;
  }
  return u;
}
void insert(int k){
    Node *y = NIL;
  Node *x = root;
  Node *z;
  z=(Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent = y;
  if(y==NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}
void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->left);
  cout << " " << u->key;
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL)return;
  cout << " " << u->key;
  preorder(u->left);
  preorder(u->right);
}
int main(){
  int n,i,x;
  string com;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> com;
    if(com == "find"){
      cin >> x;
      Node *t = find(root,x);
      if(t!=NIL)cout << "yes" << endl;
      else cout << "no" << endl;
    }else if(com == "insert"){
      cin >> x;
      insert(x);
    }else if(com == "print"){
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 21964
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define MAX 500005

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

struct st{
    int lo;
    int hi;
    int index;
}s[MAX];

int n,m,a,b,val=0,clo=0,chi=0,tlo,thi,arr[MAX],cnt[MAX*50],ans[MAX];

bool cmp(st s1,st s2)
{
    int tmp1=s1.lo/sqrt(n);
    int tmp2=s2.lo/sqrt(n);
    return tmp1==tmp2?s1.hi<s2.hi:tmp1<tmp2;
}

void my_add(int in)
{val+=++cnt[in]==1?1:0;}

void my_sub(int in)
{val-=--cnt[in]==0?1:0;}

int main() {
    scanf("%d",&n); scanf("%d",&m);
    for(int i=1;i<=n;i++)
        scanf("%d",&arr[i]);
    
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&a,&b);
        s[i].lo=a,s[i].hi=b,s[i].index=i;
    }
    sort(s,s+m,cmp);
    for(int i=0;i<m;i++)
    {
        tlo=s[i].lo,thi=s[i].hi;
        for(int k=clo;k<tlo;k++)
            my_sub(arr[k]);
        for(int k=chi+1;k<=thi;k++)
            my_add(arr[k]);
        for(int k=tlo;k<clo;k++)
            my_add(arr[k]);
        for(int k=thi+1;k<=chi;k++)
            my_sub(arr[k]);
        ans[s[i].index]=val;
        clo=tlo,chi=thi;
        // 1번 실수
    }
    for(int i=0;i<m;i++)
        printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 15424
n,k = gets.chomp.split(" ").map(&:to_i)
x = gets.chomp.split(" ").map(&:to_i)
minus = x.select{|x| x < 0}.reverse
plus = x.select{|x| x >= 0}
if minus.length == n
  puts -x[-k]
elsif plus.length == n
  puts x[k-1]
else
  i = plus.length >= k ? k-1 : plus.length-1
  j = k-i-2
  time = j == -1 ? plus[i] : plus[i] - minus[j]
  min_time = time
  if j != -1
    min_time = plus[i] < -minus[j] ? time + plus[i] : time - minus[j]
  end
  i -= 1
  j += 1
  while i != -2 && j <= minus.length-1
    time -= plus[i+1]
    time += plus[i] if i != -1
    time -= minus[j]
    time += minus[j-1] if j != 0
    min_time = [plus[i] < -minus[j] ? time + plus[i] : time - minus[j],min_time].min
    min_time = time if min_time > time && i == -1
    i -= 1
    j += 1
  end
  puts min_time
end

Measured memory_bytes: 23320
////////////////////////////////////////////////NITISH//////////////////////////////////////////////


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define sz(a) (ll)((a).size())
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define repA(i,a,n) for(int i=a;i<=n;i++)
#define repB(i,a,n) for(int i=a;i>=n;i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()


void solve(){
    ll n,k,a,b,c=0,g,ma1=0,ma2=0,x,d=0,y,s1=0,s2=0,y2,z2,q;
    string s="ACL";
    cin>>n;
    for(int i=0;i<n;i++)cout<<s;
    
}


int main(){
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }

return 0;
}




//////////////////////////////////////////////////////END////////////////////////////////////////////////


Measured memory_bytes: 3540
import math

N, D = map(int, input().split())

cnt = 0
p_list = []

for i in range(N):
    tmp = list(map(int, input().split()))
    p_list.append(tmp)

for i in range(N):
    for j in range(i+1, N):
        num = 0
        for k in range(D):
            num += (p_list[i][k] - p_list[j][k]) ** 2
        num = math.sqrt(num)
        if num.is_integer():
            cnt += 1

print(cnt)

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

const int MAX = 16;
const int NG = -1;

int N;
vii states[MAX];

int sub(ll flag) {
    REP (i, N) if ((flag >> i) & 1) { // i番目が正直者
        FORE (state, states[i]) {
            int x = state.first, y = state.second;
            if (((flag >> x) & 1) != y) return NG;
        }
    }
    return __builtin_popcount(flag);
}

int solve() {
    int ans = 0;
    REP (i, 1<<N) ans = max(ans, sub(i));
    return ans;
}

int main() {
    cin >> N;
    REP (i, N) {
        int a, x, y;
        cin >> a;
        REP (ii, a) {
            cin >> x >> y; x--;
            states[i].push_back(make_pair(x, y));
        }
    }
    cout << solve() << endl;
}

Measured memory_bytes: 256