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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define _P(...) (void)fprintf(stderr, __VA_ARGS__)

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	ll n, m;
	cin >>n >>m;

	
	ll m2 = 1LL << m;
	ll ans = ((n-m)*100 + m*1900) * m2;
	cout << ans<<"\n";
	return 0;
}

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

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

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

void test(vs red,vs blue)
{
	int h=red.size(),w=red[0].size();
	rep(i,h){
		cout<<red[i]<<' '<<blue[i]<<' ';
		rep(j,w)
			cout<<".#"[red[i][j]=='#'&&blue[i][j]=='#'];
		cout<<endl;
	}
}

int main()
{
	for(int h,w;cin>>h>>w && h|w;){
		vs grid(h);
		rep(i,h) cin>>grid[i];

		vs red(h,string(w,'.')),blue=red;
		rep(i,h){
			if(i%2==0){
				rep(j,w-1) red[i][j]='#';
				blue[i][w-1]='#';
			}
			else{
				red[i][0]='#';
				repi(j,1,w) blue[i][j]='#';
			}
		}

		rep(i,h) rep(j,w) if(grid[i][j]=='#')
			red[i][j]=blue[i][j]='#';

		rep(i,h) cout<<red[i]<<endl;
		cout<<endl;
		rep(i,h) cout<<blue[i]<<endl;
	}
}


Measured memory_bytes: 1536
N = int(input())
A = [int(a) for a in input().split()]
c4 = 0
c2 = 0
for a in A:
    if a % 4 == 0: c4 += 1
    elif a % 2 == 0: c2 += 1

if c4 >= N // 2:
    print("Yes")
elif c2 >= N - 2 * c4:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
n = gets.to_i

res = {}

res['AC'] = 0
res['WA'] = 0
res['TLE'] = 0
res['RE'] = 0

n.times do
  r = gets.chomp
  res[r] += 1
end

puts "AC x #{res['AC']}"
puts "WA x #{res['WA']}"
puts "TLE x #{res['TLE']}"
puts "RE x #{res['RE']}"

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

#define mod 1000000007

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

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

int N;

vector<int> color;
void dfs(const Graph &G, int v){
	for(auto next_v : G[v]){
        if(color[next_v.first] != -1)
            continue;
		if(next_v.second % 2 == 0){
			color[next_v.first] = color[v];
		}else{
            color[next_v.first] = abs(color[v] - 1);
        }
		dfs(G, next_v.first);
	}
}
 
int main(void){
    cin >> N;
	Graph G(N);
	for(int i=0; i<N-1; i++){
		int u, v, w;
		cin >> u >> v >> w;
        u--;
        v--;
		G[u].push_back(make_pair(v, w));
		G[v].push_back(make_pair(u, w));
	}
    color.resize(N);
	color.assign(N, -1);
    color[0] = 1;
	dfs(G, 0);
    rep(i, N)
        cout << color[i] << endl;
	
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;++i)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;0<=i;--i)
#define rRep(i,n) for(int i=n;0<i;--i)
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define EPS 1e-8
#define INF 1e8

typedef double Real;
typedef int Int;
typedef vector<Int> vi;
typedef vector<vector<Int> > vvi;
typedef pair<Int,Int> pii;

inline Real sr(Real a) {return sqrt(max(a, (Real)0));}
const vi dy = {-1, 0, 1, 0}, dx = {0, -1, 0, 1};

template <typename T> ostream& operator<< (ostream& out, const vector<T>& v) {
  out << '[';
  rep(i, v.size()) out << v[i] << ",";
  out << "\b], " << v.size() << "\n";
  return out;
}

// vars
string s;
int K;

int distToA(int idx) {
    if(s[idx] == 'a') return 0;
    return 26 - (s[idx] - 'a');
}

