akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18
 
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

signed main() {
    int a[5], k;

    for(int i = 0; i < 5; ++i) cin >> a[i];
    cin >> k;
    for(int i = 0; i < 5; ++i) {
        for(int j = 0; j < 5; ++j) {
            if(abs(a[i] - a[j]) > k) {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}

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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e6+5;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++) {
		cin>>arr[i];
	}
	int dp[k+1];
	int ndp[k+1];
	memset(dp, 0, sizeof(dp));
	dp[0]=1;
	for(int i=0;i<n;i++) {
		ndp[0]=dp[0];
		for(int i=1;i<=k;i++) {
			ndp[i]=dp[i]-dp[i-1];
		}
		for(int j=0;j<k;j++) {
			int ll = j+1;
			int rr = min(k, j+arr[i]);
			ndp[ll]+=dp[j];
			if(rr+1<=k)
				ndp[rr+1]-=dp[j];
		}
		dp[0]=ndp[0];
		for(int i=1;i<=k;i++) {
			dp[i]=(dp[i-1]+ndp[i]+MOD)%MOD;
		}
	}

	cout<<dp[k];

	return 0;
}

Measured memory_bytes: 5204
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lint;
typedef double ld;

void a();void b();void c();void d();void e();void f();

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

	a();
	// b();
	// c();
	// d();
	// e();
	// f();
	return 0;
}

void a(){
	int n;
	cin >> n;
	n %= 10;
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)puts("hon");
	else if(n == 3)puts("bon");
	else puts("pon");

}

void b(){

}

void c(){

}

void d(){

}

void e(){

}

void f(){

}

Measured memory_bytes: 3644
# ABC114

N = int(input())
def dfs(num):
    if num > N:
        return 0
    flag = True
    for s in "357":
        if str(num).count(s) >= 1:
            pass
        else:
            flag = False
    ret = 1 if flag else 0

    for c in [3, 5, 7]:
        ret += dfs(num * 10 + c)
    return ret
ans = dfs(0)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	static int[] lengthes;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		lengthes = new int[n];
		for(int i = 0; i < n; i++){
			lengthes[i] = sc.nextInt();
		}
		Pattern.setN(n);
		Pattern.setLengthes(lengthes);
		int p = (int)Math.pow(4, n);
		int minMP = Integer.MAX_VALUE;
		for(int i = 0; i < p; i++){
			Pattern pat = new Pattern(i);
			minMP = Math.min(minMP, pat.calcMP(a, b, c));
		}
		System.out.println(minMP);
	}
}
class Pattern{
	static int num;
	static int[] lengthes;
	static void setN(int n){
		num = n;
	}
	static  void setLengthes(int[] lengthes){
		Pattern.lengthes = lengthes;
	}
	int aLength = 0;
	int bLength = 0;
	int cLength = 0;
	boolean flag = true;
	int mp = -30;
	Pattern(int p){
		for(int i = 0; i < num; i++){
			int q = (int) (p / Math.pow(4, i)) % 4;
			switch(q){
				case 0: aLength += lengthes[i]; mp += 10; break;
				case 1: bLength += lengthes[i]; mp += 10; break;
				case 2: cLength += lengthes[i]; mp += 10; break;
			}
		}
		if(aLength == 0 || bLength == 0 || cLength == 0){
			flag = false;
		}
	}
	int calcMP(int a, int b, int c){
		if(flag){
			return mp + Math.abs(a - aLength) + Math.abs(b - bLength) + Math.abs(c - cLength);
		}else{
			return Integer.MAX_VALUE;
		}
	}
}

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

int counts = 0;
const int SENTINEL = 1000000005;

template<typename T>
void merge(vector<T> & A, int left, int mid, int right){
    auto n1 = mid - left;
    auto n2 = right - mid;
    vector<T> L(n1);
    vector<T> R(n2);
    copy(A.begin() + left, A.begin() + mid  , L.begin());
    copy(A.begin() + mid , A.begin() + right, R.begin());
    L.push_back(SENTINEL);
    R.push_back(SENTINEL);
    auto itL = L.begin();
    auto itR = R.begin();
    for (auto itA = A.begin() + left; itA != A.begin() + right; ++itA){
        if (*itL <= *itR){
            *itA = *itL;
            ++itL;
        }else{
            *itA = *itR;
            ++itR;
        }
    }
    counts += right - left;
}

template<typename T>
void merge_sort(vector<T> & A, int left, int right){
    if (left + 1 < right){
        auto mid = (left + right) / 2;
        merge_sort(A, left, mid);
        merge_sort(A, mid, right);
        merge(A, left, mid, right);
    }
}


