akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
	int x;
  	cin>>x;
  if(x>=400&&x<600) cout<<8;
  else if(x>=600&&x<800) cout<<7;
    else if(x>=800&&x<1000) cout<<6;
    else if(x>=1000&&x<1200) cout<<5;
    else if(x>=1200&&x<1400) cout<<4;
    else if(x>=1400&&x<1600) cout<<3;
    else if(x>=1600&&x<1800) cout<<2;
    else if(x>=1800&&x<2000) cout<<1;
}

Measured memory_bytes: 3632
#include<cstdio>

void Print(int N){
    if(!N)
        return;
    if(N>0) Print(N/(-2));
    else Print((-N+1)/2);
    if(N%2) putchar('1');
    else putchar('0');
}

int main(){
    int N;
    scanf("%d",&N);
    if(N==0){
        putchar('0');
        return 0;
    }
    //printf("%d",N/(-2));
    Print(N);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main() {
    LL n;
    LL d;
    cin >> n >> d;
    vector<LL> x(n) , y(n);
    int cnt= 0;
    rep(i,n) cin >> x[i] >> y[i];
    rep(i,n) {
        if(d*d >= x[i]*x[i] + y[i]*y[i]) {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 6420
''' *3 or /2  '''
total = 0

N = list(map(int,input().split()))

ar = list(map(int,input().split()))


def forl(num):
    count = 0

    if num%2==1:
        return 0

    while num%2 is 0 and num>1:
        count+=1
        num//=2
    
    return count

'''total+=forl(2)
total+=forl(4)'''

for i in ar:
    total+=forl(i)

print(total)



Measured memory_bytes: 4148
import java.util.*

fun main(args:Array<String>){
    solve()
}

fun solve(){
    val n = readint()
    if(n % 1000 == 0) println(0)
    else println(1000 - n % 1000)
}



fun read() = readLine()!!
fun reads() = readLine()!!.split(" ")
fun readint() = readLine()!!.toInt()
fun readints() = readLine()!!.split(" ").map{it.toInt()}
fun readlong() = readLine()!!.toLong()
fun readlongs() = readLine()!!.split(" ").map{it.toLong()}



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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end(), greater<ll>());
    ll ans = 0;
    ll itr = 0;
    rep(i, 0, n-1){
        if(i % 2) itr++;
        ans += a[itr];
    }
    cout << ans << endl;
    return 0;
}

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

#define int long long

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	int R, S, P, ans = 0;
	cin >> R >> S >> P;
	string s, t;
	cin >> t;
	for (int i = 0; i < k; i++) {
		s = "";
		for (int j = i; j < n; j += k)
			s += t[j];
		int l = 0;
		for (int j = 0; j < s.size(); j++) {
			if (!j || s[j] == s[j - 1])
				l++;
			else
				l = 1;
			if (l % 2) {
				if (s[j] == 's')
					ans += R;
				else if (s[j] == 'p')
					ans += S;
				else
					ans += P;
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    int Z1=a%10;
    a=a/10;
    int Z=a%10;
    a=a/10;
    int Y=a%10;
    a=a/10;
    int X=a%10;
    if(X+Y+Z+Z1==7)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1<<"=7";

    }
    else  if(X-Y+Z+Z1==7)
    {
        cout<<X<<"-"<<Y<<"+"<<Z<<"+"<<Z1<<"=7";;

    }
    else  if(X+Y-Z+Z1==7)
    {
        cout<<X<<"+"<<Y<<"-"<<Z<<"+"<<Z1<<"=7";;

    }
     else  if(X+Y+Z-Z1==7)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"-"<<Z1<<"=7";;

    }
     else if(X-Y-Z+Z1==7)
    {
        cout<<X<<"-"<<Y<<"-"<<Z<<"+"<<Z1<<"=7";;
    }
      else if(X-Y+Z-Z1==7)
    {
        cout<<X<<"-"<<Y<<"+"<<Z<<"-"<<Z1<<"=7";;

    }
      else if(X+Y-Z-Z1==7)
    {
        cout<<X<<"+"<<Y<<"-"<<Z<<"-"<<Z1<<"=7";;

    }
      else if(X-Y-Z-Z1==7)
    {
        cout<<X<<"-"<<Y<<"-"<<Z<<"-"<<Z1<<"=7";;
    }
     /* else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }
      else if(X+Y+Z+Z1)
    {
        cout<<X<<"+"<<Y<<"+"<<Z<<"+"<<Z1;
        break;
    }*/
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int a, b, t;
  cin >> a >> b >> t;
  int ans = (t/a)*b;
  cout << ans << endl;
  return 0;
}


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

int main() {
    vector<int> vec(3);
    for(int i = 0; i < 3; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    if(vec.at(0) == 5 && vec.at(1) == 5 && vec.at(2) == 7) {
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
} 

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		long n=s.nextLong();

		long r=0;
		for(long i=1;i*(i+1)<n;++i) {
			if(n%i==0) {
				long v=i<n/i?n/i-1:i;
				r+=v;
				System.err.println(v);
			}
		}
		System.out.println(r);
	}
}

Measured memory_bytes: 23764
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int m = 0, f = 0, r = 0;
        String grade = "";

        while(true){
            m = num.nextInt();
            f = num.nextInt();
            r = num.nextInt();

            if(m == -1 && f == -1 && r == -1) {
                break;
            }else if(m == -1 || f == -1 || m + f < 30) {
                grade = "F";
            } else if(m + f >= 80) {
                grade = "A";
            } else if(m + f >= 65) {
                grade = "B";
            } else if(m + f >= 50) {
                grade = "C";
            } else if(m + f >= 30) {
                if(r >= 50) {
                    grade = "C";
                } else {
                    grade = "D";
                }
            }
            System.out.println(grade);
        }
    }
}


