akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  int mx = n/2;
  rep(i, m){
    int a, b;
    a = i + 1;
    if(n % 2 == 1){
      b = n - i;
    }else{
      if(a <= mx/2){
        b = n-i;
      }else{
        b = n - i - 1;
      }
    }
    cout << a << " " << b << endl;
  }
  return 0;
}

Measured memory_bytes: 3652
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}

long long bigmod(long long b,long long p,long long m)
{
    if(p==0)return 1;

    if(p%2==1){
        long long part1=b%m;
        long long part2=bigmod(b,p-1,m);

        return (part1*part2)%m;
    }
    else if(p%2==0)
    {
        long long half=bigmod(b,p/2,m);

        return (half*half)%m;
    }
}

ll n;

string str;

ll call(ll i)
{
    if(i==n)
    {
        if(str[i]=='1')return 3;

        else return 1;
    }

    if(str[i]=='0')
        return call(i+1)%Mod;

    return (bigmod(3,n-i,Mod)+(2*call(i+1))%Mod)%Mod;


}
int main()
{

   fastread();


      bool flag=false;


      cin>>str;

      n=str.size()-1;

      cout<<call(0)<<endl;













}



Measured memory_bytes: 5292
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll ar[51];
ll  n,c,i,j,l;
ll dp[2510][51][51];
ll fun(ll sum,ll cnt,ll pos)
{
    if(pos==n)
    {
        if(sum>0)
        {
            if(sum%cnt==0&&sum/cnt==c)return 1;
            else return 0;
        }
        return 0;
    }
    if(dp[sum][cnt][pos]!=-1)return dp[sum][cnt][pos];
    dp[sum][cnt][pos]=fun(sum+ar[pos],cnt+1,pos+1)+fun(sum,cnt,pos+1);

    return dp[sum][cnt][pos];
}


int main()
{
    while(cin>>n>>c)
    {


        for(i=0; i<n; i++)
        {
            cin>>ar[i];
        }
            memset(dp,-1,sizeof(dp));
            cout<<fun(0,0,0);


    }
    return 0;

}


Measured memory_bytes: 51200
#include<stdio.h>
#define MAX 100
#define INFTY 300000
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int n,T[MAX][MAX];
 
