akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i= a ; i < b ; ++i)
#define rep(i,n) fo(i,0,n)
#define pln(n) printf("%lld\n",n)
#define sll(n) scanf("%lld",&n)
#define ss(n) scanf("%s",n)
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define dbg3(x,y,z) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) <<" , "<< #z <<": "<<(z)<<endl; }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<int>
#define tr(c, it) \
for(decltype(c.begin()) it = c.begin(); it!= c.end(); it++)
#define pis pair<int,string>
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c),x) != c.end())
#define mod (int)(1e9 + 7) 

using namespace std;
bool dp[100001][2];

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	dp[0][0] = false;
	dp[0][1] = false;
	for(int stones = 1; stones <= k; stones++){
		// for player 0
		dp[stones][0] = false;
		for(int i = 0; i < n; i++){
			if(a[i] <= stones && !dp[stones - a[i]][1]){
				dp[stones][0] = true;
			}
		}
		dp[stones][1] = false;
		for(int i = 0; i < n; i++){
			if(a[i] <= stones && !dp[stones - a[i]][0]){
				dp[stones][1] = true;
			}
		}
	}
	dp[k][0] == 0 ? cout << "Second": cout << "First" << endl;
	
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for (int i=0,_n=(int)(n); i < _n; i++)
template<class T> bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, T b) { return a > b ? (a = b, true) : false; }
 
typedef long long ll;

const ll MOD = (ll)(1e7);

int main2() {
  ll x;
  cin >> x;
  ll ans = 0;
  ans += 2 * (x / 11);
  x %= 11;
  if (x >= 6) { ans++; x -= 6; }
  if (x >= 1) { ans++; x -= 5; }
  cout << ans << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}

Measured memory_bytes: 256
def bite_eating(N: int, L: int)->int:
    total = N*(N-1)//2 + L*N

    if L >= 0:
        # L が正の値なら一番小さいものを食べる。
        return total-L

    if N+L-1 < 0:
        # L が負の値かつ一番大きい値も負であるなら一番大きいものを食べる。
        return total-(N+L-1)

    # 上述の条件に当てはまらない場合は、必ず美味しさ 0
    # のものが存在するのでそれを食べる。
    return total


if __name__ == "__main__":
    N, L = map(int, input().split())

    ans = bite_eating(N, L)
    print(ans)


Measured memory_bytes: 2940
import sys

input = sys.stdin.readline
t, x, y = 0, 0, 0
for _ in range(int(input())):
    t1, x1, y1 = map(int, input().split())
    a = abs(x1 - x) + abs(y1 - y)
    b = t1 - t
    if a <= b and a % 2 == b % 2:
        t, x, y = t1, x1, y1
    else:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 9120
import java.io.*;
import java.util.*;

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

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        char b = line.charAt(0);
        switch (b) {
            case 'A':
                System.out.println("T");
                break;
            case 'T':
                System.out.println("A");
                break;
            case 'G':
                System.out.println("C");
                break;
            case 'C':
                System.out.println("G");
                break;
        }
    }
}

Measured memory_bytes: 21076
abc=sorted(list(map(int,input().split())))

ans = 0
if (abc[1] - abc[0]) % 2 == 0:
  ans +=  (abc[1] - abc[0]) // 2
  abc[0] = abc[1]
else:
  ans += 1
  abc[1] += 1
  abc[2] += 1
  ans +=  (abc[1] - abc[0]) // 2
  abc[0] = abc[1]
print(ans + abc[2] - abc[1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int X;
    cin >> X;
    if (X == 7 || X == 5 || X == 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)

for i in range(1, N+1):
  t[i] = t[i-1] + (1 if S[i-1:i+1] == 'AC' else 0)
  
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1]-t[l-1])

Measured memory_bytes: 7748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 string s; cin>>s;
 
  if(s.at(0)==s.at(1)&&s.at(2)==s.at(3)&&s.at(0)!=s.at(2))cout<< "Yes" <<endl;
      else if(s.at(0)==s.at(2)&&s.at(1)==s.at(3)&&s.at(0)!=s.at(1))cout<< "Yes" <<endl;
   else if(s.at(0)==s.at(3)&&s.at(1)==s.at(2)&&s.at(0)!=s.at(1))cout<< "Yes" <<endl;
     else   cout<< "No" <<endl;
  

  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7, T = 50;
ll fac[100], invfac[100];
ll pw(ll a, ll b) {
	ll r = 1;
	for( ; b ; b >>= 1, a = a * a % mod)
		if(b & 1)
			r = r * a % mod;
	return r;
}