void solve() {
    cin >> s >> K;

    int N = s.size();
    rep(i, N) {
        int toA = distToA(i);
        if(K >= toA) {
            s[i] = 'a';
            K -= toA;
        }
        if(K == 0) {
            break;
        }
    }

    if(K > 0) {
        if(26 <= K) K %= 26;
        s[N-1] += K;
    }

    cout << s << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int r,g,b;

int main(){
	cin>>r>>g>>b;
	if((g*10+b)%4==0){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  bool flag = true;
  for(int i=1; i<=s.size(); i++){
    if(i%2==0){
      if(s.at(i-1)=='R'){cout << "No" << endl;return 0;}
    }else{
      if(s.at(i-1)=='L'){cout << "No" << endl;return 0;}
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
    int n;
    int a[3005];
    cin >> n;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    cout << sum - n << endl;

    return 0;
}



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

int main(){
    int k,x;
    cin >>k>>x;
    
    for(int i=x-k+1; i<x+k; i++){
        cout << i;
        if(i!=x+k-1)cout << " ";
    }
    
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
import itertools
from collections import deque
from sys import stdin
input = stdin.readline


def main():
  H, W = list(map(int, input().split()))

  M = [input()[:-1] for _ in range(H)]

  def bfs(start):
    dist = [[float('inf')]*W for _ in range(H)]
    dist[start[0]][start[1]] = 0

    q = deque([start])
    max_ = 0

    while len(q):
      now_h, now_w = q.popleft()
      for next_h, next_w in ((now_h+1, now_w),
                             (now_h-1, now_w),
                             (now_h, now_w-1),
                             (now_h, now_w+1)):

        if not(0 <= next_h < H) or not(0 <= next_w < W) or \
           (dist[next_h][next_w] != float('inf')) or \
           M[next_h][next_w] == '#':
          continue

        temp = dist[now_h][now_w] + 1
        dist[next_h][next_w] = temp
        if max_ < temp:
          max_ = temp
        q.append((next_h, next_w))
    return max_

  max_ = 0
  for h in range(H):
    for w in range(W):
      if M[h][w] == '.':
        max_ = max(bfs((h, w)), max_)

  print(max_)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 74576
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_N = 200050;
int64_t N;

int64_t g_A, s_A, b_A;
int64_t g_B, s_B, b_B;

int main(int argc, char **argv) {
    std::cin >> N;
    std::cin >> g_A >> s_A >> b_A;
    std::cin >> g_B >> s_B >> b_B;

    std::vector<int64_t> val;
    val.resize(N + 1, 0);

    for (int i = N; 0 <= i; i--) {
        if (i >= g_A) {
            val[i - g_A] = std::max(val[i - g_A], val[i] + g_B);
        }
    }
    for (int i = N; 0 <= i; i--) {
        if (i >= s_A) {
            val[i - s_A] = std::max(val[i - s_A], val[i] + s_B);
        }
    }
    for (int i = N; 0 <= i; i--) {
        if (i >= b_A) {
            val[i - b_A] = std::max(val[i - b_A], val[i] + b_B);
        }
    }
    int64_t M = N;
    for (int i = 0; i <= M; i++) {
        N = std::max(N, i + val[i]);
    }

    val.clear();
    val.resize(N + 1, 0);

    for (int i = N; 0 <= i; i--) {
        if (i >= g_B) {
            val[i - g_B] = std::max(val[i - g_B], val[i] + g_A);
        }
    }
    for (int i = N; 0 <= i; i--) {
        if (i >= s_B) {
            val[i - s_B] = std::max(val[i - s_B], val[i] + s_A);
        }
    }
    for (int i = N; 0 <= i; i--) {
        if (i >= b_B) {
            val[i - b_B] = std::max(val[i - b_B], val[i] + b_A);
        }
    }
    M = N;
    for (int i = 0; i <= M; i++) {
        N = std::max(N, i + val[i]);
    }

    std::cout << N << std::endl;
    
    return 0;
}

Measured memory_bytes: 195584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args)throws IOException {
		FastReader sc = new FastReader();
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int arr[] = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		Arrays.sort(arr);
		int ans = 0;
		for (int i = 0; i < k; i++) {
			ans += arr[i];
		}
		System.out.println(ans);

	}

}





class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new
		                        InputStreamReader(System.in));
	}

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

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

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

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

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

Measured memory_bytes: 33200
/*
 * 0142.cpp
 *
 *  Created on: 2011/07/27
 *      Author: isa
 */

#include <iostream>
#include <set>
#include <map>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
	int n;

	while(cin >> n && n){
		vector<int> v;
		int times[((n-1)/2)+1];

		memset(times,0,sizeof(times));
		for(int i=1;i<n;i++){
			if(find(v.begin(),v.end(),i*i%n) == v.end()){
				v.push_back(i*i%n);
			}
		}

		for(int i=0;i<v.size();i++){
			for(int j=0;j<v.size();j++){
				int tmp;
				if(i == j) continue;
				tmp = v[i] - v[j];
				if(tmp < 0) tmp+=n;
				if(tmp > (n-1)/2) tmp = n - tmp;
				times[tmp]++;
			}
		}
		for(int i=1;i<=(n-1)/2;i++){
			cout << times[i] << endl;
		}

	}
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
 
int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}
 
