akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, q;
    string s;
    cin >> n >> q >> s;

    vector<char> t(q), d(q);
    rep(i, q) {
        cin >> t[i] >> d[i];
    }

    // 最初マスiにいるゴーレムをゴーレムiと呼ぶ

    // 判定問題「ゴーレムxは左方向に消滅するか？」を二分探索で解く
    ll left1 = -1;
    ll right1 = n;
    while(right1 - left1 > 1) {
        ll x = (left1 + right1)/2;  // ゴーレムxが最初にいるマス
        ll pos = x;  // ゴーレムxがいまいるマス
        bool ok = false;  // ゴーレムxが左方向に消滅するならtrue
        rep(i, q) {
            if(s[pos] == t[i]) {
                if(d[i] == 'L') {
                    pos--;
                }
                else if(d[i] == 'R') {
                    pos++;
                }
            }
            if(pos < 0) {
                ok = true;
                break;
            }
        }
        if(ok) {
            left1 = x;
        }
        else {
            right1 = x;
        }
    }
    // ゴーレム0からゴーレムleft1までが左方向に消滅する

    // 判定問題「ゴーレムxは右方向に消滅するか？」を二分探索で解く
    ll left2 = -1;
    ll right2 = n;
    while(right2 - left2 > 1) {
        ll x = (left2 + right2)/2;  // ゴーレムxが最初にいるマス
        ll pos = x;  // ゴーレムxがいまいるマス
        bool ok = false;  // ゴーレムxが右方向に消滅するならtrue
        rep(i, q) {
            if(s[pos] == t[i]) {
                if(d[i] == 'L') {
                    pos--;
                }
                else if(d[i] == 'R') {
                    pos++;
                }
            }
            if(n <= pos) {
                ok = true;
                break;
            }
        }
        if(ok) {
            right2 = x;
        }
        else {
            left2 = x;
        }
    }
    // ゴーレムright2からゴーレムn-1までが右方向に消滅する
    
    // 最終的に消滅しないのはゴーレムright1からゴーレムleft2までのmax(0, left2 - right1 + 1)体
    out(max(0LL, left2 - right1 + 1));
    re0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m,k;cin>>n>>m>>k;
    cout << max(0, k-(n-m)) << endl;
    return 0;
}


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

typedef long long i64;

i64 a,b;

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

	if(a <= 0 && 0 <= b)
	{
		cout << "Zero" << endl;

		return 0;

	}

	if(a >= 0)
	{
		cout << "Positive" << endl;
		return 0;
	}

	i64 negative = min(b,-1LL) - a + 1;

	if(negative % 2 == 0)
	{
		cout << "Positive" << endl;
	}
	else
	{
		cout << "Negative" << endl;
	}

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
using namespace std;


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


int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  bool ans = false;
  int cnt = 0;
  for(int i = 1; i <= n; ++i){
    if(p[i - 1] != i) cnt++;
  }


 if(cnt == 0 || cnt == 2){
   cout << "YES" << endl;
 } else {
   cout << "NO" << endl;
 }


}


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

using namespace std;

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

	int S;
	cin >> S;

	cout << S/3600 << ':' << (S/60)%60 << ':' << S%60 << '\n';

	return 0;
} // br1



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

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>

using namespace std;

// Constants 
#define INF 1e18
#define EPS 1e-9
#define MOD 1000000007
 
// // for using in pairs
#define F first
#define S second
 
// Macros
#define all(x) begin(x), end(x)
 
// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

// Temporary macro.
#define int long long

