akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define mod 1000000007

using namespace std;
string solve(){
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0;i<s1.size();i++){
		if(s1[i]!=s2[i]) return "No";
	}
	return "Yes";
}
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	std::ios::sync_with_stdio(false);
	
	cout<<solve();
	
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define sf1(n) scanf("%d",&n)
#define sf2(n,q) scanf("%d %d",&n,&q)
#define f first
#define ss second
#define pb push_back
#define lli long long
#define mem(ar,false) memset(ar,false,sizeof(ar))
#define mpr make_pair
#define endl "\n"
#define mod 998244353
#define inf 9000000000000000000LL
#define M 200005

using namespace std;

struct info {
    lli prop, sum;
} tree[4*300000];
lli tree1[4*300000];
lli ar[300005];
void init(int node, int b, int e)
{
    if (b == e) {
        tree1[node] = ar[b];
        return;
    }
    int Left = node * 2;
    int Right = node * 2 + 1;
    int mid = (b + e) / 2;
    init(Left, b, mid);
    init(Right, mid + 1, e);
    tree1[node] = tree1[Left] + tree1[Right];
    tree1[node] %= mod;
}
void update(int node, int b, int e, int i, int j, int x)
{
    if (i > e || j < b)
        return;
    if (b >= i && e <= j)
    {
        tree[node].sum = x*tree1[node];
        tree[node].sum %= mod;
        tree[node].prop = x;
        return;
    }

    int Left = node * 2;
    int Right = (node * 2) + 1;
    int mid = (b + e) / 2;
    if(tree[node].prop)
    {
        tree[Left].prop = tree[Right].prop = tree[node].prop;

        tree[Left].sum = (tree[node].prop*tree1[Left])%mod;
        tree[Right].sum = (tree[node].prop*tree1[Right])%mod;

        tree[node].prop = 0;

    }
    update(Left, b, mid, i, j, x);
    update(Right, mid + 1, e, i, j, x);
    tree[node].sum = tree[Left].sum + tree[Right].sum ;
    tree[node].sum %= mod;
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,q;
    cin >> n >> q;
    ar[n] = 1;

    for(int i=n-1;i>=1;i--)
    {
        ar[i] = 10*ar[i+1];
        ar[i] %= mod;
    }
    init(1,1,n);
    update(1,1,n,1,n,1);

    while(q--)
    {
        int l,r,d;
        cin >> l >> r >> d;
        update(1,1,n,l,r,d);
        cout << tree[1].sum << endl;
    }
    return 0;

}


Measured memory_bytes: 17524
#include<iostream>

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

