akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }




int main(){

  int n, p;
  cin >> n >> p;
  vector<int> a(n);
  REP(i,n)  cin >> a[i];

  bool isOdd = false;
  REP(i,n){
    if(a[i]%2 == 1) isOdd = true; 
  }

  ll ans= 0;
  if(isOdd) ans = pow(2,n-1);
  else {
    if(p == 0) ans = pow(2,n);
    else ans = 0;
  }

  cout << ans << endl;



  return 0;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int n ;
  cin >>n ;
  vector<int> p(n);
  for(int i =0; i<n ;i++){
    cin >> p[i];
  }
  sort(p.begin(),p.end());
  int ans =0;
  for(int i =0; i<n-1 ;i++){
    ans += p[i];
  }
  cout << ans +p[n-1]/2 <<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>

using namespace std;

int main(){
   int n,k;
   cin>>n>>k;
   cout<<n-(k-1)<<endl;
}

   


Measured memory_bytes: 888
#include <stdio.h>
int main(void) {
    int cnt = 0;
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        int k;
        scanf("%d", &k);
        cnt += k % 2;
    }
    puts(cnt % 2 ? "NO" : "YES");
    return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c float64
	fmt.Scanln(&a, &b, &c)
	r := 2 * math.Pi / 360 * c
	s := a * b * math.Sin(r) / 2
	l := a + b + math.Sqrt(a*a+b*b-2*a*b*math.Cos(r))
	h := b * math.Sin(r)
	fmt.Printf("%f\n%f\n%f\n", s, l, h)
	return
}



Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
    int n, a; scanf("%d%d", &n, &a);
    int x = n % 500;
    puts(x <= a ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <numeric>
#include <algorithm>
#include <math.h>

using namespace std;

int64_t N;

int main(){
    cin >> N;

    int64_t n = N, s_n = 0;
    while ( 0 < n )
    {
        s_n += n % 10;
        n /= 10;
    }

    bool ans;
    if( N % s_n == 0 )  ans = true;
    else    ans = false;
    
    cout << ( (ans)? "Yes" : "No" ) << endl;
}

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

int main() {
    int n, m; cin >> n >> m;
    priority_queue<int> pq;
    while (n--) {
        int a; cin >> a; pq.emplace(a);
    }
    while (m--) {
        int a = pq.top(); pq.pop(); pq.emplace(a / 2);
    }
    long long ans = 0;
    while (!pq.empty()) {
        ans += pq.top(); pq.pop();
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	int A[N];
	int B[N];
	vector<int> C(N - 1);
	int sum = 0;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	for (int i = 0; i < N - 1; i++) cin >> C.at(i);
	for (int i = 0; i < N; i++) sum += B[i];
	for (int i = 0; i < N - 1; i++) {
		if (A[i + 1] - A[i] == 1) sum += C.at(A[i] - 1);
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		int X = input.nextInt();
		int Y = input.nextInt();
		boolean good = false;
		for (int crane = 0; crane <= X; crane++) {
			if (crane*2+(X-crane)*4==Y) {
				good=true;
				break;
			}
		}
		System.out.println(good?"Yes":"No");
	}	
}

Measured memory_bytes: 27060
import math

n,m=map(int,input().split())
A=list(reversed(sorted(map(int,input().split()))))
L=[math.log(a,2) for a in A]
L.append(-1)

now=int(L[0]) #log2のどこまで使うか
for i in range(n):
    cnt=m//(i+1)
    d=now-int(L[i+1])
    if cnt<d:
        now-=cnt
        m=m%(i+1)
        break
    else:
        m-=d*(i+1)
        now=int(L[i+1])

for k in range(i+1):
    A[k]/=2**(int(L[k])-now)

A=list(reversed(sorted(A)))
for i in range(min(n,m)):
    A[i]/=2
for i in range(n):
    A[i]=int(A[i])
print(sum(A))

Measured memory_bytes: 72600
dic = {}
dic.setdefault('a',str(input())+'E')
dic.setdefault('b',str(input())+'E')
dic.setdefault('c',str(input())+'E')
dare = dic['a'][0]
dic['a'] = dic['a'][1:]
while len(dic['a'])>0 and len(dic['b'])>0 and len(dic['c'])>0:
    tmp = dic[dare][0]
    dic[dare] = dic[dare][1:]
    if tmp=='E':
        ans = dare.upper()
    dare = tmp
print(ans)


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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
const int MOD = (int) 1e9 + 7;
//const int MOD = (int) 998244353;
const int maxn = (int) 2e5 + 20;
const int maxm = (int) 1e6 + 20;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL MOD)
{
    if(n < 0) a = fp(a, MOD - 2, MOD), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % MOD) if(n & 1) res = res * a % MOD; return res;
}

