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

/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

using namespace std;

typedef long long ll;

const int N_MAX = 200002;

int n, k;

int a[N_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = k + 1; i <= n; i++)
    {
        if(a[i] > a[i - k])
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}


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

const int max_N = 1e5 + 21;

using ll = long long;

int n,pos,tot,ans[max_N],a[max_N],L;

int main(){
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	for(int i=1;i<n;++i)
		if(a[i]+a[i+1]>=L){pos=i; break;}
	if(!pos)return puts("Impossible"),0;
	puts("Possible");
	for(int i=1;i<pos;++i)ans[++tot]=i;
	for(int i=n-1;i>=pos;--i)ans[++tot]=i;
	for(int i=1;i<=tot;++i)printf("%d\n",ans[i]);
	return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define vi vector<int>
#define bn(n) (n).begin(), (n).end()
#define FOR(n) for(int i = 0; i < (int)n; i++)
#define MX 1e5

const int mod = 1e9 + 7;

void solve() {
    vector<int> v(3,0);
    FOR(3){
        cin >> v[i];
    }
    sort(bn(v));
    cout << v[0]+v[1];
}

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

    int t = 1, i = 1;
    //cin >> t;
    while(t--) {
        //cout << "Case #" << i << ": ";
        solve();
        //i++;
    }
    return 0;
}


Measured memory_bytes: 3648
/*
    Problem 93
    https://atcoder.jp/contests/s8pc-3/tasks/s8pc_3_b
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 35;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
int H, W, K;
vector<vector<int>> pazzle(MAX, vector<int>(MAX));
vector<vector<int>> original(MAX, vector<int>(MAX));
/* function */
void input() {
    cin >> H >> W >> K;
    for (int i = 0; i < H; i++) {
        string S; cin >> S;
        for (int j = 0; j < W; j++) {
            original[i][j] = S[j] - '0';
        }
    }
}
void init() { pazzle = original; }
int deleteStone() {
    int ret = 0;
    for (int h = 0; h < H; h++) {
        for (int l = 0; l < W;) {
            int r = l + 1;
            for (; r < W && pazzle[h][l] == pazzle[h][r]; r++);
            if (r - l >= K) {
                ret += pazzle[h][l] * (r - l);
                for (; l < r; l++) pazzle[h][l] = 0;
            }
            l = r;
        }
    }
    return ret;
}
void moveStone() {
    for (int w = 0; w < W; w++) {
        vector<int> tmp(H, 0);
        int len = 0;
        for (int h = H-1; h >= 0; h--)
            if (pazzle[h][w] != 0) tmp[len++] = pazzle[h][w];
        for (int h = H-1; h >= 0; h--)
            pazzle[h][w] = tmp[H-1-h];
    }
}
int playGame(int h, int w) {
    // delete one block and move
    pazzle[h][w] = 0;
    moveStone();
    int totalScore = 0;
    for (int i = 1; ; i*=2 ) {
        int score = deleteStone();
        if (score == 0) break;
        totalScore += score * i;
        moveStone();
    }
    return totalScore;
}
void solve() {
    input();
    int maxScore = 0;
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            init();
            maxScore = max(maxScore, playGame(h, w));
        }
    }
    cout << maxScore << '\n';
}
/* main */
int main(){
    solve();
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

vll divisor(ll n) {
    vll ans;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ans.push_back(i);
            if (i*i != n) ans.push_back(n/i);
        }
    }
    sort(all(ans));
    return ans;
}

int main() {
    int n, X;
    cin >> n >> X;
    vint d(n);
    int x;
    int ans = 0;
    rep(i, n) {
        cin >> x;
        d[i] = abs(X - x);
    }
    if (n == 1) {
        cout << d[0] << endl;
        return 0; 
    }
    rep(i, n-1) {
        if (ans == 0) ans = gcd(d[i], d[i+1]);
        else ans = gcd(ans, d[i+1]);
    }
    cout << ans << endl;
    return 0;
}

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