int main()
{
    int x, y;
    std::cin >> x >> y;
    if(x>y)
    {
        std::cout << gcd(x, y);
    }
    else
    {
        std::cout << gcd(y, x);
    }
    std::cout << '\n';
    return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll i,j;
    ll h,w,k;
    cin >> h >> w >> k;
    vector<vector<ll>> c(h,vector<ll>(w));
    for(i = 0;i < h;++i){
        string s;
        cin >> s;
        rep(j,w){
            c.at(i).at(j) = s.at(j) - '0';
        }
    }
    ll ans = 0;
    for(i = 0;i < h;++i){
        rep(j,w){
            vector<vector<ll>> cc = c;
            cc.at(i).at(j) = 0;
            ll tmp = 0;
            ll stage = 0;
            while(true){
                ll ii,jj;
                rep(jj,w){
                    vector<ll> notzero;
                    for(ii = h-1;ii >= 0;--ii){
                        if(cc.at(ii).at(jj) != 0) notzero.push_back(cc.at(ii).at(jj));
                    }
                    for(ii = 0;ii < notzero.size();++ii){
                        cc.at(h-1-ii).at(jj) = notzero.at(ii);
                    }
                    for(ii = ii;ii < h;++ii){
                        cc.at(h-1-ii).at(jj) = 0;
                    }
                }
                /**
                for(ii = 0;ii < h;++ii){
                    rep(jj,w-1){
                        cout << cc.at(ii).at(jj) << " ";
                    }
                    cout << cc.at(ii).at(jj) << endl;
                }
                cout << endl;
                **/
                bool flag = true;
                for(ii = h-1;ii >= 0;--ii){
                    rep(jj,w){
                        if(cc.at(ii).at(jj) == 0) continue;
                        if(jj + k-1 >= w) continue;
                        ll kk;
                        ll tmp_number = cc.at(ii).at(jj);
                        ll conlen = 0;
                        for(kk = jj;kk < w;++kk){
                            if(cc.at(ii).at(kk) == tmp_number){
                                ++conlen;
                            }else{
                                break;
                            }
                        }
                        if(conlen >= k){
                            flag = false;
                            tmp += tmp_number*conlen*pow_mod(2ll, stage, 1e12+7);
                            for(kk = jj;kk < jj+conlen;++kk){
                                cc.at(ii).at(kk) = 0;
                            }
                        }
                    }
                }
                /**
                for(ii = 0;ii < h;++ii){
                    rep(jj,w-1){
                        cout << cc.at(ii).at(jj) << " ";
                    }
                    cout << cc.at(ii).at(jj) << endl;
                }
                cout << tmp << endl;
                **/
                if(flag) break;
                ++stage;
            }
            //return 0;
            ans = max(tmp,ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	
	int a,b,c;
	int temp;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a > b){
		temp = a;
		a = b;
		b = temp;
	}
	if(b > c){
		temp = c;
		c = b;
		b = temp;
	}
	if(a > b){
		temp = a;
		a = b;
		b = temp;
	}
	
	printf("%d %d %d\n",a,b,c);
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int> w(N), v(N);
	for (int i = 0; i < N; i++) cin >> w.at(i) >> v.at(i);

	vector<vector<int64_t>> dp(N, vector<int64_t>(W+1));

	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= W; j++) {
			if (!i) {
				if (w.at(i) <= j) dp.at(i).at(j) = v.at(i);
			}
			else {
				if (w.at(i) > j) dp.at(i).at(j) = dp.at(i - 1).at(j);
				else dp.at(i).at(j) = max(dp.at(i - 1).at(j), dp.at(i - 1).at(j - w.at(i)) + v.at(i));
			}
		}
	}

	//for (int i = 0; i < N; i++) {
	//	for (int j = 0; j <= W; j++) {
	//		if (j) cout << ' ';
	//		cout << dp.at(i).at(j);
	//	}
	//	cout << endl;
	//}

	cout << dp.back().back() << endl;
}

Measured memory_bytes: 82388
using System;
// using System.Collections.Generic;
// using System.Linq;

