akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/
double dist(double a, double b) {
	return a*a + b*b;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  double X = 0, Y = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    X += x[i];
    Y += y[i];
  }
  X /= n, Y /= n;
	double P = 0.1, d;
  // https://codeforces.com/blog/entry/23554
	for (int i = 0; i < 30000; i++) {
		int f = 0;
		d = dist(X - x[0], Y - y[0]);
		for (int j = 1; j < n; j++) {
			double e = dist(X - x[j], Y - y[j]);
			if (d < e) { d = e; f = j; }
		}
		X += (x[f] - X)*P;
		Y += (y[f] - Y)*P;
		P *= 0.999;
	}
  
  cout.precision(9);
  cout << fixed << sqrtl(d) << '\n';
}


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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

signed main()
{
  int n = in(), m = in();
  int t[m], p[n];
  rep(i, m) t[i] = in();
  fill(p, p + n, 0);
  
  rep(i, m) {
    int cnt = 0;
    rep(j, n) {
      if (t[i] == in()) p[j]++;
      else cnt++;
    }
    p[t[i] - 1] += cnt;
  }
  rep(i, n) print(p[i]);

  return (0);
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, K, i, j, a[101];
    bool dp[100001];

    cin >> N >> K;

    for(i=1; i<=N; i++){
        cin >> a[i];
    }

    for(i=0; i<=K; i++){
        dp[i] = false;
    }

    for(i=1; i<=K; i++){
        for(j=1; j<=N; j++){
            if(i-a[j] >= 0){
                dp[i] = dp[i] | !dp[i-a[j]];
            }
        }
    }

    if(dp[K]) cout << "First" << endl;
    else cout << "Second" << endl;

    return 0;
}

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

#define    int                      long long int
#define    ld                       long double
#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int ttt; cin >> ttt; while(ttt--)
#define    ff                       first
#define    ss                       second
#define    all(container)            container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    sp(x)                    setprecision(x)
#define    bp                       __builtin_popcountll

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}


