akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

from collections import defaultdict
from heapq import heappush, heappop
import sys
import numpy as np


sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")


def debug(*x):
    print(*x)


def solve():
    "void()"
    pass


def main():
    D = int(input())
    CS = list(map(int, input().split()))
    data = np.int16(read().split())
    S = data[:D * 26].reshape((D, 26))
    answer = data[D * 26:]

    last = [-1] * 26
    score = 0
    for i in range(D):
        j = answer[i] - 1
        score += S[i, j]
        last[j] = i
        score -= sum(CS[j] * (i - last[j]) for j in range(26))
        print(score)
    # solve()


T = """
5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
"""

OUT = """
1
17
13
14
13
"""


def _test():
    """
    >>> as_input(T)
    >>> main()
    18398
    35037
    51140
    65837
    79325
    """
    import doctest
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()


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

int main() {
  int N,X;
  cin >> N >> X;
  int m[N];
  int count = 0;
  int min = 10000;
  for(int i = 0; i < N; i++){
    cin >> m[i];
    X -= m[i];
    count++;
    if(m[i] < min){
      min = m[i];
    }
  }
  while(X >= min){
    X -= min;
    count++;
  }
  cout << count << endl;
  return 0;
}

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

int main () {
  int n;
  cin >> n;
  
  int ans = 0;
  int i = 0;
  while (pow(2,i) <= n) {
    ans = pow(2,i);
    i++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4080
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        while(true){
            String w= scanner.next();
            if(w.equals("-")) break;
            long m=scanner.nextLong();
            for(int i=0;i<m;i++){
                int h=scanner.nextInt();
                w=w.substring(h,w.length())+w.subSequence(0,h);
            }
            System.out.println(w);
        }

    }

}



Measured memory_bytes: 26608
<?php
fscanf(STDIN,'%d',$N);
$A=explode(" ",trim(fgets(STDIN)));
$sum=array_sum($A);
$X=0;
$Y=0;
$by=0;
$bymin=100000000000;
for ($i=0; $i <=$N-1 ; $i++) {
  // code...
  $X=0;
  for ($j=0; $j <=$i ; $j++) {
    // code...
    $X+=$A[$j];
  }
  $Y=$sum-$X;
  $by=abs($X-$Y);
  if($by<$bymin){
    $bymin=$by;
  }
}
echo $bymin;
echo "\n";


 ?>


Measured memory_bytes: 3828
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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



void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll ans = 0;
    rep(i,n){
        
    }
    for (ll i = 1; i <= n; i++) {
        if(i%3==0 && i%5==0) continue;
        if(i%3==0) continue;
        if(i%5==0) continue;
        ans += i;
    }
    cout << ans << endl;
    
    
}



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




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

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

    string t = "MARCH";
    vector<ll> cnt(5);
    rep(i, n) {
        string s;
        cin >> s;
        rep(i, t.size()) {
            if (t[i] == s[0])
                cnt[i]++;
        }
    }

    ll ans = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                if (i == k)
                    continue;
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3548
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using P = pair<int,int>;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n,m; cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    rep(i,n) {
        cin >> a[i];
        sum += a[i];
    }
    sort(all(a), greater<int>());
    if (4*a[m-1]*m>=sum) puts("Yes");
    else puts("No");


    return 0;
}



















Measured memory_bytes: 256
/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-4-28 22:56:15
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

const int MAX_SIZE = 2000010;
const long long MOD = 1000000007;

long long inv[MAX_SIZE];
long long fact[MAX_SIZE];
long long factinv[MAX_SIZE];

void init() {
  inv[1] = 1;
  for (int i=2; i<MAX_SIZE; i++) {
    inv[i] = ((MOD - inv[MOD%i]) * (MOD/i))%MOD;
  }
  fact[0] = factinv[0] = 1;
  for (int i=1; i<MAX_SIZE; i++) {
    fact[i] = (i * fact[i-1])%MOD;
    factinv[i] = (inv[i] * factinv[i-1])%MOD;
  }
}

long long C(int n, int k) {
  if (n >=0 && k >= 0 && n-k >= 0) {
    return ((fact[n] * factinv[k])%MOD * factinv[n-k])%MOD;
  }
  return 0;
}

long long power(long long x, long long n) {
  if (n == 0) {
    return 1;
  } else if (n%2 == 1) {
    return (x * power(x, n-1)) % MOD;
  } else {
    long long half = power(x, n/2);
    return (half * half) % MOD;
  }
}

