akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string s,t;
    cin >>s>>t;
    reverse(all(t));
    if(s==t){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3632
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

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};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//
struct Edge {
	int to;
	lint dst;
};

Vec< Vec< Edge > > edges;
Vec< lint > val;
Vec< bool > vis;

void dfs(int v, lint a, bool t, lint& mx, lint &my) {
	if (vis[v]) return;
	vis[v] = true;
	val[v] = a;
	
	if (t) minUpdate(mx, a);
	else minUpdate(my, a);
	
	for (const Edge& e : edges[v]) {
		lint na = e.dst - a;
		dfs(e.to, na, !t, mx, my);
	}
}

int main() {
	int R, C, N;
	cin >> R >> C >> N;
	
	edges.assign(R+C, Vec< Edge >());
	for_(i,0,N) {
		int r, c, a;
		cin >> r >> c >> a;
		edges[r-1].push_back(Edge{R+c-1, a});
		edges[R+c-1].push_back(Edge{r-1, a});
	}
	
	val.assign(R+C, 0);
	vis.assign(R+C, false);
	for_(v,0,R+C) {
		if (vis[v]) continue;
		lint mx = 1LL << 60, my = 1LL << 60;
		dfs(v, 0, false, mx, my);
		if (mx + my < 0) {
			puts("No");
			return 0;
		}
	}
	
	for_(v,0,R+C) {
		for (const Edge& e : edges[v]) {
			if (val[v] + val[e.to] != e.dst) {
				puts("No");
				return 0;
			}
		}
	}
	
	puts("Yes");
}
//--------------8---------------->> coding space <<-----------------8-------------//


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