int min(int a,int b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  char S[100000];
  scanf("%s", S);

  int N = strlen(S);
  int num[3] = {0, 0, 0};
  for (int i = 0; i < N; i++) {
    if(S[i] == 'a') num[0]++;
    else if(S[i] == 'b') num[1]++;
    else num[2]++;
  }

  int minimam = min(num[0], min(num[1], num[2]));
  num[0] -= minimam;
  num[1] -= minimam;
  num[2] -= minimam;

  if(num[0] > 1 || num[1] > 1 || num[2] > 1) printf("NO\n");
  else printf("YES\n");

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int a[4];
  string s;
  cin >> s;
  for(int i=0;i<4;i++){
    a[i]=s[i]-'0';
  }
  cout << a[0];
  if(a[0]+a[1]+a[2]+a[3]==7){
    cout << "+" << a[1] << "+" << a[2] << "+" << a[3];
  }else if(a[0]-a[1]+a[2]+a[3]==7){
    cout << "-" << a[1] << "+" << a[2] << "+" << a[3];
  }else if(a[0]+a[1]-a[2]+a[3]==7){
    cout << "+" << a[1] << "-" << a[2] << "+" << a[3];
  }else if(a[0]+a[1]+a[2]-a[3]==7){
    cout << "+" << a[1] << "+" << a[2] << "-" << a[3];
  }else if(a[0]-a[1]-a[2]+a[3]==7){
    cout << "-" << a[1] << "-" << a[2] << "+" << a[3];
  }else if(a[0]-a[1]+a[2]-a[3]==7){
   	cout << "-" << a[1] << "+" << a[2] << "-" << a[3];
  }else if(a[0]+a[1]-a[2]-a[3]==7){
   	cout << "+" << a[1] << "-" << a[2] << "-" << a[3];
  }else if(a[0]-a[1]-a[2]-a[3]==7){
   	cout << "-" << a[1] << "-" << a[2] << "-" << a[3];
  }
  cout << "=7" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
int main(void)
{
  char n[17];
  int max = 0;
  std::cin >> n;
  for(int i = 0; i < std::strlen(n); i++) max += (int)n[i] - '0';
  for(int i = 0; i < std::strlen(n); i++){
    if((int)n[i] - '0' > 0){
      int sum = (int)n[i] - '1';
      for(int j = i + 1; j < std::strlen(n); j++) sum += 9;
      max = std::max(max, sum);
    }
  }
  std::cout << max << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static long mod = (long) (1e9 + 7);
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long ans = power(10, n) - 2 * power(9, n) + power(8, n);
        ans = ((ans % mod) + mod) % mod;
        System.out.println(ans);
    }


    private static long power(long a, long b) {
        long x = 1, y = a;
        while (b > 0) {
            if (b % 2 != 0) {
                x = (x * y) % mod;
            }
            y = (y * y) % mod;
            b /= 2;
        }
        return x % mod;
    }
}

Measured memory_bytes: 35632
from sys import stdin
N = int(stdin.readline().rstrip())
ac, wa, tle, re = 0, 0, 0, 0

for i in range(0, N):
    a = stdin.readline().rstrip()
    if a == 'AC':
        ac += 1
    elif a == 'WA':
        wa += 1
    elif a == 'TLE':
        tle += 1
    elif a == 'RE':
        re += 1

print('AC x {}\nWA x {}\nTLE x {}\nRE x {}'.format(ac, wa, tle, re))


Measured memory_bytes: 9196
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
const int MAX_N = 1 << 19;

int n, dat[2 * MAX_N - 1];

void init(int n_) {
    n = 1;
    while(n < n_) n *= 2;
    rep(i, 2 * n - 1) dat[i] = 0;
}

// k番目の値(0-indexed)をaに変更
void update(int k, int a) {
    k += n - 1;
    dat[k] = a;
    while(k > 0) {
        k = (k - 1) / 2;
        dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}
// [a, b)の最小値を探す．
int query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return dat[k];
    else {
        int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return max(vl, vr);
    }
}

