akhauriyash/Code-Regression huggingface dataset:
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int N,K; cin>>N>>K;
  vi P(N); REP(i,N) cin>>P[i];

  vi sum(N, 0);
  sum[0] = P[0];
  FOR(i,1,N) sum[i] += sum[i-1] + P[i];

  int l=0;
  int span = sum[K-1];
  FOR(i,1,N-K+1) {
    int nspan = sum[i+K-1] - sum[i-1];
    if (nspan > span) {
      l = i;
      span = nspan;
    }
  }

  // 期待値を計算
  double ex = 0;
  FOR(i,l,l+K) {
    ex += (1+P[i])/2.0;
  }
  printf("%.12f\n", ex);


  return 0;
}


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

int n, k;
int cnt[2005][2005][2] = {0};

long long solve();

int main() {
  cin >> n >> k;
  for(int i = 0; i < n; ++i) {
    int x, y, now = 0;
    char c;
    cin >> x >> y >> c;
    now = ((c == 'B') + y / k + x / k) % 2;
    ++cnt[x % k][y % k][now];
  }
  for(int t = 0; t < 2; ++t)
    for(int i = 0; i < k; ++i)
      for(int j = 0; j < k; ++j) {
        if(i != 0) cnt[i][j][t] += cnt[i - 1][j][t];
        if(j != 0) cnt[i][j][t] += cnt[i][j - 1][t];
        if(i != 0 && j != 0)
          cnt[i][j][t] -= cnt[i - 1][j - 1][t];
      }
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int t = 0; t < 2; ++t)
    for(int i = 0; i < k; ++i)
      for(int j = 0; j < k; ++j) {
        long long now = 0;
        now += cnt[k - 1][k - 1][t] + 2 * cnt[i][j][t];
        now -= cnt[i][k - 1][t] + cnt[k - 1][j][t];
        now += cnt[i][k - 1][1 - t] + cnt[k - 1][j][1 - t];
        now -= 2 * cnt[i][j][1 - t];
        ans = max(ans, now);
      }
  return ans;
}

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

int main(int argc, const char * argv[]) {
    int a,b;
    cin >> a;
    cin >> b;
    if(a > 8 || b > 8){
        cout << ":(";
        return 0;
    }
    cout << "Yay!";
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "No";
		if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) result = "Yes";
		
		// 出力
		System.out.println(result);
	}
}



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

int main() {
	int N;
	cin >> N;
	set<string> A;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		A.insert(s);
	}
	cout << A.size() << endl;
}

Measured memory_bytes: 19200
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1<<20;
void solve() {
	int n;
	cin >> n;
	vector<ll> a(n);
	for(auto &i : a) cin >> i;
	string s;
	cin >> s;
	vector<ll> basis;
	for(int i = n; i--;) {
		ll x = a[i];
		for(auto j : basis) x = min(x, x^j);
		if(s[i] == '0')	{
			if(x) basis.push_back(x);
		} else if(x) {
			cout << "1\n";
			return;
		}
	}
	cout << "0\n";
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	int t;
	cin >> t;
	while(t--) solve();
}


Measured memory_bytes: 3584
#include <iostream>
int N, K;
int h[(int)1e5 + 1];
int memo[(int)1e5 + 1];
int dp(int i);

using namespace std;
int main(void) {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> h[i];
		memo[i] = -1;
	}
	memo[0] = 0;
	int ans = dp(N - 1);

	cout << ans << endl;
	return 0;
}

int dp(int i){
	if (memo[i] != -1) {
		return memo[i];
	}
	int min = (int) 1e9;
	for (int j = 1; j <= K && j <= i; j++) {
		int cost = dp(i - j) + abs(h[i] - h[i - j]);
		if (min > cost) {
			min = cost;
		}
	}
	memo[i] = min;
	return min;
}


