akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define min3(a, b, c)           min((a), min((b), (c)))
#define max3(a, b, c)           max((a), max((b), (c)))
#define lcm(a,b)                (a / __gcd(a,b) ) *b
#define gcd(a,b)                __gcd(a,b)
#define dist(x1,y1,x2,y2)       sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define distl(x1,y1,x2,y2)      sqrtl((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define sqr(a)                  ((a)*(a))
#define FOR(a, b)               for(int i=a; i<b; i++)
#define fRead(x)                freopen(x,"r",stdin)
#define fWrite(x)               freopen (x,"w",stdout)
#define pb                      push_back
#define mk                      make_pair
#define ff                      first
#define ss                      second
#define lb                      lower_bound
#define ub                      upper_bound
#define all(a)                  a.begin(), a.end()
#define FASTIO                  ios_base::sync_with_stdio(0);cin.tie(NULL);

bool cmp(pair<int, int> A, pair<int, int> B)
{
    if ((A.ss+A.ff != B.ss+B.ff))
        return A.ss+A.ff > B.ss+B.ff;
    else
        return A.ff > B.ff;
}

bool bmp(pair<int, int> A, pair<int, int> B)
{
    return A.ff > B.ff;
}

int main()
{
    FASTIO

    int n, m;
    vector<int> v[100005];

    cin >> n >> m;

    FOR (0, n)
    {
        int buf, bbuf;
        cin >> buf >> bbuf;
        v[buf].push_back(bbuf);
    }

    priority_queue<int> q;

    long long ans = 0, day = 1;
    for ( ; day <= m; day++)
    {
        for (int k:v[day])
            q.push(k);
        if(!q.empty())
        {
            ans += q.top();
            q.pop();
        }
    }

    cout << ans;
}



Measured memory_bytes: 8832
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int main(){
    int n;cin>>n;
    vector<ll>v(5,0);
    rep(i,n){
        string s;cin>>s;
        if(s[0]=='M')v[0]++;
        if(s[0]=='A')v[1]++;
        if(s[0]=='R')v[2]++;
        if(s[0]=='C')v[3]++;
        if(s[0]=='H')v[4]++;
    }
    ll res = 0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                res += v[i]*v[j]*v[k];
            }
        }
    }
    cout<<res<<endl;
}



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

int main(){
    std::priority_queue<long long> q;

    int n,m;
    cin >> n >> m;
    int input;
    for(int i = 0; i < n; i++){
        cin >> input;
        q.push(input);
    }

    long long temp;
    

    for(int i = 0; i < m; i++){
        temp = q.top();
        q.pop();
        temp /= 2;
        q.push(temp);
    }
    

    long long ans = 0;
    while(!q.empty()){
        //cout << q.top();
        ans += q.top();
        q.pop();

    }

    cout << ans << endl;
}

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

namespace Sum_of_Numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            String str;
            int ans;
            while ((str = Console.ReadLine()) != "0")
            {
                char[] ngo = str.ToArray();
                ans = 0;
                for (int i = 0; i < str.Length; ++i)
                {
                    ans += int.Parse(ngo[i].ToString());
                }
                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 9460
#include<bits/stdc++.h>
#define int long long
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; }


signed main()
{
    int N; cin>>N;
    vector<vector<int> > a(N,vector<int>(3));
    for(int i=0;i<N;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    
    vector<vector<int> > dp(N+1,vector<int>(3));
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++) for(int k=0;k<3;k++){
            if(j!=k){
                chmax(dp[i+1][j],dp[i][k]+a[i][j]);
            }
        }
    }
    cout<<max({dp[N][0],dp[N][1],dp[N][2]})<<endl;
}


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

#define ll long long
#define ld long double
#define pb push_back
#define pob pop_back
#define mp make_pair
#define mod 1000000007
#define forn(i, n)     for(ll i = 0; i< (ll)n; i++)
#define forf(i, x, y)  for(ll i=(x); i< (ll)y; i++)
#define forb(i, x, y)  for(ll i=(x); i>=(ll)y; i--)

using namespace std;