void work()
{
    double s;
    cin >>s;
    printf("%.12f\n", s * s * s / 27.0);

}


int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
//    pre();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }


void _main() {
  int N, K;
  string S;
  cin >> N >> S >> K;

  char c = S[K-1];
  rep(i, 0, N) if (S[i] != c) S[i] = '*';
  cout << S << endl;
}

Measured memory_bytes: 256
import numpy as np
import itertools

n = int(input())

p = []

for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        p.append([i, x - 1, y])

# print(p)

a = np.array(list(itertools.product([0, 1], repeat=n)), dtype="bool")

# print(a)

for i, x, y in p:
    cond = (~a[:, i]) | (a[:, x] == bool(y))
    a = a[cond]
# print(a)

ans = a.sum(axis=1).max()
print(ans)


Measured memory_bytes: 18356
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int aa,bb;
vector<string>ans;
void dfs(int a,int b,string now){

	if(a==aa&&b==bb){
	ans.push_back(now);
	return ;
	}	
	if((a<=3&&b==5 || b<=3&&a==5 || a==4&&b==6 || b==4&&a==6)){
	
		if(a==aa&&b==bb)ans.push_back(now);
	return ;	
	}

	if(a<aa)dfs(a+1,b,now+"A");
	if(b<bb)dfs(a,b+1,now+"B");
}


int main(){
	cin>>aa>>bb;
	dfs(0,0,"");
	sort(ans.begin(),ans.end());
	for(int i=0;i<(int)ans.size();i++)cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n < k) {
        cout << n * x << endl;
    } else {
        cout << k * x + (n - k) * y << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  long int N, H, W;
  cin >> N;
  cin >> H;
  cin >> W;

  if(N<H || N<W){
    cout << 0 << "\n";
    return 0;
  }

  cout << (N-H+1)*(N-W+1) << "\n";

  return 0;
}


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

int n, a;
double v;

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a, v += (1.0 / a);
    cout << setprecision(15) << (1.0 / v) << endl;
    return 0;
}


Measured memory_bytes: 256
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

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

N = I()
memo = [{} for _ in range(N+1)]

def ok(last4):
    for i in range(4):
        s = list(last4)
        if i>=1:
            s[i-1], s[i] = s[i], s[i-1]
        if 'AGC' in ''.join(s):
            return False
    return True

def rec(cur, s):
    if s in memo[cur]:
        return memo[cur][s]
    if cur==N:
        return 1
    ret = 0
    for c in 'AGCT':
        if ok(s+c):
            ret = (ret + rec(cur+1, s[-2:]+c))%mod
    memo[cur][s] = ret
    return ret

print(rec(0,'TTT'))

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

#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

int a,b,c;
int main() {
	cin>>a>>b>>c;
	cout<<min((c+a-1)/a,(c+b-1)/b)<<endl;
	return 0;
}


Measured memory_bytes: 256
/**-------------------------
|--------From A.R.A--------|
-------------------------**/

#include <bits/stdc++.h>

#define ll            long long int
#define pb            push_back
#define ull           unsigned long long int
#define endl          "\n"
#define sz(c)         (c).size()
#define sall(c)       sort((c).begin(),(c).end())
#define rsall(c)      sort((c).rbegin(),(c).rend())
#define rev(c)        reverse((c).begin(),(c).end())
#define FOR(i,n)      for(ll i=0;i<n;i++)
#define max3(a,b,c)   max(max(a,b),c)
#define min3(a,b,c)   min(min(a,b),c)
#define input(a,i,n)  for(ll i=1;i<=n;i++){     cin>>a[i];}
#define output(a,i,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}

using namespace std;
int64_t R=1;
int main()
{
    int64_t n;
    cin>>n;
    if(n<30) cout<<"No";
    else cout<<"Yes";
    return 0;
}