int main()
{
    ios::sync_with_stdio(false);
    int n = 0;
    cin >> n;
    vector<int> A(n);
    for (auto & element : A) cin >> element;
    merge_sort(A, 0, n);
    cout << *A.begin();
    for (auto it = A.begin() + 1; it != A.end(); ++it) cout << ' ' << *it;
    cout << endl;
    cout << counts << endl;
    return 0;
}

Measured memory_bytes: 8640
while(1):
    m,f,r=map(int,input().split())
    if m==-1&f==-1&r==-1:
        break
    else:
        if (m==-1)|(f==-1):
            print('F')
        elif m+f>=80:
            print('A')
        elif m+f>=65:
            print('B')
        elif m+f>=50:
            print('C')
        elif m+f>=30:
            if r>=50:
                print('C')
            else:
                print('D')
        else:
            print('F')



Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, q; cin >> a >> b >> q;
  vector<long long> aa(a), bb(b);
  for(long long & i : aa) cin >> i;
  for(long long & i : bb) cin >> i;
  while(q--){
	long long x; cin >> x;
    vector<long long> wa, wb;
    int pta = lower_bound(aa.begin(), aa.end(), x) - aa.begin();
    if(pta < a) wa.push_back(aa[pta]);
    if(pta) wa.push_back(aa[pta-1]);
    int ptb = lower_bound(bb.begin(), bb.end(), x) - bb.begin();
    if(ptb < b) wb.push_back(bb[ptb]);
    if(ptb) wb.push_back(bb[ptb-1]);
    long long ans = 1ll<<62;
    for(long long ca : wa){
      for(long long cb : wb) {
		long long mi = min(ca, cb), ma = max(ca, cb);
		mi = min(mi, x);
        ma = max(ma, x);
        ans = min(ans, ma - mi + min(ma - x, x - mi));
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2944
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N == 1){
			System.out.println("Hello World");
		}else if(N == 2){
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println(A+B);
		}
		return;
	}
}

Measured memory_bytes: 22740
N = int(raw_input())
A = map(int,raw_input().split())
print ' '.join(map(str,A))
for i in range(1,N):
    v = A[i]
    j = i - 1
    while j >=0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print ' '.join(map(str,A))

Measured memory_bytes: 4220
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int count = -1;
      while(n >= 0){
      	n = n - 3;
        count++;
      }
      System.out.println(count);
      sc.close();
    }
}


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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int n;
int m;
int cnt;
int p[10];
int adj[10][10];

void dfs(int pos, int mask) {
//	cout << pos << " " << mask << "\n";
	if (pos==n) {
		int c = 0;
		for (int i = 0; i < n-1; i++) {
			if (adj[p[i]][p[i+1]]==0) {
				c++;
				break;
			}
		}
		if (c==0) {
			cnt++;
		}
	}
	for (int i = 0; i < n; i++) {
		if ((mask & (1 << i)) != 0) {
			p[pos] = i;
			dfs(pos + 1, (mask ^ (1 << i)));
		}
	}
}

int main()
{
	cin >> n >> m;
	memset(p, 0, sizeof(p));
	cnt = 0;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		adj[a][b]=1;
		adj[b][a]=1;
	}
	dfs(1, (1 << n) - 2);
	cout << cnt << "\n";
}


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

bool solve(int i, int n){
  int sum=0;
  for( ; sum<n; i++){
    sum+=i;
    if(sum==n)return true;
  }
  return false;
}