int32_t main()
{
    speed upp
	int n,x=0;
    cin>>n;
    while(n>0)
    {
        if(n%10 == 7)
            x=1;
        n/=10;
    }
    if(x)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3584
#include<stdio.h>

typedef struct {
    char suit; // One of S, H, C, D
    char value;  // One of 1, 2, ... 9 (not int, but char)
} Card;


void show_cards(Card A[], int N){
    int i;

    for(i = 0; i < N; i++){
        
        printf("%c", A[i].suit);
        printf("%c", A[i].value);
        if(i < N - 1){
            putchar(' ');
        }
        else{
            putchar('\n');
        }
    }
}

void exchange(Card A[], int i, int j){
    Card tmp;
    tmp = A[i];
    A[i] = A[j];
    A[j] = tmp;
}

void bubble_sort(Card A[], int N){
    int i, j;
    for(i = 0; i < N - 1; i++){
        for(j = N - 1; j > i; j--){
            if(A[j].value < A[j-1].value){
                exchange(A, j, j - 1);
            }
        }
    }
}

void selection_sort(Card A[], int N){
    int i, j;
    int idx_min;
    for(i = 0; i < N; i++){
        idx_min = i;
        for(j = i; j < N; j++){
            if(A[idx_min].value > A[j].value){
                idx_min = j;
            }
        }
        if(i != idx_min){
            exchange(A, i, idx_min);
        }
    }
}

void print_stable(int flag){
    if(flag){
        printf("Stable\n");
    }
    else{
        printf("Not stable\n");
    }
}

int main(void){
    int N;
    Card C1[36];
    Card C2[36];
    char tmpstr[3];
    int i;
    int flag; /* whether C1 and C2 after sorting coincide with each other */
    
    /* Set the length of Cards array */
    scanf("%d", &N);
    
    /* Set C1 */
    for(i = 0; i < N; i++){
        scanf("%s", tmpstr);
        C1[i].suit = tmpstr[0];
        C1[i].value = tmpstr[1];
    }
    
    /* Copy C1 to C2 (this is a deep copy, and hence modifying C1 does not affect C2, and vice versa.) */
    for(i = 0; i < N; i++){
        C2[i] = C1[i];
    }

    // Perform sorting
    bubble_sort(C1, N);
    selection_sort(C2, N);

    // Judge whether the result of selection sort is stable or not 
    // by comparing it with that of bubble_sort, whose output is always stable.
    flag = 1;
    for(i = 0; i < N; i++){
        if( ( C1[i].value != C2[i].value) || ( C1[i].suit != C2[i].suit ) ){
            flag = 0;
            break;
        }
    }
    
    show_cards(C1, N);
    print_stable(1);
    show_cards(C2, N);
    print_stable(flag);
    
    return 0;
}



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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string result = "NA";
            if (int.Parse(S.Substring(0, 2)) <= 12 && int.Parse(S.Substring(0, 2))!= 0)
            {
                if (int.Parse(S.Substring(2, 2)) <= 12 && int.Parse(S.Substring(2, 2)) != 0)
                {
                    result = "AMBIGUOUS";
                }
                else
                {
                    result = "MMYY";
                }
            }
            else if (int.Parse(S.Substring(2, 2)) <= 12 && int.Parse(S.Substring(2, 2)) != 0)
            {
                if (int.Parse(S.Substring(0, 2)) <= 12 && int.Parse(S.Substring(0, 2)) != 0)
                {
                    result = "AMBIGUOUS";
                }
                else
                {
                    result = "YYMM";
                }
            }
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//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: 11092
using System;
using System.CodeDom.Compiler;
using System.Linq;
using System.Text.RegularExpressions;

class Program
{
	static void Main(string[] args)
	{
		long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

		long n = inputLongArray[0] - 1;
		long m = inputLongArray[1] - 1;

		Console.WriteLine(n * m);
	}
}

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

int main() {
    long long N;
    map <string, long long> cnt;
    map <string, long long> S;
    cin >> N;
    for (long long i=0; i<N; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        S[s]+=cnt[s];
        cnt[s]+=1;
    }
    long long ans=0;
    for (auto i=S.begin(); i!=S.end(); i++) {
        ans += i->second;
    }
    cout << ans;
}

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

vector<ll> p;
 
signed main(){
	int X, N;
	cin >> X >> N;
	p = vector<ll>(N);
	for(int i = 0; i < N; i++){
		cin >> p.at(i);
	}

	for(int i = 0; i <= 100; i++){
		if(find(p.begin(), p.end(), X-i) == p.end()){
			cout << X-i << endl;
			return 0;
		}else if(find(p.begin(), p.end(), X+i) == p.end()){
			cout << X+i << endl;
			return 0;
		}
	}
 
	return 0;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<int> v(n);
    for(auto &a : v) cin>>a;
    bool ok = true;
    for(int i=0;i<n;++i){
        if(v[i]%2 == 0 and (v[i]%3 != 0 and v[i]%5 !=0))ok = false;
    }
    
    if(ok) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}

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

using namespace std;

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

    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int alice=0;
    int bob=0;
    for(int i=0;i<n;i+=2) alice+=a[i];
    for(int i=1;i<n;i+=2) bob+=a[i];
    cout<<alice-bob<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int digitSum(int N){
    int ans = 0;

    while(N!=0){
        ans += N%10;
        N /= 10;
    }

    return ans;
}

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

    int fn = digitSum(N);
    if(N%fn == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


void dfs(long long now, long long &ans, vector<int> use){
    if (now > N)
    {
        return;
    }
    if (use[0] != 0 && use[1] != 0 && use[2] != 0)
    {
        ans++;
    }
    
    use[0]++;
    dfs(now * 10 + 3, ans, use);
    use[0]--;
    use[1]++;
    dfs(now * 10 + 5, ans, use);
    use[1]--;
    use[2]++;
    dfs(now * 10 + 7, ans, use);
    use[2]--;
    
}

int main(){
    cin >> N;
    // K = to_string(N).size();
    long long ans = 0;
    vector<int> use(3);
    dfs(0, ans, use);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        // System.out.println(new App().getGreeting());
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        int cnt = 0;
        for(int i = 0; i < s.length(); i++){
            cnt += (s.charAt(i)== '1' ? 1 : 0);
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 20692
#include<bits/stdc++.h>
using namespace std;
int n,cd=0,tot=0;
string a,b,c,d;
int main(){
	cin>>n;
	cin>>a;
	cin>>b;
	for(int i=0;i<n;i++){
		c=a.substr(i,n);
		d=b.substr(0,n-i);
		if(c==d){
			cd=c.size();
			break;
		}
	}
	cout<<2*n-cd<<endl;
	return 0;
}

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

int main() {
  int n,c;
  c = 1;
  cin >> n;
  vector<string> s(n);
  
  for (int i=0; i<n; i++) {
    cin >> s.at(i);
  }
  
  sort(s.begin(), s.end());
  
  for (int i=1; i < n; i++) {
    if (s.at(i) != s.at(i-1)) {
      c++;
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 9532
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

signed main() {
  int r, s;
  cin >> r;
  s = 3 * r * r;
  cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vii a(n);
    rep(i, 0, n) cin >> a[i];
    double t = 0;
    rep(i, 0, n) t += a[i];
    int ans = 0;
    double k = inf;
    t /= (double)n;
    eper(i, n-1, 0) {
      if (abs(t - a[i]) <= k) {
        ans = i;
        k = abs(t - a[i]);
      }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  int m1,d1,m2,d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if(d2 == 1) cout << 1 << endl;
  else cout << 0 << endl;

  return 0;
}


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

int main()
{
    int a,b;
    cin>>a;
    cin>>b;
    if(a>b)
    {
        string s="";
        while(s.length()<a)
        {
            s+=(b+48);
        }
        cout<<s;
    }
    else
    {
        string s="";
        while(s.length()<b)
        {
            s+=(a+48);
        }
        cout<<s;
    }

}


Measured memory_bytes: 256
#include<stdio.h>

#define NIL -1

int depth(int);
int height(int);
int sibling(int);


struct Node{
  int parent;
  int left;
  int right;
};

struct Node T[25];

int main(){

  int n,id,left,right,i,de,deg,sib,hei;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].parent=NIL;
    T[i].right=NIL;
    T[i].left=NIL;
    
  }

  for(i=0;i<n;i++){

    scanf("%d%d%d",&id,&left,&right);

    T[id].left=left;
    T[id].right=right;
    T[left].parent=id;
    T[right].parent=id;
  }

  // printf("wa-i2\n");

  for(i=0;i<n;i++){


    if(T[i].left==NIL&&T[i].right==NIL){
      deg=0;
    }
    else if(T[i].left==-1||T[i].right==-1){
      deg=1;
    }
    else{
      deg=2;
    }

    de=depth(i);

    //printf("wa-i1\n");
    
    sib=sibling(i);

    // printf("wa-i4\n");
    hei=height(i);

    // printf("hei:%d\n",hei);
    
    // printf("wa-i3\n");
    
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].parent,sib,deg,de,hei);

    if(T[i].parent==-1) printf("root\n");
    else if(T[i].right==NIL&&T[i].left==NIL) printf("leaf\n");
    else printf("internal node\n");

   
  }
  
  return 0;
}
  
int depth(int num){

  if(T[num].parent==NIL)return 0;

  return depth(T[num].parent)+1;
  
}


int sibling(int num){

  if(T[num].parent==NIL)return -1;

  if(num==T[T[num].parent].right) return T[T[num].parent].left;
  else return T[T[num].parent].right;

}

int height(int num){
  
  // printf("wa-i10\n");
  
  
  if(T[num].right==-1&&T[num].left==-1) return 0;

  else{
    if(T[num].left==-1){
      return height(T[num].right)+1;
    }
    else if(T[num].right==-1){
      return height(T[num].left)+1;
    }
  
    else if(height(T[num].right)<=height(T[num].left)){
      return height(T[num].left)+1;
    }
    else {
      return height(T[num].right)+1;
    }
  }
  
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

string str1;
string str2;
int len1;
int len2;

vvector<int> dp;

int func(int p1, int p2){
	if(p1==len1||p2==len2)return 0;
	if(dp[p1][p2]>=0)return dp[p1][p2];
	int res = 0;
	if(str1[p1]==str2[p2])res = 1 + func(p1+1, p2+1);
	chmax(res, func(p1+1, p2));
	chmax(res, func(p1, p2+1));
	return dp[p1][p2] = res;
}

int main(){
	int n;
	cin >> n;
	rep(i, n){
		cin >> str1 >> str2;
		len1 = str1.size();
		len2 = str2.size();
		dp.assign(len1, vector<int>(len2, -1));
		cout << func(0, 0) << endl;
	}
	return 0;
}



Measured memory_bytes: 6908
#include <bits/stdc++.h>
using namespace std;
int d;
int mod = 1000000007;
int arr[10001];
long long dp[10001][101][2];
long long getsum(int ind,int n,int sum, int flag){
	if(ind == n){
		if(sum%d) return 0;
		return 1;
	}
	if(dp[ind][sum][flag]!=-1) return dp[ind][sum][flag]; 
	int limit = 9;
	if(!flag) limit = arr[ind];
	long long ans  = 0;
	for(int i=0;i<=limit;i++){
		if(flag || i<arr[ind]) ans += getsum(ind + 1, n,( sum + i)%d, 1), ans = ans%mod;
		else ans  += getsum(ind + 1, n, ( sum + i)%d, 0), ans = ans%mod ;
	}
	return dp[ind][sum][flag] = ans;
}

int main() {

//	int t;
//	cin>>t;
//	while(t--){
		string a;
		cin>>a;
		cin>>d;
	
		for(int i=0;i<10001;i++) for(int j=0;j<101;j++) for(int k=0;k<2;k++) dp[i][j][k]=-1;
		
		for(int i=0;i<a.size();i++) arr[i] = a[i] - '0';
		long long ans = getsum(0,a.size(),0, 0);
		ans = (ans -1 + mod)%mod;
		cout<<ans<<endl;
//	}

}

Measured memory_bytes: 20368
import sys

n = int(input())
a = []
b = input().split(" ")
for i in range(n):
	a.append(int(b[i]))

if n == 1:
	print(0)
	sys.exit()

mx = 0
cnt = 0
for i in range(n-2, -1, -1):
	if a[i] >= a[i+1]:
		cnt += 1
		mx = max(mx, cnt)
	else:
		cnt = 0

print(mx)


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

int N;
int A[1007];

void visualize(int* A, int N) 
{
    for (int i = 0; i < N-1; i++) {
        cout << A[i] << " ";
    }
    cout << A[N-1] << endl;
}

void insertionSort(int* A, int N)
{
    visualize(A, N);
    
    for (int i = 1; i < N; i++) {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        visualize(A, N);
    }
}

int main(void)
{
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    insertionSort(A, N);
    
    return 0;
}


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

#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll mod = 1e9+7;

ll gcdll(ll a, ll b){
    if(!b) return a;
    return gcdll(b, a%b);
}

int gcd(int a, int b){
    if(!b) return a;
    return  gcd(b, a%b);
}

void seive(int n){
    vector<bool> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i=2; i*i<=n; i++){
        if(is_prime[i]){
            for(int j=i*i; j<=n; j+=i){
                is_prime[j] = false;
            }
        }
    }
}

vector<int> constructZFunc(string s){
    int n = s.size();
    vector<int> z(n);
    int l, r;
    l = r = 0;
    z[0] = 0;
    rep(i, 1, n-1){
        z[i] = 0;
        if(i<=r){
            z[i] = min(r-i+1, z[i-l]);  /// initialization, req. for linear time approach.
        }
        while(i+z[i] < n && s[z[i]] == s[i+z[i]])
            ++z[i];
        if(i+z[i]-1 > r){
            r = i+z[i]-1;
            l = i;
        }
    }
    return z;
}

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

    ll n, d, a, h, x;
    cin>>n>>d>>a;
    vector<pll> v;
    fr(i, n){
        cin>>x>>h;
        v.push_back({x, h});
    }
    sort(v.begin(), v.end());

    ll pref[n+1] = {0ll};
    ll cnt = 0ll;
    vector<ll> s;
    ll bombs = 0ll;
    ll i = 1;
    ll tot = 0ll;
    ll temp = 0ll;
    for(auto it: v){
        auto lb = lower_bound(s.begin(), s.end(), it.first) - s.begin();
        if(lb == v.size()){
            temp = 0ll;
        } else {
            temp = tot - pref[lb - 1 + 1];
        }
        it.second = max(0ll, it.second - temp);
        bombs = (it.second+a-1)/a;
        s.push_back(it.first + 2ll*d);
        pref[i] = pref[i-1ll] + (bombs*a);
        tot = pref[i];
        cnt += bombs;
        i++;
    }

    cout<<cnt;

    return 0;
}



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

int main(void){
    string s;
    bool res=0;
    cin>>s;
    if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2]){
        res=1;
    }else if(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1]){
        res=1;
    }else if(s[0]==s[3]&&s[2]==s[1]&&s[0]!=s[1]){
        res=1;
    }
    if(res){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
using namespace std;
#pragma endregion
signed main() {
	int A;
	cin >> A;
	cout << A/3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
  cin>>N;
    string d[N];
    for (int i = 0; i < N; ++i) cin >> d[i];
  	map<string,int> a;
  for(int i=0;i<N;++i){
  if(a.count(d[i])) int a;
  else a[d[i]]=1;
  }
  cout<<a.size();
}
  

Measured memory_bytes: 25464
#include <iostream>
#include <vector>
#include <string>
#include <complex>
#include <cmath>
#include <algorithm>

using namespace std;

int n, T, ans = 1e9;

int main()
{
    cin >> n;
    if (n == 1)
    {
        cout << "Hello World";
    }
    else
    {
        int a, b;
        cin >> a >> b;
        cout << a + b;
    }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;
import java.util.Arrays;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while (!(buf = br.readLine()).equals("0")) {
				int n = Integer.parseInt(buf);
				StringTokenizer st = new StringTokenizer(br.readLine());
				int S[] = new int[n];
				int C[] = new int[n];
				boolean check[] = new boolean[n];
				for (int i=0;i<n;i++) {
					S[i] = Integer.parseInt(st.nextToken());
				}
				int list[] = new int[n];
				int lp = 0;
				int m;
				int count = 0;
				while (true) {
					count++;
					Arrays.fill(C,0);
					Arrays.fill(check,false);
					for (int i=0;i<n;i++) {
						if (!check[i]) {
							check[i] = true;
							list[lp++] = i;
							for (int j=i+1;j<n;j++) {
								if (S[i]==S[j]) {
									check[j] = true;
									list[lp++] = j;
								}
							}
							m = lp;
							while (lp>0) {
								C[list[--lp]] = m; 
							}
						}
					}
					if (check_equal(S,C,n)) break;
					for (int i=0;i<n;i++) {
						S[i] = C[i];
					}
				}
				System.out.println(count-1);
				System.out.print(S[0]);
				for (int i=1;i<n;i++) {
					System.out.print(" "+S[i]);
				}
				System.out.println();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static boolean check_equal(int a[],int b[],int size) {
		for (int i=0;i<size;i++) {
			if (a[i]!=b[i]) return false;
		}
		return true;
	}
}

Measured memory_bytes: 18916
#include<iostream>
#include <string>
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define mp make_pair
#define sz(v) (int)(v.size())
#define len(s) (int)(s.length())
#define M 1000000007
#define all(v) v.begin(),v.end()
#define fr(a,b,c) for(ll i=a;i<=b;i+=c)
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = 9e18;
const ld pi = 2*acos(0.0); 
using namespace std;
ll power(ll a,ll n) 
{
    if(n==0){
        return 1;
    }
    ll p=power(a,n/2) % M;
    p = (p * p) % M;
    if (n%2==1)
    {
        p=(p*a)%M;
    }
    return p;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
const int N=1e6+5;
vector <ll> sieve(N,0); 
void si() 
{
    sieve[1]=1;
    for(int i=2;i<N;i++){
        if(sieve[i]==0){
            for(int j=i;j<N;j+=i){
                sieve[j]=i;
            }
        }
    }
}
int main(){
    ios;
    si();
    int n;
    cin>>n;
    vector <ll> a(n);
    inarr(a,n);
    sort(all(a));
    map <ll,ll> m;
    int pair=1;
    ll gc=a[0];
    for(int i=0;i<n;i++){
        gc=gcd(gc,a[i]);
        ll z=a[i];
        map <ll,ll> local;
        while(z>1){
            ll d=sieve[z];
            local[d]=1;
            z=z/d;
        }
        for(auto itr:local){
            ll pr=itr.first;
            if(m.find(pr)!=m.end()){
                pair=0;
            }
            m[pr]=1;
        }
    }
    if(pair==1){
        cout<<"pairwise coprime"<<endl;
    }
    else if(gc==1){
        cout<<"setwise coprime"<<endl;
    }
    else{
        cout<<"not coprime"<<endl;
    }
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int A, B; cin >> A >> B;
    int ans = 0;
    for (int i = A; i <= B; ++i) {
        string str = to_string(i);
        string rev = str;
        reverse(all(rev));
        if (str == rev) ans++;
    }
    cout << ans << endl;
    return 0;
}

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


typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
/*--------------------------------------------*/

int main(){
  //cout.precision(10);
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int K;
  cin >> s >> K;
  int N = s.size();
  
  vector<string> S;
  
  rep(i,N){
    REP(k,K){
      if(i + k - 1< N){
        S.PB(s.substr(i,k));
      }
    }
  }

  sort(ALL(S));

  auto ans = unique(ALL(S));
  
  S.erase(ans,S.end());

  cout << S[K-1] << endl;
  

}

Measured memory_bytes: 1660
from heapq import heapify,heappush,heappop

n,m,s,t = map(int,input().split())#順に都市の数、電車の数、スタート、ゴール
adj_list = [[]for i in range(0,(n+1),1,)]#隣接リスト(都市1~nをそのまま使いたいのでn+1の大きさで宣言して0は使わない)
for i in range(0,m,1):
    u,v,a,b = map(int,input().split())
    adj_list[u].append([v,a,b])#[0]行先[1]円[2]スヌーク
    adj_list[v].append([u,a,b])

D_INF = 10**15
d = [D_INF]*(n+1)#最速到達距離。でかい数で初期化
d[s] = 0#スタート
que = []
heapify(que)
heappush(que,(d[s],s))

while(len(que)):
    time,place = heappop(que)
    if time > d[place]:
        continue
    for i in range(0,len(adj_list[place]),1):
        if d[adj_list[place][i][0]] > time + adj_list[place][i][1]:#とりあえず円で
            d[adj_list[place][i][0]] = time + adj_list[place][i][1]
            heappush(que,(d[adj_list[place][i][0]],adj_list[place][i][0]))


d_sn = [D_INF]*(n+1)#最速到達距離。でかい数で初期化
d_sn[t] = 0#スタート
heappush(que,(d_sn[t],t))

while(len(que)):
    time,place = heappop(que)
    if time > d_sn[place]:
        continue
    for i in range(0,len(adj_list[place]),1):
        if d_sn[adj_list[place][i][0]] > time + adj_list[place][i][2]:
             d_sn[adj_list[place][i][0]] = time + adj_list[place][i][2]
             heappush(que,(d_sn[adj_list[place][i][0]],adj_list[place][i][0]))

for i in range(1,n+1,1):
    d[i]=d[i]+d_sn[i]
    heappush(que,(d[i],i))
minimum,minimum_place = heappop(que)

for i in range(0,n,1):
    if minimum_place <= i:
        while(len(que)):
            minimum,minimum_place = heappop(que)
            if minimum_place > i:
                break
    print(10**15-minimum)


Measured memory_bytes: 120608
#include<stdio.h>
int N;
typedef struct{
  char m;
  int n;
  int o;
}Card;
Card c[100000];

int partition(int p, int r);
void quickSort(int p,int r);

int main(){
  int i,stable=1;
  char s[1];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%s%d",s,&c[i].n);
    c[i].m=s[0];
    c[i].o=i;
  }

  quickSort(0,N-1);

  for(i=0;i<N;i++) 
      if(i>0 && c[i].n==c[i-1].n && c[i].o<c[i-1].o){
        printf("Not stable\n");
        break;
      }
      if(i==N)
      printf("Stable\n");

  for(i=0;i<N;i++)
    printf("%c %d\n",c[i].m,c[i].n);
  return 0;
}
int partition(int p, int r){
  int i,j;
  Card x,tmp;
  x = c[r];
  i = p-1;
  for (j =p;j<r;j++){
    if (c[j].n <= x.n){
      i = i+1;
      tmp=c[i];
      c[i]=c[j];
      c[j]=tmp;
    }
  }

  tmp=c[r];
  c[r]=c[i+1];
  c[i+1]=tmp;

  return i+1;
}

void quickSort(int p,int r){
  int q;

  if( p < r){
     q = partition(p, r);
     quickSort(p, q-1);
     quickSort( q+1, r);
  }
}



Measured memory_bytes: 2872
n, q = map(int, input().split())
l = [[] for i in range(n)]
for i in range(q):
    #print(l)
    do = list(map(int, input().split()))
    #print("do::")
    #print(do)
    if do[0] == 0: l[do[1]].append(do[2])
    elif l[do[1]] == []: continue
    elif do[0] == 1: print(l[do[1]][0])
    else: del l[do[1]][0]



Measured memory_bytes: 13696
#include <iostream>
#include <vector>
int main(){
int a=0;
std::vector<int> v(0);
while(true){
a++;
v.resize(a);
std::cin>>v[a-1];
if(v[a-1]==0){
break;
}
}
for(int i=0;i<a-1;i++){
std::cout<<"Case "<<i+1<<": "<<v[i]<<std::endl;
}
}

Measured memory_bytes: 1324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll s,w;
	cin>>s>>w;
	if(w>=s){
		cout << "unsafe";
		return 0;
	}
	else{
		cout << "safe";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i = 0; i<9 ; i++ ){
    if((i+1)*111 == n && (i+2)*111 > n){
      cout << (i+1)*111 << endl;
      break;
    } else if ((i+1)*111 < n && (i+2)*111 > n){
      cout << (i+2)*111 << endl;
      break;
    } else if(111>n){
      cout << 111 << endl;
      break;
    } else {
      continue;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N=12,inf=1e9;
int p[N],c[N],dp[N][N*105];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n,g;
  cin>>n>>g; g/=100;
  rep(i,1,n+1) cin>>p[i]>>c[i],c[i]/=100;
  rep(i,0,N) rep(j,0,N*105) dp[i][j]=-inf;
  dp[0][0]=0;
  rep(i,1,n+1)
    {
      rep(j,0,N*105)
	{
	  rep(k,1,p[i]+1)
	    {
	      if(j+k>=N*105) break;
	      int cost=dp[i-1][j]+k*i;
	      if(k==p[i]) cost+=c[i];
	      dp[i][j+k]=max(dp[i][j+k],cost);
	    }
	}
      rep(j,0,N*105) dp[i][j]=max(dp[i][j],dp[i-1][j]);
    }
  rep(i,0,N*105)
    {
      if(dp[n][i]>=g)
	{
	  cout<<i<<endl;
	  return 0;
	}
    }
  assert(false);
  return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int s;
    cin>>s;
    int dp[s+1];
    zero(dp);   
    rep(i,1,s+1){
        if ( i >= 3 ){
            dp[i] = 1;
        }
    }
    rep(i,4,s+1){
        repr(j,i-1,ceil(i,2)){
            if ( j >= 3 && i-j >= 3 ){
                if ( i-j == j ){
                    dp[i] = (dp[i]%mod + dp[j]%mod);
                }
                else{
                    dp[i] = (dp[i]%mod + dp[j]%mod + dp[i-j]%mod);
                }
                dp[i] %= mod;
            }
        }
    }
    // rep(i,0,10){
    //     out1(dp[i]);
    // }
    cout<<dp[s]<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3652
S = input()
S_num = [0]*len(S)

for i in range(len(S)):
    if S[i] in ["A", "T", "G", "C"] :
        if i == 0:
            S_num[i] = 1
        else:
            S_num[i] = S_num[i-1]+1

print(max(S_num))

Measured memory_bytes: 9052
#include <iostream>
#include <string>
#include <list>
using namespace std;

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

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

	int n;
	string st;
	int x;
	cin >> n;
	list<int> L;
	list<int>::iterator it, endit;

	while(n--) {
		cin >> st;

		if(st == "insert") {
			cin >> x;
			L.push_front(x);
		}

		else if(st == "delete") {
			cin >> x;
			for(it = L.begin(), endit = L.end(); it != endit;++it) {
				if(*it == x) {
					L.erase(it);
					break;
				}
			}
		}

		else if(st == "deleteFirst") {
			L.pop_front();
		}

		else {		// deleteLast
			L.pop_back();
		}
	}

	for(it = L.begin(), endit = --L.end(); it != endit; ++it) {
		cout << *it << ' ';
	}
	cout << *it << endl;


	return 0;
}

Measured memory_bytes: 32472
<?php
fscanf(STDIN, "%d", $n);
$v = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $n; $i++) {
	$a[$i%2][] = $v[$i];
}
$x = array_count_values($a[0]);
$y = array_count_values($a[1]);
arsort($x);
arsort($y);
if (key($x) == key($y)) {
	$x0 = current($x);
	$y0 = current($y);
	echo $n - max($x0 + next($y), next($x) + $y0);
} else {
	echo $n - current($x) - current($y);
}

Measured memory_bytes: 23028
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,L;
  cin>>N>>L;
  int sum;
  vector<int>Taste(N);
  vector<int>ABS(N);
  for(int i=0;i<N;i++){
    Taste.at(i)=L+i;
    sum=sum+Taste.at(i);
    ABS.at(i)=abs(Taste.at(i));
  }
  int mini=ABS.at(0);
  int mark=sum;
  for(int i=0;i<N;i++){
    if(ABS.at(i)==min(ABS.at(i),mini)){
      mini=ABS.at(i);
      mark=sum-Taste.at(i);
    }
  }
  cout<<mark<<endl;
}
      
      
    
    


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

namespace ConsoleApp2
{
    class Program
    {

        static void Main(string[] args)
        {
            //var N = long.Parse(Console.ReadLine());
            var NA = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var N = NA[0];
            var D = NA[1];
            var ans = 0;
            for (int i = 0; i < N; i++)
            {
                var XY = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
                var X = XY[0];
                var Y = XY[1];

                if (X * X + Y * Y <= D * D) ans++;
            }


            Console.WriteLine(ans);
        }


    }


}


Measured memory_bytes: 41364
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T;
  cin >> S >> T;
  
  int ans = T.size();
  for(int i = 0; i < S.size() - T.size() + 1; i++){
    int diff = 0;
    for(int j = 0; j < T.size(); j++){
      if(T[j] != S[j + i]){
        diff++;
      }
    }
    ans = min(ans, diff);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include<stdio.h>
int main(){
  int i,n[600]={0};
  char s[3],t[]={"ABCO"};
  while(scanf("%*d,%s",s)!=EOF){
    if(s[1])s[0]='C';
    n[s[0]]++;
  }
  for(i=0;i<4;i++)printf("%d\n",n[t[i]]);
  return 0;
}
	

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
std::tuple<T, T, T> extgcd(T a, T b){
    T s1 = 1, t1 = 0, s2 = 0, t2 = 1;
    while(b != 0){
        std::tie(s1, t1, s2, t2) = std::make_tuple(s2, t2, s1 - (a / b) * s2, t1 - (a / b) * t2);
        std::tie(a, b) = std::make_tuple(b, a % b);
    }
    return std::make_tuple(s1, t1, a);
}

template <typename T>
T mod_expt(T a, std::int64_t n, T mod){
    T power {1};
    while(n > 0){
        if(n & 1){power = power * a % mod;}
        a = a * a % mod;
        n >>= 1;
    }
    return power;
}

template <typename T>
T mod_inverse(T a, T mod){
    T b;
    std::tie(b, std::ignore, std::ignore) = extgcd(a, mod);
    if(b < 0){b += mod;}
    return b;
}

constexpr ll MOD = 1'000'000'007;
int N;
int A[10100], B[1000100];

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

  std::cin >> N;

  for(int i=0;i<N;++i){
      std::cin >> A[i];
  }

  for(int i=0;i<N;++i){
      int x = A[i];

      for(int j=2;j*j<=x;++j){
          if(x % j == 0){
              int c = 0;
              while(x % j == 0){
                  x /= j;
                  c += 1;
              }
              B[j] = std::max(B[j], c);
          }
      }

      if(x > 1){
          B[x] = std::max(B[x], 1);
      }
  }

  ll x = 1;

  for(int i=2;i<=1'000'000;++i){
      if(B[i] > 0){
          x = x * mod_expt<ll>(i, B[i], MOD) % MOD;
      }
  }

  ll res = 0;

  for(int i=0;i<N;++i){
      res = (res + x * mod_inverse<ll>(A[i], MOD) % MOD) % MOD;
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 2944
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    long k = sc.nextInt();
    sc.close();
    char[] c = s.toCharArray();
    List<Character> cl = new ArrayList<>();
    List<Integer> cs = new ArrayList<>();
    cl.add(c[0]);
    cs.add(0);
    for (char i:c){
      int cls = cl.size() - 1;
      if (i == cl.get(cls)){
        cs.set(cls,cs.get(cls)+1);
      }else{
        cl.add(i);
        cs.add(1);
      }
    }
    long ans = 0;
    int cls = cl.size() - 1;
    if (cls == 0){
      ans = (k * (long)cs.get(0))/2;
    }else{
      if (cl.get(0) != cl.get(cls)){
        for (int i:cs){
          ans += (long)i/2;
        }
        ans *= k;
      }else{
        for (int i = 1;i<cls;i++){
          ans += (long)cs.get(i)/2;
        }
        ans = ans * k + (k-1)*((cs.get(0)+cs.get(cls))/2) + cs.get(0)/2+cs.get(cls)/2;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h> 
using namespace std; 
  
typedef long long int ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
  
double EPS = 1e-9; 
long long INF = 1000000000000000005ll; 
double PI = acos(-1); 
#define M 1000000007ll
#define D 998244353ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound  
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a))
#define GCD(a,b) __gcd(a,b)
#define setbits(x)   __builtin_popcountll(x)
#define zerobits(x)  __builtin_ctzll(x) 
#define ps(x,y)  fixed<<setprecision(y)<<x
#define endl '\n'
#define ff first 
#define ss second 
#define mp make_pair  
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
  
inline string IntToString(ll a) 
{ 
    char x[100]; 
    sprintf(x, "%lld", a); 
    string s = x; 
    return s; 
} 
  
inline ll StringToInt(string a) 
{ 
    char x[100]; 
    ll res; 
    strcpy(x, a.c_str()); 
    sscanf(x, "%lld", &res); 
    return res; 
} 
  
 
inline string uppercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'a' && s[i] <= 'z') 
        s[i] = s[i] - 'a' + 'A'; 
    return s; 
} 
  
inline string lowercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'A' && s[i] <= 'Z') 
        s[i] = s[i] - 'A' + 'a'; 
    return s; 
}
ll a[100005];

int main() {
    FAST
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    string s,t;
    cin>>s>>t;
    ll n=s.length();
    ll cnt=0;
    for(ll i=0;i<n;i++){
    	if(s[i]!=t[i])cnt++;
    }
    cout<<cnt<<endl;
    return 0; 
}

Measured memory_bytes: 3880