Measured memory_bytes: 3612
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int mod=1e9+7;
struct matrix{
	int a[4][4];
	matrix(){
		memset(a,0,sizeof a);
	}
	inline int *operator[](const int x){
		return a[x];
	}
	inline matrix operator*(matrix A)const{
		matrix res;
		rep(k,0,2)
			rep(i,0,2)
				rep(j,0,2)
					res[i][j]=(res[i][j]+1ll*a[i][k]*A[k][j])%mod;
		return res;
	}
}A,B,C,Ans;
const int N=2e5+11;
int m,n,pos;
int a[N];
inline matrix fp(matrix A,int n){
	--n;
	matrix res=A;
	for(;n;n>>=1,A=A*A)
		if(n&1)
			res=res*A;
	return res;
}
int main(){
	A[0][1]=2,A[1][2]=1,A[0][2]=1,
    A[0][0]=1,A[1][1]=1,A[2][2]=1,
    B[2][0]=1,B[0][0]=1,B[1][1]=1,B[2][2]=1;
    C=A*B;
    scanf("%d%d",&n,&m);
    rep(i,1,m)
    	scanf("%d",a+i);
    a[++m]=n;
    Ans[0][0]=1;
    rep(i,1,m){
    	if(a[i]-pos-1)
    		Ans=Ans*fp(C,a[i]-pos-1);
    	Ans=Ans*A;
    	pos=a[i];
	}
	printf("%d\n",Ans[0][2]);
	return 0;
}

