akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nq = readln.split.to!(int[]);
    auto N = nq[0];
    auto Q = nq[1];
    auto S = readln.chomp;
    char[] ts, ds;
    foreach (_; 0..Q) {
        auto td = readln;
        ts ~= td[0];
        ds ~= td[2];
    }
    int i, j = N-1;
    foreach_reverse (k; 0..Q) {
        auto t = ts[k];
        auto d = ds[k];
        if (d == 'L') {
            if (i < N && S[i] == t) ++i;
            if (j < N-1 && S[j+1] == t) ++j;
        } else {
            if (j >= 0 && S[j] == t) --j;
            if (i > 0 && S[i-1] == t) --i;
        }
    }
    writeln(max(0, j - i + 1));
}

Measured memory_bytes: 4704
// ACM-ICPCアジア地区予選2013 A. Bit String Reordering

#include <iostream>
#include <vector>

using namespace std;

int solve(const vector<int>& _b, const vector<int>& _v, int start){
	int n = _b.size();
	vector<int> b = _b, target;
	for(int i=0;i<_v.size();i++){
		for(int j=0;j<_v[i];j++) target.push_back(start);
		start = 1-start;
	}
	int res = 0;
	for(int i=0;i<n;i++){
		int p = i;
		for(;p<n;p++){
			if(b[p]==target[i]) break;
		}
		if(p == n) return 100000000;
		res += p-i;
		for(int j=p-1;j>=i;j--){
			swap(b[j], b[j+1]);
		}
	}
	return res;
}