int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}
 
int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int h,w,d,a[314][314],q,l,r;
int ta[114514];
pair<int,int> cnt[114514];

signed main(){
	cin>>h>>w>>d;
	rep(i,h){
		rep(j,w){
			cin>>a[i][j];
			cnt[a[i][j]]={i,j};
		}
	}
	for(int i=1;i<=h*w;i++){
		if(i<=d)ta[i]=0;
		else ta[i]=ta[i-d]+(abs(cnt[i].first-cnt[i-d].first)+abs(cnt[i].second-cnt[i-d].second));
	}
	cin>>q;
	rep(i,q){
		cin>>l>>r;
		cout<<ta[r]-ta[l]<<endl;
	}
}


Measured memory_bytes: 3968
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

struct Node{
    int key;
    Node *next, *prev;
};

Node *nil;

Node* search(int key) {
    Node *cur = nil -> next;
    while (cur != nil && cur -> key != key) {
        cur = cur -> next;
    }
    return cur;
}

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil -> next = nil;
    nil -> prev = nil;
}

void printList() {
    Node *cur = nil -> next;
    int isf = 0;
    while (1) {
        if (cur == nil) break;
        if (isf++ > 0) printf(" ");
        printf("%d", cur -> key);
        cur = cur -> next;
    }
    printf("\n");
}

void deleteNode(Node *t) {
    if (t == nil) return;
    t -> prev -> next = t -> next;
    t -> next -> prev = t -> prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil -> next);
}

void deleteLast() {
    deleteNode(nil -> prev);
}

void deleteKey(int key) {
    deleteNode(search(key));
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x -> key = key;
    x -> next = nil -> next;
    nil -> next -> prev = x;
    nil -> next = x;
    x -> prev = nil;
}

int main(void) {
    int key, n;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (int i = 0; i < n; i++) {
        scanf("%s %d", com, &key);
        if (com[0] == 'i') {
            insert(key);
            np++;
            size++;
        } else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F') deleteFirst();
                else if (com[6] == 'L') deleteLast();
            } else {
            deleteKey(key);
            nd++;
            }
            size--;
        }
    }

    printList();

    return 0;
}

Measured memory_bytes: 32208
n=int(input())
S=[int(input()) for i in range(n)]
if sum(S)%10!=0:
  print(sum(S))
else:
  flag=float("inf")
  for i in range(n):
    if S[i]%10!=0:
      flag=min(flag,S[i])
  print(sum(S)-flag if flag<float("inf") else 0)


Measured memory_bytes: 3060
import bisect
import math
from scipy.misc import comb

N,A,B=map(int,input().split())
List=list(map(int,input().split()))
List = sorted(List, reverse=True)

mini = List[A-1]
ans = 0

if List[A-1] != List[A]:
  ans = sum(List[:A])/A
  print(ans)
  print(1)

else:
  num = List.count(List[A-1])
  List = sorted(List)
  num2 = N - bisect.bisect_right(List,mini)
  List = sorted(List, reverse=True)
  
  if List[0] != List[A-1]:
    B = A
  for i in range(B-A+1):
    n = num
    kosuu = A + i - num2
    ans  = int(ans + comb(n, kosuu, exact=True))
  
  ave = int(sum(List[:A])/A)
  print(ave)
  print(ans)

Measured memory_bytes: 13292
#include <iostream>
#include <cstring>

using ll = long long;
using namespace std;
char H[1046527][14];

int getChar(char ch){
    if (ch =='A') return 1;
    if (ch =='C') return 2;
    if (ch =='G') return 3;
    if (ch =='T') return 4;
}

ll getkey(char str[]){
    ll sum = 0, p = 1, i;
    for ( i = 0; i <  strlen(str); ++i){
        sum += p*getChar(str[i]);
        p *= 5;
    }
    return sum;
}

ll h1(ll key){return key % 1046527;}
ll h2(ll key){return 1 + (key % 1046526); }

int find(char str[]) {
    ll key, i, h;
    key = getkey(str);
    for (i = 0;; i++){
        h = (h1(key) + i*h2(key)) % 1046527;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
}

int insert(char str[]) {
    ll key, i, h;
    key = getkey(str);
    for (i = 0;; i++){
        h = (h1(key) + i*h2(key)) % 1046527;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0){
            strcpy(H[h], str); return 0;
        }
    }
}