Measured memory_bytes: 512
def main():
    from collections import Counter
    from heapq import heapify,heappop,heappush
    H,W = map(int,input().split())
    A = ''
    for i in range(H):
        A += input()
    A = list(A)
    num_chars = list(map(lambda x: -x, Counter(A).values()))
    heapify(num_chars)
    # H == 1 or W == 1

    for i in range((H//2)*(W//2)):
        num = heappop(num_chars)
        
        if -4 < num:
            print('No')
            return
        else:
            heappush(num_chars,num+4)

    if H & 1:
        for i in range(W//2):
            num = heappop(num_chars)
            if -2 < num:
                print('No')
                return
            else:
                heappush(num_chars,num+2)

    if W & 1:
        for i in range(H//2):
            num = heappop(num_chars)
            if -2 < num:
                print('No')
                return
            else:
                heappush(num_chars,num+2)


    if H & 1 and W & 1:
        if num_chars[0] != -1:
            return
    print('Yes')
    return
    






main()

Measured memory_bytes: 74852
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>
#include <set>
#include <cmath>
#include <functional>

using namespace std;

int main(void)
{
	long long int x, y;

	cin >> x >> y;

	if (abs(x - y) <= 1)
	{
		cout << "Brown" << endl;
	}
	else
	{
		cout << "Alice" << endl;
	}

	return 0;

}

Measured memory_bytes: 256
suicide = 0
while True:
    try:
        sentence = raw_input()
        start = None
        last = None
        for index, char in enumerate(sentence):
            if char.isdigit():
                if start == None:
                    start = index
            elif not start == None and not char.isdigit():
                last = index
                suicide += int(sentence[start:last])
                start = None
                last = None
        else:
            if not start == None:
                suicide += int(sentence[start:])
    except EOFError:
        print suicide
        break

Measured memory_bytes: 4224
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S; cin >> S;
    char prev = S[0];
    int step = 0;
    for (int i = 1; i < S.size(); i++) {
        if (S.at(i) != prev) step++;
        prev = S.at(i);
    }
    cout << step << endl;
}

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

#define NIL -2
#define INF 1000000001

using namespace std;
static const int BLK = 2;
static const int GRY = 1;
static const int WHT = 0;

void dijkstra(const vector<vector<pair<int,int> > > &adj_list, 
                    vector<int> &color, 
                    vector<int> &parent, 
                    vector<int> &minpath,
                    int start_node)
{
    priority_queue<pair<int,int>,vector<pair<int,int> >, greater<pair<int,int> > >  PQ;
    PQ.push(make_pair(start_node,0));

    while(!PQ.empty()){
        pair<int,int> t = PQ.top(); PQ.pop();
        int u = t.second;
        color[u] = BLK;
        if(minpath[u] < t.first) continue;
        for(int i = 0;i < adj_list[u].size();i++){
            int v = adj_list[u][i].first;
            if(color[v] != BLK){
                if(minpath[u] + adj_list[u][i].second < minpath[v]){
                    minpath[v] = minpath[u] + adj_list[u][i].second;
                    parent[v] = u;
                    color[v] = GRY;
                    PQ.push(make_pair(minpath[v],v));
                }  
            }
        }
        
    }

}


int main(){
    int mat_size;
    int node, deg;
    int to,weight;
    int temp;
    int cost = 0;

    scanf("%d",&mat_size);
    vector<vector<pair<int,int> > > adj_list(mat_size);
    vector<int> color(mat_size,WHT);
    vector<int> minpath(mat_size,INF);
    vector<int> parent(mat_size,-1);
    
    for(int i = 0;i < mat_size;i++){
        scanf("%d %d",&node,&deg);
        for(int j = 0;j < deg;j++){
            scanf("%d %d", &to, &weight);
            adj_list[node].push_back(make_pair(to,weight));
        }
    }
    
    minpath[0] = 0;
    dijkstra(adj_list,color,parent,minpath,0);

    for(int i = 0; i < mat_size;i++){
        printf("%d %d\n",i,minpath[i]);
    }

    return 0;   
}



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

int main(){
  int N;  cin >> N;
  int Q;  cin >> Q;
  string S; cin >> S;
  vector<int>AC(N+1,0);
  for(int i=1;i<N;i++){
    if(S.at(i-1) == 'A' && S.at(i) == 'C'){
      for(int j=i+1;j<=N;j++){
        AC.at(j)++;
      }
    }
  }
  for(int i=0;i<Q;i++){
    int l,r;  cin >> l >> r;
    cout << AC.at(r) - AC.at(l) << endl;
  }
}

Measured memory_bytes: 3820
W, H, N = gets.split.map(&:to_i)
spot =[]
N.times do
  spot << gets.split.map(&:to_i)
end

g = Array.new(H).map{Array.new(W, 1)}
spot.each do |x, y, a|
  case a 
  when 1 
    xr = (0...x)
    yr = (0...H)
  when 2 
    xr = (x...W)
    yr = (0...H)
  when 3 
    xr = (0...W)
    yr = (0...y)
  when 4
    xr = (0...W)
    yr = (y...H)
  end
  xr.each do |xi|
    yr.each do |yi|
        g[yi][xi] = 0 
    end
  end
end
puts g.flatten.inject(:+)


Measured memory_bytes: 1916
import java.util.*;

class Main{
	public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    // /*
    for(int i=0;i<str.length();i++){
      if(i%2!=0){
        //System.out.println("Even");
        //System.out.println(str.charAt(i));
        if(str.charAt(i)!='L' && str.charAt(i)!='U' && str.charAt(i)!='D'){
          System.out.println("No");
          System.exit(0);
        }
      }
      else {
        //System.out.println("Odd");
        //System.out.println(str.charAt(i));
        if(str.charAt(i)!='R' && str.charAt(i)!='U' && str.charAt(i)!='D'){
          System.out.println("No");
          System.exit(0);
        }
      }
    }
    // */
    System.out.println("Yes");
}
}


Measured memory_bytes: 23892
import sys
input = sys.stdin.readline

def main():
    n , m = map( int , input().split() )
    h = list( map( int , input().split() ) )
    goods = [ 1 for i in range(n) ]
    for i in range( m ):
        a , b = map( lambda x : int(x) - 1  , input().split() )
        if ( h[a] > h[b] ):
            goods[ b ] = 0
        if ( h[a] < h[b] ):
            goods[ a ] = 0
        if ( h[a] == h[b] ):
            goods[ a ] = 0
            goods[ b ] = 0
    print( sum(goods) )
main()

Measured memory_bytes: 20316
#include <stdio.h>
int main()
{
	int n,a,s=0,N;
	scanf("%d",&n);
	N=n;
	while(n>0)
	{
		a=n%10;
		n=n/10;
		s+=a;
	}
	if(N%s==0)
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

unsigned char D[252004];
bool E[252004];
int Q[252004];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N;
	cin >> N;
	int n = N + 2;
	rep1(i, N) {
		int ij = n * i + 1;
		unsigned char kari = min(i - 1, N - i);
		unsigned char kari2 = 3;

		rep(j, kari) {
			D[ij++] = kari2++;
		}
		rep(j, N - kari - kari) {
			D[ij++] = kari + 3;
		}
		rep(j, kari) {
			D[ij++] = --kari2;
		}
	}

	int kotae = 0;
	rep(k, N * N) {
		int ij;
		cin >> ij;
		ij += (ij - 1) / N * 2 + N + 2;

		kotae += D[ij];
		E[ij] = 1;

		int p = 0, q = 0;
		Q[p++] = ij;

		while (p > q) {
			int ij = Q[q++];
			int d =	D[ij] - E[ij] + 1;

			if (D[ij - n] > d) {
				D[ij - n] = d;
				Q[p++] = ij - n;
			}
			if (D[ij + n] > d) {
				D[ij + n] = d;
				Q[p++] = ij + n;
			}
			if (D[ij - 1] > d) {
				D[ij - 1] = d;
				Q[p++] = ij - 1;
			}
			if (D[ij + 1] > d) {
				D[ij + 1] = d;
				Q[p++] = ij + 1;
			}
		}
	}

	co(kotae - 3 * N * N);



	Would you please return 0;
}

Measured memory_bytes: 4960
def main():
   N = int(input())
   a = list(map(int, input().split()))

   a.sort()
   a.append(0)
   b = 0
   c = 0
   count = 0
   for a in a:
      if a != b:
         if b < c:
            count += c - b
         elif b > c:
            count += c
         b = a
         c = 1
      else:
         c += 1
   return count

print(main())


Measured memory_bytes: 14244
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

typedef vector<ll> vec;
typedef vector<vec> mat;
const int mod=1000000007;
mat mul(mat &A,mat &B){
    mat C(A.size(),vec(B[0].size()));
    rep(i,A.size())rep(k,B.size())rep(j,B[0].size()){
        C[i][j]=(C[i][j]+A[i][k]*B[k][j])%mod;
    }
    return C;
}
mat pow(mat A,ll n){
    mat B(A.size(),vec(A.size()));
    rep(i,A.size()) B[i][i]=1;
    while(n>0){
        if(n&1)B=mul(B,A);
        A=mul(A,A);n>>=1;
    }
    return B;
}

int n;
ll k;
ll ai;
int main(){
    cin>>n>>k;
    mat a=vector<vector<ll> >(n,vector<ll>(n,0));
    rep(i,n)rep(j,n){
        cin>>ai;
        a[i][j]=ai;
    }
    a=pow(a,k);
    ll ans=0;
    rep(i,n)rep(j,n){
        ans+=a[i][j];
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    ll res;

    res = C - (A - B);

    if(res <= 0)
    {
        res = 0;
    }

    cout << res <<endl;

    return 0;
}

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


def solve(D: int):
    print("Christmas" + " Eve" * (25 - D))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    solve(D)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import numpy as np
S = list(str(input()))
S = [int(s) for s in S]
S = np.array(S)
n = len(S)

N1 = np.zeros(n)
N2 = np.zeros(n)
N1[0::2] = 1
N2[1::2] = 1

a = N1 + S
a_num = np.sum(a[np.where(a == 1)])
b = N2 + S
b_num = np.sum(b[np.where(b == 1)])
print(int(min(a_num, b_num)))

Measured memory_bytes: 19268
#include <stdio.h>
#include <string.h>

int main(void)
{
	char n[100001];
	scanf("%s", n);

	int initial = 0;

	if(n[0] == '1'){
		initial = 1;	
	}

	int count = 0;
	for(int i = 1;i < strlen(n); i++) {
		if(initial) {
			if(i % 2 == 1 && n[i] != '0') {
				count++;
			} else if(i % 2 == 0 && n[i] != '1') {
				count++;
			}
		} else {
			if(i % 2 == 1 && n[i] != '1') {
				count++;
			} else if(i % 2 == 0 && n[i] != '0') {
				count++;
			}
		}
	}

	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> vec(N); 

  for (int i = 0; i < N; i++) 
    cin >> vec.at(i);

  for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (vec.at(i)>vec.at(j)) {
          int b = vec.at(i);
          vec.at(i)=vec.at(j);
          vec.at(j)=b;
        }
      } 
   
  }
  int b = 1;
  for (int i = 0; i < N-1; i++) {
     if (vec.at(i)>vec.at(i+1)) {
        b++;
        }
  }   
  cout << b << endl;
}

Measured memory_bytes: 256
n = int(input())

list = []
list_hon = [2,4,5,7,9]
list_pon = [0,1,6,8]

while n > 0:
    list.append(n % 10)
    n //= 10

if list[0] in list_hon:
    print("hon")
elif list[0] in list_pon:
    print("pon")
else: #(list[0]) == 3
    print("bon")


Measured memory_bytes: 9172
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = int.Parse(Console.ReadLine());

            int currentDig = 0;
            int cnt = 0;
            do {
                currentDig += X;
                cnt++;
            } while(currentDig % 360 != 0);

            Console.WriteLine(cnt);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 27464
#include<stdio.h>
int main()
{
	char a[1001];
	int i=0;
	while (scanf("%c", &a[i]) != EOF){


		if (a[i] == 'A'){
			a[i] = 'X';
		}
		else if (a[i] == 'B'){
			a[i] = 'Y';
		}
		else if (a[i] == 'C'){
			a[i] = 'Z';
		}
		else if('D'<=a[i]&&'Z'>=a[i]){
			a[i] -= 3;
		}
		printf("%c", a[i]);
		i++;
	}
return 0;
}

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

int h, w;
vector< vector<int> > g;
//vector<vector<bool>> v;

void dfs(int y, int x) {
  g[y][x] = 0;
  for (int i = -1; i <= 1; i++) {
    for (int j = -1; j <= 1; j++) {
      int ny = y + i;
      int nx = x + j;
      if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
      if (g[ny][nx] == 0) continue;
      dfs(ny, nx);
    }
  }
}

int main() {
  while (cin >> w >> h) {
    if (h == 0 || w == 0) break;
    g.assign(h, vector<int>(w, 0));
    rep(i, h) rep(j, w) {
      cin >> g[i][j];
    }
    //v.assign(h, vector<bool>(w, false));
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if (g[i][j] == 0) continue;
      dfs(i, j);
      cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
   ll a,b,c,k;
   cin>>a>>b>>c;
   k=c-a-b;
  if(k>0 && k * k > 4*a*b)
    cout<<"Yes"<<endl;
  else
     cout<<"No"<<endl;

}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		int N = scan.nextInt();
		int[] A = new int[N];

		for(int i=0; i < N; i++)
		{
			A[i] = scan.nextInt();
		}

		(new Solve(N, A)).solve();
	}
}
class Solve {
	private final int N;
	private final int[] A;