int main(){
	int N, M;
	while(cin >> N >> M){
		vector<int> b(N), r(M);
		for(int i=0;i<N;i++) cin >> b[i];
		for(int i=0;i<M;i++) cin >> r[i];
		cout << min(solve(b, r, 0), solve(b, r, 1)) << endl;
	}
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
void dump(){cout<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cout<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

void solve1();void solve2();
int main(){
  solve1();
  return 0;
}

void solve1(){

  int x,y;
  cin>>x>>y;
  ll ans = 0;
  if(x==1&&y==1)ans+=400000;
  if(x==1)ans+=300000;
  if(y==1)ans+=300000;
  if(x==2)ans+=200000;
  if(y==2)ans+=200000;
  if(x==3)ans+=100000;
  if(y==3)ans+=100000;
  cout<<(ans)<<endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
using P = complex<double>;

const double pi = acos(-1);

namespace std {
bool operator<(const P& a, const P& b) {
  return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
}  // namespace std

double cross(const P& a, const P& b) { return imag(conj(a) * b); }
double dot(const P& a, const P& b) { return real(conj(a) * b); }

int ccw(P a, P b, P c) {
  b -= a;
  c -= a;
  if (cross(b, c) > 0) return +1;    // counter clockwise
  if (cross(b, c) < 0) return -1;    // clockwise
  if (dot(b, c) < 0) return +2;      // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line
  return 0;
}

vector<P> convex_hull(vector<P> ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  vector<P> ch(2 * n);
  for (int i = 0; i < n; ch[k++] = ps[i++])  // lower-hull
    while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
  for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--])  // upper-hull
    while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
  ch.resize(k - 1);
  return ch;
}

int main() {
  int N;
  cin >> N;
  vector<P> ps(N);
  map<P, int> id;
  for (int i = 0; i < N; i++) {
    double x, y;
    cin >> x >> y;
    ps[i] = P(x, y);
    id[ps[i]] = i;
  }
  vector<double> res(N, 0);
  vector<P> qs = convex_hull(ps);
  if (qs.size() == 2) {
    for (P p : qs) {
      res[id[p]] = 0.5;
    }
  } else {
    for (int i = 0; i < qs.size(); i++) {
      P pre = qs[(i - 1 + qs.size()) % qs.size()];
      P cur = qs[i];
      P nxt = qs[(i + 1) % qs.size()];
      double a = arg((cur - nxt) / (pre - cur));
      if (a < 0) {
        a += 2 * pi;
      }
      res[id[cur]] = a / 2 / pi;
    }
  }
  for (double x : res) {
    printf("%.10f\n", x);
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1.0e9
#define MOD 1.0e9+7
using namespace std;
typedef long long ll;

int A, B;

int main() {
    cin >> A >> B;
    if (A % 2 == 0 || B % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl; 
    return 0;
}

Measured memory_bytes: 256
# Problem E - Almost Everywhere Zero

# input
N = list(input())
N = list(map(int, N))
K = int(input())

# initialization
dp = [[[0]*4 for i in range(2)] for j in range(len(N)+1)] # dp[keta][smaller][nums]
dp[0][0][0] = 1

# dp
for keta in range(len(N)): # keta loop
    for smaller in range(2): # smaller loop
        limit = 0
        if smaller==0:
            limit = N[keta]
        else:
            limit = 9
        for n in range(limit + 1):
            # not 0 update
            if n==0:
                for x in range(4):
                    dp[keta+1][smaller or n<limit][x] += dp[keta][smaller][x]
            else:
                for x in range(2, -1, -1):
                    dp[keta+1][smaller or n<limit][x+1] += dp[keta][smaller][x]

# output
ans = dp[len(N)][0][K] + dp[len(N)][1][K]
print(ans)


Measured memory_bytes: 3064
a, b, c, d = map(int, input().split())

from fractions import gcd
lcm = c * d // gcd(c, d)
# lcm = int(c * d / gcd(c, d)) #lcm値が微妙に異なるがこちらでも通る？
#print(lcm)

a_num = (a-1)//c + (a-1)//d - (a-1)//lcm
b_num = (b)//c + (b)//d - (b)//lcm

print(b-a+1 - (b_num - a_num))

Measured memory_bytes: 5104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll ans;
ll cnt;
ll n;
ll M=1073741824;
ll p[100005];
ll a[100005];
int main(void){
    cin>>n;
    cin>>a[0];
    if(n==0){
        if(a[0]==1){
            cout<<1<<endl;
        }else{
            cout<<-1<<endl;
        }
        return 0;
    }
    p[0]=1-a[0];
    if(p[0]<=0){
        cout<<-1<<endl;
        return 0;
    }
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i!=n&&p[i-1]*2-a[i]<=0){
            cout<<-1<<endl;
            return 0;
        }
        if(p[i-1]*2-a[i]<=1000000000000000){
            p[i]=p[i-1]*2-a[i];
        }else{
            p[i]=1000000000000000;
        }
    }
    ans=a[n];
    cnt=a[n];
    for(int i=n;i>0;i--){
        if(cnt>p[i-1]){
            if(p[i-1]*2<cnt){
                cout<<-1<<endl;
                return 0;
            }else{
                cnt=p[i-1]+a[i-1];
                ans=ans+cnt;
            }
        }else{
            cnt=cnt+a[i-1];
            ans+=cnt;
        }
        //cout<<i<<" "<<p[i]<<" "<<cnt<<endl;
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 5140
import math
K = int(input())
ans = 0
for i in range(1,K+1,1):
    for j in range(i,K+1,1):
        for k in range(j,K+1,1):
            if i == j and j==k:
                ans = ans + math.gcd(math.gcd(i,j),k)
            elif i == j and j != k:
                ans = ans + 3*math.gcd(math.gcd(i,j),k)
            elif i != j and j == k:
                ans = ans + 3*math.gcd(math.gcd(i,j),k)
            elif i != j and j != k:
                ans = ans + 6*math.gcd(math.gcd(i,j),k)
print(ans)


Measured memory_bytes: 9216
#include <stdio.h>

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

Measured memory_bytes: 2608
#include <bits/stdc++.h>
#define REP(i, n) for (decltype(n) i = 0; i < n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<string> vecstr;
typedef vector<char> vecchar;
typedef vector<bool> vecbool;
typedef vector<vector<bool>> vec2bool;
typedef vector<vector<int>> vec2int;
typedef vector<vector<double>> vec2d;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  string x;
  cin >> x;
  bool ok = false;
  REP(i, x.size()) {
    if (x[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  
  vector<int64_t> poss(0);
  map<int,int> mp;
  
  for(int i=0; i<N; i++){
    if(mp.count(vec.at(i))){
      if(mp[vec.at(i)] == 1){
        poss.push_back(vec.at(i));
        mp[vec.at(i)] = 0;
        continue;
      }
      else{
        mp[vec.at(i)]++;
      }
    }
    else{
      mp[vec.at(i)] = 1;
    }
  }
  
  sort(poss.begin(),poss.end());
  int x = poss.size();
  if(x <= 1){
    cout << 0 << endl;
  }
  else{
  cout << poss.at(x-1) * poss.at(x-2) << endl;
  }
}

Measured memory_bytes: 5376
s=list(input())
l=[0]*4
if "N" in s:
    l[0]=1
if "S" in s:
    l[1]=-1
if "E" in s:
    l[2]=2
if "W" in s:
    l[3]=-2
if sum(l)==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int n,m,X,Y;
  cin >> n >>m >> X >> Y;
  vector<int> x=input(n);
  vector<int> y=input(m);
  
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  int xmax=max(X,x[n-1]),ymin=min(Y,y[0]);
  if(xmax<ymin){
    cout << "No War" << endl;
  }else{
    cout << "War" << endl;
  }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
vector<pair<int,int>> V;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	int lef=(N-1)*(N-2)/2;
	if(K>lef) return _P("-1\n");
	
	for(i=2;i<=N;i++) V.push_back({1,i});
	lef-=K;
	for(x=2;x<=N;x++) for(y=x+1;y<=N;y++) if(lef) {
		lef--;
		V.push_back({x,y});
	}
	
	cout<<V.size()<<endl;
	FORR(v,V) cout<<v.first<<" "<<v.second<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;

const int N = 1e6 + 5;
int main()
{
	sync;
	ll n;
	cin >> n;
	vector<pair<ll, ll> > v(n);
	for(ll i = 0; i < n; i++)
		cin >> v[i].F >> v[i].S;
	ll ans = 0, minm = 1e18, maxm = -1e18;
	for(ll i = 0; i < n; i++)
	{
		minm = min(minm, v[i].F + v[i].S);
		maxm = max(maxm, v[i].F + v[i].S);
	}
	ans = maxm - minm;
	minm = 1e18, maxm = -1e18;
	for(ll i = 0; i < n; i++)
	{
		minm = min(minm, v[i].F - v[i].S);
		maxm = max(maxm, v[i].F - v[i].S);
	}
	ans = max(ans, maxm - minm);
	cout << ans;
}

Measured memory_bytes: 6376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;

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

		String input = br.readLine();

		int inputAngka = Integer.parseInt(input);

		for (int i = 0; i < inputAngka; i++) {
			String inputan = br.readLine();

			String[] arr = inputan.split(" ");

			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			int c = Integer.parseInt(arr[2]);

			int ak = (int) Math.pow(a, 2);
			int bk = (int) Math.pow(b, 2);
			int ck = (int) Math.pow(c, 2);

			if (ak + bk == ck) {
				System.out.println("YES");
			} else if (ak + ck == bk) {
				System.out.println("YES");
			} else if (ck + bk == ak) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}

	}

}

Measured memory_bytes: 20172
def solve():
    N, K = map(int,input().split())
    MOD = 10 ** 9 + 7
    fac, finv, inv = COMinit(N+1,MOD)
    ans = []
    for i in range(1,K+1):
        com1 = COM(K-1,i-1,MOD,fac,finv,inv)
        if N-K-(i-1) < 0:
            ans.append(0)
            continue
        com2 = COM(N-K+1,N-K-(i-1),MOD,fac,finv,inv)
        ans.append(com1*com2%MOD)
    
    print(*ans,sep='\n')

# COMの前処理
# テーブルを作る
# O(n)
def COMinit(N, mod):
    fac = [0] * N
    finv = [0] * N
    inv = [0] * N

    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1

    for i in range(2, N):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    
    return fac, finv, inv

# nCrを計算 前処理としてCOMinitの実行が必要
# O(1)
def COM(n, r, mod, fac, finv, inv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod

if __name__ == '__main__':
    solve()

Measured memory_bytes: 41456
#include<bits/stdc++.h>
using namespace std;
int main(){
    // data loader
    int n;
    cin >> n;
    int h[n];
    for (int i=0;i<n;i++){
        cin>>h[i];
    }
    
    //main
    int ans = 0;
    for(int i=1;i<n;i++){
        if (h[i-1]<h[i]){
            h[i]--;
        }
        if (h[i-1]>h[i]){
            ans=1;
        }
    }
    if (ans==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

typedef long long ll;



using namespace std;

struct three{
    int a,b,c;
    ll ct;
};

ll DENOM=1000000007LL;

bool cnd3(int a, int b, int c){
    if (a==0 && b==1 && c==2 ) return false;
    if (a==0 && b==2 && c==1 ) return false;
    if (a==1 && b==0 && c==2 ) return false;
    return true;
}

bool cnd4(int a, int b, int c, int d){
    if (a==0 && b==1 && c==2 ) return false;
    if (b==0 && c==1 && d==2) return false;
    
    if (a==1 && b==0 && c==2 ) return false;
    if (a==0 && c==1 && d==2) return false;
    
    if (a==0 && b==2 && c==1 ) return false;
    if (b==1 && c==0 && d==2) return false;
    
    if (a==0 && b==1 && d==2) return false;
    if (b==0 && c==2 && d==1) return false;
    return true;
}

int main() {
    int n;
    cin >> n;
    vector<three> bef, aft;
    for (int i=0; i<4;++i){
        for (int j=0; j<4;++j){
            for (int k=0; k<4;++k){
                three p = {i,j,k,0};
                if (cnd3(i,j,k)) p.ct=1;
                bef.push_back(p);
                aft.push_back(p);
            }
        }
    }
    for (int m=3; m<n; ++m){
        for (int i=0; i<aft.size(); ++i){
            aft[i].ct=0;
            if(!cnd3(aft[i].a, aft[i].b, aft[i].c)) continue;
            for(int j=0; j<bef.size(); ++j){
                if( bef[j].b!=aft[i].a || bef[j].c!=aft[i].b ) continue;
                if( cnd4(bef[j].a,bef[j].b,bef[j].c, aft[i].c)){
                    aft[i].ct += bef[j].ct;
                    aft[i].ct = aft[i].ct % DENOM;
                }
            }
        }
        bef = aft;
    }
    ll ret=0LL;
    for (auto it=aft.begin(); it != aft.end(); ++it){
        ret += it->ct;
        ret = ret % DENOM;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
 
int fac[MAX_N], inv[MAX_N];
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b, bool usemod = true) {ll c = 1LL; while (b > 0) {if (b & 1LL) {if(!usemod)c*=a;else c = a * c%mod;}if (!usemod) a*=a;else a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}

class Warshall_Floyd {
public:
	vector<vector<int>> d;
	int nodecnt = -1;

	Warshall_Floyd(int n) {
		d = vector<vector<int>>(n,vector<int>(n,INF));
		nodecnt = n;
	}

	void add(int s,int e,int cost) {
		d[s][e] = cost;
	}

	bool wf() {
		for (int k = 0;k < nodecnt;k++) {
			for (int i = 0;i < nodecnt;i++) {
				for (int j = 0;j < nodecnt;j++) {
					//k経由でi->j
					d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
				}
			}
		}
	}
};

bool solve() {
	int a,b; cin >> a >> b;
	if (a + b >= 10) cout << "error" << endl;
	else cout << a + b << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}

Measured memory_bytes: 256
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])
c = int(arr_data[0][2])


print("Yes" if a<=c and c<=b else "No")
    
    


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    double a,b;
    cin >> a >> b;
    int answer = ceil((a+b)/2);
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    Int n;
    vector<Int> a;
    cin >> n;
    for(Int i=0; i<n; i++){
        cin >> tmpi;
        a.push_back(tmpi);
    }
    sort(a.begin(), a.end());
    Int cnt=0;
    Int sum=0;
    for(Int i=0; i<n; i++){
        if(a[i] > 0){
            sum += a[i];
            continue;
        }
        sum += abs(a[i]);
        a[i] = abs(a[i]);
        cnt++;
    }
    sort(a.begin(), a.end());
    if(cnt%2==1){
        sum -= 2*a[0];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1400
#include<stdio.h>
#include<stdlib.h>

#define MAX 100000
#define ROOT 0
#define INODE 1
#define LEAF 2

struct NODE {
	int parent;
	int sibling;
	short degree;
	short depth;
	int height;
	short type;
	int left;
	int right;
};
typedef struct NODE NODE;

NODE nodes[ MAX+1 ];

void inputDepth( int id )
{
	if( -1 == id ) { return; }
	
	if( -1 != nodes[id].left ) {
		nodes[ nodes[id].left ].depth=nodes[id].depth+1;
		inputDepth( nodes[id].left );
	}

	if( -1 != nodes[id].right ) {
		nodes[ nodes[id].right ].depth=nodes[id].depth+1;
		inputDepth( nodes[id].right  );
	}

}				

int main( void ) 
{   
    int n;
    int id,left,right;
    int i,j,prej;
    char types[3][32] = { "root", "internal node", "leaf" };

	       
    scanf( "%d", &n );
    for( i=0; i<n; i++ ) {
        scanf( "%d%d%d", &id, &left, &right );
       	nodes[id].left=left;
        nodes[id].right=right;
        if( -1 == left && -1 == right ) {
        	nodes[id].type=LEAF;
        	nodes[id].degree=0;
        	nodes[id].height=0;
        } else {
        	if( -1 != left && -1 != right ) {
        		nodes[id].degree=2;
        	} else {
        		nodes[id].degree=1;
        	}
        	
    		if( -1 !=  nodes[id].parent && INODE != nodes[id].type && LEAF != nodes[id].type ) {
    			nodes[id].type=ROOT;
    			nodes[id].parent=-1;
    			nodes[id].sibling=-1;
    		}

    		if(  -1 != left ) {
 		        nodes[left].parent=id;
 		        nodes[left].sibling=right;
 		        if( ROOT == nodes[left].type ) {
 		        	nodes[left].type=INODE;	
 		        } 		
    		}
       		if(  -1 != right ) {
		        nodes[right].parent=id;
		        nodes[right].sibling=left;	
 		        if( ROOT == nodes[right].type ) {
 		        	nodes[right].type=INODE;	
 		        }
    		}
        }
    }
    if( 1 == n ) {
    	nodes[id].parent=-1;
    	nodes[id].sibling=-1;
    	nodes[id].type=ROOT;
        nodes[id].degree=0;
        nodes[id].height=0;
    } else {  

	    for( i=0; i<n; i++ ) {
			if( ROOT == nodes[i].type ) {
				inputDepth( i );
				break;
	    	}
	    }

	    for( i=0; i<n; i++ ) {
	    	if( LEAF == nodes[i].type ) {
	    		j=nodes[i].parent;
	    		prej=i;
	    		while( -1 != j ) {
	    			if( nodes[j].height < nodes[prej].height+1 ) {
	    				nodes[j].height=nodes[prej].height+1;
	    			}
	    			prej=j;
	    			j=nodes[j].parent;
	    		}
	    	}
	    }
    }
    
    for( i=0; i<n; i++ ) {
		printf( "node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", 
				i, nodes[i].parent, nodes[i].sibling, nodes[i].degree, nodes[i].depth, nodes[i].height, types[ nodes[i].type ] );
	}

    return 0;
}

Measured memory_bytes: 600
/* To Kaise Hain Aaplog*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) (x).begin(), (x).end()

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
const ll m = 998244353;
const int sizze = 2 * (1e5) + 10;

vector<int> v[1001];
bool mycompare(pair<int, int> p1, pair<int, int> p2)
{
    if (p1.first != p2.first)
    {
        return p1.first > p2.first;
    }
    else
    {
        return v[p1.second].size() < v[p2.second].size();
    }
}
int main()
{
    //shuru_krte_hai_bina_kisi_bakchodi_ke();

    /* long long yaad se daal de har jagah*/

   string s,t;
   cin>>s>>t;
   ll count = 0;
   for(int i=0;i<s.length();i++){
       if(s[i]!=t[i]){
           count++;
       }
   }
   cout<<count;
    return 0;
}

Measured memory_bytes: 3876
import java.util.*;

public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double x = n / 1.08;
//		System.out.println("" + x);
		double xx1 = Math.floor(x);
        double xx2 = xx1 + 1;
//		System.out.println("" + xx);
		double nn1 = Math.floor(xx1 * 1.08);
		double nn2 = Math.floor(xx2 * 1.08);
//		System.out.println("" + nn);
        if (n == nn1) System.out.println("" + (int)xx1);
        else if (n == nn2) System.out.println("" + (int)xx2);
        else System.out.println(":(");
    }
}

Measured memory_bytes: 22868
import math
A,B,C,X,Y = map(int,input().split())

a = [0,1,2,X-2,X-1,X,abs(X-Y),abs(X-Y+1),abs(X-Y-1)]
b = [0,1,2,Y-2,Y-1,Y,abs(Y-X),abs(Y-X+1),abs(Y-X-1)]
c = [0,1,2,X*2-2,X*2-1,X*2,Y*2-2,Y*2-1,Y*2]
ans = A * X + B * Y
for aa in a:
    for bb in b:
        for cc in c:
            if aa + cc * 0.5 >= X and bb + cc * 0.5 >= Y:
                mny = A * aa + B * bb + C * cc
                if mny < ans:
                    ans = mny
print(ans)

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

int a[256];

int main() {
  int h; cin >> h;
  for (int i = 1; i <= h; i++)
    cin >> a[i];

  for (int i = 1; i <= h; i++) {
    cout << "node " << i;
    cout << ": key = " << a[i];
    if (i != 1) cout << ", parent key = " << a[i/2];
    if (2*i <= h) cout << ", left key = " << a[2*i];
    if (2*i+1 <= h) cout << ", right key = " << a[2*i+1];
    cout << ", " << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

template<class T>
struct SegmentTree{
    using F=function<T(T,T)>;
    const T init;
    const F f;
    int sz;
    vector<T> seg;
    SegmentTree(int n,const T init,const F f):
        init(init),
        f(f)
        {
            sz=1;
            while(sz<n) sz<<=1;
            seg.resize(sz<<1,init);
        }
    // 代入
    void set(int id,T x){
        seg[id+sz]=x;
    }
    // 構築
    void build(){
        for(int k=sz-1;k>0;k--){
            seg[k]=f(seg[2*k],seg[2*k+1]);
        }
    }
    // 更新
    void update(int id){
        while(id>>=1){
            seg[id]=f(seg[2*id],seg[2*id+1]);
        }
    }
    // 置換
    void replace(int id,T x){
        id+=sz;
        seg[id]=x;
        update(id);
    }
    // 加算
    void add(int id,T x){
        id+=sz;
        seg[id]+=x;
        update(id);
    }
    // [l,r)の結果を取得
    T get(int l,int r){
        T L=init,R=init;
        l+=sz,r+=sz;
        for(;l<r;l>>=1,r>>=1){
            if(l&1) L=f(L,seg[l++]);
            if(r&1) R=f(seg[--r],R);
        }
        return f(L,R);
    }
    // debug
    void debug(){
        int i=1;
        for(int r=2;r<=2*sz;r<<=1){
            while(i<r){
                cout<<seg[i++]<<" ";
            }
            cout<<"\n";
        }
    }
};

long long gcd(long long x,long long y){
    return y>0?gcd(y,x%y):x;
}

int main(){
    int n; cin>>n;
    SegmentTree<int> seg(n,0,gcd);
    for(int i=0;i<n;i++){
        int a; cin>>a;
        seg.replace(i,a);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        int l=i>0?seg.get(0,i):0;
        int r=i<n-1?seg.get(i+1,n):0;
        ans=max(ans,(int)gcd(l,r));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define int long long 
#define float long double 
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
signed main(){
	IOS;
	int n ; 
	cin >> n; 
	vector<double>dp(n+1,0.0);
	dp[0]=1.0;
	for(int i=0;i<n;i++){
		double p ;
		cin >> p ;
		for(int coins = i+1; coins >= 0 ;coins--){
			dp[coins] = (coins>0?dp[coins-1]:0)*p + dp[coins]*(1-p);
		}
		debug() << imie(p) imie(range(dp.begin(),dp.end())) ;
	}
	double ans = 0.0;
	for(int i=0;i<=n;i++){
		int heads = n-i;
		if(i>heads) ans+=dp[i];
	}
	cout << fixed << setprecision(10) << ans << endl ;
	return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

S = str(input())

if S[-1] == 's':
    print(S+'es')
else:
    print(S+'s')

Measured memory_bytes: 65236
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repin(a, n)  \
	vector<ll> a(n); \
	rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
	vector<string> a(n); \
	rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
	vector<double> a(n); \
	rep(i, n) { cin >> a[i]; }
#define in(a) \
	ll a;     \
	cin >> a;
#define ins(a) \
	string a;  \
	cin >> a;
#define ind(a) \
	double a;  \
	cin >> a;
template <class T>
inline void out(T a)
{
	cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x) (x).begin(), (x).end()
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
using vell = vector<ll>;
using ves = vector<string>;
using ved = vector<double>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main()
{
	deque<char> s;
	ins(ss);
	rep(i,ss.size()){
		s.push_back(ss[i]);
	}
	in(q);
	bool reverse = false;
	rep(i, q)
	{
		in(t);
		if (t == 1)
		{
			reverse = !reverse;
		}
		else
		{
			in(f);
			ins(c);
			if (f == 1)
			{
				if (reverse)
				{
					s.push_back(c[0]);
				}else{
					s.push_front(c[0]);
				}
			}
			else
			{
				if (reverse)
				{
					s.push_front(c[0]);
				}else{
					s.push_back(c[0]);
				}
			}
		}
	}

	if(reverse){
		for(auto it = s.rbegin();it!=s.rend();it++){
			cout << (*it);
		}
	}else{
		for(auto it = s.begin();it!=s.end();it++){
			cout << (*it);
		}
	}
	cout << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;

int H, W;
string a[105];

signed main()
{
    cin >> H >> W;
    REP(i,H) cin >> a[i];

    REP(i,W+2) cout << '#';
    cout << endl;
    REP(i,H) cout << '#' << a[i] << '#' << endl;
    REP(i,W+2) cout << '#';
    cout << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws IOException {
	    	Scanner in = new Scanner(System.in);
	    	
	    	while(in.hasNextInt()) {
	    		int a = in.nextInt();
	    		int b = in.nextInt();
	    		a += b;
	    		int numDigit = String.valueOf(a).length();
	    		System.out.println(numDigit);
	    	}
    }
}

Measured memory_bytes: 20408
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')
 
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = input()

for i in range(3):
    if N[i] == '7':
        print('Yes')
        break
else:
    print('No')

Measured memory_bytes: 10492
#include <stdio.h>
typedef struct {
  int pm;
  int pe;
  int pj;
  int rank;
}set;

  int main(){
  set student[10000];
  int i ,n;
  while( scanf( "%d" ,&n ) != EOF ){
    if( n == 0 ){
      break;
    }

    for( i=0 ; i<n ; i++ ){
      scanf( "%d %d %d" ,&student[i].pm ,&student[i].pe ,&student[i].pj );
      
      if( student[i].pm == 100 || student[i].pe == 100 || student[i].pj == 100 ){
	student[i].rank = 1;
      }  /* 100点があったらクラスはA */
      
      else if( (student[i].pm + student[i].pe) / 2 >= 90 ){
	student[i].rank = 1;
      }  /* 数学と英語の平均点が90を超えたらクラスはA */
      
      else if( ( student[i].pm + student[i].pe + student[i].pj ) / 3 >= 80 ){
	student[i].rank = 1;
      }  /* ３教科の平均が80を超えたらクラスはA */
      
      else if( ( student[i].pm + student[i].pe + student[i].pj ) / 3 >= 70 ){
	student[i].rank = 2;
      }  /* ３教科の平均が70を超えたらクラスはB */
      
      else if(  ( student[i].pm + student[i].pe + student[i].pj ) / 3 >= 50 && student[i].pm >= 80 || student[i].pe >= 80 ){
	student[i].rank = 2;
      }  /* 3教科の平均が50を越え、数学か英語が80以上ならクラスはB */
      
      else{
	student[i].rank = 3;
      }  /* その他の場合のクラスはC */
      
    }
    
    for( i=0 ; i<n ; i++ ){
      
      if( student[i].rank == 1 ){
	printf( "A\n" );
      }
      if( student[i].rank == 2 ){
	printf( "B\n" );
      }
      
      if( student[i].rank == 3 ){
	printf( "C\n" );
      }
      
    }

  }

  return 0;
}

Measured memory_bytes: 588
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


mod = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = [0]*N
B = [0]*N
# 日数別にもらえる額を管理
# money = defaultdict(list)
keys = list(range(1, 1+10**5))
# print(keys)
values = [[] for i in range(1, 1+10**5)]
job = dict(zip(keys, values))
for i in range(N):
    a, b = map(int, input().split())
    job[a].append(-b)
    # A[i], B[i] = a, b
# A日後にB円もらえる、M日後に報酬最大化
ans = 0
can_work = []
heapq.heapify(can_work)
for delay in range(1, 1+M):
    for item in job[delay]:
        heapq.heappush(can_work, item)
    # print('delay', delay)
    # print(job)
    if (len(can_work) != 0):
        ans -= heapq.heappop(can_work)

    # for i in range(delay):
    #     print(delay-i)
    #     if len(jpb[delay-i]) != 0:
    #         print('found')
    #         max_money = max(jpb[delay-i])
    #         ans += max_money
    #         jpb[delay-i].remove(max_money)
    #         jpb[delay-i]
    #         break
    #     print('===========')
print(ans)


Measured memory_bytes: 38472
n,k = map(int,input().split())
data = []
d = dict()
for i in range(n):
    a,b = map(int,input().split())
    if d.__contains__(a):
        d[a]+=b
    else:
        d[a] = b
data = list(d.items())
data.sort()

rank = 1

for x,cnt in data:
    if rank<=k and k<rank+cnt:
        print(x)
        break
    else:
        rank+=cnt



Measured memory_bytes: 14556
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[2000];

		for(int i = 0 ; i < n ; i++){
			l[i] = sc.nextInt();
		}
		for(int i = n ; i < 2000 ; i++){
			l[i] = 10000;
		}

		Arrays.sort(l);

		int ans = 0;

		for(int i = 0 ; i < n-2 ; i++){
			for(int j = i+1 ; j < n-1 ; j++){
				for(int k = j+1 ; (k < n) && (l[k] < l[i] + l[j]) ; k++){
					if(	(l[i] < l[j] + l[k]) &&
						(l[j] < l[k] + l[i])){
							ans++;
					}
				}
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 26208
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

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

int main()
{
	int ans=0,z,k,s;
	cin >> k >> s;

	REP(i,k+1){
		REP(j,k+1){
			z = s - i - j;
			if(z<=k && z>=0)++ans;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let b: Vec<usize> = sc.vec(n);

    let mut aa = a.clone();
    aa.sort();
    let mut bb = b.clone();
    bb.sort();
    for i in 0..n {
        if aa[i] > bb[i] {
            println!("No");
            return;
        }
    }

    let mut ab: Vec<_> = a.into_iter().zip(b).collect();
    ab.sort_by_key(|&(_, b)| b);

    let mut ai: Vec<_> = ab.iter().enumerate().map(|(i, &(a, _))| (a, i)).collect();
    ai.sort();
    let mut vis = vec![false; n];
    vis[0] = true;
    let mut cur = ai[0].1;
    while cur != 0 {
        vis[cur] = true;
        cur = ai[cur].1;
    }

    if vis.contains(&false) {
        println!("Yes");
        return;
    }

    for i in 1..n {
        let a1 = ai[i - 1].0;
        let a2 = ai[i].0;
        let b1 = ab[i - 1].1;
        let b2 = ab[i].1;
        assert!(a1 <= b1);
        assert!(a2 <= b2);
        if a2 <= b1 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 11412
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
		int B = sc.nextInt();

		int ans = Math.max(A + B, A - B);

		ans = Math.max(ans, A * B);

		System.out.println(ans);


	}
}

Measured memory_bytes: 22996
#include <stdio.h>
#include <stdlib.h>

int roopCount(int days, int up) {
    int cnt = 0;
    for (int i = 0; i < days; i += up) cnt++;
    return cnt;
}

int main() {
    int num;
    scanf("%d", &num);

    int days, r;
    scanf("%d %d", &days, &r);

    int *span;
    span = malloc(sizeof(int) * num + 1);
    for (int i = 0; i < num; i++) scanf("%d", &span[i]);

    int entity = 0;
    for (int i = 0; i < num; i++) entity += roopCount(days, span[i]);

    printf("%d\n", entity + r);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define oo 1000000000
#define mod 1000000007

int main(){
    string s;
    cin >> s;
    int cur = 15 - (int)s.size();
    for(int i = 0 ;i < (int)s.size();i++){
        if(s[i] == 'o')
            cur++;
    }
    if(cur >= 8)
        puts("YES");
    else
        puts("NO");
    return 0;
}

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

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int N,ans;
	ans = 0;
	cin >> N;
	char S;
	for (int i = 0; i < N; i++) {
		cin >> S;
		if (S == 'Y')ans = 1;
	}

	if (ans == 1)cout << "Four" << endl;
	else cout << "Three" << endl;

}

Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
ans = 0
dic = {'0':0}
us = list(set(s))
for i in us:
    tmp = s.count(i) - t.count(i)
    dic['{}'.format(i)] = tmp
print(max(dic.values()))

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
  
int main(){
double x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
cout<<fixed<<setprecision(10)<<sqrt(pow((x2-x1),2)+pow((y2-y1),2))<<endl;
return 0;
}



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


bool chk(string a , string b){
  for(int i=0;i<a.size();i++){
     if(a[i]!='?' &&a[i]!=b[i]) return false;
   }
   return true;
}

string rtn(string a ,string s, int idx){
string b(a);
 for(int i=0;i<a.size();i++){
     if(a[i]=='?') {
          if(idx<=i && i<idx+s.size()) { b[i]=s[i-idx]; }else{  b[i]='a'; }
    }
   }
   return b;
}

int main(){

string S,T;
 cin>>S>>T;
int a=S.size();
int b=T.size();

for(int i=a-b;i>=0;i--){
string s=S.substr(i,b);
if(chk(s,T)) {
    cout<< rtn(S,T,i);
    return 0;
}
}

cout<<"UNRESTORABLE";
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<iomanip>
#include<map>
using namespace std;
typedef pair<int, pair<int, int> >PP;
typedef long long ll;
typedef pair<int, int>P;
typedef vector<int>vec;
int inf=-1;
ll mod = pow(10, 9) + 7;

long long gcd(long long a, long long b) {
	long long old_a, old_b;
	while (b != 0) {
		old_a = a;
		a = b;
		old_b = b;
		b = old_a % b;
	}
	return old_b;
}

int main(){
    ll a,b;cin>>a>>b;
    ll g=gcd(a,b);
    ll ans=0;
    vector<ll>k;
    for(int i=1;i<=sqrt(g);i++){
        if(g%i==0){
            k.push_back(i);
            k.push_back(g/i);
        }
    }
    sort(k.begin(),k.end());
    k.erase(unique(k.begin(),k.end()),k.end());
    for(int i=0;i<k.size();i++){
        bool flag=true;
        for(int j=2;j<=sqrt(k[i]);j++){
            if(k[i]%j==0){
                flag=false;
                break;
            }
        }
        if(flag){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int Ull;
typedef pair<int ,int> PII;
template <typename T>
inline T  read()
{
    char c=getchar();
    T x=0,f=1;
    while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
    while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
template <typename T>
inline void write(T x) 
{
    if(x < 0) x = (~x) + 1, putchar('-');
    if(x / 10) write(x / 10);
    putchar(x % 10 | 48);
}
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;
ll f(int x){
    ll ans = 0;
    for(int i = 1; i <= 110; i++){
        for(int j = i; j <= 110; j++){
            for(int s = j; s <= 110; s++){
                if(i*i+j*j+s*s+i*j+i*s+j*s == x){
                    if(i == j && j == s) ans += 1;
                    else if(i == j || j == s) ans += 3;
                    else ans += 6;
                }
                if(s*s > x) break;
            }
            if(j*j > x) break;
        }
        if(i*i > x) break;
    }
    return ans;
}
int main(){
    //ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    
    int n = read<int>();
    for(int i = 1; i <= n; i++){
        cout<<f(i)<<endl;
    }
} 



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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    string s; cin>>s;

    REP(i,3){
        if(s[i] == s[i+1]){
            cout << "Bad" << endl;
            return;
        }
    }
    cout << "Good" << endl;

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256