int main() {
    int i, n, h;
    char str[14], com[9];
    for (auto &j : H) {
        j[0] = '\0';
    }
    cin >> n;
    for (int k = 0; k < n; ++k) {
        scanf("%s %s", com, str);
        if (com[0] == 'i') {
            insert(str);
        } else {
            if (find (str)) {
                cout << "yes\n";
            } else {
                cout << "no\n";
            }
        }
    }
    return 0;
}


Measured memory_bytes: 17452
fn main() {
    let mut reader = acio::Reader::new();
    let n = reader.read::<i64>();
    let mut t = vec![];
    for _ in 0..n {
        let a = reader.read::<i64>();
        let b = reader.read::<i64>();
        t.push((a, b));
    }
    t.sort_by(|&(_, a), &(_, b)| b.cmp(&a)); // DESC
    let mut remain = None;
    for (a, b) in t {
        if let Some(t) = remain {
            let d = std::cmp::min(t, b);
            remain = Some(d - a);
        } else {
            remain = Some(b - a);
        }
        //println!("{:?} -> {:?}", (a, b), remain);
    }
    if remain.unwrap() < 0 {
        println!("No");
    } else {
        println!("Yes");
    }
}

/// Batteries for AtCoder
#[allow(dead_code)]
mod acbat {
    pub fn lcm(v1: u64, v2: u64) -> u64 {
        v1 * v2 / gcd(v1, v2)
    }

    pub fn gcd(v1: u64, v2: u64) -> u64 {
        if v1 == v2 {
            v1
        } else if v1 < v2 {
            gcd(v1, v2 - v1)
        } else {
            gcd(v1 - v2, v1)
        }
    }
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, Stdin};
    use std::str::FromStr;

    pub struct Reader {
        input: Stdin,
        stack: Vec<String>,
    }

    impl Reader {
        pub fn new() -> Self {
            Reader {
                input: stdin(),
                stack: vec![],
            }
        }

        pub fn read_by<F>(&mut self, count: u64) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            let mut v = vec![];
            for _ in 0..count {
                v.push(self.read());
            }
            return v;
        }

        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            if self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }
}


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

int main() {
  int x, y;
  while (cin >> x >> y, x | y) {
    if (x < y) {
      cout << x << " " << y << endl;
    } else {
      cout << y << " " << x << endl;
    }
  }
}


Measured memory_bytes: 3032
use proconio::{
    input,
    marker::Chars,
};

fn main() {
    input! {
        s: Chars,
    }
    let s = s.iter().map(|&c| c.to_digit(10).unwrap() as usize).collect::<Vec<_>>();

    let mut sum = 0;

    for n in 0..1 << (s.len()-1) {
        let mut start = 0;
        for i in 0..s.len() {
            let mask = 1 << i;
            if mask & n == mask {
                let num = parse(&s, start, i+1);
                sum += num;
                start = i+1;
            }
        }
        let num = parse(&s, start, s.len());
        sum += num;
    }

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

fn parse(s: &Vec<usize>, start: usize, end: usize) -> usize {
    let mut num = 0;
    for d in s.iter().skip(start).take(end-start) {
        num *= 10;
        num += d;
    }
    num
}


Measured memory_bytes: 2184
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        Magatro alice = new Magatro();
        alice.Scan();
        alice.Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;
    private string[] S;
    private int Index;
    private const char Separator = ' ';
    public Scanner()
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(Console.OpenStandardInput());
    }
    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }
    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public decimal NextDecimal()
    {
        return decimal.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private int N;
    private int[] A;
    public void Scan()
    {
        Scanner sc = new Scanner();
        N = sc.NextInt();
        A = sc.IntArray();
    }

    public void Solve()
    {
        int cnt = A.Count(i => i % 2 == 1);
        if (cnt % 2 == 0)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}



Measured memory_bytes: 16216
import java.util.*

fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" "). map { it.toLong() }
    val a = gcd(N, K)
    val list = factorization(a)
    var ans = list.size
    if (!list.contains(1L)) { ans++ }
    println(ans)
}

tailrec fun gcd(a: Long, b: Long): Long = if(b == 0L) a else gcd(b, a % b)

fun decom(v : Long) : List<Long> {
    var value = v
    var list = emptySet<Long>()
    var i = 2L
    while(value !=1L ) {
        if (value%i==0L) {
            list = list + i
            value/= i;
        } else i++;
    }
    return list.toList()
}

fun factorization(n : Long) : List<Long> {
    var list = emptySet<Long>()
    var tmp = n
    for (i in 2L .. Math.sqrt(n.toDouble()).toLong()) {
        if (tmp % i.toLong() == 0L) {
            var count = 0
            while (tmp % i ==0L) {
                count++
                tmp = tmp / i
            }
            list += i.toLong()
        }
    }
    if (tmp != 1L) {
        list += tmp
    }
    if (list.isEmpty()) {
        list += n
    }
    return list.toList()
}

