akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
    double r;
    cin >> r;
    cout << r*2*3.1415 << endl;

}

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

int main(){
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;
    if(A+B<=2*C) {
        cout<<A*X+B*Y<<endl;
        return 0;
    }
    else if(A+B>2*C&&X>=Y){
        if(A*(X-Y)<=2*C*(X-Y)) {
            cout<<2*C*Y+A*(X-Y)<<endl;
            return 0;
        }
        else{
             cout<<2*C*X<<endl;
             return 0;
        }
    }
    else {
        if(B*(Y-X)<=2*C*(Y-X)){
            cout<<2*C*X+B*(Y-X)<<endl;
            return 0;
        }
        else{
            cout<<2*C*Y<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
struct combination {
vector<mint> fact, ifact;
combination(int n):fact(n+1),ifact(n+1) {
assert(n < mod);
fact[0] = 1;
for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
}
mint operator()(int n, int k) {
if (k < 0 || k > n) return 0;
return fact[n]*ifact[k]*ifact[n-k];
}
};

int main(){
    int r1,c1,r2,c2;cin >> r1 >> c1 >> r2 >> c2;
    r1--;c1--;
    combination c(2000005);
    mint ans=c(r2+c2+2,c2+1)-c(r1+c2+2,r1+1)-c(r2+c1+2,c1+1)+c(r1+c1+2,r1+1);
    cout << ans.x << endl;
}

Measured memory_bytes: 31488
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,k,arr[505],ans;
void go(int g)
{
	int sum=0,cnt=0;
	vector<int> tmp;
	for (int i=0;i<n;i++)
	{
		sum+=(arr[i]%g);
		tmp.push_back(g-arr[i]%g);
	}
	sort(tmp.begin(),tmp.end());
	for (int i=0;i<sum/g;i++)
	cnt+=tmp[i];
	if (cnt<=k)
	ans=max(ans,g);
}
int main()
{
	int sum=0;
	scanf("%d%d",&n,&k);
	for (int i=0;i<n;i++)
	scanf("%d",&arr[i]),sum+=arr[i];
	for (int i=1;i*i<=sum;i++)
	{
		if (sum%i==0)
		{
			go(i);
			go(sum/i);
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(V) (V).begin(), (V).end() 
using namespace std;
typedef long long ll;

int main() {fio;
	set <ll> g;
	for(int i = 1; i < 10; i++) g.insert(i);
	int k;
	cin >> k;
	int iter = 0;
	while(1) {
		ll u = *g.begin();
		g.erase(u);
		iter++;
		if(iter == k) {
			cout << u << endl;
			return 0;
		}
		int d = u % 10;
		if(d > 0) {
			g.insert(u * 10 + d - 1);
		}
		if(d < 9) {
			g.insert(u * 10 + d + 1);
		}
		g.insert(u * 10 + d);
	}	
	assert(false);
    return 0;
}

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

#define M 1050000
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]){

  long long key, i, h;
  key = getKey(str);
  while(1){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
    i++;
  }
  return 0;
}

int insert(char str[]){

  long long key, i, h;
  key = getKey(str);
  while(1){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 0;
    else if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
    i++;
  }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 14964
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

vector<int> z_algorithm(string s) {
	vector<int> res(s.size());
	
	res[0] = s.size();
	
	int i = 1, j = 0;
	
	while (i < s.size()) {
		while (i + j < s.size() && s[j] == s[i + j]) j++;
		res[i] = j;
		if (j == 0) { i++; continue; }
		int k = 1;
		while (i + k < s.size() && k + res[k] < j) res[i + k] = res[k], k++;
		i += k;
		j -= k;
	}
	
	return res;
}

int N;
vector<ll> A, B;

vector<int> solve(int s, string b) {
	string a;
	REP(i, N) a.push_back((A[i] >> s & 1) + '0');
	string S = b + a + a;
	vector<int> v = z_algorithm(S);
	
	vector<int> res;
	FOR(i, N, 2 * N) if (v[i] >= N) res.push_back(i - N);
	return res;
}

vector<bool> func() {
	vector<bool> ans(N, true);
	
	REP(i, 30) {
		vector<bool> cur_ans(N, false);
		REP(flip, 2) {
			string b;
			REP(j, N) b.push_back((B[j] >> i & 1 ^ flip) + '0');
			vector<int> v = solve(i, b);
			for (int pos : v) cur_ans[pos] = true;
		}
		REP(j, N) ans[j] = ans[j] & cur_ans[j];
	}
	return ans;
}

int main() {
	cin >> N;
	A.resize(N);
	B.resize(N);
	REP(i, N) scanf("%lld", &A[i]);
	REP(i, N) scanf("%lld", &B[i]);
	
	vector<bool> ans = func();
	using pll = pair<ll, ll>;
	vector<pll> ans_v;
	REP(i, N) if (ans[i]) {
		ans_v.emplace_back(i, A[i] ^ B[0]);
	}
	
	REP(i, ans_v.size()) printf("%lld %lld\n", ans_v[i].fi, ans_v[i].se);
	
	return 0;
}


Measured memory_bytes: 14692
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    if(n>m){
        cout << "No" <<endl;
    }else{
        cout << "Yes" << endl;
    }
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
 #define ll long long int
 int main()
 {
        long long int  c,sum=0,i;
           ll n;
            cin>>n;
             ll a[n];
              for(i=0;i<n;i++)
                 cin>>a[i];
               for(i=1;i<n;i++)
               { if(a[i-1]>a[i])
                  {sum+=a[i-1]-a[i];
                      a[i]=a[i-1];
               }
               }
                cout<<sum<<endl;
 }


Measured memory_bytes: 5148
import math
while True:
    n=int(input())
    if n==0:
        break
    
    s=list(map(int,input().split()))
    m=sum(s)/len(s)
    
    a=0
    for i in range(n):
        a+=(s[i]-m)**2
    a/=n
    a=math.sqrt(a)
    print(a)


Measured memory_bytes: 5700
N=gets.to_i
XL=[]
N.times do
    x,l=gets.chomp.split(" ").map(&:to_i)
    XL.push([x-l,x+l])
end
ranges = XL.sort_by {|s,t| t }

ret = 0
max_x = -1 * 10**10
ranges.each do |s,t|
    if max_x <= s
        max_x = t
        ret += 1
    end
end
puts ret


Measured memory_bytes: 23944
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){

  int kind,remain[10000];
  while(cin >> kind, kind){
    for(int i = 0 ; i < kind ; i++)
      cin >> remain[i];

    int ans = 0, cnt = 0;
    for(int i = 0 ; i < kind ; i++){
      if(remain[i] < 2) cnt++;
      if(remain[i] > 0){
	ans++;
	remain[i]--;
      }
    }
    if(cnt == kind) cout << "NA" << endl;
    else cout << ans + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define int long long
#define rep(i,m,n) for(int i=m;i<n;i++)
#define repr(i,n,m) for(int i=n;i>=m ;i--)
#define MOD 1000000007
#define float long double
#define pb push_back
#define mp make_pair
#define pp pop_back
#define pi 3.141592653589793238
#define print(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
using namespace std;
bool sortbysec(const pair<int,int> &a,
             const pair<int,int> &b)
{
   return (a.second < b.second);
}
int lcm(int a, int b)  
 {  
    return (a*b)/__gcd(a, b);  
 }  
bool sortinrev(const pair<int,int> &a,  
              const pair<int,int> &b)
{
      return (a.first > b.first);
}
void solve()
{
	int x,total=0,p=100;
	cin>>x;
	rep(i,1,10000)
	{
		p=(0.01*p+p);
		if(p>=x)
		{
			cout<<i;
			return;
		}
	}
}    
signed main()
{
                    // #ifndef ONLINE_JUDGE
                    // freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
                    // #endif 
  int t=1;
 //cin>>t;
  while(t--){
  solve();
}
  cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
 return 0;
}  

Measured memory_bytes: 3748
#include<bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (int i=0; i < n; i++)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using LP = pair<ll,ll>;
using P = pair<int,int>;
const ll inf = 1e9;


int main()
{
    int h, n;
    cin >> h >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    vector<ll> dp(h+1, inf);
    dp[0] = 0;
    rep(i, h) rep(j, n){
        int idx = min(h, a[j]+i);
        dp[idx] = min(dp[idx], dp[i]+b[j]);
    }
    cout << dp[h] << endl;
}

Measured memory_bytes: 3696
A=input().split(" ")
A = list(map(int, A))
B=input().split(" ")
B = list(map(int, B))
C=input().split(" ")
C = list(map(int, C))


if (A[0]-B[0] == A[1]-B[1] and A[1]-B[1] == A[2]-B[2]) and (A[0]-C[0] == A[1]-C[1] and A[1]-C[1] == A[2]-C[2]) and (C[0]-B[0] == C[1]-B[1] and C[1]-B[1] == C[2]-B[2]):
			print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i=0;i<n;i++){
			x[i] = stdIn.nextInt();
		}
		for(int i=0;i<n;i++){
			y[i] = stdIn.nextInt();
		}
		double ans1 = 0;
		double ans2 = 0;
		double ans3 = 0;
		double ans4 = 0;
		
		for(int i=0;i<n;i++){
			ans1 += Math.abs(x[i]-y[i]);
			ans2 += Math.pow(x[i]-y[i],2);
			ans3 += Math.abs(Math.pow(x[i]-y[i],3));
			if(ans4<Math.abs(x[i]-y[i])){
				ans4 = Math.abs(x[i]-y[i]);
			}
		}
		
		ans2 = Math.sqrt(ans2);
		ans3 = Math.pow(ans3,1.0/3.0);
		
		System.out.println(ans1);
		System.out.println(ans2);
		System.out.println(ans3);
		System.out.println(ans4);
	}
}

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

int main(){
  int n, ans = 0;
  cin >> n;
  if ( n % 2 == 0 ) cout << ( n / 2 ) * ( n / 2 ) << endl;
  else cout << ((n / 2) + 1) * ( n / 2 ) << endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int check(int x) {
	if (x == 2)
		return 1;
	else if ((x < 8 && x % 2 == 1) || (x >= 8 && x % 2 == 0)) {
		return 2;
	}
	else {
		return 3;
	}
}

int main() {
	int x, y;
	cin >> x >> y;
	if (check(x) == check(y))
		Yes();
	else
		No();

	return 0;
}

Measured memory_bytes: 256
dict = {}

q = int(input())

for i in range(q):
    line = input().split()
    if line[0] == "0":
        dict[line[1]]=int(line[2])
    elif line[0] == "1":
        if line[1] in dict.keys():
            print(dict[line[1]])
        else:
            print(0)
    elif line[0] == "2":
        if line[1] in dict.keys():
            dict.pop(line[1])






Measured memory_bytes: 37512
import sys

input = sys.stdin.readline


def main():
    sx, sy, tx, ty = map(int, input().split())

    ans = ""
    ans = "".join((ans, "U"*(ty-sy), "R"*(tx-sx)))
    ans = "".join((ans, "D"*(ty-sy), "L"*(tx-sx)))
    ans = "".join((ans, "L", "U"*(ty-sy+1), "R"*(tx-sx+1), "D"))
    ans = "".join((ans, "R", "D"*(ty-sy+1), "L"*(tx-sx+1), "U"))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();
            long x = in.nextLong();
            if (a % x != 0) {
                a += (x - (a % x));
            }
            b -= b % x;
            if (b < a) {
                out.println(0);
                return;
            }
            a /= x;
            b /= x;
            out.println(b - a + 1);
        }

    }
}



Measured memory_bytes: 21844
#Satoooh blog
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]  # 親
        self.rank = [1] * n  # 木の高さ
        self.size = [1] * n  # size[i] は i を根とするグループのサイズ

    def find(self, x):  # x の根を返す
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])  # 経路圧縮
            return self.parent[x]

    def unite(self, x, y):  # x, y の属する集合を併合する
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += self.size[x]
            else:
                self.parent[y] = x
                self.size[x] += self.size[y]
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1

    def is_same(self, x, y):  # x, y が同じ集合に属するか判定する
        return self.find(x) == self.find(y)

    def group_size(self, x):  # x が属する集合の大きさを返す
        return self.size[self.find(x)]