void dijkstra(){
  int minv,i,v,u;
  int d[MAX],color[MAX];
 
  for(i=0;i<n;i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }
 
  d[0] = 0;
  color[0] = GRAY;
  
  while(1){
    minv = INFTY;
    u = -1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    
    if(u == -1)break;
    color[u] = BLACK;
    
    for(v=0;v<n;v++){
      if(color[v] != BLACK && T[u][v] != INFTY){
	if(d[v]>d[u]+T[u][v]){
	  d[v] = d[u] + T[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }
  
  for(i=0;i<n;i++){
    printf("%d",i);
    printf(" ");
    d[i]= (d[i] == INFTY) ? -1 : d[i];
    printf("%d\n",d[i]);
  }
}
 
int main(){
  int i,j,k,c,u,v;
 
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      T[i][j] = INFTY;
    }
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      T[u][v] = c;
    }
  }
  
  dijkstra();
 
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));

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

    int h,w;
    cin >> h >> w;
    vector<string> ss(h);
    rep(i,h){
        cin >> ss[i];
    }
    vector<vector<int>> ans(h+1,vector<int> (w+1,0));
    rep(i,h)rep(j,w){
        if(ss[i][j] == '#'){
            if(i==0){
                if(j == 0){
                    ans[i+1][j]++;
                    ans[i+1][j+1]++;
                    ans[i][j+1]++;
                }else {
                    ans[i][j-1]++;
                    ans[i][j+1]++;
                    ans[i+1][j-1]++;
                    ans[i+1][j]++;
                    ans[i+1][j+1]++;
                }
            }else if(j==0){
                if(i == 0){
                    ans[i][j+1]++;
                    ans[i+1][j]++;
                    ans[i+1][j+1]++;
                }else {
                    ans[i-1][j]++;
                    ans[i][j+1]++;
                    ans[i+1][j]++;
                    ans[i+1][j+1]++;
                    ans[i-1][j+1]++;
                }
            }else if(i==h-1){
                ans[i-1][j-1]++;
                ans[i-1][j]++;
                ans[i-1][j+1]++;
                ans[i][j-1]++;
                ans[i][j+1]++;
            }else if(j==w-1){
                ans[i-1][j-1]++;
                ans[i-1][j]++;
                ans[i][j-1]++;
                ans[i+1][j-1]++;
                ans[i+1][j]++;

            }else{
                ans[i-1][j-1]++;
                ans[i-1][j]++;
                ans[i-1][j+1]++;
                ans[i][j-1]++;
                ans[i][j+1]++;
                ans[i+1][j-1]++;
                ans[i+1][j]++;
                ans[i+1][j+1]++;   
            }
        }
    }
    rep(i,h){
        rep(j,w){
            if(ss[i][j] == '#'){
                cout << '#';
            }
            else cout << ans[i][j];
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
  long long N,H;
  std::cin >> N >> H;

  std::vector<long long> b_arr(N);
  long long max_a = 0;

  for(int i = 0; i < N; i++){
    long long a;
    std::cin >> a >> b_arr[i];
    max_a = std::max(max_a, a);
  }

  std::sort(b_arr.rbegin(), b_arr.rend());

  long long ncount = 0;
  for(auto&& b: b_arr){
    if(b <= max_a) break;
    H -= b;
    ncount++;
    if(H <= 0){
      std::cout << ncount << std::endl;
      return 0;
    }
  }

  std::cout << ncount+(H+max_a-1)/max_a << std::endl;

  return 0;
}



Measured memory_bytes: 1024
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<stw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;

int main(void){
    string S;cin>>S;
    if(S.length()%2==1){
        cout << "No" << endl;
    }else{
    for(int i=1;i<=S.length();i++){
        if(i%2==1){
            if(S[i-1]!='h'){
                cout << "No" << endl;
                break;
            }
        }else{
            if(S[i-1]!='i'){
                cout << "No" << endl;
                break;
            }
        }
        if(i==S.length()){
            cout << "Yes" << endl;
        }
    }
    }
    return 0;
}

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

int main(void)
{
  int N;
  std::cin >> N;

  int64_t num;
  std::vector<int64_t> L;

  L.push_back(2L);
  L.push_back(1L);

  if (N == 1) {
  }
  else {
    for (int i = 2; i <= N; i++) {
      num = L.at(i-1) + L.at(i-2);
      L.push_back(num);
    }
  }
  
  std::cout << L.at(N) << std::endl;
}

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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
  ll i, o, t, j, l, s, z;
  cin >> i >> o >> t >> j >> l >> s >> z;
  ll ans = o;
  ll x = 0, y = 0;
  if(i>0 && j>0 && l>0) x = ((i-1)/2)*2 + ((j-1)/2)*2 + ((l-1)/2)*2 + 3;
  y = (i/2)*2 + (j/2)*2 + (l/2)*2;
  ans += (x>y?x:y);
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100001
int n;
int A[N];
int num[N];
char B[N];
int Partition(int, int);
void Quick_Sort(int, int);
int main(){
    int i;
    int p;
    int tmp=1;
    int r;
    scanf("%d\n", &n);
    for( i=0; i<n; i++ ){
        scanf("%c %d\n", &B[i],&A[i]);
        num[i]=i+1;
    }
    p=0;
    r=n-1;
    Quick_Sort(p, r);
    for( i=1; i<n; i++ ){
        if( A[i] == A[i-1] && num[i] < num[i-1] ){
            tmp = 0;
            break;
        }
    }
    if( tmp == 1 )printf("Stable\n");
    else if( tmp == 0 ) printf("Not stable\n");
    for( i=0; i<n; i++ ) printf("%c %d\n",B[i], A[i]);
    return 0;
}
int Partition(int p, int r){
    int i;
    int j;
    int tmp1;
    int tmp3;
    char tmp2;
    int x;
    x=A[r];
    i=p-1;
    for( j=p; j<=r-1; j++ ){
        if( A[j] <= x ){
            i++;
            tmp1=A[j];
            A[j]=A[i];
            A[i]=tmp1;
 
            tmp2=B[j];
            B[j]=B[i];
            B[i]=tmp2;
 
            tmp3 = num[j];
            num[j]=num[i];
            num[i]=tmp3;
        }
    }
    tmp1=A[r];
    A[r]=A[i+1];
    A[i+1]=tmp1;
 
    tmp2=B[r];
    B[r]=B[i+1];
    B[i+1]=tmp2;
 
    tmp3=num[r];
    num[r]=num[i+1];
    num[i+1]=tmp3;
    return i+1;
}
void Quick_Sort(int p, int r){
    int q;
    if( p < r ){
        q = Partition(p,r);
        Quick_Sort(p, q-1);
        Quick_Sort(q+1, r);
    }
}

Measured memory_bytes: 1488
S = input()
l = []
ans = ("A", "C", "G", "T")
A = 0
flag = False

for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        l.append(S[i:j])
    
for i in range(len(l)):
    for c in l[i]:
        if c not in ans:
            flag = True
            break
    if flag:
        flag = False
        continue
    A = max(A, len(l[i]))

print(A)

Measured memory_bytes: 38256
n=int(input())
a=list(map(int,input().split()))
d={}
for v in a:
  if v not in d:
    d[v]=0
  d[v]+=1
  
for x in range(n):
  if x+1 not in d:
    print(0)
  else:
    print(d[x+1])

Measured memory_bytes: 114436
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
//////////

void solve(){
  ini(N);
  for(int i = 1 ; i <= 100000 ; i++){
    int j = int(i * 1.08);
    if(N == j) die(i);
  }
  out(":(");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int ocu[n+10];
  int a;
  memset(ocu,0,sizeof(ocu));
  for(int i=0;i<n-1;i++){
    cin>>a;
    ocu[a]++;
  }
  for(int i=1;i<=n;i++){
    cout<<ocu[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 4340
#include<bits/stdc++.h>
std::vector<long long> pwtwo;
std::vector<int> V;
std::map<int,int> M;
int cache[200020];
int main(){
    pwtwo.push_back(1);
    for(int i=1;i<=30;++i) 
        pwtwo.push_back(*(pwtwo.end()-1)*2);
    int n;
    scanf("%d",&n);
    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp); V.push_back(temp);
        if(M.count(temp)>0) ++M[temp];
        else M[temp]=1;
    }
    std::sort(V.begin(),V.end());
    int ans=0;
    for(int i=V.size()-1;i>=0;--i){
        if(M[V[i]]==0) continue;
        int ub = *(std::lower_bound(pwtwo.begin(),pwtwo.end(),V[i]+1));
        int ind = std::lower_bound(V.begin(),V.end(),ub-V[i]) - V.begin();
        //printf("%d, ub: %d, ind: %d\n",V[i],ub,ind);
        if(ind < i && M[V[ind]]>0 && V[ind] == ub-V[i] ){
            //puts("I am in.");
            --M[V[ind]];
            --M[V[i]];
            //printf("M[v[i]] : %d, M[v[ind]] : %d\n",M[V[i]],M[V[ind]]);
            if(M[V[i]]>=0) ++ans;
        }
    }

    printf("%d",ans);
    
}

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

int64_t total = 0;

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

    string S;
    cin >> S;
    int n = S.size();
    int64_t total = 0;
    for (int bit = 0; bit < (1<<(n-1)); bit++) {
        int64_t s = 0;
        int p = 0;
        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                s += stol(S.substr(p, i - p + 1));
                p = i + 1;
            }
        }
        if (p < n) s += stol(S.substr(p));
        total += s;
    }
    
    cout << total << endl;

    return 0;
}