int main(){
int x,N,i;
string S;
x = 0;
cin>>N;
cin>>S;
int maxVar=0;

    for(i=0;i<N; i++){
        if(S[i]=='I'){
            x++;
        }else{
            x--;
        }
    if(maxVar<x){
        maxVar=x;
        }
    }
    cout<<maxVar<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	int n, m, a[55], b[55], c[55], d[55], ans, yojo;
	cin >> n >> m;
	for (int i = 0; i < n; i++)cin >> a[i] >> b[i];
	for (int i = 0; i < m; i++)cin >> c[i] >> d[i];
	for (int i = 0; i < n; i++) {
		ans = yojo = 1e9;
		for (int j = 0; j < m; j++) {
			if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < ans) {
				ans = abs(a[i] - c[j]) + abs(b[i] - d[j]);
				yojo = j + 1;
			}
		}
		cout << yojo << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
import bisect as bi
ans=0
for j in range(n):
    i=bi.bisect_left(a, b[j])
    k=n-bi.bisect_right(c, b[j])
    ans+=i*k
print(ans)

Measured memory_bytes: 24096
#include <stdio.h>

int main(void)
{
	int benkyou;
	int kaisuu;
	int benkyou_s;
	int benkyou_e;
	int sum;
	int i;
	
	while (1){
		scanf("%d", &benkyou);
		
		if (benkyou == 0){
			break;
		}
		
		scanf("%d", &kaisuu);
		
		sum = 0;
		
		for (i = 0; i < kaisuu; i++){
			scanf("%d%d", &benkyou_s, &benkyou_e);
			sum += benkyou_e - benkyou_s;
		}
		
		if (benkyou - sum <= 0){
			printf("OK\n");
		}
		
		else {
			printf("%d\n", benkyou - sum);
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  string x;
  cin >> x;
  int cs = 0;
  int ans = x.length();
  REP(i, x.length())
  {
    if (x[i] == 'S')
    {
      cs++;
    }
    else
    {
      if (cs != 0)
      {
        cs--;
        ans -= 2;
      }
    }
  }
  cout << ans << endl;
}


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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
template<typename T = int>
T in() {T a; cin >> a; return a;}
int cum_sum[200005];
/***** MAIN *****/
signed main() {
  int n = in();
  int bars[n];
  REP(i,n) {
    cin >> bars[i];
  }
  int left = 0, right = 0;
  cum_sum[0] = 0;
  REP(i,n) {
    cum_sum[i+1] += cum_sum[i] + bars[i];
  }
  int ans = LLONG_MAX;
  REPS(i,1,n) {
    int left = cum_sum[i];
    int right = cum_sum[n] - cum_sum[i];
    ans = min(ans,abs(right-left));
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3328
#include<stdio.h>
#include<stdio.h>

int main(){
  int kill,baby,i,j,yasuna,sonya;
  scanf("%d",&kill);
  int me[kill+1][kill+1];
  for(i=1;i<=kill;i++)for(j=0;j<=kill;j++)me[i][j]=0;

  for(i=0;i<kill;i++){
    scanf("%d%d",&yasuna,&sonya);
    for(j=0;j<sonya;j++){
      scanf("%d",&baby);
      me[yasuna][baby]=1;
    }
  }
  for(i=1;i<=kill;i++){
    for(j=1;j<=kill;j++)if(j==kill)printf("%d",me[i][j]);else printf("%d ",me[i][j]);
    printf("\n");
  }
}



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

int main() {
	int nums[4] = { 1,9,7,4 };
	int exists = 0;
	for (int i = 0; i < 4; i++) {
		int N;
		cin >> N;
		for (int j = 0; j < 4; j++) if (N == nums[j]) exists += (1 << j);
	}
	cout << (exists == 15 ? "YES" : "NO") << endl;
}

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

int main(void)
{
	char words[1024];
	char *word;
	int len;
	int flag = 0;

	fgets(words, sizeof(words), stdin);
	word = strtok(words, ",. \n");
	while (word){
		len = strlen(word);
		if (len > 2 && len < 7){
			if (flag) printf(" ");
			else flag = 1;
			printf("%s", word);
		}
		word = strtok(NULL, ",. \n");
	}
	puts("");

	return (0);
}

Measured memory_bytes: 528
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	t %= mod;
	if (n % 2 == 1)t *= a;
	return t % mod;
}

const int INF = 1001001001;
//const ll INF = 1e18;

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

ll cal_gcd(ll a, ll b) {
	ll m = max(a, b);
	ll n = min(a, b);
	while (m%n != 0) {
		ll b = m % n;
		m = n;
		n = b;
	}
	return n;
}


int main() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<int>c(n);
	vector<vector<int>>a(n, vector<int>(m));
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	int ans = INF;
	for (ll i = 0; i < (1 << n); i++) {
		int tmp = 0;
		vector<int>obj(m);
		for (int j = 0; j < n; j++) {
			if ((i >> j) & 1) {
				for (int k = 0; k < m; k++) {
					obj[k] += a[j][k];
				}
				tmp += c[j];
			}
		}
		bool ok = true;
		for (int j = 0; j < m; j++) {
			if (obj[j] < x) {
				ok = false;
				break;
			}
		}
		if (ok)ans = min(ans, tmp);
	}
	if (ans == INF)cout << -1 << endl;
	else {
		cout << ans << endl;
	}
	return 0;
}

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

ll slice_area(ll H, ll W) {
    ll res = H*W;
    if(W <= 2) return res;
    for(ll i = W/3; (i+1)*2 < W; ++i) {
        ll S1 = H*i, S2 = H*(W - 2*i);
        res = min(res, abs(S1 - S2));
    }
    return res;
}

ll T_area(ll H, ll W) {
    ll res = H*W;
    for(ll i = 1; i < W; ++i) {
        ll  S1 = H*i,
            S2 = H/2 * (W - i),
            S3 = (H - H/2)*(W - i);
        ll  mx = max(S1, max(S2, S3)),
            mn = min(S1, min(S2, S3));
        res = min(res, abs(mx - mn));
    }
    return res;
}

int main()
{
    ll H, W;
    cin >> H >> W;
    if(H%3 == 0 || W%3 == 0) { cout << 0 << endl; return 0; }

    ll res = H * W;
    res = min(res, slice_area(H, W));
    res = min(res, slice_area(W, H));
    res = min(res, T_area(H, W));
    res = min(res, T_area(W, H));
    
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    VI x(5);
    rep(i,5){
        cin >> x[i];
    }
    rep(i,5){
        if(x[i]==0){
            cout << i+1 << endl;
            return 0;
        }
    }
}

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

int main() {
  int64_t MOD = 1000000007;
  int N;
  cin >> N;
  int64_t A = 0;
  int64_t B = 0;
  for(int i = 0; i < N; i++) {
    int64_t x;
    cin >> x;
    A += x;
    B += x * x;
    B %= MOD;
  }
  A %= MOD;
  int64_t C = (A * A - B + MOD) % MOD;
  if(C % 2 == 0) {
    cout << C / 2 << endl;
  }
  else {
    cout << (C + MOD) / 2 << endl;
  }
}

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp(a, b) make_pair(a, b)
#define pb push_back

const long long MOD = 1000000007;


int main(){
    ll n;
    cin >> n;
    ll bs[n-1];
    rep(i, n-1){
        cin >> bs[i];
    }

    ll out = bs[0];
    out += bs[n-2];
    rep(i, n-2){
        out += min(bs[i], bs[i+1]);
    }

    cout << out << endl;
    
    return 0;
}


Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define inf 20021225
#define mdn 998244353
#define inv2 499122177
using namespace std;
int read()
{
	int s=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
	return f*s;
}
int f[3010][3010],a,b;
int dfs(int x,int y)
{
	if(x<a||y<b)	return 0;
	if(x==a&&y==b)	return 1;
	if(~f[x][y])	return f[x][y];
	f[x][y]=(1ll*dfs(x,y-1)*x%mdn+1ll*dfs(x-1,y)*y%mdn-1ll*dfs(x-1,y-1)*(x-1)%mdn*(y-1)%mdn+mdn)%mdn;
	return f[x][y];
}
int main()
{
	a=read(),b=read(); memset(f,-1,sizeof(f));
	int c=read(),d=read();
	printf("%d\n",dfs(c,d));
	return 0;
}


Measured memory_bytes: 37332
import numpy as np
H, W = map(int, input().split())
a = []
for i in range(H):
    a_l = input()
    a.append([c for c in a_l])


for i in range(H):
    for j in range(W):
        if a[i][j] == '.':
            a[i][j] = 1
        elif a[i][j] == '#':
            a[i][j] = 0
        else:
            pass
a = np.array(a)
v = []
h = []
for i in range(H):
    if np.sum(a[i,:]) == W:
        h.append(i)
for j in range(W):
    if np.sum(a[:,j]) == H:
        v.append(j)

a_del = np.delete(np.delete(a, v, 1), h, 0)
a_del = list(a_del)

for i in range(len(a_del)):
    for j in range(len(a_del[i])):
        if a_del[i][j] == 1:
            print('.', end='')
        elif a_del[i][j] == 0:
            print('#', end='')
    print('')

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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int a, b, c; cin>>a>>b>>c;
    int MAX=max({a, b, c})*3, sum=a+b+c;
    if((MAX-sum)%2==1){
        cout << (MAX+3-sum)/2 << endl;
    }
    else{
        cout << (MAX-sum)/2 << endl;
    }
}

Measured memory_bytes: 256
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    d = collections.defaultdict(list)
    d["A"]
    d["C"]
    d["G"]
    d["T"]
    mt = 0
    c = 0
    for i in range(len(s)):
        if s[i] in d:
            c += 1
        else:
            c = 0
        mt = max(mt, c)
    print(mt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,k = map(int,input().split())
s = input()

ans = list(s)
ans[k-1] = ans[k-1].lower()

print(*ans,sep="")
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 2940
#![allow(dead_code, unused_imports, deprecated)]
use std::cmp::{max, min, Reverse};

use itertools::Itertools;

use maplit::*;

use proconio::{input, fastout};
use proconio::marker::*;

const INF: usize = 1_000_000_007;

#[fastout]
fn solve() {
  input! {
    x: u64,
  };
  
  let mut res = 0u64;
  let mut d = 100u64;
  while d < x {
    d += d / 100;
    res += 1;
  }

  println!("{}", res);
}

fn main() {
  std::thread::Builder::new()
    .name("big stack size".into())
    .stack_size(32 * 1024 * 1024)
    .spawn(|| {
      solve();
    })
    .unwrap()
    .join()
    .unwrap();
}


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

int main(){
	long long int a,b,x,y,z;
	
	while(cin >> a >> b){
		x=max(a,b);
		y=min(a,b);
		while(1){
			if(y==0) break;
			z=x%y;
			x=y;
			y=z;
		}
		
		cout << x << ' ' << a*b/x << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
def main():
    n = int(input())
    a = [[int(x) for x in input().split()] for _ in range(n)]

    for i in range(n):
        for j in range(n):
            for k in range(n):
                if a[i][j] > a[i][k] + a[k][j]:
                    print(-1)
                    return

    ret = 0
    for i in range(n):
        for j in range(i):
            for k in range(n):
                if k == i or k == j: continue
                if a[i][j] == a[i][k] + a[k][j]: break  # 辺ではない
            else:
                ret += a[i][j]

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 42972
#include <stdio.h>
#define swap(X , Y) {int Z ; Z = Y ; Y = X , X = Z}

int main(void)
{
	double x , y;
	scanf("%lf %lf" , &x , &y);
	int a = x , b = y;
	printf("%d %d %5lf\n" , a / b , a % b , x / y);
	
	return 0;
} 


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

int main(){
    int n, m;
    cin >> n >> m;

    int sum = 0;

    rep(i,m){
        int a;
        cin >> a;
        sum += a;
    }

    if(n-sum<0){
        cout << -1 << endl;
    }
    else{
        cout << n - sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#include <cstring>

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;
const int N = 1e4+5, inf = 1e9+5;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll dp[N][105][2];
int d;
string num;
ll f(int i, int mod, bool lower) {
    if (i == num.size()) return mod == 0;
    if (dp[i][mod][lower] != -1) return dp[i][mod][lower];

    ll ans = 0;
    for (int digit = 0; digit <= (lower ? 9 : num[i]-'0'); ++digit) {
        int need = ((mod-digit)%d+d)%d;
        ans = add(ans, f(i+1, need, lower || digit < num[i]-'0'));
    }
    return dp[i][mod][lower] = ans;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> num >> d;
    memset(dp, -1, sizeof(dp));
    cout << sub(f(0, 0, false), 1) << endl;
    return 0;
}

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


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int k;
    string s;
    cin>>k>>s;
    for(int i=0;i<s.length();i++)
        {if(i>=k)break;cout<<s[i];}
    if(s.length()>k)
        cout<<"...";
return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
    int n,m,k,x,y,good=0;
    cin>>n>>m;
    vector<int> h(n);
    for (int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    vector <vector <int> > g(n);
    for (int i=0;i<m;i++)
    {
        cin>>x>>y;
        g[x-1].push_back(y-1);
        g[y-1].push_back(x-1);
    }
    for (int i=0;i<n;i++)
    {
        if (g[i].size()==0)
        {
            good+=1;
        }
        else{
            k=1;
            for (int j=0;j<g[i].size();j++)
            {
                if (h[i]<=h[g[i][j]])
                {
                    k=0;
                    break;
                }
            }
            if (k==1)good+=1;
        }
    }
    cout<<good;
    return 0;
}

Measured memory_bytes: 8780
#include<iostream>
int main(){
 int a,b;
  scanf("%d %d",&a,&b);
  int add,sub,mul;
  add=a+b;
  sub=a-b;
  mul=a*b;
  if(add>sub){
   if(add>mul)
     printf("%d",add);
    else
     printf("%d",mul);
  }else{
   if(sub>mul)
     printf("%d",sub);
    else
     printf("%d",mul);
  }
  return 0;
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

  public static boolean is_prime(int k) {
    for (int i=2; i*i<=k; i++) 
    if (k%i == 0) return false;
    return k != 1;
  }

  public static void main(String[] args) {
    int i;
    int res = 0;
    Scanner sc = new Scanner(System.in); 
    int n = Integer.parseInt(sc.next());;
    for (i=0; i<n; i++) {
      int a = Integer.parseInt(sc.next());;
      if (is_prime(a)) res++;
    }
    System.out.println(res);
  }
}

Measured memory_bytes: 27772
#include <iostream>

using namespace std;

int main() {
    int S;

    cin >> S;

    int r = S / 100;
    int l = S % 100;
    bool yymm = false, mmyy = false;
    if (r > 0 && r < 13) mmyy = true;
    if (l > 0 && l < 13) yymm = true;
    if (mmyy && yymm) cout << "AMBIGUOUS" << endl;
    else if (mmyy) cout << "MMYY" << endl;
    else if (yymm) cout << "YYMM" << endl;
    else cout << "NA" << endl;
}

Measured memory_bytes: 256
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=(1<<29);
map<ll,bool> mp;
ll n,ans=0;
vector<ll> x;
void dfs(ll k){
  if(k==1){
    return;
  }
  ll a=n;
  while(a>=k){
    if(a%k==0){
      a=a/k;
    }
    else{
      a=a%k;
    }
  }
  if(a==1){
    mp[k]=true;
    ans++;
  }
}
int main(){
  ll i;
  scanf("%lld\n",&n);
  for(i=1;i*i<=n;i++){
    if(n%i==0){
      x.push_back(i);
      if((n/i)!=i){
        x.push_back(n/i);
      }
    }
  }
  for(i=0;i<x.size();i++){
    dfs(x[i]);
  }
  n--;
  for(i=1;i*i<=n;i++){
    if(n%i==0 && mp[i]==false){
      mp[i]=true;
      ans++;
    }
    if(n%i==0 && mp[n/i]==false){
      mp[i]=true;
      ans++;
    }
  }
  printf("%lld\n",ans-1);
  return 0;
}

Measured memory_bytes: 384
def main():
    s = []
    for i in input():
        s.append(i)
    alpha = [chr(i) for i in range(97, 97 + 26)]
    for a in alpha:
        if s.count(a) % 2 != 0:
            print("No")
            return
    print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e6+9;

int main() {
    ios_base::sync_with_stdio(0);
    int a,b,n;
    cin>>n;
    cout<<(n==0)<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n, mn = 0, t = 0, u = 0;
  string s;
  cin >> n >> s;
  for(int i = 1; i < n; i++){
    t += (s[i-1] == 'W') + (s[i] == 'W') - 1;
    u += (s[i] == 'E');
    mn = min(mn, t);
  }
  printf("%d\n", u+mn);
}

Measured memory_bytes: 900
read N X
read L
L=($L)
x=0
ans=0

for D in ${L[@]}; do
    if [ $x -le $X ]; then
        ans=$((ans+1))
    fi
    x=$((x+D))
done
    if [ $x -le $X ]; then
        ans=$((ans+1))
    fi

echo $ans

Measured memory_bytes: 376
n, m = map(int, input().split())
h = list(map(int,input().split()))

graph = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

ans = 0
minus = 0
# print(graph)

for i in range(n):
    height = h[i]
    if graph[i]:
        flg = True
        for j in graph[i]:
            if i == j:
                continue
            if h[j] >= height:
                flg = False
                minus += 1
                break
        if flg is True:
            ans += 1
    else:
        ans += 1
        minus += 1
        continue

print(ans)




Measured memory_bytes: 29572
import java.io.*;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		long ans = 0;
		for (int i = 1; i <= n; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				ans += i;
		}
		System.out.println(ans);
	}
 
	static class Scanner {
 
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 32728
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
#define All(v) (v).begin(),(v).end()
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define REPS(i,n) for(int i = 1; i <= (int)n; i++)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define FORS(i,m,n) for(int i = m; i <= n; i++)
#define INF 2e9
#define F first
#define S second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}speed;

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

int main (){
    int a,b,c;
    cin >> a >> b >> c;
    if((a < c && c < b) || (b < c && c < a)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

const int MAX_V = 1000000;
int prime[MAX_V+1];

void init(){
    int i, k, v;
    for(i=2; i<=MAX_V; i++){
        prime[i] = 1;
    }
    for(i=2; i*i<=MAX_V; i++){
        if(prime[i]){
            for(k=2*i; k<=MAX_V; k+=i){
                prime[k]=0;
            }
        }
    }   
}

int isprime(int n){
    return prime[n];
}

int main(){
    init();
    int num;
    while(scanf("%d", &num) != EOF){
        int count=0;
        for(int i=2; i<=num; i++){
            if(isprime(i)==1)
                count++;
        }
    printf("%d\n", count);
    }
    return 0;
}

Measured memory_bytes: 6632
#include<iostream>

int main() {
  char s;
  std::cin >> s;
  switch(s) {
  case 'A':
    std::cout << 'T' << std::endl;
    break;
  case 'G':
    std::cout << 'C' << std::endl;
    break;
  case 'C':
    std::cout << 'G' << std::endl;
    break;
  case 'T':
    std::cout << 'A' << std::endl;
    break;
  }
}

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

bool isprime(int x){
	if(x == 2) return true;
	if(x < 2 || x % 2 == 0){
		return false;
	}
	
	for(int i = 3; i <= sqrt(x); i+=2){
		if(x % i == 0) return false;
	}
	return true;
}
int main(){
	int n;
	int num;
	int count = 0;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> num;
		if(isprime(num)) count++;
	}
	
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1160
import collections
N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b
A.sort()
B.sort()
N_q, N_mod = divmod(N, 2)
if N_mod == 1:
    ans = B[N_q] - A[N_q] + 1
else:
    ans = B[N_q - 1] - A[N_q - 1] + B[N_q] - A[N_q] + 1
print(ans)

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

using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  bool minus = 0, zero = 0;
  ll ans = 0;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    minus ^= (A[i] < 0);
    zero |= (A[i] == 0);
    ans += abs(A[i]);
  }
  if (!zero && minus)
    ans -=
        2 * abs(*min_element(A.begin(), A.end(), [](const ll& l, const ll& r) {
          return abs(l) < abs(r);
        }));
  cout << ans << endl;
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string s;
    cin>>s;
    //cout<<n<<s;
    deque<char> ans;
    int open = 0;
    int close = 0;
    for(int i=0;i<n;i++) {
        char a = s[i];
        //cout<<a;
        if(a=='(') {
            ans.push_back(a);
            //cout<<a;
            open++;
        }
        else {
            if(open==0) {
                ans.push_front('(');
                open++;
            }
            ans.push_back(a);
            open--;
        }
    }
    for(int i=0;i<open;i++) {
        ans.push_back(')');
    }
    for (deque<char>::iterator it = ans.begin(); it != ans.end(); ++it)
        cout<< *it;
    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define pb push_back
const int N=3005;
int v[N*2],nxt[N*2],point[N],bs;
int ans[N];
LL a[N];
vector<int> vp;
void addedge(int x,int y) {bs++;v[bs]=y;nxt[bs]=point[x];point[x]=bs;}
void dfs(int x)
{
    int p,tp=1;
    for (p=point[x];p;p=nxt[p])
    {
        if (ans[v[p]]==-1) dfs(v[p]);
        tp=min(tp,ans[v[p]]);
    } 
    ans[x]=1-tp;
}
int main()
{
  //  freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
    int i,n;
    scanf("%d",&n);
    for (i=1;i<=n;i++) scanf("%lld",&a[i]);
    for (i=1;i<n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        if (a[x]<a[y]) swap(x,y);
        if (a[x]>a[y]) addedge(x,y);
    }
    for (i=1;i<=n;i++) ans[i]=-1;
    for (i=1;i<=n;i++) if (ans[i]==-1) dfs(i);
    for (i=1;i<=n;i++) if (ans[i]==1) vp.pb(i);
    int tot=vp.size();
    if (!tot) {puts("");return 0;}
    printf("%d",vp[0]);
    for (i=1;i<tot;i++) printf(" %d",vp[i]);
    puts("");
    
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main()
{
	int a = 1, x, y;
	cin >> x >> y;
	string yn[2] = { "Yes","No" };
	if (x == 2 || y == 2) a = 1;
	if (x == 4 || x == 6 || x == 9 || x == 11) {
		if (y == 4 || y == 6 || y == 9 || y == 11) a = 0;
	}
	if (x == 1 || x == 3 || x == 5 || x == 7 | x == 8 || x == 10 || x == 12) {
		if (y == 1 || y == 3 || y == 5 || y == 7 | y == 8 || y == 10 || y == 12) a = 0;
	}
	cout << yn[a] << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] a)throws java.io.IOException{
	Scanner scan=new Scanner(System.in);
	int [][] map = new int[10][10];
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
			map[i][j] =0;
	while(scan.hasNext()){
		String [] strs =scan.nextLine().split(",");
		int x=Integer.parseInt(strs[0]);
		int y=Integer.parseInt(strs[1]);
		int size=Integer.parseInt(strs[2]);
		
		switch (size){
		case 1:{
			int []dx ={0,1,0,-1,0};
			int []dy ={0,0,1,0,-1};
			for(int i=0;i<5;i++){
				int nx =x+dx[i];
				int ny =y +dy[i];
				if(0<=nx&&nx<10&&0<=ny&&ny<10)
					map[ny][nx]++;
			}
		}
			break;
		case 2:{
			for(int i=-1;i<=1;i++){
				for(int j=-1;j<=1;j++){
				int nx =x+j;
				int ny =y +i;
				if(0<=nx&&nx<10&&0<=ny&&ny<10)
					map[ny][nx]++;
				}
			}
			}
		
			break;
		case 3:{
			for(int i=-1;i<=1;i++){
				for(int j=-1;j<=1;j++){
				int nx =x+j;
				int ny =y +i;
				if(0<=nx&&nx<10&&0<=ny&&ny<10)
					map[ny][nx]++;
				}
			}
			int []dx ={2,0,-2,0};
			int []dy ={0,2,0,-2};
			for(int i=0;i<4;i++){
				int nx =x +dx[i];
				int ny =y +dy[i];
					if(0<=nx&&nx<10&&0<=ny&&ny<10)
						map[ny][nx]++;
			}
			}
			
			break;
			}
		
			}
	int max =0;
	int space =0;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			max =Math.max(map[i][j], max);
			if(map[i][j]==0)space++;
		}
	}
	System.out.println(space);
	System.out.println(max);
		}
}

Measured memory_bytes: 12000
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());

        List<Pair> l = new ArrayList<>();
        for (int i = 2; i <= n; i++) {
            l.add(new Pair(1, i));
        }

        int now = (n - 1) * (n - 2) / 2;
        if (now < k) {
            System.out.println("-1");
            return;
        }

        int from = 2;
        int to = 3;

        while (now > k) {
            l.add(new Pair(from, to));
            now--;
            if (to == n) {
                from++;
                to = from + 1;
            } else {
                to++;
            }
        }

        System.out.println(l.size());
        for (Pair p : l) {
            System.out.println(p.u + " " + p.v);
        }
    }

    public static class Pair {
        int u;
        int v;

        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
    }
}


Measured memory_bytes: 26324
N = gets.to_i

alp = (0..25).map { |i| ("a".ord + i).chr }
name = ""
n = N

name = alp[n % 26 - 1]
n = (n - 1).div(26)

while n > 0
  name = alp[n % 26 - 1] + name
  n = (n - 1).div(26)
end
puts name


Measured memory_bytes: 14172
import sys
readline = sys.stdin.readline

S = readline().rstrip()
N = len(S)
DIV = 10 ** 9 + 7

dp = [[0] * 13 for i in range(N)]

x0 = S[0]
if x0 == "?":
  for i in range(10):
    dp[0][i] = 1
else:
  dp[0][int(x0)] = 1
  
for i in range(1, N):
  x = S[i]
  if x == "?":
    for j in range(13):
      for k in range(10):
        dp[i][(j * 10 + k) % 13] += dp[i - 1][j]
        dp[i][(j * 10 + k) % 13] %= DIV
  else:
    for j in range(13):
      dp[i][(j * 10 + int(x)) % 13] += dp[i - 1][j]
      dp[i][(j * 10 + int(x)) % 13] %= DIV

print(dp[-1][5])


Measured memory_bytes: 96248
#include <iostream>
#include <cstring>
using namespace std;
int main(){
    char str[3];
    cin>>str;
    if(strcmp(str,"abc")==0||strcmp(str,"bca")==0||strcmp(str,"cab")==0||strcmp(str,"acb")==0||strcmp(str,"bac")==0||strcmp(str,"cba")==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>

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

    std::set<int> s;
    int Q;
    std::cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int t;
        std::cin >> t;
        if (t == 0) {
            int x;
            std::cin >> x;
            s.insert(x);
            std::cout << s.size() << "\n";
        } else if (t == 1) {
            int x;
            std::cin >> x;
            std::cout << s.count(x) << "\n";
        } else if (t == 2) {
            int x;
            std::cin >> x;
            s.erase(x);
        } else {
            int l, r;
            std::cin >> l >> r;
            auto e = s.upper_bound(r);
            for (auto itr = s.lower_bound(l); itr != e; ++itr) std::cout << *itr << "\n";
        }
    }
}



Measured memory_bytes: 12376
using System;
 
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
        int c = int.Parse(input[2]);
		int ax = a;
      	int bx = b;
        int cx = c;
        a = bx;
      	b = ax;
        ax = a;
        c = ax;
        a = cx;
		Console.WriteLine(a + " " + b + " " + c);
	}
}