vector<int> v[300010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, M;
    cin >> H >> W >> M;
    init(W);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        v[a].push_back(b);
        int c = query(b, b + 1, 0, 0, n);
        update(b, c + 1);
    }
    int ans = 0;
    // rep(i, W) cout << query(i, i + 1, 0, 0, n) << " ";
    // cout << endl;
    rep(i, H) {
        for(auto& e: v[i]) {
            int c = query(e, e + 1, 0, 0, n);
            update(e, c - 1);
            //cout << e << " " << c - 1 << endl;
        }
        //rep(i, W) cout << query(i, i + 1, 0, 0, n) << " ";
        //cout << endl;
        //cout << "*" << query(1, 2, 0, 0, n) << " " << query(1, 2, 0, 0, n) << endl;
        //cout << query(0, W, 0, 0, n) << " " << (int)v[i].size() << endl;
        ans = max(ans, query(0, W, 0, 0, n) + (int)v[i].size());
        for(auto& e: v[i]) {
            int c = query(e, e + 1, 0, 0, n);
            update(e, c + 1);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 24116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mxn= 1e5+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    int n;
    cin>>n;
    int arr[n];
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum=sum+arr[i];
    }
    int q;
    cin>>q;
    while(q--){
        int pos, val;
        cin>>pos>>val;
        cout<<sum-arr[pos-1]+val<<endl;
    }
}

Measured memory_bytes: 3580
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        m: usize,
        k: [[usize]; m],
        p: [usize; m],
    }

    let mut cnt = 0;
    let mut status = true;
    for bit in 0usize..1 << n{
        for i in 0..m {
            status = true;
            let mut acc = 0;
            for j in 0..k[i].len() {
                if bit & (1 << k[i][j]-1) != 0 {
                    acc += 1
                }
            }
            if acc % 2 != p[i] {
                status = false;
                break
            }
        }
        if status == true {
            cnt += 1;
        }
        //break
    }
    println!("{}", cnt);
}


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