Measured memory_bytes: 256
//四則演算 #pragma GCC target("avx")
//並列計算 #pragma GCC optimize("O3")
//条件分岐を減らす #pragma GCC optimize("unroll-loops")
//浮動小数点演算 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
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(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
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& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; 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...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    ll a, v, b, w, t; cin >> a >> v >> b >> w >> t;
    ll d = abs(a - b);
    d += w * t;
    d -= v * t;
    print(d <= 0 ? "YES" : "NO");

    return 0;
}

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

using namespace std;

typedef long long llint;

const int MAXN = 105;

llint n, w, sol;
llint m[MAXN], val[MAXN];
vector <llint> v[5];

int main () {
    cin >> n >> w;
    for (int i=1; i<=n; i++) {
        cin >> m[i] >> val[i];
        v[m[i] - m[1]].push_back(val[i]);
    }
    for (int i=0; i<4; i++) {
        sort(v[i].begin(), v[i].end());
        v[i].push_back(0);
        reverse(v[i].begin(), v[i].end());
    }
    llint s0 = 0;
    for (int i=0; i<v[0].size(); i++) {
        s0 += v[0] [i];
        llint s1 = 0;
        for (int j=0; j<v[1].size(); j++) {
            s1 += v[1] [j];
            llint s2 = 0;
            for (int k=0; k<v[2].size(); k++) {
                s2 += v[2] [k];
                llint s3 = 0;
                for (int h=0; h<v[3].size(); h++) {
                    s3 += v[3] [h];
                    llint t = i*m[1] + j*(m[1] + 1) + k*(m[1] + 2) + h*(m[1] + 3);
                    if (t > w) continue;
                    llint res = s0 + s1 + s2 + s3;
                    sol = max(sol, res);
                }
            }
        }
    }
    cout << sol;
    return 0;
}


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