// Operator overloads.
/**
 * The type of element in the vector should have overload for << operator with ostream. 
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T> v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

/**
 * Both types in the pair should have overload for << operator with ostream. 
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2> p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

template<typename T>
void swap(T &a, T &b)
{
	T t = a;
	a = b;
	b = t;
}

// Utility functions.
void swap(int &a, int &b)
{
	int t = a;
	a = b;
	b = t;
}

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

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = MOD)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;	
}

//////////////////// START CODE HERE ///////////////////////////


void solve(int tc)
{
	int n, W;
	cin >> n >> W;


	int w[n], val[n];
	for (int i = 0; i < n; i++)
		cin >> w[i] >> val[i];

	int dp[n + 1][W + 1];
	int ans = 0;

	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= W; j++)
		{
			if (!i || !j)
			{
				dp[i][j] = 0;
				continue;
			}

			dp[i][j] = dp[i - 1][j];

			if (j >= w[i - 1])
				dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i - 1]] + val[i - 1]);	

			ans = max(ans, dp[i][j]);	
			
		}
	}

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

int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

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

	int t = 1;
	// cin >> t;		
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}

	return 0;
}


Measured memory_bytes: 82456
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
import itertools
J=(list(itertools.permutations(range(1,n+1))))
#print(J)
for i, j in enumerate(J):
    #print(j,p,q)
    if j == p:
        a=i
    if j==q:
        b=i
print(abs(a-b))

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = (n-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

typedef pair<int, int> P;

pair<P, P> make_pp(int a, int b, int c, int d){
    return make_pair(make_pair(a, b), make_pair(c, d));
}

int main(){
    int H, W; cin >> H >> W;
    int a[H][W];
    rep(i, H) rep(j, W){
        cin >> a[i][j];
    }
    vector<pair<P, P> > V;
    rep(i, H){
        if(i % 2 == 0){
            rep(j, W){
                if(i == H-1 && j == W-1) break;
                if(a[i][j] % 2 == 1){
                    a[i][j]--;
                    if(j == W-1){
                        a[i+1][j]++;
                        V.push_back(make_pp(i, j, i+1, j));
                    }
                    else{
                        a[i][j+1]++;
                        V.push_back(make_pp(i, j, i, j+1));
                    }
                    
                }
            }
        }
        else{
            repr(j, W){
                if(i == H-1 && j == 0) break;
                if(a[i][j] % 2 == 1){
                    a[i][j]--;
                    if(j == 0){
                        a[i+1][j]++;
                        V.push_back(make_pp(i, j, i+1, j));
                    }
                    else{
                        a[i][j-1]++;
                        V.push_back(make_pp(i, j, i, j-1));
                    }
                }
            }
        }
    }

    cout << V.size() << endl;
    rep(i, V.size()){
        cout << V[i].first.first + 1 << " " << V[i].first.second + 1<< " ";
        cout << V[i].second.first + 1<< " " << V[i].second.second + 1<< endl;
    }
}

Measured memory_bytes: 5232
tmp = list(map(int,(input().split())))
n = tmp[0]
k = tmp[1]
q = tmp[2]

point = [0] * n
for i in range(q):
  ai = int(input())
  point[ai-1] += 1

for i in range(n):
  if(k - (q - point[i]) > 0):
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 4680
import java.util.Scanner

object Main {
  def main (args: Array[String]) = {
    val in = new Scanner(System.in)
    val a = in.nextInt()
    val b = in.nextInt()
    val c = in.nextInt()
    val result = if (a < b && b < c) "Yes" else "No"

    println(result)
  }
}

Measured memory_bytes: 45084
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <typeinfo>

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

#define all(x) (x).begin(),(x).end()
*/

using namespace std;