long long gcm(long long a, long long b) {
  if (a < b) {
    return gcm(b, a);
  }
  if (b == 0) return a;
  return gcm(b, a%b);
}

ll N;
ll Ika[2000010];

int main()
{
  init();
  cin >> N;
  Ika[0] = Ika[1] = 0;
  if (N == 2)
  {
    cout << 1 << endl;
    return 0;
  }
  for (ll A = 2; A <= N - 1; A++)
  {
    ll x = N - 1 - A;
    if (x >= 0 && A >= 0)
    {
      Ika[A] = (((C(A - 1, N - 1 - A) * fact[x]) % MOD) * fact[A]) % MOD;
      // cerr << "Ika[" << A << "] = " << Ika[A] << endl;
    }
  }
  ll ans = 0;
  for (ll A = 1; A <= N - 1; A++)
  {
    ans += (A * ((Ika[A] + MOD - Ika[A - 1]) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll a, b, c;

	cin >> a >> b >> c;

	if (a + b >= c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define root sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : ' ');
  }
  // os << '}';
  return os;
}

int main()
{
  ll k, s, ans = 0LL;
  cin >> k >> s;
  rep(i, k)
  {
    rep(j, k)
    {
      ll z = s - (i + j);
      if (0 <= z && z <= k)
        ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main(void) {
	int num, i, a = 0, ans;
	double b, c = 1000000000, buf;
	cin >> num;
	vector<int> d(num);
	for (i = 0; i < num; i++) {
		scanf("%d", &d[i]);
		a = max(a, d[i]);
	}
	b = (double)a / 2;
	for (i = 0; i < num; i++) {
		buf = (double)d[i] - b;
		if (buf < 0)
			buf *= (double)-1;
		if (a != d[i] && c > buf) {
			c = buf;
			ans = d[i];
		}
	}
	printf("%d %d\n", a, ans);
	return 0;
}

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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll n, a, b;
    cin >> n >> a >> b;
    if (a > b) swap(a, b);

    if ((b - a) % 2 == 0) {
        cout << (b - a) / 2 << endl;
    }
    else {
        ll b1 = b - a;
        ll a1 = a + n - b + 1;
        cout << min((b1 - 1) / 2 + a, (n - a1) / 2 + n - b + 1) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <bitset>
#include <utility> 
using namespace std;

int main() {
    int a,b; cin >> a >> b;
    int ans=0;
    if (a>=b) {
        ans += a;
        a--;
    }
    else {
        ans += b;
        b--;
    }
    ans+= max(a,b);
    cout << ans << endl;
}

Measured memory_bytes: 256
#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 p; 
vector<string> S;
int N;

int solve(int level)
{

    if (isdigit(S[p][level])) {
        return (S[p++][level] - '0');
    }

    while (true) {
        // DUMP2(p, level);
        if (p < N && S[p].size() < level) break;
        if (S[p][level] == '+') {
            p++; // skip '+'
            int tmp = 0;
            while (true) {
                if (p >= N || S[p].size() <= level+1) break;
                tmp += solve(level+1);
            }
            return tmp;
        } else if (S[p][level] == '*') {
            p++; // skip '*'
            int tmp = 1;
            while (true) {
                if (p >= N || S[p].size() <= level+1) break;
                tmp *= solve(level+1);
            }
            return tmp;
        }
    }

    return -1;
}

int main()
{
    while (cin >> N, N) {
        p = 0;
        S.resize(N);
        rep(i, N) cin >> S[i];
        cout << solve(0) << endl;
    }
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,j,n) for(int i=j;i<n;i++)
#define F first
#define S second
#define lb lower_bound
#define mem0(dp) memset(dp,0,sizeof(dp))
#define mem1(dp) memset(dp,-1,sizeof(dp))
#define pb push_back
#define sz(s) (int)(s.size())
#define debug(x) cout << #x << " = " << x << '\n';

void solve()
{
	int n, m, k;
	cin >> n >> m >> k;
	vector<int> a(n), b(m);
	rep(i, 0, n){
		cin >> a[i];
		if(i > 0){
			a[i] += a[i - 1];
		}
		// cout << a[i] << " ";
	}
	rep(i, 0, m){
		cin >> b[i];
		if(i > 0){
			b[i] += b[i - 1];
		}
		// cout << b[i] << " ";
	}
	int ans = upper_bound(all(b), k) - b.begin();
	// cout << ans << " ";
	rep(i, 0, n){
		if(a[i] <= k){
			ans = max(ans, i + 1 + (int)(upper_bound(all(b), k - a[i]) - b.begin()));
			// cout << ans << " ";
		}
	}
	cout << ans << '\n';
}

int32_t main(){
ios_base::sync_with_stdio(false); 
cin.tie(0); cout.tie(0);
int tst = 1;
//cin >> tst;
while(tst--)
{
	solve();
}
}

Measured memory_bytes: 6364
#include	<stdio.h>
int	main(void)
{
	int h,w,i,j;
	
	while(1){
		scanf("%d %d",&h,&w);
		if(h==0 && w==0) break;

		for(i=0; i<h; i++){
			for(j=0; j<w; j++){
				if((i+j)%2==0){
					printf("#");
				}else{
					printf(".");
				}
			}

			puts("");
		}puts("");
	}
	return	0;
}

Measured memory_bytes: 588
# cording:utf-8

# Nの入力
N = int(input())

# 要素数Nのリストを作成
N_i = [0] * N

# N個の整数の入力
N_i = list(map(int, input().split()))

# 踏み台高さ合計Sumを定義
Sum = 0

# N回の繰り返し
for i in range(1, N):
    # Sum_iを初期化
    Sum_i = 0

    # 直前の人の高さが自分より高ければ
    if N_i[i-1] > N_i[i]:
        # 仮のSum_iに踏み台の高さを代入
        Sum_i = N_i[i-1] - N_i[i]
        # N_iに上書き
        N_i[i] = N_i[i] + Sum_i
        # 合計値を算出
        Sum = Sum + Sum_i

print(Sum)


Measured memory_bytes: 33632
I=lambda:map(int,input().split());n,m=I();l=[[]for _ in[0]*-~n];a=[]
for i in range(m):p,y=I();l[p].append([y,i])
for p in range(1,n+1):
 for i,t in enumerate(sorted(l[p])):a.append([t[1],'%06d'%p+'%06d'%-~i])
for t in sorted(a):print(t[1])

Measured memory_bytes: 49684
#include <stdio.h>
#include <stdlib.h>

int D,N;
int kion[200];
struct {
	int A,B,C;
} fuku[200];

int memo[210][110];

int tansaku(int day,int maxday,int prev_hade) {
	int result=0;
	int nowresult;
	int i;
	if(day>=maxday)return 0;
	if(memo[day][prev_hade]>0)return memo[day][prev_hade]-1;
	for(i=0;i<N;i++) {
		if(fuku[i].A<=kion[day] && kion[day]<=fuku[i].B) {
			nowresult=abs(prev_hade-fuku[i].C);
			nowresult+=tansaku(day+1,maxday,fuku[i].C);
			if(nowresult>result)result=nowresult;
		}
	}
	memo[day][prev_hade]=result+1;
	return result;
}

int main(void) {
	int i;
	int result=0;
	int nowresult;
	scanf("%d%d",&D,&N);
	for(i=0;i<D;i++)scanf("%d",&kion[i]);
	for(i=0;i<N;i++)scanf("%d%d%d",&fuku[i].A,&fuku[i].B,&fuku[i].C);
	for(i=0;i<N;i++) {
		if(fuku[i].A<=kion[0] && kion[0]<=fuku[i].B) {
			nowresult=tansaku(1,D,fuku[i].C);
			if(nowresult>result)result=nowresult;
		}
	}
	printf("%d\n",result);
	return 0;
}

Measured memory_bytes: 700
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    b = input()
    if b == "A":
        print("T")
    elif b == "T":
        print("A")
    elif b == "C":
        print("G")
    elif b == "G":
        print("C")
            
if __name__ == '__main__':
    main()

Measured memory_bytes: 9048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <cstdio>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;



#define INF 2000000000
#define MAX_V 10
const int MAX_N =10000000;


bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

ll gcd(ll a,ll b) { return b ? gcd(b, a%b) : a; }

ll func(ll a,ll b,ll& ans_x,ll& ans_y){
    if(b == 0){
        ans_x = 1;
        ans_y = 0;
        return a;
    }else{
        ll ret = func(b,(a%b),ans_y,ans_x);
        ans_y -= (a/b)*ans_x;
        return ret;
    }
}

ll par[MAX_N],ranking[MAX_N];

void init(ll n){
    rep(i,n){
        par[i]=i;
        ranking[i]=0;
    }
}

ll find(ll x){
    if(par[x]==x) return x;
    else return par[x]=find(par[x]);
}

void unite(ll x,ll y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    
    if(ranking[x]<ranking[y]) par[x]=y;
    else{
        par[y]=x;
        if(ranking[x]==ranking[y]) ranking[x]++;
    }
}

bool same(ll x,ll y){
    return find(x)==find(y);
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    string s;
    cin>>n;
    while(n!=0){
        n-=1;
        s+=char((int)('a'+n%26));
        n/=26;
    }
    reverse(ALL(s));
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3600
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

sx,sy,tx,ty=map(int,input().split())
anslst=""
anslst+="R"*(tx-sx)
anslst+="U"*(ty-sy)
anslst+="L"*(tx-sx)
anslst+="D"*(ty-sy)

anslst+="D"
anslst+="R"*(tx-sx+1)
anslst+="U"*(ty-sy+1)
anslst+="L"

anslst+="U"
anslst+="L"*(tx-sx+1)
anslst+="D"*(ty-sy+1)
anslst+="R"

print(anslst)

Measured memory_bytes: 64116
import java.util.*;

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

        int P = sc.nextInt();
        int Q = sc.nextInt();
        int R = sc.nextInt();

        int[] time ={P+Q,P+R,Q+R};

        Arrays.sort(time);

        System.out.println(time[0]);


    }
}

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

using namespace std;
#define ALL(x) x.begin(), x.end()

int main(){
  vector<int> v(3); cin >> v[0] >> v[1] >> v[2];
  int i, j, cnt=0;
  for (i=0; i<3; i++) {
    for (j=0; j<3; j++) {
      if (v[i]==v[j]) cnt++;
    }
  }
  if (cnt==3) cout << 3 << endl;
  else if (cnt==5) cout << 2 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt(), zero = 0;
		BigInteger nums[] = new BigInteger[size];
		for(int i = 0; i < size; i++){
			String str = sc.next();
			if(str.equals("0")){zero++;}
			nums[i] = new BigInteger(str);
		}
		if(zero > 0){System.out.println("0"); return;}
		BigInteger base = new BigInteger("1000000000000000000"), ans = BigInteger.ONE;
		for(BigInteger num : nums){
			if(num.compareTo(base) > 0){
				System.out.println("-1"); return;
			} else {
				ans = ans.multiply(num);
				base = base.divide(num);
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 67592
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  ll n,a,b,x,y,ans=0;
  cin>>n>>a>>b;
  rep(i,n){
      cin>>x;
      if(i!=0){
        ans+=min(a*(x-y),b);
      }
      y=x;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    double T,X;
    cin >>T >>X;
    printf("%.10f\n",T/X);
    return 0;
}


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

int main(){
    int n;
    cin>>n;
    int a[n];
    bool flag=true,change=true;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=n-1;i>0;i--){
        if(a[i]>=a[i-1])continue;
        else if(a[i]+1==a[i-1])a[i-1]--;
        else flag=false;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3956
N = int(input())
C = {}
flag = 0
for i in range(N):
    W = input().strip()
    if W not in C:
        C[W] = 0
    C[W] += 1
    if i==0:
        a = W
    else:
        if W[0]!=a[-1]:
            flag = 1
        a = W
if len(C)<N or flag==1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 62192
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;

int n,m,dp[100010][20],val[100010];
int num[20][20];
vector<int> v;

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int a,b,c;
		cin>>a>>b>>c;
		num[a][b]=num[b][a]=c;
	}
	val[0]=0;
	for(int i=1;i<(1<<n);i++){
		v.clear();
		for(int j=1;j<=n;j++) if(i&(1<<(j-1))){
			v.push_back(j); 
		}
		val[i]=val[i^(1<<(v[0]-1))];
		for(int j=1;j<v.size();j++){
			val[i]+=num[v[0]][v[j]];
		}
	}
	for(int i=0;i<(1<<n);i++) for(int j=1;j<=n;j++) dp[i][j]=-INF;
	for(int i=0;i<(1<<n);i++) if(i&1) dp[i][1]=val[i];
	for(int i=1;i<(1<<n);i++){
		for(int j=1;j<=n;j++) if(i&(1<<(j-1))){
			if(dp[i][j]==-INF) continue;
			int xx=((1<<n)-1)^i;
			for(int mask=xx;mask>0;mask=(mask-1)&xx){
				for(int k=1;k<=n;k++) if(mask&(1<<(k-1))&&num[j][k]){
					dp[i^mask][k]=max(dp[i^mask][k],dp[i][j]+num[j][k]+val[mask]);
				}
			}
		}
	}
	cout<<val[(1<<n)-1]-dp[(1<<n)-1][n]<<endl;
	return 0;
}

Measured memory_bytes: 4096
#!/usr/bin/env python3
# coding=utf-8

import sys

n = int(sys.stdin.readline().strip())

txy = [tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x) + abs(_y) <= _t and (_t + _x + _y) % 2 == 0 for (_t, _x, _y) in txy]
if all(check_txy):
    print("Yes")
else:
    print("No")


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

using namespace std;

int n;

int main(){
    cin>>n;
    vector<int> l(n);

    for(int i= 0; i < n; i++) cin>>l[i];

    int ans = 0;
    for(int i= 0; i < n; i++) for(int j = i + 1; j < n; j++) for(int k = j + 1; k < n; k++) if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k] && l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]) ans++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3632
import itertools
from collections import defaultdict

N=input()

if N==3:
	print 61
	quit()

dp=defaultdict(lambda: 0)	#dp[ (n,i,j,k,l) ]
a=0;g=1;c=2;t=3

n=4
for i,j,k,l in itertools.product( range(4), repeat=4 ):
	if l==c and j==g and i==a: continue
	elif l==c and k==g and i==a: continue
	elif l==c and k==g and j==a: continue
	elif k==c and j==g and i==a: continue
	elif l==c and k==a and j==g: continue
	elif k==c and j==a and i==g: continue
	elif l==g and k==c and j==a: continue
	elif k==g and j==c and i==a: continue
	dp[ (n,i,j,k,l) ]=1



for n in range(5,N+1):
	for i,j,k,l in itertools.product( range(4), repeat=4 ):
		if l==c and j==g and i==a: continue
		elif l==c and k==g and i==a: continue
		elif l==c and k==g and j==a: continue
		elif k==c and j==g and i==a: continue
		elif l==c and k==a and j==g: continue
		elif k==c and j==a and i==g: continue
		elif l==g and k==c and j==a: continue
		elif k==g and j==c and i==a: continue
	
		for m in range(4):
			dp[ (n,i,j,k,l) ]+=dp[ (n-1,j,k,l,m) ]


ans=0
for x,val in dp.items():
	n=x[0]
	if n==N:
		ans+=val

print ans%(10**9+7)


Measured memory_bytes: 43932
n,m,k = map(int,input().split())
a=[]
costs=[]
for _ in range(n):
    nl = list(map(int,input().split()))
    costs += [nl[0]]
    nl = nl[1:]
    a += [nl]

from itertools import product

ans = 10**16

for i in range(2**n):
    f = bin(i)[2:]
    f = "0"*(n-len(f)) + f
    f = [int(k) for k in f]
    total = [0]*m
    cost = 0
    for i in range(n):
        if f[i]:
            cost += costs[i]
            for j in range(m):
                total[j] += a[i][j]
    if min(total) >= k:
        ans = min(ans, cost)

print(ans if ans != 10**16 else -1)

Measured memory_bytes: 69116
X = int(input())
def primes(N):
    P = []
    for i in range(2,N):
        sieve = 1
        for p in P:
            if p*p > i:
                break
            elif i % p == 0:
                sieve = 0
                break
        if sieve == 0:
            continue
        else:
            P.append(i)
    return P

P = primes(X)
y = X
while True:
    for p in P:
        if y % p == 0:
            break
    else:
        break
    y += 1
    continue
print(y)

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

int main(int argc, const char * argv[]) {
    // insert code here...
    string a, b;
    cin >> a >> b;
    
    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n;
int ci[4400];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		ci[x]++;
	}
	int ans=0;
	for(int i=0;i<=400;i++)
	{
		if(ci[i])
		{
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  std::vector<int> v(3);
  int a,b,c;
  a=b=c=0;
  for(int i=0;i<100;i++){
    cin>>v[0]>>v[1]>>v[2];
    sort(v.begin(),v.end());
    if(v[2]>=v[0]+v[1]){
      cout<<i<<" "<<a<<" "<<b<<" "<<c<<endl;
      break;
    }
    else{
      if(v[2]*v[2]==v[0]*v[0]+v[1]*v[1])a++;
      if(v[2]*v[2]<v[0]*v[0]+v[1]*v[1])b++;
      if(v[2]*v[2]>v[0]*v[0]+v[1]*v[1])c++;
    }
  }
}



Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

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

    int n, m;
    cin >> n >> m;
    vector<int> pen(n);
    vector<int> ac(n);
    while (m--) {
    	int x;
    	string s;
    	cin >> x >> s;
    	x--;
    	if (s == "AC") {
    		ac[x] = 1;
    	} else {
    		if (!ac[x]) pen[x]++;
    	}
    }
    int f = 0;
    int s = 0;
    for (int i = 0; i < n; i++) {
    	if (ac[i]) {
    		f++;
    		s += pen[i];
    	}
    }
    cout << f << ' ' << s << endl;
}   

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
 
int w[10000]={0},s[10000]={0};
 
int main ()
{
	int a,b,c,d,e,f,i,j,k=0,mxw=0,mxs=0;
	cin>>a>>b>>c>>d>>e>>f;
	for(i=0;i<=f/100;i++)
		for(j=0;j<=f/100;j++)
		{
			w[i*a+j*b]=1;
		}	
//	cout<<mxw<<endl;
	for(i=0;i<=3000;i++)
		for(j=0;j<=3000;j++)
		{
			if(i*c+j*d>3000)
				continue;
			s[i*c+j*d]=1;
		}
	int tw,ts;
	double mx=0;
	for(i=1;i<=f/100;i++)
		for(j=0;j<=3000;j++)
		{
			if(w[i]!=1||s[j]!=1)
				continue;
			if(j+i*100>f)
				continue;
			if(e*i<j)
				continue;
			if(j*1.0/(i*1.0)>=mx)
			{
		//		cout<<i<<j<<endl;
				tw=i;
				ts=j;
				mx=j*1.0/(i*1.0);
			}
			
		}
	printf("%d %d\n",tw*100+ts,ts);
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
    return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
int main() {
   int N;
   cin >> N;
   vector<ll> a(N);

   for (int i = 0; i < N; i++)
   {
       cin >> a[i];
   }
   
   ll sum = 0;

   for (int i = 0; i < N; i++)
   {
       sum += a[i];
   }
   ll ans = 10000000000;
   ll s = 0;
   for (int i = 0; i < N - 1; i++)
   {
       sum -= a[i];
       s += a[i];
        if (ans > abs(sum - s))
    {
        ans = abs(sum - s);
    }
       
   }
   

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 4756
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;
ll dp[111][100100];

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N);
    vector<ll> v(N);
    rep(i,N) cin >> w[i] >> v[i];
    
    rep(i,N) {
        rep(j,W+1) {
            if (j-w[i]<0) dp[i+1][j] = dp[i][j];
            else dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
        }    
    }
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 79488
#include <bits/stdc++.h>
#include <cstring>
#include <algorithm>

#define pi 2 * acos(0.00)
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl '\n'
#define null '\0'
#define mx 1000007

using namespace std;


int main()
{
    fastio;

    int n,k;
    cin>>n>>k;
    int snuke[n]={0};

    for(int i=0;i<k;i++)
    {
        int di;
        cin>>di;
        for(int j=0;j<di;j++)
        {int snk;
        cin>>snk;
        snuke[snk-1]++;}
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(snuke[i]==0)
        c++;
    }
    cout<<c<<nl;
    
}

Measured memory_bytes: 3652
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end

require 'pp'

INT_MAX = 999999999999999999999999

H,W=gets.chomp.split(' ').map{|n| n.to_i}
N,d=gets.chomp.split(' ').map{|n| n.to_i}
A = gets.chomp.split(" ").map{|i| i.to_i}
h=0
w=0
HW = Array.new(H){Array.new(W)}
A.each_with_index{|a,i|
	0.upto(a-1){|j|
		if(h%2==0)
			HW[h][w] = i+1
			case w
			when W-1
				h+=1
			else
				w+=1
			end
		else
			HW[h][w] = i+1
			case w
			when 0
				h+=1
			else
				w-=1
			end
		end
	}
}
puts HW.map{|l| l.join(" ")}.join("\n")


Measured memory_bytes: 3196
A,B,C,X,Y = map(int,input().split())

MA, MI = max(X,Y), min(X,Y)
ans = 2 * C * MA

if X != Y:
    for i in range(MA-MI):
        if X > Y:
            tmp = ans - 2*C + A
        else:
            tmp = ans - 2*C + B
        ans = min(ans,tmp)
        
for j in range(MI):
    tmp = ans - 2*C + A + B
    ans = min(ans,tmp)

print(ans)


Measured memory_bytes: 3064
import collections
n, k = map(int, input().split())
aa = list(map(int, input().split()))

ca = collections.Counter(aa) # counter aa
arca = [a for a in ca.items()] #array ca
sa = sorted(arca, key = lambda x:x[1]) # sorted araca
lca = len(ca) #length ca
cnt = 0
if lca > k:
  for i in range(lca - k):
    cnt += sa[i][1]
else:
  cnt = 0
print(cnt)

Measured memory_bytes: 45616
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/



void Main(){
    double n;
    cin >> n;
    cout << n*2*PI << endl;
    
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, T;
	cin >> N >> T;
	vector<int> A(N);
	for (auto& x : A) cin >> x;
	auto B = A;
	for (int i = N-2; i >= 0; -- i) B[i] = max(B[i], B[i+1]);
	int C = 0;
	for (int i = 0; i < N; ++ i) C = max(C, B[i] - A[i]);
	int r = 0;
	for (int i = 0; i < N; ++ i) if (B[i] - A[i] == C) ++ r;
	cout << r << endl;
}


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

int checkstring(string W, string T)
{
	//同じか調べる
	int Wsize = W.size();

	if (Wsize != T.size()) {//同じ文字数か
		return 0;
	}

	for (int i = 0; i < Wsize; i++) {
		if (W[i] == T[i] || W[i] == T[i] + ' ') {//小文字か大文字が同じではない
			if (i + 1 == Wsize) {
				return 1;
			}
		}
		else {
			return 0;
		}
	}

}

int main()
{
	string W, T;
	cin >> W;//単語
	
	int count = 0;

	while (cin >> T) {
		if (T == "END_OF_TEXT") {//終了
			break;
		}
		//同じ文字かどうか
		count += checkstring(W, T);
	}

	cout << count << endl;

	return 0;
}


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


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int a, b; cin >> a >> b;
    int sum = 0;
    if (a > b) {
        sum += a--;
    } else {
        sum += b--;
    }
    if (a > b) {
        sum += a--;
    } else {
        sum += b--;
    }
    
    cout << sum << '\n';
    
    return 0;
}


Measured memory_bytes: 256
import numpy as np
N,M,C=map(int,input().split())
B=np.array(input().split(),dtype=np.int32)
ans=0
for _ in range(N):
    A=np.array(input().split(),dtype=np.int32)
    if A.dot(B)+C>0:
        ans+=1
print(ans)


Measured memory_bytes: 27228
#include<iostream>
using namespace std;
int main(){
  int A,B,K;
  cin >> A >> B >> K;
  for(int i=1;i<=K;i++){
    if(i%2==1){
      if(A%2==1){
        A--;
      }
      B+=A/2;
      A-=A/2;
    }
    else{
      if(B%2==1){
        B--;
      }
      A+=B/2;
      B-=B/2;
    }
  }
  cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(input())
    ln = list(map(int, input().split()))
    ln = sorted(ln)
    ln_shorter = ln[::2]
    print(sum(ln_shorter))

main()


Measured memory_bytes: 3444
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int a, b, c;
    int tmp;
 
    scanf("%d%d%d", &a, &b, &c);
    if (a > b) tmp = a, a = b, b = tmp;
    if (b > c) {
        tmp = b, b = c, c = tmp;
        if (a > b) tmp = a, a = b, b = tmp;
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


Measured memory_bytes: 2104
n, a, b = map(int, input().split())

if (a > b):
    print(0)
elif (n == 1):
    if (a != b):
        print(0)
    else:
        print(1)
else:
    mx = a + b * (n - 1)
    mn = a * (n - 1) + b
    print(mx-mn+1)


Measured memory_bytes: 2940
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

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

    int n, k;
    cin >> n >> k;
    std::vector<int> pos;

    int m1;
    for (int i = 0; i < n; i++) {
        cin >> m1;
        pos.push_back(m1);
    }

    int left[100001] = {}, right[100001] = {};

    int s       = 0;
    int zeropos = n;
    for (; s < n; s++) {
        // cout << pos[s] << endl;
        if (pos[s] >= 0) {
            // cout << pos[s] << endl;
            zeropos = s;
            // cout << zeropos << endl;
            break;
        }
    }
    int leftcount = 0;
    for (int i = 1; s < n; s++) {
        // cout << pos[s] << endl;
        left[i] = pos[s];
        leftcount++;
        // cout << left[i] << endl;
        i++;
    }
    s              = zeropos - 1;
    int rightcount = 0;
    for (int i = 1; s >= 0; s--) {
        right[i] = pos[s];
        // cout << right[i] << endl;
        i++;
        rightcount++;
    }

    int result = 1000000000;
    for (int i = 0; i <= k; i++) {
        // cout << left[i] << " " << right[k - i] << endl;
        if (k - i <= rightcount && i <= leftcount) {

            int temp = left[i] * 2 + (right[k - i]) * -1;
            // cout << temp << endl;
            if (temp < result)
                result = temp;
            temp = left[i] + (right[k - i]) * -2;
            // cout << temp << endl;
            if (temp < result)
                result = temp;
        }
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1656
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<cmath>
using namespace std;
#define ll long long
int main(){
  ll N,A,B,C;
  cin >> N >> A >> B >> C;
  ll ans=100000;
  ll i,j;
  ll setl[4];
  ll sizel[4];
  ll tmp;
  ll x;
  ll t;
  ll l[N];
  for(i=0;i<N;i++){
    cin >> l[i];
  }
  for(i=0;i<pow(4,N);i++){
    t=i;
    for(j=0;j<4;j++){
      setl[j]=0;
      sizel[j]=0;
    }
    for(j=0;j<N;j++){
      x=t%4;
      setl[x]+=l[j];
      sizel[x]+=1;
      t=t/4;
    }
    if(sizel[0]!=0&&sizel[1]!=0&&sizel[2]!=0){
      tmp=abs(A-setl[0])+abs(B-setl[1])+abs(C-setl[2])+10*(sizel[0]+sizel[1]+sizel[2]-3);
      ans=min(tmp,ans);
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.extend(b)
a.extend(c)

n = int(input())
nums = []
for i in range(n):
  nums.append(int(input()))
  
a = [ i in nums for i in a]
if((a[0] and a[1] and a[2])  or
   (a[3] and a[4] and a[5])  or
   (a[6] and a[7] and a[8])  or
   (a[0] and a[3] and a[6])  or
   (a[1] and a[4] and a[7])  or
   (a[2] and a[5] and a[8])  or
   (a[0] and a[4] and a[8])  or
   (a[2] and a[4] and a[6])):
  print("Yes")
else:
  print("No")

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

int main() {
	long long int a[3],ans;
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);

	if (a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0)
		ans = 0;
	else if (a[0] == 1 && a[1] == 1 && a[2] == 1)
		ans = 1;
	else
		ans = a[0] * a[1];
		
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
int main(){
  ll h;
  cin>>h;
  int count=0;
  while(h>=1){
    count++;
    h=h/2;
  }
  ll ans=1;
  while(count>0){
    ans *= 2;
    count--;
  }
  cout<<ans-1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a = 0;
  string s;
  in(s);
  rep(i, s.size()){
    if(i % 2 == 0){
      if(s[i] == 'p')
        a--;
    }
    else{
      if(s[i] == 'g')
        a++;
    }
  }
  out(a);
  memi;
}

Measured memory_bytes: 512
<?php

//$_input = explode(
//    "\n",
//    '1 21'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}

list($a, $b) = explode(' ', getNext());
$a = substr($a, -2);
$b = substr($b, -2);


printf("%s\n", ($a * $b) % 2 === 0 ? 'Even' : 'Odd');



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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N;
  cin >> N;
  vector<pair<int, int>> es;
  vector<vector<int>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    es.emplace_back(a, b);
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  int K = 0;
  map<pair<int, int>, int> ans;
  vector<int> used(N, 0);
  vector<int> cs(N, 0);
  queue<int> que;
  que.emplace(0);
  used[0] = 1;
  while (!que.empty()) {
    int v = que.front();
    que.pop();
    int cur = 1;
    for (int u : G[v]) {
      if (used[u]) continue;
      if (cs[v] == cur) cur++;
      cs[u] = ans[make_pair(u, v)] = ans[make_pair(v, u)] = cur++;
      K = max(cs[u], K);
      used[u] = 1;
      que.emplace(u);
    }
  }
  cout << K << endl;
  for (auto e : es) cout << ans[e] << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 20088
a, b = [int(i) for i in input().split()]
s = input()

for i in range(len(s)):
    if i == a:
        if s[i] != "-":
            print("No")
            exit()
    elif not ord("0") <= ord(s[i]) <= ord("9"):
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3060