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

string S; int N, cnt;

int main() {
	cin >> N >> S;
	for (int i = 0; i < 1000; i++) {
		int c[3] = {i / 100, (i / 10) % 10, i % 10};
		int f = 0;
		for (int j = 0; j < N; j++) {
			if (S[j] == ('0' + c[f])) f++;
			if (f == 3) break;
		}
		if (f == 3) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

int main() {
    int n, k; cin >> n >> k;
    vector<int> l(n);
    for(auto& e : l) cin >> e;
    
    sort(l.begin(), l.end());
    cout << accumulate(l.end()-k, l.end(), 0) << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>

using namespace std;

int main()
{
  vector<int> v(3);
  for (int i = 0; i < 3; ++i) {
    cin >> v[i];
  }
  int ans = 100000;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
	if (i != j and i != k and j != k) {
	  ans = min(ans, abs(v[j] - v[i]) + abs(v[k] - v[j]));
	}
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
typedef pair<db, db> pdd;

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int main(){
    int N, L;
    scanf("%d%d", &N, &L);

    db VT = 0;
    deque<pdd> dq;
    for(int i=1;i<=N;i++){
        db t, v;
        scanf("%lf%lf", &t, &v);
        if(i > 1){
            db val = v;
            while(!dq.empty() && val > 0){
                if(dq.front().second > val){
                    VT -= dq.front().first*val;
                    dq.front().second -= val;
                    val = 0;
                    break;
                }
                else{
                    VT -= dq.front().first*dq.front().second;
                    val -= dq.front().second;
                    dq.pop_front();
                }
            }
        }
        VT += v*1.0*t;
        printf("%.10lf\n", VT/L);
        while(!dq.empty() && dq.back().first >= t){
            t = (dq.back().first*dq.back().second + v*1.0*t)/(v+dq.back().second);
            v += dq.back().second;
            dq.pop_back();
        }
        dq.push_back(pdd(t, v));
    }   
}

Measured memory_bytes: 18704
from itertools import product

A = range(int(input()) + 1)
B = range(int(input()) + 1)
C = range(int(input()) + 1)
X = int(input())

count = 0
for a, b, c in product(A, B, C):
    sum = (500 * a) + (100 * b) + (50 * c)
    if sum == X: count += 1
print(count)

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	
	int n, x,a[1008],sum=0;
	cin >> n >> x;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	for (int i = 0; i < x; ++i)
		sum += a[i];
	cout << sum;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

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

    int A[N];
    rep(i, N){
        cin >> A[i];
    }
    int res = 0;
    int right = 0;
    while(true) {
        if (res == 0) right += K;
        else right += K - 1;
        ++res;

        if (right >= N) break;
    }
    cout << res << endl;


}

Measured memory_bytes: 640
NIL = -1


class Node():
    def __init__(self, key=NIL, parent=NIL, left=NIL, right=NIL):
        self.key = key
        self.parent = parent
        self.left = left
        self.right = right


class BinaryTree():
    def __init__(self, node):
        self.root = node

    def insert(self, key):
        if self.root.key == NIL:
            self.root.key = key
            return

        now = self.root
        while now != NIL:
            parent = now
            if   key < now.key:
                now = now.left
            elif key > now.key:
                now = now.right
            else:
                raise
        
        insert = Node(key, parent)

        if   insert.key < parent.key:
            parent.left = insert
        elif insert.key > parent.key:
            parent.right = insert
        else:
            raise

    def treewalk_inorder(self, node):
        if isinstance(node, int):
            return

        self.treewalk_inorder(node.left)
        print(f" {node.key}", end="")
        self.treewalk_inorder(node.right)

    def treewalk_preorder(self, node):
        if isinstance(node, int):
            return

        print(f" {node.key}", end="")
        self.treewalk_preorder(node.left)
        self.treewalk_preorder(node.right)



n = int(input())

root_node = Node()
binary_tree = BinaryTree(root_node)


for _ in range(n):

    command, *list_num = input().split()

    if   command == "insert":
        k = int(list_num[0])
        binary_tree.insert(k)
    elif command == "print":
        binary_tree.treewalk_inorder(root_node)
        print()
        binary_tree.treewalk_preorder(root_node)
        print()
    else:
        raise



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

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

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	ll N,A,B; cin >> N >> A >> B;
	if(N < A+B-1 || N > A*B){
		cout << -1 << endl;
		return 0;
	}
	using P = pair<ll,ll>;
	int free = N - (A+B-1);
	V<P> ps;
	rep(i,A){
		rep(j,B){
			if(i == 0 || j == 0){
				ps.pb(i*B+j,(i+1)*B-1-j);
			}else{
				if(free == 0) break;
				ps.pb(i*B+j,(i+1)*B-1-j);
				free--;
			}
		}
	}
	assert(si(ps) == N);
	sort(all(ps));
	V<ll> ys;
	rep(i,N) ys.pb(ps[i].sc);
	mkuni(ys);
	for(P p: ps){
		cout << lower_bound(all(ys),p.sc) - ys.begin() + 1 << " ";
	}
	cout << endl;
}


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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 300005;
const int mod = 1e9 + 7;

int n, ans, suf[N], f[N][2][2][3];
char s[N];

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  scanf("%s", s), n = strlen(s), f[0][0][0][0] = suf[n] = 1;
  for (int i = n - 1; ~i; --i) {
    suf[i] = 1LL * suf[i + 1] * ((s[i] == '?') + 1) % mod;
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] != '1') {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          for (int l = 0; l < 3; ++l) {
            f[i + 1][j][k][(l & 1) + 1] = (f[i + 1][j][k][(l & 1) + 1] + f[i][j][k][l]) % mod;
          }
        }
      }
    }
    if (s[i] != '0') {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          if (!j && !k) {
            f[i + 1][1][1][0] = (f[i + 1][1][1][0] + f[i][j][k][0]) % mod;
          } else if (j && k) {
            ans = (1LL * f[i][j][k][0] * suf[i + 1] + ans) % mod;
          } else {
            f[i + 1][!j][k][0] = (f[i + 1][!j][k][0] + f[i][j][k][0]) % mod;
          }
          f[i + 1][j][k][0] = (f[i + 1][j][k][0] + f[i][j][k][1]) % mod;
          f[i + 1][!j][k][0] = (f[i + 1][!j][k][0] + f[i][j][k][2]) % mod;
        }
      }
    }
  }
  printf("%d\n", (ans + f[n][1][1][0]) % mod);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 15744
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace aoj1
{
    class Program
    {
        static void Main()
        {
            int[] num = IntInput();
            int x = num[0];
            int y = num[1];
            Console.WriteLine("{0} {1}", x * y, 2 * x + 2 * y);
        }

        static int[] IntInput()
        {
            string[] strs = Console.ReadLine().Split(' ');
            int[] numbers = new int[strs.Length];
            for (int i = 0; i < strs.Length; i++)
            {
                numbers[i] = int.Parse(strs[i]);
            }
            return numbers;
        }
    }
}