Measured memory_bytes: 26320
def main():
    N, K = map(int, input().split())
    S = input()
    ans = 0
    prev = ""
    for c in S:
        if c == prev:
            ans += 1
        prev = c
    ans = min(ans + 2*K, N-1)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 39484
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <unordered_map>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug "<< i << std::endl

//const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

// kmp をやるための前計算
std::vector<int> makeTable(const std::string& s) {
  int n = s.size();
  std::vector<int> ret(n + 1);
  ret[0] = -1;
  int j = -1;
  for (int i = 0; i < n; i++) {
    while (j >= 0 && s[i] != s[j]) j = ret[j];
    ret[i + 1] = ++j;
  }
  return ret;
}

// str の中に word とマッチする場所のリストを返す
// ret のそれぞれの要素 el は, 「str[el] からの文字列が word
// と一致する」ことを示す
std::vector<int> kmp(const std::string& str, const std::string& word) {
  std::vector<int> table = makeTable(word), ret;
  int m = 0, i = 0, n = str.size();
  while (m + i < n) {
    if (word[i] == str[m + i]) {
      if (++i == (int)(word.size())) {
        ret.push_back(m);
        m = m + i - table[i];
        i = table[i];
      }
    } else {
      m = m + i - table[i];
      if (i > 0) i = table[i];
    }
  }
  return ret;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  std::string s;
  std::cin>>s;

  ll left=0,right=n/2+1;

  while(right-left>1){
    ll mid=left+(right-left)/2;

    bool isok=false;

    rep(i,0,n-2*mid+1){
      std::string word=s.substr(i,mid),search=s.substr(mid+i);
      std::vector<int> temp=kmp(search,word);
      if(temp.size()){
        isok=true;
        break;
      }
    }

    if(isok)left=mid;
    else right=mid;
  }

  std::cout<<left;

  return 0;
}


Measured memory_bytes: 384
import java.io.*;
import java.util.*;
 
public class Main {
    static final long MOD = 1000000007L;
    //static final long MOD = 998244353L;
    static final int INF = 50000000;
    static final int NINF = -500000000;

    
    static long[] fac;
    static long[] invfac;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        int S = sc.ni();
        fac = new long[S+1];
        fac[0] = 1L;
        for (int i = 1; i <= S; i++)
        	fac[i] = (i*fac[i-1])%MOD;
        invfac = new long[S+1];
        invfac[S] = power(fac[S],MOD-2,MOD);
        for (int i = S-1; i >= 0; i--)
        	invfac[i] = ((i+1)*invfac[i+1])%MOD;
        