Measured memory_bytes: 37864
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){
	
	int a, b, c;
	int cnt1 = 0, cnt2 = 0;
	while(scanf("%d,%d,%d", &a, &b, &c) != EOF){
		if(a == b) cnt2++;
		else if(c * c == a * a + b * b) cnt1++;
	}

	cout << cnt1 << endl << cnt2 << endl;
	
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int ans(int n, int *c)
{
    int l = 0;
    int r = n - 1;
    int count = 0;
    while( l < r )
    {
        while(l < n && c[l] == 0) l++;
        while(r >= 0 && c[r] == 1) r--;
        if( l >= r ) return count;
        c[l] = 0;
        c[r] = 1; 
        count++;
    }
    return count;
}

int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    int *c = new int[n];
    rep(i, n) c[i] = (s[i] == 'W' ? 1 : 0);
    cout << ans(n, c);
    return 0;
}

Measured memory_bytes: 4504
use std::io::*;
use std::str::FromStr;
use std::iter::*;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let a: f64 = sc.read();
    let b: f64 = sc.read();
    let c: f64 = sc.read();
    let c = c / 180.0 * std::f64::consts::PI;
    let s = a*b*c.sin() / 2.0;
    let l = (a*a + b*b - 2.0*a*b*c.cos()).sqrt() + a + b;
    let h = s / a * 2.0;
    println!("{:.09}\n{:.09}\n{:.09}", s, l, h);
}



Measured memory_bytes: 5196
n, k = map(int, input().split())
if k%2 == 0:
	cnt = 1
	ans1 = 0
	ans2 = 0
	while cnt <= n:
		if cnt%k == 0:
			ans1 += 1
		if cnt%k == k//2:
			ans2 += 1
		cnt += 1
	print(ans1**3+ans2**3)
else:
	cnt = 1
	ans = 0
	while cnt <= n:
		if cnt%k == 0:
			ans += 1
		cnt += 1
	print(ans**3)
	


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t=1;
    //cin>>t;
    while(t--)
    {
        int d,t,s;
        cin>>d>>t>>s;
        if(t*s>=d)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    }

}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
using namespace std;
long N,K;
long long cnt;
int H[201010];
bool compare(int a,int b)
{
  return a>b;
}

int main(){
    cin>>N>>K;
    for(int i = 0;i<N;i++){
        cin>>H[i];
        cnt+=H[i];
    }
    sort(H,H+N,compare);
    for(int i=0;i<K;i++){
        cnt-=H[i];
    }
    cout<<cnt;
}

Measured memory_bytes: 4344
n = int(input())
a = list(map(int,input().split()))

print(' '.join(map(str,a)))
for i in range(1,n):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j -= 1
    a[j+1] = v
    ans = ' '.join(map(str,a))
    print(ans)



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