Measured memory_bytes: 5760
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
int main()
{
 
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
     //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,r = 0,b = 0,g  = 0,tc = 0,c = 0;
    string s;
    cin >> n;
    cin >> s;
    set <int>sp;
    for (int i = 0; i < n; ++i)
    {
      if(s[i] == 'R')
        r++;
      if(s[i] == 'G')
        g++;
      if(s[i] == 'B')
        b++; 
    }
    tc = r*b*g;
    for (int i = 0; i < n; ++i)
    {
      for (int j = i+1; j < n; ++j)
      {
        if(j+(j-i) < n && j > i )
        {
          if (s[i] != s[j] && s[i] != s[j+(j-i)] && s[j] != s[j+(j-i)])
          {
            c++;
          }
        }
      }
    }
    cout << tc-c;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;

int main() {
  ll N, K, min = 1000000001;
  cin >> N >> K;
  vector<ll> h(N);
  for(ll i = 0; i < N; i++) cin >> h.at(i);
  
  sort(h.begin(), h.end());
  
  for(ll i = 0; i < N - K + 1; i++) {
    if(min >= h.at(i + K - 1) - h.at(i)) min =  h.at(i + K - 1) - h.at(i);
  }
  
  cout << min << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long/*--------------------*/ll;
typedef long double/*------------------*/ld;
typedef unsigned long long/*-----------*/ull;
typedef pair<ll, ll >/*----------------*/pll;
typedef std::vector<pll >/*------------*/vpll;
 
#define rep(i,a)/*---------------------*/for(i = 0 ; i < a ; i++)
#define repr(i,a)/*--------------------*/for(i = a ; i >= 0 ; i--)
#define REP(i,a,b)/*-------------------*/for(i = a ; i <= b ; i++)
#define REPR(i,a,b)/*------------------*/for(i = a ; i >= b ; i--)
 
#define YES/*--------------------------*/cout << "YES" << endl
#define NO/*---------------------------*/cout << "NO" << endl
 
#define lb/*---------------------------*/lower_bound
#define ub/*---------------------------*/upper_bound
#define pb/*---------------------------*/push_back
#define popb/*-------------------------*/pop_back
#define mem(a,b)/*---------------------*/memset(a,b,sizeof(a))
#define sz/*---------------------------*/size()
#define mpp/*--------------------------*/make_pair
#define bs/*---------------------------*/binary_search
#define gcd(a, b)/*--------------------*/__gcd(a, b)
#define lcm(a, b)/*--------------------*/((a)*((b)/gcd(a,b)))
#define sqr(x)/*-----------------------*/(x)*(x)
#define all(a)/*-----------------------*/a.begin(),a.end()
 
#define ff/*---------------------------*/first
#define ss/*---------------------------*/second
 
#define endl/*-------------------------*/'\n'
#define inf/*--------------------------*/(ll)2e15
#define MOD/*--------------------------*/(ll)1000000007
 
void solve();
void boost()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	boost();
	ll t,i;
	t = 1;
    //cin >> t;
	REP(i,1,t)
	{
       //cout << "Case "<< i << ": ";
       solve();
	}
	return 0;
}
 
void solve()
{
    ll n,k;
    cin >> n >> k;
    ll ans = 1LL;
    while(n--)
    {
        ans = min(ans*2LL,ans + k);
    }
    cout << ans << endl;
}

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

//#define rep(i, n)     for(auto i = 0; i != n; ++i)
#define REP(i, k, n)  for(auto i = k; i != n; ++i)
//#define rrep(i, n)    for(auto i = n; i != 0; --i)
#define RREP(i, n, k) for(auto i = n; i != k; --i)

#define debug(x) cerr << #x << " " << x << endl
#define spc << " " <<

#define mp make_pair
#define mt make_tuple

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<typename T>using V = vector<T>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

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

    int N, M; cin >> N >> M;
    V<ll> num(N+1, 0);
    Vi places(M+1, 0); REP(i, 1, M+1) cin >> places[i];

    REP(i, 1, M) {
        int left = min(places[i], places[i+1]);
        int right = max(places[i], places[i+1]);
        REP(j, left, right) ++num[j];
    }

    ll total = 0;
    REP(i, 1, N) {
        int A, B, C; cin >> A >> B >> C;
        total += min(A*num[i], B*num[i] +C);
    }

    cout << total << endl;

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
// g[pos][type] -> vi
unordered_map<int,vi> g[125252];
unordered_set<int> colors[125252];
unordered_map<int,int> dist[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int p,q,c;
    scanf("%d%d%d",&p,&q,&c);
    --p;--q;
    g[p][c].push_back(q);
    g[q][c].push_back(p);
    colors[p].insert(c);
    colors[q].insert(c);
  }
  // dist,pos,company
  deque<pair<int,pii>> Q;
  const int NICO = 830252521;
  Q.push_back(make_pair(0,pii(0,NICO)));
  dist[0][NICO] = 0;
  while(!Q.empty()){
    pair<int,pii> P = Q.front(); Q.pop_front();
    int d = P.first;
    int p = P.second.first;
    int c = P.second.second;
    if(c==NICO){
      // get train
      for(const int& com:colors[p]){
        if(dist[p].count(com)!=0 && d+1>=dist[p][com])continue;
        dist[p][com] = d+1;
        Q.push_back(make_pair(d+1,pii(p,com)));
      }
    }else{
      // continue train or ride off
      for(const int& to:g[p][c]){
        if(dist[to].count(c)!=0 && d>=dist[to][c])continue;
        dist[to][c] = d;
        Q.push_front(make_pair(d,pii(to,c)));
      }
      if(dist[p].count(NICO)==0 || d<dist[p][NICO]){
        dist[p][NICO] = d;
        Q.push_front(make_pair(d,pii(p,NICO)));
        if(p==n-1){
          Q.clear();
          break;
        }
      }
    }
  }
  if(dist[n-1].count(NICO)==0){
    dist[n-1][NICO] = -1;
  }
  printf("%d\n",dist[n-1][NICO]);
  return 0;
}


