akhauriyash/Code-Regression huggingface dataset:
using System;

namespace B___Echo
{
    class Program
    {
        static void Main (string[] args)
        {
            var n = int.Parse (Console.ReadLine ());
            var s = Console.ReadLine ();
            if (n % 2 == 1)
            {
                Console.WriteLine ("No");
            }
            else
            {
                for (var i = 0; i < n / 2; i++)
                {
                    if (s[i] != s[n / 2 + i])
                    {
                        Console.WriteLine ("No");
                        return;
                    }
                }
                Console.WriteLine ("Yes");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int n,x,a[200005];
int main(){
	scanf("%d%d",&n,&x);
	if (x==1||x==2*n-1){
		puts("No");
		return 0;
	}
	puts("Yes");
    for (int i=0;i<2*n-1;i++)a[i]=i+1;
    swap(a[x-1],a[n-1]);
    swap(a[0],a[n-2]);
    swap(a[2*n-2],a[n]);
    for (int i=0;i<2*n-1;i++)printf("%d\n",a[i]);
}

Measured memory_bytes: 2304
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const int MAXN = -1; 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!
    int N;
    cin >> N;
    vector<int> pos(N+1);
    for (int i = 1; i <= N; i++) {
        int x;
        cin >> x;
        pos[x] = i;
    }
    vector<int> rott = {0};
    for (int i = 1; i <= N-1; i++) if (pos[i] > pos[i+1]) rott.push_back(i);
    rott.push_back(N);
    int diff = 0;
    for (int i = 0; i < -1+(int)rott.size(); i++) {
        diff = max(diff, rott[i+1]-rott[i]);
    }
    cout << N-diff << "\n";
}



Measured memory_bytes: 2168
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;

#define A first
#define B second

typedef long long ll;
constexpr int MOD = 1000000007;

void solve() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cnt = 0;
  for(int i = 0; i < N; i++){
    if(S[i] == 'R') cnt++;
  }
  int ans = cnt;
  for(int i = 0; i < cnt; i++){
    if(S[i] == 'R') ans--;
  }
  cout << ans;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  T = 1;
  //cin >> T;
  while(T--){
    solve();
  }
}

Measured memory_bytes: 3716
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define int long long

using namespace std;

int a[123456];
int vis[123456];

signed main()
{
    int flag=0;
    int n,c,k;
    scanf("%lld %lld %lld",&n,&c,&k);
    for(int i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }
    sort(a,a+n);
    int sum=0;
    for(int i=0; i<n; i++)
    {
        int f=a[i]+k;
        int h=0;
        while(i<n)
        {
            if(a[i]<=f)
            {
                vis[i]=1;
                h++;
            }
            if(h==c)
            {
                if(i==n-1)
                    flag=1;
                sum++;
                break;
            }
            if(a[i] > f)
            {
                i--;
                sum++;
                break;
            }
            i++;
        }
    }
    if(flag==0) sum++;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1792
# ABC073D - joisino's travel
from itertools import permutations
from scipy.sparse.csgraph import dijkstra


def main():
    N, M, R, *RABC = map(int, open(0).read().split())
    visit, ABC = RABC[:R], RABC[R:]
    G = [[float("inf")] * (N + 1) for _ in range(N + 1)]
    for v, u, c in zip(*[iter(ABC)] * 3):
        G[v][u] = G[u][v] = c
    dist = [None] * (N + 1)
    for i in range(1, N + 1):
        dist[i] = dijkstra(G, directed=0, indices=i)
    ans = float("inf")
    for perm in permutations(visit):
        cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))
        ans = min(ans, cur)
    print(int(ans))


if __name__ == "__main__":
    main()

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

#define MAX 9

void print_table( int table[MAX][MAX], int table1[MAX][MAX] )
{
	for ( int i = 0 ; i < MAX ; i++ ) {
		for ( int j = 0 ; j < MAX ; j++ ) {
			printf( "%c%d", table1[i][j], table[i][j] );
		}
		printf( "\n" );
	}
}

int main()
{
	int n, tmp, dbl = 0;
	int table[MAX][MAX];
	int table1[MAX][MAX];

	scanf( "%d", &n );
	for ( int i = 0 ; i < n ; i++ ) {
		for ( int j = 0 ; j < MAX ; j++ ) {
			for ( int k = 0 ; k < MAX ; k++ ) {
				scanf( "%d", &table[j][k] );
			}
		}
		memset( table1, ' ', sizeof( table1 ) );
		
		for ( int j = 0 ; j < MAX ; j++ ) {
			for ( int k = 0 ; k < MAX ; k++ ) {
				tmp = table[j][k];

				/* 3x3で区切らない範囲で重複する数字がある場合 */
				// y軸方向に重複する数値の探索
				for ( int l = k+1 ; l < MAX ; l++ ) {
					if ( table[j][k] == table[j][l] ) {
						table1[j][k] = table1[j][l] = '*';
					}
				}

				// x軸方向に重複する数値の探索
				for ( int l = j+1 ; l < MAX  ; l++ ) {
					if ( table[j][k] == table[l][k] ) {
						table1[j][k] = table1[l][k] = '*';
					}
				}


				// 3x3の範囲で重複する文字列の探索
				for ( int l = j/3*3 ; l < j/3*3+3 ; l++ ) {
					for ( int m = k/3*3 ; m < k/3*3+3 ; m++ ) {
						if ( l == j && m == k ) { continue; }
						else if ( tmp == table[l][m] ) {
							table1[l][m] = '*';
						}
					}
				}
			}
		}
		print_table( table, table1 );
		if ( i != n-1 ) {
			printf( "\n" );
		}
	}

}



Measured memory_bytes: 2016
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int a[3][3];
    rep(i, 3) {
        rep(j, 3) {
            cin >> a[i][j];
        }
    }

