akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pll pair<long long int, long long int>
#define great (long long int)(1e9+7)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fst first
#define scd second

void solve()
{
  ll n;
  cin>>n;
 string a[n];
 for(ll i=0;i<n;i++)
 {
     cin>>a[i];
 }
 ll ac=0,wa=0,tle=0,re=0;
 for(ll i=0;i<n;i++)
 {
    if(a[i][0]=='A')
        ac++;
    else if(a[i][0]=='T')
        tle++;
    else if(a[i][0]=='W')
        wa++;
    else if(a[i][0]=='R')
        re++;
 }
 cout<<"AC x "<<ac<<endl;
 cout<<"WA x "<<wa<<endl;
 cout<<"TLE x "<<tle<<endl;
 cout<<"RE x "<<re<<endl;


}
int main()
{
    //fastio;
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}


Measured memory_bytes: 6768
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
int main(){
int n;
cin>>n;
V<ll> a(n);
set<ll> s;
for(int i=0;i<n;i++){
   cin>>a[i];
}
sort(all(a));
ll mi=a[0],ma=a[n-1];
if(ma==mi){
   if(ma==n-1||ma*2<=n)cout<<"Yes"<<"\n";
   else cout<<"No"<<"\n";
}else if(ma-mi==1){
   ll x=0,y=0;
   for(int i=0;i<n;i++){
      if(a[i]==ma)x++;
      else y++;
   }
   // x=自分の他に同じ帽子を持つ猫 y:他に同じ帽子を持たない猫
   if(y<ma&&2*(ma-y)<=x)cout<<"Yes"<<"\n";
   else cout<<"No"<<"\n";
}
else cout<<"No"<<"\n";
}
    

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

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

    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> E(n + 1), W(n + 1);
    for(int i = 0; i < n; i++){
        if(s[i] == 'E'){
            E[i + 1]++;
        }else{
            W[i + 1]++;
        }
        E[i + 1] += E[i];
        W[i + 1] += W[i];
    }

    int ans = 1e9;
    for(int i = 0; i < n; i++){
        int r = E[n] - E[i + 1];
        int l = W[i];
        ans = min(ans, l + r);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2964
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    long long N,I,J,K = 0;
    cin >> N;
    
    for ( int i = 1; i <= 3500; i++ ) {
    for ( int j = 1; j <= 3500; j++ ) {
        if ( ( 4*i*j - N*j - N*i ) <= 0 ) { continue; }
        if ( ( N*i*j ) % ( 4*i*j - N*j - N*i ) == 0 )  {
            I = i;
            J = j;
            K = ( N*i*j ) / ( 4*i*j - N*j - N*i );
            
            cout << I << " " << J << " " << K << endl;
            return 0;
        }
    }
    }
    
    
    return 0;
}

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

namespace ABC108C_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = nk[0];
            var k = nk[1];
            var vs = new ValSet(nk[0], nk[1]);
            Console.WriteLine(vs.CalculateTriangularRelationShip());

        }
    }
    public class ValSet
    {
        private int _n;
        private int _k;

        public ValSet(int v1, int v2)
        {
            this._n = v1;
            this._k = v2;
        }

        public long CalculateTriangularRelationShip()
        {

            if(_k%2 == 1)
            {
                long count = 0;
                for(var x = 1; x <= _n; x++)
                {
                    if (x % _k == 0)
                    {
                        count++;
                    }
                }
                return count * count * count;
            }
            else
            {
                long counta = 0;
                long countb = 0;
                for(var x = 1; x <= _n; x++)
                {
                    if (x % _k == 0)
                    {
                        counta++;
                    }
                    if(x%_k == _k / 2)
                    {
                        countb++;
                    }
                }
                return counta * counta * counta + countb * countb * countb;
            }
        }
    }
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, w, v, val, h;
        double ink;
        while (true) {
            h = 0;
            ink = 0.01;
            n = sc.nextInt();
            w = sc.nextInt();
            if (n == 0) break;

            List<Integer> histogram = new ArrayList<>();

            for (int i = 0; i < n; i++) {
                v = sc.nextInt();

                if (v/w > histogram.size()-1) {
                    // extend size of histogram
                    while (v/w > histogram.size()-1)
                        histogram.add(0);
                }
                val = histogram.get(v/w) + 1;
                if (val > h) h = val;
                histogram.set(v/w, val); // increment
            }
            double brightness = histogram.size()-1;

            for (int i = 0; i < histogram.size(); i++) {
                ink += (histogram.get(i) / (double)h) * ((brightness-i)/brightness);
            }
            System.out.println(ink);
        }
    }
}

Measured memory_bytes: 31748
import math

N,K = map(int,input().split())
A = list(map(int,input().split()))

m = 1
M = max(A)