	public Solve(final int N, final int[] A)
	{
		this.N = N;
		this.A = A;
	}

	public void solve()
	{
		int A[] = copyNumbers(N, this.A);

		printNumList(N, A);

		for(int i=1; i < N; i++)
		{
			int v = A[i];
			int j= i - 1;

			while(j >= 0 && v < A[j])
			{
				A[j+1] = A[j];
				j--;
			}

			A[j+1] = v;

			printNumList(N, A);
		}
	}

	public int[] copyNumbers(final int N, final int[] A)
	{
		int[] numbers = new int[N];

		for(int i=0; i < N; i++) numbers[i] = A[i];

		return numbers;
	}

	public void printNumList(final int N, final int[] A)
	{
		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++)
		{
			sb.append(A[i]);
			sb.append(" ");
		}


		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}
class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
}

Measured memory_bytes: 27012
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using static Scanner;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        int H = ScanInt(), W = ScanInt();
        var a = new List<string>();
        for (int i = 0; i < H; i++) {
            var isAllWhite = true;
            var line = Scan();
            for (int j = 0; j < W; j++) {
                if (line[j] == '.') continue;
                isAllWhite = false;
                break;
            }
            if (!isAllWhite) a.Add(line);
        }
        for (int i = 0; i < W; i++) {
            var isAllWhite = true;
            foreach (var s in a) {
                if (s[i] == '.') continue;
                isAllWhite = false;
                break;
            }
            if (!isAllWhite) continue;
            for (int j = 0; j < a.Count; j++) {
                a[j] = new StringBuilder(a[j][..i]).Append(a[j][(i + 1)..]).ToString();
            }
            i--;
            W--;
        }
        foreach (var line in a) {
            Console.WriteLine(line);
        }
    }
}