int main(){
    int a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (a * 1.0) / b;
    cout << d << " " << r << " " << fixed << setprecision(10) << f << endl;
    return 0;
}


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

const int MAX_N = 100000;

int main() {
  int n, pre, now, ans = 1, dir = 0;
  cin >> n;
  cin >> pre;
  for (int i=0; i<n-1; i++) {
    cin >> now;
    if (dir == -1) {
      if (pre < now) {
        ans++;
        dir = 0;
      }
    } else if (dir == 1) {
      if (now < pre) {
        ans++;
        dir = 0;
      }
    } else {
      if (pre < now) {
        dir = 1;
      } else if (now < pre) {
        dir = -1;
      }
    }
    pre = now;
  }

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

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	
	
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)){
			//Input
			int X=Integer.parseInt(sc.next());
			int A=1;
			while(2*X>A*(A-1)){
				A++;
			}
			System.out.println(A-1);
			
		}
	}
}

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

const int mod = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  int  n = s.size();

  LL dp[100010][4] = {};
  dp[n][0] = dp[n][1] = dp[n][2] = 0;
  dp[n][3] = 1;
  for (int i = n - 1; i >= 0; i --) {
    for (int j = 3; j >= 0; j --) {
      if (s[i] == '?') dp[i][j] = dp[i + 1][j] * 3;
      else dp[i][j] = dp[i + 1][j];

      if (j < 3 && (s[i] == '?' || s[i] == "ABC"[j])) dp[i][j] += dp[i + 1][j + 1];
      dp[i][j] %= mod;
    }
  }

  cout << dp[0][0] << endl;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int[] arr = new int[n];
    	for (int i = 0; i < n; i++) {
    	    arr[i] = sc.nextInt();
    	}
    	int[] sums = new int[n];
    	sums[n - 1] = arr[n - 1];
    	for (int i = n - 2; i >= 0; i--) {
    	    sums[i] = (sums[i + 1] + arr[i]) % MOD;
    	}
    	long total = 0;
    	for (int i = 0; i < n - 1; i++) {
    	    total += (long)arr[i] * sums[i + 1] % MOD;
    	    total %= MOD;
    	}
    	System.out.println(total);
    }
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll X, Y, Z, K;
vector<ll> A, B, C;

signed main()
{
    cin >> X >> Y >> Z >> K;
    A.resize(X);
    B.resize(Y);
    C.resize(Z);
    REP(i, X) { cin >> A[i]; }
    REP(i, Y) { cin >> B[i]; }
    REP(i, Z) { cin >> C[i]; }
    sort(A.begin(), A.end(), greater<ll>());
    sort(B.begin(), B.end(), greater<ll>());
    sort(C.begin(), C.end(), greater<ll>());

    vector<ll> AB;
    // A と B の組み合わせ全パターンを試す
    REP(i, X) {
        REP(j, Y) {
            AB.push_back(A[i] + B[j]);
        }
    }
    sort(AB.begin(), AB.end(), greater<ll>());

    // AB の上位 K 組と C の組み合わせ全パターンを試す
    vector<ll> ans;
    REP(i, min((size_t)K, AB.size())) {
        REP(j, Z) {
            ans.push_back(AB[i] + C[j]);
        }
    }
    sort(ans.begin(), ans.end(), greater<ll>());

    REP(i, K) {
        printf("%lld\n", ans[i]);
    }

    return 0;
}


Measured memory_bytes: 42600
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

vector<int> wei;
vector<int> val;

lli dp[101][100001]; 

lli knapsack(lli n, lli w)
{
	if(n == 0 || w == 0)
		dp[n][w] = 0;
	
	if(dp[n][w] != -1)
		return dp[n][w];

	if(wei[n-1] > w)
		return knapsack(n-1, w);

	lli x1 = val[n-1] + knapsack(n-1, w-wei[n-1]);
	lli x2 = knapsack(n-1, w);

	dp[n][w] = max(x1, x2);
	return dp[n][w];
}