unsigned euclidean_gcd(unsigned a, unsigned b)
{
    if (a < b)
        euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    long long X;
    cin >> n>>X;

    bool ans = true;
    long long  x[100005];
    //long long x[1000000005];
    for (int i = 0; i < n; i++)
    {
        long long tmp;
        cin >> tmp;
        x[i] = tmp - X;
    }
    x[n] = 0;

    sort(x, x + n + 1);

    long long ming = x[1] - x[0];
    for (int i = 1; i < n;i++){
        ming = euclidean_gcd(ming, x[i + 1] - x[i]);
    }

    cout << ming;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
static const int MAX = 100;
static const long long int INF = (1LL << 32);

void put(long long d) {
  if (d < INF)
    printf("%lld", d);
  else
    printf("INF");
}

int main() {
  long long D[MAX][MAX];
  int nv, nedge;
  cin >> nv >> nedge;
  for (int i = 0; i < nv; i++) {
    for (int j = 0; j < nv; j++) {
      D[i][j] = i == j ? 0 : INF;
    }
  }

  for (int i = 0; i < nedge; i++) {
    int s, t;
    long long d;
    scanf("%d %d %lld", &s, &t, &d);
    D[s][t] = d;
  }

  for (int k = 0; k < nv; k++) {
    for (int i = 0; i < nv; i++) {
      if (D[i][k] == INF) continue;
      for (int j = 0; j < nv; j++) {
        if (D[k][j] == INF) continue;
        D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
      }
    }
  }
  for (int i = 0; i < nv; i++) {
    if (D[i][i] < 0) {
      printf("NEGATIVE CYCLE\n");
      return 0;
    }
  }

  for (int i = 0; i < nv; i++) {
    put(D[i][0]);
    for (int j = 1; j < nv; j++) {
      printf(" ");
      put(D[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 3296
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;


int count_true(int N) {
    int ret{0};
    for (; N > 0; N >>= 1) {
        ret += N & 1;
    }
    return ret;
}

bool is_true(int n, int who) {
    return (n >> (who-1)) & 1;
}

int main(int argc, char **argv) {
    i64 n, a;
    cin >> n;
    std::map<int, std::map<int, int>> t;
    t[0] = std::map<int, int>();
    for (int i=0; i<n; ++i) {
        t[i+1] = std::map<int, int>();
        cin >> a;
        for (int j=0; j<a; ++j) {
            int x, y;
            cin >> x >> y;
            t[i+1][x] = y;
        }
    }

    int ans{0};
    for (int i=1; i< (1 << n); ++i) {
        bool ok{true};
        for (int j = 0; j < n; ++j) {
            if (! ((i >> j)&1)) continue;
            for (auto kv : t[j+1]) {
                if (! is_true(i, kv.first)) {
                    if (kv.second == 1) {
                        ok = false;
                        break;
                    }
                    continue;
                } else {
                    if (kv.second == 0) {
                        ok = false;
                        break;
                    }
                    continue;
                }
            }
        }
        if (ok) {
            ans = max(ans, count_true(i));
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int n,q;
vector<int> val;
vector<int> tree[200005];

void dfs(int now_val,int parent_val = -1){
    if(now_val != 0) val[now_val] += val[parent_val];
    for(int i : tree[now_val]){
        if(i != parent_val){
            dfs(i,now_val);
        }
    }
    return;
}
int main(){
    cin >> n >> q;
    val.resize(n,0);
    for(int i=0;i<n-1;i++){
        int a,b; cin >> a >> b;
        a--; b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    for(int i=0;i<q;i++){
      int p,x;
        cin >> p >> x;
        p--;
        val[p] += x;
    }

    dfs(0);
    for(int i=0;i<n;i++){
        cout << val[i] << " ";
    }
    return 0;
}




Measured memory_bytes: 23424
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=998244353;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans1=a*b*4;
    ll ans2=(c-a-b)*(c-a-b);
    if(ans1<ans2&&c>(a+b))
        cout<<"Yes"<<'\n';
    else
        cout<<"No"<<'\n';











}


Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n,m;
  cin>>n>>m;
  vi v(n,0);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    v[a]++;
    v[b]++;
  }
  rep(i,n)
    cout<<v[i]<<endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
bool cmp(char A,char B){
	return A>B;
}
int main(){
	int lens,lent;
	char s[105],t[105],temp;
	while(~scanf("%s",&s)){
		scanf("%s",&t);
		lens = strlen(s);
		lent = strlen(t);
		sort(s,s+lens);
		sort(t,t+lent,cmp);
		if(strcmp(s,t) < 0)
			printf("Yes\n");
		else
			printf("No\n");
		memset(s,0,sizeof(s));
		memset(t,0,sizeof(t));
	}
	return 0;
}

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

int main(){
    int r,c;
    cin>>r>>c;
    char grid[r][c];
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            char cc;cin>>cc;
            grid[i][j] = cc;
        }
    }
    vector<vector<int> > le(r,vector<int>(c,0));
    vector<vector<int> > ri(r,vector<int>(c,0));
    vector<vector<int> > up(r,vector<int>(c,0));
    vector<vector<int> > dw(r,vector<int>(c,0));
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            if(grid[i][j] == '#'){
                le[i][j] = 0;
            }
            else{
                if(j == 0){
                    le[i][j] = 1;
                }else{
                    le[i][j] = le[i][j-1]+1;
                }
            }
        }
    }
    for(int i=0;i<r;i++){
        for(int j=c-1;j>=0;j--){

            if(grid[i][j] == '#'){
                ri[i][j] = 0;
            }
            else{
                if(j == c-1){
                    ri[i][j] = 1;
                }else{
                    ri[i][j] = ri[i][j+1] +1;
                }
            }
        }
    }
    for(int i=0;i<c;i++){
        for(int j=0;j<r;j++){
            if(grid[j][i] == '#'){
                up[j][i] = 0;
            }
            else{
                if(j == 0){
                    up[j][i] = 1;
                }else{
                    up[j][i] = up[j-1][i]+1;
                }
            }
        }
    }
    for(int i=0;i<c;i++){
        for(int j=r-1;j>=0;j--){
            if(grid[j][i] == '#'){
                dw[j][i] = 0;
            }
            else{
                if(j == r-1){
                    dw[j][i] = 1;
                }else{
                    dw[j][i] = dw[j+1][i]+1;
                }
            }
        }
    }
    int ans = 0;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            ans = max(ans ,
                      le[i][j] + up[i][j] + ri[i][j] + dw[i][j] -3);
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  long long N,Q;
  cin >> N >> Q;
  fenwick_tree<long long> A(N);
  for(int i=0;i<N;i++){
    long long a;
    cin >> a;
    A.add(i,a);
  }
  
  for(int i=0;i<Q;i++){
    long long q,x,y;
    cin >> q >> x >> y;
    
    if(q==0){
      A.add(x,y);
    }
    if(q==1){
      cout << A.sum(x,y) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 8208
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int d;
	scanf("%d", &d);
	int c[26];
	int s[365][26];
	int t[365];
	for (int i = 0; i < 26; i++) {
		scanf("%d", &c[i]);
	}
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < 26; j++) {
			scanf("%d", &s[i][j]);
		}
	}
	for (int i = 0; i < d; i++) {
		scanf("%d", &t[i]);
		t[i]--;
	}

	int last[26] = {};
	long long ans = 0;
	for (int i = 0; i < d; i++) {
		last[t[i]] = i + 1;
		ans += s[i][t[i]];
		for (int j = 0; j < 26; j++) {
			ans -= c[j] * (i + 1 - last[j]);
		}
		printf("%lld\n", ans);
	}

	return 0;
}

Measured memory_bytes: 3856
n,m=map(int,input().split())
a=[int(input().replace(" ",""),2) for i in range(n)]
o=998244353
c=0
for j in range(m)[::-1]:
 for i in range(c,n):
  if a[i]&1<<j:
   for k in range(n):
    if i!=k and a[k]&1<<j:a[k]^=a[i]
   a[i],a[c]=a[c],a[i];c+=1
p=lambda x:pow(2,x,o)
print(p(n+m-c-1)*(p(c)-1)%o)

Measured memory_bytes: 3064
#include<stdio.h>
 
int main(){
  int o,n,k,i,j;
  int key;
  int A[110];
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&A[i]);
 
  /*for(o=1;o<=n;o++)
    {
      if(o == n){printf("%d\n",A[o]);}
      else printf("%d ",A[o]);
    }
  */
  for(j=1;j<=n;j++)
    {   
          key = A[j];       
          i = j-1;
          while(i>0 && A[i]>key)
        {
          A[i+1]=A[i];  
          i = i-1;
        }
          A[i+1] = key;
          for(k=1;k<=n;k++){
        if(k == n)printf("%d\n",A[k]);
        else printf("%d ",A[k]);
          }
    }
   
  return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
		#include <iostream>
		#include <numeric>
        using namespace std;
		int main(){
          int N;
          cin>> N;
          int A,B,C,D;
          A=N/1000;
          B=(N/100)%10;
          C=(N/10)%10; 
          D= N%10; 
          if( A==B || B==C || C==D ){
            cout<<"Bad" << endl;
          }
          else{
            cout<<"Good" << endl;
          }
        }

Measured memory_bytes: 256
n,m=map(int,input().split())

edges=[[] for i in range(n)]

for i in range(m):
  s,t = map(int,input().split())
  edges[s-1].append(t-1)
  edges[t-1].append(s-1)

cnt =[0]

def dfs(V,s):
  V[s]=1
  if sum(V)==n:
    cnt[0]+=1
  else:
    for adj in edges[s]:
      if V[adj] == 0:
        dfs(V[:adj] + [1] + V[adj + 1:], adj)
dfs([0] * n, 0)
print(cnt[0])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    int n; cin >> n;
    int ans = 0;
    FOR(i, 0, n) {
        string s; cin >> s;
        if (s == "E869120")++ans;
    }
    cout << ans << "\n";
}



Measured memory_bytes: 3176
<?php

fscanf(STDIN, "%d %d", $n,$m);
for($i=0; $i<$m; $i++){
  	$d_check[] = trim(fgets(STDIN));
    $d[$d_check[$i]] = 1;
    if(count($d_check) > 1 && $d_check[$i-1]+1 == $d_check[$i]){
        echo 0;
        exit;
    }
}
 
$step[-1] = 0;
$step[0] = 1;
 
for($i=1; $i<=$n; $i++){
    if(isset($d[$i])){
        $step[$i] = 0;
    }else{
        $step[$i] = $step[$i-1] + $step[$i-2];
    }
    $step[$i] = $step[$i] % 1000000007;
}
 
echo $step[$n];
?>

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
l = LI()
if sum(l) - max(l) > max(l):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
int main()
{

  long long n;
  cin>>n;
  long long arr[n];
  long long arr1[n];
  long long sum=0;
  for(int i=0;i<n;i++){
    cin>>arr[i];
    arr[i]%=mod;
  }
  arr1[0]=arr[0];
   for(int i=1;i<n;i++){
    arr1[i]=arr1[i-1]+arr[i];
    arr1[i]%=mod;
  }
  for(int i=n-1;i>=1;i--){
    sum+=(arr[i]*arr1[i-1]);
    sum%=mod;
  }


    cout<<sum<<"\n";
	return 0;
}


Measured memory_bytes: 6768
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  int c=0;
  string s,large="",max;
  map<string,int>wordbox;
  while(cin>>s){
    wordbox[s]++;
    if(s.length()>large.length())large=s;
  }
  map<string,int>::iterator it=wordbox.begin();
  while(it!=wordbox.end()){
    if((*it).second>c)max=(*it).first,c=(*it).second;
    it++;
  }
  cout<<max<<" "<<large<<endl;
  return 0;
}

Measured memory_bytes: 0
N,K = map(int, input().split())
D = [0]*(N+1)
sunuke = [1]*(N+1)
for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        sunuke[a] = 0
print(sum(sunuke[1:]))

Measured memory_bytes: 9176
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for(int i=0; i<n; ++i)

int main() {
  int n, d, x;
  std::cin >> n >> d >> x;
  int a[110];
  rep(i, n) std::cin >> a[i];

  int choco = 0;
  int day;

  rep(i, n) {
    choco += 1;
    day = 1;
    while(day*a[i]+1<=d) {
      choco += 1;
      day += 1;
    }
  }

  std::cout << choco + x << std::endl;

  return 0;
}


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

int main() {
    long long int n,ans;
    ans = 0;
    cin >> n;
    pair<long long int,long long int> p[n];
    for(long long int i=0;i<n;i++){
        long long int a,b;
        cin >> a >> b;
        p[i]=make_pair(b,a);
    }
    sort(p,p+n);
    long long int A = 0;
    for(long long int i=0;i<n;i++){
        A += p[i].second;
        if(A<=p[i].first);
        else ans = 1;
    }
    if(ans == 0)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main(){
    int d,n;
    cin >> d >> n;
    if(n!=100){
    if(d==0)cout << n << endl;
    else if(d==1) cout << n*100 << endl;
    else if(d==2) cout << n*10000 << endl;
    }
    else{
    if(d==0)cout << n+1 << endl;
    else if(d==1) cout << n*100+100 << endl;
    else if(d==2) cout << n*10000+10000 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7L;

bool check(int t,int sx,int sy,int tx,int ty){
	int time=t;
	int ax=abs(tx-sx);
	int ay=abs(ty-sy);
	if(time<ax) return 0;
	time-=ax;
	if(time<ay) return 0;
	else if(time%2==ay%2) return 1;
	else return 0;
}

int N;
int t[100005];
int x[100005];
int y[100005];

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;

t[0]=0; 
x[0]=0;
y[0]=0;
for(int i=1; i<=N; i++){
	cin>>t[i]>>x[i]>>y[i];
}

for(int i=1; i<=N; i++){
	int time=t[i]-t[i-1];
	bool chk=check(time,x[i-1],y[i-1],x[i],y[i]);
	if(!chk){
		cout<<"No"<<endl;
		return 0;
	}
}

cout<<"Yes"<<endl;

}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    int N;
    while (cin >> N) {
        int res = -1;
        for (int i = 0; i <= 100000; ++i) {
            int val = i + i * 8 / 100;
            if (val == N) {
                res = i;
            }
        }
        if (res == -1) cout << ":(" << endl;
        else cout << res << endl;
    }
}












Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

ctr = Counter(A)
doub = ctr.most_common()[0][0]
i1 = A.index(doub)
i2 = N - A[::-1].index(doub)
l = N - (i2-i1)

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

def ncr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

ans = []
for n in range(1,N+2):
    ans.append(ncr(N+1,n))
for i in range(l+1):
    ans[i] -= ncr(l,i)
    ans[i] %= MOD

print(*ans, sep='\n')

Measured memory_bytes: 33324
/// BISMILLAH
#include <bits/stdc++.h>
using namespace std;
#define end "\n"
int main(void) {
    ios_base::sync_with_stdio(0);

    int count = 0, n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 0; i < n; i++) {
        if((i + 1) % 2) {
            if(a[i] % 2)
                count++;
        }
    }
    cout << count << end;

    return 0;
}

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

long dp[11][1001][101];
int n,s;
const int N=9;

long rec(int a, int b, int c){
	if(dp[a][b][c]>=0) return dp[a][b][c];
	
	long ret=0;	
	if(a==n && b>=0){
		if(b==0) ret=1;
		else ret=0;
	}
	else if(b<0) ret=0;
	else for(int i=c-1; i>=0; --i) ret+=rec(a+1, b-i, i);	
	
	return dp[a][b][c]=ret;
}

int main(){
	while(1){
		scanf(" %d %d", &n, &s);
		if(n==0) break;
			
		memset(dp, -1, sizeof(dp));
		printf("%ld\n", rec(0, s, N+1));
	}
}

Measured memory_bytes: 9884
#include <iostream>
#include <string>

int main()
{
  std::string S;
  int n = 0;
  std::cin >> S;
  for(int i = 0;i < S.size(); ++i){
    n += (S[i] - '0');
  }
  ////↓でもok
  //for(const auto& v : S){
  //  n += (v - '0');
  //}
  std::cout << ((std::stoi(S)%n==0)?"Yes":"No") << std::endl;
}


Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int[] c;
    int i;
    c = new int[6];

    for(i = 0;i < 6;i++)c[i] = sc.nextInt();
    if(c[0] + c[1] * 5 + c[2] * 10 + c[3] * 50 + c[4] * 100 + c[5] * 500 >= 1000)
      out.println("1");
    else out.println("0");

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17348
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define INF (ll)1e18
struct aaa{aaa(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(10);};}aaaaaaa;
inline void in() {}
template <class Head, class... Tail>
inline void in(Head&& head,Tail&&... tail){
    cin>>head;
    in(move(tail)...);
}
template <class T>
inline void out(T t) {
    cout<<t<<'\n';
}
template <class Head, class... Tail>
inline void out(Head head,Tail... tail){
    cout<<head<<' ';
    out(move(tail)...);
}

int main(){
    int a[3];
    in(a[0],a[1],a[2]);
    sort(a, a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7)out("YES");
    else out("NO");
}























Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
//#define for(i,a,b) for(int i=(a);i<=(b);i++)
#define ppi pair<int,int>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int N = 105;
const double pi = acos(-1.0);
const ll mod = 1e9+7;
void init(){ios::sync_with_stdio(false);cin.tie(0);} 
template<class T>inline void read(T &res)
{
	char c;T flag=1;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int main()
{
	int a,b,k,f=0;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	if(i%k==0)
	{
		f=1;
		break;
	}
	if(f)cout<<"OK";
	else cout<<"NG";
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;

#define MAXN 100005

int dp[MAXN][5];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, a, b, c;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a >> b >> c;
		if(i == 1) {
			dp[i][1] = a;
			dp[i][2] = b;
			dp[i][3] = c;
		}
		else {
			dp[i][1] = a + max(dp[i - 1][2], dp[i - 1][3]);
			dp[i][2] = b + max(dp[i - 1][1], dp[i - 1][3]);
			dp[i][3] = c + max(dp[i - 1][1], dp[i - 1][2]);
		}
	}
	
	cout << max(dp[n][1], max(dp[n][2], dp[n][3])) << '\n';
	
	return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF = 1e18;
const int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);
void coutY();
void coutN();
LL ave(LL, LL);

int main() {
	string n; cin >> n;
	if (n[0] == '9' || n[1] == '9')coutY();
	else coutN();
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}
void coutY() {
	cout << "Yes" << endl;
	return;
}
void coutN() {
	cout << "No" << endl;
	return;
}
LL ave(LL a, LL b) {
	return (a + b) / 2;
}

Measured memory_bytes: 256
N = int(input())
if N<=9:
    print(N)
elif N<=99:
    print(9)
elif N<=999:
    print(9+(N-99))
elif N<=9999:
    print(909)
elif N<=99999:
    print(909+(N-9999))
elif N<=999999:
    print(90909)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef long double ld;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll exp(ll x,ll y){if(y==0) return 1;if(y%2 == 1) return x*exp(x,y/2)*exp(x,y/2);return exp(x,y/2) * exp(x,y/2);}
ll exp(ll x,ll y,ll modd) {if(y==0) return 1;ll t=exp(x,y/2,modd);t = t%modd;t=t*t;t=t%modd;if(y % 2 == 1) return (x*t)%modd ;return t%modd;}
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target ("sse4")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define emp empty()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0ll, so x)
#define all(x) (x).be , (x).en
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define revn(i,a,b) for(ll i=a;i>=b;--i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vs vector<string>
#define vsi vector<pair<string,int>>
#define vll vector<pair<ll,ll> >
#define vlll vector<pair<ll,pair<ll,ll>>>
#define vlvl vector<pair<pair<ll,ll>,ll>>>
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
const int mod = 1e9+7;
int main()
{
    ios;
	int n,h;
	
    cin>>n>>h;
	
	
	vector<vector<char>> grid(n, vector<char>(h));
	
	vector<vector<int>> dp(n, vector<int>(h, 0));
	
	for(int i=0;i<n;i++)
		for(int j=0;j<h;j++)
			cin>>grid[i][j];
			
	
	for(int i=1;i<h;i++)
	{
		if(grid[0][i]=='#')
			break;
		dp[0][i]=1;
	}

	for(int i=1;i<n;i++)
	{
		if(grid[i][0]=='#')
			break;
		dp[i][0]=1;
	}
	
	for(int i=1;i<n;i++)
		for(int j=1;j<h;j++)
		{
			if(grid[i][j]=='.')
				dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
			else
				dp[i][j]=0;
		}
		
	cout<<dp[n-1][h-1]%mod;
	return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int>c(n), s(n), f(n);
	for (int i = 0; i < n - 1; i++) {
		cin >> c[i] >> s[i] >> f[i];
	}
	
	for (int i = 0; i < n; i++) {
		long long ans = 0;
		for (int j = i ; j < n-1; j++) {
			if (ans < s[j])ans = s[j];
			else if (ans % f[j] == 0);
			else ans = ans + f[j] - ans % f[j];
			ans += c[j];
		}
		cout << ans << endl;

	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a,b;

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

  if(a<b){
    printf("a < b\n",a,b);
  }
  else if(a>b){
    printf("a > b\n",a,b);
  }
  else{
    printf("a == b\n",a,b);
  }

    return 0;
}

Measured memory_bytes: 580
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくお願いします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */

#include<bits/stdc++.h>

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N, K;
    cin >> N >> K;
    vector<unsigned long> comb(N);
    {
        vector<unsigned long> invmod(N + 1);
        invmod[0] = invmod[1] = 1;
        for(unsigned long i{2}; i <= N; ++i)invmod[i] = invmod[MOD % i] * (MOD - MOD / i) % MOD;
        for(unsigned long i{1}; i <= N; ++i)(invmod[i] *= invmod[i - 1]) %= MOD;
        unsigned long fact{1};
        for(unsigned long i{1}; i < N; ++i)(fact *= i) %= MOD;
        fact = fact * fact % MOD * N % MOD;
        for(unsigned long i{0}; i < N; ++i)comb[i] = fact * (N - i) % MOD * invmod[i] % MOD * invmod[i] % MOD * invmod[N - i] % MOD * invmod[N - i] % MOD;
    }
    partial_sum(comb.begin(), comb.end(), comb.begin());
    K = min(K, N - 1);
    cout << comb[K] % MOD << endl;
    return 0;
}

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

int main()
{
    ll n;
    cin>>n;
    map<ll , ll> data;
    for(int i=0;i<n;i++)
    {
        ll temp;
        cin>>temp;
        data[temp]++;
    }
    ll m;
    cin>>m;
    bool exists = true;
    for(int i=0;i<m;i++)
    {
        ll temp;
        cin>>temp;
        if( data[temp] )
        {
            data[temp] --;
        } else
        {
            exists = false;
        }
    }
    if( exists)
    {
        cout<<"YES";
    }
    else cout<<"NO";
}

Measured memory_bytes: 16072
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    long long temp = 0, ans = 0;;
    long long i = 0, num;
    while(i < N){
        temp = 0;
        num = A.at(i);
        while(i < N && A.at(i) == num){
            temp++;
            i++;
        }
        if(temp % 2 == 1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  string s;
  cin >> s;

  string ans = "";

  ans += s.substr(0, 4);
  ans += " ";
  ans += s.substr(4);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

static const int N = 51;

ll K;

int main()
{
	int h,w;
	char str;
	int t[N][N],dp[N][N];
	scanf("%d %d\n",&h,&w);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			scanf("%c",&str);
			t[i][j] = str - '0';
		}
		scanf("%c",&str);
	}
	for(int i=0;i<=h;i++)dp[i][0]=9999999;
	for(int i=0;i<=w;i++)dp[0][i]=9999999;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(i==1&&j==1){
				dp[i][j]=0;
				continue;
			}
			dp[i][j] = min(dp[i-1][j],dp[i][j-1])+t[i][j];
		}
	}
	printf("%d\n",dp[h][w]);
	return 0;
}