int main(){
	int N, K;
	long long ans = 0;
	cin >> N >> K;
	if(!K){
		cout << (long long int)N*N << endl;
		return 0;
	}
	for(int i=K+1; i<=N; i++){
		int a = N/i;
		int b = (K+i-1)/i;
		ans += (i - K)*(a - b);
		a = a*i;
		b = b*i;
		ans += i - K;
		if(N % i >= K){
			ans += (N%i) - K + 1;
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

    for (int i = 0; i < n; i++)
    {
        cin >> d[i];
    }

    sort(d.begin(),d.end());

    int i,ans = 1;
    for (i = 0; i < n - 1; i++)
    {
        if(d[i] != d[i + 1])ans++;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    N, A, B = [int(x) for x in input().strip().split()]
    if N == 1 and A != B:
        print(0)
        return
    elif A > B:
        print(0)
        return
    print((B * (N - 1) + A) - (B + A * (N - 1)) + 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrrr
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Console.WriteLine(input[0] + input[1] + input[2] - input.Max());
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    
    string s;
    cin >> s;

    rep(i, s.size()){
        cout << "x";
    }
    





}





//              g++ -std=c++1z

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
    // 配列の最大値を取得
    int max = *max_element(vec.begin(), vec.end());
    // 配列の最大値のイテレータを取得
    vector<int>::iterator maxIt = max_element(vec.begin(), vec.end());
    // 配列の最大値までの距離を取得
    int maxIndex = distance(vec.begin(), maxIt);
*/

int main () {
    int N; cin >> N;
    int T, A; cin >> T >> A;
    vector<int> H(N);
    for (int i=0; i<N; ++i) cin >> H[i];

    vector<double> temp;
    for (int i=0; i<N; ++i) {
        double t = T - H[i] * 0.006;
        temp.push_back((abs(t - A)));
    }

    vector<double>::iterator minIt = min_element(temp.begin(), temp.end());
    cout << distance(temp.begin(), minIt) + 1 << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int ans = pow(n,3);

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n; cin>>n;
    map<int,int> map;
    for(int i=2;i<=n;i++){
        int t=i;
        for(int j=2;j*j<=t;j++){
            while(t%j==0){
                map[j]++;
                t/=j;
            }
        }
        if(t!=1)map[t]++;
    }
    ll ans=1;
    for(auto i:map){
        ans=(ans*(i.second+1))%MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

public class Main {
    static int m = (int) Math.pow(5.0, 11.0);
    static int[] T;

    static long h1(long i) {
        return i % m;
    }

    static long h2(long i) {
        return 1 + i % (m-1);
    }

    static long h(long i, long call) {
        long key = h1(i) + call * h2(i);
        if (T[(int)key] != -1) {
            return h(i, call + 1);
        } else {
            return key;
        }
    }

    public static void main(String[] args) {
        T = new int[m];
        for (int i = 0; i < m; i++) {
            T[i] = -1;
        }
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        for (int i = 0; i < n; i++) {
            String op = s.next();

            String acgt = s.next();
            long num = str2int(acgt);

            if (op.equals("insert")) {
                long key = h(num, (long)0);
                T[(int)key] = (int)num;
            }
            if (op.equals("find")) {
                if (find(num, (long)0) != -1) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
            }
        }
    }

    static long find(long i, long call) {
        long key = h1(i) + call * h2(i);
            if (i >= m || T[(int)key] == -1) {
                return -1;
            } else if (T[(int)key] == i) {
                return i;
            } else {
                return find(i, call + 1);
            }
    }

    static long str2int(String str) {
        char[] chars = str.toCharArray();
        int digits = chars.length;

        long p = 1;
        long is = 0;
        for (int i = 0; i < digits; i++) {
            is += p * char2int(chars[i]);
            p *= 5;
        }

        return is;
    }

    static int char2int(char c) {
        int i = 0;
        switch (c) {
            case 'A': {
                i = 1;
                break;
            }
            case 'C': {
                i = 2;
                break;
            }
            case 'G': {
                i = 3;
                break;
            }
            case 'T': {
                i = 4;
                break;
            }
        }
        return i;
    }
}



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

int main(void){

	char x[1001];
	int sum;
	int i;

	while(scanf("%s",x)!=EOF){

		if(x[0] == '0' && x[1] == '\0')
			break;

		sum = 0;

		for(i=0;i<strlen(x);i++){
			sum += x[i]%'0';//数値変換
		}

		printf("%d\n",sum);

	}

	return 0;

}



Measured memory_bytes: 2084
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll v[205];
ll x[20000005];
ll a[10000005];
ll dp[10005][10005];
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
typedef pair<ll, ll> P;


double q[200005];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	ll count = 0;
	ll odd = 0;
	ll count2 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] % 4 == 0) {
			count++;
		}
		if (a[i]%2==1) {
			odd++;
		}
		if (a[i]%2 == 0&&a[i]%4!=0) {
			count2++;
		}
	}
	if (count2 > 0) {
		
			if (count >= odd ) {
				cout << "Yes" << endl;
				return 0;
			}
		
		
	}
	else {
		if (count>=odd-1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 200000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	int n;
    IN(n);
    int ans=0;
    for(int i=1;i<=n;i++){
        string s=to_string(i);
        if(SZ(s)%2!=0)ans++;
    }
    OUT(ans);
    
	return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
# 約数列挙
def find_divisor(n):
    divisors=[]
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            divisors.append(i)
            if i*i!=n:
                divisors.append(n // i)
    return divisors

def main():
    N,M=MI()
    ans = 0
    for d in find_divisor(M):
        if N<=M//d:
            ans = max(ans,d)
    print(ans)
    
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 64236
s = input()
sd = {}
for i in range(4):
    if not s[i] in sd.keys():
        sd[s[i]] = 1
    else:
        sd[s[i]] += 1

if len(sd) != 2:
    print('No')
elif sd[s[0]] == sd[s[1]] == sd[s[2]] == sd[s[3]] == 2:
    print('Yes')

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,29)-1;


int main() {
  int r; cin >> r;
  int result = 3*r*r;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int d;
	long long int g;
	cin >> d >> g;
	int p[11], c[11];
	for(int i = 0; i < d; i++){
		cin >> p[i] >> c[i];
	}
	int ans = mod;
	for(int i = 0; i < (1 << d); i++){
		int score = 0;
		int num = 0;
		for(int j = 0; j < d; j++){
			if((i & (1 << j)) == 0) continue;
			score += p[j] * 100 * (j + 1) + c[j];
			num += p[j];
		}
		if(score >= g){
			ans = min(ans, num);
			continue;
		}
		int resscore = g - score;
		for(int j = d - 1; j >= 0; j--){
			if((i & (1 << j)) > 0) continue;
			int tmpnum = resscore / (100 * (j + 1));
			if(resscore % (100 * (j + 1)) != 0) tmpnum++;
			tmpnum = min(tmpnum, p[j]);
			int tmpsscore = tmpnum * 100 * (j + 1);
			if(tmpnum == p[j]) tmpsscore += c[j];
			num += tmpnum;
			resscore -= tmpsscore;
			if(resscore <= 0){
				ans = min(ans, num);
				break;
			}
		}
	}
	cout << ans << endl;
}


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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define F first
#define S second
#define loop(z, v) for(auto &z: v)
#define nl "\n"
#define fat 1000000007

int main()
{
    boost
    ll x;
    cin >> x;

    ll p500 = (x / 500);
    x = x%500;
    ll p5 = (x / 5);
    
    cout << p500*1000 + p5*5 << nl;

    return 0;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = max(N-K*2,0LL);

  // bool ok = false;

  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}









Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define pll pair<ll,ll>
#define vll vector<pll>
#define vl vector<ll>
#define f first
#define s second
#define N 50000
#define pb push_back
#define mp make_pair
#define MAP map<ll,ll>
#define INF 1000000000
#define mod 1000000007
#define foo(i,a,b) for(ll i=(a);i<=(b);i++)
#define rep(i,a,b) for(ll i=(a);i>=(b);i--)
#define sl set<ll> 
#define sll set<pll>
#define ub upper_bound
#define lb lower_bound
using namespace std;
ll a[100000],dp[100000];
int main(){
	fastio;
	ll n,k;
	cin>>n>>k;
	foo(i,0,n-1) cin>>a[i];
	dp[0]=0;
	//dp[1]=abs(a[1]-a[0]);
	foo(i,1,n-1){
		dp[i]=INF;
		foo(j,1,k){
			if(i-j>=0)
			dp[i]=min(dp[i-j]+abs(a[i-j]-a[i]),dp[i]);
			else
				break;
		}
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
int n , l ;
cin>>n>>l;
int A[n+1];
for(int i=1 ; i<=n ; i++) cin>>A[i];
bool flag = 0;
int pos = 0;
for(int i=1 ; i<n ; i++){
    if(A[i]+A[i+1]>=l){
        flag = 1;
        pos = i;
        break;
    }
}


if(flag == 0){
    cout<<"Impossible"<<endl;
    return 0;
}
else{
    cout<<"Possible"<<endl;

for(int i=1 ; i<pos ; i++){
    cout<<i<<endl;
}

for(int i=n-1 ; i>=pos ; i--)
    cout<<i<<endl;
}
}


Measured memory_bytes: 4008
from collections import deque
n,m = map(int,input().split())

maze = [list(input()) for _ in range(n)]

def bfs():
    dx = (1, 0, -1, 0)
    dy = (0, 1, 0, -1)
    d = [([-1]*m)for _ in range(n)]
    q = deque([])
    for i in range(n):
        for j in range(m):
            if maze[i][j] == "#":
                d[i][j] = 0
                q.append((i,j))
    a = 0

    while q:
        x,y = q.popleft()
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0<= nx < n and 0<= ny < m and maze[nx][ny] != '#' and d[nx][ny] == -1:
                q.append((nx,ny))
                d[nx][ny] = d[x][y] +1
                a = max(a,d[nx][ny])
    return a

print(bfs())

Measured memory_bytes: 121436
#include <iostream>
#include <ctype.h>
#include <string>
using namespace std;

int main()
{
  char arr[3];
  int i;
  int count = 1;
  for(i=0; i<3; i++)
    cin>>arr[i];
  for(i=0; i<3; i++)
  {
    if(arr[i] == arr[i+1])
    {
      count++;
    }
  }
  if(count==3)
    cout<<"No"<<"\n";
  else
    cout<<"Yes"<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int i = 0; i < n; ++i) cin >> a[i];
sort(a.begin(), a.end());
long long sum = 0;
int ans = 0;
while (ans < n && sum <= x) sum += a[ans++];
if (ans == n && sum == x) printf("%d\n", n);
else printf("%d\n", ans - 1);
}


Measured memory_bytes: 256
#include <stdio.h>

#define PRINT_MISSING_CARDS(SUIT)               \
    for (int i = 0; i < 13; i++)                \
        if (!SUIT[i])                           \
            printf(#SUIT " %d\n", i+1);

int main()
{
    bool S[13] = {}, H[13] = {}, C[13] = {}, D[13] = {};
    int n;

    scanf("%d\n", &n);

    for (int i = 0; i < n; i++) {
        char suit;
        int rank;

        scanf("%c %d\n", &suit, &rank);
        switch (suit) {
        case 'S': S[rank-1] = true; break;
        case 'H': H[rank-1] = true; break;
        case 'C': C[rank-1] = true; break;
        case 'D': D[rank-1] = true; break;
        }
    }

    PRINT_MISSING_CARDS(S);
    PRINT_MISSING_CARDS(H);
    PRINT_MISSING_CARDS(C);
    PRINT_MISSING_CARDS(D);
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
int n,a[100];
long long ans=0;

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<n;i++)
	for(int j=i+1;j<=n;j++) ans+=a[i]*a[j];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let r: f64 = read_line()[0];
    let pi: f64 = 3.14159265359;
    println!("{}", 2. * pi * r);
}


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


def solve(N: int, A: int, B: int, X: "List[int]"):
    return sum(min(A*(a1-a0), B) for a0, a1 in zip(X, X[1:]))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A, B, X))

def test():
    import doctest
    doctest.testmod()

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


Measured memory_bytes: 21940
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] strs = sc.nextLine().split(" ");
        double[] n = new double[4];
        for (int i = 0; i < 4; i++) {
            n[i] = Double.parseDouble(strs[i]);
        }
        System.out.println(Math.sqrt(Math.pow(n[0] - n[2], 2) + Math.pow(n[1] - n[3], 2)));
    }
}