N, M, K = map(int, input().split())
A, B = [0] * M, [0] * M  # 入力時に 0-index に合わせる
C, D = [0] * K, [0] * K  # 入力時に 0-index に合わせる

direct =[[] for _ in range(N)]  # 同じ集合の友達もしくはブロック関係の人
uf = UnionFind(N)  # 友達関係をまとめた UnionFind 木

for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1
    direct[A[i]].append(B[i])
    direct[B[i]].append(A[i])
    uf.unite(A[i], B[i])

for i in range(K):
    C[i], D[i] = map(int, input().split())
    C[i] -= 1
    D[i] -= 1
    if uf.is_same(C[i], D[i]):
        direct[C[i]].append(D[i])
        direct[D[i]].append(C[i])

ans = [0] * N
for i in range(N):
    ans[i] = uf.group_size(i) - len(direct[i]) - 1
print(*ans)

Measured memory_bytes: 41492
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int ll
#define For(a, b, c) for(int a = b; a <= c; ++a)
#define Ford(a, b, c) for(int a = b; a >= c; --a)
#define All(a, b) for(auto &a : b)
#define Rep(a, b, c) for(int a = b; a < c; ++a)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
#define reset(a, b) memset(a, b, sizeof(a))
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))
#define bitone(i) __builtin_popcountll(i)
#define bitl(i) __builtin_clz(i)
#define bitr(i) __builtin_ctz(i)
#define vll vector<ll>
/********************************************************

Digvijay Bahadur Singh
MNNIT

*********************************************************/
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}


