akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main(){
  string a;
  cin>>a;
  int ans=0;
  if (a[0]=='1')ans+=1;
  if (a[1]=='1')ans+=1;
  if (a[2]=='1')ans+=1;
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,W;
int dp[102][100002];
int v[102];
int w[102];
int knap(int i,int W){
    if(i>n){return 0;}
    if(W-w[i] < 0){
        if(i==n){return 0;}
        return knap(i+1,W);
    }
    if(dp[i][W] != -1){return dp[i][W];}
    int op1 = v[i] + knap(i+1,W-w[i]);
    int op2 = knap(i+1,W);

    return dp[i][W] = max(op1,op2);
}

int32_t main(){
    cin>>n>>W;
    for(int i=1;i<=n;i++){cin>>w[i]>>v[i];}
    memset(dp,-1,sizeof(dp));
    cout<<knap(1,W);
    return 0;

}

Measured memory_bytes: 83272
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define rep(i, e) for(int i = 0; i < e; i++)
#define repp(i, s, e) for(int i = s; i < e; i++)
#define MAX_N 100
#define Card_Max 36
#define p(a) printf("%d\n", a);
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define NIL -1
typedef pair<ll, ll> P;

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

int main() {
    int N, cnt = 0, pre_minv = 1e9;
    cin >> N;
    vector<int> P(N);
    vector<int> M(N, 1e9);
    rep(i, N) cin >> P[i];
    rep(i, N) {
        M[i] = min(pre_minv, P[i]);
        pre_minv = M[i];
    }
    rep(i, N) {
        if(P[i] == M[i])
            cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1792
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = scan!(usize);
    println!("{}", n * 800 - (n / 15) * 200);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val)
{
    std::fill((T *)array, (T *)(array + N), val);
}

// ll power(ll n, ll x)
// {
//     ll res = 1;
//     while (n)
//     {
//         if (n & 1)
//         {
//             res *= x;
//         }
//         x *= x;
//         n >>= 1;
//     }
//     return res;
// }
int main()
{
    ll x;
    cin >> x;
    ll ans = 0;
    ll sum = 100;
    while (sum < x)
    {
        sum += sum/100;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  t,i,x,y,j,k,n,m,d,ans=0;
    string s;
    cin>>m>>d;
    for(i=4; i<=m; i++)
    {
        for(j=22; j<=d; j++)
        {
            ll cpj=j;
            x=cpj%10;
            cpj/=10;
            y=cpj%10;
            if(x>=2&&y>=2)
            {
                if(x*y==i)
                    ans++;
            }
          //  cout<<i<<" "<<j<<" "<<x<<" "<<y<<endl;
        }

    }

    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int n;
	cin >> n;
	if ((n % 1000) % 111 == 0 || (n - n % 10) % 1110 == 0)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

Measured memory_bytes: 3632
N,M = map(int,(input().split()))

A = []
for i in range(N):
	n = int(input())
	A.append(n)

B = []
for i in range(M):
	n = int(input())
	B.append(n)

ans = [0 for i in range(N)]
for i in range(M):
	for j in range(N):
		if B[i] >= A[j]:
			ans[j] += 1
			break

Max = 0
idx = 0
for i in range(N):
	if Max < ans[i]:	
		Max = ans[i]
		idx = i + 1

print(idx)



Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
int n, m;
double sum;
int a[N];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
	}
	sum /= (4.0*m);
	int cnt = 0;
	for (int i = 0; i < n; i++)if (a[i] >= sum)cnt++;
	if (cnt >= m)puts("Yes");
	else puts("No");
	return 0;
}

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

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

#define PI (3.14159265358979323)
#define MOD (1000000007LL)
#define INF (1LL<<60LL)
#define MAX_N (100001)
#define MAX (1000000000000000000LL)

using namespace std;

signed main() {
	int n;
	cin >> n;
	int ans = 1;
	rep(i, n) {
		int a; cin >> a;
		if(ans==-1){
			if (a == 0) {
				ans = 0;
				break;
			}
			continue;
		}
		if (MAX / ans < a) {
			ans = -1;
			continue;
		}
		else if (MAX < ans * a) {
			ans = -1;
			continue;
		}
		else if (a == 0) {
			ans = 0;
			break;
		}
		ans = ans * a;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3584
# Author: cr4zjh0bp
# Created: Sun Mar  1 12:01:00 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

A = nan(3)
n = ni()
b = nin(n)

d = [[0] * 3 for _ in range(3)]

for i in range(n):
    for j in range(3):
        for k in range(3):
            if A[j][k] == b[i]:
                d[j][k] = 1

flag = False
for i in range(3):
    c = 0
    for j in range(3):
        if d[i][j] == 1:
            c += 1
    if c == 3:
        flag = True

for i in range(3):
    c = 0
    for j in range(3):
        if d[j][i] == 1:
            c += 1
    if c == 3:
        flag = True

if d[0][0] == 1 and d[1][1] == 1 and d[2][2] == 1:
    flag = True
if d[0][2] == 1 and d[1][1] == 1 and d[2][0] == 1:
    flag = True

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip> 
#include <cstring>
#include <queue>
#include <stack> 
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int n,p;
ll temp,res;
int vis[2000005];
string s;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> p >> s;
	int d = 1;
	vis[0] = 1;
	if(p == 2 || p == 5){
		for(int i = 0;i < s.length();i++){
			if((s[i] - '0') % p == 0 ){
				res += (i + 1);
			}
		}
	}else{
		for(int i = s.length() - 1;i >= 0;i--){
			temp = (((s[i] - '0') * d) % p + temp % p) % p;
			res += vis[temp];
			vis[temp]++;
			d = d * 10 % p;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 832
(defun split (str)
  (labels ((inner (rest-str-list stack-str-list temp-out)
                  (if rest-str-list
                      (let ((now-char (car rest-str-list)))
                        (cond ((eq #\space now-char) (inner (cdr rest-str-list)
                                                            '()
                                                            (cons (concatenate 'string (reverse stack-str-list))
                                                                  temp-out)))
                              (t (inner (cdr rest-str-list)
                                        (cons now-char stack-str-list)
                                        temp-out))))
                      (reverse (cons (concatenate 'string (reverse stack-str-list))
                                     temp-out)))))
          (inner (concatenate 'list str)
                 '()
                 '())))

(defun input-to-list (str)
  (mapcar #'parse-integer (split str)))

(defvar n (read))
(defvar dif (input-to-list (read-line)))

(defvar s-dif (sort (copy-list dif) #'>))
(let ((lef (nth (1- (/ n 2)) s-dif))
      (rig (nth (/ n 2) s-dif)))
  (format t "~a" (- lef rig)))

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

int main() {
    string S;
    cin >> S;
    bool ok = (S.size() % 2 == 0);
    for (int64_t i = 0; i < S.size(); i++) {
        if ((i % 2 == 0 && S[i] != 'h') || (i % 2 == 1 && S[i] != 'i')) {
            ok = false;
            break;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

const int MAXN = 200000;
int K,N;
int A[MAXN];
bool ok(double mid) {
    int count = 0;
    rep(i,N) {
        count+=(int)(A[i]/mid);
        if((double)(A[i]/mid) != (int)(A[i]/mid)) {
            count++;
        }
        count--;
    }
    return (count <= K);
}

int up(double x) {
    if(x == int(x))return (int)x;
    else return int(x)+1;
}

int main(){
    cin >> N >> K;
    rep(i,N)cin >> A[i];
    long double mini,maxi,mid;
    mini = 0;
    maxi = 10000000000;
    while(1) {
        mid = (mini + maxi)/2;
        if(ok(mid)){
            maxi = mid;
        }else {
            mini = mid;
        }
        if(abs(maxi - mini) < 0.000001)break;
    }

    if(maxi > 1000000000)cout <<  1000000000 << endl;
    else cout<< up(mini) << endl;
    return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long int> A(N);
    for(int n=0; n<N; n++) {
        cin >> A[n];
    }
    
    sort(A.begin(), A.end());
    
    int ans=0;
    int ind=-1;
    for(int n=0; n<N-1; n++) {
        if(min(A[N-1]-A[n], A[n])>=ans) {
            ind = n;
            ans = min(A[N-1]-A[n], A[n]);
        }
    }
    
    cout << A[N-1] << " " << A[ind] << endl;
    

    return 0;
    
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cstring>

// ---------- PBDS -----------------

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

// ----------------------------------

using namespace std;
using namespace __gnu_pbds; 

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a) 
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
// #define ll long long int
//#define int long long int

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }
#define deb(x) debug() << imie(x)

int const N = 1e6 + 5;

void solve(){
    
    int spf[N];
    
    MEM(spf, 0);

    
    for(int i = 2; i < N; i++){
        if(spf[i] == 0){
            for(int j = i; j < N; j += i)
            spf[j] = i;
        }
    }
    
    int n;
    cin >> n;
    
    if(n == 1){
        cout << "pairwise coprime";
        return;
    }
    
    int cou[N];
    
    MEM(cou, 0);
    cou[1] = 1;
    
    for(int i = 0; i < n; ++i){
        int x; cin >> x;
        
        while(x != 1){
            
            cou[spf[x]]++;
            int num = spf[x];
            while(x % num == 0)
                x /= num;
        }
    }
    
    int max_num = *max_element(cou, cou + N);
        
    if(max_num == 1){
        cout << "pairwise coprime";
    }else if(max_num != n){
        cout << "setwise coprime";
    }else{
        cout << "not coprime";
    }
    
}

int32_t main(){

	boost;

	int T;
	
	//cin >> T;
	 T = 1;
	
	for(int i = 1; i <= T; ++i){
		solve();
		cout << "\n";
	}

	return 0;
}



Measured memory_bytes: 11460
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int mod = 1e9 + 7;

char conv(char x)
{
    if (x >= 'a' && x <= 'z')
    {
        x += 'A' - 'a';
    }
    else if (x >= 'A' && x <= 'Z')
    {
        x += 'a' - 'A';
    }
    return x;
}

int main()
{
    string s;
    getline(cin, s);
    for (int i = 0; i < s.size(); i++)
    {
        s.at(i) = conv(s.at(i));
    }
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);


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

	string S;
	cin >> S;

	int a, b;
	a = (S[0] - '0') * 10 + (S[1] - '0');
	b = (S[2] - '0') * 10 + (S[3] - '0');
	auto func = [](int x) {
		return (1 <= x && x <= 12);
	};
	if (func(a) && !func(b))cout << "MMYY" << endl;
	else if (!func(a) && func(b))cout << "YYMM" << endl;
	else if (func(a) && func(b))cout << "AMBIGUOUS" << endl;
	else cout << "NA" << endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from math import factorial
MOD = 1000000007  # type: int

def cmb(n, r, p):
    return (factorial(n) // (factorial(r) * factorial(n - r))%p)

def solve(N: int, K: int):
    c = N-K

    for i in range(K):
        # i+1回の操作でとるために両端を除くセパレータの数はi個
        # 両端を含めたセパレータの数はi+2個
        # セパレータには最低1つ配属するので，配置する赤玉の数はN-K-i個
        # この赤玉をi+2個のセパレータに配属させる
        # i+2 H c-i
        if c-i<0:
            print(0)
        else:
            b = cmb(K-1, i, MOD)
            k = cmb(c+1, c-i, MOD)
            print(b*k%MOD)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


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

int main() {
    int A , B , C ;
    cin >> A >> B >> C ; //A , B, and C are all integers between 1 and 9 (inclusive).
    if (A == B && A != C && B != C) cout << "Yes" <<endl;
    if (A == C && A != B && C != B) cout << "Yes" <<endl;
    if (B == C && B != A && C != A) cout << "Yes" <<endl;
    if (B == C && B == A && C == A) cout << "No" <<endl;
    if (B != C && B != A && C != A) cout << "No" <<endl;
	return 0;
}

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

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

}


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

using namespace std;

int main(){
    
    int n;
    cin >> n;
    
    if(n%1000 == 0){
        cout << 0 << endl;
    } else {
        
        cout << 1000-(n%1000) << endl;
        
    }
    
    return 0;
    
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

bool sosu(int n){
	if (n == 1)
		return false;

	int sqr = sqrt(n);
	for (int i = 2; i <= sqr ;i++){
		if (n % i == 0){
			return false;
		}
	}
	return true;
}

int main()
{
	int a, d, n;
	while (cin >> a >> d >> n, a || d || n){
		int counter = 0;
		for (int i = a;; i = i + d){
			if (sosu(i))
				counter++;
			if (counter == n){
				cout << i<<endl;
				break;
			}
		}

	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;

int main()
{
    int h1, h2, m1, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int min = (h2-h1)*60+m2-m1-k;
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 3564
#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)

bool c[100004];
int n, l, r;
int s;

int main() {
  
  cin>>n;
  rep(i, n) {
    cin>>l>>r;
    for_(j, l, r+1)c[j] = true;
  }
  
  rep(i, 100000)s += c[i+1]?1:0;
  
  cout<<s;
  
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define vvl vector<vector<ll>>
#define vl  vector<ll>
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
int n;
ll ans;
vvl a(3,vl(3));

signed main(){
	acc_io;
	cin>>a[0][0]>>a[0][1]>>a[0][2];
	cin>>a[1][0]>>a[1][1]>>a[1][2];
	cin>>a[2][0]>>a[2][1]>>a[2][2];
	cin>>n;
//	vl b(n);
	int b;
	rep(i,0,n){
		cin>>b;
		rep(j,0,3){
			rep(k,0,3){
				if(a[j][k]==b) a[j][k]=0;
			}
		}
	}
	int tmp=0;
	rep(j,0,3){
		rep(k,0,3){
			tmp+=a[j][k];
		}
		if(tmp==0){
			cout<<"Yes"<<endl;
			return 0;
		}
		tmp=0;
	}
	rep(k,0,3){
		rep(j,0,3){
			tmp+=a[j][k];
		}
		if(tmp==0){
			cout<<"Yes"<<endl;
			return 0;
		}
		tmp=0;
	}
	tmp=0;
	rep(j,0,3){
		tmp+=a[j][j];
	}
	if(tmp==0){
		cout<<"Yes"<<endl;
		return 0;
	}
	tmp=a[0][2]+a[1][1]+a[2][0];
	if(tmp==0){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		if(n%1000==0) System.out.println("0");
		else
		{
			int c=n%1000;
			System.out.println(1000-c);
		}
	}

}


Measured memory_bytes: 26956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200010;
const ll MOD = 1000000007;
int h, w, a, b;
ll fac[N], inv[N];
void init() {
    fac[0] = inv[0] = 1;
    for (int i = 1; i < N; i++) {
        fac[i] = fac[i-1] * i %MOD;
    }
    inv[1] = 1;
    for (int i = 2; i < N; i++) {
        inv[i] = 1ll * (MOD - MOD/i) * inv[MOD%i] %MOD;
    }
    for (int i = 1; i < N; i++) {
        inv[i] = inv[i-1] * inv[i] %MOD;
    }
}
inline ll C(int n, int k) {
    return fac[n] * inv[k] %MOD * inv[n-k] %MOD;
}
int main() {
    init();
    cin >> h >> w >> a >> b;
    ll ans = 0;
    for (int i = 1; i <= h-a; i++) {
        ans += 1ll * C(i+b-2, i-1) * C(h-i+w-b-1, h-i) %MOD;
        ans %= MOD;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int n; cin >> n;
  int x = n%10;
  if(x == 3){
    cout << "bon" << endl;
  }else if(x == 0 || x == 1 || x == 6 || x == 8){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
  return 0;
}


Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0004
{
	class Program
	{
		static void Main(string[] args)
		{
			while( true ) {
				var	str	= Console.ReadLine();
				if( str == null ) {
					break;
				}
				var	n	= Array.ConvertAll( str.Split(), a => double.Parse( a ) );
				
				// 加減法
				var	nn	= Array.ConvertAll( str.Split(), a => double.Parse( a ) );
				for( int i = 0; i < 3; i++ ) {
					nn[ i ]	*= n[ 3 ];
				}
				for( int i = 3; i < 6; i++ ) {
					nn[ i ]	*= n[ 0 ];
				}
				double	y	= (nn[ 2 ] - nn[ 5 ]) / (nn[ 1 ] - nn[ 4 ]);
				double	x	= (n[ 2 ] - (n[ 1 ] * y)) / n[ 0 ];
				Console.WriteLine( "{0:f3} {1:f3}", x, y );
			}
		}
	}
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
constexpr long long MOD(long long in) {
	return in % mod;
}

int n, a, b;
int main()
{
	std::cin >> n >> a >> b;
	std::cout << std::min(a * n, b) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int in;
	scanf("%d",&in);
	int data,gohyaku,hyaku,goju,ju,go,iti;
	while(in!=0){
		data=1000-in;
		gohyaku=data/500;
		data-=gohyaku*500;
		hyaku=data/100;
		data-=hyaku*100;
		goju=data/50;
		data-=goju*50;
		ju=data/10;
		data-=ju*10;
		go=data/5;
		data-=go*5;
		iti=data;
		printf("%d\n",gohyaku+hyaku+goju+ju+go+iti);
		scanf("%d",&in);
	}
	return 0;
}

Measured memory_bytes: 600
n,y = gets.split(' ').map(&:to_i)
y = y/1000
ans = '-1 -1 -1'

for c in 0..y
	b = (10 * n - y - 9 * c) / 5
	a = n - b - c
	if ((10 * n - y - 9 * c) % 5) == 0 && c <= n && b >= 0 && a >= 0
		ans = a.to_s + ' ' + b.to_s + ' ' + c.to_s
		break
	else
		c += 1
	end
end
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; i++ )
#define rep(i,n) REP(i,0,n)

int main(){
    int N, M, X, Y; cin >> N >> M >> X >> Y;
    vector <int> c(N); 
    int a = X;
    rep(i, N){
        cin >> c[i];
        a = max(a, c[i]);
    }
    vector <int> d(M); 
    int b = Y;
    rep(i, M){
        cin >> d[i];
        b = min(b, d[i]);
    }
    if (a < b){
        cout << "No War" << endl;
    }
    else{
        cout << "War" << endl;
    }
    return 0;
}

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

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


int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N){
    cin >> a.at(i);
  }
  
  int ans = 0;
  for (int i = 0; i < N-2; i++){
    for (int j = i+1; j < N-1; j++) {
      for (int k = j+1; k < N; k++){
        vector<int> b(3);
        b.at(0) = a.at(i);
        b.at(1) = a.at(j);
        b.at(2) = a.at(k);
        sort(b.begin(),b.end());
        if(b.at(0)+b.at(1)>b.at(2)){
          if(b.at(0)!=b.at(1)&&b.at(1)!=b.at(2)){
          ans += 1;
        }
        }
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3484
N=int(input())
A=list(map(int,input().split()))
ans=1
t=0
if 0 in A:
 print(0)
else:
 while ans<=10**18 and t<N:
  ans*=A[t]
  t+=1
 if ans<=10**18:
  print(ans)
 else:
  print(-1)

Measured memory_bytes: 21664
n, t = map(int, input().split())
A = list(map(int, input().split()))

min_dif = 0
count = 0
min_val = A[0]

for i in range(1, n):
    if A[i]-min_val > min_dif:
        min_dif = A[i]-min_val
        count = 1
    elif A[i]-min_val == min_dif:
        count += 1

    min_val = min(min_val, A[i])

print(count)


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

N,M,X,Y = map(int, input().split())
xN = list(map(int, input().split()))
yM = list(map(int, input().split()))
# 首都も同一視できる
xN.append(X)
yM.append(Y)

# これだけでも干渉するか分かる
if max(xN) < min(yM):
    print('No War')
else:
    print('War')

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

long long int solve(long long int n){
	if(n==2){return 3;}
	else if(n==4||n==6||n==9||n==11){return 2;}
	else{return 1;}
}

int main() {
	long long int n=0,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b;
	cout<<(a+b)%24;



	cout<<endl;
} 


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

using namespace std;
#define int long long
const int N = 1e5 + 10, MOD = 1e9 + 7;
int a[N];
vector <int> vec[N];

int32_t main()
{
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        vec[a[i]].push_back(i);
    }
    int ans = 1;
    for (int i = n - 1; i >= 1; i--) {
        if (vec[i].size() > 3 || vec[i].size() > vec[i - 1].size()) return cout << "0\n", 0;
        for (int j = 0; j < vec[i].size(); j++) {
            int x = lower_bound(vec[i - 1].begin(), vec[i - 1].end(), vec[i][j]) - vec[i - 1].begin();
            if (x - j <= 0) return cout << "0\n", 0;
            ans = (ans * (x - j)) % MOD;
        }
    }
    if (vec[0].size() > 3) return cout << "0\n", 0;
    if (vec[0].size() == 1) ans = (ans * 3) % MOD;
    else ans = (ans * 6) % MOD;
    cout << ans << "\n";
}


Measured memory_bytes: 6528
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log, floor
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

t = input()

if(t.isupper()):
    print('A')
else:
    print('a')

Measured memory_bytes: 68248
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<cmath>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;

int main() {
	ll a;
	cin >> a;
	cout << a * a << endl;
}

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

using namespace std;

bool isYear(int a, int b) {
    if (a == 0 && b == 0) {
        return true;
    }
    if (a == 1 && b > 2) {
        return true;
    }
    if (a > 1) {
        return true;
    }

    return false;
}

string f(string s) {

    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';

    if (isYear(a, b) == true) {
        if (isYear(c, d) == true) {
            return "NA";
        } else {
            return "YYMM";
        }
    }
    if (isYear(c, d) == true) {
        if (isYear(a, b) == true) {
            return "NA";
        } else {
            return "MMYY";
        }
    }

    return "AMBIGUOUS";
}

int main() {

    string s;
    cin >> s;

    string result = f(s);
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define NDEBUG
#define debug(...)
#define IFD(...)
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <iostream>
#include <iomanip>
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = static_cast<int>(a); i <= static_cast<int>(b); ++i)
#define FORD(i, a, b) for (int i = static_cast<int>(b); i >= static_cast<int>(a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int h, n;
    cin >> h >> n;
    vector<int> a_s(n), b_s(n);
    rep(i, n)
    {
        cin >> a_s[i] >> b_s[i];
    }
    vector<int> dp(h + 1, 10000'0001);
    dp[h] = 0;
    rep(i, n)
    {
        FORD(k, 0, h)
        {
            int l = max(0, k - a_s[i]);
            chmin(dp[l], dp[k] + b_s[i]);
        }
    }
    cout << dp[0] << endl;

    return 0;
}


Measured memory_bytes: 3596
//Robs Code
#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define all(x) x.begin(),x.end()
#define ed cout<<"\n";
#define pb push_back
#define pii pair<ll,ll>
#define _1 first
#define _2 second
#define maxi 100000007
/**********************************************************/
using namespace std;
ll i,j,k,n,m,q,t,a,b,c,cnt,sum,tot;
int main() 
{
    speed;
    string s;
    cin>>s;
    stack<char> st;
    for(auto x : s){
        if(!st.empty()&&st.top()!=x){
            cnt++;
            st.pop();
        }else{
            st.push(x);
        }
    }
    cout<<2*cnt;
    return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
	string S;
	cin >> S;
	int len = S.size();

	int cnt1=0, cnt2=0;
	int cnt3=0, cnt4=0;
	int change = 0;
	bool flag = false;
	vector<char> o, e;
	rep(i, len) {
		if (i % 2 == 0) e.push_back(S[i]);
		else o.push_back(S[i]);
	}
	
	rep(i, e.size()) {
		if (e[i] == '0') cnt1++;
		else cnt2++;
	}

	rep (i, o.size()) {
		if (o[i] == '0') cnt3++;
		else cnt4++;
	}

	cout << min(cnt1 + cnt4, cnt2 + cnt3) << endl;





	return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
pair<int,int> v[6],k;
int x[6];
bool cmp(pair<int,int> a,pair<int,int> b)
{
    if(a.second>b.second)
        return 0;
    else return 1;
}
int main()
{
    for(int i=1;i<=5;i++)
    {
        cin>>v[i].first;
    }
    int t=0;
    for(int i=1;i<=5;i++)
    {
        v[i].second=10-v[i].first%10;
        if(v[i].second==10) v[i].second=0;
    }
    sort(v+1,v+6,cmp);
    for(int i=1;i<=5;i++)
    {
        if(i!=5)
            t+=v[i].first+v[i].second;
        else t+=v[i].first;
    }
    cout<<t;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int max(int a,int b){
if(a>b)return a;
else return b;
}

int abs(int a){
if(a>0)return a;
else return -a;
}

int main(){
int n,z,r;
scanf("%d%d%d",&n,&z,&r);
int a[n];
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
int ans;
if(n==1)ans=abs(a[0]-r);
else ans=max(abs(a[n-1]-r),abs(a[n-1]-a[n-2]));
printf("%d",ans);
return 0;
}


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


int main(void) {
   int N;
   cin >> N;
    vector<int> vec(N);
    rep(i,N) {
        cin >> vec.at(i);
   }
        sort(vec.begin(),vec.end());
        reverse(vec.begin(),vec.end());

    int A=0, B=0;
        rep(i,N){
            if(i%2 == 0) {
                A += vec.at(i);
            }else{
                B += vec.at(i);
            }
        }
  cout << A-B << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>=MOD){
		a -= MOD;
	}
}

int main(void){
	int i,j,n,ans=0,h[123];
	bool flag;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> h[i];
		flag = true;
		for(j=0; j<i; ++j){
			if(h[j]>h[i]){
				flag = false;
				break;
			}
		}
		if(flag){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL n;cin>>n;
    string s;cin>>s;

    deque<LL> r;
    deque<LL> w;

    REP(i,n){
        if(s[i] == 'R'){
            r.push_back(i);
        }
        else{
            w.push_back(i);
        }
    }

    if(w.empty() || r.empty()){
        cout<<0<<endl;
        return;
    }

    LL result = 0;
    while(true){
        if(w.empty() || r.empty()){
            break;
        }
        LL wt = w.front();
        LL rt = r.back();
        w.pop_front();
        r.pop_back();
        if(wt < rt){
            result++;
        }
    }

    cout<< result<<endl;

	return;
}

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

Measured memory_bytes: 5260
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
ans=2*(n//11)
if 0<(n%11)<=6:
    ans+=1
elif 6<(n%11):
    ans+=2
print(ans)


Measured memory_bytes: 9500
#include <iostream>
using namespace std;
int n,a,b;

int sumOfDigits(int n){
  if (n==0) return 0;
  return n % 10 + sumOfDigits(n / 10);
}


int main(){
  cin>>n>>a>>b;
  int total = 0;

  for (int i = 1; i <= n; i++) {
    int target = sumOfDigits(i);
    if (target <= b && target >= a) total += i;
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


map<char,ll>mp;


ll dp[102][5][5][5][5];

ll n;

string str;


ll ok(ll a,ll b,ll c,ll d)
{
   ll sum=0,num=0;

   sum=a;

   sum*=10;

   sum+=b;

   sum*=10;

   sum+=c;

   sum*=10;

   sum+=d;



   num=b;

   num*=10;

   num+=c;

   num*=10;

   num+=d;


   if(sum==123 || sum==132 || sum==213 ||
      sum==1243 || sum==1423 || sum==1223 || sum==1323)
        return -1;

   if(num==123 || num==132 || num==213)return -1;

   ll s=0;

   s=a;
   s*=10;
   s+=b;
   s*=10;
   s+=c;

    if(s==123 || s==132 || s==213)return -1;


    return num>100;



}

ll call(ll pos,ll a,ll b,ll c,ll d)
{

      if(ok(a,b,c,d)==-1)return 0;

      if(pos==n)
      {
          if(ok(a,b,c,d)==1)return 1;

          else return 0;
      }

      ll &ret=dp[pos][a][b][c][d];


      if(~ret)return ret;


      ret=0;

      for(ll i=0; i<4; i++)
      {
          ret=(ret+call(pos+1,b,c,d,mp[str[i]]))%Mod;
      }


        return ret%Mod;




}

int main()
{

   fastread();

   ll i,j,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;



      cin>>n;

      memset(dp,-1,sizeof(dp));

   str="AGCT";

    mp['A']=1;

    mp['G']=2;

    mp['C']=3;

    mp['T']=4;


    cout<<call(0,0,0,0,0)<<endl;
















}



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

int main() {
    long long K, A, B;
    cin >> K >> A >> B;

    long long ans = 1;
    if (B - A <= 2 || K <= A - 1) {
        ans += K;
    } else {
        K -= A - 1;
        ans += A - 1;
        ans += (B - A) * (K / 2);
        ans += K % 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>

int main(void){

 int W, H, x, y, r;
 scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

 int u = y+r, d = y-r, rw = x+r, l = x-r;

 if(u <= H && d >= 0 && rw <= W && l >= 0)puts("Yes");
 else puts("No");

 return 0;

}


Measured memory_bytes: 2108
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
using namespace std;
int n,a[100005],i,ans,f1,f2,mx,s;
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		s+=abs(a[i]);
		if(a[i]<=0)
			f1=1;
		if(a[i]>0)
			f2=1;
	}
	if(f1==1&&f2==1)
	{
		for(i=1;i<=n;i++)
			ans+=abs(a[i]);
		cout<<ans<<endl;
		ans=0;
		int u,v;
		for(i=1;i<=n;i++)
		{
			if(a[i]<=0)
				u=i;
			if(a[i]>0)
				v=i;
		}
		ans=a[u];
		for(i=1;i<=n;i++)
			if(a[i]>0&&i!=v)
			{
				printf("%d %d\n",ans,a[i]);
				ans-=a[i];
			}
		printf("%d %d\n",a[v],ans);
		ans=a[v]-ans;
		for(i=1;i<=n;i++)
			if(a[i]<=0&&i!=u)
			{
				printf("%d %d\n",ans,a[i]);
				ans-=a[i];
			}
	}
	else
		if(f1==0)
		{
			int u,v;
			mx=1<<30;
			for(i=1;i<=n;i++)
				if(mx>a[i])
				{
					mx=a[i];
					u=i;
					v=u;
				}
				else
					v=i;
			ans=a[u];
			cout<<s-2*a[u]<<endl;
			for(i=1;i<=n;i++)
				if(i!=u&&i!=v)
				{
					printf("%d %d\n",ans,a[i]);
					ans-=a[i];
				}
			printf("%d %d\n",a[v],ans);
		}
		else
		{
			int u;
			mx=-1000000000;
			for(i=1;i<=n;i++)
				if(mx<a[i])
				{
					mx=a[i];
					u=i;
				}
			ans=mx;
			cout<<s+ans*2<<endl;
			for(i=1;i<=n;i++)
				if(i!=u)
				{
					printf("%d %d\n",ans,a[i]);
					ans-=a[i];
				}
		}
}


Measured memory_bytes: 2304
#include <stdio.h>
int main()
{
   int a,b,c[4],i,temp=0;
   scanf("%d %d",&a,&b);
   c[0]=a+b;
   c[1]=a-b;
   c[2]=a*b;
   if(c[0]>c[1]&&c[0]>c[2]){
     printf("%d\n",c[0]);
   }
   else if(c[2]>c[0]&&c[2]>c[1]){
    printf("%d\n",c[2]);
   }
   else{
    printf("%d\n",c[1]);
   }
   return 0;
   }

Measured memory_bytes: 128
dom_num = int(input())
dom_rain = [int(i) for i in input().split(" ")]
mou_rain = []
a = 0
is_plus = 1
for i in dom_rain:
    if is_plus:
        a += i
    else:
        a -= i
    is_plus = 1 - is_plus
mou_rain.append(a)
for i in range(0, dom_num - 1):
    mou_rain.append(2 * dom_rain[i] - mou_rain[- 1])
print(" ".join([str(i) for i in mou_rain]))

Measured memory_bytes: 19144
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  vector<int> hen(3),ans(4);
  fill(ans.begin(),ans.end(),0);

  while(cin >> hen[0] >> hen[1] >> hen[2]){

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

    if(hen[2] < hen[0] + hen[1]){
      ans[0]++; 
      if(hen[2]*hen[2] < hen[0]*hen[0] + hen[1]*hen[1]){
	ans[2]++;
      }else if(hen[2]*hen[2] > hen[0]*hen[0] + hen[1]*hen[1]){
	ans[3]++;
      }else ans[1]++;

    }else break;
  }
  for(int i = 0 ; i < 4 ; i++ ){
    if(i == 0)cout << ans[0];
    else cout <<' '<< ans[i];
  }
  cout << endl;

  return 0;
}

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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 2011, inf = 1000111222;

char f[max_n][max_n];
int cnt[max_n][max_n];

int main()
{
    //freopen("input.txt", "r", stdin);
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        scanf("%s", f[i]);
    }
    for (int i = 0; i < h; ++i) {
        int cr = 0;
        for (int j = w - 1; j >= 0; --j) {
            cnt[i][j] += cr;
            if (f[i][j] == '.') {
                ++cr;
            } else {
                cr = 0;
            }
        }
        int cl = 0;
        for (int j = 0; j <= w - 1; ++j) {
            cnt[i][j] += cl;
            if (f[i][j] == '.') {
                ++cl;
            } else {
                cl = 0;
            }
        }
    }


    for (int j = 0; j < w; ++j) {
        int cd = 0;
        for (int i = h - 1; i >= 0; --i) {
            cnt[i][j] += cd;
            if (f[i][j] == '.') {
                ++cd;
            } else {
                cd = 0;
            }
        }
        int cu = 0;
        for (int i = 0; i <= h - 1; ++i) {
            cnt[i][j] += cu;
            if (f[i][j] == '.') {
                ++cu;
            } else {
                cu = 0;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (f[i][j] == '#') continue;
            ans = max(ans, 1 + cnt[i][j]);
        }
    }
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 19968