Measured memory_bytes: 2780
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main(){
	string s;
	cin>>s;
	string s1 = s.substr(0,2);
	string s2  = s.substr(2,2);


	int a = stoi(s1);
	int b = stoi(s2);

	// cout<<a<<" "<<b<<endl;

	if(1<=a && a<=12 && 1<=b && b<=12){
		cout<<"AMBIGUOUS"<<endl;
	}
	else if(1<=a && a<=12){
		cout<<"MMYY"<<endl;
	}
	else if(1<=b && b<=12){
		cout<<"YYMM"<<endl;
	}
	else{
		cout<<"NA"<<endl;
	}


}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N = int(input())
    T, A = map(int, input().split())
    h = list(map(int, input().split()))
    temp = float('inf')
    for  i in range(N):
        d = T - h[i]*0.006
        if abs(A - temp) > abs(A - d):
            temp = d
            ans = i+1
    print(ans)

if __name__ == '__main__':
    main()

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

int main(){
  long long K, A, B;
  cin >> K >> A >> B;
  long long ans=0;
  if (B<=A+2||K<=A) {
    ans = K+1;
  } else {
    K -= (A-1);
    ans += A;
    ans += (K/2)*(B-A);
    ans += K%2;
  }
  cout << ans << endl;
}


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

int main(){
    int N, ans=0, cost;
    cin >>N;
    vector<int> c(N), s(N), f(N);

    for(int i=0; i<N-1; i++){
	cin >> c[i] >> s[i] >> f[i];
    }

    for(int i=0; i<N; i++){
	ans = 0;
	for(int j=i; j<N-1;j++){
	    if (ans < s[j])
		ans = s[j];
	    else if( ans % f[j]==0);
	    else
		ans = ans + f[j] - ans%f[j];
	    ans += c[j];
	}
	cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w,a,b;cin>>h>>w>>a>>b;
    int ans[h][w];
    rep(i,0,h-b){
        rep(j,0,a)ans[i][j]=0;
        rep(j,a,w)ans[i][j]=1;
    }
    rep(i,h-b,h){
        rep(j,0,a)ans[i][j]=1;
        rep(j,a,w)ans[i][j]=0;
    }
    rep(i,0,h){
        rep(j,0,w)cout<<ans[i][j];
        cout<<endl;
    }
}


Measured memory_bytes: 5120
N, K = map(int, input().split())
List = list(map(int, input().split()))

ans = 0
for i in range(min(N, K)+1):
    for j in range(min(N, K)-i+1):
        if j==0:
            temp = List[:i]
        else:
            temp = List[:i]+List[-j:]
        for k in range(min(i+j, K-(i+j))+1):
            ret = sum(sorted(temp)[k:])
            if ret>ans:
                ans = ret
                
print(ans)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))
#define PB push_back
#define MP make_pair

using namespace std;

const double eps = 1e-8;

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

int main() {
    string line;
    getline(cin, line);
    int a = atoi(line.substr(0, line.find(' ') + 1).c_str());
    int p = atoi(line.substr(line.find(' ') + 1, line.length()).c_str());
    cout<< (p + a * 3) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	ll ans = 0;
	int N;
	cin >> N;
	int a[2 * N];
	for (int i = 0; i < 2 * N; i++) {
		cin >> a[i];
	}
	sort(a, a + 2 * N);
	for (int i = 0; i < 2 * N; i += 2) {
		ans += min(a[i], a[i + 1]);
	}
	cout << ans << endl;
}



Measured memory_bytes: 256