Measured memory_bytes: 97664
// template {{{
#include <bits/stdc++.h>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"

using ld = long double;
using ll = long long;

inline ll addm(ll __a, ll __b, ll __m);
inline ll subm(ll __a, ll __b, ll __m);
inline ll mulm(ll __a, ll __b, ll __m);
ll powm(ll __a, ll __b, ll __m);
ll inv(ll __x, ll __m);
// }}}

const ll INFL = numeric_limits<ll>::max() / 2;
const ll INF = numeric_limits<int>::max() / 2;
const ll MOD = 1e9+7;

const int N = 22;

ll a[N][N];
ll dp[N][1<<N];

void solve()
{
    int n; cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];

    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int m = 0; m < (1<<n); m++)
            dp[i][m] %= MOD;
        for (int j = 0; j < n; j++) {
            if (!a[i][j]) continue;
            for (int m = 0; m < (1<<n); m++) {
                if (!(m&(1<<j)))
                    dp[i+1][m|(1<<j)] += dp[i][m];
            }
        }
    }
    cout << dp[n][(1<<n)-1] % MOD << endl;
}

// main {{{
int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}

inline ll addm(ll __a, ll __b, ll __m = MOD) {
    return ((__a+__b)%__m);
}
inline ll subm(ll __a, ll __b, ll __m = MOD) {
    return (((__a-__b)%__m+__m)%__m);
}
inline ll mulm(ll __a, ll __b, ll __m = MOD) {
    return ((__a*__b)%__m);
}
ll powm(ll __a, ll __b, ll __m = MOD) {
    ll ret = (!__b) ? 1 : powm(__a, __b/2, __m);
    return (!__b) ? 1 : mulm(mulm(ret, ret, __m), (__b%2) ? __a : 1, __m);
}
ll inv(ll __x, ll __m = MOD) {
    return powm(__x, __m-2, __m);
}
// }}}


Measured memory_bytes: 405760
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 1e18;
const ll fact_table = 800008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
// priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
// #define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
 
// ll mod = 998244353;
 ll mod = 1000000007;
  
ll mypow(ll number1,ll number2, ll mod){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5];
 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,a,b,d,e,h,r,l,q;
ll w, ans;
ll k;
ll x[500005], y[500005], z[500005];
char s[500005], t[500005];

int main(){
    cin >> n >> m;
    if(n >= 10){
        ans = m;
    }else{
        ans = m + 1000 - 100 * n;
    }
    p(ans);
    return 0;

}


















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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 x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  ll a,v,b,w,t;
  cin >> a>>v>>b>>w>>t;

  if(v<=w) cout << "NO" << endl;

  else cout << ((v-w)*t>=abs(a-b)?"YES":"NO") << endl;       
}