Measured memory_bytes: 26284
object Main extends App {
  val Array(n, m) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  var min = 1
  var max = n
  (1 to m).foreach { _ =>
    val Array(l, r) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
    min = List(min, l).max
    max = List(max, r).min
  }

  if (max >= min) {
    println(max - min + 1)
  } else {
    println(0)
  }
}

Measured memory_bytes: 67172
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main() {
	int n, ans = 0;
	cin >> n;
	if (n < 4) cout << "No" << endl;
	else {
		if (n % 4 == 0 || n % 7 == 0) cout << "Yes" << endl;
		else {
			while (n >= 11) {
				n -= 11;
				if (n % 4 == 0 || n % 7 == 0) {
					cout << "Yes" << endl;
					return 0;
				}
			}
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n, m, l;

    scanf("%d %d %d", &n, &m, &l);

    int A[100][100] = {0};
    int B[100][100] = {0};
    long long C[100][100] = {0};

    int i, j, k;

    for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            scanf("%d", &A[i][j]); //A[n][m]の要素を読み込む
        }
    }

    for (i = 0; i < m; i++)
    {
        for (j = 0; j < l; j++)
        {
            scanf("%d", &B[i][j]); //B[m][l]の要素を読み込む
        }
    }

    for (i = 0; i < n; i++)
    {
        for (j = 0; j < l; j++)
        {
            for (k = 0; k < m; k++)
            {
                C[i][j] += A[i][k] * B[k][j]; //A[n][m]*B[m][l]の積をC[n][l]に格納
            }
        }
    }

    for (i = 0; i < n; i++)
    {
        for (j = 0; j < l; j++)
        {
            if (j == l - 1)
            {
                printf("%lld", C[i][j]);
            }
            else
            {
                printf("%lld ", C[i][j]);
            }
        }
        putchar('\n');
    }

    return 0;
}



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