while(M-m>0):
    mm = 0

    mid = (M+m)//2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid+1
    else:
        M = mid

print(math.ceil(m))




Measured memory_bytes: 104624
using System;

namespace SimpleCalc
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			double a, b, ans = 0;
			string[] data;
			while (true) {
				data  = Console.ReadLine ().Split (" ".ToCharArray ());
				a = double.Parse (data [0]);
				b = double.Parse (data [2]);
				if (string.Compare (data [1], "?") == 0)
					break;

				switch (data [1]) {
				case "+":
					ans = a + b;
					break;
				case "-":
					ans = a - b;
					break;
				case "*":
					ans = a * b;
					break;
				case "/":
					ans = a / b;
					break;
				}

				Console.WriteLine ((int)ans);
			}
		}
	}
}

Measured memory_bytes: 10432
#include<iostream>
#include <cstdlib>
#include<sstream>
#define MAX 1000
using namespace std;
  
struct Stack{
  double s[MAX];
  int top;

  void initial(){
    top = 0;
  }
  bool isEmpty(){
    return (top == 0);
  }
  bool isFull(){
    return (top == MAX-1);
  }
  void push(double x){
    if(isFull()){
      cout << "stack overflow\n";
      exit(0);
    }
    s[top++] = x;
  }
  double pop(){
    if(isEmpty()){
      cout << "stack underflow\n";
      exit(0);
    }
    return s[--top];
  }
};
  