int main()
{
	lli n, w, wi, vi;
	cin >> n >> w;

	for(lli i = 0; i < n; i++)
	{
		cin >> wi >> vi;
		wei.push_back(wi);
		val.push_back(vi);
	}

	for(int i = 0; i < 101; i++)
		for(int j = 0; j < 100001; j++)
			dp[i][j] = -1;

	cout << knapsack(n,w) << endl;
	return 0;
}

Measured memory_bytes: 79104
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i + 100*j + 50*k == x:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e3 + 11;
const int MM = 5e6 + 11;
int n, k, f[N][N];
int fac[MM], inv[MM];
inline int M(int x, int y){
    return 1LL * x * y % mod;
}
inline int A(int x, int y){
    return x + y - (x + y >= mod ? mod : 0);
}
inline int C(int n, int m){
    if(n < m)return 0;
    return M(fac[n], M(inv[m], inv[n-m]));
}
int main(){
    fac[0] = fac[1] = inv[1] = inv[0] = 1;
    for(int i = 2;i <= 5e6; i++){
        fac[i] = M(fac[i-1], i);
        inv[i] = mod - M(mod / i, inv[mod%i]);
    }
    for(int i = 2;i <= 5e6; i++){
        inv[i] = M(inv[i], inv[i-1]);
    }
    cin>>n>>k;
    if(k == 1){
        puts("1");
        return 0;
    }
    for(int i = 1;i <= n; i++){
        f[i][0] = 1;
        for(int j = 1;j <= i; j++){
            f[i][j] = A(f[i-1][j], M(f[i][j-1], C(n * k - i - (k - 1) * (j - 1) - 1, k - 2)));
        }
    }
    printf("%d\n", M(f[n][n], fac[n]));
    return 0;
}


Measured memory_bytes: 55040
a = input()

a = list(a)
b = a[0]+a[1]
c = a[2]+a[3]

b = int(b)
c = int(c)

if c >= 1 and c <= 12 and b >= 1 and b <= 12:
        print("AMBIGUOUS")

elif c >= 1 and c <= 12:
    print("YYMM")

elif b >= 1 and b <= 12:
    print("MMYY")
    
else:
    print('NA')

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

int main(){
    int n;cin >> n;
    bool flag = false;
    rep(i,n){
        int a;cin >> a;
        if(a%2==1) flag = true;
    }
    if(flag) cout << "first" << endl;
    else cout << "second" << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define FORD(i,a,b) for(int i=(a);i>=b;i--)
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
using namespace std;
int a[200005];
int main()
{
	int n,h;
	ll ans=0;
	cin>>h>>n;
	FOR(i,0,n) cin>>a[i],ans+=a[i];
	if(ans>=h)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

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

        int N = sc.nextInt();

        int digitSum = 0;

        int temp = N;
        while(temp != 0){
            digitSum = digitSum + temp % 10;
            temp = temp /10;
        }
        System.out.println( N % digitSum == 0 ? "Yes" : "No");
    }

}


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

int main()
{
    string ct, ch;
    int n, st=0, sh=0;
    
    cin >> n;

    for(int i=0;i<n;i++)
    {
        cin >> ct >> ch;
        for(int j=0;;j++)
        {
            if(ct[j] > ch[j]) {
                st += 3;
                break;
            } else if(ct[j] < ch[j]) {
                sh += 3;
                break;
            }
            if(j+1 == ct.size() && j+1 < ch.size())
            {
                sh += 3;
                break;
            } else if(j+1 < ct.size() && j+1 == ch.size()) {
                st += 3;
                break;
            } else if((j+1 == ct.size() && j+1 == ch.size())) {
                st += 1;
                sh += 1;
                break;
            }
        }
    }
    cout << st << " " << sh << endl;
    return 0;
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n;

  string ans;
  cin >> n;
  n %= 10;

  if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
    ans = "hon";
  else if (n == 0 || n == 1 || n == 6 || n == 8)
    ans = "pon";
  else
    ans = "bon";

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


Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		x--;
		a[x] = i;
	}
	int ans = 1, cnt = 1;
	for (int i = 0; i < n - 1; i++) {
		if (a[i] < a[i + 1]) cnt++;
		else cnt = 1;
		ans = max(ans, cnt);
	}
	cout << n - ans << endl;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())						# 5