Measured memory_bytes: 19964
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
	ll a,b,c, o = 0,i,ans;
	cin >> a >> b >> c;  
	o = b * c * (a / 2 + a % 2) -  b * c * (a / 2);
	i = a * c * (b / 2 + b % 2) - a * c * (b / 2);
	ans = min(min(o,i), b * a * (c / 2 + c % 2) - b * a * (c / 2));
	cout << ans << endl;
}

Measured memory_bytes: 256
def BFS(x):
  cnt=1
  v=deque([x])
  k=0
  zu[x]=k
  lis=[x]
  roots[x]=x
  
  while len(v)>0:
    a=v.popleft()
    roots[a]=x
    for i in fr[a]:
      if zu[i]==-1:
        zu[i]=zu[a]+1
        v.append(i)
        cnt += 1
        lis.append(i)

          
  return lis

##############################

from collections import deque
N,M,K=map(int,input().split())
A=[0]*M
B=[0]*M
C=[0]*K
D=[0]*K
fr=[ [] for _ in range(N)]
bl=[ set() for _ in range(N)]
zu=[ -1 for _ in range(N)] #訪問済みリスト
roots= [ -1 for _ in range(N)]

for i in range(M):
  A[i],B[i]= map(int,input().split())
  fr[A[i]-1].append(B[i]-1)
  fr[B[i]-1].append(A[i]-1)
for k in range(K):
  C[k],D[k]= map(int,input().split())
  bl[C[k]-1].add(D[k]-1)
  bl[D[k]-1].add(C[k]-1)
fr_set= [set(fr[i]) for i in range(N)]
    
size=[0]*N
pena=[0]*N
for i in range(N):
  if zu[i]==-1:
    kumi=BFS(i) #リスト
    for k in range(len(kumi)):
      size[kumi[k]]=len(kumi)
      
      
ans=[0 for _ in range(N)]      
for i in range(N):
  ans[i]= size[i]-1 - len(fr[i])
  for j in bl[i]:
    if roots[j]==roots[i]:
      ans[i] -= 1      
      
print(*ans)


Measured memory_bytes: 108104
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<vector<int>> C(N, vector<int>(N));
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cin >> C[i][j];
    }
  }
  long long ans = 0;
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      ans += min(C[i][j], C[j][i]);
    }
  }
  cout << ans << endl;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long
#define MAX_V 10000

