akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define iter(v, i) for (__typeof__((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define fast_io_without_cstdio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define all(v) (v).begin(), (v).end()
#define rep(i, s, e) for (int i = s; i < e; i++)

// START for segment tree
#define params int p, int L, int R
#define housekeep int mid = (L + R) >> 1, left = p << 1, right = left | 1
// END

#ifdef __linux__
#define gc getchar_unlocked
#define pc putchar_unlocked
#else
#define gc getchar
#define pc putchar
#endif

#if __cplusplus <= 199711L
template<class BidirIt>
BidirIt prev(BidirIt it, typename iterator_traits<BidirIt>::difference_type n = 1) {
    advance(it, -n);
    return it;
}

template<class ForwardIt>
ForwardIt next(ForwardIt it, typename iterator_traits<ForwardIt>::difference_type n = 1) {
    advance(it, n);
    return it;
}
#endif

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ldouble;

const double EPS = 1e-9;
const double PI = 3.141592653589793238462;

template<typename T>
inline T sq(T a) { return a * a; }

//#ifdef LOCAL_MACHINE
//#endif

const int MAXN = 2e5 + 5;

bool visit[MAXN];
int ans[MAXN];

int main() {
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    int n, x;
    scanf("%d %d", &n, &x);
    int sz = 2 * n - 1;
    if (x == 1 || x == sz) {
        puts("No");
        return 0;
    }
    if (sz == 3) {
        puts("Yes");
        puts("1 2 3");
        return 0;
    }
    if (x == 2) {
        ans[n] = x;
        ans[n - 1] = 1;
        ans[n - 2] = 3;
        ans[n + 1] = 4;
        for (int i = 1; i <= 4; i++)
            visit[i] = true;
    } else {
        ans[n] = x;
        ans[n - 1] = x + 1;
        ans[n - 2] = x - 1;
        ans[n + 1] = x - 2;
        for (int i = x - 2; i <= x + 1; i++)
            visit[i] = true;
    }
    puts("Yes");
    int j = 1;
    for (int i = 1; i <= sz; i++) {
        if (ans[i] == 0) {
            while (visit[j]) j++;
            visit[j] = true;
            ans[i] = j;
        }
        printf("%d\n", ans[i]);
    }
    return 0;
}



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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n, 0);

    for(int i=0; i<k; i++) {
        int d;
        cin >> d;
        vector<int> b(d);
        for(int j=0; j<d; j++) {
            cin >> b[j];
            a[b[j]-1] = 1;
        }
    }

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

    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (1e9)

int main() {
  ll k, lunlun; cin >> k;
  queue<ll> que;

  for(int i = 1; i <= 9; i++) {
    que.push(i);  
  }

  for(int i = 0; i < k-1; i++) {
    lunlun = que.front();
    que.pop();
    if(lunlun%10 != 0) que.push(lunlun*10 + lunlun%10 - 1);
    que.push(lunlun*10 + lunlun%10);
    if(lunlun%10 != 9) que.push(lunlun*10 + lunlun%10 + 1);
  }

  cout << que.front() << endl;

  return 0;
}

Measured memory_bytes: 5092
using System;
using System.Globalization;
using System.IO;
using System.Text;
using static Scanner;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        int N = ScanInt(), B = ScanInt();
        var answer = 0;
        for (int i = N; i <= B; i++) {
            var str = i.ToString();
            if (str[0] == str[4] && str[1] == str[3]) answer++;
        }
        Console.WriteLine(answer);
    }
}

public static class Scanner
{
    static readonly Stream stream = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte ConsoleIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stream.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = ConsoleIn();
        while ((by < '!' || '~' < by) && !isEof) by = ConsoleIn();
        return (char) by;
    }
    public static string Scan() {
        var sb = new StringBuilder();
        for (var ch = GetChar(); '!' <= ch && ch <= '~'; ch = (char) ConsoleIn()) {
            sb.Append(ch);
        }
        return sb.ToString();
    }
    public static int ScanInt() {
        var temp = 0;
        for (var ch = GetChar(); '0' <= ch && ch <= '9'; ch = (char) ConsoleIn()) {
            temp = temp * 10 + ch - '0';
        }
        return temp;
    }
}

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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}
template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }
template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }
template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T> inline bool chkmax(T &x, const T &y){ return y > x ? x = y, 1 : 0; }
template <typename T> inline bool chkmin(T &x, const T &y){ return y < x ? x = y, 1 : 0; }

#ifdef ONLINE_JUDGE
#define debug(...) ;
#else
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG
#endif

//---------------------------------------------------------head----------------------------------------------------

const int maxn = 1e5 + 100;

int n;
vi g[maxn];
int siz[maxn], par[maxn], dep[maxn];

void dfs(int u, int p = 0)
{
	par[u] = p; dep[u] = dep[p] + 1; siz[u] = 1;
	for(int v: g[u]) if(v != p) dfs(v, u), siz[u] += siz[v];
	return;
}