int main(){
  while(true){
    int N;
    cin>>N;
    if(N==0)break;
    int ans=0;
    for(int i=1; i<N; i++){
      if(solve(i, N))ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

int main(){
  int n, m, q;
  cin >> n >> m >> q;
  
  vector<vector<int>> s(n + 1, vector<int>(n + 1, 0));
  
  for(int i = 0; i < m; i++){
    int l, r;
    cin >> l >> r;
    
    s[l][r]++;
  }
  
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      s[i][j] += s[i][j - 1];
    }
  }
  
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      s[i][j] += s[i - 1][j];
    }
  }
  
  for(int i = 0; i < q; i++){
    int l, r;
    cin >> l >> r;
    cout << s[r][r] + s[l - 1][l - 1] - s[r][l - 1] - s[l - 1][r] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//全探索として？N^3　ギリ間に合わなそう
//sortして、lower_boundでいけるか
//累積和のほうがはやそう
//3,5 ときたら、もう1個は、3+5=8未満、7以下
//                       かつ5-3+1 で3以上
//1,3だったら、1+3-1=3以下
//            3-1+1=3以上
//1,2だったら　2以下、2以上
//自分が2のときに2をつかってしまっているのか
//lowerでいくか。
//N^2でいけるか
int main(){
  ll N; cin>>N;
  vector<ll> T(1001,0), K(0,0);
  for(int i=0; i<N; i++){
    ll L; cin>>L;
    T[L]++;      
    K.emplace_back(L);
  }
  sort(K.begin(), K.end());
  for(int i=1; i<=1000; i++) T[i]+=T[i-1];
  ll ans=0;
  //{1,2,3,4}
  //1,2のとき、2以下かつ1以上
  //T[2]-T[0]
  //1,3のとき、3以下かつ2以上
  //T[3]-T[1]
  //T[3]=3だけど、1,3は使ってるから-2
  //T[1]=1だけど1は使ってるから0
  //いやいや、K[j]以降のものだけとればよくね
  //もし3,3,3,3とかだった場合？
  //やっぱ累積和むずかしいかも。
  //取り除いてはlower_boundしたいんだが
  //ああ、探索する範囲を狭めればいいのか
  //1,3,5,5,5,6,9
  for(int i=0; i<N-1; i++){
    for(int j=i+1; j<N; j++){
      ll up=K[i]+K[j];
      ans+=lower_bound(K.begin()+j+1, K.end(), up)-(K.begin()+j+1);
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;


int main() {
    int H1, M1, H2, M2, K;
    int before, after, diff, result;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    before = H1*60 + M1;
    after = H2*60 + M2;
    diff = after - before;
    if (diff - K <= 0)
    {
        result = 0;
    }
    else
    {
        result = diff - K;
    }
    
    cout << result << endl;
}


Measured memory_bytes: 3592
n = int(input())
h = list(map(int, input().split()))

l = []
for i in range(n):
    tmp = h[i]
    l.append(h[i])
    for j in range(n):
        h[j] -= tmp
        
ans = 0
for i in l:
    if i > 0:
        ans += i

print(ans)

Measured memory_bytes: 38512
import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int,input().split()))
def inpm():
    return map(int,input().split())

n,k =map(int,input().split())

a=[1] + inpl()
b=[-1] * (n+1); b[1] = 0
place = 1
turn = 0

while b[a[place]] == -1:
    place = a[place]
    turn += 1
    b[place] = turn
r = (k - turn) % (b[place] - b[a[place]] + 1)

if k < turn:
    print(b.index(k))
else:
    for _ in range(r):
        place = a[place]
    print(place)



Measured memory_bytes: 31064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  cin >> str;
  if(str.at(0)==str.at(1)||str.at(1)==str.at(2)||str.at(2)==str.at(3)){
    cout<<"Bad";
  }
  else{
    cout<<"Good";
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>

using namespace std;

int main(){
	int h,w;
	cin >> h >> w;
	char a[h][w];
	char c1[h][w];
	char c2[h][w];
	
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> a[i][j];
			c1[i][j]=a[i][j];
			c2[i][j]=a[i][j];
		}
	}
	
	for(int i=0;i<h;i++){
		bool f=true;
		for(int j=0;j<w;j++){
			if(a[i][j]=='#')f=false;
		}
		if(f==true){
			for(int x=0;x<w;x++){
				c1[i][x]='A';
			}
		}
	}
	
	for(int i=0;i<w;i++){
		bool f=true;
		for(int j=0;j<h;j++){
			if(c2[j][i]=='#')f=false;
		}
		if(f){
			for(int x=0;x<h;x++){
				c2[x][i]='B';
			}
		}
	}
	
	for(int i=0;i<h;i++){
		if(c1[i][0]=='A')continue; 
		for(int j=0;j<w;j++){
			if(c2[i][j]=='B')continue;
			cout << a[i][j];
		}
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = GetNumber();
            Console.WriteLine(num * num * num);
        }

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static List<int> GetNumbers()
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
        }

        static List<string> GetStrings()
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }
    }
}

Measured memory_bytes: 9408
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {

			String s = sc.next();

			int count = 0;
			int len = s.length();
			char[] sArray = s.toCharArray();
			int[] residuals = new int[2019];
			for(int i = 0 ; i <len ; i++ ) {
				
				int current = (int)sArray[i] - 48;
//				System.out.println("## " + current);
				
				int[] newResiduals = new int[2019];
				for(int j = 0 ; j < 2019 ; j++ ) {
					int num = j * 10 + current;
					int newResidual = num % 2019;
					newResiduals[newResidual] += residuals[j];
				}
				newResiduals[current]++;
				residuals = newResiduals;
				
				count += residuals[0];
			}
			
			System.out.println(count);
		}
	}

}