int main()
{
    int N, R;
    cin >> N >> R;
    if (N >= 10)
    {
        cout << R << endl;
    }
    else
    {
        cout << R + (100 * (10 - N)) << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

  string s;

  cin >> s;

  bool a1 = false;
  bool a2 = false;
  bool a3 = false;
  int tail = s.size();
  //cout << s[s.size() - 1] << endl;

  if (s[0] == 'A') a1 = true;

  int c_i;
  int count_c = 0;
  for (int i = 2; i < tail - 1; i++){
    if (s[i] == 'C'){
      count_c++;
      c_i = i;
    }
  }
  int count_s = 0;
  if (count_c == 1){
    for (int i = 1; i < tail; i++){
      if (s[i] >= 'a' && s[i] <= 'z') {
        count_s++;
      }
      //a3 = true;
    }
  }
  if (count_s == tail - 2) a3 = true;

  //cout << c_i << endl;

  if (a1 && a3){
    cout << "AC" << endl;
  }else{
    cout << "WA" << endl;
  }
  return 0;
}


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

d = 2

ans = 2

if x != 2:
  while d <= 1+x//2:
    if x%d == 0:
      x += 1
      d = 2
    else:
      if d == 1+x//2:
        ans = x
        break
      else:
        d += 1
  print(ans)
else:
  print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

double pi = 3.14159265358979324;

void solve(){
    double a, b; cin>>a>>b;
    double h, m; cin>>h>>m;
    int v = h*60+m;
    double hr = v / double(12*60);
    hr = hr*(2*pi);
    double a1 = a*sin(hr);
    double b1 = a*cos(hr);
    double mn = m / (double)60;
    mn = mn*(2*pi);
    double a2 = b*sin(mn);
    double b2 = b*cos(mn);
    double dist = (a1-a2)*(a1-a2)+(b1-b2)*(b1-b2);
    dist = sqrt(dist);
    cout<<fixed<<setprecision(15)<<dist;
}

signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 4112
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <vector>
#include <cmath>
#include <cstdint>

using namespace std;

int main() {
  int n;
  std::vector<int> a;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  for (int i = a.size() - 1; i > 0; --i) {
    cout << a[i] << " ";
  }
  cout << a[0] << endl;
}

Measured memory_bytes: 3120
n=int(input())
x=[]
y=[]
for i in range(n):
  a,b=map(int,input().split())
  x.append(a)
  y.append(b)

def fac(n):
  if n==0:
    return 1
  if n==1:
    return 1
  return n*fac(n-1)

ans=0
for i in range(n):
  for j in range(n):
    tmp=(((x[i]-x[j])**2+(y[i]-y[j])**2)**.5)
    ans+=tmp
   

print(ans/n)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

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

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
       Scanner input = new Scanner(System.in);
       ArrayList<Integer> out = new ArrayList<Integer>();
        for (int i = 0; i < 10; i++) {
            out.add(input.nextInt());
        }
        Collections.sort(out);
        System.out.println(out.get(out.size()-1));
        System.out.println(out.get(out.size()-2));
        System.out.println(out.get(out.size()-3));
    }
}

Measured memory_bytes: 17172
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>
//#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long int;
//// 任意長整数型
//namespace mp = boost::multiprecision;
//using Bint = mp::cpp_int;







int main(int argc, char *argv[])
{
	ll x, k, d;
	//input
	cin >> x >> k >> d;



	//calc
	ll ans = x;

	ll move_count = abs(x) / d;
	if (move_count < k){
		x = min(abs(x - d * move_count), abs(x + d * move_count));
		k -= move_count;
	}
	else{
		ans = abs(x) - d * k;
		//ans
		cout << ans << endl;
		
		return 0;
	}

	if (min(abs(x - d), abs(x + d)) < abs(x)){
		x = min(abs(x - d), abs(x + d));
		k--;
	}

	if (k % 2 == 0){
		ans = x;

		//ans
		cout << ans << endl;

		return 0;
	}
	else{
		ans = min(abs(x - d), abs(x + d));
		//ans
		cout << ans << endl;

		return 0;
	}


	return 0;
}


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

int a[500];
int main()
{
 int m, n, k, t;
 cin >> m;
 n=0;
 if(m==0)
 printf("0\n");


 while(m != 0){
 k = m % (-2);
 t = m / (-2);
 if(k < 0){
 k = k-(-2);
 t++;
 }
 m = t;
 a[n++]=k;
}
 for(int i=n-1;i>=0;i--){
 cout << a[i];
 }
 return 0;
}

Measured memory_bytes: 256
c1 = tuple(map(int,input().split()))
c2 = tuple(map(int,input().split()))
c3 = tuple(map(int,input().split()))

q = 0

adif = [c1[1]-c1[0],c1[2]-c1[1]]

bdif1 = int(c2[0]-c1[0])

bdif2 = int(c3[0]-c2[0])

acnt = 0

bdif = 0

if c2[1]-c2[0] != adif[0]:
    q = 1
    
if c2[2]-c2[1] != adif[1]:
    q = 1
    
if c3[1]-c3[0] != adif[0]:
    q = 1
    
if c3[2]-c3[1] != adif[1]:
    q = 1
    
if int(c2[1]-c1[1]) != bdif1:
    q = 1
    
if c2[2]-c1[2] != bdif1:
    q = 1
    
if c3[1]-c2[1] != bdif2:
    q = 1
    
if c3[2]-c2[2] != bdif2:
    q = 1
    
if q == 1:
    print("No")
else:
    print("Yes")
    
    

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

typedef long long ll;

const ll INTEG = pow(10,9) + 7;

vector<ll> fac(2001);
vector<ll> ifac(2001);

ll pow_mod(ll x, ll y){
  ll ans = 1;
  while(y != 0){
    if(y&1) ans = ans*x % INTEG;
    x = x*x % INTEG;
    y = y >> 1;
  }
  return ans;
}