public static class Scanner
{
    static readonly Stream stream = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte ConsoleIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stream.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = ConsoleIn();
        while ((by < '!' || '~' < by) && !isEof) by = ConsoleIn();
        return (char) by;
    }
    public static string Scan() {
        var sb = new StringBuilder();
        for (var ch = GetChar(); '!' <= ch && ch <= '~'; ch = (char) ConsoleIn()) {
            sb.Append(ch);
        }
        return sb.ToString();
    }
    public static int ScanInt() {
        var temp = 0;
        for (var ch = GetChar(); '0' <= ch && ch <= '9'; ch = (char) ConsoleIn()) {
            temp = temp * 10 + ch - '0';
        }
        return temp;
    }
}

Measured memory_bytes: 25592
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
      .map(|e| e.parse().ok().unwrap()).collect()
}

struct Stack {
    top: usize,
    s: [i32; 1000],
}

impl Stack {
    fn new() -> Stack {
        Stack {
            top: 0,
            s: [0; 1000],
        }
    }

    fn push(&mut self, x: i32) {
        self.top += 1;
        self.s[self.top] = x;
    }

    fn pop(&mut self) -> i32 {
        self.top -= 1;
        self.s[self.top + 1]
    }
}

fn main() {
    let mut stack = Stack::new();
    let symbols: Vec<String> = read_vec();
    for i in 0..symbols.len() {
        if symbols[i] == "+" {
            let a = stack.pop();
            let b = stack.pop();
            stack.push(a + b);
        } else if symbols[i] == "-" {
            let a = stack.pop();
            let b = stack.pop();
            stack.push(b - a);
        } else if symbols[i] == "*" {
            let a = stack.pop();
            let b = stack.pop();
            stack.push(a * b);
        } else {
            stack.push(symbols[i].parse().unwrap());
        }
    }

    let ans = stack.pop();
    println!("{}", ans);
}



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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