class Program
{
    static void Main()
    {
        string S = Console.ReadLine();
        Console.WriteLine(7 - Array.IndexOf(
            new string[] { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" }, S));
        return;
    }
}

Measured memory_bytes: 25928
#include <stdio.h>

long long mpow(long long a, int n, int mod)
{
	long long res = 1;
	while (n > 0) {
		if(n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int minv(int a, int mod)
{
	return mpow(a, mod-2, mod);
}

int main(void)
{
	int n, a, b, mod = 1000000007;
	long long mfact[200001];
	long long nPr[200001];
	
	scanf("%d%d%d", &n, &a, &b);
	
	mfact[0] = 1; nPr[0] = 1;
	for (int i = 1; i <= 200000; i++) {
		mfact[i] = mfact[i-1] * i % mod;
		nPr[i] = nPr[i-1] * (n-i+1) % mod;
	}
	
	long long ans = mpow(2, n, mod) - 1;
	
	ans = (ans - nPr[a] * minv(mfact[a], mod) % mod + mod) % mod;
	
	ans = (ans - nPr[b] * minv(mfact[b], mod) % mod + mod) % mod;
	
	printf("%ld", ans);
	
	return 0;
}


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


int main(){
  long long a,b,c;
  cin >> a >> b >> c;
  long long ans=0;
  if(a+b>=c){
    ans=b+c;
  }else{
    ans=a+b+b+1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    s = kwargs["s"]
    if s == "SSS":
        res = 0
    elif s == "RRR":
        res = 3
    elif s == "RRS" or s == "SRR":
        res = 2
    else:
        res = 1
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["s"] = cin[0]

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 31184
def main():
	t, *grid = open(0)
	h, w = map(int, t.split())
	vis = [[False] * w for _ in range(h)]
	ans = 0
	for y in range(h):
		for x in range(w):
			if vis[y][x]:
				continue
			q = [(y, x, grid[y][x])]
			d = {"#": 0, ".": 0}
			while q:
				cy, cx, cc = q.pop()
				for ny, nx in ((cy + 1, cx), (cy - 1, cx), (cy, cx + 1), (cy, cx - 1)):
					if not (0 <= ny < h and 0 <= nx < w) or vis[ny][nx] or cc == grid[ny][nx]:
						continue
					nc = grid[ny][nx]
					d[nc] += 1
					vis[ny][nx] = True
					q.append((ny, nx, nc))
			ans += d["#"] * d["."]
	print(ans)

if __name__=="__main__":
	main()

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

#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1e9 + 7

using namespace std;

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 main(void)
{
    int x, a, b;
    cin >> x >> a >> b;
    cout << (x - a) % b << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const int inf=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
  ll n;cin>>n;
  ll x=n/3;
  ll ans=0;
  COMinit();
  rep(i,1,x+1){
    ll y=n-i*3;
    ans+=COM(y+i-1,y);
    ans%=MOD;
  }
  cout<<ans<<endl;
  
}



Measured memory_bytes: 15584
#include<iostream>

using namespace std;
int main(){
	int w,i,j;
	char S[5000];
	cin >> S;
	cin >> w;
	for(i=0; S[i] != '\0'; i++){
	}
	if(i%w == 0){
		for(j=0; j<i/w; j++){
			cout << S[w*j];
		}
	}
	else
		for(j=0; j<=i/w; j++){
			cout << S[w*j];
		}
	
	return 0;
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    string a, b;
    cin >> a >> b;
    if(a == b){
        cout << "EQUAL" << endl;
        return 0;
    }
    cout << ((a.size() == b.size() ? a > b : a.size() > b.size()) ? "GREATER" : "LESS") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"("<<(x).FI<<", "<<(x).SE<<")"<<endl;
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N; cin >> N;
  string A, B, C;
  cin >> A >> B >> C;
  int ans = 0;
  REP(i, N) {
    int cnt = 0;
    if (A[i] == B[i]) cnt++;
    if (B[i] == C[i]) cnt++;
    if (C[i] == A[i]) cnt++;
    if (cnt == 0) ans += 2;
    else if (cnt == 1) ans += 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int x,n;
    vector<int> p;
    int k;
    
    cin >> x >> n;
    for (int i = 0;i < n;i++){
        cin >> k;
        p.push_back(k);
    }
    
    sort(p.begin(),p.end());
    
    int ans = 0;
    int i = 0;
    while (1){
        if (binary_search(p.begin(),p.end(),x+i) && binary_search(p.begin(),p.end(),x-i)){
            ;
        }
        else if (!(binary_search(p.begin(),p.end(),x+i)) && !(binary_search(p.begin(),p.end(),x-i))){
            ans = min(x+i,x-i);
            break;
        }
        else if(!binary_search(p.begin(),p.end(),x+i) ){
            ans = x+i;
            break;
        }
        else {
            ans = x-i;
            break;
        }
        i++;
    }
    
    cout << ans << endl;
}



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

#define LL long long
#define int long long
#define RG register

using namespace std;
template<class T> T gi() {
	T x = 0; bool f = 0; char c = getchar();
	while (c != '-' && (c < '0' || c > '9')) c = getchar();
	if (c == '-') f = 1, c = getchar();
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f ? -x : x;
}
const int N = 1e5 + 10, Mod = 1e9 + 7;
int fac[N], ifac[N];
int fpow(int a, int b) {
	int res = 1;
	for (; b; b >>= 1, a = 1ll * a * a % Mod)
		if (b & 1) res = 1ll * res * a % Mod;
	return res;
}
int C(int n, int m) {
	if (n < m) return 0;
	return 1ll * fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;
}
int A[N];
 main() {
	fac[0] = 1;
	for (int i = 1; i < N; i++) fac[i] = 1ll * fac[i - 1] * i % Mod;
	ifac[N - 1] = fpow(fac[N - 1], Mod - 2);
	for (int i = N - 1; i >= 1; i--) ifac[i - 1] = 1ll * ifac[i] * i % Mod;
	int n = gi<int>(), k = gi<int>();
	for (int i = 1; i <= n; i++) A[i] = gi<int>();
	sort(A + 1, A + 1 + n);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		(ans += 1ll * C(i - 1, k - 1) * A[i] % Mod) %= Mod;
		(ans += Mod - 1ll * C(n - i, k - 1) * A[i] % Mod) %= Mod;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2560
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <sstream>
#include <bitset>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
#define MOD ((int)1e9+7)
//static const long double pi = 3.1415926535897932;

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

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

struct Combination {
	const int num=51e4;			//要素数
	const int mod=1e9+7;
	vector<ll> fact,inv,finv; //階乗,逆元,逆元の階乗.
	
	Combination():fact(num),inv(num),finv(num){
		fact[0]=fact[1]=1;
		inv[1]=1;
		finv[0]=finv[1]=1;
		for(int i=2;i<num;++i){
			fact[i]=fact[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	int nCk(int n,int k){
		if(n<k) return 0;
		if(n<0 or k<0) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
	int big_nCk(int n,int k){ //nが大きいとき
		ll res=1LL;
		for (int i = 0; i < k; i++) {
			res=res*(n-i)%mod;
		}
		res = res*finv[k]%mod;
		return res;
	}
	int nHk(int n,int k){return nCk(n+k-1,n-1);}//重複組み合わせ.
};

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

ll pow_mod(ll n, ll k, ll p) { // n^k(mod p)
	if (k == 0) {
		return 1;
	}
	ll res = pow_mod(n * n % p, k / 2, p);
	if (k & 1) {
		res = res * n % p;
	}
	return res;
}

bool vector_finder(std::vector<int> vec, int number) { // vector 内にnumberがあるかどうか
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance( vec.begin(), itr );
	if (index != vec.size()) { // 発見できたとき
		return true;
	}
	else { // 発見できなかったとき
		return false;
	}
}

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans = 0;
	ll start = a[0];
	for (int i = 1; i < n; i++) {
		if (start > a[i]) {
			ans += (start - a[i]);
		} else {
			start = a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  int dp[n];
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for(int i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
  }
  cout<<dp[n-1]<<"\n";
}

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

int n;
int a[100010];

int cmp(int q,int w)
{
    return q>w;
}

vector<int> v;

int main()
{
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+n+1,cmp);
    for (int i=1;i<=n;i++) if (a[i]==a[i+1]) v.push_back(a[i++]);
    if (v.size()>=2)
    {
        long long ans=(long long)v[0]*(long long)v[1];
        cout<<ans<<endl;
    }
    else cout<<0<<endl;
}

Measured memory_bytes: 1024
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;

public class Main {

    public static void main(String[] args) throws IOException{
        BufferedReader br = null;
        PrintWriter writer = null;
        
        try {
            br =new BufferedReader(new InputStreamReader(System.in));
            writer = new PrintWriter(System.out);
            
            String[] readLine = br.readLine().split(" ");
            int firstNum = Integer.parseInt(readLine[0]),
                secondNum = Integer.parseInt(readLine[1]);
            
            if(firstNum%secondNum != 0){
                for(int i = firstNum * 2; i < Math.pow(10, 18); i += firstNum){
                    if(i % secondNum != 0){
                        writer.println(i);
                        break;
                    }
                }
            }else writer.println(-1);
            
        }finally{
            if(br != null){
                br.close();
            }
            if(writer != null){
                writer.close();
            }
        }

    }
}

Measured memory_bytes: 21204
#include <iostream>
#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
#include <math.h>
//#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    int k;
    int tmp;
    double ans = 0.0;

    cin >> n >> k;
    for(int i=1; i<=n; i++){
        if(k%i==0){
            tmp = k/i;
        }else{
            tmp = k/i+1;
        }
        if(log2(tmp)-(int)log2(tmp)==0){
            tmp = (int)log2(tmp);
        }else{
            tmp = (int)log2(tmp)+1;
        }
        ans += 1.0/(double)n*pow(0.5, (double)tmp);
    }
    cout << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
# ABC164 B

def main():
    a, b, c, d = map(int, input().split())

    while True:
        c = c - b
        if c <= 0:
            print('Yes')
            break
        a = a - d
        if a <= 0:
            print('No')
            break

if __name__ == '__main__':
    main()

Measured memory_bytes: 9172
/* You can't hack me! */
#pragma warning(disable : 4996)
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vch;
typedef set<ll> sll;
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(auto i=a; i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define sc scanf
#define pr printf
#define in(x) sc("%lld", &(x))
#define id(x) sc("%Lf", &(x))
#define os(x) pr("%lld ", x)
#define on(x) pr("%lld\n", x)
#define nl cout<<"\n"
const ll P=998244353;
const ll N=200010;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll t=1;
    //cin>>(t);
    while(t--)
    {
        ll k, a, b;
        cin>>k>>a>>b;
        if(a/k*k==a || (k*(a/k+1)>a && k*(a/k+1)<=b)) cout<<"OK";
        else cout<<"NG";
        nl;
    }
    cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int s, w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

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

using namespace std;

const int N=100000+5;
const int inf=10000000;

int dis[N];
int f[N];
int dp[N];
int q[N];
int n;
int a[N];

int main()
{
	int i=1;
	cin>>n;
	int j;
	for(i=1;i<=n;++i)cin>>dis[i];
	int ans=0;
	reverse(dis+1,dis+1+n);
	memset(q,0x3f,sizeof(q));
	for(i=1;i<=n;++i)
	{
		dp[i]=upper_bound(q+1,q+n,dis[i])-q;
		q[dp[i]]=dis[i];
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(void){
    int n;
    cin >> n;
    int ans = 0;
    if(n <= 9){
        ans = n;
    }else if(10 <= n && n <= 99){
        ans = 9;
    }else if(100 <= n && n <= 999){
        ans = n - 100 + 1 + 9;
    }else if(1000 <= n && n <= 9999){
        ans = 909;
    }else if(10000 <= n && n < 100000){
        ans = 909 + n - 10000 + 1;
    }else{
        ans = 90909;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
H,W=map(int,input().split())

if H==1 or W==1:
    print(1)
else:
    

    if H%2==0 and W%2==0:
        print(int(H*(W/2)))
    elif H%2!=0 and W%2==0:
        print(int(W/2*H))
    elif H%2==0 and W%2!=0:
        a=(H//2)*(W//2+1)
        b=(H//2)*(W//2)
        print(int(a+b))
    else:
        a=(H//2+1)*(W//2+1)
        b=H//2*(W//2)
        print(int(a+b))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=0,now=0;
  for(int i=0;i<n;i++){
    if(s[i]=='I')now++;else now--;
    ans=max(ans,now);
  }
  cout<<ans<<endl;
}


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

using namespace std;

int main() {
	int add = 10;
	int sum = 0;
	for(int i=0; i < 5; i++) {
		int val;
		cin >> val;
		
		int rest = val % 10;
		if(rest != 0) {
			val += (10 - rest);
		}
		
		sum += val;
		if(rest != 0) add = min(add, rest);
	}
	
	if(add != 10) sum += add;
	if(add != 0 && add != 10) sum -= 10;
	
	cout << sum;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define INF 1000000000000000000LL
using namespace std;
using ll = long long;

int main()
{
  int h1, m1, h2, m2, k;

  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int h3 = k / 60;
  int m3 = k % 60;

  cout << (h2 - h3 - h1)*60 + m2 - m3 - m1 << endl;
  return 0;
}

Measured memory_bytes: 3632
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

sys.setrecursionlimit(10 ** 7)

n, k = na()
a = na()

proc = [0] * n
def rec(i, cnt):
    if proc[i]:
        return (cnt, i)
    proc[i] = 1
    return rec(a[i] - 1, cnt + 1)

def rec2(i, arr):
    if proc[i] >= 2:
        return arr
    proc[i] += 1
    arr.append(i)
    return rec2(a[i] - 1, arr)

cnt, i = rec(0, 0)
arr = rec2(i, [])

nk = k
nk -= cnt - len(arr)
if nk < 0:
    ans = 0
    for i in range(k):
        ans = a[ans] - 1
    print(ans + 1)
else:
    print(arr[nk % len(arr)] + 1)

Measured memory_bytes: 267884
#!/usr/bin/env python3

N = int(input())
SP = []
for i in range(N):
    SP.append({"id" :i, "data": input().split()})

tmp = sorted(SP, key=lambda x:int(x["data"][1]), reverse=True)

for k in sorted(tmp, key=lambda x:x["data"][0]):
    print(k["id"]+1)


Measured memory_bytes: 3316
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf("%lld", &(n))
#define scd(n) scanf("%Ld", &(n))
typedef long long LL;

int main(void)
{
	LL n, t; 
	sci(n);  sci(t);
	LL mn = 1e9;
	for (int i = 0; i < n; i++) {
		LL c, tt;
		sci(c); sci(tt);
		if (tt > t)continue;
		mn = min(mn, c);
	}
	if (mn == 1e9)cout << "TLE";
	else {
		cout << mn;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  string S;cin>>S;
  int K;cin>>K;
  int point=0,cnt=0;
  char tmp=S.at(0);
  REP(i,1,S.size()){
    if(S.at(point)!=S.at(i)){
      cnt+=(i-point)/2;
      point=i;
    }
  }
  cnt+=(S.size()-point)/2;
  if(point==0){
    print(K*(S.size())/2);
    re 0;
  }
  // print(cnt);
  if(S.at(0)!=S.at(S.size()-1)){
    print(cnt*K);
    re 0;
  }
  else{
    int a=S.size()-point,b;
    REP(i,0,S.size()){
      if(S.at(0)!=S.at(i)){
        b=i;
        br;
      }
    }
    
    // print(a," ",b);

    int ans=cnt*K-(K-1)*(a/2+b/2-(a+b)/2);
    print(ans);

  }


}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 2010
const int MOD = 1000000007;

int dp[maxn][maxn];

int C(int n, int k) {
    int i, j;
    for (i = 0; i <= n; i++)
        for (j = 0; j <= min(i, k); j++)
            if (j == 0 || j == i)
                dp[i][j] = 1;
            else
                dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD;
    return dp[n][k];
}

void solve() {
    C(2000, 2000);
    int n, k;
    cin >> n >> k;

    int r = n - k;
    for (int i = 1; i <= k; i++) {
        int ans = dp[r + 1][i];
        ans = ans * dp[k - 1][i - 1] % MOD;
        cout << ans << endl;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

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

Measured memory_bytes: 30336
#include<iostream>
using namespace std;
int main(){
    int n,m,x,y,c,d,i,j,k;
    cin>>n;
    string s[n];
    for(i=0;i<n;i++)
        cin>>s[i];
    cin>>m;
    string t[m];
    for(i=0;i<m;i++)
        cin>>t[i];
    for(i=0;i<n;i++){
        x=0;
        for(j=0;j<n;j++){
            if(s[i]==s[j])
                x=x+1;
        }
        for(k=0;k<m;k++){
            if(s[i]==t[k])
                x=x-1;
        }
        if(i==0)
            c=x;
        if(x>c)
            c=x;
    }
    for(i=0;i<m;i++){
        y=0;
        for(j=0;j<n;j++){
            if(t[i]==s[j])
                y=y+1;
        }
        for(k=0;k<m;k++){
            if(t[i]==t[k])
                y=y-1;
        }
        if(i==0)
            d=y;
        if(x>d)
            d=y;
    }
    if(c>=d&&c>0)
        cout<<c;
    else if(d>=c&&d>0)
        cout<<d;
    else
        cout<<'0';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 1000000007
#define inf 1000000007
#define ll long long
#define ull unsigned long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 100010
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}
int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}

ll dp[N];
int a[101],b[101];
int main(){
    //srand(time(NULL)+clock());
    int ca=0,T,k,i,j,m=0,K,n;
    double start=clock();
    scanf("%d%d",&n,&m);
    rep(i,0,n)scanf("%d%d",&a[i],&b[i]);
    int s=0;
    rep(i,0,n){
        per(j,0,min(s,m)+1){
            if(a[i]+j<=m)Max(dp[a[i]+j],dp[j]+b[i]);
        }
        s+=a[i];
    }
    ll ans=0;
    rep(i,0,m+1)Max(ans,dp[i]);
    printf("%lld\n",ans);
    cerr<<(1.*clock()-start)/CLOCKS_PER_SEC<<"\n";
}


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

#define int long long
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int32_t main(){
	fast;

	string s;
	cin >> s;

	s = "a" + s;
	for(int i=1 ;i<=s.length()-1 ; i++)
	{
		if(s[i] == s[i+1])
		{
			cout << i << " " << i+1 ;
			return 0;
		}
	}
	
	for(int i=1 ;i<=s.length()-2 ; i++)
	{
		if(s[i] == s[i+2])
		{
			cout << i << " " << i+2 ;
			return 0;
		}
	}
	
	cout << "-1 -1";

}







Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    string b=s;
    reverse(s.begin(),s.end());
    for(int i=0;i<s.size();++i)
    {
        if(s[i]=='b') s[i]='d';
        else if(s[i]=='d') s[i]='b';
        else if(s[i]=='p') s[i]='q';
        else if(s[i]=='q') s[i]='p';
    }
    if(s==b) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 512
s=input()
l=0
r=len(s)-1
cnt=0
while(l<r):
    if s[l]==s[r]:
        l+=1
        r-=1
    elif s[l]=="x":
        cnt+=1
        l+=1
    elif s[r]=="x":
        cnt+=1
        r-=1
    else:
        cnt=-1
        break
print(cnt)

Measured memory_bytes: 39792
S = input()
YM = True
MY = True
former = int(S[0])*10 + int(S[1])
latter = int(S[2])*10 + int(S[3])
if latter == 0 or latter>=13:
    YM = False
if former == 0 or former>=13:
    MY = False
if YM and MY:
    print("AMBIGUOUS")
elif YM == False and MY:
    print("MMYY")
elif MY == False and YM:
    print("YYMM")
else:
    print("NA")

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

typedef long long ll;

int a[12][12];

int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> c(n);
	rep(i, n)
	{
		cin >> c[i];
		rep(j, m)
			cin >> a[i][j];
	}
	//bit全探索 1<<nで、1の後ろにn個0がつく
	//n=3 => 1000 なので(s = 0000; s < 1000 s++)の0〜7まで
	int ans = INT_MAX;
	//1<<n == 2^n;
	rep (s, 1<<n)
	{
		int cost = 0;
		vector<int> d(m);
		rep(i, n)
		{
			//bit が１の時つまり本が選ばれた時
			//(s=010,i=1)の時 sの1をi個右に移動010＝>001
			if (s>>i&1)
			{
				cost += c[i];
				rep(j,m)
				{
					d[j] += a[i][j];
				}
			}
		}
		int cnt = 0;
		rep (j,m)
		{
			if (d[j] >= x)
				cnt++;
		}
		if (cnt == m)
			ans = min(ans, cost);
	}
	if (ans == INT_MAX)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return (0);
}


Measured memory_bytes: 3568
// Problem : A - Plural Form
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// $%U%$
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	string s;
	cin >> s;
	if(s.back()=='s')
	cout << s << "es" << endl;
	else
	cout << s << "s" << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 3652
using System;

class program
{
    public static int Main()
    {
        while (true)
        {
            var str = Console.ReadLine();
            var x = int.Parse(str.Split(' ')[0]);
            var y = int.Parse(str.Split(' ')[1]);

            if (x == 0 && y == 0) break;

            if (x > y)
            {
                Console.WriteLine("{0} {1}", y, x);
            }
            else
            {
                Console.WriteLine("{0} {1}", x, y);
            }

        }
        return 0;
    }
}

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

using namespace std;
typedef long long ll;

int main() {
//	freopen("input.txt","r",stdin);
	int n,b;
	vector< pair<int,int> > a;
	cin >>n;
	for(int x=1;x<=n;x++){
		cin >> b;
		a.push_back({b,x});
	}
	int p=0;
	for(int x=0;x<n;x++){
		if(a[x].first == a[x].second){
			swap(a[x].second,a[x+1].second);
			p++;
		}
	}
	cout << p << endl;
}

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

using namespace std;

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

void solve()
{
	int n;
	cin >> n;
	vector<int> input(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> input[i];
	}
	sort(input.begin(), input.end());
	vector<int> ans;
	ans.push_back(1);
	if(n == 2)
	{
		int gcd = GCD(input[1], input[0]);
		for(int i = 2; i <= gcd; ++i)
		{
			if(input[1] % i == 0 && input[0] % i == 0)
			{
				ans.push_back(i);
			}
		}
	}
	else if(n == 3)
	{
		int gcd = GCD(input[2], input[1]);
		if(gcd > input[0])
		{
			gcd = GCD(gcd, input[0]);
		}
		else
		{
			gcd = GCD(input[0], gcd);
		}
		for(int i = 2; i <= gcd; ++i)
		{
			if(input[2] % i == 0 && input[1] % i == 0 && input[0] % i == 0)
			{
				ans.push_back(i);
			}
		}
	}
	for(int i = 0; i < ans.size(); ++i)
	{
		cout << ans[i] << endl;
	}
}

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

Measured memory_bytes: 1220
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

# x/B = t + c
# at

# floor(a(t+c))
# floor(a(x%B)/B)
a, b, n = na()
n = min(b-1, n)
print(a*(n%b)//b)



Measured memory_bytes: 61844
import java.util.Scanner;

class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		
		if (a < b && b < c){
			System.out.println("Yes");}
		else{
			System.out.println("No");}
	}
}


Measured memory_bytes: 26128
import sys
input=sys.stdin.readline
from collections import deque
n=int(input())
l=deque()
for i in range(n):
    c=list(input().split())
    if c[0]=="insert":
        c[1]=int(c[1])
        l.appendleft(c[1])
    elif c[0]=="delete":
        c[1]=int(c[1])
        try:
            l.remove(c[1])
        except:
            pass
    elif c[0]=="deleteFirst":
        a=l.popleft()
    else:
        a=l.pop()

print(*l)



Measured memory_bytes: 45952
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
int a[100001];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i <= 100000; i++)
    {
        a[i] = 0;
    }
    for (int i = 0; i < n; i++)
    {
        int b;
        cin >> b;
        if (b == 0)
        {
            a[0]++;
            a[1]++;
        }
        else
        {
            a[b]++;
            a[b + 1]++;
            a[b - 1]++;
        }
    }
    int ans = 0;
    for (int i = 0; i <= 100000; i++)
    {
        ans = max(ans, a[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long r, long long g, long long b) {
  ll n = r * 100 + g * 10 + b;
  cout << (n % 4 == 0 ? "YES" : "NO") << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long b;
  long long g;
  long long r;
  cin >> r;
  cin >> g;
  cin >> b;
  solve(r, g, b);
  return 0;
}


Measured memory_bytes: 256
import sys
n,m = map(int,input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for y in range(n-m+1):
    for x in range(n-m+1):
        f = 1
        for i in range(m):
            for j in range(m):
                if b[i][j] == a[i+y][j+x]:
                    pass
                else:
                    f = 0
                    break
            if f == 0:
                break
        if f == 1:
            print("Yes")
            sys.exit()
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;

int main()
{
	string s;
	cin >> s;
	if(s[0]==s[2])
	cout<<"Yes"<<endl;
	else 
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var k, a, b int
	fmt.Scanf("%d", &k)
	fmt.Scanf("%d %d", &a, &b)
	if b/k > a/k {
		fmt.Println("OK")
	} else if a%k == 0 || b%k == 0 {
		fmt.Println("OK")
	} else {
		fmt.Println("NG")
	}
}


Measured memory_bytes: 1816
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N ;
  vl x(N),y(N),h(N);
  rep(i,N) cin >> x[i] >> y[i] >> h[i] ;
  vi idx(N);
  iota(idx.begin(),idx.end(),0);
  sort(idx.begin(),idx.end(),[&](int l,int r){return h[l]<h[r];});
  reverse(ALL(idx));
  for(ll cx = 0; cx <= 100; cx++)
    for(ll cy = 0; cy <= 100; cy++){
      int f = idx[0];
      ll hh = h[f]+abs(x[f]-cx)+abs(y[f]-cy);
      bool ok = true;
      rep(i,N) ok &= (h[i]==max(hh-abs(x[i]-cx)-abs(y[i]-cy),0LL));
      if(ok){
        cout << cx << " " << cy << " " << hh << endl;
        return 0;
      }
    }

  return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
KS = [[int(i) for i in input().split()] for j in range(M)]
p = [int(i) for i in input().split()]

ans = 0
for i in range(1<<N):
    light = [0 for k in range(M)]
    flag = [False for k in range(N)]
    for j in range(N):
        if (i>>j & 1) == 1:
            flag[j] = True
    for j in range(M):
        for k in KS[j][1:]:
            light[j] += 1 if flag[k-1] else 0
            light[j] = light[j]%2
    if light == p:
        ans += 1
print(ans)

Measured memory_bytes: 3064
import java.io.PrintWriter
val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }

fun func() {
    val (N, X) = listOfInt()
    val L = listOfInt()
    var d = 0
    var i = 0
    while (d <= X && i < N) {
        d = d + L[i++]
    }
    println("${if (d > X) i else i + 1}")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 36128
#include<stdio.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

/*
	入力例：
	3
	1 1 3
*/

int main(){
	long N=0;
	long R=0;
	long d=0;
	long p,e,z;
	long iResult=0;
	scanf("%ld", &N);
	long a[N];
	for(long i=0;i<N;i++){
		scanf("%ld", &a[i]);
	}
	long iCnt;
	iCnt=0;
	for(long i=0;i<N;i=i+2){
		if (a[i]%2==1) {
			iCnt++;
		}
	}
	printf("%ld\n",iCnt);
	return 0;
}

Measured memory_bytes: 1724