        long ans = 0;
        for (int t = 1; 3*t <= S; t++) {
        	int target = S-3*t;
        	//stars n bars
        	ans += choose(target+t-1,t-1);
        	ans %= MOD;
        }
        pw.println(ans);
        pw.close();
    }
    
    public static long choose(int n, int k) {
    	if (k < 0 || k > n)return 0;
    	long num = fac[n];
    	long denInv = (invfac[k]*invfac[n-k])%MOD;
    	return (num*denInv)%MOD;
    }
    
    //Fast exponentiation (x^y mod m)
    public static long power(long x, long y, long m) {
      long ans = 1;
      x %= m;
      while (y > 0) {
        if((y&1)==1)
          ans = (ans * x) % m;
        y /= 2;
        x = (x * x) % m;
      }
      return ans;
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 33028
#include <stdio.h>

typedef struct{
  char mark;
  int number;
}Card;
void merge(int ,int ,int );
void mergesort(int ,int );
int partition(int ,int );//return element of head(now)
void quicksort(int ,int );

Card Merge[100000],Quick[100000],Left[50001],Right[50001],temp,final;
int n;
int main(void){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&Merge[i].mark,&Merge[i].number);
    Quick[i].mark=Merge[i].mark;
    Quick[i].number=Merge[i].number;
  }
  mergesort(0,n);
  quicksort(0,n-1);

  i=0;
  while(i<n){
    if(Merge[i].mark!=Quick[i].mark){
      i=0;
      break;
    }
    i++;
  }

  if(i==n)printf("Stable\n");
  else printf("Not stable\n");

  i=0;
  while(i<n){
    printf("%c %d\n",Quick[i].mark,Quick[i].number);
    i++;
  }
  return 0;
}
void mergesort(int left,int right){
  int mid;
  if(right-left>1){
    mid=(left+right)/2;
    mergesort(left,mid);
    mergesort(mid,right);
    merge(left,mid,right);
  }
}
void merge(int left,int mid,int right){
  int n1=mid-left,n2=right-mid,i,j,k;
  for(i=0;i<n1;i++)
    Left[i]=Merge[left+i];
  for(i=0;i<n2;i++)
    Right[i]=Merge[mid+i];
  Left[n1].number=1000000001;
  Right[n2].number=1000000001;
  i=0;j=0;k=left;
  while(k<right){
    if(Left[i].number>Right[j].number)
      Merge[k++]=Right[j++];
    else Merge[k++]=Left[i++];
  }
}
void quicksort(int head,int last){
  int element;
  if(last-head>0){
    element=partition(head,last);
    quicksort(head,element-1);
    quicksort(element+1,last);
  }
}
int partition(int head,int last){
  int i,j;
  final=Quick[last];
  for(i=head;i<last;i++){
    if(Quick[i].number<=final.number){
      temp=Quick[head];
      Quick[head++]=Quick[i];
      Quick[i]=temp;
    }
  }
  temp=Quick[head];
  Quick[head]=Quick[last];
  Quick[last]=temp;
  return head;
}


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

int main() {
    ll W,a,b;
    cin >> W >> a >>b;
    ll ans;
    if(b>a+W){
        ans = b-(a+W);
    }else if(a >b+W){
        ans = a- (b+W);
    }else{
        ans =0;
    }
    cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;



int main(void) {
    ll N;
    cin >> N;
    string s;
    cin >> s;
    ll i, p;
    ll l[26]={}, r[26]={};
    
    for(i=0; i<s.size(); i++) {
        r[s[i]-'a']++;
    }
    
    
    //O(N)
    
    ll ans=0;
    for(i=0; i<s.size(); i++) {
        ll t=0;
        for(p=0; p<26; p++) {
            if(l[p]>0 && r[p]>0) t++;
        }
        
        ans=max(ans, t);
        
        l[s[i]-'a']++;
        r[s[i]-'a']--;
    }
    
    pt(ans);
    
}


Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#define lli long long int
#define mp make_pair
#define pb push_back
using namespace std;

const lli mod = 1e9 + 7;

lli power(lli x, lli y) {
    x %= mod;
    if (y == 0) return 1;
    return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2)) % mod;
    // return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2));
}

vector <long long int> primeNumbers;

void SieveOfEratosthenes(int n){
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++){ 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++){
      if (prime[p]){
        primeNumbers.push_back(p);
      }
    }        
}

vector < vector <lli> > matrixMultiply(vector < vector <lli > > a,vector < vector <lli> >b){
  int n = a.size();
  vector < vector< lli > > result(n);
  for(int i = 0;i<n;i++){
    for(int j = 0;j<n;j++){
      lli val = 0;
      for(int k = 0;k<n;k++){
        val += (a[i][k]%mod)*(b[k][j]%mod);
        val = val%mod;
      }
      result[i].push_back(val);
    }
  }
  return result;
}

vector < vector <lli> > identity(int n){
  vector < vector <lli> >result(n);
  for(int i = 0;i<n;i++){
    for(int j = 0;j<n;j++){
      if(i == j) result[i].push_back(1);
      else result[i].push_back(0);
    }
  }
  return result;
}

vector < vector <lli> > matrixPow(vector < vector <lli > > v, lli y){
  int n = v.size();
  if(y == 0) return identity(n);
  else{
    if(y%2 == 0){
      return matrixPow(matrixMultiply(v , v),y/2);
    }else{
      return matrixMultiply(v ,matrixPow(matrixMultiply(v , v),y/2));
    }
    // return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2)) % mod
  }
}


void pre(){
}