double e(ll x) {
  ll sum = x * (x + 1) / 2;
  return (double)sum / (double)x;
}

void solve(ll N, ll K, std::vector<ll> p) {
  vector<ll> acc(N + 1);
  acc.at(0) = 0;
  rep(i, N) acc.at(i + 1) = acc.at(i) + p.at(i);

  ll idx = -1;
  ll mx = -1;

  rep(i, N - K + 1) {
    ll s = acc.at(i + K) - acc.at(i);
    if (s > mx) {
      mx = s;
      idx = i;
    }
  }

  double ans = 0.0;
  FOR(i, idx, idx + K) { ans += e(p.at(i)); }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  std::vector<ll> p(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &p[i]);
  }
  solve(N, K, std::move(p));
  return 0;
}


Measured memory_bytes: 6420
#include <iostream>
using namespace std;
int main()
{
    int h;
    int w;
    bool bLoop = true;
    
    while(bLoop)
    {
        cin >> h >> w;
        
        if ((h == 0) && (w == 0))
        {
            bLoop = false;
        }
        else
        {
            for (int i = 0; i < h; ++i)
            {
                for (int j = 0; j < w; ++j)
                {
                    if ((i == 0) || (i == (h - 1)) || (j == 0) || (j == (w - 1)))
                    {
                        cout << "#";
                    }
                    else
                    {
                        cout << ".";
                    }
                }
                cout << endl;
            }
            cout << endl;
        }
    }
    
    return 0;
}


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

using namespace std;
int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);//, x(M), y(M), c(M);
  int min_a = 100000, min_b = 100000;
  for (int i = 0; i < A; ++i) {
    cin >> a.at(i);
    if (a.at(i) < min_a) {
      min_a = a.at(i);
    }
  }
  for (int i = 0; i < B; ++i) {
    cin >> b.at(i);
    if (b.at(i) < min_b) {
      min_b = b.at(i);
    }
  }
  int ans = min_a + min_b;
  for (int i = 0; i < M; ++i) {
    int x, y, c;
    cin >> x >> y >> c;
    --x;
    --y;
    int t = a.at(x) + b.at(y) - c;
    if (t < ans) {
      ans = t;
    }
  }

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define PUTS(x) cout << (x) << endl;
int main() {
    int n;
    cin >> n;
    int ans = 0;
    bool flag = false; // 直前が×であったか
    reps(i, n) {
        int x;
        cin >> x;
        if (x == i) { // 今回が×のとき
            if (flag) { // 1つ前が×ならこれらを入れ替え
                ans++;
                flag = false; // 最後は○になった
            } else { // 1つ前が○のとき
                flag = true; // まだ入れ替えはせず，最後が×になったという情報を伝える
            }
        } else { // 今回が○のとき
            if (flag) { // 1つ前が×ならこれらを入れ替え
                ans++;
            }
            flag = false; // いずれにせよ最後は×でない
        }
    }
    if (flag) ans++; // 一番最後が×で残っている場合はそれを直前と入れ替え
    PUTS(ans);
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n;	scanf("%d",&n);
	int dif[n];
	int v[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&v[i]);
	}
	int c[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&c[i]);
		dif[i]=v[i]-c[i];
		if(dif[i]<0) dif[i]=0;
	}

	int ans=0;
	for (int i = 0; i < n; ++i)
	{
		ans+=dif[i];
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 128
#標準入力
a,b = map(int,input().split())

#0なら西暦を和暦に変換する
if a == 0:
    if b > 1988:print("H" + str(b - 1988))
    elif b > 1925:print("S" + str(b - 1925))
    elif b > 1911:print("T" + str(b - 1911))
    else:print("M" + str(b - 1867))
    
#それ以外なら和暦を西暦にする
if a == 1:print(1867 + b)
if a == 2:print(1911 + b)
if a == 3:print(1925 + b)
if a == 4:print(1988 + b)


Measured memory_bytes: 5596
# -*- coding: utf-8 -*-

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

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

ans = 0
for i in range(1, N):
    ans += min((xN[i] - xN[i-1]) * A, B)
print(ans)


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

int main(){
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    cout << (60*H2 + M2) - (60*H1 + M1) - K << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

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;}

const ll MOD = 1000000007;
const int INF = 1<<29;
#define PI 3.14159265359

int main(){
  double R; cin >> R;
  printf("%.6f", 2 * PI * R);
}


Measured memory_bytes: 3788
import sys
input = sys.stdin.readline

def main():
    s = input().strip()

    ans = 0
    count_a = 0
    if s[0] == "A":
        count_a += 1
    for i in range(len(s)-1):
        tmp = s[i:i+2]
        if tmp == "AA":
            count_a += 1
        elif tmp == "AB":
            pass
        elif tmp == "BC":
            ans += count_a
        elif tmp == "CB":
            pass
        elif tmp == "CA":
            count_a += 1
        elif tmp == "BA":
            count_a = 1
        else:
            count_a = 0
        # print(i, count_a)
    print(ans)
        

        


if __name__ == "__main__":
    main()


Measured memory_bytes: 3500
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	int X,Y,Z;
	int i,j;
	int tmp;
	int answer=0;
	int counter=0;
	vector<int> given;

	cin >> X >> Y >> Z;

	cout << Z << " " << X << " " << Y << endl;

	return 0;
}