Measured memory_bytes: 11092
#include <queue>
#include <vector>
#include <iostream>

using std::cin;
using std::cout;
using std::endl;
using std::queue;
using std::vector;

int main() {
	int n,q;
	cin >> n >> q;
	vector< queue<int> > qv(n);
	while (q--) {
		int op,t,x;
		cin >> op >> t;
		switch (op) {
			case 0:
				cin >> x;
				qv[t].push(x);
				break;
			case 1:
				if (!qv[t].empty()) {
					cout << qv[t].front() << endl;
				}
				break;
			default:
				if (!qv[t].empty()) {
					qv[t].pop();
				}
		}
	}
}


Measured memory_bytes: 4424
#include<stdio.h>

int main(){
  int i,input,fibonacciA=1,fibonacciB=1,fibonacciC=1;
  scanf("%d",&input);
  if(input == 0 || input == 1){
    printf("%d\n",fibonacciA);
  }else{
    for(i=1;i<input;i++){
      fibonacciC = fibonacciB + fibonacciA;
      fibonacciA = fibonacciB;
      fibonacciB = fibonacciC;
    }
    printf("%d\n",fibonacciC);
  }
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;


int main(){
    int a, b, c;
    scan(a, b, c);
    swap(a, b);
    swap(a, c);
    print(a, b, c);
    
    
    
    return 0;
}

Measured memory_bytes: 256
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    // cin>>n;
    string s;
    cin>>s;
    cin>>k;
    string s1="",s2="";
    m=0;
    while(k--)
    {
      int x;
      cin>>x;
      if(x==1) m++;
      else
      {
        int z;
        char c;
        cin>>z>>c;
        if(m&1)
        {
          if(z==1) s2+=c;
          else s1+=c;
        }
        else
        {
          if(z==1) s1+=c;
          else s2+=c;
        }

      }
    }
      // cout<<s<<" "<<s1<<" "<<s2<<el;
      if(m&1){reverse(all(s2));cout<<s2;
      reverse(all(s));cout<<s<<s1;}
      else {reverse(all(s1));cout<<s1;
      cout<<s<<s2;}




  }


  return 0;
}