const int MOD=1e9+7;
const int N = 1e6+100;
/********************************************************************/
                 /* GRAPH*/
//vector<vector<ll>> g;
//vector<bool> vis1,vis2;
/*******************************************************************/
ll power(ll a,ll b)
{
   ll ans =1;
   while(b>0){
   if(b&1) ans = (ans%MOD * a%MOD)%MOD;
   a = (a%MOD * a%MOD)%MOD;
   b=b>>1;
   }
   return ans%MOD;
}


signed main(){
  ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
  ll n;

  
  ll T=1;
 //cin>>T;
  
   // T=1;
    
    while(T--)
  {
    
        
     int n;
     cin>>n;
     vll a(n);
     cin>>a;
     int flag=0;
     for(int i=0;i<n;i++)
     {
       if(a[i]%2==0)
       {
         if(a[i]%3==0||a[i]%5==0)continue;
         else{
           flag=1;
           break;
         }
       }
       
       
     }
     if(flag==0)
     {
       cout<<"APPROVED\n";
     }
     else
     {
       cout<<"DENIED\n";
     }
     
	
  }

       
   
  

   
 


      

  }

  



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define INF LLONG_MAX
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    ll sum = 0;
    for (size_t i = 0; i < n; i++)
    {
        sum += a[i]-1;
    }
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int days = Integer.parseInt(sc.next());
        int nokori = Integer.parseInt(sc.next());
        int sum = 0;
        for (int i = 0; i < n; i++ ){
            int between = Integer.parseInt(sc.next());
            for (int j = 1; j <= days; j += between) {
                sum += 1;
            }
        }
        System.out.println(sum + nokori);
    }
}

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