double calc(double x, string op, double y){
  if(op == "+")  return (x+y);
  if(op == "-")  return (x-y);
  if(op == "*")  return (x*y);
  if(op == "/")  return (x/y);
}
  
  
int main(){
  string str;
  double numA, numB;
  Stack stack;
  stack.initial();
  
  while(cin >> str){
    if(str == "+" || str == "-" || str == "*" || str == "/"){
      numA = stack.pop();
      numB = stack.pop();
      stack.push(calc(numB, str, numA));
    }
    else{
        numA = atoi(str.c_str());
        stack.push(numA);
    }
  }
  
  cout << stack.pop() << '\n';
  return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  rep(l,n){
    ll x,y,b,p;
    double ans;
    cin >> x >> y >> b >> p;
    ans = x * b + y * p;
    if(b >= 5 && p >= 2){
      ans *= 0.8;
    }
    if(b < 5 && p < 2){
      ans = min(ans,0.8*(x * 5+y*2));
    }
    else if( p < 2){
      ans = min(ans,0.8*(x * b + y * 2)) ;
    }
    else if(b < 5){
      ans = min(ans,0.8*(5 * x + y * p));
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3268
import java.util.*;

class Main{
    public static void main( String[] args ) {
	Scanner sc = new Scanner(System.in);
	int A = sc.nextInt();
	int B = sc.nextInt();
	int C = sc.nextInt();
	if ( A == B && B == C && C == A ) System.out.println("Yes");
	else System.out.println("No");
    }
}


Measured memory_bytes: 23892
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n, m, x, y = 0, z = 0, h, w, ans = 0, sum = 0, Max = -1, Min = 1e9+1;
  string s, t, u;
  bool ok=true;
  cin >> n >> s;
  if(n>=s.size())
    pri(s);
  else
    pri(s.substr(0,n)+"...");
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define debug if (1)

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define pb push_back

ll k, n, q, r;

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

    cin >> k;

    if (k >= 50) {
        n = 50;

        q = k/n - 1;
        r = k%n;

        cout << n << endl;
        for (int i = 0; i < n; i++) {
            ll x;
            if (i < r) {
                x = n + q + 1;
            } else {
                x = n + q - r;
            }
            cout << x << " ";
        }
        cout << endl;
    } else if (k >= 2) {
        cout << k << endl;
        for (int i = 0; i < k; i++)
            cout << k << " ";
        cout << endl;
    } else if (k == 1) {
        cout << "2\n2 0" << endl;
    } else {
        cout << "2\n0 0" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin>>N>>S;
  vector<int> left(N),right(N);
  left[0]=0;right[N-1]=0;
  for(int i=1;i<N;i++){
    left[i]=left[i-1]+(S[i-1]=='W');
  }
  for(int i=N-2;i>=0;i--){
    right[i]=right[i+1]+(S[i+1]=='E');
  }
  int ans=INF;
  for(int i=0;i<N;i++){
    //cout<<i<<" "<<left[i]<<" "<<right[i]<<endl;
    ans=min(ans,left[i]+right[i]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2964
import math

def move(dig):
    rad = math.radians(dig)
    x = math.cos(rad)
    y = math.sin(rad)
    return x,y

def run():
    x, y = 0,0
    dig = 90
    while True:
        r, d = map(int, input().split(','))
        d = -d
        if r == 0 and d == 0:
            break
        _x, _y = move(dig)
        dig += d
        x += r * _x
        y += r * _y

    print(int(x))
    print(int(y))

if __name__ == '__main__':
    run()




Measured memory_bytes: 5716
//Author: AnandRaj uux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{
	ll x;
	cin>>x;
	x=x-x%5;
	cout<<1000*(x/500)+((x%500)/5)*5<<endl;
}		

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
using namespace std;
int main(){
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x - a) % b << endl;
	return 0;
}

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

int main(void)
{
    int n;

    scanf("%d", &n);

    if (n % 10 == 3)
    {
        printf("bon");
        return 0;
    }
    else if (n % 10 == 0)
    {
        printf("pon");
        return 0;
    }
    else if (n % 10 == 1)
    {
        printf("pon");
        return 0;
    }
    else if (n % 10 == 6)
    {
        printf("pon");
        return 0;
    }
    else if (n % 10 == 8)
    {
        printf("pon");
        return 0;
    }
    else
    {
        printf("hon");
    }

    return 0;
}

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

int min(int a,int b){
	return (a<b)?a:b;
}

int main(){
	int a,b,k;
	cin>>a>>b>>k;
	int cnt=0;
	for(int i=min(a,b);i>=0;i--){
		if(a%i==0&&b%i==0){
			cnt++;
		}
		if(cnt==k){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

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

int main(){
  int i,N,K,a[200000],max=0,ans=0;
  char ss[10000];
  for(i=0;i<3;i++){
    scanf("%d",&a[i]);
    ans+=a[i];
    if(max<a[i])max=a[i];
  }
  ans-=max;
  printf("%d\n",ans);
  

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define double long double
#define minheapair priority_queue<pair<int,int>, vector<pair<int,int>> , greater<pair<int,int>> >
#define maxheapair priority_queue<pair<int,int>>
#define minheap priority_queue<int,vector<int>,greater<int>>
#define vi vector<int>
#define vpi vector<pair<int,int> >
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define msi map<string,int>
#define set set<int>
#define u_set unordered_set<int>
#define pb push_back
#define endl "\n"
#define ll long long int
#define vll vector<long long int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define umap unordered_map
#define mod 1000000007
#define fori(a,n) for(int i=a;i<n;i++)
#define forj(a,n) for(int j=a;j<n;j++)
// #define MAX 300303
#define V vector
#define inf 9219999999999999999
using namespace std;
//  inline bool operator<(const data& lhs, const data& rhs)
//  {
//      if(lhs.val< rhs.val)return 1;
//      return 0;
//  }
// inline bool operator>(const data& lhs, const data& rhs)
//  {
//      if(lhs.val > rhs.val)return 1;
//      return 0;
//  }
ll modexp(ll x,ll y,ll m){
    ll ans = 1;
    while(y>0){
        if(y&1){
            ans *= x;
            ans %= m;
            --y;
        }
        else{
            y /= 2;
            x *= x;
            x %= m;
        }
    }
    return ans;
}
ll minv(ll a,ll m){
    return modexp(a,m-2,m);
}
void Z(string s,vector<int>&z){
    int L = 0, R = 0;
    int n = s.size();
    for (int i = 1; i < n; i++) 
    {
        if (i > R) 
        {
            L = R = i;
            while (R < n && s[R-L] == s[R]) 
            {
                R++;
            }
            z[i] = R-L; 
            R--;
        } 
        else 
        {
            int k = i-L;
            if (z[k] < R-i+1) 
            {
                z[i] = z[k];
            } 
            else 
            {
                L = i;
                while (R < n && s[R-L] == s[R]) 
                {
                    R++;
                }
                z[i] = R-L; 
                R--;
            }
        }
    }
}

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
class comp{
    public:
    bool operator () (pair<ll,ll>a,pair<ll,ll>b){return 1LL*a.first*a.second <= 1LL*b.first*b.second;}
};
using namespace std;

int main() {
    io
    int tt = 1;
    // cin>>tt;
    while(tt--){
        ll n,x,t;cin>>n>>x>>t;
        n%x==0?cout<<t*(n/x):cout<<t*(n/x + 1);
        cout<<endl;
    }
}
/*
1                                 
7  
1 2
1 3  
2 4
2 5
3 6
3 7
0010010
*/










Measured memory_bytes: 3648
#define _GLIBCXX_DEBUG
#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 rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

const int MAX=200001; //nCrのnのMAX+1
ll fac[MAX],finv[MAX],inv[MAX];

void cominit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<MAX;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
ll com(int n,int k){
  if (n<k) return 0;
  if (n<0||k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
//Add cominit(); in main function.

int main(){
  cominit();
  int n,k; cin >> n >> k;
  vector<ll> ans(k+1);
  for(int i=1;i<=k;i++){
    ans[i]=com(n-k+1,i)*com(k-1,i-1)%mod;
    ans[i]%=mod;
  }
  for(int i=1;i<=k;i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 4992
use std::io;
use std::collections::BTreeMap;

fn f(b: usize, n: usize) -> usize {
    if n < b {
        n
    } else {
        f(b, n / b) + n % b
    }
}

fn main() {
    let n = read_values::<usize>()[0];
    let s = read_values::<usize>()[0];

    if n == s {
        println!("{}", n + 1);
        return;
    }

    for b in 2..400000 {
        if f(b, n) == s {
            println!("{}", b);
            return;
        }
    }

    // x  + y = s
    // bx + y = n
    // => (b-1)x = n - s
    if n <= s {
        println!("-1");
        return;
    }
    let ns = n - s;
    let mut divisors = Vec::new();
    for d in 2..400000 {
        if d * d > ns {
            break;
        }
        if ns % d == 0 {
            divisors.push(d);
            divisors.push(ns / d);
        }
    }
    divisors.push(ns);
    divisors.sort();

    for a in &divisors {
        let b = *a + 1;
        if f(b, n) == s {
            println!("{}", b);
            return;
        }
    }
    println!("-1");
}

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}

fn read_values<T>() -> Vec<T> where T: std::str::FromStr, T::Err: std::fmt::Debug {
    read_line()
        .split(' ')
        .map(|a| a.trim().parse().unwrap())
        .collect()
}

Measured memory_bytes: 4476
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


s = input()

end = len(s)-1
res = 2
while end > 1:
    if end % 2 == 0:
        mid = end // 2
        left = s[:mid]
        right = s[mid:end]
        if left == right:
            res = len(left)
            break
        else:
            end -= 1
    else:
        end -= 1
print(res+res)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <cctype>
using namespace std;

int main(){
	int i=0;
	int num[26]={0};
	char cha;
	string str;
	int k =0;
	while(k<1000){
		k++;
		i=0;
		getline(cin, str);
		while(cha = str[i]){
			if(cha == 'a'||cha == 'A'){
				num[0] += 1;
			}else if(cha == 'b'||cha == 'B'){
				num[1] += 1;
			}else if(cha == 'c'||cha == 'C'){
				num[2] += 1;
			}else if(cha == 'd'||cha == 'D'){
				num[3] += 1;
			}else if(cha == 'e'||cha == 'E'){
				num[4] += 1;
			}else if(cha == 'f'||cha == 'F'){
				num[5] += 1;
			}else if(cha == 'g'||cha == 'G'){
				num[6] += 1;
			}else if(cha == 'h'||cha == 'H'){
				num[7] += 1;
			}else if(cha == 'i'||cha == 'I'){
				num[8] += 1;
			}else if(cha == 'j'||cha == 'J'){
				num[9] += 1;
			}else if(cha == 'k'||cha == 'K'){
				num[10] += 1;
			}else if(cha == 'l'||cha == 'l'){
				num[11] += 1;
			}else if(cha == 'm'||cha == 'M'){
				num[12] += 1;
			}else if(cha == 'n'||cha == 'N'){
				num[13] += 1;
			}else if(cha == 'o'||cha == 'O'){
				num[14] += 1;
			}else if(cha == 'p'||cha == 'P'){
				num[15] += 1;
			}else if(cha == 'q'||cha == 'Q'){
				num[16] += 1;
			}else if(cha == 'r'||cha == 'R'){
				num[17] += 1;
			}else if(cha == 's'||cha == 'S'){
				num[18] += 1;
			}else if(cha == 't'||cha == 'T'){
				num[19] += 1;
			}else if(cha == 'u'||cha == 'U'){
				num[20] += 1;
			}else if(cha == 'v'||cha == 'V'){
				num[21] += 1;
			}else if(cha == 'w'||cha == 'W'){
				num[22] += 1;
			}else if(cha == 'x'||cha == 'X'){
				num[23] += 1;
			}else if(cha == 'y'||cha == 'Y'){
				num[24] += 1;
			}else if(cha == 'z'||cha == 'Z'){
				num[25] += 1;
			}
			i++;
		}

	}

	cout << "a : " << num[0] << endl;
	cout << "b : " << num[1] << endl;
	cout << "c : " << num[2] << endl;
	cout << "d : " << num[3] << endl;
	cout << "e : " << num[4] << endl;
	cout << "f : " << num[5] << endl;
	cout << "g : " << num[6] << endl;
	cout << "h : " << num[7] << endl;
	cout << "i : " << num[8] << endl;
	cout << "j : " << num[9] << endl;
	cout << "k : " << num[10] << endl;
	cout << "l : " << num[11] << endl;
	cout << "m : " << num[12] << endl;
	cout << "n : " << num[13] << endl;
	cout << "o : " << num[14] << endl;
	cout << "p : " << num[15] << endl;
	cout << "q : " << num[16] << endl;
	cout << "r : " << num[17] << endl;
	cout << "s : " << num[18] << endl;
	cout << "t : " << num[19] << endl;
	cout << "u : " << num[20] << endl;
	cout << "v : " << num[21] << endl;
	cout << "w : " << num[22] << endl;
	cout << "x : " << num[23] << endl;
	cout << "y : " << num[24] << endl;
	cout << "z : " << num[25] << endl;
	return 0;
}

Measured memory_bytes: 1184
#include <iostream>
using namespace std;
int main(void){
   int S,h,m,s;
   cin>>S;
   h=S/3600;
   m=(S%3600)/60;
   s=(S%3600)%60;
   cout<<h;
   cout<<":";
   cout<<m;
   cout<<":";
   cout<<s;
   cout<<endl;
}


Measured memory_bytes: 3088
#include <iostream>
#include <vector>

int max(std::vector<int> &a)
{
    if (a.size()==0) return 0;
    int m=a[0];
    for (int i=1; i<a.size(); i++)
        if (a[i]>m) m=a[i];
    return m;
}

int main()
{
    int k,n;
    std::cin>>k>>n;
    std::vector<int> a(n);
    for (int i=0; i<n; i++)
        std::cin>>a[i];
    std::vector<int> v;
    for (int i=1; i<n; i++)
        v.push_back(a[i]-a[i-1]);
    v.push_back(k-a[n-1]+a[0]);
    std::cout<<k-max(v);
    return 0;
}


Measured memory_bytes: 5080
# -*- coding: utf-8 -*-
s = input()
k = int(input())

if len(s)==1:
    print(s[0])
elif k==1:
    print(s[0])
else:
    cnt = 0
    idx = 0
    for c in list(s):
        idx += 1
        if c=="1":
            cnt += 1
        else:
            break
    if k<=cnt:
        print(1)
    else:
        print(s[idx-1])


Measured memory_bytes: 3060
import math

N = int(input())
T, A = [int(i) for i in input().split()]

diff_min = 999999999
diff_i = 0
H = [int(i) for i in input().split()]
for i, n in enumerate(H):
    diff = math.fabs(A - (T - 0.006*n))
    if diff < diff_min:
        diff_min = diff
        diff_i = i + 1

print(diff_i)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline bool isprime(i32 n) { if (n < 2) return 0; for (i32 i = 2; i * i <= n; i++) if (n % i == 0) return 0; return 1; }
inline vi32 plist(i32 n) { vi32 f(n, 1); f[0] = f[1] = 0; repi(i, 2, n) for (int j = i * 2; j < n; j += i) f[j] = 0; return f; }
inline void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
template<class T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<class T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<class T> inline bool amax(T &x, T y) { if (x >= y) return 0; x = y; return 1; }
template<class T> inline bool amin(T &x, T y) { if (x <= y) return 0; x = y; return 1; }
template<class T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }

template<class T> struct flow {
  struct edge {
    int to;
    T cap;
    int rev;
  };

  int n, s, t;
  vector<vector<edge>> g;
  vector<bool> used;

  flow(int n, int s, int t) : n(n), s(s), t(t) {
    g = vector<vector<edge>>(n);
  }

  void add(int from, int to, T cap) {
    g[from].push_back({ to, cap, (int) g[to].size() });
    g[to].push_back({ from, 0, (int) g[from].size() - 1 });
  }

  T dfs(int v, T f) {
    if (v == t) {
      return f;
    }
    used[v] = true;
    for (auto &e : g[v]) {
      if (used[e.to] || e.cap <= 0) {
        continue;
      }
      T d = dfs(e.to, min(f, e.cap));
      if (d > 0) {
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
      }
    }
    return 0;
  }

  T max_flow() {
    T sum = 0;
    while (true) {
      used = vector<bool>(n);
      T f = dfs(s, numeric_limits<T>::max());
      if (f == 0) {
        break;
      }
      sum += f;
    }
    return sum;
  }
};

int main() {
  ioinit();
  int v, e;
  cin >> v >> e;
  auto f = flow<i32>(v, 0, v - 1);
  rep(i, e) {
    int u, v, c;
    cin >> u >> v >> c;
    f.add(u, v, c);
  }
  cout << f.max_flow() << '\n';
  return 0;
}



Measured memory_bytes: 3236
#include <iterator>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <algorithm>
using namespace std; typedef long long ll; typedef pair<ll,ll> P; const ll INF = 1e15;
int main() {
  ll a,b,c; cin>>a>>b>>c;
  if (c-a-b<0) {
    cout<<"No"<<endl;
    return 0;
  }
  if (4*a*b < (c-a-b)*(c-a-b)) {
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
int main() {
	
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int Y, M,D;

	scanf("%d %d %d", &Y, &M,&D);
	//20190430까진 Heisei, 그이상부터 TBD
	if (M/Y >= D) {
		printf("%d",D);
	}
	else if (M / Y < D) {
		printf("%d",M/Y);
	}
	
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <utility>
#include <queue>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second

queue<int> q;
vector<int> veki[100003];
int bio[100003];

int main () {
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		veki[a].push_back(b);
		veki[b].push_back(a);
	}
	int br=0;
	for(int i=1;i<=n;i++){
		if(bio[i]) continue;
		else{
			br++;
			q.push(i);
			bio[i]=1;
			while(!q.empty()){
				int f=q.front();
				q.pop();
				for(int j=0;j<veki[f].size();j++){
					if(bio[veki[f][j]]) continue;
					bio[veki[f][j]]=1;
					q.push(veki[f][j]);
				}
			}
		}
	}
	cout<<br-1;



return 0;
}



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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

vector<int> primes;
bool isNotPrime[1300100];

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

    primes.emplace_back(2);
    for(int i=3;i<=1300000;i+=2){
        if(!isNotPrime[i]){
            primes.emplace_back(i);

            for(int j=2*i;j<=1300000;j+=i){
                isNotPrime[j] = true;
            }
        }
    }

    while(true){
        int N;
        std::cin >> N;
        if(!N){break;}
    
        auto it = lower_bound(primes.begin(), primes.end(), N);

        if(*it == N){
            std::cout << 0 << std::endl;
        }else{
            std::cout << (*it - *(it - 1)) << std::endl;
        }
    }
}



Measured memory_bytes: 4556
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve()
{
    int x, y;
    cin >> x >> y;
    int gidx = 0, gidy = 0;
    if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12)
        gidx = 1;
    if (x == 4 || x == 6 || x == 9 || x == 11)
        gidx = 2;
    if (x == 2)
        gidx = 3;
    if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)
        gidy = 1;
    if (y == 4 || y == 6 || y == 9 || y == 11)
        gidy = 2;
    if (y == 2)
        gidy = 3;
    if (gidx == gidy)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

Measured memory_bytes: 3628
#include <iostream>
#include <cstring>

using namespace std;

bool search(char *S, char c) {
  for (int i = 0; i < strlen(S); i++) {
    if (S[i] == c) return true;
  }
  return false;
}

int main() {
  char S[100001];
  cin >> S;
  char c;
  for (c = 'a'; c <= 'z'; c++) {
    if (!search(S, c)) {
      cout << c << endl;
      return 0;
    }
  }
  if (c > 'z') {
    cout << "None\n";
  }

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

int main(){
    string num; cin >> num;
    cout << "ABC" << num << endl;

    return 0;
}


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

int main(){
	int N; cin>>N;
	int all = 0, maxi = 0;
	for(int i=0; i<N; ++i){
		int l; cin>>l;
		all += l;
		maxi = max(maxi, l);
	}
	cout<< (maxi<all-maxi? "Yes":"No") <<endl;
}

Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
s = h.times.map {gets.chomp}

v = Array.new(h) {Array.new(w, false)}
ans = 0
h.times do |i|
    w.times do |j|
        next if v[i][j] || s[i][j] == ?.

        que = [[i, j]]
        all = 0
        black = 0
        while now = que.shift
            x, y = now
            next if v[x][y]

            v[x][y] = true
            all += 1
            black += 1 if s[x][y] == ?#

            que << [x-1, y] if x > 0 && s[x][y] != s[x-1][y]
            que << [x+1, y] if x < h-1 && s[x][y] != s[x+1][y]
            que << [x, y-1] if y > 0 && s[x][y] != s[x][y-1]
            que << [x, y+1] if y < w-1 && s[x][y] != s[x][y+1]
        end
        
        ans += (all - black) * black
    end
end

p ans

Measured memory_bytes: 4220
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin>>N>>K;
    char s;
    vector<int>v;
    int count=0;
    bool flag=false;//trueなら0
    for(int i=0;i<N;i++){
        cin>>s;
        if(flag==true){
            if(s=='0'){count++;}
            else{v.pb(count);flag=false;count=1;}
        }
        else{
            if(s=='1'){count++;}
            else{v.pb(count);flag=true;count=1;}
        }
    }
    v.pb(count);
    if(flag==true){v.pb(0);}
    vector<int>num;
    int sum=0;
    for(int i=0;i+2*K<v.size();i+=2){
        sum=0;
        for(int j=0;j<2*K+1;j++){
            sum+=v[i+j];
        }
        num.pb(sum);
    }
    if(num.empty()){cout<<N<<endl;exit(0);}
    sort(ALL(num),greater<int>());
    cout<<num[0]<<endl;
}

Measured memory_bytes: 1144
def main():
    N = int(input())
    A = []
    for i in range(N - 1):
        A.append(list(map(int, input().split())))

    r = []
    for i, ai in enumerate(A):
        c, s, f = ai
        # print('csf', c, s, f)
        x = s + c
        for ci, si, fi in A[i+1:]:
            # print('ci,si,fi', ci, si, fi)
            if x < si:
                x = si
            while x % fi != 0:
                x += 1
            x += ci
        r.append(x)
        x = 0
    r.append(0)

    # print(r)
    for ri in r:
        print(ri)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
# coding: utf-8
# Your code here!

import re

S = input()

# print(S)

# content = r'hellow python, 123, end.' 
content = S

# pattern = 'hel'
pattern = '^YAKI'

# result = re.match(pattern, content)

# print(result)


if re.match(pattern, content):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3188
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

int main()
{
    int K,N,ans=0,maxi=0;
    cin>>K>>N;
    vector<int>A(N);
    for(int i=0;i<N;i++){
    	cin>>A[i];
    	if(i!=0)maxi=max(A[i]-A[i-1],maxi);
    }
    maxi=max(maxi,A[0]+K-A[N-1]);
    cout<<K-maxi;
    
}


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

template <class T>
inline vector<T> vec(size_t n, T a) {
  return vector<T>(n, a);
}

template <class T>
void set_if_greater(T& a, T b) {
  if (a < b) a = b;
}

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  auto m = vec(h + 1, vec(w + 1, 0ll));
  while (k--) {
    ll y, x, e;
    cin >> y >> x >> e;
    m[y][x] = e;
  }

  constexpr int M = 3;
  auto dp = vec(h + 1, vec(w + 1, vec(M + 1, 0ll)));
  for (int y = 1; y <= h; y++) {
    for (int x = 1; x <= w; x++) {
      for (int i = 0; i <= M; i++) {
        set_if_greater(dp[y][x][0], dp[y - 1][x][i]);
        set_if_greater(dp[y][x][i], dp[y][x - 1][i]);
        set_if_greater(dp[y][x][1], dp[y - 1][x][i] + m[y][x]);
        if (i < M) set_if_greater(dp[y][x][i + 1], dp[y][x - 1][i] + m[y][x]);
      }
    }
  }
  cout << *max_element(dp[h][w].begin(), dp[h][w].end()) << endl;
}


Measured memory_bytes: 706496
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;

int main(void) 
{
    int x;
    cin >> x;

    if (x>=30) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

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

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

using namespace std;

int main(){
	int n; cin>>n;
	string s[100];
	rep(i,n) cin>>s[i];

	bool ok=true;
	rep(i,n) rep(j,i) if(s[i]==s[j]) ok=false;
	rep(i,n-1) if(s[i].back()!=s[i+1].front()) ok=false;
	cout<<(ok?"Yes":"No")<<endl;

	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    string s;
    cin >> s;

    int ans = 700;
    rep(i,3){
        if(s[i] == 'o') ans += 100;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import copy
h, w, x = map(int, input().split())
c = [list(input()) for i in range(h)]

ans = 0
for i in range(2 ** (h + w)):
    d = copy.deepcopy(c)
    for j in range(h + w):
        if i >> j & 1:
            if 0 <= j < h:
                for k in range(w):
                    d[j][k] = "."
            else:
                for k in range(h):
                    d[k][j - h] = "."
    #print(d)
    cnt = 0
    for l in range(h):
        cnt += d[l].count("#")
    if cnt == x:
        ans += 1

print(ans)
    


Measured memory_bytes: 71560
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for(long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for(long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                                                            \
    (upper_bound((V).begin(), (V).end(), X) -                                  \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                                                               \
    {                                                                          \
        cerr << #v << ':';                                                     \
        for(auto xv : v) cerr << xv << ' ';                                    \
        cerr << endl;                                                          \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
    if(a > b) a = b;
    return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
    if(a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* liblary */

/* main */

signed main() {
    string S;
    cin >> S;
    ll a = stoi(S.substr(0, 2));
    ll b = stoi(S.substr(2, 2));
    bool mm, mm2;
    mm = 1 <= a && a <= 12;
    mm2 = 1 <= b && b <= 12;
    if(mm && mm2)
        cout << "AMBIGUOUS" << endl;
    else if(mm)
        cout << "MMYY" << endl;
    else if(mm2)
        cout << "YYMM" << endl;
    else
        cout << "NA" << endl;
}

Measured memory_bytes: 256
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	string s; cin >> s;
	int res = 0;
	string acgt = "ACGT";
	rep(i, s.size())
	{
		int cnt = 0;
		if (acgt.find(s[i]) != string::npos)
		{
			++cnt;
			while (i + 1 < s.size() && acgt.find(s[i + 1]) != string::npos)
			{
				++cnt;
				++i;
			}
		}
		res = max(res, cnt);
	}
	cout << res << endl;
}

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

#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define debg(a) cout<<#a<<":"<<a<<endl;
#define vint vector<signed>
#define all(a) a.begin(),a.end()
#define pb(a) push_back((a))
#define yn(a) cout<<((a)?"Yes":"No")<<endl;
#define YN(a) cout<<((a)?"YES":"NO")<<endl;

signed main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  vint ans;
  if(a+b>2*c){
    if(x==y)ans.pb(2*c*x);
    else if(x>y)ans.pb(2*c*y+a*(x-y));
    else ans.pb(2*c*x+b*(y-x));
  }
  ans.pb(a*x+b*y);
  ans.pb(2*c*max(x,y));
  sort(all(ans));
  cout<<ans[0];
  
  return 0;
}


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

int bubbleSort(int arr[], int N) {
    int sw=0;
    bool flag=1;
    for (int i=0; flag; i++) {
        flag=0;
        for (int j=N-1; j>=i+1; j--) {
            if (arr[j-1] > arr[j]) {
                swap(arr[j-1], arr[j]);
                flag=1;
                sw++;
            }
        }
    }
    return sw;
}

int main() {
    int arr[100], N, sw;
    cin >> N;
    for (int i=0; i<N; i++) {
        cin >> arr[i];
    }
sw=bubbleSort(arr, N);

for (int i=0; i<N; i++) {
    if (i) cout << " ";
    cout << arr[i];
}

cout << "\n";
cout << sw << endl;

return 0;
}


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {
	static Scanner scn = new Scanner(System.in);

	public static void main(String[] args) {
		int k = scn.nextInt(), n = scn.nextInt(), temp = 0, sum = 0;
		int[] arr = new int[n + 1];
		for (int i = 1; i < n + 1; i++) {
			temp = scn.nextInt();
			arr[i] = temp - sum;
			sum += arr[i];
		}
		int min = temp - arr[1];
		for (int i = 2; i <= n - 1; i++) {
			min = Integer.min(min, Integer.min(k - arr[i + 1], k - arr[i - 1]));
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 84248
#include <bits/stdc++.h>
#define gcj "Case #"
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

ll pow1(ll a, ll b, ll m = mod)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2, m);
		x *= x;
		x %= m;
		if (b%2)
		{
			x *= a;
			x %= m;
		}
		return x;
	}
}

template <class avgType>
avgType avg(avgType a, avgType b) {
	return (a + b)/2;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());

int randInt() {
	return rng() % INT_MAX;
}

ll randLL() {
	return rng64() % LLONG_MAX;
}

vector< int > hashmods = {1000000007, 1000000009, 1000000021, 1000000033, 1000000087, 1000000093};

int n, a[3100], vis[2][3100][3100];
ll dp[2][3100][3100];

ll solve(int mode, int x, int y) {
	if (vis[mode][x][y])
		return dp[mode][x][y];
	vis[mode][x][y] = 1;
	if (x > y)
		return 0;
	if (mode == 1)
		dp[mode][x][y] = max(a[x] + solve(0, x+1, y), a[y] + solve(0, x, y-1));
	else
		dp[mode][x][y] = min(-a[x] + solve(1, x+1, y), -a[y] + solve(1, x, y-1));

	return dp[mode][x][y];
}

int main() {
	fastio;
	memset(vis, 0, sizeof(vis));
	cin>>n;
	for (int i = 1; i <= n; i++)
		cin>>a[i];

	ll ans = solve(1, 1, n);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 225792
n = int(input())
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)

for i in range(n-1):
    c[i],s[i],f[i] = map(int,input().split())

## x 以上の最小の　y の倍数
def ceil(x,y):
    if x % y == 0:
        return x
    else:
        return (x//y+1)*y

for i in range(n):
    t = 0
    for j in range(i,n-1):
        t = max(ceil(t,f[j]),s[j])+c[j]
    print(t)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
    int d;
    cin >> d;
    if (d == 25) cout << "Christmas" << endl;
    else if (d == 24) cout << "Christmas Eve" << endl;
    else if (d == 23) cout << "Christmas Eve Eve" << endl;
    else if (d == 22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int n,cnt=0;
int main(void){
    cin>>n;
    n<<=1;
    int a[n];
    for(auto& i:a)cin>>i;
    sort(a,a+n);
    for(int i=-2;(i+=2)-n;)cnt+=a[i];
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 384