A =        list( map(int, input().split()) )	# 1 2 3 4 5 ...

A.sort()
maxA = A[-1]
X = [0]*(maxA+1)


for a in A:
  for i in range(1,maxA+1):
    x = a*i
    if x > maxA: break
    X[x] += 1

ans = 0
for a in A:
  if X[a]==1: ans+=1

print(ans)
# print(A)
# print(X)



Measured memory_bytes: 32068
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    i64 N, H;
    read(H, N);
    rep(i, N) {
        i64 a ;read(a);
        H -= a;
    }

    print((H <= 0) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args){
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		String s;
		int t;
		int n=0;
		try{
			while((s=reader.readLine()) !=null){
				t=Integer.parseInt(s);
				for(int a=0;a<10;a++){
					for(int b=0;b<10;b++){
						for(int c=0;c<10;c++){
							for(int d=0;d<10;d++){
								if((a+b+c+d) == t){
										n += 1;
								}
							}
						}
					}
				}
				System.out.println(n);
				n=0;
			}
		}catch(IOException e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 16768
{-# LANGUAGE RankNTypes #-}
import qualified Data.Ix as I
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import Control.Monad
import Control.Monad.ST

solve :: Int -> [(Int,Int)] -> Int -> Int
solve n goods' w = f (0, w) where
  goods = U.fromList goods'
  f = memoize ((0,0), (n,w)) [(0,w)] f'
  f' f (i, j)
    | i == n = return 0
    | j < wi = nxt
    | otherwise = liftM2 max nxt nx'
    where
      nxt = f (i+1, j)
      nx' = (+vi) <$> f (i+1, j-wi)
      (wi, vi) = goods U.! i

--{ memoize
memoize :: (I.Ix i, U.Unbox e) => (i, i) -> [i] ->
  (forall m. Monad m => (i -> m e) -> i -> m e) -> (i -> e)
memoize ran is fun i = U.unsafeIndex memo ix
  where
    ix = I.index ran i
    size = I.rangeSize ran
    memo = runST $ do
      memo <- UM.unsafeNew size
      memd <- UM.replicate size False
      forM_ is $ calc memo memd
      U.unsafeFreeze memo
    calc memo memd i = do
      written <- UM.unsafeRead memd ix
      unless written $ do
        UM.unsafeWrite memo ix =<< fun (calc memo memd) i
        UM.unsafeWrite memd ix True
      UM.unsafeRead memo ix
      where ix = I.index ran i
--}

main = do
  [n,w] <- map read.words <$> getLine
  goods <- replicateM n $ (\[a,b]->(a,b)).map read.words <$> getLine
  print $ solve n goods w

Measured memory_bytes: 91132
#include<iostream>

using namespace std;

int main(){
 	int n;
  
  	int half;
  
  	cin >> n;
  
  half = n/2;
  half = n - half;
  
  double ans;
  
  ans = (double)half/(double)n;
  
  cout << ans << endl;
  
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define fi first
#define se second
#define mp make_pair
#define pb push_back
int32_t main(){
    
    
   unordered_map< int,int>cn;
//   string s;
//   cin>>s;
   
   int n;
   cin>>n;
   
//   unorderde_map<int,int>cn;
   string res = "YES\n";
   for(int i = 0 ;i < n; i++)
        {
            int x;
            cin>>x;
            cn[x]++;
            if(cn[x]>1)
                res="NO\n";
        }
        cout<<res<<endl;
}

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

using namespace std;

//typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)


signed main(){

	int N, a[123456], b[123456], c[123456];

	cin >> N;
	for (int i = 0; i<N; i++)
		cin >> a[i] >> b[i] >> c[i];

	int dp[123456][3] = { -INF };

	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for (int i = 1; i < N; i++){
		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
		dp[i][1] = max(dp[i - 1][2], dp[i - 1][0]) + b[i];
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
	}
	cout << max(max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]) << endl;

	return 0;
}


Measured memory_bytes: 6016
#pragma region Include
#include <bits/stdc++.h>
// #include <algorithm>
// #include <bitset>
// #include <climits>
// #include <cmath>
// #include <iostream>
// #include <iterator>
// #include <map>
// #include <queue>
// #include <sstream>
// #include <stack>
// #include <string>
// #include <unordered_map>
// #include <unordered_set>
// #include <vector>
#pragma endregion

using namespace std;

#pragma region Macros
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define all(c) (c).begin(), (c).end()
#define dump(x) \
  cout << "Line " << __LINE__ << " : " << #x << " = " << (x) << endl
template <class T>
using VV = vector<vector<T>>;

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  rep(i, vec.size()) os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& mat) {
  os << "[";
  rep(i, mat.size()) os << mat[i] << (i + 1 == mat.size() ? "" : ",\n ");
  os << "]";
  return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}

template <typename V, typename H>
void resize(vector<V>& vec, const H head) {
  vec.resize(head);
}

template <typename V, typename H, typename... T>
void resize(vector<V>& vec, const H& head, const T... tail) {
  vec.resize(head);
  for (auto& v : vec) resize(v, tail...);
}
constexpr double EPS = 1e-10;
const int INF = 0x3f3f3f3f;

string tostring(int i, int digit) {
  auto cur = cout.flags();
  stringstream ss;
  ss << setw(4) << setfill('0') << i;
  string ret = ss.str();
  cout.flags(cur);
  return ret;
}
#pragma endregion

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 1;
  char cur = S[0];
  rep2(i, 1, N) {
    if (cur != S[i]) {
      ++ans;
      cur = S[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    long long n,a,b,i,v[131072],r2=0,x=0,y=0;
    double r1=0;
    scanf("%lld%lld%lld",&n,&a,&b);
    for(i=0;i<n;i++){scanf("%lld",&v[i]);}
    qsort(v,n,sizeof(long long),llsortfnckj);
    for(i=0;i<a;i++){r1+=v[i];}
    r1/=a;
    printf("%.12lf\n",r1);
    for(i=0;i<n;i++){if(v[i]==v[a-1]){x++;}else if(v[i]>v[a-1]){y++;}}
    for(i=1;i<=x;i++){
        if(((y+i)<a) || (b<(y+i))){continue;}
        r2+=llnCr(x,i);
        if(v[0]!=v[y+i-1]){break;}
    }
    printf("%lld\n",r2);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
public 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();
    int d = sc.nextInt();
    int e = sc.nextInt();
    int k = sc.nextInt();
    if(e - a > k){
      System.out.println(":(");
    }else{
      System.out.println("Yay!");
    }
  }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,a,b;
  cin >> n >> a >> b;
  int64_t cnt=n/(a+b);
  int64_t caat=n%(a+b);
  if(caat>a)caat=a;
  cout << a*cnt+caat << endl;
}


Measured memory_bytes: 3572
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if(n/100==n%10){
      System.out.println("Yes");
    }else{
      System.out.println("No");
      
    }

  }
  

  
}


Measured memory_bytes: 23764
H, W, K = map(int, input().split())
mod = int(1E9+7)

if W == 1:
    print(1)
else:
    dp = [[0 for _ in range(W)] for _ in range(H+1)]

    P = [1, 1, 2, 3, 5, 8, 13, 21]
    dp[0][0] = 1

    for h in range(1, H+1):
        for k in range(W):
            if k == 0:
                dp[h][k] = (P[k]*P[W-k-1]*dp[h-1][k] + P[k]*P[W-k-2]*dp[h-1][k+1]) % mod
            elif k == W-1:
                dp[h][k] = (P[k-1]*P[W-k-1]*dp[h-1][k-1] + P[k]*P[W-k-1]*dp[h-1][k]) % mod
            else:
                dp[h][k] = (P[k-1]*P[W-k-1]*dp[h-1][k-1] + P[k]*P[W-k-1]*dp[h-1][k] + P[k]*P[W-k-2]*dp[h-1][k+1]) % mod
    print(dp[H][K-1])


Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

void solve(int n, int k, vector<char> &cv) { cv[k-1] = cv[k-1] + 0x20; }

int main(int argc, char const *argv[]) {
  int r,d;
  long long x2k;

  cin >> r;
  cin >> d;
  cin >> x2k;
  
  for (int i = 0; i < 10; i++) {
    x2k = r*x2k -d;
    cout << x2k << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,n,r=0,b=0;
    cin >>n;
    for(int i=0;i<n;i++){
        char a;
        cin>>a;
        if(a=='R')r++;
        else b++;
    }
    

    {
        if(r>b)cout <<"Yes"<<endl;
        else cout <<"No"<<endl;
    }

    dbg cout <<ans<<endl;

    return 0;

}

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

using str = string;
using ss = stringstream;

bool n,w,s,e;

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

    str ss;
    cin>>ss;

    for(int i=0;i<ss.size();i++)
    {
        if(ss[i]=='N')n=true;
        if(ss[i]=='W')w=true;
        if(ss[i]=='S')s=true;
        if(ss[i]=='E')e=true;
    }

    puts((n&&s&&!w&&!e)||(w&&e&&!n&&!s)||(n&&s&&w&&e)?"Yes":"No");

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;
const int MAX_V = 300000;

int n, m;
struct Flow{
    struct edge{
        int to, cap, rev;
    };
    vector<edge> G[MAX_V];//??£??\?????????
    bool used[MAX_V];

    void add_edge(int from, int to, int cap){
        G[from].push_back((edge){to, cap, (int)G[to].size()});//from -> to
        G[to].push_back((edge){from, 0, (int)G[from].size() - 1});//to -> from
    }

    //?¢???????????????¢???
    int dfs(int v, int t, int f){
        if(v == t) return f;
        used[v] = true;
        for (int i = 0; i < G[v].size(); ++i){
            edge &e = G[v][i];
            if(!used[e.to] && e.cap > 0){
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    //s??????t???????????§???
    int max_flow(int s, int t){
        int flow = 0;
        while(1){
            memset(used, 0, sizeof(used));
            int f = dfs(s, t, INF);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int main(void){
    cin >> n >> m;
    int s = n + m, t = n + m + 1;
    Flow mf;
    //s -> A
    rep(i, n){
        mf.add_edge(s, i, 1);
    }
    //B -> t
    rep(i, m){
        mf.add_edge(n + i, t, 1);
    }

    rep(i, n){
        int k; cin >> k;
        rep(j, k){
            int d; cin >> d; d--;
            mf.add_edge(i, n + d, 1);
        }
    }
    //?????§??????????????°??°??? m ????????????Bob??????
    if(mf.max_flow(s, t) == m) printf("Bob\n");
    else printf("Alice\n");
    return 0;
}

Measured memory_bytes: 16464
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
	PAU;
	return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	string s;
	int n;
	cin>>s>>n;
	for(int i=0;i<s.size();i++){
		if(s[i]!='1'){
			if(i>=n){
				cout<<1<<endl;
			}
			else{ 
				cout<<s[i]<<endl;
			}	
			return 0;
		}
	}
	cout<<1<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////
int ans[1000][1000];
signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,m;
	cin>>n>>m;
	pair<int,int> st;
	pair<int,int> de;
	cin>>st.F>>st.S;
	cin>>de.F>>de.S;
	--st.F;--st.S;
	--de.F;--de.S;
	for(int i=0;i<n;++i){
		for(int j=0;j<m;++j){
			ans[i][j]=infi;
		}
	}
	string s[n];
	for(int i=0;i<n;++i)
		cin>>s[i];
	priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> q;
	ans[st.F][st.S]=0;
	q.push({0,{st.F,st.S}});
	while(q.size()){
		pair<int,pair<int,int>> p=q.top();
		q.pop();
		int i=p.S.F;
		int j=p.S.S;
		int di=p.F;
		if(ans[i][j]<di)
			continue;
		if(i-1>=0&&s[i-1][j]!='#'&&ans[i-1][j]>p.F){
			ans[i-1][j]=di;
			q.push({di,{i-1,j}});
		}
		if(j-1>=0&&s[i][j-1]!='#'&&ans[i][j-1]>p.F){
			ans[i][j-1]=di;
			q.push({di,{i,j-1}});
		}
		if(i+1<n&&s[i+1][j]!='#'&&ans[i+1][j]>p.F){
			ans[i+1][j]=di;
			q.push({di,{i+1,j}});
		}
		if(j+1<m&&s[i][j+1]!='#'&&ans[i][j+1]>p.F){
			ans[i][j+1]=di;
			q.push({di,{i,j+1}});
		}
		for(int x=i-2;x<=i+2;++x){
			for(int y=j-2;y<=j+2;++y){
				if(x>=n||x<0||y<0||y>=m)
					continue;
				if(s[x][y]=='#')
					continue;
				if(ans[x][y]>p.F+1){
					ans[x][y]=p.F+1;
					q.push({di+1,{x,y}});
				}
			}
		}
	}
	if(ans[de.F][de.S]==infi){
		cout<<"-1";
	}
	else{
		cout<<ans[de.F][de.S];
	}
	#ifdef ANIKET_GOYAL
		// cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}

Measured memory_bytes: 12724