int main() {
  int x, y, cnt = 0;
  cin >> x >> y;
  for (int i = 0; i <= x; i++){
    int z;
    z = (x - i) * 2 + i * 4;
    if(z == y) cnt++;
  }
  if (cnt > 0) cout << "Yes";
  else cout << "No" ;
}
  

Measured memory_bytes: 3632
n = int(input())
house = [[[0 for r in range(10)]for f in range(3)]for b in range(4)]
for i in range(n):
  b,f,r,v = map(int,input().split())
  house[b-1][f-1][r-1]+=v

for b in range(4):
  for f in house[b]:
    print("",*f)
  if b != 3:
    print("#"*20)


Measured memory_bytes: 5620
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

import sys
sys.setrecursionlimit(4100000)
rl = sys.stdin.readline

N = input()

if N[-1] in ['2','4','5','7','9']:
    print('hon')
elif N[-1] in ['0','1','6','8']:
    print('pon')
elif N[-1] in ['3']:
    print('bon')

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007

signed main()
{
	init();
	solve();
}

int a, b, x, y;

void init()
{
	int n, k;
	cin >> n >> k >> x >> y;
	if (k > n) k = n;
	a = k;
	b = n - k;
}

void solve()
{
	cout << a * x + b * y << endl;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

int n, ave = 0;
int a[110];

int main() {

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		ave += a[i];
	}
	ave /= n;

	int d, ans, min = 2147483647;
	for (int i = ave - 10; i <= ave + 10; ++i) {
		d = 0;
		for (int j = 0; j < n; ++j)
			d += (a[j] - i) * (a[j] - i);

		if (d < min)
			min = d;
	}

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <queue>
#include <cstring>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLl(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE 1000000007
#define MAXN 100005

using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


int main(){
    int n;
    cin >>n;
    int k = n%100;
    int t = n/100;
    if(k == 0 && t == 0){
        cout <<"NA";
        return 0;
    }
    if(t== 0 && k <=12){
        cout<<"YYMM";
        return 0;
    }
    if(t== 0 && k >12){
        cout<<"NA";
        return 0;
    }
    if(k==0 && t <=12){
        cout<<"MMYY";
        return 0;
    }
    if(k==0 && t >12){
        cout<<"NA";
        return 0;
    }
    if(k <= 12 && t <=12){
        cout<<"AMBIGUOUS";
    }else if(k > 12 && t > 12){
        cout  << "NA";
    }else if( k > 12 && t <=12 ){
        cout<<"MMYY";
    }else if(k <= 12 && t>12){
        cout <<"YYMM";
    }

    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
l=[]
for i in range(k):
    d=int(input())
    x=[int(w) for w in input().split()]
    for j in range(len(x)):
        if x[j] not in l:
            l.append(x[j])
    
s=[i for i in range(1,n+1)]
ans=0
for i in s:
    if i not in l:
        ans+=1
print(ans)

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 30;

int main() {
  int ans = 0;
  vector<int> tmp;
  rep (i, 5) {
    int x;
    cin >> x;
    ans += x - x % 10;
    if (x % 10) tmp.eb(x % 10);
  }

  sort(all(tmp));

  rep (i, sz(tmp)) {
    if (i == 0) ans += tmp[i];
    else ans += 10;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
using System;

namespace abc164_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b,c,d,k=1;
            bool Takahashi = false;
            string[] token = Console.ReadLine().Split();
            a = Convert.ToInt32(token[0]);
            b = Convert.ToInt32(token[1]);
            c = Convert.ToInt32(token[2]);
            d = Convert.ToInt32(token[3]);
            while (true)
            {
                if (k % 2 != 0)
                {
                    c -= b;
                }
                else
                {
                    a -= d;
                }
                if (a <= 0)
                {
                    break;
                }
                if (c <= 0)
                {
                    Takahashi = true;
                    break;
                }
                k++;
            }
            if (Takahashi)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 17948
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[100010][4] = {};
signed main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S; cin >> S;
	dp[100010][3] = 1;
	for (int i = S.length(); i >= 0; i--) {
		for (int j = 3; j >= 0; j--) {
			if (i == S.length()) {
				if (j == 3) dp[i][j] = 1;
				else dp[i][j] = 0;
			}
			else {
				if (S[i] == '?') dp[i][j] = dp[i + 1][j] * 3;
				else dp[i][j] = dp[i + 1][j];
				if (j < 3 && (S[i] == '?' || S[i] == "ABC"[j])) {
					dp[i][j] += dp[i + 1][j + 1];
				}
				dp[i][j] %= mod;
			}
		}
	}
	//for (int i = S.length(); i >= 0; i--) {
	//	for (int j = 3; j >= 0; j--) {
	//		cout << dp[i][j] << " ";
	//	}
	//	cout << endl;
	//}
	cout << dp[0][0] << endl;

    return 0;
}


Measured memory_bytes: 3664
# coding: utf-8
# Your code here!#
#N,W = list(map(int,input().split()))
#w = [i for i in range(N)]


A , B, C, K = list(map(int,input().split()))
if K<=A:
    print(K)
elif K<=B:
    print(A)
else:
    print(A-(K-(A+B)))

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

int main(){
  int n,m,x; cin >> n >> m >> x;
  vector<int> a(m); rep(i,m) cin >> a[i];
  vector<int> cost(n+2, 0); rep(i,m) cost[a[i]]++;

  int tmp_x = x;
  int ans = 0, tmp_ans = 0;
  while(tmp_x != 0){
    tmp_ans += cost[tmp_x];
    tmp_x--;
  }
  ans = tmp_ans;
  tmp_x = x;
  tmp_ans = 0;
  while(tmp_x != n){
    tmp_ans += cost[tmp_x];
    tmp_x++;
  }
  ans = min(ans, tmp_ans);

  cout << ans << endl;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

int n;
double dp[302][302][302];

double rec(int i, int j, int k)
{
    if (i == 0 && j == 0 && k == 0) return 0.0;
    if (dp[i][j][k] != 0.0) return dp[i][j][k];

    double res = (double)n / (i + j + k);
    if (i > 0) res += rec(i - 1, j, k) * i / (i + j + k);
    if (j > 0) res += rec(i + 1, j - 1, k) * j / (i + j + k);
    if (k > 0) res += rec(i, j + 1, k - 1) * k / (i + j + k);
    return dp[i][j][k] = res;
}

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

    cin >> n;
    int ni = 0, nj = 0, nk = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a == 1) ni++;
        if (a == 2) nj++;
        if (a == 3) nk++;
    }

    cout << rec(ni, nj, nk) << endl;
    return 0;
}

Measured memory_bytes: 215296
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int r = Integer.valueOf(arr01[0]);

        System.out.println(r * 2 * Math.PI);

    }

}


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