typedef pair<ll, ll> P;
set<int> st;
int point;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    ll ai, bi;
    vector<int> retu(n);
    vector<int> a(n), b(n);
    REP(i, n) retu[i] = i+1;
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    ll idx = 0;

    do {
        if(retu == a) ai = idx;
        if(retu == b) bi = idx;
        idx++;
    } while (next_permutation(retu.begin(), retu.end()));

    cout << abs(ai-bi) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char S[4];
  int i;
  int ans=0;
  
  for(i=0;i<4;i++){
    S[i] = getchar();
    if(S[i]=='+'){
      ans++;
    }else{
      ans--;
    }
  }
  
  printf("%d\n",ans);
  
  return(0);
}

Measured memory_bytes: 128
class Queue:
    queue_list = []
    def enqueue(self, a):
        self.queue_list.append(a)
    def dequeue(self):
        return self.queue_list.pop(0)
    def isEmpty(self):
        return len(self.queue_list) == 0

n, q = list(map(lambda x: int(x), input().strip().split()))

queue = Queue()

for i in range(n):
    queue.enqueue(input().strip().split())


sum_time = 0
while not queue.isEmpty():
    name, time = queue.dequeue()
    if int(time) <= q:
        sum_time += int(time)
        print(name + ' ' + str(sum_time))
    else:
        queue.enqueue([name, str(int(time) - q)])
        sum_time += q



Measured memory_bytes: 16836
#!/usr/bin/env python3
import sys


def solve(X: int):
    target = 360
    count = 0
    while True:
        mod = target % X
        div = target // X
        count += div
        if mod == 0:
            break
        else:
            target = 360 + mod

    print(count)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }


int N,K;


void compute() {

}

vector<int> compress(vector<int> p,map<ll,ll> &mp) {
  vector<int> vec = p;
  rep(i,(int)p.size()) {
    vec.push_back(p[i]-1LL);
    vec.push_back(p[i]+1LL);
  }
  sort(ALL(vec));
  vec.erase(unique(ALL(vec)),vec.end());
  vector<int> q;

  //puts("===");
  rep(i,(int)p.size()) {
    int ptr = lower_bound(ALL(vec),p[i]) - vec.begin();
    q.push_back( ptr );
    //cout << p[i] << " = " << ptr << endl;
    mp[ptr] = p[i];
  }



  
  return q;
}

bool mp[200][200];
int sum[200][200];

int main() {
  cin >> N >> K;
  vector<int> x(N), y(N);
  rep(i,N) {
    cin >> x[i] >> y[i];
  }
  map<ll,ll> X,Y;
  x = compress(x,X);
  y = compress(y,Y);
  memset(mp,false,sizeof mp);
  int H = 0, W = 0;
  rep(i,N) {
    mp[y[i]][x[i]] = true;
    H = max(H,y[i]+1);
    W = max(W,x[i]+1);
  }
  memset(sum,0,sizeof sum);
  rep(i,H) {
    rep(j,W) {
      sum[i][j] += mp[i][j];
      if( i - 1 >= 0 ) sum[i][j] += sum[i-1][j];
      if( j - 1 >= 0 ) sum[i][j] += sum[i][j-1];
      if( i - 1 >= 0 && j - 1 >= 0 ) sum[i][j] -= sum[i-1][j-1];
    }
  }
  ll mini = LLONG_MAX;
  rep(y1,H) {
    rep(x1,W) {
      REP(y2,y1,H) {
	REP(x2,x1,W) {
	  int v = sum[y2][x2];
	  if( y1 - 1 >= 0 ) v -= sum[y1-1][x2];
	  if( x1 - 1 >= 0 ) v -= sum[y2][x1-1];
	  if( y1 - 1 >= 0 && x1 - 1 >= 0 ) v += sum[y1-1][x1-1];
	  if( X.count(x1) == 0 ) continue;
	  if( X.count(x2) == 0 ) continue;
	  if( Y.count(y1) == 0 ) continue;
	  if( Y.count(y2) == 0 ) continue;
		  
	  if( v >= K ) {
	    ll X1 = X[x1];
	    ll X2 = X[x2];
	    ll Y1 = Y[y1];
	    ll Y2 = Y[y2];

	    mini = min(mini,llabs(X1-X2)*llabs(Y1-Y2));
	  }
	}
      }
    }
  }
  cout << mini << endl;
  compute();
  return 0;
}


Measured memory_bytes: 512
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N = k()
a = []
b = []
for i in range(N):
    A,B = I()
    a.append(A)
    b.append(B)
for i in range(N-1,-1,-1):
    x = a[i]
    y = b[i]
    x += ans
    x = x%y
    if x == 0:
        continue
    ans += y-x

print(ans)


Measured memory_bytes: 17800
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
template <typename T>
T pow(T a, ll n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}
 
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
 