int main(){
    using tsii = tuple<string,int,int> ;
    int N; cin >> N;
    vector<tsii> P(N);
    for(int i=0;i<N;i++){
        string a;
        int b,c;
        cin >> a >> b;
        b = -1 * b;
        c = i + 1;
        P[i]=(make_tuple(a,b,c));
    }

    sort(P.begin(),P.end());
    for(int i=0;i<N;i++){
        int ans;
        tie(ignore,ignore,ans) = P[i];
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define MKP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

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

int fpow(int a,int b,int m)
{
	if(b==0) return 1;
	if(b==1) return a;
	int tmp=fpow(a,b/2,m);
	if(b%2) return a*tmp%m*tmp%m;
	return tmp*tmp%m;
}

int f(int n)
{
	int t=10*((n+9)/10);
	return t-n;
}

#define mn max

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	cout<<(a+b+c+d+e+f(a)+f(b)+f(c)+f(d)+f(e)-mn(f(a),mn(f(b),mn(f(c),mn(f(d),f(e))))))<<"\n";
	return 0;
}









Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
cnt = 1
b = []
for i in range(n-1):
    if a[i] == a[i+1]:
        cnt += 1
    else:
        b.append(cnt)
        cnt = 1
        
    if i == n-2:
        b.append(cnt)

ans = 0
for i in range(len(b)):
    ans += b[i]//2
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;

int main() {
	int n, m;
	cin >> n >> m;
	cout << n+m/2 << endl;
	return 0;
}

//Ctrl+Aを使わない

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

int fib[10000];

int main(){
	fib[0]=fib[1]=1;
	for(int i=2;i<40;i++){
		fib[i]=fib[i-1]+fib[i-2];
	}

	double x,y;	cin>>x>>y;
	x+=0.5;	y+=0.5;

	double sY=1, sX=0;
	int flag=0;

	while(1){
		double pY=sY, pX=sX;
		switch(flag%4){
			case 0:	// 東
				sY-=fib[flag];
				sX+=fib[flag];
				break;
			case 1: // 北
				sY+=fib[flag];
				sX+=fib[flag];
				break;
			case 2: // 西
				sY+=fib[flag];
				sX-=fib[flag];
				break;
			case 3: // 南
				sY-=fib[flag];
				sX-=fib[flag];
				break;
		}

		int color=1+(flag%3);
		if( (pY<y && y<sY)||(sY<y && y<pY)){
			if((pX<x&&x<sX)||(sX<x&&x<pX)){
				cout<<color<<endl;
				break;
			}
		}

		flag++;
	}


	return 0;
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;

int main() {
	string S;
	cin >> S;

	u64 k = 2019;
	u64 ans = 0;
	boost::dynamic_bitset<> mat(S.size()+1);
	
	for(u64 b=0; b<S.size(); b++) {
		u64 tdiv = 0;
		u64 bs = 0;
		
		if(mat[b]) continue;
		
		for(u64 e=b; e<S.size(); e++) {
			tdiv = tdiv * 10 + S[e] - '0';
			bool r = (tdiv != 0);
			
			tdiv = tdiv - (tdiv / k) * k;
			
			if(r && tdiv == 0) {
				if(mat[e+1]) break;
				
				bs++;
				ans += bs;	
				mat[e+1] = 1;
			}
		}
	}

	cout << ans;

}


Measured memory_bytes: 3732
#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
   long long h,n;
   int flag=0;
   cin>>h>>n;
   long long arr[n];
    for(int i=0;i<n;i++){
    cin>>arr[i];}
    sort(arr,arr+n);

   for(int i=n-1;i>-1;i--){
        h-=arr[i];
        if(h<=0){flag=1;break;}
    }
  (flag==1)?cout<<"Yes"<<endl:cout<<"No"<<endl;
   return 0;
}


Measured memory_bytes: 1024
while true do
   h, w = gets.split.map(&:to_i)
   if h == 0 && w == 0
      break
   end
   h.times do |i|
      if i % 2 == 0
         outputs = []
         w.times do |h|
            if h % 2 == 0
               outputs << "#"
            else
               outputs << "."
            end
         end
         outputs.each do |output|
            print output
         end
         print "\n"
      else
         outputs = []
         w.times do |h|
            if h % 2 == 0
               outputs << "."
            else
               outputs << "#"
            end
         end
         outputs.each do |output|
            print output
         end
         print "\n"
      end
   end
   puts ""
end

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

int main() {
  string O, E;
  cin >> O >> E;
  char a[O.size()], b[E.size()];
  for(int i=0; i<O.size(); i++) {
    a[i]=O.at(i);
  }
  for(int i=0; i<E.size(); i++) {
    b[i]=E.at(i);
  }
   for(int i=0; i<min(O.size(), E.size()); i++) {
    cout << a[i] << b[i];
  }
  if(O.size()<E.size()) {
    cout << b[E.size()-1];
  }
  if(O.size()>E.size()) {
    cout << a[O.size()-1];
  }
  cout << endl;
  return 0;
}

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

int64_t n,res=0;
map<int64_t,int64_t> M;

int main()
{
	ios_base::sync_with_stdio(false);
	//freopen("TEST.INP","r",stdin);
	//freopen("TEST.OUT","w",stdout);
	cin>>n;
	M[0]++;
	int64_t x,sum=0;
	for(int64_t i=1;i<=n;i++)
	{
		cin>>x;
		sum+=x;
		res+=M[sum]++;
	}
	cout<<res;
}

Measured memory_bytes: 12800
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], D = l[1];

            var ans = N / (2 * D + 1);
            Console.WriteLine(N % (2 * D + 1) == 0 ? ans : ans + 1);
        }
    }
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair
 