ll combination(ll n, ll k){
  if(n < k) return 0;
  if(n < 2*k) k = n - k;
  if(k==0) return 1;

  ll res = 0;
  res = ifac[n-k] * ifac[k] % INTEG;
  res = res * fac[n] % INTEG;
  return res;
}

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

  ll res = 0;

  fac[0] = 1;
  ifac[0] = 1;
  for(ll i = 0; i < 2000; i++){
    fac[i+1] = fac[i] * (i+1) % INTEG;
    ifac[i+1] = ifac[i] * pow_mod(i+1, INTEG-2) % INTEG;
  }
  
  for(ll i = 1; i <= K; i++){
    ll bplace = i - 1;
    ll rplace = i;
    ll bball = K-i;
    ll rball = N-K-i+1;

    if(bplace < 0 || rplace < 0 || bball < 0 || rball < 0){
      cout << 0 << endl;
      continue;
    }
    res = combination(bplace + bball, bplace);
    res = (res * combination(rplace + rball, rplace)) % INTEG;

    cout << res << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a==b){
          System.out.println("Yes");
        }else{
          System.out.println("No");
        }
    }
}

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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
#define ll long long
using namespace std;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

ll bsearch_a(vector<ll> v, ll key) {
  int left = -1;
  int right = v.size();

  while(right - left > 1) {
    int mid = left + (right - left)/2;
    if (v[mid] >= key) right = mid;
    else left = mid;
  }
  return right;
}

ll bsearch_c(vector<ll> v, ll key) {
  int left = -1;
  int right = v.size();

  while(right - left > 1) {
    int mid = left + (right - left)/2;
    if (v[mid] > key) right = mid;
    else left = mid;
  }
  return right;
}

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

  int N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N);
  vector<ll> C(N);
  loop(0, N, i) cin >> A[i];
  loop(0, N, i) cin >> B[i];
  loop(0, N, i) cin >> C[i];
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());

  ll total = 0;
  loop(0, N, i) {
    ll bi = B[i];
    ll a = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
    ll c = C.end() - upper_bound(C.begin(), C.end(), B[i]);
    total += a * c;
  }
  print(total);
}


Measured memory_bytes: 5560
#include<iostream>
int main(){
    int a,b,c,d,e,f;
    std::cin>>a>>b>>c>>d>>e>>f;
    if(a+b*5+c*10+d*50+e*100+f*500>=1000){
        std::cout<<1<<std::endl;
    }else{
        std::cout<<0<<std::endl;
    }
    return 0;
}

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

int main()
{
    int t;
    cin >> t;
    int tle = 0;;
    int ac = 0;
    int wa = 0;
    int re = 0;
    while(t--)
    {
        string s;
        cin >> s;
        if(s == "TLE")
            tle++;
        else if(s == "AC")
            ac++;
        else if(s == "WA")
            wa++;
        else
            re++;
    }

    cout << "AC x " << ac <<'\n';
    cout << "WA x " << wa << '\n';
    cout << "TLE x " << tle << '\n';
    cout << "RE x " << re << '\n';
}


Measured memory_bytes: 3568
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=[(1+i)/2 for i in range(1,1001)]
l=[0,s[p[0]-1]]
for i in range(1,n):
    l.append(l[-1]+s[p[i]-1])
ans=0
for j in range(n-k+1):
    ans=max(ans,l[j+k]-l[j])
print(ans)

Measured memory_bytes: 25060
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
int main(){
    //条件セット
    int N;
    int K;
    std::cin >> N;
    std::cin >> K;

    std::vector<bool> p_have(N, false);

    for(int i=0;i<K;i++){
        int d;
        std::cin >> d;

        for(int j=0;j<d;j++){
            int idx;
            std::cin >> idx;
            p_have[idx-1] = true;
        }
    }

    //判定
    int count = 0;
    for(auto a: p_have){
        if(a){
            count++;
        }
    }

    std::cout << N-count << std::endl;
    //::system("pause");
}

Measured memory_bytes: 3572
#include<stdio.h>

int pasta[100], dp[101][4][4];

int main(){
  int n, i ,j ,k, l;
  scanf("%d%d", &n, &k);
  for(i = 0;i < k;i++){
    int ai, bi;
    scanf("%d%d", &ai, &bi);
    pasta[ai] = bi;
  }
  dp[0][0][0] = 1;
  for(i = 1;i <= n;i++){
    if(pasta[i] == 0){
      for(j = 1;j <= 3;j++){
	for(k = 0;k <= 3;k++){
	  for(l = 0;l <= 3;l++){
	    if(j == k && l == k)continue;
	    dp[i][j][k] += dp[i - 1][k][l];
	    dp[i][j][k] %= 10000;
	  }
	}
      } 
    }
    else{
      for(k = 0;k <= 3;k++){
	for(l = 0;l <= 3;l++){
	  if(pasta[i] == k && l == k)continue;
	  dp[i][pasta[i]][k] += dp[i - 1][k][l];
	  dp[i][pasta[i]][k] %= 10000;
	}
      }
    }
  }
  int ans = 0;
  for(i = 1;i <= 3;i++){
    for(j = 1;j <= 3;j++){
      ans += dp[n][i][j];
      ans %= 10000;
    }
  }
  printf("%d\n", ans);
  return 0;
}

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