void solve(){
  lli n,k;
  cin>>n>>k;
  vector < vector <lli> > mat(n);
  for(int i= 0;i<n;i++){
    for(int j = 0;j<n;j++){
      int x;
      cin>>x;
      mat[i].push_back(x);
    }
  }
  mat = matrixPow(mat,k);
  int ans = 0;
  for(int i= 0;i<n;i++){
    for(int j = 0;j<n;j++){
      ans += mat[i][j];
      ans %= mod;
    }
  }
  cout<<ans;
}
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
 
  int t;
  // cin>>t;
  // scanf("%d",&t);
  t = 1;
  pre();
  while(t--){
    // cout<<
    solve();
 
    if(t>0){
      cout<<endl;
      // printf("\n");
    } 
  }
 
 
  cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
 
  return 0;
}


Measured memory_bytes: 8112
#include<stdio.h>
int main(void)
{
	int a,b,c,i;
	i=0;

	scanf("%d %d %d",&a,&b,&c);
	for(a;a<=b;a++){
		if(c%a==0){
			i=i+1;
		}else{
			i=i;
		}
	}
	printf("%d\n",i);

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define nmax 100005

using namespace std;
long long n,ans,i,x;
int main()
{
    cin>>n;
    ans=0;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        ans+=x-1;
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main( void )
{
	int t, h, m, s;
	scanf( "%d", &t);
	h = t / 3600;
	t = t % 3600;
	m = t / 60;
	s = t % 60;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}



Measured memory_bytes: 2768
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int, N);
    var(string, s);
    var(int, Q);

    while (Q--) {
        var(int, K);
        i64 d = 0;
        i64 m = 0;
        i64 dm = 0;
        i64 dmc = 0;

        rep(i, 0, K) {
            if (s[i] == 'D') {
                ++d;
            } else if (s[i] == 'M') {
                ++m;
                dm += d;
            } else if (s[i] == 'C') {
                dmc += dm;
            }
        }

        rep(i, K, N) {
            if (s[i - K] == 'D') {
                --d;
                dm -= m;
            } else if (s[i - K] == 'M') {
                --m;
            } else if (s[i - K] == 'C') {
            }

            if (s[i] == 'D') {
                ++d;
            } else if (s[i] == 'M') {
                ++m;
                dm += d;
            } else if (s[i] == 'C') {
                dmc += dm;
            }
        }

        print(dmc);
    }

    return 0;
}


Measured memory_bytes: 1948
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n, m;
    ll k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    vector<ll> acua(n+1), acub(m+1);
    acua[0] = acub[0] = 0;
    rep(i,n) acua[i+1] = acua[i] + a[i];
    rep(i,m) acub[i+1] = acub[i] + b[i];
    int ans = 0;
    int j = m;
    rep(i,n+1) {
        if (acua[i] > k) break;
        while (acub[j] > k - acua[i]) {
            j--;
            if (j < 0) break;
        }
        if (j < 0) j++;
        chmax(ans, i+j);
    }
    cout << ans << "\n";
    return 0;
}


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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  cout << max({a, b, c}) * 10 + (a + b + c - max({a, b, c})) << endl;

  return 0;
}


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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int n; cin >> n;
        string s; cin >> s;
        int ans = 0;
        for (int i = 0; i < n; i++) {
                ++ans;
                int j = i;
                while (j < n && s[i] == s[j]) j++;
                i = j - 1;
        }

        cout << ans;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3780
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for i in range(1,N+1):
    s += B[A[i-1]-1]
for i in range(1,N):
    if A[i] == A[i-1] + 1:
        s += C[A[i-1]-1]
print(s)


Measured memory_bytes: 3064
from operator import itemgetter
#入力
N = int(input())
red =[]
red_x = []
blue = []
blue_y = []
for i in range(N):
    a,b = map(int, input().split())
    red.append([a,b])
for i in range(N):
    c,d = map(int,input().split())
    blue.append([c,d])
#処理
#最もxの小さいblueとそいつで可能な最も大きいyをペアに
#blueをx座標昇順に
blue.sort(key = itemgetter(0))
#redをy座標降順に
red.sort(key = itemgetter(1),reverse = True)
count  = 0
for b in blue:
    for r in red:
        #可能なredを選び。降順になっているのでその中で最もyが大きいred
        if b[0]>=r[0] and b[1]>=r[1]:
                count +=1
                red.remove(r)
                break

print(count)


Measured memory_bytes: 3064
#include<iostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main()
{
	long long N, plis = 0;
	cin >> N;
	for (long long x = 1; x <= N; x++)
	{
		if (x % 3 != 0 && x % 5 != 0)plis += x;

	}
	cout << plis << endl;
	return 0;

}