using mint = ModInt<1000000007>;
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll a, b, c, x, y; cin >> a >> b >> c >> x >> y;
    ll min_sum = 1e15;

    ll z = max(x, y);
    for(ll i = 0; i <= z; i++){
        ll sum = i * c * 2 + max(x - i, 0LL) * a + max(y - i, 0LL) * b;
        min_sum = min(min_sum, sum);
    }
    cout << min_sum << endl;
}

Measured memory_bytes: 3660
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
	}
	wa := make(map[int]int, 0)
	sa := make(map[int]int, 0)
	for i := 0; i < N; i++ {
		wa[i+A[i]]++
		sa[i-A[i]]++
	}
	ans := 0
	for k, v_wa := range wa {
		if v_sa, ok := sa[k]; ok {
			ans += v_sa * v_wa
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 25208
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

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

    int N;
    cin >> N;

    for (int q = 0; q < N; ++q) {
        string cmd;
        cin >> cmd;

        int a, b;
        cin >> a >> b;

        if (cmd == "print") {
            cout << S.substr(a, b - a + 1) << endl;
        } else if (cmd == "reverse") {
            reverse(S.begin() + a, S.begin() + b + 1);
        } else if (cmd == "replace") {
            string T;
            cin >> T;
            for (int i = a; i <= b; ++i) {
                S[i] = T[i - a];
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,c[N],k;
struct zhihuan{
	int a[N];
	zhihuan operator *(const zhihuan &b)const {
		zhihuan x;
		for (int i=1;i<=n;i++)x.a[i]=a[b.a[i]];
		return x;
	}
}I,p,q;
zhihuan inv(zhihuan x){
	for (int i=1;i<=n;i++)c[x.a[i]]=i;
	for (int i=1;i<=n;i++)x.a[i]=c[i];
	return x;
}
zhihuan ksm(zhihuan x,int y){
	zhihuan z=I;
	for (;y;y>>=1,x=x*x)
		if (y&1)z=z*x;
	return z;	
}
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)I.a[i]=i;
	for (int i=1;i<=n;i++)scanf("%d",&p.a[i]);
	for (int i=1;i<=n;i++)scanf("%d",&q.a[i]);
	zhihuan Ans=q*inv(p)*inv(q)*p;
	int t=k%6;if (t==0)t=6;
	int ttt=(k-t)/6;zhihuan A=ksm(Ans,(k-t)/6);k=t;
	Ans=I;
	if (k==1)Ans=A*p*inv(A);
	if (k==2)Ans=A*q*inv(A);
	if (k==3)Ans=A*q*inv(p)*inv(A);
	if (k==4)A=A*q,Ans=A*inv(p)*inv(A);
	if (k==5)A=A*q*inv(p),Ans=A*inv(q)*inv(A);
	if (k==6)A=A*q*inv(p),Ans=A*inv(q)*p*inv(A);
	for (int i=1;i<=n;i++)printf("%d ",Ans.a[i]);
}

Measured memory_bytes: 13184
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> cake(H,vector<char>(W));
  vector<int> berry(H);
  for(int i=0; i<H; i++){
      bool ichigo = false;
    for(int j=0; j<W; j++){
      cin >> cake.at(i).at(j);
      if(cake.at(i).at(j) == '#'){
        ichigo = true;
      }
    }
    if(ichigo){
      berry.at(i) = 1;
    }
  }
  vector<vector<int>> ans(H,vector<int>(W));
  int cnt = 1;
  for(int i=0; i<H; i++){
    int num = 0;
    if(berry.at(i) == 0){
      continue;
    }
    for(int j=0; j<W; j++){
      if(cake.at(i).at(j) == '#'){
        num++;
      }
      if(num < 2){
        ans.at(i).at(j) = cnt;
      }
      else{
        cnt++;
        ans.at(i).at(j) = cnt;
        num = 1;
      }
    }
    cnt++;
  }
  
  for(int i=0; i<H-1; i++){
    if(berry.at(i) == 0){
      int y = 0;
      for(int k=i; k<H; k++){
        if(berry.at(k) == 1){
          y = k;
          break;
        }
      }
      if(y != 0){
        berry.at(i) = 1;
        for(int j=0; j<W; j++){
          ans.at(i).at(j) = ans.at(y).at(j);
        }
      }
    }
  }
  
  for(int i=H-1; i>0; i--){
    if(berry.at(i) == 0){
      int y = H-1;
      for(int k=i; k>=0; k--){
        if(berry.at(k) == 1){
          y = k;
          break;
        }
      }
      if(y != H-1){
        for(int j=0; j<W; j++){
          ans.at(i).at(j) = ans.at(y).at(j);
        }
      }
    }
  }
      
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << ans.at(i).at(j);
      if(j == W-1){
        cout << endl;
      }
      else{
        cout << " ";
      }
    }
  }
  
} 