int adja[101][101], dist[101];

void bfs() {
    int que[100], l = 0, d = 1;
    que[0] = 1;l++;
    while (l > 0) {
        int temp[100], m = 0;
        for (int i = 0; i < l; ++i) {
            int u = que[i];
            if (0 < dist[u] && dist[u] <= d)
                continue;
            dist[u] = d;
            for (int j = 0, v; (v = adja[u][j]) > 0; j++) {
                temp[m++] = v;
            }
        }
        memcpy(que, temp, sizeof(int) * m);
        l = m;
        d++;
    }
}

int main() {
    int n, k, u;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &u, &k);
        for (int j = 0; j < k; ++j) {
            scanf("%d", &adja[u][j]);
        }
    }
    bfs();
    for (int i = 1; i <= n; ++i) {
        printf("%d %d\n", i, --dist[i]);
    }

    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const int inf = pow(2, 31) - 1;
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n) {
        rep(i,n)par[i] = i;
    }

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

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if(rx == ry)return;
        par[rx] = ry;
    }

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

int main(){
    int n, q;
    cin >> n >> q;
    
    UnionFind tree(n);
    rep(i,q){
        int com, x, y;
        cin >> com >> x >> y;
        if(com == 0) tree.unite(x, y);
        else cout << tree.same(x, y) << endl;
    }
    return 0;
}


Measured memory_bytes: 3160
from collections import defaultdict

n, m = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))
abm = [None] * m

d = defaultdict(list)
for i in range(m):
    v = list(map(int, input().split(' ')))
    d[v[0]].append(v[1])
    d[v[1]].append(v[0])
    

count = 0

for i in range(1, n + 1):
    cand = d.get(i)
    if cand is None:
        count += 1
        continue
    ok = True
    for c in cand:
        if hn[i - 1] <= hn[c - 1]:
            ok = False
            break
    if ok:
        count += 1
print(count)


Measured memory_bytes: 99312