using namespace std;
 
const LL MOD=1e9+7;

LL n,p,modval[200010],num[10010],cur=0,ans=0;
string s;

int main()
{
	cin>>n>>p>>s;
	modval[0]=1;
	repn(i,200005) modval[i]=modval[i-1]*10%p;
	if(p==2||p==5)
	{
		rep(i,n) if((s[i]-'0')%p==0) ans+=i+1;
		cout<<ans<<endl;
		return 0;
	}
	for(int i=n-1;i>=0;i--)
	{
		cur=(cur+(s[i]-'0')*modval[n-1-i])%p;
		if(cur==0) ans++;
		num[cur]++;
	}
	rep(i,p) ans+=num[i]*(num[i]-1)/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2180
import math

N = int(input())

MOD = 10 ** 9 + 7

# エラトステネスの篩(ふるい)
# 計算量はnloglogn(?)
# かなり早い
# n以下の自然数の内、素数であるものをリストに入れて返す関数
def eratosthenes(n):
    # 1からnのところにTrueを格納
    # is_primeがTrueは素数を表す
    is_prime = [True] * (n + 1)

    # 1,2は素数
    is_prime[0] = False
    is_prime[1] = False

    # iは着目する数
    # 高速化1
    # ・nまでの自然数のうち、約数の候補としてはrootnまでしかない
    for i in range(2, int(math.sqrt(n))+1):
        # 高速化2
        # ・iが既にFalseだったら(not False = True)それは回さなくて良い
        if not is_prime[i]:
            continue
        # j=2i,3i,4i,...と続く
        # j番目は素数でない
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False

    # is_primeがTrueとなっている所のみ数を入れる
    return [i for i in range(n + 1) if is_prime[i]]

prime = eratosthenes(N)

M = len(prime)
cnt = [0]*M
for i in range(M):
    p = prime[i]
    while p <= N:
        cnt[i] += N // p
        p *= prime[i]

ans = 1
for i in range(M):
    ans *= cnt[i] + 1
    ans %= MOD
print(ans)

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int di2[] = {1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1};
const int dj2[] = {1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};



int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;
  for(int i = 1; i < n; ++i) {
    if(a[i-1] > a[i]) {
      ans += a[i-1]-a[i];
      a[i] = a[i-1];
    }
  }
  cout << ans << endl;
}

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