Measured memory_bytes: 1280
s = input()
t = input()

sl = len(s)
tl = len(t)
count = 0
for i in range(0,sl-tl+1):
    sb = s[i:i+tl]

    co = 0
    for j in range(tl):

        
        if sb[j] == t[j]:
            co += 1
    if co > count:
        count = co


print(tl - count)


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a == b) {
    cout << "Draw" << endl;
  } else if (a == 1) {
    cout << "Alice" << endl;
  } else if (b == 1) {
    cout << "Bob" << endl;
  } else if (a > b) {
    cout << "Alice" << endl;
  } else {
    cout << "Bob" << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	if strings.Count(s, "A") != 0 && strings.Count(s, "B") != 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1836
N, M = map(int, input().split())

num = [0]*N
TorF = [False] * N

for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    if S == "WA" and TorF[p-1] == False:
        num[p-1] += 1
    elif S == "AC":
        TorF[p-1] = True

maru = 0
pena = 0

for i in range(N):
    if TorF[i]:
        maru += 1
        pena += num[i]

print(maru, pena)

Measured memory_bytes: 45656
import math

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

p = 0
q = 0

for i in range(N-1):
	tmp = 0
	n = P.pop(0)
	for x in range(N):
		if not (x+1 in P) and x+1 < n : tmp += 1
	p += (n-tmp-1) * math.factorial(N-(i+1))
	
	tmp = 0
	n = Q.pop(0)
	for x in range(N):
		if not (x+1 in Q) and x+1 < n : tmp += 1
	q += (n-tmp-1) * math.factorial(N-(i+1))

print(abs(p-q))

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  vector<int> A(3);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 3; ++i) scanf("%d", &A[i]);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int prod = 1;
  for (int i = 0; i < n; ++i) prod *= 4;
  vector<int> S(3);
  int ret = 1 << 30;
  for (int k = 0; k < prod; ++k) {
    fill(S.begin(), S.end(), 0);
    int cost = 0, t = k;
    for (int i = 0; i < n; ++i) {
      if (t % 4 != 3) {
        cost += 10;
        S[t % 4] += a[i];
      }
      t /= 4;
    }
    if (S[0] == 0 || S[1] == 0 || S[2] == 0) continue;
    cost -= 30;
    for (int i = 0; i < 3; ++i) {
      cost += abs(S[i] - A[i]);
    }
    ret = min(ret, cost);
  }
  printf("%d\n", ret);
  return 0;
}


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

#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define hsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define hkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define zen(v) (v).begin(),(v).end()
#define yu(v) v.erase(unique(zen(v)), v.end());
//#define syutu(v) si(a, (v).size()) {cout << v[a];if(a != v.size()-1)cout << " ";else cout << endl;}
#define mug 10000000111;
#define yo 10000000711;
#define kyo 1e-9;

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

using namespace std;
typedef long long sei;
typedef long double xyo;
typedef vector<sei> vs;
typedef vector<xyo> vx;
typedef vector<vs> vvs;
typedef vector<vx> vvx;
typedef pair<sei, sei> ks;
typedef bool singi;

sei dai(sei a, sei b){return max(a,b);}
sei syo(sei a, sei b){return min(a,b);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    sei N;
    cin >> N;
    if(N%2 == 0) cout << N << endl;
    else cout << 2*N << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

struct ExtendedSieve{
    vector<int> table;
    const int n;

    ExtendedSieve(int __n) : n(__n + 1) {
        table.assign(n, 0);
        table[0] = table[1] = 1;
        for(int i = 2; i <= n; ++i){
            if(table[i] > 0)    continue;
            table[i] = i;
            for(int j = i + i; j <= n; j += i){
                if(table[j] == 0)   table[j] = i;
            }
        }
    }

    map<int, int> prime_factorization(int x){
        map<int, int> res;
        while(x > 1){
            ++res[table[x]];
            x /= table[x];
        }
        return res;
    }
};

constexpr int M = 1000000;
int cnt[M + 5];

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

    int N;
    cin >> N;
    vector<int> A(N);
    int G = 0;
    for(int i = 0; i < N; ++i){
        cin >> A[i];
        G = gcd(G, A[i]);
    }
    if(G > 1){
        cout << "not coprime\n";
        return 0;
    }
    ExtendedSieve sieve(M);
    vector<int>& dp = sieve.table;
    for(int i = 0; i < N; ++i){
        vector<int> prime(1, 1);
        while(A[i] != 1){
            if(dp[A[i]] != prime.back())    prime.emplace_back(dp[A[i]]);
            A[i] /= dp[A[i]];
        }
        for(int j = 1; j < (int)prime.size(); ++j){
            if(cnt[prime[j]]){
                cout << "setwise coprime\n";
                return 0;
            }
            ++cnt[prime[j]];
        }
    }
    cout << "pairwise coprime\n";
}