Measured memory_bytes: 56836
#include <iostream>
using namespace std;
int main () {
	int a,b,c;
	cin >> a >> b >> c;
	int count = 0;
	for (int i = a; i<=b ; i++ ) { 
	if (c % i == 0) {
		count++;
		}
	}
	cout << count <<endl;
	return 0;
}



Measured memory_bytes: 3088
#include <iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  
  int p[n];
  int M=0;
  int index;
  for(int i=0;i<n;i++){
    cin>>p[i];
    if(p[i]>M){
      M = p[i];
      index = i;
    }
  }
  
  int ans=0;
  for(int i=0;i<n;i++){
    if(i==index){
      ans+=p[i]/2;
    }else{
      ans+=p[i];
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

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

int main(void) {
    int a, b, c;

    cin >> a >> b >> c;

    if (a == b && b == c) {
        cout << 1 << endl;
    } else if (a == b || b == c || a == c) {
        cout << 2 << endl;
    } else {
        cout << 3 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    b = list(map(int, input().split()))
    a = [0]*(n+1)
    for i in range(n):
        a[i+1] = b[i]
    for i in range(n+1):
        if 0 < i:
            a[i] += a[i-1]
        a[i] %= k
    for i in range(1, n+1):
        a[i] = (a[i] - (i%k) + k) % k
    dic = {}
    ans = 0
    l, r = 0, 0
#    print(a)
    while r < n+1:
        x = a[r]
        if k <= r-l:
            dic[a[l]] -= 1
            l += 1
        if x in dic.keys():
            ans += dic[x]
            dic[x] += 1
        else:
            dic[x] = 1
#        print(l, r)
        r += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 40484
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  int N,A,B;
  cin>>N>>A>>B;
  int ans=0;
  for(int i=1;i<=N;i++){
    int C=0,co=i;
    for(int j=0;j<5;j++)C+=co%10,co/=10;
    if(A<=C&&C<=B)ans+=i;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n;
	cin >> n;
	map<int, int> mp;
	REP(i, n)
	{
		int a; cin >> a;
		mp[a]++;
	}
	int ans = mp.size();
	int cnt = 0;
	for (auto i : mp)
	{
		cnt += i.second - 1;
	}
	if (cnt % 2 == 1) ans--;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;

bool sort_sec(const pair<int,int> &a,const pair<int,int> &b){
   if(a.second<b.second){
      return true;
   }
   return false;
}

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

int main(void){
   int N,M;
   cin>>N>>M;
   vector<int> A(N);
   for(int i=0;i<N;i++){
      cin>>A[i];
   }
   priority_queue<int> que;
   for(int i=0;i<N;i++){
      que.push(A[i]);
   }

   while(M!=0){
      M=M-1;
      int v=que.top();
      que.pop();
      int mv=v/2;
      que.push(mv);
   }
   long long ans=0;
   for(int i=0;i<N;i++){
      ans+=que.top();
      que.pop();
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 1276
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>

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

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

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<double> t(N); rep(i,N) std::cin >> t[i];
  std::vector<double> v(N); rep(i,N) std::cin >> v[i];

  double ret = 0, sp = 0;
  rep(i,N) {
    for(double j=0; j<t[i]; j+=0.5) {
      bool flag1 = true, flag2 = true;
      double ti = t[i]-j-0.5;
      for(int k=i+1; k<N; k++) {
        ti += t[k];
        if(sp+0.5-ti > v[k+1]) flag1 = false;
        if(sp-v[k+1] > ti) flag2 = false;
      }
      if(sp+0.5 <= v[i] && flag1 && (sp+0.5-(t[i]-j-0.5)) <= v[i+1]) {
        ret += sp*0.5;
        ret += 0.125;
        sp += 0.5;
      } else if(sp - v[i+1] <= t[i]-j-0.5 && flag2) {
        ret += sp*0.5;
      } else {
        sp -= 0.5;
        ret += sp*0.5;
        ret += 0.125;
      }
    }
  }
  std::cout << std::fixed << std::setprecision(12) << ret << std::endl;
  return 0;
}


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

int main( void )
{
	int n;
	while ( cin >> n )
	{
		for ( int i = 0; i < n ; i++ )
		{
			int cnt = 0;
			int point = 0;
			int runner = 0;
			int out = 0;
			while ( out < 3 && cnt < 100 )
			{
				cnt ++;
				string in;
				cin >> in;

				if ( in == "HIT" )
				{
					if ( runner == 3 )
						point ++;
					else
						runner++;
				}
				else if ( in == "HOMERUN" )
				{
					point += runner + 1;
					runner = 0;
				}
				else if ( in == "OUT" )
				{
					out ++;
				}
			}

			cout << point << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
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 All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> dist(10, vector<int>(10));
    rep(i, 10) rep(j, 10) { cin >> dist[i][j]; }
    for(int k = 0; k < 10; k++) {
        for(int i = 0; i < 10; i++) {
            for(int j = 0; j < 10; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    int res = 0;
    rep(i, H) rep(j, W) {
        int a;
        cin >> a;
        if(a != -1) {
            res += dist[a][1];
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int W, A, B;
	int ans;
	scanf("%d%d%d", &W, &A, &B);

	if ((A + W) < B) {
		ans = B - (A + W);
	}
	else if ((B + W) < A) {
		ans = A - (B + W);
	}
	else {
		ans = 0;
	}
	printf("%d\n", ans);


#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);

		int A=sc.nextInt();
		int B=sc.nextInt();
		int T=sc.nextInt();

		int ans=0;

		int t=0;

		while(true) {

			t+=A;
			if(T+0.5<=t) break;

			ans+=B;

		}

		System.out.println(ans);

		sc.close();

	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	string s,onesside;
	unsigned long long  k;
	int ans,ones = 0;

	cin >> s >> k;


	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			ones++;
		}
		else {
			//cout << "not One! : " << s[i] << endl;
			onesside = s[i];
			break;
		}
	}
	//cout << "ones : " << ones << endl;

	if (k <= ones) {
		ans = 1;
	}
	else {
		ans = atoi(onesside.c_str());
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

signed main()
{
    int cnt[4] = {};

    string s;
    cin >> s;
    rep(i, s.size()) {
        if (s[i] == 'N') cnt[0]++;
        if (s[i] == 'S') cnt[1]++;
        if (s[i] == 'W') cnt[2]++;
        if (s[i] == 'E') cnt[3]++;
    }

    if (cnt[0] >= 1 && cnt[1] >= 1 && cnt[2] == cnt[3] && cnt[2] == 0) {
        cout << "Yes\n";
        return 0;
    }
    
    if (cnt[2] >= 1 && cnt[3] >= 1 && cnt[0] == cnt[1] && cnt[1] == 0) {
        cout << "Yes\n";
        return 0;
    }

    if (cnt[0] >= 1 && cnt[1] >= 1 && cnt[2] >= 1 && cnt[3] >= 1) {
        cout << "Yes\n";
        return 0;
    }

    cout << "No\n";
}


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

using namespace std;

string findLCS( string s1, string s2) {
	int n = s1.length(), m = s2.length();
	int lcs[n + 1][m + 1]{};
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if( i == 0 || j == 0) {
                lcs[i][j] = 0;  
            } 
            else if (s1[i-1] == s2[j-1]) {
                lcs[i][j] = lcs[i-1][j-1] + 1;
            }
            else {
                lcs[i][j] = max(lcs[i - 1][j], lcs[i][j - 1]);
            }
        }
    }
    string ans = "";
    int i = n, j = m;
    while( i > 0 && j > 0){
        if (s1[i - 1] != s2[j - 1]) {
            if (lcs[i - 1][j] > lcs[i][j - 1]){
                i--;  
            } 
            else{
                j--;  
            } 
        }
        else {
            ans += s1[i - 1];
            i--;
            j--;
        }
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int main(){
	string s1, s2;
    cin >> s1 >> s2;
	cout << findLCS( s1, s2);
  	return 0;
}

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

using namespace std;
using ll = long long;

int main()
{
  int n;
  ll res=0, x;
  cin >> n >> x;
  n--;
  ll pre;
  cin >> pre;
  while (n--) {
    ll now;
    cin >> now;
    if (now + pre > x) {
      res += now + pre - x;
      pre = max(x - pre, 0LL);
    } else {
      pre = now;
    }
  }
  cout << res << endl;
}


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

int main(){
int N;
  cin>>N;
  vector<int>l(N),r(N);
  int sum=0;
  for(int i=0; i<N; i++){
   cin>>l[i]>>r[i];
   sum+=r[i]-l[i]+1;
  }
  
  cout<<sum;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int v[MAXN];
char s[MAXN];
int main(){
    string str;
    cin>>str;
    if(str.size()%2){cout<<"No";return 0;}
    int flag=1;
    for(int i=0;i<str.size();i++){
        if(i%2==1&&str[i]!='i')flag=0;
        if(i%2==0&&str[i]!='h')flag=0;
    }
    if(flag)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){ string S; cin >> S;
int alphabet[26] = {0};
 for(int i = 0; i < S.size(); i++){
      alphabet[S[i] - 'a']++;}
           for(int i = 0; i < 26; i++){
             if(alphabet[i] == 0){  char x = 'a' + i; cout << x << endl; return 0;}}
           
           cout << "None" << endl;
           return 0;}

Measured memory_bytes: 512
import sys

def print_arr(arr):
	for i in range(len(arr)):
		sys.stdout.write(str(arr[i]))
		if i != len(arr) - 1:
			sys.stdout.write(' ')
	print()

n = int(input())
arr = list(map(int, input().split()))

for i in range(n):
	key = arr[i]
	j = i - 1
	while j >= 0 and arr[j] > key:
		arr[j + 1] = arr[j]
		j -= 1
	arr[j + 1] = key
	print_arr(arr)



Measured memory_bytes: 5992
def b_sort(A):
    flg = True
    swap = 0
    while flg:
        flg = False
        for j in range(len(A) - 1,0,-1):
            if A[j] < A[j-1]:
                A[j],A[j-1] = A[j-1],A[j]
                swap += 1
                flg = True
    return swap

if __name__=='__main__':
    N = int(input())
    A = list(map(int,input().split()))
    swap = b_sort(A)
    print(*A)
    print(swap)



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

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(string, S);
    int temp = 0, ans = 0;

    for (int i = 0; i <= S.size(); i++) {
        if ( i < S.size() && ( S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T' ) ) {
            temp++;
        } else {
            ans = max(ans, temp);
            temp = 0;
        }
    }

    cout << ans << "\n";
    return 0;
}

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

int main() {
int A,B;
  cin>>A>>B;
  int i,sum;
    for(i=A;i<=B;i++){
      if(i%10==i/10000 && i/10%10==i/1000%10)sum++;
        else;
        }
  cout<<sum<<endl;
}
  

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

const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int mn = 101, mx = -101;
  for (int &i : a) {
    cin >> i;
    mn = min(i, mn);
    mx = max(i, mx);
  }
  int mincost = INT_MAX;
  for (int i = mn; i <= mx; i++) {
    int cost = 0;
    for (int j : a) {
      cost += (j-i) * (j-i);
    }
    mincost = min(cost, mincost);
  }
  cout << mincost << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll n,presum[405],a[405],dp[405][405];

ll PreSum(ll l,ll r){
	return presum[r]-presum[l-1];
}

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n;
	forn(i,1,n+1){
		cin>>a[i];
		presum[i]=presum[i-1]+a[i];
	}
	for(ll l=n;l>=1;l--){
		for(ll r=l;r<=n;r++){
			if(l==r)
				dp[l][r]=0;
			else{
				dp[l][r]=1e18;
				for(ll k=l;k<r;k++){
					dp[l][r]=min(dp[l][r],dp[l][k]+dp[k+1][r]+PreSum(l,r));
				}
			}
		}
	}
	ll ans=dp[1][n];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#include <cmath>

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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll r;
    cin>>r;
    cout<< 6.28318530717958623200*r<<endl;


    return 0;
}


Measured memory_bytes: 3804
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int a = scanner.nextInt();
        String[] siritori = new String[a];
        String end="";
        String head="";
        boolean chkFlg=true;
        for(int i=0;i<a;i++) {
        	siritori[i]=scanner.next();
        	if(i!=0) {
        		head=siritori[i].substring(0,1);
        		if(!head.equals(end)){
        			System.out.println("No");
        			chkFlg=false;
        			break;
        		}
        		for(int j=0;j<i;j++) {
        			if(siritori[j].equals(siritori[i])) {
        				System.out.println("No");
        				chkFlg=false;
        				break;
        			}
        		}
        	}
        	end=siritori[i].substring(siritori[i].length()-1, siritori[i].length());
        }
        if(chkFlg) {
        	System.out.println("Yes");
        }

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 22996
#include<stdio.h>
int main(void) {
int i,j,n,count;
while(scanf("%d",&n)!=EOF) {
count=0;
int num[1000000]={0};
for(i=2;i<=n/2;i++) {
for(j=2;j*i<=n;j++) {
num[i*j]++;
}
}
for(i=2;i<=n;i++) {
if(num[i]==0) 
count++;
} 
printf("%d\n",count);
}
return (0) ;
}

Measured memory_bytes: 4508
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int H,W; cin>>H>>W;
  vector<string> S(H);
  vi x={0,1,0,-1},y={1,0,-1,0};
  int count=0;
  rep(i,0,H){
    cin>>S[i];
    rep(j,0,W){
      if(S[i][j]=='#')
        count++;
    }
  }
  queue<pii> Q;
  Q.push(make_pair(0,0));
  int sum=1;
  Q.push(make_pair(-1,-1));
  vector<vector<bool>> F(H,vector<bool> (W,1));
  F[0][0]=0;
  bool flag=0;
  while(Q.size()>1){
    int X=Q.front().first,Y=Q.front().second;
    Q.pop();
    if(X==(H-1)&&Y==(W-1)){
      flag=1;
      break;
    }
    if(X==-1){
      sum++;
      Q.push(make_pair(-1,-1));
    }
    else{
    rep(i,0,4){
      int R=X+x[i],T=Y+y[i];
      if(0<=R&&R<H&&0<=T&&T<W){
        if(S[R][T]=='.'){
          if(F[R][T]){
            F[R][T]=0;
            Q.push(make_pair(R,T));
          }
        }
      }
    }
    }
  }
  if(flag)
    cout<<H*W-count-sum<<endl;
  else
    cout<<-1<<endl;
  }



Measured memory_bytes: 256
#include <iostream>
#include <stack>

using namespace std;

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

	stack<int> st[10001];

	for (int i = 0; i < q; i++) {
		int s, t;
		cin >> s >> t;
		switch (s) {
		case 0:
			int v;
			cin >> v;
			st[t].push(v);
			// push
			break;
		case 1:
			// top
			if (!st[t].empty()) {
				cout << st[t].top() << endl;
			}
			break;
		case 2:
			// pop
			if (!st[t].empty()) {
				st[t].pop();
			}
			break;
		}
	}
}



Measured memory_bytes: 10444
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, n;
  string color;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> color;
    if(color == "P" && n < 1){
      n += 1;
      }
    else if(color == "W" && n < 10){
      n += 10;
      }
    else if(color == "G" && n < 100){
      n += 100;
      }
    else if(color == "Y"){
      n += 1000;
      cout << "Four" << endl;
      break;
      }
  }
  if(n <1000){
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int x;
    cin >> x;
    if (x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

    vector<int> v(9);

    for (int i = 0; i < N; ++i) {
        int tmp = 0;
        cin >> tmp;

        if (tmp >= 1 && tmp <= 399) v[0]++;
        if (tmp >= 400 && tmp <= 799) v[1]++;
        if (tmp >= 800 && tmp <= 1199) v[2]++;
        if (tmp >= 1200 && tmp <= 1599) v[3]++;
        if (tmp >= 1600 && tmp <= 1999) v[4]++;
        if (tmp >= 2000 && tmp <= 2399) v[5]++;
        if (tmp >= 2400 && tmp <= 2799) v[6]++;
        if (tmp >= 2800 && tmp <= 3199) v[7]++;
        if (tmp >= 3200) v[8]++;
    }
    int ansMin = 0, ansMax = 0;
    for (int i = 0; i < v.size(); ++i) {
        if (i != 8 && v[i] > 0) {
            ansMin++;
            ansMax++;
        } else if (i == 8 && ansMin == 0) {
            ansMin++;
            ansMax += v[i];
        } else if (i == 8 && ansMin != 0) {
            ansMax += v[i];
        }
    }
    cout << ansMin << " " << ansMax << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import math

def solve(N):
    F = math.factorial(N)
    ans = 1
    
    for i in range(2, N + 1):
        count = 1
        while(F%i == 0):
            F //= i
            count += 1
        ans *= count
        
    print(ans % (10**9+7))

if __name__ == '__main__':
    N = int(input())
    
    solve(N)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	int sum=0;
	vector<int> a;
	vector<int> b;
	rep(i,n){
		int x;
		cin >> x;
		if(x%10==0) a.pb(x);
		else b.pb(x);
		sum+=x;
	}
	if(sum%10!=0) cout << sum << endl;
	else{
		if(b.size()){
			sort(b.begin(),b.end());
			cout << sum-b[0] << endl;
		}
		else cout << 0 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <sstream> 
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define endl "\n"
#define CPrint(c)  for(auto i:(c)) { cout<<i<<" "; } nl 
#define eb   emplace_back
#define ef   emplace_front
#define pb   push_back
#define pf   push_front
#define popb pop_back
#define popf pop_front
#define mp   make_pair
//debuggers
#define trace2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define trace3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define trace4(w,x,y,z) cout<<#w<<"="<<w<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
typedef long long ll;
const int INF=1e9+5;
using namespace std;

int main()
{
	FAST_IO;
	int n,k;
	cin >> n >> k;
	vector<int> h(n);
	for(int i=0;i<n;i++)
	{
		cin >> h[i];
	}
	vector<int> dp(n,INF);//stores cost incurred to reach n
	dp[0] = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<=i+k;j++)
		{
			dp[j] = min(dp[j],dp[i]+abs(h[j]-h[i]));
		}
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main() {
    int r, D, x2000, ans;
    cin >> r >> D >> x2000;
    for(int i = 0; i < 10; i++){
        ans = r*x2000-D;
        x2000 += ans - x2000;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _001_FindingMissingCards
{
    class Dice
    {
        private int[] num = new int[6];

        public Dice(int[]given)
        {
            num[0] = given[0];
            num[1] = given[5];
            num[2] = given[4];
            num[3] = given[2];
            num[4] = given[3];
            num[5] = given[1];
        }

        public int topNumber()
        {
            return num[0];
        }

        private void moveNorth()
        {
            int tmp = num[0];
            num[0] = num[5];
            num[5] = num[1];
            num[1] = num[2];
            num[2] = tmp;
        }
        private void moveSouth()
        {
            moveNorth();
            moveNorth();
            moveNorth();
        }
        private void moveEast()
        {
            int tmp = num[0];
            num[0] = num[4];
            num[4] = num[1];
            num[1] = num[3];
            num[3] = tmp;
        }
        private void moveWest()
        {
            moveEast();
            moveEast();
            moveEast();
        }

        public void moveByCommand(char[] commands)
        {
            for (int i = 0; i < commands.Length; i++)
            {
                if (commands[i] == 'N')
                {
                    moveNorth();
                }
                else if (commands[i] == 'E')
                {
                    moveEast();
                }
                else if (commands[i] == 'W')
                {
                    moveWest();
                }
                else if (commands[i] == 'S')
                {
                    moveSouth();
                }

            }
        }


    }

    class Program
    {
        static void Main()
        {
            var tmp1 = Console.ReadLine().Split(' ');
            var sample1 = new int[tmp1.Length];
            for (int i = 0; i < tmp1.Length; i++)
            {
                sample1[i] = Convert.ToInt32(tmp1[i]);
            }
            var tmp2 = Console.ReadLine().ToCharArray();
            Dice a = new Dice(sample1);
            a.moveByCommand(tmp2);
            Console.WriteLine(a.topNumber());

        }
    }
}

Measured memory_bytes: 9208
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;

int main(){

	int a,b,c,d,e,k;

	cin >> a >> b >> c >> d >> e >> k;

	if(e - a <= k){
		cout << "Yay!" << endl;
	} else {
		cout << ":(" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
    long long k;
    cin>>n>>k;
    map<int,long long>mp;
    while(cin>>a>>b)
        mp[a]+=b;
    long long sum=0;
    for(auto x:mp){
        sum+=x.second;
        if(sum>=k){
            cout<<x.first<<endl;
            return 0;
        }
    }
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i,n) cin >>a[i];
	ll ans = accumulate(all(a),0LL) - n;
	
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
import Data.List (permutations)
import Control.Monad (replicateM)

isTriangle [a,b,c]
  | any isTriangle' (permutations [a,b,c]) = "YES"
  | otherwise                             = "NO"
    where
      isTriangle' [x,y,z] = (read x)^2 + (read y)^2 == (read z)^2

main = do
  s  <- getContents
  putStr $ unlines $ map isTriangle $ map words $ tail $ lines s

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

using ll = long long;
#define REP(i, n) for(int (i)=0; (i)< (n); ++i)
#define REPR(i, n) for(int (i)=(n); (i)>=0; --i)
#define FOR(i, n, m) for(int (i)=(n); (i)<(m); ++i)

#define INF 1e9
int main(){
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
  }
  int ans = INF;
  int sum = 0;
  A.push_back(A[0]+K);
  REP(i, N+1){
    ans = min(ans, K-(A[i+1]-A[i]));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792