akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll power(ll m,ll n){
    ll res = 1;
    if(n > 0){
        res = power(m,n / 2);
        if(n % 2 == 0){
            res = (res * res) % mod;
        }
        else{
            res = (((res * res) % mod) * m) % mod;
        }
    }
    return res;
}
/*long long inverse(long long m,long long n){
  return (m * power(n,mod - 2)) % mod;
}*/
//modはグローバル変数にしておく
int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans = 0;
  ans += power(2,n) - 1;
  ll anf = 0;
  anf = 1;
  ll af = 0;
  af = 1;
  ll bnf = 0;
  bnf = 1;
  ll bf = 0;
  bf = 1;
  for(int i = a - 1;i >= 0;i--){
    anf = (anf * (n + i - a + 1) % mod) % mod;  
  }
  for(int i = 1;i <= a;i++){
    af = (af * i) % mod;
  }
  for(int i = b - 1;i >= 0;i--){
    bnf = (bnf * (n + i - b + 1) % mod) % mod;
  }
  for(int i = 1;i <= b;i++){
    bf = (bf * i) % mod;
  }
  //cout << anf << " " << af << " " << bnf << " " << bf << endl; 
  ans -= (anf * power(af,mod - 2)) % mod;
  ans -= (bnf * power(bf,mod - 2)) % mod;
  //ans -= inverse(inverse(factorial[n],power(factorial[a],mod - 2)),power(factorial[n - a],mod - 2)) % mod;
  //ans -= inverse(inverse(factorial[n],power(factorial[b],mod - 2)),power(factorial[n - b],mod - 2)) % mod;  
  while(ans < 0){
    ans += mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter
def solve():
    n = int(input())
    s = input()
    c = Counter(s)
    ans = c['R']*c['G']*c['B']
    for i in range(n):
        for j in range(i+1,n):
            k = 2*j-i
            if k>=n:
                continue
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                ans-=1
    print(ans)
if __name__=='__main__':
    solve()

Measured memory_bytes: 9352
def solve(n, inp):
    if n == 1:
        return int(inp[0])

    INF = -(10 ** 18)

    dp1, dp2, dp3 = int(inp[0]), INF, INF
    for op, a in zip(inp[1::2], inp[2::2]):
        a = int(a)
        if op == '+':
            dp1, dp2, dp3 = dp1 + a, max(dp2 - a, dp3 + a), dp3 + a
        else:
            dp1, dp2, dp3 = max(dp1 - a, dp2 + a), max(dp1 - a, dp2 + a), max(dp2 + a, dp3 - a)

    return dp1


n = int(input())
inp = input().split()
print(solve(n, inp))


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

int main(void){

  	
	int n, k;
  	cin>>n>>k;
  	vector<long long int> a;
  	for(int i=0;i<n;i++){
    	long long int t;
      	cin>>t;
      	a.push_back(t);
    }
  	
  	long long int p=a[0];
  	long long int tm=a[0];
  	
  	for(int i=0;i<n;i++){
        
      	if(i>=k){
        	tm=a[i-k];
        }
        
      	p=a[i];
      	
      	if(i>=k){
      		
            if(p>tm){
                cout<<"Yes"<<endl;
            }else{
                cout<<"No"<<endl;
            }
        }
    }
  	
  	
}

Measured memory_bytes: 5280
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  while(N > 0){
      N /= K;
      ans++;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,X;
  cin>>N>>X;
  int A;
  cin>>A;
  A=abs(X-A);
  for(int i=1;i<N;i++){
    int a;
    cin>>a;
    a=abs(a-X);
    A=gcd(A,a);
  }
  cout<<A<<endl;
}

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

int main() {
  int x,y,z;
  cin >> x>>y>>z;

  if (x==y) {
    cout << z<< endl;
  }

  else if (x==z) {
    cout <<y<< endl;
  }

  else if (y==z) {
    cout << x << endl;
  }
}


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

int main(){
    string s[3];
    cin >> s[0] >> s[1] >> s[2];

    int i=0;
    while(1){
        if(s[i].size() == 0){
            cout << (char)(i + 'A');
            return 0;
        }
        char c = s[i][0];
        s[i].erase(0, 1);
        i = c - 'a';
    }

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    H = list(map(int, input().split()))
    if N == 1:
        return print(1)
    CNT = 1
    High = H[0]
    for i in range(1,N):
        if H[i] >= High:
            CNT += 1
            High = H[i]
        
    return print(CNT)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
def resolve():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(k):
        nxt = [0]*n
        for j in range(len(a)):
            r = min(j + a[j], n-1) #look right
            l = max(j-a[j], 0) #look left
            nxt[l] += 1
            if r+1 < n:
                nxt[r+1] -= 1
        b = [0] *n
        for j in range(len(a)):
            if j== 0:
                b[j] = nxt[j]
            else:
                b[j] = (nxt[j]+b[j-1])
        a, b = b, a
        if a == b:
            break
    print(*a)
resolve()

Measured memory_bytes: 158276
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
     for (int i = 1; i > 0; i ++)
            {
                int x;
                cin >> x;
                if (x == 0) {
                    break;
                }else {
                    cout << "Case " << i << ": " <<  x << endl;
                }
            }

}


Measured memory_bytes: 2988
using System;
using System.Collections.Generic;




namespace SolutionCS
{
    class Program
    {
        static long gcd(long a, long b)
        {
            if (a < b)
            {
                return gcd(b, a);
            }

            while (b != 0)
            {
                long rem = a % b;
                a = b;
                b = rem;
            }

            return a;
        }

        static long lcm(long a, long b)
        {
            return a / gcd(a, b) * b;
        }

        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long A = long.Parse(s[0]);
            long B = long.Parse(s[1]);

            Console.WriteLine(lcm(A, B));
        }
    }
}