Measured memory_bytes: 11408
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <stack>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	int n;
	cin >> n;
	std::vector< std::pair<int,std::string> > th(n);
	for (int i = 0; i < n; i++) {
		cin >> th[i].first;
		cin >> th[i].second;
	}

	int now = 0;
	int d = 1;
	std::vector<bool> check(n,false);
	std::stack<int> s;
	std::stack<int> deep;
	std::stack<std::string> name;
	std::string temp;
	s.push(1);
	deep.push(0);
	name.push(th[0].second);
	while ( !s.empty() ) {
		cout << name.top() << endl;
		d = deep.top()+1;
		now = s.top();
		name.pop();
		deep.pop();
		s.pop();
		for (int i = 0; i < n; i++) {
			if ( th[n-1-i].first == now && !check[n-i-1] ) {
				temp = "";
				for (int k = 0; k < d; k++) {
					temp += ".";
				}
				temp += th[n-1-i].second;
				name.push(temp);
				deep.push(d);
				s.push(n-i);
			}
		}
	}
	return 0;
}	

Measured memory_bytes: 3332
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a,b; cin>>a>>b;
    if(a > b) {
    	swap(a, b);
    }
    int mid = (b - a)/ 2 + a;
    if((mid - a) != (b - mid)) {
    	cout<<"IMPOSSIBLE";
    } else {
    	cout<<mid;
    }

    return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, m;
	scanf("%d%d", &n, &m);
	vii job(n);
	for (int i = 0; i < n; i++) scanf("%d%d", &job[i].first, &job[i].second);

	sort(all(job));
	multiset<int> pay;
	ll answer = 0;
	for (int d = 1, i = 0; d <= m; d++) {
		while (i < n && job[i].first <= d) {
			pay.insert(-job[i].second);
			i++;
		}
		if (!pay.empty()) {
			answer -= *pay.begin();
			pay.erase(pay.begin());
		}
	}
	printf("%lld\n", answer);
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);

#define INF 0x3f3f3f3f
#define eps 1e-5

typedef long long LL;
const double pi = acos(-1.0);
const long long mod = 25 * 1E8;
using namespace std;

int a[1000005];
LL cnt;
int l;
int N;
vector<int> G;

void insertionSort(int g,int N)
{
    for(int i = g;i < N;i++)
    {
        int v = a[i];
        int j = i - g;
        while(j >= 0 && a[j] > v)
        {
            a[j + g] = a[j];
            j -= g;
            cnt++;
        }
        a[j + g] = v;
    }
}

void shellSort(int N)
{
    int h = 1;
    while(1)
    {
        //if(h > N)
            //break;
        //printf("h = %d,N = %d\n",h,N);
        G.push_back(h);
        h = 3 * h + 1;
        if(h > N)
            break;
    }
    for(int i = G.size() - 1;i >= 0;i--)
        insertionSort(G[i],N);
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(0);cin.tie(0);
    int N;
    cin >> N;
    //printf("N = %d\n",N);
    for(int i = 0;i < N;i++)
        cin >> a[i];
    cnt = 0;
    shellSort(N);
    cout << G.size() << endl;
    for(int i = G.size() - 1;i > 0;i--)
        printf("%d ",G[i]);
    printf("%d\n",G[0]);
    printf("%d\n",cnt);
    for(int i = 0;i < N;i++)
        printf("%d\n",a[i]);
    return 0;
}