int main(){

	int Tc;
	scanf("%d",&Tc );
	long long int data[Tc]={}; long long int Tot=1;
	
	for (int i=0; i<Tc; i++){
		scanf("%lld", &data[i]);
	}
	
	for (int j=0; j<Tc; j++){
		if (data[j]==0){
		printf("0");
		return 0;	
		}
	}
	for(int k=0; k<Tc; k++){
		if (data[k]>1000000000000000000/Tot){
		printf ("-1");
		return 0;	
		} else {
		Tot *= data[k]; 		
		}
	
	}
	printf ("%lld", Tot);
	return 0;
}

Measured memory_bytes: 2476
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans=0;
  ll k[n];
  rep(i,n)cin >> k[i];
  rep(i,n-1){
    ans+=min(b,(k[i+1]-k[i])*a);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  string s,t;
  while(cin>>s>>t) {
    int c = 0;
    REP(i,3) if (s[i]==t[i]) c++;
    cout << c << endl;
  }
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

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

	cout << n-i+1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

string YorN(bool P) { if (P)return "Yes"; else return "No"; }

int main() {

    int x;
    cin >> x;

    cout << ((x<1200)?"ABC":"ARC") << endl;

    return 0;

}

Measured memory_bytes: 256
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.IntSet as S
main=do
    [n,k]<-map read.words<$>getLine::IO[Int]
    as<-unfoldr(B.readInt.B.dropWhile(<'!'))<$>B.getLine
    putStrLn $ if S.member k $ f k as then "First" else "Second"

f k as = foldl' p S.empty [0..k] where
    p s i | S.member i s = s
          | otherwise = foldl' (flip S.insert) s $ map (+i) as

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

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

  vector<int> a(10);
  rep(i, 3) IN(a[i]);
  sort(all(a), greater<>());
  OUTL(a[1] * a[2] / 2);

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 最大公約数(ユークリッドの互除法)
// O(log max(a, b))
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){
    ll a, b;
    cin >> a >> b;
    cout << 3*(a-gcd(a, b)) << endl;
}