int main()
{
	scf(n);
	rep(i, n - 1){ int u, v; scf(u, v); g[u].pb(v); g[v].pb(u); }
	dfs(1);
	int len = dep[n] - dep[1];
	len = (len - 1) / 2;
	int u = n;
	rep(i, len) u = par[u];
	int s1 = siz[u], s2 = n - siz[u];
	if(s1 >= s2) puts("Snuke"); else puts("Fennec");
	return 0;
}

Measured memory_bytes: 13184
#include <stdio.h>
#include <algorithm>

const int N = 200005;

char a[N];

int main() {
  int n;
  scanf("%d %s", &n, a);
  int w = 0;
  for (int i = 0; i < n; i++) {
    w += (a[i] == '.');
  }
  int b = 0;
  int ans = (1 << 30);
  for (int i = 0; i < n; i++) {
    ans = std::min(ans, b + w);
    if (a[i] == '#') {
      b++;
    }
    if (a[i] == '.') {
      w--;
    }
  }
  printf("%d\n", std::min(ans, b + w));
  return 0;
}

Measured memory_bytes: 384
S=input()
dp=[[0]*13 for i in range(len(S)+1)]
mod=10**9+7
dp[0][0]=1
for n in range(len(S)):
    for t in range(13):
        if S[n]!='?':
            dp[n+1][(10*t+ int(S[n]))%13]+=dp[n][t]
            dp[n + 1][(10 * t + int(S[n])) % 13] %=mod
        else:
            for s in range(10):
                dp[n+1][(10*t+ s)%13]+=dp[n][t]
                dp[n + 1][(10 * t + s) % 13] %= mod
#print(dp)
print(dp[len(S)][5])

Measured memory_bytes: 62032
def f(n):
    if n==1:
        yield "7"
        yield "5"
        yield "3"
    else:
        for i in f(n-1):
            yield i+"7"
            yield i+"5"
            yield i+"3"
n=int(input())
ans=0
for j in range(1,10):
    for i in f(j):
        if len(set(i))==3 and int(i)<=n:
            ans+=1
print(ans)

Measured memory_bytes: 9188
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i,N) for(int i=0;i<(int)N;++i)

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

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

int a,k=0,x,ans=0;

while(1){
++k;
a=2*k-1;
if(a>N){break;}
x=0;
for(int j=1;j<=a;++j){
if(a%j==0){++x;}
}
if(x==8){++ans;}
}

cout<<ans<<endl;

}

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

int main(){
	int N,K;
	cin>>N>>K;
	
	int l[N];
	for(int i=0;i<N;i++)
		cin>>l[i];
	
	sort(l,l+N,greater<int>());
	
	int ans=0;
	for(int i=0;i<K;i++){
		ans+=l[i];
	}
	
	cout<<ans<<endl;
	return 0;
	
}

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

int main(){
  int n,a,b,c,x;
  while(cin>>n>>a>>b>>c>>x){
    if(n==0)break;
    int y[n];
    for(int i=0;i<n;i++)cin>>y[i];
    int cnt=0;
    int t=-1;
    int check = x;
    while(cnt!=n && t <= 10000){
      t++;
      //cout << "check:" << check << endl;
      if(y[cnt]==check){
	cnt++;
      }
      check=(a*check+b)%c;
    }
    if(t==10001){
      cout << -1 << endl;
    }else{
      cout << t << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(int argc, char *argv[])
{
    int i;
    int j;
    
    for (i = 1; i < 10; i++) {
        for (j = 1; j < 10; j++) {
            printf("%dx%d=%d\n", i, j, i * j);
        }
    }
    
    return 0;    
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) std::cout << (x) << std::endl
typedef long long ll;
const int INF = 1e9;
const int MAX_H = 1e4 * 3;

int main() {
    int h, n;
    cin >> h >> n;
    int a[n], b[n];
    REP(i, n) {
        cin >> a[i] >> b[i];
    }
    int dp[n + 1][MAX_H];
    REP(i, n + 1) {
        REP(j, MAX_H) {
            dp[i][j] = INF;
        }
    }
    REP(i, n) {
        dp[i][0] = 0;
    }
    REP(i, n) {
        REP(j, MAX_H) {
            if (j - a[i] >= 0) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][j - a[i]] + b[i]);
            }
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }
    int ans = INF;
    for (int i = h; i < MAX_H; i++) {
        ans = min(ans, dp[n][i]);
    }
    OUT(ans);
}

Measured memory_bytes: 117504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i+<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,p,ans=1;
  cin>>n>>p;
  vector<pair<ll,int>> fcn;
  for(ll i=2;i*i<=p;i++){
    if(p%i==0){
      int cnt=0;
      while(p%i==0){
        cnt++;
        p/=i;
      }
      fcn.pb(make_pair(i,cnt));
    }
  }
  if(p>1) fcn.pb(make_pair(p,1));
  for(auto it=fcn.begin();it!=fcn.end();it++){
    ll q=(*it).first;int r=(*it).second;
    fr(i,r/n) ans*=q;
  }
  cout<<ans<<endl;
}

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