Measured memory_bytes: 3624
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		Map<Integer, Integer> n = new TreeMap<>();
		for (int i = 0; i < N; i++) {
			Integer integer = sc.nextInt();
			if (n.containsKey(integer)) {
				int count = n.get(integer) + 1;
				n.put(integer, count);
			} else {
				n.put(integer, 1);
			}
		}
		int ans = 0;
		if (K < n.size()) {
			List<Map.Entry<Integer, Integer>> mapValuesList = new ArrayList<Map.Entry<Integer, Integer>>(n.entrySet());
			Collections.sort(mapValuesList, new Comparator<Map.Entry<Integer, Integer>>() {
				@Override
				public int compare(Entry<Integer, Integer> entry1, Entry<Integer, Integer> entry2) {
					return ((Integer) entry1.getValue()).compareTo((Integer) entry2.getValue());
				}
			});
			int diff = n.size() - K;
			for (int i = 0; i < diff; i++) {
				ans += (int) mapValuesList.get(i).getValue();
			}
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 94316
import numpy as np
from numba import njit

n = int(input())
A = list(map(int,input().split()))
q = int(input())
BC = [list(map(int,input().split())) for _ in range(q)]
A = np.array(A)

ans = sum(A)

#aの個数を管理するlist a_num
a_num = [0]*10**5
for  a in A:
    a_num[a-1]+=1

for bc in BC:
    change = bc[1]-bc[0]
    ans += change*a_num[bc[0]-1]
    a_num[bc[1]-1] += a_num[bc[0]-1]
    a_num[bc[0]-1] = 0
    print(ans)

Measured memory_bytes: 114164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n;
  cin>>n;
  for(i=0;i<n;i++){
    int a;
    cin>>a;
    if(a%2==0&&a%3!=0&&a%5!=0){
      cout<<"DENIED"<<endl;
      return 0;
    }
  }
  cout<<"APPROVED"<<endl;
}
  


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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll n, x, t; cin >> n >> x >> t;
  cout << ((n + x - 1) / x) * t << endl;

  return 0;
}



Measured memory_bytes: 3616
# ti+1 - ti >= abs(xi+1 - xi) + abs(yi+1 - yi)
# かつ ti+1 - ti + abs(xi+1 - xi) + abs(yi+1 - yi) % 2 == 0
N = int(input())
after = [0, 0, 0]
flag = True
for i in range(N):
    before = after
    after = list(map(int, input().split()))
    if after[0] - before[0] < abs(after[1] - before[1]) + abs(after[2] - before[2]) or (
            after[0] - before[0] + abs(after[1] - before[1]) + abs(after[2] - before[2])) % 2 == 1:
        print("No")
        flag = False
        break
    else:
        continue
if flag:
    print("Yes")


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

int sosu(int n){
	if(n==1)return 0;
	int i;
	for(i=2; i<=sqrt(n); i++){
		if(n%i==0)return 0;
	}
	return 1;
}

int main(){
	int a,d,n;
	int i,j,k,l,m;
	int cnt;

	while(1){
		scanf("%d %d %d",&a,&d,&n);
		if(a==0&&d==0&&n==0)break;
		cnt=0;
		while(cnt<n){
			if(sosu(a))cnt++;
			a+=d;
		}
		printf("%d\n",a-d);
	}

	return 0;
}