Measured memory_bytes: 3640
#include <sys/time.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

class Timer {
 public:
  void restart();
  double getElapsed();

  Timer();

 private:
  static double rdtsc_per_sec_inv;

  double getTimeOfDay();
  unsigned long long int getCycle();

  double start_time;
  unsigned long long int start_clock;
};
double Timer::rdtsc_per_sec_inv = -1;

inline double Timer::getElapsed() {
  if (rdtsc_per_sec_inv != -1)
    return (double)(getCycle() - start_clock) * rdtsc_per_sec_inv;

  const double RDTSC_MEASUREMENT_INTERVAL = 0.1;
  double res = getTimeOfDay() - start_time;
  if (res <= RDTSC_MEASUREMENT_INTERVAL) return res;

  rdtsc_per_sec_inv = 1.0 / (getCycle() - start_clock);
  rdtsc_per_sec_inv *= getTimeOfDay() - start_time;
  return getElapsed();
}

inline void Timer::restart() {
  start_time = getTimeOfDay();
  start_clock = getCycle();
}

Timer::Timer() { restart(); }

inline double Timer::getTimeOfDay() {
  timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec + tv.tv_usec * 0.000001;
}

inline unsigned long long int Timer::getCycle() {
  unsigned int low, high;
  __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
  return ((unsigned long long int)low) | ((unsigned long long int)high << 32);
}

inline unsigned get_random() {
  static unsigned y = 2463534242;
  return y ^= (y ^= (y ^= y << 13) >> 17) << 5;
}
inline double get_random_double() { return (double)get_random() / UINT32_MAX; }

int main() {
  long long m, d, c, s = 0, l = 0;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> d >> c;
    s += d * c;
    l += c;
    if (s > 9) {
      long long x = (s - 1) / 9;
      l += x;
      s -= 9 * x;
    }
  }
  cout << (l - 1) << endl;
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