int main()
{
ios_base::sync_with_stdio(0); 
cin.tie(NULL);
cout.tie(NULL);
	
	int n;
	cin>>n;
	ll h[n];
	forn(i,n)
		cin>>h[i];
	ll cost[n];
	cost[0]=0,cost[1]=abs(h[1]-h[0]);
	forf(i,2,n)
	{
		cost[i]=min(cost[i-1]+abs(h[i]-h[i-1]),cost[i-2]+abs(h[i]-h[i-2]));
	}

	cout<<cost[n-1]<<endl;

return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n, s; cin>>n>>s;
  vi a(n,0);
  rep(i,n) cin >> a[i];
  int sum=0; int j=0; int minlen=numeric_limits<int>::max();
  for(int i=0; i<n; ++i){
    while(i<=j && j<n && sum<s){ sum += a[j++]; }
    if(sum>=s) minlen = min(minlen, j-i);
    sum -= a[i];
  }
  if(minlen==numeric_limits<int>::max()) minlen = 0;
  cout << minlen << endl;

}


Measured memory_bytes: 3364
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl

#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#else
#define DBPRT(a) if(0){}
#define DBSTART if(0){
#define DBEND }
#define PRTLST(arr,num) if(0){}
#define PRTLST2(arr2,d1,d2) if(0){}
#define PRTLST2D(arr2,d1,d2) if(0){}
#endif

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 100000
//---------------------

ll n,a,b;