Measured memory_bytes: 7024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	static const int DMAX = 80 * 80 * 80 + 5;
	static const int MAX = DMAX * 2;

	int H, W; cin >> H >> W;
	vector<vector<int>> A(H, vector<int>(W));
	rep(i, 0, H) rep(j, 0, W) { cin >> A[i][j]; }
	vector<vector<int>> B(H, vector<int>(W));
	rep(i, 0, H) rep(j, 0, W) { cin >> B[i][j]; }

	vector<vector<bitset<MAX>>> dp(H, vector<bitset<MAX>>(W));

	dp[0][0].set(A[0][0] - B[0][0] + DMAX);
	dp[0][0].set(B[0][0] - A[0][0] + DMAX);

	static const int di[] = { 1,0 };
	static const int dj[] = { 0,1 };
	auto inrange = [&](int i, int j) { return i >= 0 && i < H && j >= 0 && j < W; };
	rep(i, 0, H)rep(j, 0, W) {

		rep(d, 0, 2) {
			int ni = i + di[d], nj = j + dj[d];
			if (inrange(ni, nj)) {
				dp[ni][nj] |= dp[i][j] << abs(A[ni][nj] - B[ni][nj]);
				dp[ni][nj] |= dp[i][j] >> abs(A[ni][nj] - B[ni][nj]);
			}
		}

	}
	int ans = INF;
	rep(i, 0, MAX) {
		if (!dp[H - 1][W - 1][i])continue;
		chmin(ans, abs(i - DMAX));
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 810752
def iter2(it):
    x = iter(it)
    before = next(x)
    for item in x:
        yield before, item
        before = item

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

costs = (min(B, A*(x2-x1)) for x1, x2 in iter2(xs))
print(sum(costs))

Measured memory_bytes: 14480
import math
n,k = map(int,input().split())

ans = 0
for i in range(1,n+1):
  tmp = math.floor(k/i)
  if tmp == 0:
    ans += 1/n
  elif k % i == 0 and tmp & tmp-1 == 0:
    ans += 1/(n*(2**(len(bin(tmp))-3)))
  else:
    ans += 1/(n*(2**(len(bin(tmp))-2)))
print(ans)

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

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> S(h);
  rep(i,h) cin >> S[i];
  int ans = 0;
  rep(is,1<<h)rep(js,1<<w){
    int cnt = 0;
    rep(i,h)rep(j,w){
      if(is>>i&1)continue;
      if(js>>j&1)continue;
      if(S[i][j]=='#')cnt++;
    }
    if(cnt==k)ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int h,w;
    cin>>h>>w;
    vector<int> cnt('z'-'a'+1,0);
    vector<string> a(h);
    for(int i=0;i<h;i++){
        cin>>a[i];
        for(int j=0;j<w;j++){
            cnt[a[i][j]-'a']++;
        }
    }

    int oddcnt=0;
    int twocnt=0;
    for(int i=0;i<cnt.size();i++){
        if(cnt[i]%2==1){
            oddcnt++;
        }
        if((cnt[i]-cnt[i]%2)%4!=0){
            twocnt+=2;
        }
    }
    bool isyes=true;
    if(h%2==0 && w%2==0){
        isyes=(oddcnt==0 && twocnt==0);
    }
    else if(h%2==1 && w%2==0){
        isyes=(twocnt<=w && oddcnt==0);
    }
    else if(h%2==0 && w%2==1){
        isyes=(twocnt<=h && oddcnt==0);
    }
    else{
        isyes=(twocnt<=w+h-2 && oddcnt==1);
    }
    cout<<(isyes ? "Yes" : "No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << (char)toupper(s1[0]) << (char)toupper(s2[0]) << (char)toupper(s3[0]) << endl;
  return 0;
}


Measured memory_bytes: 256
/*
    to amy
    https://atcoder.jp/contests/abc132/tasks/abc132_d
*/

#include <bits/stdc++.h>

using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second

#define MAX 2005

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

ll C[MAX+2][MAX+2];
ll MOD = 1e9 + 7;

void init(){
    C[0][0] = 1;
    for (int n = 1; n <= MAX; n++) {
        C[n][0] = C[n][n] = 1;
        for (int k = 1; k < n; k++)
            C[n][k] = (C[n - 1][k - 1]+C[n - 1][k]) % MOD;
    }
}

int main() {
    IOS
    int n,k;
    init();
    while(cin>>n>>k){
        int b,r;
        b = k; r = n-k;
        for(int i=1;i<=k;i++)
            cout<<(C[b-1][i-1]*C[r+1][i]) % MOD<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 30208
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 633;
int n,w=150000,s[N],len;ll a[633][633];
map<ll,bool>used;
ll gcd(ll a, ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a, ll b){return min(a,b)==0?max(a,b):a/gcd(a,b)*b;}//WA
bool isprime(int x){
	rep(i,2,x-1)if(x%i==0)return 0;return 1;
}
int main() {
	read(n);int dfn=0;
	for(int i=2;len<n;i++)if(isprime(i))s[++len]=i;
	rep(i,1,n)rep(j,1,n)if((i+j)&1){//(1,i)
		if(i-1>=1&&j+1<=n)continue;dfn++;
		ll v=0;int x=i,y=j;
		while(x<=n&&y>=1){
			v+=s[dfn];while(used[v])v+=s[dfn];used[v]=1;a[x][y]=v;x++;y--;
		//	assert(v<=3e7);
		}
	}
	rep(i,0,n)a[0][i]=a[i][0]=a[i][n+1]=a[n+1][i]=0;
	rep(i,1,n)rep(j,1,n)if((i+j)%2==0){
	//	printf("%d %d %lld %lld\n",a[i][j-1],a[i][j+1],gcd(a[i][j-1],a[i][j+1]),lcm(a[i][j-1],a[i][j+1]));
		ll val=lcm(lcm(a[i][j-1],a[i][j+1]),lcm(a[i-1][j],a[i+1][j]));if(val==0)val=R();
	//	printf("val = %lld %d %d %d %d (%d,%d)\n",val,a[i][j-1],a[i][j+1],a[i-1][j],a[i+1][j],i,j);
		ll v=val;while(used[v+1])v+=val;used[v+1]=1;a[i][j]=v+1;//WA
	//	if(v>1e15)printf("%lld %lld\n",val,v);
	}
	set<ll>Q;
	rep(i,1,n)rep(j,1,n){
		if(j+1<=n)assert(max(a[i][j],a[i][j+1])%min(a[i][j],a[i][j+1])==1);
		if(i+1<=n)assert(max(a[i][j],a[i+1][j])%min(a[i][j],a[i+1][j])==1);
		assert(a[i][j]<=1e15);assert(!Q.count(a[i][j]));Q.insert(a[i][j]);
	}
	rep(i,1,n){rep(j,1,n)printf("%lld ",a[i][j]);puts("");}
	return 0;
}

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

struct Card  {char suit, value; };
//バブルソート
void bubbleSort (struct Card A[], int N){
  for(int i = 0; i < N; i++){
    for (int j = N - 1; j >= i; j--){
      if (A[j].value < A[j-1].value){
        Card t = A[j];
        A[j] = A[j-1];
        A[j-1] = t;
      }
    }
  }
}

//選択ソート
void selectionSort (struct Card A[], int N){
  for (int i = 0; i < N; i++){
    int minj = i;
    for (int j = i; j < N; j++){
      if (A[j].value < A[minj].value){
        minj = j;
      }  
    }
    Card t = A[i];
    A[i] = A[minj];
    A[minj] = t;
  }
}

void print (struct Card A[], int N){
  for (int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
//安定なバブルソートと比較
bool isStable (struct Card C1[], struct  Card C2[], int N){
  for (int i = 0; i < N; i++){
    if (C1[i].suit != C2[i].suit) return false;
  }
  return true;
}

int main(){
  Card C1[40], C2[40];
  int N;
  
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> C1[i].suit >> C1[i].value;
  }

  for (int i = 0; i < N; i++) C2[i] = C1[i];  

  bubbleSort (C1, N);
  selectionSort (C2, N);

  print (C1, N);
  cout << "Stable" << endl;
  print (C2, N);
  if (isStable (C1, C2, N)){
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
}



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

int main() {
  vector<char> A(3);
  for (int i = 0; i < 3; i++) {
    cin >> A.at(i);
  }
    sort(A.begin(), A.end());
      
  if ((A.at(0) == 'a') && (A.at(1) == 'b') && (A.at(2) == 'c')) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner stdin = new Scanner( System.in);
		String  x;
		long i=0,j=0;
		x =stdin.next();
		for(int k=1;k<=x.length();k++){
			String xx=x.substring(k-1,k);
			if(xx.equals("W")) {j=j+i;
			}else{i++;
			}
			
		}
		System.out.print(j);
	}
}


Measured memory_bytes: 39828
///Nahid Hasan Raju
#include <bits/stdc++.h>
#define ll long long
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
using namespace std;

#define P1(XX) cerr<<"db1: "<<XX<<endl
#define P2(XX,YY) cerr<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cerr<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define pb push_back
#define pll pair<ll,ll>
#define pii pair<int,int>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007ll
#define MX 200006  ///200005

ll m, n;
ll a[MX];
bool f(ll p)
{
    ll c=0,u;
    for(int i=0;i<n;i++)
    {
        if(a[i]<=p)break;
        u=(((a[i]+p-1)/p)-1);
        c+=u;
        if(c>m)return 0;
    }
    //P1(c);
    if(c<=m)return 1;
    return 0;
}

int main()
{
    #ifndef ONLINE_JUDGE
    Fin;
    #endif
    int test=1, tc=0, i, j;
    ll k, ans;
    ll c,y,x,mid;
    //scanf("%d", &test);
    while(test--)
    {
        ans=0;
        cin>>n>>m;

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

        x=1; y=INT_MAX;
        while(x<y)
        {

            mid=(x+y)/2;
            //P3(x,mid,y);
            if(f(mid)){
                y=mid;
            }
            else{
                x=mid+1;
            }

//            if(y-x<=5){
//                if(f(mid)==1){if(f(mid-1)==0)break;}
//                else if(f(mid+1)==1){
//                        //mid++;
//                        break;
//                }
//            }
        }
        if(!f(mid))mid++;

        printf("%lld\n", mid);
    }
    return 0;
}




Measured memory_bytes: 5328