    int n;
    cin >> n;
    rep(i, n) {
        int b;
        cin >> b;
        rep(i, 3) {
            rep(j, 3) {
                if(a[i][j] == b) a[i][j] = 0;
            }
        }
    }

    bool ok = false;
    rep(i, 3) {
        bool tate = true;
        bool yoko = true;
        rep(j, 3) {
            if(a[i][j] != 0) yoko = false;
            if(a[j][i] != 0) tate = false;
        }
        if(tate || yoko) ok = true;
    }

    bool naname1 = true, naname2 = true;
    rep(i, 3) {
        if(a[i][i]!=0) naname1 = false;
        if(a[i][2-i]!=0) naname2 = false;
    }
    if(naname1 || naname2) ok = true;

    Yn(ok);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] h = new int[n];
    for(int i = 0;i<n;i++){
      h[i] = sc.nextInt();
    }

    int count = 0;
    int start = 0;
    while(start < n){
      if(h[start]==0){
        start++;
        continue;
      }
      count++;
      h[start]--;
      for(int i = start+1;i<n;i++){
        if(h[i]==0){
          break;
        }
        h[i]--;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 36028
n = gets.to_i
array = gets.chomp.split.map(&:to_i)
puts array.join(' ')

(1...n).each do |i|
  key = array[i]
  j = i - 1
  while j >= 0 && array[j] > key do
    array[j + 1] = array[j]
    j -= 1
  end
  array[j + 1] = key
  puts array.join(' ')
end


Measured memory_bytes: 6896
// ALDS1_6_B
#include <iostream>
#include <vector>
using namespace std;

void swap(int &a, int &b){
	int temp = a;
	a = b;
	b = temp;
}

int partition(vector<int> &A, int p, int r){
	int x = A[r], i = p-1;

	for(int j=p;j<r;j++){
		if(A[j] <= x){
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[i+1], A[r]);

	return i+1;
}

int main(){
	int n, num;
	vector<int> A;

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

	num = partition(A, 0, n-1);
	for(int i=0;i<n;i++){
		if(i != 0)
			cout<<" ";

		if(i != num)
			cout<<A[i];
		else
			cout<<"["<<A[i]<<"]";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 1672
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef int_fast64_t ll;
typedef int_fast64_t intt;
typedef int_fast64_t tmp_m;
#define deb(x) cout << #x << ' ' << x << endl
#define rep(i, a, b) for (tmp_m i = a; i < b; ++i)
#define repp(i, a, b) for (tmp_m i = a; i >= b; --i)
#define pb push_back
#define st stack
#define pa pair
#define vc vector
#define qu queue
#define pq priority_queue
#define fr first
#define sc second
#define mp map
const intt mod = 1e9 + 7;

struct pr {
  intt x;
  intt y;
  intt dst;
  pr() {}
  pr(intt x, intt y, intt dst) : x(x), y(y), dst(dst) {}
  inline bool operator<(const pr& b) const {
    if (dst != b.dst) return dst > b.dst;
    if (x != b.x) return x > b.x;
    return y > b.y;
  }
};

struct point {
  intt x;
  intt y;
  point() {}
  point(intt x, intt y) : x(x), y(y) {}
  inline bool operator<(const point& b) const {
    if (x != b.x) return x > b.x;
    return y > b.y;
  }
};

inline bool spoint(point a, point b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}

inline bool spr(pr a, pr b) {
  if (a.dst != b.dst) return a.dst < b.dst;
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}



void solve() {
  intt n;
  cin >> n;
  intt ans = 0;
  rep(i, 1,  n + 1){
    if((i % 3) && (i % 5)){
      ans += i;
    }
  }
  cout << ans << endl;
}

int main() {
  // remove if interactive
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}


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

int main() {
  int origin, n;
  cin >> origin;
  n = origin;
  int fx = 0;
  for (; n > 0; n /= 10) {
    fx += n % 10;
  }
  if (origin % fx == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
typedef long long ll;
const int mod = 1e9 + 7;
int main() {

    int n;
    cin >> n;

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

    int ans = 0;
    int idx = 0;
    rep(i, n){
        while(a[i] % 2 == 0){
            ans++;
            a[i] /= 2;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int N100 = N / 100;
		int N1 = N % 10;
		int N10 =( N - (N100 * 100 + N1) )/ 10;
		System.out.println(N100 == 7 || N10 == 7 || N1 == 7 ? "Yes" : "No");
	}

}

Measured memory_bytes: 35548
class segment_tree:
    def __init__(self, N, operator_M, e_M):
        self.op_M = operator_M
        self.e_M = e_M
        
        self.N0 = 1<<(N-1).bit_length()
        self.dat = [self.e_M]*(2*self.N0)
    
    # 長さNの配列 initial で初期化
    def build(self, initial):
        self.dat[self.N0:self.N0+len(initial)] = initial[:]
        for k in range(self.N0-1,0,-1):
            self.dat[k] = self.op_M(self.dat[2*k], self.dat[2*k+1])

    # a_k の値を x に更新
    def update(self,k,x):
        k += self.N0
        self.dat[k] = x
        k //= 2
        while k:
            self.dat[k] = self.op_M(self.dat[2*k], self.dat[2*k+1])
            k //= 2

    # 区間[L,R]をopでまとめる
    def query(self,L,R):
        L += self.N0; R += self.N0 + 1 
        sl = sr = self.e_M
        while L < R:
            if R & 1:
                R -= 1
                sr = self.op_M(self.dat[R],sr)
            if L & 1:
                sl = self.op_M(sl,self.dat[L])
                L += 1
            L >>= 1; R >>= 1
        return self.op_M(sl,sr)

    def get(self, k): #k番目の値を取得。query[k,k]と同じ
        return self.dat[k+self.N0]


# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n = int(input())
xd = [[int(i) for i in readline().split()] for _ in range(n)]
xd.sort(key=lambda x: x[0])

xx = [xdi[0] for xdi in xd]
from bisect import bisect_left

a = [bisect_left(xx,x+d)-1 for x,d in xd]
seg = segment_tree(n, max, 0)
seg.build(a)

b = list(range(n))
for i in range(n-2,-1,-1):
    if i+1 <= a[i]:
        b[i] = seg.query(i+1,a[i])   
        seg.update(i,b[i])

dp = [0]*(n+1)
dp[-1] = 1

MOD = 998244353
for i in range(n-1,-1,-1):
    dp[i] = (dp[i+1] + dp[b[i]+1])%MOD

#print(a)
#print(b)
#print(dp)
print(dp[0])







Measured memory_bytes: 113772
from fractions import gcd
from itertools import accumulate

def main():
    S = input() + "💕"
    n = len(S) - 1
    ans = [0] * n
    start = 0
    for i in range(n):
        if S[i] != S[i+1]:
            if S[i] == "R":
                ans[i] += S[start:i+1:2].count("R")
                ans[i+1] += S[start+1:i+1:2].count("R")
            else:
                ans[start] += S[start:i+1:2].count("L")
                ans[start-1] += S[start+1:i+1:2].count("L")
            start = i+1
    print(*ans)

main()

Measured memory_bytes: 8772
#include <bits/stdc++.h>
 
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, a, n) for(int i = a; i < n; i++)
#define PI 3.141592653589793238
#define bc __builtin_popcountll
#define pf push_front
#define pb push_back
#define rf pop_front
#define rb pop_back
#define fs first
#define sc second
#define mp make_pair
#define fi ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
const ll M = 1e9 + 7;
const ll INF = 1e9;
inline ll pwr(ll base, ll n, ll m) {ll ans = 1;while( n > 0 ) {if ( n & 1 ) ans = (ans * base) % m; base = (base * base) % m; n>>=1;}return ans;}


int main() {
    fi;
 
    // #ifndef ONLINE_JUDGE
    // freopen( "input.txt", "r", stdin );
    // freopen( "output.txt", "w", stdout );
    // #endif

    int a, b, cnt = 0, s = 1;
    cin >> a >> b;

    while( s < b ) {
        cnt++;
        s--;
        s += a;
    }

    cout << cnt;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define vi vector<int>
#define pb emplace_back
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define x first
#define y second
#define rep(i, j, k) for(i=j; i<k; i++)
#define sep(i, j, k) for(i=j; i>k; i--)
const int N = 3e3+5, inf = 1e9+7;
int n, k, i, j;
int w[N], v[N], dp[N][N];
 
signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int i, j, a, b, ans = 0;
    string s, t;
    cin>>s>>t;
    rep(i, 1, sz(s)+1) rep(j, 1, sz(t)+1){
        if(s[i-1]==t[j-1]) dp[i][j] = dp[i-1][j-1]+1;
        else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    }
    a = sz(s); b = sz(t);
    string f = "";
    while(a>0 && b>0){
        if(s[a-1]==t[b-1])
            f = f+s[a-1], a--, b--;
        else if(dp[a][b]==dp[a-1][b]) a--;
        else b--;
    }
    reverse(all(f));
    cout<<f;
}

Measured memory_bytes: 70656
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve (void)
{
  string str;cin>>str;
  int N = str.size();
  for (int i = N-2; i >= 2; i -=2) 
  {
    string s = str.substr(0,i);
    string s1 = str.substr(0,i/2);
    string s2 = str.substr(i/2,i/2);
    if(s1 == s2)
    {
      cout<<i<<endl;
      return;
    }
  }
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
#(i,j)=7i+j-7
x=0
for i in range(11):
    if (9*i)%11==k:
        x=i
        break
K=0
L=0
for i in range(1,78):
    if i%11!=x:
        continue
    if i%7<=1:
        continue
    K+=1
    if i<=7:
        L+=1
P=0
for i in range(1,7*(n%11)+1):
    if i%11!=x:
        continue
    if i%7<=1:
        continue
    if i>(7*(n%11)-7):
        continue
    P+=1
print(K*(n//11)+P-L)



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

int main(){
	ios::sync_with_stdio(0); 
	cin.tie(0);
	string z;
	cin>>z;
	
	if(z[1] == 'R') cout<<"ABC";
	else cout<<"ARC";
	
   
}



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

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;
    vector<vector<int> > cakeSunuke(K, vector<int>());
    for (int i = 0; i < K; ++i) {
        int dtemp;
        cin >> dtemp;
        cakeSunuke[i] = vector<int>(dtemp, 0);
        for (int j = 0; j < dtemp; ++j) {
            cin >> cakeSunuke[i][j];
        }
    }

    set<int> sunukes;
    for (int i = 0; i < K; ++i) {
        for (int j = 0; j < cakeSunuke[i].size(); ++j) {
            sunukes.insert(cakeSunuke[i][j]);
        }
    }

    cout << N - sunukes.size() << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

#define mod                          1000000007
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define rep(i,a,b)                   for(int i=a;i<b;i++)
using namespace std;

bool isSubSequence(string str1, string str2,int m,int n){int j = 0;for (int i=0; i<n&&j<m; i++){if (str1[j] == str2[i]) j++;}return (j==m);}
int isPrime(ll n) {rep(i, 2, sqrt(n)+1) if (n%i==0) return 0; return 1;}
int isSquare(ll n) {return (ll) sqrt(n) * (sqrt(n)) == n;}
int digsum(int n)
{int s=0;
    while(n>0)
    {  int d=n%10;
        s+=d;
        n/=10;
    }
    return s;
}

void print(int n)
{
    if(n%digsum(n)==0) cout<<"Yes";
    else cout<<"No";
}

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n,m,i=0,j,k,cnt=0;
   cin>>n;
  print(n);
	return 0;
}



Measured memory_bytes: 256
test_input = str(input())
v = [(test_input[i*2]+test_input[i*2+1]) for i in range(int(len(test_input)/2))]
if len(test_input)%2 !=0:
    print("No")
elif set(v) == set(["hi"]):
    print("Yes")
else:
    print("No")


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

int main() {
  int n;
  cin >> n;
  
  int x = 0, y = n;
  for (int j = 0; j < 8; j++) x += y % 10, y /= 10;

  if (n%x == 0) puts("Yes");
  else puts("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define meck main
long  w[105],v[105],t[2][100005];
int meck()
{
    long  i,j,n,ww;
    scanf("%ld%ld",&n,&ww);
    for(i=1;i<=n;i++)
    {
        scanf("%ld%ld",&w[i],&v[i]);
    }
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=ww;j++)
        {
            if(w[i] <= j)
            {
                t[i%2][j] = max(t[(i-1)%2][j],t[(i-1)%2][j-w[i]]+v[i]);
            }
            else
            {
                t[i%2][j] = t[(i-1)%2][j];
            }
        //printf("%ld ",t[i%2][j]);
        }
        //printf("\n");
    }
    printf("%ld",t[n%2][ww]);
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  //ll n; cin>>n;
  ll a,b,c,d,e,f; cin>>a>>b;
  //string a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  bool judge = true;
  for(i=a;i<=b;i++){
    string s = to_string(i);
    if(s[0]==s[4]&&s[1]==s[3]) result++;
  }
  cout<<result<<endl;

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(i=0;i<n;i++){

  }
  */

  return 0;
}

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

int main() {
    long long N,A,B;
    cin >> N >> A >> B;
    if(A==0){
        cout << 0 << endl;
    }
    else{
        long long q=N/(A+B),r=N%(A+B);
        if(r<A){
            cout << q*A + r << endl;
        }
        else{
            cout << q*A+A << endl;
        }
    }
}

Measured memory_bytes: 256
import scala.io.StdIn
object Main extends App {
  // def calcPows(n:Int) = 
  val x = StdIn.readLine.toInt
  val r = math.sqrt(x).toInt
  val ans = (1 to r).map { i =>
    val e: Seq[Int] = for {
      j <- (1 to r)
      e = math.pow(i,j).toInt if(e <= x)
    } yield e
    e.max
  }
  println(ans.max)
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int ans = 0;
  for(int i=0; i<3; i++){
    if(S.at(i) == T.at(i)) ans++;
  }
  
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;
const int A = 998244353;

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

long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  string X;
  cin >> N >> X;

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    cnt += (X[i] == '1');
  }

  long long A = 0, B = 0;
  for (int i = 0; i < N; i++) {
    if (X[i] == '1') {
      if (cnt - 1 > 0) {
        A = (A + mod_pow(2, N - i - 1, cnt - 1)) % (cnt - 1);
      }
      B = (B + mod_pow(2, N - i - 1, cnt + 1)) % (cnt + 1);
    }
  }

  for (int i = 0; i < N; i++) {
    long long ans = 0, t = 0;
    if (X[i] == '1') {
      if (cnt != 1) {
        t = ((A - mod_pow(2, N - i - 1, cnt - 1)) + (cnt - 1)) % (cnt - 1);
        ans++;
      }
    } else {
      t = (B + mod_pow(2, N - i - 1, cnt + 1)) % (cnt + 1);
      ans++;
    }
    while (t != 0LL) {
      long long md = __builtin_popcountll(t);
      if (mod == 0LL) {
        break;
      }
      t %= md;
      ans++;
    }
    cout << ans << "\n";
  }
  return 0;
}

Measured memory_bytes: 3780
#include<iostream>
#include<cstring>
using namespace std;
int l,i,r,n;
char a[101];
int main()
{
	cin>>a;
	l=strlen(a);
	for(i=0;i<=l;i++)
	{
		if(a[i]=='C')
		r=1;
		if(a[i]=='F'&&r==1)
		n=1;
    }
    if(r==1&&n==1)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]<h[b-1]:
         final[a-1]=0
  elif h[a-1]>h[b-1]:
         final[b-1]=0
  else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))


Measured memory_bytes: 20048
#include <bits/stdc++.h>
using namespace std;
void solve()
{
  int a;
  string s;
  cin >> a >> s;
  if(a<3200){
    cout << "red" << endl;
  }
  else cout << s << endl;
 }
int main ()
{
   // FasterIO;
    #ifdef _online
    input
    //output
    #endif // _online
    solve();
}


Measured memory_bytes: 256
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

last = 0
remain = 10
foods = [a, b, c, d, e]
for i in range(len(foods)):
    r = foods[i] % 10
    if r == 0:
        r = 10
    if r < remain:
        remain = r
        last = i

time = 0
for i in range(len(foods)):
    if i == last:
        continue
    time += math.ceil(foods[i] / 10) * 10

time += foods[last]
print(time)

Measured memory_bytes: 3064
fun main(args: Array<String>?): Unit {
    val input = readLine()?.trim()?.split(" ")?.map(String::toDouble) ?: return
    resolve(input)
}

private fun resolve(input: List<Double>) {
    val (a, b) = input.map { it.toBigDecimal() }
    val d = a.multiply(b)
    println(d.toBigInteger())
}


Measured memory_bytes: 36932
#include <iostream>
#include<bits/stdc++.h>
#define ll long long 
using namespace std;


int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];        
    }
    
    int pre[n];
    pre[0] = a[0];
    
    for(int i = 1; i < n; i++){
        pre[i] = pre[i - 1] + a[i];
    }
    
    int suff[n];
    suff[n - 1] = a[n - 1];
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1] + a[i];
    }
    
    // for(int i = 0; i < n; i++){
    //     cout << pre[i] << " ";
    // }
    // cout << endl;
    int min = 1000000;
    for(int i = 0; i < n - 1; i++){
        if(abs(suff[i + 1] - pre[i]) < min){
            min = abs(suff[i + 1] - pre[i]);
        }
    }
    
    cout << min << endl;
    
}

Measured memory_bytes: 256
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define dump(x) 
#endif

class range {
    struct Iterator {
        int val, inc;
        int operator*() {return val;}
        bool operator!=(Iterator& rhs) {return val < rhs.val;}
        void operator++() {val += inc;}
    };
    Iterator i, n;
    public:
    range(int e) : i({0, 1}), n({e, 1}) {}
    range(int b, int e) : i({b, 1}), n({e, 1}) {}
    range(int b, int e, int inc) : i({b, inc}), n({e, inc}) {}
    Iterator& begin() {return i;}
    Iterator& end() {return n;}
};

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

const int D = 100100;
vector<int> calc(vector<int> p, vector<int> q) {
    vector<int> res(D);
    for(int x = 0; x < D; x++) {
        res[x] = x;
        REP(i, p.size()) {
            if(x-p[i] >= 0) {
                res[x] = max(res[x], res[x-p[i]] + q[i]);
            }
        }
    }
    return res;
}
int main(){
    iostream_init();
    int n, d, x;
    while(cin >> n >> d >> x) {
        vector<vector<int>> ps(d, vector<int>(n));
        REP(i, d) REP(j, n) {
            cin >> ps[i][j];
        }
        REP(i, d-1) {
            auto next = calc(ps[i], ps[i+1]);
            x = next[x];
        }
        cout << x << endl;
    }
    return 0;
}

/* vim:set foldmethod=marker: */

Measured memory_bytes: 1612
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();

	int ans,L,R;
	if( size&1 ){
		ans = size/2;
		L = size/2;
		R = L;
	}else{
		ans = size/2;
		L = size/2-1;
		R = size/2;
	}
	while(true){
		if( str[L] == str[R] ){
			if( L!=R ){
				if( str[L]!=str[L+1] ){
					break;
				}
			}
		}else{
			break;
		}

		--L;
		++R;
		++ans;
		if( L < 0 ){
			break;
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 512
use std::io;
use std::str::FromStr;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (a, b) = input_tuple();
    println!("{}", (a - 1) * (b - 1));
}


Measured memory_bytes: 2060
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

template<class T>
T modinv(T a, T m) {
  T b = m, u = 1, v = 0;
  while (b) {
    T t = a / b;
    a -= t * b; boost::swap(a, b);
    u -= t * v; boost::swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

void solve(void)
{
  int N; scanf("%d\n", &N);
  using boost::multiprecision::cpp_int;
  vector<int> A(N);
  for (int i = 0; i < N - 1; ++i) {
    scanf("%d ", &A[i]);
  }
  scanf("%d\n", &A[N-1]);

  cpp_int res{1};
  for (const auto& a : A) {
    res = (res * a) / boost::gcd(res, cpp_int(a));
  }
  res %= MOD;

  cpp_int ans{0};
  for (const auto& a : A) {
    ans += res * modinv(a, MOD);
  }
  ans %= MOD;

  printf("%d\n", int(ans));
  return;
}

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

  solve();

  return 0;
}


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

#define cst() int __t;scanf("%d",&__t);while(__t--)
#define rep(i,s,e) for(int i=s;i<e;++i)
#define repb(i,s,e) for(int i=s;i<=e;++i)
#define lep(i,s,e) for(int i=s;i>e;--i)
#define lepb(i,s,e) for(int i=s;i>=e;--i)
#define mst(a,b) memset(a,b,sizeof(a))
#define mcpy(des,sor) memcpy(des,sor,sizeof(sor))
#define pow2(x) ((x)*(x))
#define pt(x) cout<<#x<<"="<<x<<endl;


#define maxn 100006

typedef long long ll;
const int inf = 0x3f3f3f3f;

typedef pair<int,int> pii;

int main()
{
	int n,a[maxn],ma,mi,si,sa;
	cin>>n;
	ma=0;mi=n;
	repb(i,1,n)
	{
		cin>>a[i];
		ma=max(ma,a[i]);
		mi=min(mi,a[i]);
	}
	if(mi==ma)
	{
		if(a[1]==n-1||2*a[1]<=n)puts("Yes");
		else puts("No");
	}
	else if(mi+1==ma)
	{
		si=sa=0;
		repb(i,1,n)if(a[i]==mi)++si; else ++sa;
		if(si+2*(mi-si+1)<=n&&mi-si+1==ma-si&&ma-si>0)puts("Yes");
		else puts("No");
	}
	else puts("No");
}


Measured memory_bytes: 640
n=int(input().strip())
a=list(map(int, input().split()))
su=0
ans1=0
ans2=0
for i in range(n):
    if i%2==0:
        su+=a[i]
        if su<=0:
            ans1+=abs(su-1)
            su=1
    if i%2==1:
        su+=a[i]
        if su>=0:
            ans1+=abs(su+1)
            su=-1
su=0
for i in range(n):
    if i%2==0:
        su+=a[i]
        if su>=0:
            ans2+=abs(su+1)
            su=-1
    if i%2==1:
        su+=a[i]
        if su<=0:
            ans2+=abs(su-1)
            su=1

print(min(ans1,ans2))

Measured memory_bytes: 14468
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    if(s.at(2)==s.at(3) && s.at(4)==s.at(5)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
    cin >> data.at(i).at(j);
    }
  }
  int count =0; //answerの列
  for (int i = 0; i < W; i++) {
    bool flag = true;
    for (int j = 0; j < H; j++) {
      if (data.at(j).at(i-count) != '.')  {
        flag = false;
        break;
      }
    }
    if (flag == true) {
      for (int k = 0; k < H; k++) {
        for (int l = i-count; l < W-1; l++){
            data.at(k).at(l) = data.at(k).at(l+1);
        }
      }
      count++;
    }
    
  }
  
  for (int i = 0; i < H; i++) {
    bool flag = true;
    for (int j = 0; j < W; j++) {
      if (data.at(i).at(j) != '.') {
        flag = false;
        break;
      }  
    }
    if (flag == false) {
        for (int j = 0; j < W - count; j++) {
          cout << data.at(i).at(j);
        }
        cout << endl;
    }
  }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
using namespace std;
int sp[309][309];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>sp[i][j];
			sp[i][j]--;
		}
	}
	if(m==1){
		cout<<n<<endl;
		return 0;
	}
	for(int k=1;k<=n;k++){
		int cnt[m],pos[n],used[m],upd[n];
		for(int i=0;i<m;i++){
			cnt[i]=0;
			used[i]=0;
		}
		for(int i=0;i<n;i++){
			pos[i]=0;
			upd[i]=1;
		}
		int fin = 0;
		bool update = true;
		while(update == true && fin == 0){
			update = false;
			for(int i=0;i<n;i++){
				if(upd[i]==1 && pos[i]<m){
					cnt[ sp[i][pos[i]] ] ++;
				}
				upd[i]=0;
			}
			for(int i=0;i<m;i++){
				if( cnt[i] > k && used[i] == 0 ){
					update = true;
					used[i] = 1;
				}
			}
			for(int j=0;j<n;j++){
				while( pos[j]<m && used[ sp[j][pos[j]] ] == 1){
					pos[j]++;
					upd[j]=1;
				}
				if(pos[j]==m){
					fin++;
				}
			}
		}
		if(update==false){
			cout<<k<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iterator>
#include<math.h>
#define debug() puts("what the fuck")
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
int main()
{
    int  n,k,s;
    cin>>n>>k>>s;
    for(int i=1;i<=k;i++)
        cout<<s<<' ';
        if(s==1e9)
        {
            for(int i=1;i<=n-k;i++)
                cout<<1<<' ';
        }
        else
        {
            for(int i=1;i<=n-k;i++)
        cout<<s+6<<' ';
        }
    return 0;
}


Measured memory_bytes: 1280
#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 repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll k,t,a,ma=0;
	cin >> k >> t;
	rep(i,t){
		cin >> a;
		chmax(ma,a);
	}
	cout << max(0LL,ma-1-(k-ma)) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BFiveDishes solver = new BFiveDishes();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFiveDishes {
        static final int m = 10;
        static final int n = 5;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] times = new int[n];
            for (int i = 0; i < n; i++) {
                times[i] = in.nextInt();
            }

            int answer = 0;

            for (int x : times) {
                answer += m * ((x + m - 1) / m);
            }

            int min = m;
            for (int x : times) {
                if (x % m > 0) min = Math.min(min, x % m);
            }

            answer -= m;
            answer += min;

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 21460
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
using namespace std;
int hoge[5] = {0, 6000,4000,3000,2000 };
int main() {
	for (int i = 0;i < 4;++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		printf("%d\n", (b*hoge[a]));
	}
}


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

int main(){

    int m,n;
    cin >> n >> m;
    int p;
    string s;
    int i;
    int tr[n+1], fl[n+1],flag[n+1];
    int ans,ans2;
    ans = 0;
    ans2 = 0;


    for(i = 0; i < n+1; i++){
        tr[i] = 0;
        fl[i] = 0;
        flag[i] = 0;
    }

    for (i = 0; i < m; i++){
        cin >> p >> s;
        if(flag[p] == 0){
            if(s == "AC"){
            tr[p] = 1;
            flag[p] = 1;
            ans2 += fl[p];
            }
            else if(s == "WA") fl[p]++;
        }
    }

    for(i=0; i<n+1; i++){
        ans = ans + tr[i];
    }
       cout << ans << " " << ans2 << endl;
}

Measured memory_bytes: 1408
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dis=float('inf')
for i in range(M):
    x,y,c=map(int,input().split())
    dis=min(dis,a[x-1]+b[y-1]-c)
ans=min(min(a)+min(b),dis)
print(ans)

Measured memory_bytes: 18612
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	for i := 0; i < m; i++ {
		var a int
		fmt.Scan(&a)
		n -= a
	}
	if n >= 0 {
		fmt.Println(n)
	} else {
		fmt.Println(-1)
	}
}


Measured memory_bytes: 2460
#include <iostream>
#include <string>
using namespace std;
int main(){
    string S;
    cin >> S;
    int counter = 0;
    if (S[0] == '1') ++counter;
    if (S[1] == '1') ++counter; 
    if (S[2] == '1') ++counter;
    cout << counter << endl;
    
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int i, n, *d;
    cin >> n;
    d = new int[n];
    for (i = 0; i < n; i++) 
        cin >> d[i];

    sort(d, d+n);

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

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
  n=int(input())
  #a=list(map(lambda x:list(map(int,list(bin(int(x))[2:]))),input().split()))
  a=list(map(int,input().split()))
  mod=pow(10,9)+7
  bit=[0]*61
  for ai in a:
    for j in range(61):
      if ((ai>>j)&1):
        bit[j]+=1
  ans=0
  for i in range(61):# 2^iの位
    ans+=(pow(2,i,mod)*bit[i]*(n-bit[i]))%mod
    ans%=mod
  print(ans)
if __name__=='__main__':
  main()

Measured memory_bytes: 123132
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String N = s.next();
	
	long count = 0;
	for(int i = 0; i < N.length(); i++){
		count = count + (N.charAt(i)-48);
	}
	
	if(count%9==0){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}

    
  }
}

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

int main() {
    int N, K;
    cin >> N >> K;
    deque<int> V(N);
    rep(i, N) cin >> V[i];

    int ans = 0;
    rep(a, min(K + 1, N + 1)) rep(b, min(K + 1, N + 1) - a) {
        int del = K - (a + b);
        vector<int> j;
        rep(i, a) {
            j.push_back(V[i]);
        }
        rep(i, b) {
            j.push_back(V[N - 1 - i]);
        }
        sort(all(j));
        rep(i, del) {
            if (i >= j.size()) break;
            if (j[i] < 0) j[i] = 0;
        }
        ans = max(ans, accumulate(all(j), 0));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256