Measured memory_bytes: 3624
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
    
    io
    
    ll n;
    cin>>n;
    string x;
    cin>>x;
    ll s=0;
    std::vector<ll> pos1,pos2,pos3;
    rep(i,0,n)
    {
        if(x[i]=='R')
        {
            pos1.pb(i);
        }
        if(x[i]=='G')
        {
            pos2.pb(i);
        }
        if(x[i]=='B')
        {
            pos3.pb(i);
        }
    }
    rep(i,0,n)
    {
        rep(j,i+1,n)
        {
            if(x[i]==x[j])
                continue;
            ll len=(j-i);
            if(x[i]!='R' && x[j]!='R')
            {
                ll zz=lower_bound(all(pos1),j+1)-pos1.begin();
                s+=(pos1.size()-zz);
                if(binary_search(all(pos1),j+len))
                    s--;
            }
            if(x[i]!='G' && x[j]!='G')
            {
                ll zz=lower_bound(all(pos2),j+1)-pos2.begin();
                s+=(pos2.size()-zz);
                if(binary_search(all(pos2),j+len))
                    s--;
            }
            if(x[i]!='B' && x[j]!='B')
            {
                ll zz=lower_bound(all(pos3),j+1)-pos3.begin();
                s+=(pos3.size()-zz);
                if(binary_search(all(pos3),j+len))
                    s--;
            }
        }
    }

    cout<<s;
}

Measured memory_bytes: 3696
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

		int set, outcount, runs, first, second, third;
		String event;
		List<Integer> list = new ArrayList<Integer>();

		set = Integer.parseInt(bufferedReader.readLine());

		for(int i = 0; i < set; i++){
			outcount = runs = first = second = third = 0;
			while (outcount < 3) {
				event = bufferedReader.readLine();
				if (event.equals("HIT")){
					if(third == 1){
						third = 0;
						runs++;
					}
					if(second == 1){
						second = 0;
						third = 1;
					}
					if(first == 1){
						first = 0;
						second = 1;
					}
					first = 1;
				}else if(event.equals("HOMERUN")){
					runs += (first + second + third + 1);
					first = second = third = 0;
				}else if(event.equals("OUT")){
					outcount++;
				}
			}
			list.add(runs);
		}
		for(int value : list) System.out.println(value);
	}
}

Measured memory_bytes: 9056
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if((abs(a-b)<=d)&&(abs(b-c)<=d)) cout<<"Yes";
  else if(abs(a-c)<=d) cout<<"Yes";
  else cout<<"No";
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int k,x;cin>>k>>x;
    if(x<=k*500)cout<<"Yes"<<nnn;
    else cout<<"No"<<nnn;
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	int N;
	ll K;
	cin >> N >> K;
	const ll mod = 1000000007;
	vector<int> A(N);
	ll ans = 0;
	for(int i = 0; i < N; i++) cin >> A[i];
	for(int i = 0; i < N-1; i++) {
		for(int j = i+1; j < N; j++) {
			if(A[i] > A[j]) {
				ans += K*(K+1) / 2LL;
				ans %= mod;
			}
			else if(A[i] < A[j]) {
				ans += K*(K-1) / 2LL;
				ans %= mod;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
// cf IO: I64d
// atcoder IO: ｌｌｄ
const int Maxn=200005;
int vis[Maxn];
int loc[Maxn];
int a[Maxn];
int ept;
void A(int x){
	if (loc[x]<=0){
		loc[x]--;
		return;
	}
	vis[loc[x]]++;
	if (vis[loc[x]]==1) ept--;
	loc[x]--;
}
void E(int x){
	loc[x]++;
	if (loc[x]<=0){
		//loc[x]++;
		return;
	}
	///cout<<loc[x]<<endl;
	vis[loc[x]]--;
	if (vis[loc[x]]==0) ept++;
	
}
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	ept=n;
	for (int i=1;i<=n;i++){
		loc[i]=i;
	}
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		A(a[i]);
	}
	for (int i=0;i<m;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		E(a[x]);
		//printf("%d\n",a[x])
		;a[x]=y;
		A(a[x]);
		//for (int j=1;j<=n;j++) cout<<loc[j]<<' ';
		//cout<<endl;
		printf("%d\n",ept);
	}
	return 0;
}
/*
4 5
1 1 1 2
4 1
1 2
3 3
2 4
2 3
*/

Measured memory_bytes: 3840
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
using namespace std;
using ll = long long;
using Lf = long double;
using plong = pair<ll,ll>;
const int mod = 1000000007;

 
bool cmp(plong p1,plong p2){
    return p1.second<p2.second;
}
 
int main(){
    ll N;
    cin>>N;
    vector<plong> p(N);
    for(auto i=0;i<N;i++){
        cin>>p[i].first>>p[i].second;
    }
    sort(p.begin(),p.end(),cmp);
    ll now_t=0;
    for(auto i=0;i<N;i++){
        now_t += p[i].first;
        if(p[i].second<now_t){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int w=0, e=0, count=n, c;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'E') e++;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == 'W') {
      c = e + w;
      w++;
    }
    else {
      c = e + w - 1;
      e--;
    }
    if (c < count)
      count = c;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 900
H, W = map(int, input().split())
a = []
for _ in range(H):
    a.append(list(map(int, input().split())))

ans = []

i = 0
flag = False

while i < H * W:
    row = i // W
    if row % 2 == 0:
        col = i % W
    else:
        col = W - i % W - 1

    if a[row][col] % 2 == 1 and flag == False:
        flag = True
    elif a[row][col] % 2 == 1 and flag == True:
        flag = False

    if flag == True:
        j = i + 1
        if j == H * W:
            break
        row_ = j // W
        if row_ % 2 == 0:
            col_ = j % W
        else:
            col_ = W - j % W - 1
        ans.append(str(row+1)+' '+str(col+1)+' '+str(row_+1)+' '+str(col_+1))

    i += 1

print(len(ans))
for an in ans:
    print(an)

Measured memory_bytes: 16472
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int f=max(a,b);
	int y=min(a,b);
	f-=1;
	int o=max(f,y);
	cout<<o+max(a,b)<<endl;
	return 0;
}

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

namespace ITP1_10_B
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line = ReadIntAr();
            double rad = line[2] * Math.PI / 180;
            double a = line[0];
            double b = line[1];

            double h = b * Math.Sin(rad);
            double c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2) - 2 * a * b * Math.Cos(rad));

            Console.WriteLine("{0}", a * h / 2);
            Console.WriteLine("{0}", a + b + c);
            Console.WriteLine(h);
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 16052
n,x,m=map(int,input().split())
a=list()
ans=0
s=n
for i in range(n):
    ans+=x
    a.append(x)
    x=(x**2)%m
    if x in a:
        s=a.index(x)
        break