Measured memory_bytes: 600
#include<cstdio>
int main(){
	int a,b,c,d,i,j,k,l;
	double g;
	while(~scanf("%d",&a))
	{
		l=0;
		for(i=1;i<=a;i++)
		{
			g=i*1.08;
			if(g>=a&&g<a+1)
			{
				l=1;break;
			}
		}
		if(l==0)
		printf(":(\n");
		else
		printf("%d\n",i);
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	char in[5];
	while(~scanf("%s",in)){
		int exist[500]={};
		F(i,0,4) exist[in[i]]++;
		int cnt=0;
		F(i,0,500){
			if(exist[i]!=0) cnt++;
			if(exist[i]>2){
				puts("No");
				return 0;
			}
		}
		if(cnt>2) puts("No");
		else puts("Yes");
	}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

char S[202020];
int F[202020], L;
long long x[100], y[100], cntx[100][26], cnty[100][26], ans[26];

void go(int p, long long l, long long r)
{
	if (r <= L){
		while (l < r){
			ans[S[l]-'a']++;
			l++;
		}
		return;
	}

	long long w = 0;
	for (int k=0;;k++){
		long long a = (k%3==1?y[p]:x[p]);
		long long u = max(l, w);
		long long v = min(r, w+a);
		if (r <= w) break;
		if (v - u == a){
			if (k % 3 == 1) for (int k=0;k<26;k++) ans[k] += cnty[p][k];
			else for (int k=0;k<26;k++) ans[k] += cntx[p][k];
		}
		else if (u < v) go(p-1, u-w, v-w);
		w += a;
	}
}

int main()
{
	scanf("%s", S);

	int l = 0;
	while (S[l]) l++;
	L = l;

	int k = -1; F[0] = -1;
	for (int i=1;i<l;i++){
		while (k >= 0 && S[k+1] != S[i]) k = F[k];
		if (S[k+1] == S[i]) k++;
		F[i] = k;
	}

	int u = l-1;
	while ((u + 1) >= (l + 1) / 2) u = F[u];
	int r = l - (u + 1) * 2;

	const long long lim = (long long)1e18 + 10;
	int v = u+r;
	while ((v + 1) > (u + r + 1) / 2) v = F[v];
	for (int i=0;i<=v;i++) cntx[0][S[i]-'a']++;
	for (int i=v+1;i<=u+r-v-1;i++) cnty[0][S[i]-'a']++;
	x[0] = v + 1;
	y[0] = u+r-v-1 - v;

	int p = 1;
	while (1){
		for (int k=0;k<26;k++){
			cntx[p][k] = cntx[p-1][k] + cnty[p-1][k];
			cnty[p][k] = cntx[p-1][k];
		}
		x[p] = x[p-1] + y[p-1];
		y[p] = x[p-1];
		if (x[p] > lim) break;
		p++;
	}
	{
		long long l, r;
		scanf("%lld %lld", &l, &r);
		go(p, l-1, r);
	}
	for (int i=0;i<26;i++) printf("%lld%c", ans[i], i+1<26?' ':'\n');

	return 0;
}

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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { for (auto& _e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(8); } } pre__;



int main(void) {
	int N, X;
	cin >> N >> X;
	vec<int> L(N);
	for (int i = 0; i < N; ++i) {
		cin >> L[i];
	}

	vec<int> D(N + 1);
	D[0] = 0;
	for (int i = 1; i <= N; ++i) {
		D[i] = D[i - 1] + L[i - 1];
	}
	int ans = count_if(ALL(D), [X](int x) {return x <= X; });
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define loop(i,a,b) for(int (i)=(a);(i)<(b);++(i))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;

int c(int i){
  return i*100+i*10+i;
}


int main(void){
  int n;
  cin>>n;
  rep(i,10){
    if(n <= c(i)){
      cout<<c(i)<<endl;
      break;
    }
  }
}



Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp1 = [n] * (n+1)
for i in range(n+1):
    if i>=a[0]:
        dp1[i] = max(dp1[i],dp1[i-a[0]]-a[0]+b[0])
    if i>=a[1]:
        dp1[i] = max(dp1[i],dp1[i-a[1]]-a[1]+b[1])
    if i>=a[2]:
        dp1[i] = max(dp1[i],dp1[i-a[2]]-a[2]+b[2])
n=dp1[n]
dp2 = [n] * (n+1)
for i in range(n+1):
    if i>=b[0]:
        dp2[i] = max(dp2[i],dp2[i-b[0]]-b[0]+a[0])
    if i>=b[1]:
        dp2[i] = max(dp2[i],dp2[i-b[1]]-b[1]+a[1])
    if i>=b[2]:
        dp2[i] = max(dp2[i],dp2[i-b[2]]-b[2]+a[2])


print(dp2[n])

Measured memory_bytes: 230424
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^9
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int A,B;
    cin >> A >> B;

    for (int i = 1; i <= 1001; i++){
        int x = i * 0.08;
        int y = i * 0.1;
        // cout << x << " " << y << endl;
        if(x == A && y == B) {
            cout << i << endl;
            return 0;
        }
    }

    cout << "-1" << endl;
}


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

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

int main(void){
	int h[10];

	rep(i,10) cin>>h[i];
	sort(h,h+10);
	rep(i,3) cout<<h[9-i]<<endl;

	return 0;
}

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

using namespace std;

int main(){
  int h, a;
  cin >> h >> a;
  cin.ignore();

  if(h % a == 0){
    cout << h / a << endl;
  } else {
    cout << (h / a + 1) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	static boolean[] isPrime = new boolean[10000001];
	static int cnt=0;
	static int[] a = new int[664579];
	static{
		Arrays.fill(isPrime,true);
		isPrime[0]=isPrime[1]=false;
		for(int i = 4; i < isPrime.length;i+=2){
			isPrime[i]=false;
		}
		for(int i = 3; i*i<=isPrime.length;i+=2){
			if(isPrime[i]){
				for(int j = i+i; j < isPrime.length; j+=i){
					isPrime[j]=false;
				}
			}
		}

		for(int i = 0; i < isPrime.length;i++){
			if(isPrime[i]){
				a[cnt++]=i;
			}
		}
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int n = cin.nextInt();
			if(n==0){
				break;
			}

			int bs = Arrays.binarySearch(a, n);
			int start =0;
			if(bs<0){
				start = -2-bs;
			}
			else{
				start = bs;
			}
			for(int i = start; i >= 0; i--){
				if(a[i]-a[i-1]==2){
					if(a[i-1]-a[i-2]==4){
						if(a[i-2]-a[i-3]==2){
							System.out.println(a[i]);
							break;
						}
					}
				}
			}

		}
	}

}

Measured memory_bytes: 25000
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

template <class InputIterator, class T>
bool contains(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// =========ここまでテンプレ============

using route = vector<ll>;

int main()
{
    ll n, m, q;
    cin >> n >> m >> q;
    vector<array<ll, 4>> abcds;
    for (ll i = 0; i < q; i++)
    {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        --a;
        --b;
        abcds.push_back(array<ll, 4>{a, b, c, d});
    }
    vector<route> routes;
    stack<route> st;

    // DFS初期化
    for (ll i = 1; i <= m; i++)
    {
        st.push(vector<ll>{i});
    }

    //DFS実行
    while (!st.empty())
    {
        route rt = st.top();
        st.pop();
        if (rt.size() == n)
        {
            routes.push_back(rt);
        }
        else
        {
            for (ll i = *(--rt.end()); i <= m; i++)
            {
                route r2 = rt;
                r2.push_back(i);
                st.push(r2);
            }
        }
    }

    ll maxScore = 0;

    for (route r : routes)
    {
        ll tempScore = 0;
        for (array<ll, 4> abcd : abcds)
        {
            ll a = abcd[0];
            ll b = abcd[1];
            ll c = abcd[2];
            ll d = abcd[3];

            if (r[b] - r[a] == c)
            {
                tempScore += d;
            }
        }
        maxScore = max(tempScore, maxScore);
    }
    cout << maxScore;
}

// 最大組み合わせ数は19C9 = 92378

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

int main() {
  int X, A, B;
  cin >> X >> A >> B;
  string s = "dangerous";
  if (-A + B <= 0)
    s = "delicious";
  else if (-A + B <= X)
    s = "safe";
  cout << s << endl;
}


Measured memory_bytes: 256
x=list(int(input()) for _ in range(5))

import numpy as np

y=[0]*5

for i in range(5):
	if x[i]%10==0:
		y[i]=9
	else:
		y[i]=x[i]%10

res=0

for i in range(5):
	if i==np.argmin(y) or x[i]%10==0:
		res+=x[i]
	else:
		res+=x[i]+10-x[i]%10
  
print(res)

Measured memory_bytes: 12488
//  Author : Amit Kumar 

#include <iostream>
#include <algorithm> 
#include <string> 
#include <sstream>
#include <fstream>
#include <iomanip> 
#include <chrono> 
#include <numeric> 
#include <utility>
#include <functional>

#include <bitset>
#include <tuple>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <deque>
#include <list>


#include <climits>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdio>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace std::chrono;
//  using namespace placeholders;
using namespace __gnu_pbds;
template<typename TypeInfo>
using new_set = tree< 
/* ob.order_of_key(element) -> number of element strictly less than element
 * *ob.find_by_order(n) ->  nth element in increasing order
 */
         TypeInfo ,
         null_type ,
         less<TypeInfo> ,
         rb_tree_tag ,
         tree_order_statistics_node_update 
 > ;

void show_me() { cerr << endl; }
 
template <typename HEAD, typename... TAIL>
void show_me(HEAD H, TAIL... T) {
  cerr << " " << (H);
  show_me(T...);
}
 
#ifdef HELL_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "]:", show_me(__VA_ARGS__)
#else
#define show(...) 0
#endif
 
template<typename A, typename B>
ostream& operator<<(ostream&out, const pair<A, B>&p){
    out << p.first << ' ' << p.second ;
    return out;
}

template<typename A, typename B>
istream& operator>>(istream&in, pair<A, B>&p){
    in >> p.first >> p.second ;
    return in;
}

template<typename A> 
istream& operator>>(istream&in, vector<A>&vec){
    for(auto&itr:vec){
        in >> itr;
    }
    return in;
}

template<typename A>
ostream& operator<<(ostream&out,const vector<A>&vec){
    for(auto&itr:vec){
        out << itr <<' '; // VVV 
    }
    return out;
}

const int MAXM = (int)1e5+100;
const int MAXN = (int)1e5+100;
const int MOD  = (int)1e9+7;




signed main(void){
#ifdef HELL_JUDGE
    freopen("input","r",stdin);
    freopen("output","w",stdout);
    freopen("error","w",stderr);
#endif 
    ios::sync_with_stdio(false); // FLUSH THE STREAM IF USING puts / printf / scanf/
    cin.tie(nullptr);            //
    cout.tie(nullptr);           //
#ifdef HELL_JUDGE
    auto INITIAL_TIME = high_resolution_clock::now();
#endif 

    int n , k;  cin>> n >> k; 
    vector<int>v(n);
    cin >> v; 
    sort(v.begin() , v.end() );
    cout << accumulate(v.begin() , v.begin()+k , 0ll) << '\n'; 

#ifdef HELL_JUDGE
    auto FINAL_TIME = high_resolution_clock::now();
    cout << "Time : "
         << duration_cast<milliseconds>(FINAL_TIME-INITIAL_TIME).count() 
         << " ms" << '\n'; 
#endif 
    return 0;
}


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

int main() {
    ll N;
    vector<ll> maxs(5);
    cin >> N;
    rep(i, 5) cin >> maxs[i];

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

    ll res = 5;
    if(N%maxs[0]) res += ll(N/maxs[0]);
    else if(N > maxs[0]) res += N/maxs[0] - 1;

    cout << res << endl;
    return 0;

}

Measured memory_bytes: 256
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
int ret;
bool used[105]={};
vector<int>edge[105];
void rec(int a,int b)
{
	ret=max(ret,b);
	for(int i=0;i<edge[a].size();i++)
	{
	
		if(!used[edge[a][i]])
		{
			used[a]=true;
			rec(edge[a][i],b+1);
			used[a]=false;
		}
	}
}
int main()
{
	while(1)
	{
		
		int n;
		ret=0;
		for(int i=0;i<105;i++) edge[i].clear();
		scanf("%d",&n); if(!n) return 0;
		for(int i=0;i<n;i++)
		{
			int a,b;
			scanf("%d %d",&a,&b);
			edge[a].pb(b);
			edge[b].pb(a);
		}
		for(int i=1;i<=100;i++)
		{
			memset(used,0,sizeof(used));
			rec(i,1);
		}
		printf("%d\n",ret);
	}
}

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

template<typename T>
void chmin(T &a,T b){
  if(a>b||!a)a=b;
}
using ll=long long;
ll dp[500][500],wa[500],v[500];
ll f(int l,int r){
  if(~dp[l][r])return dp[l][r];
  ll res=0;
  for(int i=l+1;i<r;i++)chmin(res,f(l,i)+f(i,r));
  return dp[l][r]=res+wa[r]-wa[l];
}

signed main(){
  memset(dp,-1,sizeof(dp));
  int n;cin>>n;
  for(int i=0;i<n;i++)cin>>v[i];
  for(int i=0;i<n;i++)wa[i+1]=wa[i]+v[i];
  cout<<f(0,n)-wa[n]<<endl;
}


Measured memory_bytes: 2176
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

int Num_P;
int target;

int getMin(int flag[],int pi,int Num_Q[],int Comp_P[]){
    int tmp_min;
    if(pi==Num_P){
        int get_p=0;
        int count=0;
        for( int pi = 0 ; pi < Num_P ; pi++ ){
            count+= flag[pi] * Num_Q[pi];
            get_p+= flag[pi] * (Num_Q[pi] * (pi+1) * 100 + Comp_P[pi]);
        }
        if(get_p >= target) return count;
        else{
            int tmp_p=0;
            int tmp_num;
            for( int pi = 0 ; pi < Num_P ; pi++ ){
                if(tmp_p < (1-flag[pi])*(pi+1)*100){
                    tmp_p = (1-flag[pi])*(pi+1)*100;
                    tmp_num = Num_Q[pi] - 1;
                }
            }
            //cout << get_p <<" " << tmp_p << ":" << tmp_num << ":"    << endl;
            if(tmp_p==0) return 1000000;
            else if( (target - get_p) > (tmp_p * tmp_num) ) return 100000;
            else{
                //cout << count << endl;
                if((target - get_p) % tmp_p==0)
                    return (target - get_p) / tmp_p + count;
                else
                    return (target - get_p) / tmp_p + 1 + count;
            }
        }
    }else{
        flag[pi] = 1;
        tmp_min = getMin(flag,pi+1,Num_Q,Comp_P);
        flag[pi] = 0;
        return min(tmp_min,getMin(flag,pi+1,Num_Q,Comp_P));
    }

}


int main(){

    cin >> Num_P;
    cin >> target;
    int Num_Q[Num_P];
    int Comp_P[Num_P];

    int tmp;
    for( int qi = 0 ; qi < Num_P ; qi++ ){
        cin >> tmp;
        Num_Q[qi]=tmp;
        cin >> tmp;
        Comp_P[qi]=tmp;
    }
    int pi = 0;
    int flag[20]={};
    cout << getMin(flag,pi,Num_Q,Comp_P);
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"os"
	"strconv"
	"sort"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func nextString() string {
	if !sc.Scan() {
		panic("failed scan string")
	}
	return sc.Text()
}

func nextInt() int {
	if !sc.Scan() {
		panic("failed scan int")
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	list := make([]int, 3)

	for i := 0; i < 3; i ++ {
		list[i] = nextInt()
	}
	sort.Ints(list)

	sum := (list[2] - list[1]) + (list[1] - list[0])
	fmt.Println(sum)
}


Measured memory_bytes: 640