int main(){
	int a, b;
	cin >> a >> b;
	if(a*b%2 == 0)
		cout << "Even" << endl;
	else
		cout << "Odd" << endl;
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    int n; cin >> n;
    ll ans = 0;
    vector<ll> a(n+1), b(n);
    for(int i = 0; i <= n; i++) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) {
        ans += min(a[i], b[i]);
        b[i] -= min(a[i], b[i]);
        ans += min(a[i + 1], b[i]);
        a[i + 1] -= min(a[i + 1], b[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			//long A = scan.nextLong();
			//double B = scan.nextDouble();
			BigDecimal s = scan.nextBigDecimal();//new BigDecimal(A);
			BigDecimal k = scan.nextBigDecimal();//new BigDecimal(B);
			BigDecimal C= s.multiply(k);
			
			
		
			
			
			/*
			long goukei = 0;
			int k = (int)(100.0*B);
			int a = k%10;//1
			k/=10;
			int b = k%10;//10
			k/=10;
			int c = k%10;//100
			
			
			
			goukei+=(long)c*A;
			long x = A*(long)b/10;
			long y = A*(long)a/100;
			
			goukei+=x+y;
			*/
			
	
			System.out.println(C.toBigInteger());
			//System.out.println();
			
			
			
			
			
			
		}
		
		
	}
		

}


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

using namespace std;

int main(){
        int w, a, b;
        cin>>w>>a>>b;
        if(a>b){
                swap(a, b);
        }
        int res=b-(a+w);
        if(res<0)
                res=0;
        cout<<res<<endl;
        return 0;
}


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

int N;
cin>>N;

bool hant = false;
for(int a=1; a<=9; a++){
  for(int b=1;b<=9; b++){
    if(N == a*b)hant = true;
  }
}
if(hant){
  cout<<"Yes"<<endl;
}
else{
  cout<<"No"<< endl;
}
return 0;
}


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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;

ll ans;
//ここから書き始める
int main()
{
	cout << setprecision(10);
	
	int a,b;
	cin >> a >> b;
	if(a>=10 || b>=10){
		cout << -1 << endl;
	}else cout << a * b << endl;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	int a, b,k;
	cin >> a >> b >> k;
	for (int i = 0; i < k; i++) {
		if (i % 2 == 0) {
			if (a % 2 == 1) {
				a = a - 1;
			}
			b = b + a / 2;
			a = a / 2;
		}
		else {
			if (b % 2 == 1) {
				b = b - 1;
			}
			a = a + b / 2;
			b = b / 2;
		}
	}
	cout << a << " " << b;
}

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

int main(){
    int H,W;
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0)break;
        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++ ){
                if(j == 0  || j == W-1 || i == 0 || i == H-1){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
     cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int r = sc.nextInt();
		int s = sc.nextInt();
		int p = sc.nextInt();
		sc.nextLine();
		char[] t = sc.nextLine().toCharArray();

		long answer = 0;
		for (int i = 0; i < k; i++) {
			for (int j = 0; i + (j * k) < t.length; j++) {
				int c = i + (j * k);
				int count = 1;
				while (i + ((j + 1) * k) < t.length && t[i + (j * k)] == t[i + ((j + 1) * k)]) {
					count++;
					j++;
				}

				if (t[c] == 'r') {
					// p score
					answer += ((count + 1) / 2) * p;
				} else if (t[c] == 's') {
					// r score
					answer += ((count + 1) / 2) * r;
				} else {
					// s score
					answer += ((count + 1) / 2) * s;
				}
			}
		}

		System.out.println(answer);
	}
}


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

using namespace std;

int main()
{
    int x = 0;
    cin >> x;

    int happy = 0;
    int num = x / 500;
    x -= num * 500;
    happy += num * 1000;
    
    num = x / 5;
    x -= num * 5;
    happy += num * 5;

    cout << happy << endl;

    return 0;
}

Measured memory_bytes: 256