Measured memory_bytes: 1040
nom,dis = gets.split(" ").map!{|i| i.to_i}
yoko=Array.new(nom)
tate=Array.new(nom)

for i in 0..(nom-1)
  yoko[i],tate[i]= gets.split(" ").map!{|i| i.to_i}
end
kazu=0
for j in 0..(nom-1)
  if dis>=Math.sqrt(yoko[j]**2+tate[j]**2)
    kazu+=1
  end
end
puts kazu


Measured memory_bytes: 17416
// finish date: 2018/01/10
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int fact(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans *= i;
    }
    return ans;
}

int main() {
    int K, S;
    cin >> K >> S;
    int total = 0;
    FOR(i, max(S - K, 0), S + 1) {
        total += max(0,(i<=K)?i+1:2*K-i+1);
    }
    cout << total << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int r, c, a[100][100] = {{}}, sumi[100] = {}, sumj[100] = {}, sumfin = 0;
  cin >> r >> c;
  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
      cin >> a[i][j];
    }
  }

  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
      cout << a[i][j] << " ";
      sumi[i] += a[i][j];
    }
    cout << sumi[i] << endl;
  }

  for(int j = 0; j < c; j++){
    for(int i = 0; i < r; i++){
      sumj[j] += a[i][j];
    }
    cout << sumj[j] << " ";
  }

  for(int i = 0; i < r; i++){
    sumfin += sumi[i];
  }
  cout << sumfin << endl;
}