int main() {
	int n, m; cin >> n >> m;
	fac[0] = 1; for(int i = 1 ; i <= T ; ++ i) fac[i] = fac[i - 1] * i % mod;
	invfac[0] = 1, invfac[T] = pw(fac[T], mod - 2);
	for(int i = T - 1 ; i ; -- i) invfac[i] = invfac[i + 1] * (i + 1) % mod;
	ll ans = 1;
	for(int i = 2 ; i * i <= m ; ++ i) {
		if(m % i) continue;
		int tot = 0;
		while(m % i == 0) ++ tot, m /= i;
		ll r = invfac[tot];
		for(int j = n ; j <= tot + n - 1 ; ++ j) r = r * j % mod;
		ans = ans * r % mod;
	}
	if(m > 1) {
		int tot = 1;
		ll r = invfac[tot];
		for(int j = n ; j <= tot + n - 1 ; ++ j) r = r * j % mod;
		ans = ans * r % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
class Value{
	T value;
	public:
	Value() { }
	Value(T value) : value(value) { }

	Value<T> add(Value<T> a){ return Value<T>(value + a.get()); }
	Value<T> sub(Value<T> a){ return Value<T>(value - a.get()); }
	Value<T> pro(Value<T> a){ return Value<T>(value * a.get()); }
	Value<T> div(Value<T> a){ return Value<T>(value / a.get()); }
	Value<T> mod(Value<T> a){ return Value<T>(value % a.get()); }
	bool eq(Value<T> a){ return value == a.get(); }
	bool gt(Value<T> a){ return value > a.get(); }
	bool gtq(Value<T> a){ return value >= a.get(); }
	bool lt(Value<T> a){ return value < a.get(); }
	bool ltq(Value<T> a){ return value <= a.get(); }


	T get(){ return value; }
	void set(T v){ value = v; }

	void out(){ cout << value << endl; };
};

template<typename T>
Value<T> max(Value<T> a, Value<T> b){
	return a.get() < b.get() ? b : a;
}
template<typename T>
Value<T> min(Value<T> a, Value<T> b){
	return a.get() < b.get() ? a : b;
}

/* output */
template<typename T>
ostream& operator << (ostream& os, Value<T> t){
	os << t.get();
	return os;
}
void yn(bool b){
	cout << (b ? "Yes" : "No") << endl;
}
template<typename T> void out(Value<T> a){
	cout << a << endl;
}
template<typename T> void out(vector<T> a, bool space = true){
	rep(i,a.size()){
		cout << a[i] << (i + 1 == a.size() ? "\n" : (space ? " " : ""));
	}
}
template<typename T> void out(vector<vector<Value<T>>>& v){
	rep(i,v.size()){
		out(v[i]);
	}
}

/* 多重vector */
template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

/* input */
template<typename T>
istream& operator >> (istream& is, Value<T>& t){
	T res;
	is >> res;
	t.set(res);
	return is;
}

template<typename T> T in(){
	T res;
	cin >> res;
	return res;
}
template<typename T> vector<T> in(int n){
	vector<T> res(n);
	rep(i,n) res[i] = in<T>();
	return res;
}
template<typename T> vector<vector<T>> in(int h, int w){
	vector<vector<T>> res(h);
	rep(i,h) res[i] = in<T>(w);
	return res;
}





template<typename T>
void solve(T a){
	min(a[0], a[1]).add(min(a[2], a[3])).out();
}

int main(){
	solve(in<Value<int>>(4));
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a,b;
	int sum=0;
	while(n--)
	{
		cin>>a>>b;
		if(a==b)
		sum++;
		else
		sum+=(b-a+1);
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
class CraneAndTurtle
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int x = int.Parse(input[0]);
            int y = int.Parse(input[1]);
            int leg;

            for(int i = 0; i <= x; i++)
            {
                leg = (2 * i) + (4 * (x - i));
                if(leg == y)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }

Measured memory_bytes: 27532
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        var A = cin.scanint.Select(i => i - 1).ToArray();
        var B = new bool[N];
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
            if(i == A[A[i]])
            {
                ans++;
            }
        }
        WriteLine(ans / 2);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main(){
  
  long double n,ans=0;
  cin >> n;
  for(long long i=0; i<n; i++){
    long double x;
    string S;
    cin >> x >> S;
    if(S=="JPY"){
      ans+=x;
    }
    else{
      ans+=(x*380000);
    }
  }
  
  cout << fixed << setprecision(10) << ans << endl;
}



Measured memory_bytes: 256
// start fold
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define enter putchar('\n')
#define size(x) ((int)x.size())
#define mem0(x) memset(x,0,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; short f=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') x=x*10+(c^'0'),c=getchar();
	x*=f;
}
template <typename T,typename ...Args>il void in(T &x, Args &...args)
{
	in(x); in(args...);
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30];
	short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template <typename T,typename ...Args>il void out(const T &x,const Args &...args)
{
	out(x,' '); out(args...);
}
template<class T>il void print(T a[],int n)
{
	if(n<=0) return;
	for(ri i=0; i<n; ++i) out(a[i],' ');
	enter;
}
namespace i207M
{
// end fold
int n;
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
#endif
	in(n); int i=1;
	for(; i*(i+1)/2<n; ++i);
	out(i);
	return 0;
}
// start fold
}
signed main()
{
	i207M::main();
	return 0;
}
// end fold

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

ll ncr(ll n, ll r){
  if(n < r) return 0;
  if(r > n-r) r = n-r;

  ll a = 1, b = 1;
  for(int i = 0; i < r; i++){
    a *= (n - i);
  }
  for(int i = 0; i < r; i++){
    b *= (i + 1);
  }
  return a/b;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, P;
  cin >> N >> P;
  ll even = 0, odd = 0;
  for(int i = 0; i < N; i++){
    ll A;
    cin >> A;
    if(A % 2 == 0) even++;
    else odd++;
  }
  ll ans = 0;
  if(P == 0){
    ll x = 0LL;
    for(int i = 0; i <= odd; i+=2){
      x += ncr(odd, i);
    }
    ans = (1LL << even) * x;
  }
  else{
    ll x = 0LL;
    for(int i = 1; i <= odd; i+=2){
      x += ncr(odd, i);
    }
    ans = (1LL << even) * x;
  }
  cout << ans << endl;
}

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

map<ll, ll> primeFactor(ll n) {
    map<ll, ll> ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}


int main() {
    ll n;
    cin >> n;
    vector<int> num = {1, 3, 6, 10, 15, 21, 28, 36, 45, 55};
    auto mp = primeFactor(n);
    ll ans = 0;
    for (auto p : mp) {
        int t = 0;
        if (binary_search(num.begin(), num.end(), p.second)) t = 1;
        ans += lower_bound(num.begin(), num.end(), p.second) - num.begin() + t;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <stdio.h>
int main(){
    int i;
    int num;
    for(i=0; i<10000; i++){
        scanf("%d", &num);
        if(num == 0){
            break;
        }else{
            printf("Case %d: %d\n", i+1, num);
        }
    }
    return 0;
}



Measured memory_bytes: 2024
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <cassert>
using namespace std;

//common
typedef int  i32;
typedef long long i64,ll;
#define BR "\n"

#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef long long ll; typedef vector<long long> vl; typedef pair<long long,long long> pll; typedef vector<pair<long long,long long> > vpll;
typedef vector<string> vs; typedef long double ld;

//config
//#define MODE_DEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef MODE_DEBUG
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl

#define  DUMP(x)  cerr << #x << " = " << (x) <<endl
#define DEBUG(x) DUMP(x) << " (L" << __LINE__ << ")" << " " << __FILE__<<endl
#define CHECK(exp,act)  if(exp!=act){DUMP(exp);DEBUG(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#else
#define DUMP(x)
#define DEBUG(x)
#define CHECK(exp,act)
#define STOP(e)
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}
template<class T> inline string toString(const vector<vector<T>>& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

template<typename T,typename V> inline T mod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}

typedef vector<vector<int>> Mat;
void warshall_floyd(Mat& d){
    const int V=d.size();
    for(int k=0;k<V;k++)
        for(int i=0;i<V;i++)for(int j=0;j<V;j++)
            if(d[i][j]>d[i][k] + d[k][j]){
                d[i][j]=d[i][k] + d[k][j];
                //prev[i][j]=k;
            }
}

const int INF =1<<28;
int main(){

	while(true){
		int N,M;cin >> N >> M;
		if(N==0 && M==0)return 0;
		Mat ds(M+1,vector<int>(M+1,INF));
		Mat cs(M+1,vector<int>(M+1,INF));
		REP(i,M+1)ds[i][i]=cs[i][i]=0;

		REP(i,N){
			int a,b,c,t; cin >> a >> b >> c>>t;
			ds[a][b]=min(ds[a][b],t);ds[b][a]=min(ds[b][a],t);

			cs[a][b]=min(cs[a][b],c);cs[b][a]=min(cs[b][a],c);
		}
		warshall_floyd(ds);DUMP(toString(ds));
		warshall_floyd(cs);DUMP(toString(cs));
		int k;cin >> k;
		REP(i,k){
			int p,q,r;cin >> p >> q >>r;
			if(r==0)cout<<cs[p][q]<<endl;
			else cout<<ds[p][q]<<endl; 
		}
	}
	return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

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

    int n, k;
    cin >> n >> k;

    vector< vector<int> > v(10);
    rep(i, n){
        int c, g;
        cin >> c >> g;
        --g;
        v[g].push_back(c);
    }
    rep(i, 10){
        SORT_INV(v[i]);
        v[i].insert(v[i].begin(), 0);
        REP(j, 1, v[i].size()){
            v[i][j] += v[i][j - 1];
            v[i][j] += (j * (j - 1)) - ((j - 1) * (j - 2));
        }
        while(v[i].size() < k){
            v[i].push_back(v[i].back());
        }
    }

    int dp[11][2001] = {0};
    rep(i, 10){
        rep(j, k + 1){
            rep(l, j + 1){
                chmax(dp[i + 1][j], dp[i][l] + v[i][j - l]);
            }
        }
    }

    cout << dp[10][k] << endl;

    return 0;
}


Measured memory_bytes: 3312
/*
ID: Aldew
LANG: C++14
PROG:
*/


#include <bits/stdc++.h>
#define check(x) cout<<(#x)<<": "<<x<<" ";
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ss second
#define ff first
#define pb push_back
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef unsigned long long ull;

int pct(int x) { return __builtin_popcount(x); }

using namespace std;

//ifstream fin("lamps.in");
//ofstream fout("lamps.out");
const int sz = 85;
int a[sz];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    ll now = 1000;

    for (int i = 0; i + 1 < n; i++){
        if (a[i] < a[i+1]){
            ll c= now / a[i];
            now += c * (a[i+1] - a[i]);
        }
    }
    cout << now << endl;


    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

// GCDを計算します
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
    if (a < b) {
        NumType tmp = a;
        a = b;
        b = tmp; 
    }

    NumType r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

// 約数を数えます
template <typename NumType>
NumType cntDivisor(const NumType & num) {
    NumType cnt = 0;
    for(NumType i = 1; i * i <= num; ++i) {
        if(num % i == 0) {
            cnt++;
            if(i * i != num) cnt++;
        }
    }

    return cnt;
}

// [beg, end)の範囲を，添え字indexでループするfor文に置換します
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"

template<class T>
T Min(T a, T b) {
    return (a < b) ? a : b;
}

template<class T>
T Max(T a, T b) {
    return (a > b) ? a : b;
}

int main() {
    int32_t N;
    array<int32_t, 200000> A;

    cin >> N;
    for (int32_t i = 0; i < N; i++) cin >> A[i];

    int32_t maxFrom0 = 0;
    int32_t maxFromN = 0;

    array<int32_t, 200000> maxFrom0Arr;
    array<int32_t, 200000> maxFromNArr;

    for (int32_t i = 0; i < N; i++) {
        maxFrom0 = Max(maxFrom0, A[i]);
        maxFrom0Arr[i] = maxFrom0;
    }

    for (int32_t i = N-1; i >= 0; i--) {
        maxFromN = Max(maxFromN, A[i]);
        maxFromNArr[i] = maxFromN;
    }

    for (int32_t i = 0; i < N; i++) {
        int32_t maxFrom0 = 0;
        if (i - 1 >= 0) {
            maxFrom0 = maxFrom0Arr[i - 1];
        }
        int32_t maxFromN = 0;
        if (i + 1 < N) {
            maxFromN = maxFromNArr[i + 1];
        }
        cout << Max(maxFrom0, maxFromN) << '\n';
    }

    return 0;
}



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

int main() {
 int n;
 int x = 0;
 string ans;
 cin >> n;
 int m = n;
 while(true){
   x += n%10;
   if(n/10 == 0){
     break;
   }else{
     n /= 10;
   }
 }
 if(m%x == 0){
   ans = "Yes";
 }else{
   ans = "No";
 }
 cout << ans <<  endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
happy=0
old_a=n
for i in range(n):
    new_a=a[i]
    happy+=b[(new_a-1)]
    if new_a==old_a+1:
        happy+=c[new_a-2]
    old_a=new_a
print(happy)

Measured memory_bytes: 3064
import numpy

n, m = map(int, input().split())
a = numpy.zeros([n, n], dtype=int)
b = numpy.zeros([m, m], dtype=int)
for i in range(n):
    s = input()
    for j in range(n):
        if s[j] == '#':
            a[i, j] = 1
for i in range(m):
    s = input()
    for j in range(m):
        if s[j] == '#':
            b[i, j] = 1
for i in range(n - m + 1):
    for j in range(n - m + 1):
        if numpy.all(a[i: i + m, j: j + m] == b):
            print("Yes")
            f = True
            exit()
print("No")

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

int main() {
	
	char a[3], b[3];
	int ans = 0;
	
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}

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

	for (int i = 0; i < 3; i++) {
		if (a[i] == b[i]) {
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
from sys import setrecursionlimit
from collections import Counter
from collections import defaultdict
from collections import deque
from heapq import heapify
from heapq import heappop
from heapq import heappush
from time import time
setrecursionlimit(10**9)
mod=10**9+7
inf=10**18

d,t,s=[int(x) for x in input().split()]

print('Yes' if d<=t*s else 'No')

Measured memory_bytes: 9460
def isFizzBuzz (N):
  if N % 15 == 0 :
    return 0
  elif N % 3 == 0:
    return 0
  elif N % 5 == 0:
    return 0
  else:
    return N

N = int(input())
ans = 0
for i in range(1,N+1):
  ans += isFizzBuzz(i)

print(ans)


Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 7;
int main(){
	int arr[MAX],arr1[MAX];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		arr1[i]=arr[i];
	}	
	sort(arr1,arr1+n);
	int num=0;
	for(int i=0;i<n;i++){
		if(arr[i]!=arr1[i]){
			num++;
		}
	}
	if(num==2 || num==0){
		printf("YES\n");
	}
	else 
		printf("NO\n");
	return 0;
}                                


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

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

	for (ll i = 0; i < N; i++) {
		char S;
		cin >> S;
		if (S == 'Y') {
			cout << "Four" << endl;
			exit(0);
		}
	}

	cout << "Three" << endl;
}

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


int main() {
    string s;
    cin >> s;
    int n = s.size();
    int first = ((n-1)/2);
    int second = ((n+3)/2) -1 ;

    string fir = s.substr(0, first);
    string sec = s.substr(second,n);
    string tempf = fir;
    string temps = sec;
    string tempss = s;


    reverse(s.begin(), s.end());
    reverse(fir.begin(), fir.end());
    reverse(sec.begin(), sec.end());


    if(tempf == fir && temps == sec && tempss == s){
        cout << "Yes";
    }
    else{
        cout << "No";
    }


    return 0;
}


Measured memory_bytes: 256
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/25 08:16:53 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	vector<string>	V(3);
	rep(i, 3)
		cin >> V.at(i);
	// cin >> A >> B >> C;

	vector<int>	VI(3);
	// int	ai,	bi, ci;
	// ai = bi = ci = 0;

	int	n = 0;
	while (1)
	{
		VI.at(n)++;
		if (VI.at(n) > V.at(n).size())
		{
			if (n == 0)
				cout << 'A' << endl;
			else if (n == 1)
				cout << 'B' << endl;
			else
				cout << 'C' << endl;
			return ;
		}
		if (V.at(n).at(VI.at(n) - 1) == 'a')
			n = 0;
		else if (V.at(n).at(VI.at(n) - 1) == 'b')
			n = 1;
		else
			n = 2;
	}
}
// END

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


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

// APG4b-N
int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) cin >> d.at(i);

  int leftend = 0;
  while (leftend < n)
  {
    for (int i = n-1; i > leftend; i--)
    {
      if (d.at(i-1) > d.at(i))
      {
        int temp = d.at(i-1);
        d.at(i-1) = d.at(i);
        d.at(i) = temp;
      }
    }
    leftend++;
  }

  int chk = d.at(0);
  int ans = 1;
  for (int i = 1; i < n; i++)
  {
    if (d.at(i) != chk)
    {
      ans++;
      chk = d.at(i);
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
<?php

fscanf(STDIN,"%d",$n);
fscanf(STDIN,"%s",$str);
$c=str_split($str);
$count=array_count_values($c);
$w=0;
$r=0;
$play=[];
if(array_key_exists('W',$count)){
$w=$count['W'];}
if(array_key_exists('R',$count)){
$r=$count['R']; 
}
if($w==0 || $r==0){
    $play[]=0;
}else{
$left=0;
$right=$r;
for($i=0;$i<$n;$i++){
    $play[]=max($left,$right);
    if($c[$i]=="W"){
        $left++;
    }else{
        $right--;
    }
}
}
echo min($play);

Measured memory_bytes: 35928
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int n;

map<char,int> mp;

i64 cou[5];

int main()
{
    mp['M'] = 0;
    mp['A'] = 1;
    mp['R'] = 2;
    mp['C'] = 3;
    mp['H'] = 4;
    cin >> n;
    string s;
    rep(i,1,n)
    {
        cin >> s;
        if(!(mp.count(s.front()))) continue;
        cou[mp[s.front()]]++;
    }

    i64 result = 0;
    rep(i,0,4)
    {
        rep(j,i + 1,4)
        {
            rep(k,j + 1,4)
            {
                result += cou[i] * cou[j] * cou[k];
            }
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define REP(i, n) for(int i = 0;i < (n);++i)
typedef long long ll;
const int MOD = 1e9+7;
const int INF = 1e9;

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

	int N, Ma, Mb, a[40], b[40], c[40];
	cin >> N >> Ma >> Mb;
	REP(i, N) cin >> a[i] >> b[i] >> c[i];
	int dp[45][410][410];
	REP(i, 45) REP(j, 410) REP(k, 410){
		if(j == 0 and k == 0) dp[i][j][k] = 0;
		else dp[i][j][k] = INF;
	}
	REP(i, N) REP(j, 405) REP(k, 405){
		if(j-a[i] < 0 or k-b[i] < 0) dp[i+1][j][k] = dp[i][j][k];
		else dp[i+1][j][k] = min(dp[i][j][k], dp[i][j-a[i]][k-b[i]]+c[i]);
	}
	
	int tmp = 1, ans = INF;
	while(1){
		if(Ma*tmp > 400 or Mb*tmp > 400) break;
		ans = min(ans, dp[N][Ma*tmp][Mb*tmp]);
		tmp++;
	}
	cout << (ans!=INF ? ans : -1) << endl;

	return 0;
}


Measured memory_bytes: 29824
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,a[200005],memo[200005]={},cou;

int main() {
	cout << fixed << setprecision(18);
	cin>>n;
    cou=n;
    memo[0]=1;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        if(memo[a[i]-1]==1){memo[a[i]]=1;}
    }
    for(int i=1;i<=n;i++){
        cou-=memo[i];
    }
    if(cou==n){cou=-1;}
    cout<<cou;
} 

Measured memory_bytes: 3328
#include <stdio.h>

int main()
{
    int n,p[55];

    scanf("%d",&n);

    int i;

    for(i=0;i<n;i++)
        scanf("%d",&p[i]);

    int ans = 0;

    for(i=0;i<n;i++)
        if(p[i] == i+1 )
            ans ++;

    if(n == ans || n == ans+2)
        printf("YES\n");
    else
        printf("NO\n");
        
        

    return 0;
}

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

#define ll long long
#define ar array

const int M=1e9+7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n;
	cin >> n;
	vector<ll> a(n);
	ll s=0, c=0;
	for(int i=0; i<n; ++i) {
		cin >> a[i];
		c+=a[i];
	}
	for(int i=0; i+1<n; ++i) {
		c-=a[i];
		s=((((a[i]%M)*(c%M))%M)+(s%M))%M;
	}
	cout << s%M << "\n";
}


Measured memory_bytes: 4776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
	ll N;
	cin >> N;
	vector<ll> d(N);
	for(ll i = 0; i < N; i++){
		cin >> d[i];
	}
	sort(d.begin(), d.end());
	cout << d[N/2] - d[(N/2)-1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int x,y;
int main() {
 cin>>x>>y;
  cout << x + y/2 <<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	vector<int>a(5);
	for(int i=0;i<5;i++)
	{
		cin>>a[i];
		
	}
		for(int i=0;i<5;i++)
	{
		if(a[i]==0){cout<<i+1<<"\n";
		}
		
		
		
	}
	
	
	
	    
	return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <math.h>

//xが平方数ならば1，そうでなければ0を返す関数
int func(int x);

int main(void){
  int a, b;
  int x, y, z;
  scanf("%d%d", &a, &b);
  if(b < 10){
    if(func(a*10 + b) == 1){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  else if(b >= 10 && b < 100){
    if(func(a*100 + b) == 1){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }else{
    if(func(a*1000 + b) == 1){
      printf("Yes\n");
    }else{
      printf("No\n");
    }

  }
  return 0;
}

int func(int x){
  int y;
  y = (int) sqrt((double) x);
  if(y*y == x){
    return 1;
  }else{
    return 0;
  }
}


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

int a[1001];

int main(){
while(1){

    int n;
    cin >> n;
    if(n == 0) break;
    int ans = 0;
    for(int i=1; i < n; i++){
        int sum = 0;
        for(int j=i; sum <= n; j++){
            if(sum == n) ans++;
            //if(sum == n) cout << i << " " << j << endl;
            sum += j;
        }
    }
    if(n == 1) ans = 0;
    cout << ans << endl;
}
    return 0;
}



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

int main(void){
  int n,m,c,b[30],cnt=0;
  
  cin >> n >> m >> c;
  for (int i=0; i<m; i++) cin >> b[i];
  for (int i=0; i<n; i++){
    int a,res;
    res = 0;
    for (int j=0; j<m; j++){
      cin >> a;
      res += a*b[j];
    }
    if (res+c>0) cnt++;
  }
  cout << cnt << endl;
    
  return 0;
}
  

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

const int MOD=1e9+7;
ll facs[10001];
ll modExp(ll base, ll power) {
    if (power == 0)
        return 1;
    if(power%2==0)
		return modExp(( base * base) % MOD, power / 2);
	else
		return (base * (modExp(( base * base) % MOD, power / 2))%MOD);
}

ll modInv(ll base) {						//(a^-1)%MOD=(a^(m-2))%MOD
    return modExp(base, MOD-2);
}
void fact()
{
    facs[0]=1;
    for(int i=1;i<=10001;i++)
    {
        facs[i]=(facs[i-1]*i)%MOD;
    }
}
ll mul(ll A, ll B) {
    return (A*B)%MOD;
}
ll choose(ll a, ll b) {
    ll cur = facs[a];
    cur = mul(cur, modInv(facs[b]));
    cur = mul(cur, modInv(facs[a-b]));
    return cur;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    fact();
    int n,k;
    cin>>n>>k;
    int blue,red;
    ll x,y,z,w;
    for(int i=1;i<=k;i++)
    {
        blue=k-i;                /**<  //place i blue balls */
        red=n-k-(i-1);  /**<//place i-1 red balls in between thoseblue balls  */
        if(red<0)
        {cout<<0<<"\n"; continue;}
         x=choose(blue+i-1,i-1);         /**<//assign remaining blue balls into i groups  stars and bars*/
         y=choose(red+i,i);       /**<//assign remaining red balls into i-1 + 2(at both end) groups  stars and bars*/
            x=(x*y)%MOD;
        cout<<x<<"\n";
    }
    //code goes here
	return 0;
}


Measured memory_bytes: 384
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int K = input.nextInt();
		int[] dp = new int[15];
		dp[1]=2; //Minimum value after one operation even if K=1
		for (int i = 2; i <= N; i++)
			dp[i]=Math.min(dp[i-1]*2, dp[i-1]+K);
		System.out.println(dp[N]);
	}
}

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

int main() {
	int n,k,q;
	cin >> n>>k>>q;
	vector<int> ac(q);
	vector<int>per(n,k-q);
	
	for (int i=0;i<q;i++){
		cin >>ac.at(i);
	}
	
	for (int i=0;i<q;i++){
		per.at(ac.at(i)-1)++;
	}
	
	for(int i=0;i<n;i++){
		if (per.at(i)<=0){
			cout << "No"<< endl;
		}
		else {
			cout << "Yes"<<endl;
		}
	}
	
	
}


Measured memory_bytes: 1408
#%%
N, A, B = map(int, input().split())

p1 = 10e18
p2 = 10e18
p3 = 10e18
p4 = 10e18
p5 = 10e18

if (B - A) % 2 == 0:
    p1 = (B - A) // 2
else:
    p2 = B - 1 #左端による
    p3 = N - A # 右端による
    # Aを1回左端に寄せてから、折り返し
    p4 = (B - A) // 2 + A
    # Bを1回右端に寄せてから折り返し
    p5 = (-A + B -1) //2 + N -B + 1

print(min(p1, p2, p3, p4, p5))

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

int main(){
  map<int,int>mp;
  int n,m,s=1;
  cin >> n;
  r(i,n){
    cin >> m;
    mp[m]=i+1;
  }
  for(auto it=mp.begin();it!=mp.end();it++){
    if(s<n){
    cout << (*it).second<<" ";
    }
    else cout << (*it).second<<endl;  
    s++;
  }
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int a, b;
    cin >> a >> b;
    if(a*b % 2 == 0) cout << "No";
    else cout << "Yes";
}


Measured memory_bytes: 256
def checkDigit(a):
  while(a > 10):
    a %= 10
  return a
  
a = [int(input()) for i in range(5)]
calc = []
for i in range(5):
  tmp = checkDigit(a[i])
  if tmp != 0:
    calc.append(tmp)
calc.sort()

ans = sum(a)
for i in range(1, len(calc)):
  ans += 10 - calc[i]
print(ans)




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

using namespace std;

#define mx INT_MAX
#define N (int) 1e5+10
#define ll long long
int n ;
int h[N], dp[N];

int main()
{
	ios_base :: sync_with_stdio( false );
	cin.tie( nullptr );
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >>h[i];
	}
	
	dp[0] = 0;
	dp[1] = abs(h[0]-h[1]);
	
	for (int i = 2; i < n; i++)
	{
		dp[i] = min (dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i]));
	}

	cout << dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 1024
/*
Dont BLUNDER
*/
#include<bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


 */
#define d long double
#define int long long
#define pii pair<int,int>
#define pb push_back
#define endl '\n'
#define pi acos(-1)

#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod1 = 998244353;
int const mod = 1000000007;
#define l first
#define r second
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// * Using PBDS *
/*typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
               os; */



int modexp(int x, int n) {
	if (n == 0) {
		return 1;
	}
	else if (n & 1) {
		return (modexp((x * x) % mod, n / 2) % mod * x % mod) % mod;
	}
	else {
		return (modexp((x * x) % mod, n / 2) % mod);
	}
}

int modinv(int n)
{
	return modexp(n, mod - 2);
}

int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

int sz(int x) {
	int c = 0;
	while (x)
	{
		c++;
		x /= 10;
	}
	return c;
}
bool con(int a, int b)
{
	if (a >= b)
		return true;
	return false;
}



signed main()
{
	haha
#ifndef ONLINE_JUDGE

	freopen("inp.txt", "r", stdin);

	freopen("out.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	int f = 0;
	if (n % 2 == 0)
		cout << -1;
	else {
		int r = 0;
		int m = sz(n);
		int already = 0;
		int ans = 0;
		int bg = 1000000;
		while (bg--) {
			if (r > 0)
				already = sz(r);
			int req = m - already;
			ans += req;
			int tocomp = r * pow(10, req);
			for (int j = 0; j < req; j++) {
				tocomp += 7 * pow(10, j);
			}
			if (con(tocomp, n))
			{
				r = tocomp % n;
			}
			else {
				ans++;
				r = ((tocomp * 10 + 7) % n);
			}
			if (r == 0)
			{
				f = 1;
				break;
			}






		}
		if (f == 1)
			cout << ans;
		else
			cout << -1;







	}




}

Measured memory_bytes: 4040
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	A = inputList()

	A.sort()
	A = A[::-1]
	ans = 0
	maxs = 0
	cnt = 0
	fst = True

	ansans = []
	pgt = queue.Queue()
	for i,val in enumerate(A):
		if i == 0:
			pgt.put(val)
		else:
			tmp = pgt.get()
			ansans.append(tmp)

			pgt.put(val)
			pgt.put(val)
	print(sum(ansans))


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 117552
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(1e9+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


signed main() {
	int n, m, k;
	cin >> n >> m >> k;
	double nn = n, mm = m;
	if (k) {
		printf("%.12lf\n", (mm - 1)*(((nn - k) * 2)) / (nn*nn));
	}
	else {
		printf("%.12lf\n", (mm - 1)*(nn / (nn*nn)));
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int M, N, ans = 0; cin >>M >>N;
  REP(i, M){
    int cnt = 0;
    REP(j, N){
      int n; cin >>n;
      cnt += n;
    }
    ans = max(ans, cnt);
  }
  cout <<ans <<endl;
  return 0;
}

Measured memory_bytes: 1160
count = gets.to_i
nums = gets.chomp.split(" ").map(&:to_i);
is_approved = true
nums.each do |num|
  if num % 2 != 0
  elsif (num % 3 != 0 && num % 5 != 0)
    is_approved = false
    break
  end
end
print(is_approved ? "APPROVED" : "DENIED")

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cstdlib>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

map<pair<int, int>, ll>in;

int main()
{
	ll H, W, N; cin >> H >> W >> N;
	for (int i = 0; i < N; i++) {
		int x, y; cin >> x >> y;
		for (int i = -2; i <= 0; i++) {
			for (int j = -2; j <= 0; j++) {
				if (x + i <= 0 || y + j <= 0)continue;
				if (x + i > H - 2 || y + j > W - 2)continue;

				pair<int, int>co(x+i, y+j);
				if (in.find(co) == in.end())in[co] = 1;
				else in[co]++;
			}
		}
	}

	vector<ll>cnt(10);
	for (auto itr = in.begin(); itr != in.end(); itr++) {
		cnt[itr->second]++;
	}
	cnt[0] = (H - 2)*(W - 2) - in.size();
	for (int i = 0; i < 10; i++)cout << cnt[i] << endl;

    return 0;
}



Measured memory_bytes: 56448