int main(){
	cin >> n >> a >> b;
	ll s = a+b;

	PRT(a*(n/s)+min(a,n%s));
	return 0;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Yutori | diff Yutori.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Yutori.cpp && ./a.out

/*
 
 4/4/2020
 
 6:05-6:30 give up
 
 11:35- read editorials
 
 https://twitter.com/hanseilimak/status/1246507944008486913
 https://youtu.be/q-mrqE2Q7JQ?t=4025
 
 */

//const int MAX_N=1e6+1;
string S;
int N,K,C;

void solve() {
  VI A(N); REP(i,N) A[i]=S[i]=='o';
  
  auto f=[&](VI &A)->VI {
    VI res(N);
    int pre=-1e7,cnt=0;
    REP(i,N) if(A[i]) {
      if(i-pre>=C+1) ++cnt,res[i]=1,pre=i;
    }
    return res;
  };
  
  VI L=f(A);
  reverse(ALL(A));
  VI R=f(A);
  reverse(ALL(R));
  int cntl=count(ALL(L),1),cntr=count(ALL(R),1);
//  dump(cntl,cntr);
  if(cntl>K||cntr>K) return;
  VI res;
  REP(i,N)if(L[i]&&R[i]) res.push_back(i);
  FORR(a,res) cout<<a+1<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>K>>C>>S;
  solve();
  
  return 0;
}


Measured memory_bytes: 5004
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <cmath>
#include <climits>
using namespace std;

long long N, h, n, w, denom;

int main()
{
    cin >> N;
    for (h = 1; h < 3501; h++) {
        for (n = 1; n < 3501; n++) {
            denom = 4*h*n - N*n - N*h;
            if (denom > 0 && 0 == N*h*n % denom) {
                w = N*h*n / denom;
                printf("%d %d %d\n", h, n, w);
                return 0;
            }
        }
    }
    return 1;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using vvll = vector<ll, vector<ll> >;
using vll = vector<ll> ;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main() {
    fastio();

    int N;
    cin >> N;
    int A, B, C;
    int ADP = 0, BDP = 0, CDP = 0, ADP_, BDP_, CDP_;
    for(int i = 0;i < N;i ++) {
        cin >> A >> B >> C;
        ADP_ = A + max(BDP, CDP);
        BDP_ = B + max(ADP, CDP);
        CDP_ = C + max(ADP, BDP);
        ADP = ADP_;
        BDP = BDP_;
        CDP = CDP_;
    }
    cout << max(ADP, max(BDP, CDP));
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
    char S[3];
    int i;
    for ( i=0; i<3; i++ ) {
        scanf("%c", &S[i]);
    }
    char c;
    int ans = 0;
    scanf("%c", &c);
    for ( i=0; i<3; i++ ) {
        scanf("%c", &c);
        if ( c == S[i] )
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
<?php
//$K = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
list($A,$B,$H,$M) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$s = trim(fgets(STDIN));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$hh = ($H % 12)*30;
$mm = $M * 6;
$hh += $M*0.5;

//角度を求める
$k = abs($hh - $mm);
if ($k > 180) $k = 360-$k;
//printf("%d %d %d\n",$hh,$mm,$k);

echo sqrt($A**2 + $B**2 - (2*$A*$B * cos(deg2rad($k))));


Measured memory_bytes: 16556
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int N;
ll L;
vector<ll> x(100005);
int doub[40][100005];

void prepare() {
  int index;
  for(int i=0;i<N;++i) {
    index = upper_bound(x.begin(), x.end(), x[i]+L) - x.begin() - 1;
    doub[0][i] = index;
  }
  for(int i=1;i<40;++i) {
    for(int j=0;j<N;++j) {
      doub[i][j] = doub[i-1][doub[i-1][j]];
    }
  }
}

ll solve(int a, int b) {
  ll two, tmp;
  ll ans = 0;
  while(a<b) {
    two = 1;
    tmp = 0;
    while(doub[tmp+1][a]<b) {
      two *= 2;
      tmp++;
    }
    ans += two;
    a = doub[tmp][a];
  }
  return ans;
}

int main() {
  for(int i=0;i<100005;++i) x[i] = big;
  cin>>N;
  for(int i=0;i<N;++i) cin>>x[i];
  cin>>L;
  prepare();
  int Q;
  cin>>Q;
  int a, b;
  ll ans[Q];
  for(int i=0;i<Q;++i) {
    cin>>a>>b;
    a--;
    b--;
    if(a>b) swap(a, b);
    ans[i] = solve(a, b);
  }
  for(int i=0;i<Q;++i) cout<<ans[i]<<endl;
}



Measured memory_bytes: 20320
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (h, w) = (v[0], v[1]);
    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");

    for _ in 0..h {
        let s = read::<String>();
        println!("#{}#", s);
    }

    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<iostream>

using namespace std;

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

  int c[N], t[N];
  for (int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
  }

  int ans = 1e9;
  for (int i = 0; i < N; i++) {
    if (t[i] > T) {
      continue;
    }
    ans = min(ans, c[i]);
  }

  if (ans == 1e9) {
    cout << "TLE";
  } else {
    cout << ans;
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
/* 配列の初期化 fill(array, 0); すべて0に初期化 */
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );}
using namespace std;
int main()
{
    char s[4];
    long in[4];

    for(int i = 0;i < 4;i++){
        cin >> s[i];
        in[i] = s[i] - '0';
    }

    for(int i = 0;i < 8;i++){
        long ans = in[0];
        queue<char> q;
        for(int j = 0;j < 3;j++){
            if(i & (1 << j)){
                ans += in[j + 1];
                //cout << '+';
                q.push('+');
            }else{
                ans -= in[j + 1];
                q.push('-');
                //cout << "-";
            }
        }
        //cout << endl;
        if(ans == 7){
            for(int j = 0;j < 7;j++){
                if(j % 2 == 0){
                    cout << in[j/2];
                }else{
                    cout << q.front();
                    q.pop();
                }
            }
            cout << "=7" << endl;
            return 0;
        }
    }
    return 0;
}

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

#define LL long long int
#define mp make_pair
#define FOR(i, n) for(i = 0; i < n; ++i)
typedef vector <int> vi;
typedef vector <LL> vll;
typedef pair<LL, LL> iPair;
const int MOD = 1e9+7;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);

    LL t = 1;
    LL i,j;
    // cin>>t;
    
    while(t--)
    {
        int n, w;
        cin >> n >> w;
        vi weight(n);
        vll value(n);
        FOR(i, n) cin >> weight[i] >> value[i];

        LL dp[n][w+1];
        
        for(int i = 0; i <= w; ++i)
            dp[0][i] = (i < weight[0])? 0 : value[0];

        for(int i = 1; i < n; ++i)
        {
            for(int j = 0; j <= w; ++j)
            {
                if(weight[i] > j) dp[i][j] = dp[i-1][j];
                else dp[i][j] = max(value[i] + dp[i-1][j - weight[i]], dp[i-1][j]);
            }
        }
        cout<<dp[n-1][w];
    }

	return 0;
}


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

int main(){
  int A,B;
  cin>>A>>B;
  
  int count=0;
  
  for(int i=A;i<=B;i++){
    if(i/10000==i%10 && i/1000%10==i/10%10){
     count++; 
    }
  }

  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

template<typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}



int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int>A(N), B(N), C(N);
    REP(i, N) {
        cin >> A[i] >> B[i] >> C[i];
    }

    vector<vector<int>> dp(N + 1, vector<int>(3));
    REP(i, N) {
        chmax(dp[i + 1][1], dp[i][0] + B[i]);
        chmax(dp[i + 1][2], dp[i][0] + C[i]);

        chmax(dp[i + 1][0], dp[i][1] + A[i]);
        chmax(dp[i + 1][2], dp[i][1] + C[i]);

        chmax(dp[i + 1][0], dp[i][2] + A[i]);
        chmax(dp[i + 1][1], dp[i][2] + B[i]);
    }

    cout << max({ dp[N][0],dp[N][1],dp[N][2] }) << endl;
    return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main(){
  prep();
  int n, m;
  cin >> n >> m;
  long long x[n];
  long long y[m];
  for (int i=0; i<n; i++){
      cin >> x[i];
      
  }
  for (int i=0; i<m; i++){
      cin >> y[i];
  }
  vector<long long> betwx;
  vector<long long> betwy;
  for (int i=1; i<n; i++){
     
      betwx.push_back(mymod((n-i)*(x[i]-x[i-1])));
  }

  for (int i=1; i<m; i++){
      betwy.push_back(mymod((m-i)*(y[i]-y[i-1])));
  }
  for (int i=n-3; i>=0; i--){
      betwx[i] = mymod(betwx[i+1]+betwx[i]);
  }
  for (int i=m-3; i>=0; i--){
      betwy[i] = mymod(betwy[i+1]+betwy[i]);
  }
  long long ysum = 0;
  for (int i=0; i<m-1; i++){
      ysum += betwy[i];
      ysum = mymod(ysum);
  }
  long long res = 0;
  for (int i=0; i<n-1; i++){
     
          
          res += mymod(betwx[i]*ysum);
          res = mymod(res);
     
  }
  cout << res;
  return 0; 
}

Measured memory_bytes: 4212
n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0

for i in range(2**n): # bitで全状態を列挙
    for j in range(m): # あるスイッチ状態における各電球のONOFFを探索する
        count = 0
        #print(i, (i>>j)&1)
        for k in range(n):
            if ((i >> k) & 1) and (k+1) in l[j][1:]:
                # j番目の電球にスイッチkがつながっていたらcountを追加
                count += 1
        if count % 2 != p[j]:
            break
        if j == m-1: ans += 1
print(ans)


Measured memory_bytes: 40816
from collections import defaultdict

N = int(input())
S = input()

S1 = S[:N]
S2 = S[N:][::-1]
D = defaultdict(int)
ans = 0

for i in range(2**N):
    bit = bin(2**N+i)[3:]
    red1 = "".join([d for d, s in zip(S1, bit) if s == "1"])
    blue1 = "".join([d for d, s in zip(S1, bit) if s == "0"])
    D[(red1, blue1)] += 1

for i in range(2 ** N):
    bit = bin(2 ** N + i)[3:]
    red2 = "".join([d for d, s in zip(S2, bit) if s == "1"])
    blue2 = "".join([d for d, s in zip(S2, bit) if s == "0"])
    ans += D[(blue2, red2)]

print(ans)


Measured memory_bytes: 170100
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vector<ll> a(3*n), af, bf;
    min_priority_queue<ll> que;
    priority_queue<ll> pue;
    ll sa = 0, sb = 0;
    rep(i, 0, 3*n) {
        cin >> a[i];
        if (i < n) {
            que.push(a[i]);
            sa += a[i];
        } else if (2*n <= i) {
            pue.push(a[i]);
            sb += a[i];
        }
    }
    af.pb(sa); bf.pb(sb);
    rep(k, 0, n) {
        que.push(a[n+k]);
        sa += a[n+k] - que.top();
        que.pop();
        af.pb(sa);

        pue.push(a[2*n-1-k]);
        sb += a[2*n-1-k] - pue.top();
        pue.pop();
        bf.pb(sb);
    }
    reverse(all(bf));
    ll ans = af[0] - bf[0];
    erep(i, 1, n) {
        ans = max(ans, af[i] - bf[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6516
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
signed main(){
  int N,M,O=0,P=0,count=0,count2=0;
  str S,W,T;
  cin>>S;
  rep(0,S.size()){
    if(O==0&&S.at(i)=='A'){
      count=i;
      O+=1;
    }
    if(P==0&&S.at(S.size()-i-1)=='Z'){
      count2=S.size()-i;
      P+=1;
    }
  }
  cout<<count2-count<<endl;
}


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

using namespace std;

const int MAX_N = 200010;
const long long P = 998244353;
int N, K;
int L[20], R[20];
long long dp[MAX_N], sums[MAX_N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> N >> K;
	for (int i = 0; i < K; i++)
		cin >> L[i] >> R[i];
	
	dp[N] = 1;
	sums[N] = 1;
	
	for (int i = N - 1; i >= 1; i--) {
		for (int j = 0; j < K; j++) {
			int a = min(i + L[j], N + 1), b = min(i + R[j], N);
			dp[i] = (dp[i] + sums[a]) % P;
			dp[i] = (dp[i] - sums[b + 1] + P) % P;
		}
		sums[i] = (dp[i] + sums[i + 1]) % P;
	}
	
	cout << dp[1] << "\n";
	
	return 0;
}


Measured memory_bytes: 6772
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int A[3];

	for (int i = 0; i < 3; i++)
	{
		cin >> A[i];
	}

	sort(A, A + 3);

	if (A[0] == A[1]) {
		cout << A[2] << endl;
	}
	else {
		cout << A[0] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
d,n = map(int,input().split())
if d == 0 and 1<=n<=99:
  print(n)
elif d == 0 and n ==100:
  print(101)
elif d == 1 and 1<=n<=99:
  print(100*n)
elif d == 1 and n ==100:
   print(101*n)
elif d == 2 and 1<=n<=99:
  print(10000*n)
elif d == 2 and n ==100:
   print(10100*n)

Measured memory_bytes: 3060
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (decltype(a) i=(a); i<(b); ++i)
#define iter(it,c) for (decltype((c).begin()) it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31); // 2147483647

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) { return (a % b + b) % b; }

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if(c < b) swap(b,c);
	if(b < a) swap(a,b);
	if(c < b) swap(b,c);
	ll res = 0;
	if((a&b&c&1) == 1)
	{
		res = a*b;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(){
    int n,r,card[100],p,c,temp[100];
    while(1){
        scanf("%d%d",&n,&r);
        if(n==0&&r==0)return 0;
        for(int i=1;i<=n;i++)card[i]=n-i+1;
        while(r--){
            scanf("%d%d",&p,&c);
            for(int i=1;i<=c;i++)temp[i]=card[i+p-1];
            for(int i=c+1;i<p+c;i++)temp[i]=card[i-c];
            for(int i=1;i<p+c;i++)card[i]=temp[i];
        }
        printf("%d\n",card[1]);
    }
}

Measured memory_bytes: 2576
//In the name of God
//SMani24
#include<bits/stdc++.h>
using namespace std;

int n, cnt, a, b;
bool f = 1;
string p, q, s;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		char t;
		cin >> t;
		p += t;
	}
	for (int i = 0; i < n; i++) {
		char t;
		cin >> t;
		q += t;
	}
	for (int i = 1; i <= n; i++)
		s += (i + '0');
	while (f) {
		if (p == s)
			a = cnt;
		if (q == s)
			b = cnt;
		cnt++;
		f = next_permutation(s.begin(), s.end());
	}
	cout << abs(a - b) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;

    vector<int> cnt(13);
    cnt[0] = 1;
    bool iszero = false;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        cnt[a]++;
        if (cnt[a] >= 3)
            iszero = true;
    }

    if (iszero) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 0;
    for (int i = 0; i < (1 << 13); ++i) {
        vector<int> v;
        for (int j = 0; j < 13; ++j) {
            if (!cnt[j])
                continue;
            if (cnt[j] == 2) {
                v.push_back(j);
                v.push_back(24 - j);
                continue;
            }
            if (i & (1 << j))
                v.push_back(24 - j);
            else
                v.push_back(j);
        }

        int siz = v.size();
        int res = 12;
        for (int j = 0; j < siz; ++j) {
            for (int k = j + 1; k < siz; ++k) {
                int dif = abs(v[j] - v[k]);
                res = min(res, min(dif, 24 - dif));
            }
        }
        ans = max(ans, res);
    }

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


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

int L;
std::string S;

bool puttable(int, int);

int main()
{
	std::cin >> L >> S;

	int max{};
	for (int i{}; i < L; i++)
	{
		if (S[i] == 'B') continue;
		for (int j{i + 2}; j < L; j++)
		{
			if (S[j] == 'B' || S[j] == S[i]) continue;
			if (puttable(i, j))
				max = std::max(max, j - i - 1);
		}
	}

	printf("%d\n", max);

	return 0;
}

bool puttable(int left, int right)
{
	for (int i{left + 1}; i < right; i++)
		if (S[i] != 'B') return false;
	if (S[left] == '.')
	{
		int diff{left - 1};
		while (diff >= 0 && S[diff] == 'W') diff--;
		if (diff >= 0 && S[diff] == 'B') return false;
	}
	else
	{
		int diff{right + 1};
		while (diff < L && S[diff] == 'W') diff++;
		if (diff < L && S[diff] == 'B') return false;
	}
	return true;
}


Measured memory_bytes: 3324
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
ll A[200010];
ll f[200010];
inline ll Cut(ll l, ll r)
{
	ll Left = l, Right = r;
	while(Left < Right - 1)
	{
		ll Mid = (Left + Right) >> 1;
		if(f[Mid] - f[l - 1] >= f[r] - f[Mid])
			Right = Mid - 1;
		else
			Left = Mid;
	}
	if(Left < r && abs(f[Left] - f[l - 1] - f[r] + f[Left]) > abs(f[Left + 1] - f[l - 1] - f[r] + f[Left + 1]))
		++ Left;
	if(Left < r && abs(f[Left] - f[l - 1] - f[r] + f[Left]) > abs(f[Left + 1] - f[l - 1] - f[r] + f[Left + 1]))
		++ Left;
	return Left;
}
int main()
{
	scanf("%lld", &n);
	for(ll i = 1; i <= n; ++ i)
		scanf("%lld", &A[i]);
	for(ll i = 1; i <= n; ++ i)
		f[i] = f[i - 1] + A[i];
	ll Ans = 2147483647;
	for(ll i = 3; i < n; ++ i)
	{
		ll x = Cut(1, i - 1);
		ll y = Cut(i, n);
		ll p = f[x];
		ll q = f[i - 1] - f[x];
		ll r = f[y] - f[i - 1];
		ll s = f[n] - f[y];
		ll Max = 0;
		Max = max(Max, abs(p - q));
		Max = max(Max, abs(p - r));
		Max = max(Max, abs(p - s));
		Max = max(Max, abs(q - r));
		Max = max(Max, abs(q - s));
		Max = max(Max, abs(r - s));
		Ans = min(Ans, Max);
	}
	printf("%lld", Ans);
	return 0;
}

Measured memory_bytes: 3328
while True:
    x = [i for i in input().split()]
    if x[1] == '?':
        break
    a = int(x[0])
    b = int(x[2])
    if x[1] == '+':
        print (a + b)
    elif x[1] == '-':
        print (a - b)
    elif x[1] == '*':
        print (a * b)
    elif x[1] == '/':
        print (a // b)



Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
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; }
const ll INF=1LL<<60;

int n;
vector<int> a(100005);

int main(){
    cin>>n;
    rep(i,n) cin>>a[i];
    int b=a[0];
    int cnt=1;
    bool flag=false;
    rep(i,n){
        if(b==2){
            flag=true;
            break;
        }
        b=a[b-1];
        cnt++;
   }
    if(flag) cout<<cnt<<"\n";
    else cout<<-1<<"\n";
    return 0;
}

Measured memory_bytes: 3704
li =[int(input()) for i in range(6)]
isexist=False

for i in range(5):
    j=5
    while j>i:
        if (li[j]-li[i])>li[5]:
            isexist=True
        j-=1

if isexist==True:
    print(":(")
else:
    print("Yay! ")

Measured memory_bytes: 3060
#include <stdio.h>

#define BIGNUM 1000000

int GCD (int a, int b){
	int amari;
	int l, s;
	if (a < b){
		s = a;
		l = b;
	}
	else {
		s = b;
		l = a;
	}

	amari = l % s;

	if (amari != 0) GCD(s, amari);
	else return s;
}

int main (void){
	int a, b;
	int LCM;
	while (scanf ("%d %d", &a, &b) != EOF){
		int ProcessingFlag = 0;
		if (a >= BIGNUM) {
			a = a / BIGNUM;
			ProcessingFlag = 1;
		}
		if (b >= BIGNUM) {
			b = b / BIGNUM;
			ProcessingFlag = 1;
		}
		LCM = (a * b) / GCD(a, b);
		if (ProcessingFlag == 1) {
			printf("%d %d\n", GCD(a, b) * BIGNUM, LCM * BIGNUM);
		}
		else {
			printf("%d %d\n", GCD(a, b), LCM);
		}
	}

	return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, a, b;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vector<int> v;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        v.push_back(a);
    }
    sort(ALL(v));
    int count = 1;
    for (int i = 0; i < v.size() - 1; i++)
    {
        if (v[i] == v[i + 1])
        {
            count++;
        }
        else
        {
            if (count % 2 == 1)
                ans++;
            count = 1;
        }
    }
    if (count % 2 == 1)
    {
        ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n;cin>>n;
  set<int> s;
  rep(i,n){
    int d;cin>>d;
    s.insert(d);
  }
  int ans=s.size();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int  main(){
  int c11,c12,c13,c21,c22,c23,c31,c32,c33;
  cin>>c11>>c12>>c13>>c21>>c22>>c23>>c31>>c32>>c33;
  string ans;
  
  if(c11-c12!=c21-c22){ans="No";}
  else if(c31-c32!=c21-c22){ans="No";}
  else if(c11-c13!=c21-c23){ans="No";}
  else if(c11-c13!=c31-c33){ans="No";}
  else if(c11-c21!=c12-c22){ans="No";}
  else if(c11-c21!=c13-c23){ans="No";}
  else if(c11-c31!=c12-c32){ans="No";}
  else if(c11-c31!=c13-c33){ans="No";}
  else{ans="Yes";}
  
  cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p (int)(1e9 + 7)

char s[100002];

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

signed main(){
	int N, i, j, f;
	scanf("%s", &s[1]);
	for(N = 0; s[N + 1] != '\0'; N++){}
	for(i = 1, f = 1; i < N; i++){
		if(s[i] == s[i + 1]){
			f = 0;
			break;
		}
	}
	if(f == 1){
		printf("1\n");
		return 0;
	}
	int *A = (int *)malloc(sizeof(int) * (N + 1));
	A[0] = 0;
	for(i = 1; i <= N; i++){
		if(s[i] == 'a'){
			A[i] = (A[i - 1] + 1) % 3;
		}
		else{
			A[i] = (A[i - 1] + 2) % 3;
		}
	}
	int **dp1 = (int **)malloc(sizeof(int *) * (N + 1));
	int **dp2 = (int **)malloc(sizeof(int *) * (N + 1));
	for(i = 0; i <= N; i++){
		dp1[i] = (int *)malloc(sizeof(int) * 3);
		dp2[i] = (int *)malloc(sizeof(int) * 3);
		for(j = 0; j < 3; j++){
			dp1[i][j] = 0;
			dp2[i][j] = 0;
		}
	}
	int pre[3] = {1, 0, 0};
	dp1[0][0] = 1;
	dp2[0][0] = 1;
	for(i = 1; i <= N; i++){
		dp1[i][A[i]] = MOD(dp2[i - 1][(A[i] + 1) % 3] + dp2[i - 1][(A[i] + 2) % 3] - pre[A[i]]);
		if(A[i] == 0){
			dp1[i][A[i]] = MOD(dp1[i][A[i]] + 1);
		}
		for(j = 0; j < 3; j++){
			dp2[i][j] = MOD(dp2[i - 1][j] + dp1[i][j]);
		}
		pre[A[i]] = dp2[i][A[i]];
	}
/*	for(i = 0; i <= N; i++){
		for(j = 0; j < 3; j++){
			printf("%lld ", dp1[i][j]);
		}
		printf("\n");
	}
*/	if(A[N] == 0){
		dp2[N][A[N]] = MOD(dp2[N][A[N]] - 1);
	}
	printf("%lld\n", dp2[N][A[N]]);
	return 0;
}

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

#define int long long 
#define INF 1000000000
#define MAX 1000002

vector<int>prime;
bitset<MAX>bit;

void seive(){
    bit.set();
    for(int i = 2; i < MAX; i++){
        if(bit[i]){
            prime.push_back(i);
            for(int j = i*2; j < MAX; j+=i){
                bit[j] = false;
            }
        }
    }
    return;
}

int32_t main(){
    seive();
    int n;
    while(cin >> n){
        map<int, int>mp;
        for(int i = 0; i < prime.size() && prime[i] <= n; i++){
            int pf = prime[i];
            int cnt = 0;
            if(n%pf == 0){
                while(n%pf == 0){
                    cnt++;
                    n /= pf;
                }
                mp[pf] = cnt;
            }
        }
        if(n > 1){
            mp[n] = 1;
        }
        int ans = 0;
        for(auto x : mp){
            int v = x.second;
            for(int i = 1; ; i++){
                int tv = (i*(i+1))/2;
                if(tv == v){
                    ans += i; break;
                }
                if(tv > v){
                    ans += (i-1); break;
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 4220
#include<stdio.h>
int main(void)
{
	
	int n,i,j;
	
	scanf("%d",&n);
	int R[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&R[i]);
	}
	int maxv=R[1]-R[0];
	int minv=R[0];
	for(j=1;j<n;j++)
	{
		
		if(maxv<R[j]-minv)
		{
			maxv=R[j]-minv;
		}
		if(minv>R[j])
		{
			minv=R[j];
		}
	}
	printf("%d\n",maxv);
	return 0;
}


Measured memory_bytes: 2620
n,k = map(int,input().split())

sA = []
for i in range(n):
  sA.append(list(map(int,input().split())))

sA.sort()

compK = 0
for i in sA:
  compK += i[1]
  if compK >= k:
    print(i[0])
    break
 


Measured memory_bytes: 27872
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	vi mi, pl;
	rep(i, n){
		int x; cin >> x;
		if(x < 0) mi.pb(x);
		else pl.pb(x);
	}
	if(mi.size() == 0){
		cout << pl[k - 1] << endl;
		return 0;
	}
	
	int ans = inf;
	for(int i = 0; i <= k && i <= mi.size(); i++){
		if(k - i > pl.size()) continue;
		int d1 = i ? -mi[mi.size() - i] : 0;
		int d2 = k - i ? pl[k - i - 1] : 0;
		ans = min(ans, d1 + d2 + min(d1, d2));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1020
#include <algorithm>
#include <iostream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define pii pair<int,int>
#define ll long long
#define N (int)(1e5+10)
#define mod 998244353
#define mp make_pair
#define pb push_back
#define nd second
#define st first
#define inf mod
#define endl '\n'
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define bit(x,y) ((x>>y)&1)

ll i,j,k,n,m,x,y,z;
int A[N];
ll fe(ll x, ll y) {
	if (y == 0)
		return 1;

	ll t = fe(x, y/2);

	t = t*t%mod;

	if(y&1)
		return t*x%mod;
	return t;
}

int main(){
	int n;
	cin >> n;

	for(int i=1 ; i<=n ; i++) {
		cin >> x;
		A[x]++;
		if (i == 1) {
			if(x) {
				cout << 0 << endl;
				return 0;
			}
			continue;
		}
		if (x == 0) {
			cout << 0 << endl;
			return 0;
		}

	}

	ll ans = 1;

	for(int i=1 ; i<n ; i++) {
		if(A[i] and !A[i-1])
			ans = 0;
		ans = ans * fe(A[i-1], A[i]) % mod;
	}

	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n,m;
ll A[100010] = {0},B[100010] = {0};

int main(){
	cin >> n >> m;
	ll sum = 0;
	vector<P> v(n);
	for(int i=0;i<n;i++){
		cin >> A[i];
		B[i] = A[i];
		if(i>=1){
			if(B[i-1]>A[i]) A[i] += m;
			sum += A[i]-B[i-1];
			v[i-1] = {B[i-1],A[i]};
//			cout << v[i-1].first << " " << v[i-1].second << endl;
		}
	}
	sort(v.begin(),v.end());
	P F[2*(m+2)];
//	cout << endl;
	for(int i=0;i<2*(m+2);i++){
		F[i] = {0,0};
	}
	for(int i=0;i<n;i++){
		F[v[i].first+1].second++;
		F[v[i].second+1].second--;
		F[v[i].second+1].first -= v[i].second-v[i].first;
	}
	ll ans = 0;
	for(int i=2;i<2*(m+2);i++){
//		cout << F[i].first << " " << F[i].second << " ";
		F[i].second += F[i-1].second;
		F[i].first += F[i].second + F[i-1].first;
//		cout << F[i].first << " " << F[i].second << endl;
	}
	for(int i=1;i<=m;i++){
		ans = max(ans,F[i].first+F[i+m].first-F[i].second-F[i+m].second);
	}
//	cout << sum << endl;
	cout << sum - ans << endl;
}

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

int main(){

  string key[20] = {"y","u","i","o","p","h","j","k","l","n","m"}; 

  string x;

  while(1){

    cin >> x;
    if(x == "#") break;  

    int flag = 1;; // 0 右　１左
    int c = 0;

    for(int j = 0 ; j < 11 ; j++){
      if( x[0] == key[j][0] )
	flag = 0;
    }


    for(int i = 0 ; i < x.size() ; i++){

      for(int j = 0 ; j < 11 ; j++){

	if( x[i] == key[j][0] ){

	  if(flag == 1){
	    c++;
	    flag = 0;
	    break;
	  }
	  else{
	    break;
	  }

	}
	if( j == 10 ) 
	  if(flag == 0){
	    c++;
	    flag = 1;
	  }
      }
    }

    cout << c << endl;

  }


  return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <cmath>

int n, a, b;
int main()
{
	std::cin >> n >> a >> b;
	auto big = std::min(a, b);
	auto small = std::max(0, a - (n - b));
	std::cout << big << " " << small << std::endl;
	return 0;
}


Measured memory_bytes: 256