Measured memory_bytes: 3120
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //b
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i <= n - 3; i++) {
    if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char ans;
        for (int i = 0; s.length() > i; i++) {
            if (i % 2 == 0) {
                System.out.print(s.charAt(i));
            }
        }
        System.out.println("");
    }
}

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

using namespace std;

int
main(void){
	int n = 1e7;
	vector<int> div(n + 1, 0);
	for (long long i = 1; i <= n; ++i)
 		for (long long j = i; j <= n; j += i)
  			++div[j];
  	int num; cin >> num;
  	long long ans = 0;
	for(int i = 1; i <= num; i++){
  		ans += i * 1ll * div[i];
	}
	cout << ans;
}

Measured memory_bytes: 42152
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	n=II()
	A=[II() for _ in range(n)]+[0]


	if A[0]!=0:
		print(-1)
		exit()

	ans=0

	for i,j in zip(A[:-1],A[1:]):
		if j-i>=2:
			print(-1)
			exit()
		elif j-i<=0:
			ans+=i

	print(ans)












if __name__ == "__main__":
	main()


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

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

    int x = -1;
    int y = -1;
    int z = -1;

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N - i; j++) {
            if ( Y == 10000 * i + 5000 * j + 1000 * (N - i - j)) {
                x = i;
                y = j;
                z = N - x - y;
            }
        }
    }


    cout << x << " " << y << " " << z << endl;

    return 0;
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if ((abs(a - b) <= d && abs(c - b) <= d)||abs(a-c)<=d)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 256
<?php
 
fscanf(STDIN, '%d', $n);
 
$a = array();
for ($i = 0; $i < $n; ++$i) {
    fscanf(STDIN, '%s %s', $c, $str);
    if ($c == 'insert') {
        $a[$str] = 1;
    } else {
        if (isset($a[$str])) {
            echo 'yes', PHP_EOL;
        } else {
            echo 'no', PHP_EOL;
        }
    }
}

Measured memory_bytes: 50928
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define range(i,l,h) for(int i=l;i<h;i++)
#define endl '\n'
#define I INT_MAX
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define vt vector
using namespace std;
using std::ios;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;
template<typename T> T power(T a,T b){T r=1;while(b){if(b&1)r*=a;b/=2;a*=a;}return r;}

ll n;
ll dp[2005];

int main()
{
  fastio;
  

  cin>>n;
  memset(dp,0,sizeof dp);

  for(int i=3;i<=n;i++)
    dp[i]=1LL;

  for(int i=3;i<=n;i++)
  {
    for(int j=3;j<=n;j++)
    {
      if(i-j<0)continue;
        dp[i]=dp[i]+dp[i-j];
        dp[i]%=MOD;
    }
  }

  cout<<dp[n];


}
  


Measured memory_bytes: 3640