sum=0
if s!=n:
    for i in range(s, len(a)):
        sum+=a[i]   

if len(a)>s:
    ans+=sum*(((n-s)//(len(a)-s))-1)

    z=(n-s)%(len(a)-s)
    if z!=0:
        for i in range(z):
            ans+=a[s+i]
print(ans)


Measured memory_bytes: 70468
#include <stdio.h>

int main(void)
{
    int a, b, c, d;
    int p;
    int pa, pb;

    scanf("%d %d %d %d", &a, &b, &c, &d);
    scanf("%d", &p);

    pa = a * p;
    pb = b + (c < p ? d * (p - c) : 0);
    printf("%d\n", pa < pb ? pa : pb);

    return 0;
}

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

const int mod = 1000000007;

struct mint {
    ll x;

    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 {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    ll n,k;
    cin >> n >> k;

    vector<mint> cnt(k + 1);
    for (int i = k; i >= 1; i--) {
        mint val = k / i;
        val = val.pow(n);
        cnt[i] = val;

        int x = 2;
        while(true){
            if(i * x > k) break;

            cnt[i] -= cnt[i * x];
            x++;
        }
    }

    mint ans = 0;
    for (ll i = 1; i <= k; i++) {
        mint x = i;
        ans += cnt[i] * x;
    }
    cout << ans.x << endl;
}

Measured memory_bytes: 3936
#include <cstdio>
long long D, P10[19], O;
long long DFS(int len, bool first, long long need)
{
	if (len == 0)
		return need == 0;
	if (len == 1)
		return need == 0 ? 10 - first : 0;
	long long S = 0;
	for (long long dif = -9; dif <= 9; dif++)
		if ((need - dif * (P10[len - 1] - 1)) % 10 == 0)
			S += DFS(len - 2, false, (need - dif * (P10[len - 1] - 1)) / 10) * (10 - (dif < 0 ? -dif : dif) - (first && dif >= 0));
	return S;
}
int main()
{
	scanf("%lld", &D);
	P10[0] = 1;
	for (int i = 1; i <= 18; i++)
		P10[i] = P10[i - 1] * 10;
	for (int i = 1; i <= 18; i++)
		O += DFS(i, true, D);
	printf("%lld\n", O);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long n,a,b;
int main()
{
    scanf("%lld%lld%lld",&n,&a,&b);
    if((b-a)&1)printf("%lld",min((unsigned long long)((n<<1)-a-b+1),(unsigned long long)(a+b-1))>>1);
    else printf("%lld",b-a>>1);
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int A,B,m,a[100000],b[100000],x,y,c;
    cin>>A>>B>>m;
    for(int i=0;i<A;i++)
        cin>>a[i];
    for(int i=0;i<B;i++)
        cin>>b[i];
    int ans=*min_element(a,a+A)+*min_element(b,b+B);
    while(cin>>x>>y>>c)
        ans=min(ans,a[x-1]+b[y-1]-c);
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
	int x, y;

	cin >> x >> y;

	int group[] = { 4, 6, 9, 11 };

	if (x == y)
		cout << "Yes" << endl;
	else if (x == 2 || y == 2)
		cout << "No" << endl;
	else
	{
		bool IsInclude[2];
		IsInclude[0] = IsInclude[1] = false;

		for (int i = 0; i < 4; i++)
		{
			if (x == group[i])
				IsInclude[0] = true;

			if (y == group[i])
				IsInclude[1] = true;
		}

		if (IsInclude[0] == IsInclude[1])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
times = int(input())  
n = [input() for i in range(times)]
acount=0
wacount=0
tlecount=0
recount=0
for item in n:
    if item == 'AC':
        acount += 1
    elif item == 'WA':
        wacount += 1
    elif item == 'TLE':
        tlecount += 1
    elif item == 'RE':
        recount += 1

print('AC x '+ str(acount))
print('WA x '+str(wacount))
print('TLE x '+str(tlecount))
print('RE x '+str(recount))

Measured memory_bytes: 16244
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))

const ll inf = (1LL<<62);
const int iinf = (1<<30);
//CLOCKS_PER_SEC



int main(){
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //ifstream cin ("test.in");
    //ofstream cout ("test.out");
	string s;
	cin >> s;
	cout << (s == "ARC" ? "ABC" : "ARC");
    return 0;
}


Measured memory_bytes: 3600
import java.util.*;

public class Main {
	static class Edge {
		int src;
		int dst;
		int cost;

		public Edge(int src, int dst, int cost) {
			this.src = src;
			this.dst = dst;
			this.cost = cost;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		ArrayList<Edge> es = new ArrayList<>();

		int[][] d = new int[N][N];
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				if (i == j)
					continue;
				d[i][j] = Integer.MAX_VALUE / 10;
			}
		}
		for (int i = 0; i < M; ++i) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int c = sc.nextInt();
			d[a][b] = c;
			d[b][a] = c;
			es.add(new Edge(a, b, c));
		}
		for (int m = 0; m < N; ++m) {
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					d[i][j] = Math.min(d[i][m] + d[m][j], d[i][j]);
				}
			}
		}
		int ans = 0;
		out: for (Edge e : es) {
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					if (d[i][e.src] + e.cost + d[e.dst][j] == d[i][j])
						continue out;
				}
			}
			++ans;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 14844
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG

int main() {
  ll H, N;
  cin >> H >> N;

  ll sum =0;
  for (ll i=0 ; i<N; i++){
    ll tmp;
    cin >> tmp;
    sum += tmp;
  }

  if(sum >= H) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int a[10001],ans=0,bns=0,n;
int main()
{
    cin>>n;
    for(int i=1;i<=2*n;i++)
        cin>>a[i];
    sort(a+1,a+1+2*n);
    for(int i=1;i<=2*n;i+=2)
        bns+=a[i];
    printf("%d\n",bns);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int a,b;
    cin >> a >> b;

    int ans = max(0, a-b-b);

    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool f(int i){
    while(i){
        if(i%10==3) return true;
        i/=10;
    }
    return false;
}
int main(){
    int n;
    cin>>n;
    for(int i=1; i<=n; i++){
        if(i%3==0 || f(i))  cout<<" "<<i;
    }
    cout<<endl;
    return 0;
}


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

int main(){
    int N,count=0;
    string s;

    cin >> N;
    cin >> s;
    for(int i=0;i<N;i++){
        if(s[i]=='R')count++;
    }

    if((N/2)<count){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

vector<int> V[5005];
int sz[5005];
long long dp[5005][5005];
long long fact[10005];long long inv[10005];
long long power(long long a,long long b){
    if(b==0) return 1;
    long long f=power(a,b/2);
    f=(f*f)%MOD;
    if(b%2)
        return (a*f)%MOD;
    return f;
}
long long comb(long long n,long long r){
    if(n<r) return 0;
    if(n==r || r==0 ){
        return 1;
    }

    long long temp=(inv[r]*inv[n-r])%MOD;
    return (fact[n]*temp)%MOD;
}
int dfs(int n,int p=-1){
    sz[n]=1;
    for(int i=0;i<V[n].size();++i){
        if(V[n][i]==p) continue;
        sz[n]+=dfs(V[n][i],n);
    }
    return sz[n];
}
long long dfsx(int n,int si){
    for(int i=0;i<=5000;++i) for(int j=0;j<=5000;++j) dp[i][j]=0;
    for(int i=0;i<=sz[V[n][0]];++i){
        dp[0][i]=(comb(sz[V[n][0]],i)*comb(sz[V[n][0]],i))%MOD;
        dp[0][i]=(dp[0][i]*fact[i])%MOD;
    }
    int tot=sz[V[n][0]];
    for(int i=1;i<V[n].size();++i){
        for(int j=0;j<=tot;++j){
            for(int k=0;k<=sz[V[n][i]];++k){
                long long temp=(comb(sz[V[n][i]],k)*comb(sz[V[n][i]],k))%MOD;
                temp=(temp*fact[k])%MOD;
                dp[i][j+k]=(dp[i][j+k]+dp[i-1][j]*temp)%MOD;
            }
        }
        tot+=sz[V[n][i]];
    }
    long long ans=0;long long an=1;
    for(int i=0;i<=si;++i){
        ans+=an*((fact[si-i]*dp[V[n].size()-1][i]));
        ans%=MOD;an*=-1;
    }
    return ans;

}
vector<int> X;
int main(){
    int n;
    cin >> n;
    fact[0]=inv[0]=1;
    for(long long i=1;i<=10000;++i){
        fact[i]=(i*fact[i-1])%MOD;
        inv[i]=power(fact[i],MOD-2);
    }
    for(int i=1;i<n;++i){
        int a,b;scanf("%d %d",&a,&b);
        V[a].push_back(b);V[b].push_back(a);
    }
    long long ans=0;int flag=0;
    for(int i=1;i<=n;++i){
        X.clear();
        dfs(i);
        for(int j=0;j<V[i].size();++j){
            X.push_back(sz[V[i][j]]);
        }

        sort(X.rbegin(),X.rend());
        int ma=X[0];
        for(int j=1;j<X.size();++j){
            ma-=X[j];
        }
        if(ma>1)
            continue;
        ++flag;
        ans+=dfsx(i,n);
        if(flag==2){
            ans=(fact[n/2]*fact[n/2])%MOD;
            break;
        }
    }
    cout << (ans+MOD)%MOD << endl;


    return 0;
}


Measured memory_bytes: 196608
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;


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

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include<cstring>
#include<vector>
#include<cstdio>
using namespace std;
typedef long long ll;

int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    if(x<0)
        x = -x;

    ll t = x / d;


    if(t>=k){
        cout << x - k * d;

    }else{
        x %= d;
        k -= t;
        bool a = x > d / 2;
        bool b = k % 2;
        if(a==b)
            cout << min(x, d - x);
        else {
            if(a && !b)
                cout << x;
            if(!a && b)
                cout << d - x;
        }

    }

    return 0;
}


Measured memory_bytes: 3632
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()
  ans=''

  for i in range(3):
    ans+=s[i]

  return ans

# main()
print(main())


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

double averageTemp(int T, int x){
  return (double)T - (double)x * 0.006;
}

int main(){
  int N, T, A; cin >> N >> T >> A;

  vector<int> H(N);
  for(int i = 0; i < N; i++){
    cin >> H[i];
  }

  int ans = 1;
  double temp = averageTemp(T, H[0]);

  for(int i = 1; i < N; i++){
    if(fabs((double)A - averageTemp(T, H[i])) < fabs((double)A - temp)){
      ans = i + 1;
      temp = averageTemp(T, H[i]);
    }
 }

  cout << ans;

	return 0;
}

Measured memory_bytes: 256
program answer
  implicit none
  integer(16) :: i, N, mi, ans, z
  integer(16), allocatable :: A(:)
  read(*,*) N
  allocate(A(N))
  read(*,*) A

  ans=10**9
  do i = 1, N-1
     call gcd(A(i),A(i+1),z)
     ans=min(ans,z)
  end do

  write(*,*) ans
  deallocate(A)
  stop
contains
  subroutine gcd(x,y,ans)
    implicit none
    integer(16) :: i, x, y, ans, a, b, c
    if(x<y) then
       a=y
       y=x
       x=a
    end if
    a=x
    b=y
    do
       if(mod(a,b)==0) then
          ans=b
          exit
       end if
       c=b
       b=mod(a,b)
       a=c
    end do
    end subroutine gcd
 end program answer

Measured memory_bytes: 4524
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
macro max!(a,b); esc(:($a=max($a,$b))); end
function main()
  V=zeros(Int,3010,3010)
  dp=zeros(Int,3010,3010,4)
  R,C,K=parse.(Int,split(readline()))
  for i=1:K
    r,c,v=parse.(Int,split(readline()))
    V[r,c]=v
  end
  for i=1:R
    for j=1:C
      for k=1:4
        #sita
        @inbounds @max!(dp[i+1,j+1,1],dp[i,j+1,k])
        @inbounds @max!(dp[i+1,j+1,2],dp[i,j+1,k]+V[i,j])
        #migi
        @inbounds @max!(dp[i+1,j+1,k],dp[i+1,j,k])
        @inbounds @max!(dp[i+1,j+1,k],k>1 ? dp[i+1,j,k-1]+V[i,j] : 0)
      end
    end
  end
  println(maximum(dp[R+1,C+1,:]))
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

Measured memory_bytes: 576868
#include<iostream>

using namespace std;

int main() {
    int S, L, R;

    cin >> S;

    L = S / 100;
    R = S % 100;

    if (1 <= L && L <= 12) {
        if (1 <= R && R <= 12) {
            cout << "AMBIGUOUS" << endl;
        }
        else {
            cout << "MMYY" << endl;
        }
    }
    else if (1 <= R && R <= 12) {
        cout << "YYMM" << endl;
   }
    else {
        cout << "NA" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut iter = s.split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();
    if a<b {
        if b<c {
            println!("{} {} {}", a, b, c)
        } else if c<a {
            println!("{} {} {}", c, a, b)
        } else {
            println!("{} {} {}", a, c, b)
        }
    } else {
        if a<c {
            println!("{} {} {}", b, a, c)
        } else if c<b {
            println!("{} {} {}", c, b, a)
        } else {
            println!("{} {} {}", b, c, a)
        }
    }
}



Measured memory_bytes: 5024
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N ;
    vector<ll> A(N),B(N),C(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];
    REP(i, N) cin >> C[i];
    SORT(A);
    SORT(B);
    SORT(C);
    ll ans = 0;
    REP(i, N){
        ll c = (C.end()-upper_bound(ALL(C), B[i]));
        ll a = (lower_bound(ALL(A), B[i]) - A.begin());
        ans += a*c;
    }
    pr(ans);
}

Measured memory_bytes: 2560
#include<stdio.h>

void insertionSort(int A[], int N);
int A[100];
int main(void){

  int N, i, y;

  scanf("%d",&N);

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

    scanf("%d",&y);
    
    A[i] = y;
    
    if(i > 0) printf(" ");
    printf("%d",A[i]);
 
 }
  printf("\n");

  insertionSort(A, N);
  return 0;

}

void insertionSort(int A[], int N){

  int i, j, k, v;

  for(i = 1; i < N; i++){
    v = A[i];
    j = i - 1;

    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
    }

    for(k = 0; k < N; k++){
      if(k > 0) printf(" ");
      printf("%d",A[k]);
    }
    printf("\n");
  }
}

Measured memory_bytes: 604
#include <stdio.h>

int main()
{
    int i = 0;
    char ch;
    char inputStr[1200];

    fgets(inputStr, 1200, stdin);

    while(inputStr[i] != '\0') {
        ch = inputStr[i];
        if ('A' <= ch && ch <= 'Z') {
            ch += 32;
        }
        else if ('a' <= ch && ch <= 'z') {
            ch -= 32;
        }
        else {

        }
        printf("%c", ch);
        i++;
    }

    return 0;
}


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

int x,y;

void swap(){
  int temp;
  temp = x;
  x = y;
  y = temp;
}

int main(){

  while(cin >> x >> y){
    if(x < y) swap();
    int count=0, temp;
    if(x==0 && y==0) break;
    while(y!=0){
      count++;
      x = x % y;
      swap();
    }
    cout << x  << ' ' << count << endl;
  }
  return 0;
}

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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int t;
        cin >> t;
        v.push_back(t);
    }
    int m;
    cin >> m;
    for(int i=0;i<m;++i){
        int p, x;
        cin >> p >> x;
        int ans = 0;
        for(int j=0;j<n;++j){
            if(j == p-1)ans += x;
            else ans += v[j];
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256