int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if(a+w<b) cout<<b-a-w;
  else if(b+w<a) cout<<a-b-w;
  else cout<<0;
  cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

char X,Y;
int main(){
    cin >> X >> Y;
    if(X > Y) pr(">");
    else if(X < Y) pr("<");
    else pr("=");
}

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

typedef long long int ll;
ll powk(ll a, ll n){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

int main()
{
    ll n;
    cin >> n;
    vector<string> s(n);
    vector<ll> a(n);
    for(ll i = 0;i < n;i++){
        cin >> s[i];
    }

    sort(s.begin(), s.end());

    ll cnt = 0, ans = 0;
    for(ll i = 0;i < n - 1;i++){
        if(s[i] == s[i + 1]){
            cnt++;
        }
        else{
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);

    cnt = 0;
    for(ll i = 0;i < n - 1;i++){
        if(s[i] == s[i + 1]){
            cnt++;
        }
        else{
            if(cnt == ans){
                cout << s[i] << endl;
            }
            cnt = 0;
        }
    }

    if(ans == cnt){
        cout << s[s.size() - 1] << endl;
    }


    return 0;
}

Measured memory_bytes: 15872
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;

int main(){
	
	while(true){
		char s[29];
		cin >> s;
		
		if(s[0] == '0') break;
		
		int a=0,b=0;
		
		int len = strlen(s);
		
		for(int i = 1;i < len;i++){
			if(s[i] == 'A'){
			a++;
			}else if(s[i] == 'B'){
			b++;
			}
		}
		if(a >= 10 && b >= 10){
			if(a > b){
			cout << a + 1 << " " << b << endl;
			}else{
			cout << a << " " << b + 1 << endl;
			}
	
		}else if(a == 10){
		cout << 11 << " " << b << endl;
		}else if(b == 10){
		cout << a << " " << 11 << endl;
		}
	}
	
	return 0;
	
}
	


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

CSF = [tuple(map(int, input().split())) for _ in range(n-1)]

for i in range(n-1):
    t = 0
    for j in range(i, n-1):
        c, s, f = CSF[j]
        if t <= s:
            t = s
        elif t % f == 0:
            pass
        else:
            t += f - t % f
        t += c
    print(t)
print(0)


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


using namespace std;

const int INF = 2e9 + 3;
const int N = 1e2 + 3;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

const double PI = acos(-1);



void solve() {
    int k;
    cin >> k;
    if (__gcd(k, 10) != 1) {
        cout << -1;
        return;
    }
    auto cur = 10ll;
    k = (k % 7 ? k : k / 7);
    for (int x = 1; x <= 9 * k; x++) {
        if (cur % (9 * k) == 1) {
            cout << x;
            return;
        }
        cur = (cur * 10) % (9 * k);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    t = 1;
    while (t--) {
        solve();
    }
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;
typedef long long ll;
typedef pair<int,int> pii;

const double EPS = 1e-8;
const double PI = acos(-1);

typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    // if (abs(a-b)<EPS) return 0;
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}
// テ」ツδ凖」ツつッテ」ツδ暗」ツδォテ」ツ?ョテ・ツ崢榲ィツサツ「
P rotate(const P &p, double ang) {
  return p * P(cos(ang), sin(ang));
}
// ティツサツクテ」ツつ津ヲツアツコテ」ツつ?」ツ?淌」ツδ凖」ツつッテ」ツδ暗」ツδォテ」ツ?ョテ・ツ崢榲ィツサツ「
P rotate(const P &p, const P &axis, double ang) {
  return axis + rotate(p-axis, ang);
}
double angle(const P &a, const P &b) {        // テ」ツδ凖」ツつッテ」ツδ暗」ツδォテッツスツ?」ツ?凝」ツつ嘉」ツ?ソテ」ツ?淌」ツδ凖」ツつッテ」ツδ暗」ツδォテッツスツづ」ツ?ョティツァツ津・ツコツヲテ」ツ?ョティツィツ暗ァツョツ夕0,2pi)
  double ret = arg(b)-arg(a);
  return (ret>=0) ? ret : ret + 2*PI;
}

P p[25];

int main() {
  int n, R, Q;
  while(cin>>n>>R>>Q,n||R||Q) {
    REP(i,n) {
      cin >> p[i].real() >> p[i].imag();
    }
    P axis;
    REP(i,n) {
      if (abs(abs(p[i]) - R) < EPS) {
        assert(axis==P(0,0));
        axis = p[i];
      }
    }
    while(Q--) {
      double low=0,high=2*PI;
      REP(iter,70) {
        double mid = (low+high)/2;
        bool f = 0;
        REP(i,n) {
          if (abs(rotate(p[i],axis,mid)) > R) f = 1;
        }
        if (f) high = mid;
        else low = mid;
      }
      P tmp;
      double maxangle = -1;
      REP(i,n) {
        p[i] = rotate(p[i],axis,low);
        if (abs(abs(p[i])-R) < EPS) {
          double ang = angle(p[i],axis);
          if (maxangle==-1 || ang > maxangle) {
            maxangle = ang;
            tmp = p[i];
          }
        }
      }
      axis = tmp;
      printf("%.10f %.10f\n", axis.real(), axis.imag());
    }
  }
}

Measured memory_bytes: 1348
#include<stdio.h>
#include<stdlib.h>
typedef struct s{int I,U,A,P;}s;
s S[501];
int N,a,t[501],i,j,m;
int c(const void *a,const void *b)
{
	s x=*(s*)a,y=*(s*)b;
	if(x.A!=y.A)
		return y.A-x.A;
	if(x.P!=y.P)
		return x.P-y.P;
	return x.I-y.I;
}
int main()
{
	for(;scanf("%d",&N),N;)
	{
		for(i=0;i<N;t[i++]=0)
			scanf("%d%d%d%d",&S[i].I,&S[i].U,&S[i].A,&S[i].P);
		qsort(S,N,sizeof(s),c);
		for(i=m=0;i<N;i++)
			if((m<10&&t[S[i].U]<3)||(m<20&&t[S[i].U]<2)||(m<26&&t[S[i].U]<1))
			{
				printf("%d\n",S[i].I);
				t[S[i].U]++;
				m++;
			}
	}
	return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, l;
    cin >> n >> l;
    string s[n];
    for (int i = 0; i < n; ++i) cin >> s[i];
    sort(s, s+n);
    for (int i = 0; i < n; ++i) cout << s[i];
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC095C
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABCXY = ReadInt();
            long A = ABCXY[0];
            long B = ABCXY[1];
            long C = ABCXY[2];
            long X = ABCXY[3];
            long Y = ABCXY[4];

            long ans = 0;
            if (A + B >= 2 * C)
            {
                long min = Math.Min(X, Y);
                ans += min * 2 * C;

                ans += (X - min) * Math.Min(A, 2 * C);
                ans += (Y - min) * Math.Min(B, 2 * C);
            }
            else
            {
                ans += A * X + B * Y;
            }

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
long long a[100010];
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%lld",&a[i]);
int zero=0;
for(int i=0;i<n;i++)if(a[i]==0)zero++;
if(zero>0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod=1;
for(int i=0;i<n;i++){
if(a[i]<=1000000000000000000/prod){
// This condition is equivalent to prod*a[i]<=10ˆ18
prod*=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod);
}

Measured memory_bytes: 2444
module Main where

import qualified Data.Vector as Vector
import Data.List as List
import Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as BS
import Data.Maybe as Maybe

main :: IO ()
main =
    solve =<< getInts

getInt :: IO Int
getInt = read <$> BS.unpack <$> BS.getLine

splitLine :: IO [BS.ByteString]
splitLine = BS.words <$> BS.getLine

getInts :: IO (V.Vector Int)
getInts = V.fromList <$> List.map fst <$> Maybe.mapMaybe BS.readInt <$> splitLine

solve :: V.Vector Int -> IO ()
solve v = print (if (v V.! 0 == 1) && (v V.! 1 == 1) then 1000000 else V.foldl (\a b -> a + (prize b)) 0 v)

prize :: Int -> Int
prize 1 = 300000
prize 2 = 200000
prize 3 = 100000
prize _ = 0


Measured memory_bytes: 508
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int N;

    map <string, int> voteCount;
    vector <string> ans;
    int maxCount = 0;

    cin >> N;
    for (int i = 0; i < N; ++i) {
        string str;
        cin >> str;

        maxCount = max(maxCount, ++voteCount[str]);
    }

    auto iter = voteCount.begin();
    while (iter != voteCount.end()) {
        if (iter->second == maxCount) {
            ans.push_back(iter->first);
        }
        ++iter;
    }

    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); ++i) {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 26868
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}
struct houseki{
	int nedan;
	int cost;
	int point;
};

int main(){
	int n;
	cin >> n;
	syc(n,1,20);
	houseki _houseki[n];
	int sum=0;
	
	for(int i=0;i<n;i++){
		cin >> _houseki[i].nedan;
		syc(_houseki[i].nedan,1,50);
	}
	
	for(int i=0;i<n;i++){
		cin >> _houseki[i].cost;
		syc(_houseki[i].cost,1,50);
	}
	
	for(int i=0;i<n;i++){
		_houseki[i].point=_houseki[i].nedan-_houseki[i].cost;
	}
	
	for(int i=0;i<n;i++){
		if(_houseki[i].point > 0){
			sum+=_houseki[i].point;
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <iomanip>
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
#define _GLIBCXX_DEBUG

using namespace std;

pair<int,int> keta(int x) {
    int a = x % 10;
    int b = 0;
    while (x != 0) {
        b = x;
        x = x / 10;
    }
    pair<int, int> m;
    m.first = a;
    m.second = b;
    return m;
}

int main() {
    int n;
    cin >> n;
    pair<int, int> p;
    map<pair<int, int>, int> m;
    for (int i = 1; i <= n; i++) {
        p = keta(i);
        m[p]++;
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        p = keta(i);
        pair<int, int>q;
        q.first = p.second;
        q.second = p.first;
        ans += m[q];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
def is_stairs(h):
    
    if len(h) == 1:
        return('Yes')
    for i in range(2, len(h)):
        if h[i-1] - h[i] > 1:
            return('No')
        h[i] = max(h[i-1],h[i])
    return('Yes')
print(is_stairs(h))

Measured memory_bytes: 14224
using System;
using System.Collections.Generic;
using System.Linq;
class Program
    {
        static void Main(string[] args)
        {
            //4<=N<=10^5 
            //1<=A<=10^9
            long N = long.Parse(Console.ReadLine());
            //昇順ソート
            var Array = Console.ReadLine().Split().Select(x => long.Parse(x)).OrderBy(x => x).ToArray();
            long Fir = 0;
            long Sec = 0;
            long Count = 1;
            long Num = Array[0];
            for (long i = 1; i < N; i++)
            {
                if (Array[i] == Num)
                {
                    Count++;
                    if (Count == 2)
                    {
                        MaxCheck(Num, ref Fir, ref Sec);
                    }
                    else if (Count == 4)
                    {
                        MaxCheck(Num, ref Fir, ref Sec);
                    }
                }
                else
                {
                    Num = Array[i];
                    Count = 1;
                }
            }
            Console.WriteLine(Fir * Sec);
        }
        static void MaxCheck(long Current, ref long F, ref long S)
        {
            if (F < Current)
            {
                S = F;
                F = Current;
            }
            else if (S < Current)
            {
                S = Current;
            }
        }
    }

Measured memory_bytes: 26080
# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    N = II()
    c = collections.Counter(input())
    return c["R"] > c["B"]


if __name__ == "__main__":
    YESNO(main(), "Yes", "No")


Measured memory_bytes: 5396
#include <bits/stdc++.h>
#define int long long
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? LLONG_MAX : INT_MAX;
const int MOD = 1000000007;
const long double EPS = 1e-8;

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a + b >= c ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long n, k;

bool ok(long long x) {
	long long res = k;
	for (long long i = 0; i < n; ++i) {
		res -= x;
		x >>= 1;
		if (res < 0 || x == 0) break;
	}
	return res >= 0;
}

int main() {
	cin >> n >> k;
	long long l = 0, r = k + 1;
	while (r - l > 1) {
		long long mid = (l + r) / 2;
		if (ok(mid)) l = mid;
		else r = mid;
	}
	cout << l << endl;

	return 0;
}


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

int main()
{
	int A,B,x,y;
	while(cin>>A>>B, A||B)
	{
		B-=A;
		x = B/1000;
		B%=1000;
		y = B/500;
		B%=500;
		cout << B/100 << " "	<< y << " " << x << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
char str[105];
int main() {
	int k;
	scanf("%s%d", str, &k);
	int n = strlen(str);
	bool same = true;
	vector<int> cnt(n);
	ll tot = 0;
	for (int i = 0; i < n; ++i) {
		if (str[i] != str[0]) same = false;
		if (!i || str[i] != str[i - 1]) {
			if (i) tot += cnt[i - 1] / 2;
			cnt[i] = 1;
		} else cnt[i] = cnt[i - 1] + 1;
	}
	tot += cnt[n - 1] / 2;
	if (same) printf("%lld\n", (ll)n * k / 2);
	else if (str[n - 1] != str[0]) printf("%lld\n", tot * k);
	else {
		int i = 0;
		for (; str[i] == str[0]; ++i);
		printf("%lld\n", tot * k + ((i + cnt[n - 1]) / 2 - i / 2 - cnt[n - 1] / 2) * (k - 1));
	}
}


Measured memory_bytes: 256
using System;

namespace ITP1_11_B
{
    class Program
    {
        static void Main(string[] args)
        {

            int[] dice = getdice();
            int q = int.Parse(Console.ReadLine());

            for (int i=0; i<q; i++)
            {
                string[] numbers = Console.ReadLine().Split(' ');
                int num1 = int.Parse(numbers[0]);
                int num2 = int.Parse(numbers[1]);

                int right = checkdice(dice, num1, num2);
                Console.WriteLine(right);
            }

        }

        static int checkdice(int[] a, int b, int c)
        {
            int right = 0;

            if(a[1] != b)
            {
                bool top_eq = false;
                bool all_noteq = false;
                int count = 0;
                while (top_eq == false && all_noteq == false)
                {
                    int tmp = a[1];
                    a[1] = a[5];
                    a[5] = a[6];
                    a[6] = a[2];
                    a[2] = tmp;

                    count++;

                    if (a[1] == b)
                    {
                        top_eq = true;
                    }
                    else if (count == 4)
                    {
                        all_noteq = true;
                    }
                }

                if (top_eq == false && all_noteq == true)
                {
                    while (top_eq == false)
                    {
                        int tmp2 = a[1];
                        a[1] = a[4];
                        a[4] = a[6];
                        a[6] = a[3];
                        a[3] = tmp2;

                        if (a[1] == b) top_eq = true;
                    }
                }

            }

            if (a[2] != c)
            {
                right = turndice(a, c);
            }
            else
            {
                right = a[3];
            }
            
            return right;
        }


        static int turndice(int[] d, int e)
        {
            bool forward_eq = false;
            while (forward_eq == false)
            {
                int tmp = d[2];
                d[2] = d[4];
                d[4] = d[5];
                d[5] = d[3];
                d[3] = tmp;

                if (d[2] == e) forward_eq = true;
            }

            return d[3];
        }


        static int[] getdice()
        {
            int[] dice = new int[7];


            string[] input = Console.ReadLine().Split(' ');
            for (int i=1; i<=6; i++)
            {
                dice[i] = int.Parse(input[i-1]);
            }

            return dice;
        }
    }
}

Measured memory_bytes: 9032
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int value;
  node *next;
  node(int value,node *next):value(value),next(next){}
};
int INF=1LL<<55LL;
string lcs(string x,string y){
  int n=x.size(),m=y.size();
  map<char,vector<int> > M;
  for(int j=m-1;j>=0;j--) M[y[j]].push_back(j);
  vector<int> xs(n+1,INF);
  xs[0]=-INF;
  vector<node* > link(n+1);
  for(int i=0;i<n;i++){
    if(M.count(x[i])){
      vector<int> ys=M[x[i]];
      for(int j=0;j<(int)ys.size();j++){
	int k=distance(xs.begin(),lower_bound(xs.begin(),xs.end(),ys[j]));
	xs[k]=ys[j];
	link[k]=new node(y[ys[j]],link[k-1]);
      }
    }
  }
  string res;
  int l=distance(xs.begin(),lower_bound(xs.begin(),xs.end(),INF-1))-1;
  for(node *p=link[l];p!=NULL;p=p->next)
    res.push_back(p->value);
  return res;
}
signed main(){
  int q;
  cin>>q;
  while(q--){
    string x,y;
    cin>>x>>y;
    cout<<lcs(x,y).size()<<endl;
  }
  return 0;
}

Measured memory_bytes: 51228
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); // カードの枚数
    int z = sc.nextInt(); // Xの初期カード
    int w = sc.nextInt(); // Yの初期カード
    int[] card = new int[N]; // N枚の山札カード
    int score; // スコア
    for(int i = 0; i < N; i++) {
      card[i] = sc.nextInt();
    }

    if(N == 1) {
      score = Math.abs(card[0] - w);
      System.out.println(score);
    } else {
      score = Math.max(Math.abs(card[N - 1] - w), Math.abs(card[N - 2] - card[N - 1]));
      System.out.println(score);
    }
  }
}


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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    string tmp;
    map< pair<int,int> , int> states;
    long long int ans = 0;
    for(int i = 0; i < n; ++i){
        cin >> tmp;
        long long int num = 0;
        int pos = tmp.size() - 1;
        for(int i = 0; i < tmp.size(); ++i){
            if(tmp[i] == '.'){
                pos = i;
            }else{
                num = num * 10 + (tmp[i] - '0');
            }
        }

        int cnt = tmp.size() - pos - 1;

        int cnt5 = 0;
        while(num % 5 == 0){
         ++cnt5;
         num /= 5;
        }
        int cnt2 = 0;
        while(num % 2 == 0){
         ++cnt2;
         num /= 2;
        }
        pair<int,int> p = {cnt2 - cnt , cnt5 - cnt};
        // cout << cnt2 << " " << cnt5 << " " << cnt << "\n";

        for(auto& x:states){
                if(p.first + x.first.first >= 0 &&  x.first.second + p.second  >= 0){
                   ans += x.second;
                }
        }
        ++states[p];

    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;

int main()
{

    int N,X,T;

    cin >> N >> X >> T;


    int k = N/X;
    int a = N%X;


    if(a==0){

        cout << k*T << endl;

    }
    else{

        cout << (k+1)*T << endl;
    }

    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

vector<vi> adj;

pi dfs(int node, int par)
{
	pi ret(0, node);
	for(int e:adj[node]){
		if (e==par) continue;
		pi p = dfs(e, node); p.fi++;
		ret = (ret.fi > p.fi) ? ret : p;
	}
	return ret;
}

int Diameter()
{
	pi p = dfs(1, 0);
	pi q = dfs(p.se, 0);
	return q.fi;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin>>n;
	adj.resize(n+1);
	rep(i, n-1){
		int u, v; cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	int L = Diameter();

	if (L % 3 == 1){
		cout << "Second\n";
	}else{
		cout << "First\n";
	}
	
	return 0;
}


Measured memory_bytes: 26880
import heapq
import math

def main():
    N,M = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]
    count = 0
    heap = []
    for i in range(len(A)):
        heapq.heappush(heap,(A[i] * -1))
    for i in range(M):
        a = heapq.heappop(heap)
        a = int(a / 2)
        heapq.heappush(heap, a)
    for i in range(len(heap)):
        count += heapq.heappop(heap) * -1
    print(count)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 14532
import java.util.*;
import java.lang.Integer;
 
class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int W = sc.nextInt();
      int H = sc.nextInt();
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      double area = 0.0;
      
      if (x+x==W && y+y==H){
        area = (double)W*(double)H/2.0;
        System.out.println(area);
        System.out.println(1);
      }
      else{
        area = (double)W*(double)H/2.0;
        System.out.println(area);
        System.out.println(0);
      }
    }  
}

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

#define int unsigned long long int

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n,k,d,a,count=0;
	cin>>n>>k;
	bool B[n+1]={0};
	for(int i=0;i<k;i++){
		cin>>d;
		for(int j=0;j<d;j++){
			cin>>a;
			B[a] = true;
		}
	}
	for(int i=1;i<=n;i++){
		if(B[i] == false)
			count++;
	}
	cout<<count;

	return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#include<cstring>
using namespace std;
char s1[501000],s2[501000];
int len;
int main()
{
	scanf("%s",s1);
	len=strlen(s1);
	for(int i=0;i<len;i++)
	{
		s2[len-i-1]=s1[i];
		if(s1[i]=='p') s1[i]='q';
		else if(s1[i]=='q') s1[i]='p';
		else if(s1[i]=='b') s1[i]='d';
		else if(s1[i]=='d') s1[i]='b';
	}
	for(int i=0;i<len;i++)
	{
		if(s1[i]!=s2[i])
		{
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 384
def main():
    n, k = map(int, input().split())
    ans = 0.0
    for t in range(1, n + 1):
        cnt = 0
        now = t
        per = 1.0
        while now < k:
            per /= 2
            now *= 2
        ans += per / n
    print('{:.20}'.format(ans))
    pass


if __name__ == '__main__':
    main()


Measured memory_bytes: 9108
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;




class Main{


	static	ArrayList<Integer> one ;
	static	ArrayList<Integer> two ;
	static	ArrayList<Integer> three ;
	static	ArrayList<Integer> four ;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		String[] S = new String[n];

		int l = 100;
		int num = 51;				//なんばんめの文字列か覚えておく


		for(int i = 0;i < n;i++){
			S[i] =sc.next();					//入力
			if(l > S[i].length()){				//最小長の文字列を発見する
				l = S[i].length();
				num = i;
			}

		}
				

		ArrayList<Character> ans = new ArrayList<Character>();				//一致文字をいれていく

		for(int i = 0;i < S[num].length();i++){
			boolean find = false;
			int count = 0;



			for(int j = 0;j < n;j++){				//文字列の選択
				if( j != num){
					for(int x = 0;x < S[j].length();x++){		//その文字列についてS[num].charat[i]があるかみる
						if(S[j].charAt(x) == S[num].charAt(i)){
							count++;
							break;
						}
						
					}


				}
			}
			
			
			if(count == n-1){					//全ての文字列でS[num].charat[i]があったらtrue
				find = true;
				for(int j = 0;j < n;j++){		//その文字列についてS[num].charat[i]があるかみる
					if(j != num){
						String string  = String.valueOf(S[num].charAt(i));

					S[j] = S[j].replaceFirst(string, "");					//該当文字を消していく
					}
				}
			}

			if(find){
				ans.add(S[num].charAt(i));

			}
		}
		
		
		char[] aa = new char[ans.size()];
		for(int i = 0;i < ans.size();i++){
			aa[i] = ans.get(i);
		}
		Arrays.sort(aa);

		String pp = new String(aa);
		System.out.println(aa);


	}
}

class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




Measured memory_bytes: 24916
#include<iostream>
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;
ll gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}
int main()
{
    int n;
    cin >> n;
    ll sum = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            for(int k = 1; k <= n; k++)
            {
                sum += (ll)gcd(i, gcd(j, k));
            }
        }
    }
    cout << sum << endl;
    return 0;
}


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

int w, a, b;

int main (){
	cin >> w >> a >> b;
	if(a+w<b){
		cout << b-(a+w) << endl;
	}
	else if(b+w<a){
		cout << a-(b+w) << endl;
	}
	else {
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256
from collections import deque
import sys
 
deque = deque()
num = int(sys.stdin.readline())
line = sys.stdin.readlines()
 
for i in range(num):
 
    order = line[i].split()
 
    if order[0] == 'insert':
        deque.appendleft(order[1])
    elif order[0] == 'deleteFirst':
        deque.popleft()
    elif order[0] == 'deleteLast':
        deque.pop()
    else:
        if order[1] in deque:
            deque.remove(order[1])
 
print(' '.join(deque))

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

int main() {
    int n; std::cin >> n;
    std::vector<std::pair<int, int>> a;
    for (int i = 0; i < n; i++) {
        int aa; std::cin >> aa;
        a.push_back(std::make_pair(aa, i));
    }
    std::sort(a.begin(), a.end());
    for (const auto& aa: a) {
        std::cout << (aa.second + 1) << " ";
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 3776
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<set>
#include<map>
#include<cmath>
#include<numeric>

#define _GLIBCXX_DEBUG
#define chinko long long

using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	vector<int> p(n);
	for(int i=0;i<n;i++) p[i]=i+1;
	
	int ans=0;
	
	bool visited[9][9]={};	
	
	for(int i=0;i<m;++i){
		int a,b;
		cin>>a>>b;
		visited[a][b]=visited[b][a]=true;
	}
	
	do{
		bool anko=true;
		for(int i=0;i<n-1;++i){
			if(visited[p[i]][p[i+1]]) continue; 
			anko=false; 
			break;
		}
		if(anko) ++ans;
	}while(next_permutation(p.begin()+1,p.end()));
	
	cout<<ans<<endl;
	return 0;
}

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

namespace ConsoleApp15
{
    class Class3
    {
        static void Main()
        {
            var NKS = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NKS[0], K = NKS[1], S = NKS[2];
            int gomi = S / 2 + 1;
            int[] A = new int[N];

            if (S == 1)
                for (int i = 0; i < N; i++) A[i] = 10000000;
            else
                for (int i = 0; i < N; i++) A[i] = gomi;

            for (int i = 0; i < K; i++) A[i] = S;

            Console.WriteLine(string.Join(" ", A));
        }
    }
}


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

#ifdef LOCAL
#include "../debug.h"
#else
#define debug(x...) 141
#endif
#define forn(i,x,n) for(int i = x; i < n; ++i)
#define forit(it, m) for(auto it = m.begin(); it!=m.end(); ++it)
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,tot=0;

    cin>>n;
    vector<int> a(n);
    forn(i,0,n){
    	cin>>a[i];
    	tot^=a[i];
    }
    forn(i,0,n){
    	cout<<(a[i]^tot)<<" ";
    }
    
    return 0;
}

Measured memory_bytes: 3892
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  [h,w] <- getl $ split toInt
  when (h /= 0 || w /= 0) $ do
    xs <- replicateM h getLine
    putStrLn . solve $ xs
    main

solve :: [String] -> String
solve xs = case p of
            Nothing   ->  "LOOP"
            Just (x,y) ->  show x ++ " " ++ show y
  where
    p = move xs [] (0,0)
    
move :: [String] -> [(Int,Int)] -> (Int,Int) -> Maybe (Int, Int)
move mt hs (x,y)
  | (x,y) `elem` hs = Nothing
  | c == '.' = Just (x,y)
  | c == '<' = move mt ((x,y):hs) (x-1,y)
  | c == '>' = move mt ((x,y):hs) (x+1,y)
  | c == '^' = move mt ((x,y):hs) (x,y-1)
  | c == 'v' = move mt ((x,y):hs) (x,y+1)
  | otherwise = Nothing
  where
    c = mt !! y !! x
    
toInt :: String -> Int
toInt s = read s

split :: (String -> a) -> String -> [a]
split f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4548
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll mod=1e9+7;

int main(){
    ll a,b;
    cin >> a >> b;
    string s;
    cin >> s;
    bool ok=true;
    rep(i,a+b+1){
        if(i==a){
            if(s[i]!='-'){
                ok=false;
                break;
            }
        }
        else{
            ll v=s[i]-'0';
            if(v<0 || v>9){
                ok=false;
                break;
            }
        }
    }
    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3604
'use strict';

function Main(input) {
    // N A0~Ai
    const tmp = input.trim().split('\n');
    const N = Number(tmp[0]);
    const A = tmp[1].split(' ').map((v) => Number(v));

    let height = A[0];
    let result = 0;
    for (const a of A) {
        if (a > height) {
            height = a;
        }
        result += height - a;
    }
    console.log(result);
    return;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

typedef long long int ll;

// 最大公約数
ll GCD(ll a,ll b){if(a%b==0)return b;return GCD(b,a%b);}

// 最小公倍数
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

int main(void){

    int n; cin >> n;
    vector<int> num(n);

    for(int i = 0;i < n;i++) cin >> num[i];
    
    int ans = 0;

    for(int i = 0;i < n;i++) ans += num[i] - 1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;
ll n,k,ans;
vll a,b;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);

    cin >> k;
    ans = 0;
    rng(i,1,k+1){
        rng(j,1,k+1){
            rng(l,1,k+1){
                ans += gcd(i,gcd(j,l));
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>

using namespace std;

int main(){
    int r,d,xi,xi_1;
    cin >> r >> d >> xi;

    for(int i = 0;i < 10;i++){
        xi_1 = r*xi - d;
        cout << xi_1 << endl;
        xi = xi_1; 
    }
    return 0;
}

Measured memory_bytes: 256