Measured memory_bytes: 3604
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m:usize,
        k:usize,
        a: [usize; n],
        b: [usize; m]
    }

    let mut ruiseki_a = vec![0; n + 1];
    let mut ruiseki_b = vec![0; m + 1];
    for x in 1..=n {
        ruiseki_a[x] = a[x-1] + ruiseki_a[x - 1];
    }
    for y in 1..=m {
        ruiseki_b[y] = b[y-1] + ruiseki_b[y - 1];
    }

    let mut ans = 0;
    let mut j = m;
    for i in 0..=n {
        if ruiseki_a[i] > k {
            break;
        }

        while ruiseki_b[j] + ruiseki_a[i] > k {
            j -= 1;
        }
        ans = ans.max(i + j);
    }

    println!("{}", ans);
}


Measured memory_bytes: 12488
n = int(input())
heights = list(map(lambda x: int(x), input().split()))
sum_boards = 0

for i in range(len(heights) - 1):
    gap = heights[i+1] - heights[i]
    
    if gap >= 0:
        continue
    sum_boards += abs(gap)
    heights[i+1] = heights[i]
    
print(sum_boards)
        
        
    

Measured memory_bytes: 32300
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ull bin(ull a, ull b)
{
    if(a%mod==0) return 0;
    ull res = 1;
    a %= mod;
    while(b)
    {
        if(b&1) res = (res*a)%mod;
        b >>= 1;
        a *= a;
        a%=mod;
    }
    return res%mod;
}

int main()
{
    int n, k;
    cin>>n>>k;
    vector<ll> v(n);
    for(int i = 0; i<n; ++i)
    {
        cin>>v[i];
    }

    sort(v.begin(), v.end(), greater<ll>());
    if(k>=n)
    {
        cout<<0<<endl;
        return 0;
    }

    ll sum = 0;
    for(int i = k; i<n; ++i)
        sum += v[i];
    cout<<sum<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll e[1005][1005];
ll d[1005][1005];
ll n,m;
ll a[1005],b[1005],c;
ll ans;
int main(void){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j){
				d[i][j]=0;
			}else{
				d[i][j]=100000000;
			}
		}
	}
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i]>>c;
		e[a[i]-1][b[i]-1]=c; e[b[i]-1][a[i]-1]=c;
		d[a[i]-1][b[i]-1]=c; d[b[i]-1][a[i]-1]=c;
	}
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
	for(int i=0;i<m;i++){
		if(d[a[i]-1][b[i]-1]<e[a[i]-1][b[i]-1]){
			ans++;
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 4864