int main(){
	int N,ANS=0;
	cin>>N;
	vector<int> B;
	REP(i,N-1){
		int a;
		cin >> a;
		B.PB(a);
	}
	ANS=B[0]+B[N-2];
	REP(i,N-2)ANS+=min(B[i],B[i+1]);
	cout << ANS << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace AizuOnlineJudgement.ITP1_3_D
{
	public static class Program
	{
		public static void Main (string[] args)
		{
			var abc = Console.ReadLine ().Split (' ').Select (s => int.Parse (s)).ToArray ();
			Console.WriteLine (Enumerable.Range (abc[0], abc[1] - abc[0] + 1).Where (d => abc[2] % d == 0).Count ());
		}
	}
}



Measured memory_bytes: 9592
#include <cstdio>

int sx, sy, tx, ty;
int vis[4010][4010];
int q[20000000];
int front, tail;
int step[4][2] = {{-1,0}, {1,0}, {0,-1}, {0,1}};
char sd[5] = "LRDU";
int lx[4010][4010];
int ly[4010][4010];
int dr[4010][4010];
int path[2600000];
int vis2[4010][4010];

void EnQueue(int x)
{
	q[tail] = x;
	tail ++;
}

int DeQueue()
{
	int r = q[front];
	front ++;
	return r;
}

void calc(int sx1, int sy1, int tx1, int ty1)
{
	int i, j;
	for(i=0; i<3300; i++){
		for(j=0; j<3300; j++)
			vis[i][j] = 0;
	}
	front = tail = 0;
	EnQueue(sx1);
	EnQueue(sy1);
	vis[sx1+1300][sy1+1300] = 1;
	while(front != tail){
		int xx = DeQueue();
		int yy = DeQueue();
		if(xx == tx1 && yy == ty1)
			break;
		int x2, y2;
		for(i=0; i<4; i++){
			x2 = xx + step[i][0];
			y2 = yy + step[i][1];
			if(x2>=-1100 && x2<=1100 && y2>=-1100 && y2<=1100 && vis[x2+1300][y2+1300]==0 && vis2[x2+1300][y2+1300]==0){
			//if(x2>=-4 && x2<=4 && y2>=-4 && y2<=4 && vis[x2+1300][y2+1300]==0 && vis2[x2+1300][y2+1300]==0){
				vis[x2+1300][y2+1300] = 1;
				lx[x2+1300][y2+1300] = xx;
				ly[x2+1300][y2+1300] = yy;
				dr[x2+1300][y2+1300] = i;
				EnQueue(x2);
				EnQueue(y2);
			}
		}
	}
}

void prt(int sx1, int sy1, int tx1, int ty1)
{
	int i;
	int xx = tx1;
	int yy = ty1;
	int pathL = 0;
	while(xx!=sx1 || yy!=sy1){
		int x2, y2;
		x2 = lx[xx+1300][yy+1300];
		y2 = ly[xx+1300][yy+1300];
		path[pathL] = dr[xx+1300][yy+1300];
		pathL ++;
		xx = x2;
		yy = y2;
		if( (xx==sx1 && yy==sy1) || (xx==tx1 && yy==ty1) ){}
		else
			vis2[xx+1300][yy+1300] = 1;
	}
	for(i=0; i<pathL/2; i++){
		int tmp = path[i];
		path[i] = path[pathL-1-i];
		path[pathL-1-i] = tmp;
	}
	for(i=0; i<pathL; i++)
		printf("%c", sd[path[i]]);
}

int main()
{
	scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
	//vis[sx][sy] = vis[tx][ty] = 0;
	calc(sx, sy, tx, ty);
	prt(sx, sy, tx, ty);
	
	//vis[sx][sy] = vis[tx][ty] = 0;
	calc(tx, ty, sx, sy);
	prt(tx, ty, sx, sy);
	
	//vis[sx][sy] = vis[tx][ty] = 0;
	calc(sx, sy, tx, ty);
	prt(sx, sy, tx, ty);
	
	//vis[sx][sy] = vis[tx][ty] = 0;
	calc(tx, ty, sx, sy);
	prt(tx, ty, sx, sy);
	printf("\n");
	return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  int n, d, x;
  std::cin >> n >> d >> x;
  int ans = 0;
  REP(i, n) {
    int a = read();
    int tmp = 1;
    while (tmp <= d) {
      ans++;
      tmp += a;
    }
  }
  print(ans + x);
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int T = sc.nextInt();

		int[][] ct = new int[N][2];
		for (int i = 0; i < N; i++) {
			ct[i][0] = sc.nextInt();
			ct[i][1] = sc.nextInt();
		}

		int[][] r = Stream.of(ct)
				.filter(a -> a[1] <= T)
				.sorted((a1, a2) -> a1[0] - a2[0])
				.limit(1)
				.toArray(int[][]::new);

		if(r.length == 0) {
			out.println("TLE");
		}else {
			out.println(r[0][0]);
		}
		sc.close();
	}

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

}


Measured memory_bytes: 28372
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main(){

    string s;
    cin >> s;
    int ans = 0;
    rep(i, 3){
        if(s[i] == 'o')ans++;
    }
    cout << 700 + ans * 100 << endl;

}

Measured memory_bytes: 256
using System;

namespace ITP1_5_C
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] inputs = Console.ReadLine().Split(' ');

                int height = Convert.ToInt32(inputs[0]);
                int width = Convert.ToInt32(inputs[1]);

                if (height == 0 && width == 0) break;

                for (int i = 0; i < height; i++)
                {
                    for (int j = 0; j < width; j++)
                    {
                        if (i % 2 == 0)
                        {
                            if (j % 2 == 0) Console.Write("#");
                            else Console.Write(".");

                        }
                        else
                        {
                            if (j % 2 == 0) Console.Write(".");
                            else Console.Write("#");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 5368
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

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

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long MOD = 1000000007;

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

	int x;
	cin >> x;

	int a = x % 100;

	int sum = 0;
	RREP(i, 1, 5) {
		int t = a / i;
		sum += t;
		a -= i * t;

		if (a == 0) break;
	}

	x -= a;

	if (x/100 >= sum) {
		cout << 1 << "\n";
	}
	else {
		cout << 0 << "\n";
	}

	return 0;
}


Measured memory_bytes: 256