Measured memory_bytes: 13140
#include<stdio.h>
#include<string.h>
int main()
{
	char s[3];
// input
	scanf("%s",s);
// output
	if(strstr(s,"9")!=NULL)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
return 0;
}

Measured memory_bytes: 128
#MLE注意！

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    res = 0
    for i in range(n+1):
        if i%3==0 or i%5==0:
            continue
        res += i
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 68004
N,A=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0 for i in range(50*50+1)] for j in range(N+1) ]for k in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
  for j in range(N+1):
    for k in range(50*50+1):
      dp[i][j][k]=dp[i-1][j][k]
      if x[i-1]<= k and j>0: dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]]
ans=0
for j in range(1,N+1):
  ans+=dp[N][j][j*A]
print(ans)

Measured memory_bytes: 95964
#include <iostream>
#include <utility>
using namespace std;
 
int main(){
 int n,c=0,minv=0,maxv=0,a;
 cin >> n;
 int m[9]={};

 for(int i=0;i<n;i++){
    cin >> a;
    if(a/400<8){
        m[a/400]=1;
    }
    else{
        m[8]++;
    }
 }
 for(int i=0;i<8;i++){
    c+=m[i];
 }
 if(c==0){
     minv=1;
 }
 else{
    minv=c;
 }
 maxv=c+m[8];
 cout << minv << " " << maxv << endl;
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <long long mod>
class Combination
{
    std::vector<long long> fact, finv, inv;
public:
    Combination(ll sz)
    {
        fact.resize(sz);
        finv.resize(sz);
        inv.resize(sz);
        fact[0] = 1;
        for (ll i = 1; i < sz; ++i)
        {
            fact[i] = fact[i - 1] * i % mod;
        }
        inv[0] = 0;
        inv[1] = 1;
        for (ll i = 2; i < sz; ++i)
        {
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        }
        finv[0] = 1;
        for (ll i = 1; i < sz; ++i)
        {
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    long long C(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return (fact[n] * finv[k] % mod) * finv[n - k] % mod;
    }
    long long P(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return fact[n] * finv[n - k] % mod;
    }
    long long H(long long n, long long k)
    {
        return this->C(n + k - 1, k);
    }
    long long getfact(ll i)
    {
        return fact[i];
    }
    long long getinv(ll i)
    {
        return inv[i];
    }
    long long getfinv(ll i)
    {
        return finv[i];
    }
};
using ld = long double;
using P = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vector<ll>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const ll INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(ll i=0;i<(ll)(s.size());++i) {
    cout << s[i];
    if(i == (ll)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  Combination<MOD> comb(3000000);
  ll n; ll a, b, c; cin >> n >> a >> b >> c;
  ll pa = a * comb.getinv(a + b) % MOD;
  ll pb = b * comb.getinv(a + b) % MOD;
  ll ans = 0;
  ll tmpa = 1;
  for(ll i=0;i<n;++i) {
    tmpa *= pa;
    tmpa %= MOD;
  }
  ll nowx = 1;
  for(ll i=0;i<n;++i) {
    ll m = i + n;
    ll now = tmpa * nowx % MOD * comb.C(m-1, n-1) % MOD * m % MOD;
    ans += now;
    ans %= MOD;
    nowx *= pb;
    nowx %= MOD;
  }
  ll tmpb = 1;
  for(ll i=0;i<n;++i) {
    tmpb *= pb;
    tmpb %= MOD;
  }
  nowx = 1;
  for(ll i=0;i<n;++i) {
    ll m = i + n;
    ll now = tmpb * nowx % MOD * comb.C(m-1, n-1) % MOD * m % MOD;
    ans += now;
    ans %= MOD;
    nowx *= pa;
    nowx %= MOD;
  }
  cout << ans * 100 % MOD * comb.getinv(100 - c) % MOD<< endl;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define fout(x) cout << fixed << setprecision(10) << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

struct UnionFind {
  std::vector<int> parents;
  std::vector<int> num_nodes;
  std::vector<int> depth_rank;

  UnionFind(int n) {
    parents = std::vector<int>(n);
    std::iota(parents.begin(), parents.end(), 0);
    depth_rank.assign(n, 0);
    num_nodes.assign(n, 1);
  }

  int root(int x) {
    if (parents[x] == x) {
      return x;
    } else {
      return parents[x] = root(parents[x]);
    }
  }

  void unite(int x, int y) {
    int parx = root(x);
    int pary = root(y);
    if (parx == pary)
      return;
    else if (depth_rank[parx] < depth_rank[pary]) {
      num_nodes[pary] += num_nodes[parx];
      parents[parx] = pary;
    } else {
      num_nodes[parx] += num_nodes[pary];
      parents[pary] = parx;
      if (depth_rank[parx] == depth_rank[pary]) depth_rank[parx]++;
    }
  }

  bool same(int x, int y) { return root(x) == root(y); }

  int group_size(int x) { return num_nodes[root(x)]; }
};


signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  UnionFind uni(n);
  VI v(n, 0);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    uni.unite(a, b);
    v[a]++;
    v[b]++;
  }
  rep(i, k) {
    int c, d;
    cin >> c >> d;
    c--; d--;
    if(uni.same(c, d)) {
      v[c]++;
      v[d]++;
    }
  }
  rep(i, n) {
    cout << uni.group_size(i) - 1 - v[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2432
Scanf.scanf "%d %d %d" (fun n a b ->
    let h = Array.init n (fun _ -> Scanf.scanf " %d" (fun h -> h)) in
    Array.sort compare h;

    let check m =
        let c = a - b in
        let s = Array.fold_left (fun acc v ->
            acc + (max 0 (v - m * b) + c - 1) / c) 0 h
        in
        s <= m
    in

    let rec bin left right =
        if left = right then left else
            let m = (left + right) / 2 in
            if check m then bin left m
                       else bin (m + 1) right
    in
    bin 0 ((h.(n - 1) + b - 1) / b + 1) |> Printf.printf "%d\n"
)

Measured memory_bytes: 6692
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(a,b,c) for(int i=a;i<b;i+=c)  
typedef pair<ll , pair<ll, ll> > pi;
int pow(int x,int y){
    int res=1;
    while(y){
        if(y&1) res*=x;
        y>>=1;
        x*=x;
    }
    return res;
}   
struct Compare {
    constexpr bool operator()(pi const & a,
                              pi const & b) const noexcept
    { return a.first < b.first || (a.first == b.first && a.second.first > b.second.first); }
 
};
void prefix_function( string s,ll arr[] )
{
     long long border=0; arr[0]=0;
    for(long long i=1;i<s.size();i++)
    {
      while(border>0 && s[i]!=s[border])
        border=arr[border-1];
     
     if(s[i]==s[border])
         border++;
      else
       border=0;
      
      arr[i]=border;
    }
}
ll mod=998244353;
ll add( ll a , ll b)
{
    return (((a%mod)+(b%mod))%mod);
}
ll mul(ll a,ll b)
{
  return (((a%mod)*(b%mod))%mod);
}
//send mod-2 for a^-1 if mod is a prime number
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}
ll dsu_arr[100000];
ll dsu_sz[100000];
void dsu(ll n)
{
    for(ll i=0;i<=n;i++)
    {
        dsu_arr[i]=i;
        dsu_sz[i]=1;
    }
}
ll find(ll x)
{
     ll root=x;
    while (root!=dsu_arr[root])
    {
        root=dsu_arr[root];
    }
    while(x!=dsu_arr[x])
    {
        dsu_arr[x]=root;
        x=dsu_arr[x];
    }
    return root;
}
ll merge(ll x,ll y)
{
    ll root1=find(x);
    ll root2=find(y);
    
    if(root1==root2)
    return 0ll;
 
    if(dsu_sz[x]>dsu_sz[y]){
    dsu_arr[root2]=root1;
    dsu_sz[x]+=dsu_sz[y];
    }
    else
    {
         dsu_sz[y]+=dsu_sz[x];
        dsu_arr[root1]=root2;
    }
    return 1ll;
}


int main()
{

ll a,b,c;
cin>>a>>b>>c;
for(ll i=1;;i++)
{
    if((a*i)%b==c)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    if((a*i)%b==0)
    {
        break;
    }
}
cout<<"NO"<<endl;



}



   
      
    
        



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

using Edge = pair<int,ll>;

vector<Edge> g[100010];
int color[100010];

void coloring(int pre, int v, ll dist) {
    color[v] = dist%2;
    for(Edge e : g[v]){
        int to = e.first;
        ll d = e.second;
        if (to == pre) continue;
        coloring(v, to, dist + d);
    }
}

int main(void){
    int n;
    cin >> n;
    rep(i,n-1){
        int u,v;
        ll w;
        cin >> u >> v >> w;
        u--, v--;
        g[u].push_back({v,w});
        g[v].push_back({u,w});
    }
    coloring(-1, 0, 0);
    rep(i,n){
        cout << color[i] << endl;
    }

    return 0;
}


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

int main(void)
{
  ll n, k;
  cin >> n >> k;
  
  ll a, b;
  a = n % k;
  b = k-a;
  if (a<b){
    cout << a << endl;
  }else {
    cout << b << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    ct = 0
    while True:
        nums = map( int, raw_input().split())
        H = nums[0]
        W = nums[1]
        if H == 0:
            if W == 0:
                break

        so = ""
        se = ""
        j = 0
        while j < W:
            if j & 1:
                se += "."
                so += "#"
            else:
                se += "#"
                so += "."
            j += 1

        i = 0
        while i < H:
            if i & 1:
                print so
            else:
                print se
            i += 1
        print

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

int main(int argc, char const* argv[])
{
    int n;
    std::cin >> n;

    auto vec = std::vector<int>(n);

    for(auto &v: vec)
    {
        std::cin >> v;
    }

    int count = 0;
    while(true)
    {
        for(auto &v: vec)
        {
            if(v % 2 == 0)
            {
                v /= 2;
            }
            else
            {
                goto finish;
            }
        }
        count++;
    }
finish:

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll n,ans[100010],ans1;
vector<pair<ll,ll>>ch[100010];
void dep(ll p,ll c){
	ll cnt=1;
	if(ch[p].size()==1&&p!=0){
		return ;
	}
	for(ll i=0;i<ch[p].size();i++){
		ll next=ch[p][i].first;
		ll noi=ch[p][i].second;
		if(ans[noi]!=0){
			continue;
		}
		if(cnt==c){
			cnt++;
		}
		ans[noi]=cnt;
		ans1=max(ans1,cnt);
		dep(next,cnt);
		cnt++;
	}
}
int main() {
	cin>>n;
	for(ll i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		ch[x].push_back(make_pair(y,i));
		ch[y].push_back(make_pair(x,i));
	}
	dep(0,0);
	cout <<ans1<<endl;
	for(ll i=0;i<n-1;i++){
		cout << ans[i]<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 9856
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        n*=sc.nextInt();
        String ans="Yes";
        if(n%2==0)ans="No";
      
        out.println(ans);
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  

    static long gcd(long a, long b){
        if(min(a,b) == 0)return max(a,b);
        return gcd(max(a,b) % min(a,b),min(a,b));
    }
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
typedef long long ll;

using namespace std;

int n,w;
int wei[101],val[100001];
ll dp[101][100001];

ll napzac(int i,int j){
    if(dp[i][j]>=0){
        return dp[i][j];
    }
    ll res;
    if(i==n){
        res=0;
    }else if(j<wei[i]){
        res=napzac(i+1,j);
    }else{
        res=max(napzac(i+1,j),napzac(i+1,j-wei[i])+val[i]);
    }
    return dp[i][j]=res;
}

int main() {
    cin>>n>>w;
    REP(i,n){
        cin>>wei[i]>>val[i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<napzac(0,w);
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

const int MAX_N = 1001;
bool dp[MAX_N][MAX_N];
int dp2[MAX_N];

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<ll> C(N), W(N);
    rep(i, N) cin >> C[i] >> W[i];
    vector<ll> sum(N+1);
    rep(i, N) sum[i+1] = sum[i] + W[i];

    rep(i, N) dp[i][i] = true;
    for (int len=1; len<=N; len++) {
        for (int l=0; l<=N-len; l++) {
            int r = l + len - 1;
            int ww = sum[r+1] - sum[l];

            if (!dp[l][r]) continue;
            
            if (l-1 >= 0 && C[l-1] >= ww) {
                dp[l-1][r] = true;
            }
            if (r+1 < N && C[r+1] >= ww) {
                dp[l][r+1] = true;
            }

#ifdef DEBUG
            cerr << "len = " << len << ", l = " << l << endl;
            DUMP(ww);
#endif
        }
    }

#ifdef DEBUG
    rep(i, N) {
        rep(j, N) {
            cerr << "xo"[dp[i][j]] << " ";
        }
        cerr << endl;
    }
#endif

    fill(dp2, dp2+MAX_N, INF);
    dp2[0] = 0;
    for (int r=1; r<=N; r++) {
        for (int l=0; l<r; l++) {
            if (dp[l][r-1]) {
                dp2[r] = min(dp2[r], dp2[l] + 1);
            }
        }
    }

    cout << dp2[N] << endl;
}

Measured memory_bytes: 4180
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;

void lazy_query(int k, vector<int>& node, vector<int>& lazy, int n) {
	if (lazy[k] == INT_MAX)return;
	node[k] = lazy[k];
	if (k < n - 1) {
		lazy[2 * k + 1] = lazy[k];
		lazy[2 * k + 2] = lazy[k];
	}
	lazy[k] = INT_MAX;
}

void update(int a, int b, int x, int k, int l, int r, vector<int>&node, vector<int>& lazy, int n) {
	lazy_query(k, node, lazy, n);
	if (r <= a || b <= l)return;
	if (a <= l && r <= b) {
		lazy[k] = x;
		lazy_query(k, node, lazy, n);
		return;
	}
	else {
		update(a, b, x, 2 * k + 1, l, (l + r) / 2, node, lazy, n);
		update(a, b, x, 2 * k + 2, (l + r) / 2, r, node, lazy, n);
		node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		return;
	}
}

int find(int a, int b, int k, int l, int r, vector<int>&node, vector<int>& lazy, int n) {
	lazy_query(k, node, lazy, n);
	if (r <= a || b <= l)return INT_MAX;
	if (a <= l && r <= b) {
		return node[k];
	}
	else {
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2, node, lazy, n);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r, node, lazy, n);
		return min(vr, vl);
	}
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n_, q;  cin >> n_ >> q;
	int n = 1;
	while (n < n_) n *= 2;
	vector<int> node(2 * n - 1, INT_MAX);
	vector<int> lazy(2 * n - 1, INT_MAX);

	for (int i = 0; i < q; i++) {
		int com; cin >> com;
		if (com == 0) {
			int s, t, x; cin >> s >> t >> x;
			update(s, t + 1, x, 0, 0, n, node, lazy, n);
		}
		else {
			int s, t; cin >> s >> t;
			cout << find(s, t + 1, 0, 0, n, node, lazy, n) << endl;
		}
	}
}

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

int main(){
 int i;
  cin >>i;
  i %= 10;
  if(i==2 || i==4 || i==5 || i==7 || i==9){
  cout <<"hon"<<endl;
    return 0;
  }
    if(i==0 || i==1 || i==6 || i==8){
  cout <<"pon"<<endl;
    return 0;
  }else{
    cout<<"bon"<<endl;
      return 0;
    }

  
  
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N,x;cin>>N>>x;
  int ans=0,idx=0;
  vector<int> A(N);
  REP(i,0,N)cin>>A[i];
  sort(ALL(A));
  REP(i,0,N-1){
    if(x>=A[i]){
      ans++;
      x-=A[i];
    }
    else{br;}
  }
  if(x==A[N-1])ans++;
  // if(x>0)print(ans-1);
  // else 
  print(ans);




}


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

int main() {
    int R0, W, C, R;
    while(cin >> R0 >> W >> C >> R, R0) {
        for(int i=0; ; ++i) {
            if((R0 + R*i)/W >= C) {
                cout << i << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		try {
			int ope = Integer.parseInt(br.readLine());
			DoublyLinkedList(ope, br);
		} catch (NumberFormatException | IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}
	public static enum Operate{
		insert("insert"),
		delete("delete"),
		deleteFirst("deleteFirst"),
		deleteLast("deleteLast");
		
		private final String name;
		
		Operate(String name){
			this.name = name;
		}
		
		String getName(){
			return this.name;
		}

		public static Operate getEnumName(String str){
			for(Operate v : values()){
				if(v.getName().equals(str)){
					return v;
				}
			}
			throw new IllegalArgumentException("undefined : " + str);
		}
	}

	public static void DoublyLinkedList(int ope, BufferedReader br){
		ArrayDeque<String> que = new ArrayDeque<String>();
		int i;
		
		for ( i = 0; i < ope; i++) {
			String[] str;
			try {
				str = br.readLine().split(" ");
			 
				switch( Operate.getEnumName(str[0]) ){
				case insert:
					que.addFirst(str[1]);
					break;
				case delete:
					que.remove(str[1]);
					break;
				case deleteFirst:
					que.removeFirst();
					break;
				case deleteLast:
					que.removeLast();
					break;
				}
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
		}
		System.out.print(que.remove());
		while (que.isEmpty() == false) {
			System.out.print(" " + que.remove());
		}
		System.out.println();
	}
}


Measured memory_bytes: 222544
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	int ans = (H - h)*(W - w);
	cout << ans;
	ed;
	return 0;
}


Measured memory_bytes: 256
a = gets.split(" ").map {|s| s.to_i};
b = a[0] / a[1];
c = a[0] % a[1];
d = "%.8f" % "#{a[0].to_f / a[1];}"
puts b.to_s + " " + c.to_s + " " + d.to_s;

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

int main (){
        int N,M;
        cin >> N >> M;
        int a[M],b[M],c[N];
        for(int i=0; i<N; i++) {
                c[i] = 0;
        }
        for(int i=0; i<M; i++) {
                cin >> a[i] >> b[i];
                c[a[i]-1]++;
                c[b[i]-1]++;
        }
        for(int i=0; i<N; i++) {
                cout << c[i] << endl;
        }
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    long long int a;
    scanf("%lld", &a);
    long long int all[a];
    int i;
    int fo = 0;
    int min_index=0;
    int firstflag = 1;
    for(i=0; i<a; i++){
        scanf("%lld", &all[i]);
        if(all[i] < 0){
            fo++;
        }
        if(firstflag == 1){
            min_index = i;
            firstflag = 0;
        }
        if(all[i]*all[i] < all[min_index]*all[min_index]){
            min_index = i;
        }
    }
    fo = fo%2;
    if(fo == 0){
        long long int sum = 0;
        int j;
        for(j=0; j<a; j++){
            if(all[j]<0){
                sum+=-all[j];
            }
            else{
                sum+=all[j];
            }
        }
        printf("%lld", sum);
    }
    else{
        long long int sum = 0;
        int j;
        for(j=0; j<a; j++){
            if(j == min_index){
                if(all[j] < 0){
                    sum+=all[j];
                }
                else{
                    sum-=all[j];
                }
            }
            else if(all[j]<0){
                sum+=-all[j];
            }
            else{
                sum+=all[j];
            }
        }
        printf("%lld", sum);
    }
}

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

int main() {
  int h,w;
  int ans = 0;
  cin >> h >> w;
  vector<string>data(h);
  vector<vector<int>>cnt(h,vector<int>(w,0));
  rep(i,0,h) cin >> data[i];
  queue<P>que;
  rep(i,0,h) rep(j,0,w) if(data[i][j] == '#') que.push(P(i,j));
  while(!que.empty()){
    int x,y;
    x = que.front().first;
    y = que.front().second;
    que.pop();
    if(x > 0) if(data[x-1][y] == '.'){
      data[x-1][y] = '#';
      que.push(P(x-1,y));
      cnt[x-1][y] = cnt[x][y]+1;
      ans = cnt[x-1][y];
    }
    if(x < h-1) if(data[x+1][y] == '.'){
      data[x+1][y] = '#';
      que.push(P(x+1,y));
      cnt[x+1][y] = cnt[x][y]+1;
      ans = cnt[x+1][y];
    }
    if(y > 0) if(data[x][y-1] == '.'){
      data[x][y-1] = '#';
      que.push(P(x,y-1));
      cnt[x][y-1] = cnt[x][y]+1;
      ans = cnt[x][y-1];
    }
    if(y < w-1) if(data[x][y+1] == '.'){
      data[x][y+1] = '#';
      que.push(P(x,y+1));
      cnt[x][y+1] = cnt[x][y]+1;
      ans = cnt[x][y+1];
    }
  }
  cout << ans << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> ii;
typedef complex<ld> cp;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<cp> vcp;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i,l,r) for( int i = (l) ; i < (r) ; i++ )
#define forb(i,r,l) for( int i = (r) ; i >= (l) ; i-- )
#define log2i(x) 32 - __builtin_clz((x)) - 1
#define log2ll(x) 64 - __builtin_clzll((x)) - 1
#define Pi acos(-1.0)
#define sz(x) (int)x.size()
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int N = 2e5+7;
int n,sl;
ll ans=0;
int a[N];

int main() {
#ifndef ONLINE_JUDGE
    freopen("test.inp","r",stdin);
    freopen("test.out","w",stdout);
#endif
    fastIO;
    cin >> n;
    forw(i,0,n) cin >> a[i];
    sort(a,a+n,greater<int>());
    ans+=a[0], sl=1;
    forw(i,1,n) {
        if(sl+2<n) sl+=2, ans+=2*a[i];
        else if(sl<n-1) ans+=a[i], sl++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4408
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254 より

macro_rules! eprint {
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = write!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! eprintln {
    () => { eprintln!(""); };
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = writeln!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! dbg {
    ($v:expr) => {{
        let val = $v;
        eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
        val
    }}
}

macro_rules! mat {
    ($($e:expr),*) => { Vec::from(vec![$($e),*]) };
    ($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
    ($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
    ($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
    ($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
        $a$([$i])*.$f($($t),*)
    };
    ($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
        let t = $e;
        ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
    } };
}

pub fn readln() -> String {
    let mut line = String::new();
    ::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
    line
}

macro_rules! read {
    ($($t:tt),*; $n:expr) => {{
        let stdin = ::std::io::stdin();
        let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
            let line = line.unwrap();
            let mut it = line.split_whitespace();
            _read!(it; $($t),*)
        }).collect::<Vec<_>>();
        ret
    }};
    ($($t:tt),*) => {{
        let line = readln();
        let mut it = line.split_whitespace();
        _read!(it; $($t),*)
    }};
}

macro_rules! _read {
    ($it:ident; [char]) => {
        _read!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        Vec::from(_read!($it; String).into_bytes())
    };
    ($it:ident; usize1) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_read!($it; $t)),*)
    };
}


pub fn main() {
    let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: i64 = 998244353;
// const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

fn solve() {
    let (a,b,c,d) = read!(i64,i64,i64,i64);
    let mut ma = a*c;
    ma = max(ma,a*d);
    ma = max(ma,b*c);
    ma = max(ma,b*d);
    println!("{}",ma);
}

fn run() {
    solve();
}


Measured memory_bytes: 2268
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	x,y,a,b,c = MI()
	p = LI()
	p.sort(reverse=True)
	q = LI()
	q.sort(reverse=True)
	r = LI()

	p = p[:x]
	q = q[:y]
	pqr = p+q+r
	pqr.sort(reverse=True)
	print(sum(pqr[:x+y]))

if __name__ == '__main__':
	main()

Measured memory_bytes: 23472
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		if (n >= 1 && n <= 999) {
			System.out.println("ABC");
		} else {
			System.out.println("ABD");
		}
	}
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 21204
#pragma GCC optimize("Ofast")
#include<stdio.h>
int main(void)
{
  char buf[400002];
  int i = 0;
  while(1) if(EOF == (buf[++i] = getchar_unlocked())) break;
  int ans = 0;
  i >>= 1;
  char* x = buf + i;
  while(--i) ans += buf[i] != x[i];
  printf("%d", ans);
}


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

int main()
{
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    
    sort(a , a + n);
    reverse(a , a + n);

    long long ans = -a[0];
    for (int i = 0; i < n / 2; i++)
    {
        ans += a[i] * 2;
    }
    if(n % 2 == 1)ans += a[n / 2];

    cout << ans << endl;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

// int N;
vector<int> A, B, C;
const int MAX = 400;

int dp[41][MAX+1][MAX+1];
// dp[n][a][b] := n 番目までの薬品で a : b の溶液を作るときの最小コスト

/*
int solve(int n, int a, int b)
{
    if (n == N) return 0;
}
*/

int main()
{
    ios::sync_with_stdio(false);

    int N, MA, MB;
    cin >> N >> MA >> MB;

    A.resize(N), B.resize(N), C.resize(N);
    rep(i, N) cin >> A[i] >> B[i] >> C[i];
    fill(dp[0][0], dp[0][0] + 41*(MAX+1)*(MAX+1), INF);

    dp[0][0][0] = 0;

    for (int n=0; n<N; n++) {
        for (int a=0; a<=MAX; a++) {
            for (int b=0; b<=MAX; b++) {
                // if (dp[n][a][b] == INF) continue;
                dp[n+1][a][b] = min(dp[n+1][a][b], dp[n][a][b]);
                int aa = a + A[n];
                int bb = b + B[n];
                if (aa > MAX || bb > MAX) continue;
                dp[n+1][aa][bb] = min(dp[n+1][aa][bb], dp[n][a][b] + C[n]);
            }
        }
    }

    int ans = INF;
    for (int m=1; m*MA <= MAX && m*MB <= MAX; m++) {
        ans = min(ans, dp[N][m*MA][m*MB]);
    }

    cout << (ans != INF ? ans : -1) << endl;

    /*
    rep(n, N+1) rep(a, 11) rep(b, 11) {
        if (dp[n][a][b] == INF) continue;
        cerr << "dp(" << n << ", " <<  a << ", "<<  b << ") = " << dp[n][a][b] << endl;
    }
    */
}



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

const int maxn = 3000+10;
double dp[maxn][maxn], p[maxn];

int main() {
	//freopen("demo.in", "r", stdin);
	//freopen("demo.out", "w", stdout);
	
	int n;	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%lf", &p[i]);
	
	dp[0][0] = 1.0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			int x = j, y = i-j;
			if (x) dp[x][y] += dp[x-1][y] * p[i];
			if (y) dp[x][y] += dp[x][y-1] * (1 - p[i]);
		}
	}
	double ans = 0.0;
	for (int i = n, j = 0; i > j; i--, j++) ans += dp[i][j];
	printf("%.9f\n", ans);

	return 0;
}

Measured memory_bytes: 70016
import heapq
N, M = map(int, input().split())

fee = [[] for _ in range(10**5+10)]  # i日後に収入がもらえるバイトの価値
for _ in range(N):
    a, b = map(int, input().split())
    fee[a].append(-b)

task = []
ans = 0

# 締め切り日からさかのぼっていって、できるバイトで最大の収入をもらえるやつを実行する感じ
for i in range(1, M + 1):
    for f in fee[i]:
        heapq.heappush(task, f)

    if task:
        ans -= heapq.heappop(task)

print(ans)


Measured memory_bytes: 17864
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	int k;
	cin >> k;
	string s;
	cin >> s;
	if (sz(s) <= k) cout << s << endl;
	else {
		rep(i, k) cout << s[i];
        cout<<"..."<<endl;
	}
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main(void){
        int N;
        scanf("%d", &N);
        printf("Christmas");
        for (int i = 0; i <abs( N-25); i++) {
                printf(" Eve");
        }
        printf("\n");
        return 0;
}

Measured memory_bytes: 128
def main():
    S = input()
    T = input()
    answer = solve(S, T)
    print(answer)


def solve(S, T):
    min_diff_cnt = len(T)
    for i in range(len(S) - len(T) + 1):
        s = S[i:i+len(T)]
        diff = [(x, y) for x, y in zip(list(s), list(T)) if x != y]
        diff_cnt = len(diff)
        if diff_cnt < min_diff_cnt:
            min_diff_cnt = diff_cnt

    return min_diff_cnt

if __name__ == "__main__":
    main()


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

using namespace std;

#define ll long long

#define DEBUG (0)

int main()
{
  int N = 0;
  cin >> N;
  N = N%10;

  switch(N){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon" << "\n";
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon" << "\n";
      break;
    case 3:
      cout << "bon" << "\n";
      break;
    default:
      break;
  }
  
}


Measured memory_bytes: 3636
using System;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] F = new int[n + 1];
            //エラトステネスのふるい風の素因数分解
            for (long i = 1; i <= n; i++)//longじゃないとオーバーフロー
            {
                int m = 1;
                while (m * i <= n)
                {
                    F[m * i]++;
                    m++;
                }
            }
            long sum = 0;
            for (long i = 1; i <= n; i++)//longじゃないとオーバーフロー
            {
                sum += i * F[i];
            }
            Console.WriteLine(sum);
        }
    }
}


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

int n,m,t;
int a[3005][3005];
long long dp[3005][3005][4];

int main(){

    scanf("%d %d %d",&n,&m,&t);
    for(int i=0;i<t;i++){
        static int r,c,v;
        scanf("%d %d %d",&r,&c,&v);
        a[r][c]=v;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[i][j][0]=*max_element(dp[i-1][j],dp[i-1][j]+4);
            dp[i][j][1]=max(max(dp[i][j-1][0],dp[i][j][0])+a[i][j],dp[i][j-1][1]);
            dp[i][j][2]=max(dp[i][j-1][1]+a[i][j],dp[i][j-1][2]);
            dp[i][j][3]=max(dp[i][j-1][2]+a[i][j],dp[i][j-1][3]);
        }
    }
    printf("%lld\n",*max_element(dp[n][m],dp[n][m]+4));

    return 0;
}

Measured memory_bytes: 320560