akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
def BitArrFromInt(i):
    arr = []
    quotient = i
    for ind in range(3):
        arr.append(quotient % 2)
        quotient /= 2
    return arr

def OpeStrFromBit(i):
    return '+' if i == 0 else '-'

# ABC 079 C -- Train Ticket
def solve():
    S = raw_input()
    # A, B, C, D = [int(S[i]) for i in range(len(S))]
    for i in range (2**3):
        bit_arr = BitArrFromInt(i)
        sum = int(S[0])
        for j in range (3):
            sum += (int(S[j+1]) if bit_arr[j] == 0 else -int(S[j+1]))
            # print sum
        if sum == 7:
            print S[0] + OpeStrFromBit(bit_arr[0]) + S[1] + \
                OpeStrFromBit(bit_arr[1]) + S[2] + OpeStrFromBit(bit_arr[2]) + S[3]+ '=7'
            break

if __name__ == '__main__':
    solve()


Measured memory_bytes: 2692
n, a, b = map(int, input().split())

def sum_all_digits(m):
    res = 0
    while m > 0:
        res += m % 10
        m = m // 10
    return res

ans = 0
for i in range(1, n+1):
    s = sum_all_digits(i)
    if a <= s and s <= b:
        ans += i

print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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; }

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */
int main(){
    int a, b, t;
    cin >> a >> b >> t;
    cout << b*(t/a)<< endl;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main()
	{
		Console.WriteLine(Regex.IsMatch(GetString(), "^A?KIHA?BA?RA?$") ? "YES" : "NO");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 16184
#include <bits/stdc++.h>
using namespace std;
int main () {
	int a,b;
	scanf("%d %d", &a, &b);
	if (a>b) {
	a=a-1;
	printf("%d\n",a);
	} else if (a<b) {
	printf("%d\n",a);
	} else {
	printf("%d\n",a);
	}
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	int rem=n%10;
	if(rem==2 || rem==4 || rem==5 || rem==7 || rem==9){
		cout<<"hon";
	}
	else if(rem==0 || rem==1 || rem==6 || rem==8){
		cout<<"pon";
	}
	else{
		cout<<"bon";
	}
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
int main() {
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  int n,k=0;
  cin>>n;
  while(n>0)
  {
      if(n%10==7)
      {
          k=1;
      }
      n=n/10;
  }
  if(k==1)
  {
      cout<<"Yes";
  }
  else
  {
      cout<<"No";
  }
}

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

int main(void)
{
    int i,tmp;
    int N,keta=0;
    int count=0;

    scanf("%d",&N);

    for(i=0; i<=N; i++){
        keta=0;
        tmp = i;
        //桁を求める
        while(tmp > 0){
            tmp/=10;
            keta++;
        }
        //桁が奇数ならカウント
        if(keta%2 == 1) {
            //printf("i=%d\n",i);
            count++;
        }
    }

    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 128
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline())
A = list(map(int, readline().split()))

S = [0] * N

for a in A:
    S[a-1] += 1

for s in S:
    print(s)

Measured memory_bytes: 27832
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  lint n,a,b;
  cin>>n>>a>>b;
  lint loop=n/(a+b);
  lint remain=n%(a+b);
  lint result=a*loop;
  if(remain<=a){
    result+=remain;
  }else{
    result+=a;
  }
  cout<<result<<endl;

  return 0;
}




Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}

// nCk の組み合わせを列挙する
pub fn combination(n: usize, k: usize) -> Vec<Vec<usize>> {
    let mut ans = Vec::new();
    if k == 1 {
        for i in 1..n+1 {
            let mut tmp = Vec::new();
            tmp.push(i);
            ans.push(tmp);
        }
    }
    else {
        for iter in combination(n-1, k-1) {
            let max = iter.iter().max().unwrap();
            for j in *max+1..n+1 {
                let mut tmp = iter.clone();
                tmp.push(j);
                ans.push(tmp);
            }
        }
    }
    ans
}

use std::f64;

fn main() {
    input!{
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }
    let mut ha: f64 = 360.0 * h / 12.0 + 360.0 * m / (60.0 * 12.0);
    let mut ma: f64 = 360.0 * m / 60.0;
    let mut ma: f64 = 2.0 * f64::consts::PI * (ha-ma).abs() / 360.0;
//    println!("{}", (ha-ma).abs());
    let mut ans = (a * a + b * b - 2.0 * a * b * ma.cos()).sqrt();
    println!("{}", ans);
}


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

int main() {
    int n, k, q, a;
    cin >> n >> k >> q;
    vector<int> v(n, 0);
    for (int i = 0; i < q; i++) {
        cin >> a;
        v[a-1]++;
    }
    for (int i = 0; i < n; i++) {
        if (v[i]+k-q > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h> 
#include<iostream>
using namespace std;
const int maxn=2e5+5;
int a[maxn];
int main()
{
	int n;
	while(cin>>n)
	{
		int min=maxn,t=0;
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
			if(min>a[i])
			{
				min=a[i];
			}
			if(min==a[i])
			t++; 
			
		}
		cout<<t<<'\n';
		
	}
	
	
	
}

Measured memory_bytes: 1024
import itertools

H, W, K = map(int, input().split())
C = []
 
for i in range(H):
    C.append(input())

ans = 0

for i in range(H+1):
    for j in range(W+1):
        for m in itertools.combinations(list(range(H)), i):
            for n in itertools.combinations(list(range(W)), j):
                count = 0
                for a in m:
                    for b in n:
                        if(C[a][b] == "#"):
                            count += 1
                if(count == K):
                    ans += 1

print(ans)


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()
#define pb push_back


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vi arr(n);
    for (int i = 0; i < n; ++i) cin >> arr[i];
    sort(all(arr));
    if (arr.size() == 0 || arr.size() & 1) {
        cout << 0 << endl;
        return 0;
    }
    int m = arr.size() >> 1;
    cout << arr[m] - arr[m-1] << endl;
    return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,l;
int sum = 0;
//const long long maxn = 1e8;
//long long a,b,c,d;
//long long ans = 0;
//long long a1[maxn],a2[maxn];
int main(void)
{
	scanf("%d %d",&n,&l);
	int a = l,b = l+n-1;
	sum = (a+b)*(b-a+1)/2;
	if(a<=0 && b>=0) cout<<sum<<endl;
	else if(a<=0 && b<=0 ) cout<<(sum-b)<<endl;
	else cout<<(sum-a)<<endl; 
//	scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
//	if(a>b) swap(a,b);
 
	return 0;
} 

Measured memory_bytes: 256
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import pprint
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n, k = MI()
print(0 if n % k == 0 else 1)



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

t = 0
for i in range(n+2):
    if N[t] == 2:
        break
    else:
        t = N[t] - 1
if i == n+1:
    print(-1)
else:
    print(i+1)

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

int main() {
  int a, b;
  cin >> a >> b;

  if (b == 1) {
    cout << 0 << endl;
    return 0;
  }

  int i = 1;
  while (1) {
    if (a * i - (i - 1) >= b) {
      cout << i << endl;
      return 0;
    } else
      i++;
  }
}

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

int main(void){
  char s[4];
  int a,b;
  
  
  scanf("%s", s);
  /*
  for(int i=0; i<5; i++){
  if(strcmp(s[i],"A")==0){
    a++;
  }
   else if(strcmp(s[i],"B")==0){
     b++;
   }
  }
  */
  if(s[0]==s[1] && s[1]==s[2]){
    printf("No");
  }
  else{
    printf("Yes");
  }

  return 0;

}





  
  
    

Measured memory_bytes: 1732
def main():
        
    N,C = map(int, input().split())

    #　各時間各チャンネルで録画機が動いてるかどうか
    R = [[0]*(10**5) for _ in range(C)]

    for _ in range(N):
        s,t,c = map(int, input().split())
        #チャンネルｃをｓからｔまで録画、ｓの0.5秒前から録画機を使うのでs-1始まりにする
        R[c-1][s-1:t] = [1] * (t-(s-1))

    ans = 0
    for t in range(10**5):
        cnt = 0
        for ch in range(C):
            if R[ch][t] == 1: cnt += 1

        ans = max(ans, cnt)

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 28660
#include<cstdio>
#include<iostream>
int a, b, sum[1000];
using namespace std;
int main() {
	cin >> a >> b;
	for (int i = 1; i <= 999; i++) sum[i] = sum[i - 1] + i;
	printf ("%d", sum[b - a] - b);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  /*h:時間,m:分,s:秒
  　Sを入力
  　Sが６０未満のときsは秒だけ
  　Sが３６００未満のとき分と秒
  　Sが３６００以上のとき時間が発生する
  　出力はh:m:sの形式*/
  int S,h,m,s;
  scanf("%d",&S);
  if(S<60){
    printf("0:0:%d\n",S);
  }else if(S>=60 && S<3600){
    m=S/60;
    s=S%60;
    printf("0:%d:%d\n",m,s);
  }else if(S>=3600){
    h=S/3600;
    S=S-h*3600;
    m=S/60;
    s=S%60;
    printf("%d:%d:%d\n",h,m,s);
  }
  return 0;
}



Measured memory_bytes: 2104
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = int(1e9) + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

struct SieveOfEratosthenes {
    int n;
    vector<int> primes;
    vector<bool> isPrime;
    SieveOfEratosthenes(int n_) {
        isPrime.assign(n_, true);
        isPrime[0] = isPrime[1] = false;
        for (int i = 2; i < n_; ++i) {// primesがどうでもよければ i < n / iでいい
            if (!isPrime[i]) continue;
            primes.emplace_back(i);
            for (int j = i * 2; j < n_; j += i) isPrime[j] = false;
        }
        n = primes.size();
    }
} soe(1e5 + 5);

int main() {
    int Q;
    cin >> Q;
    vi l(Q), r(Q);
    rep(i, Q) cin >> l[i] >> r[i];

    vi cnt(1e5, 0);
    for (int n = 3; n < 1e5; n += 2) {
        cnt[n] = cnt[n - 2];
        if (soe.isPrime[n] && soe.isPrime[(n + 1) / 2]) cnt[n]++;
    }

    rep(i, Q) {
        write(cnt[r[i]] - cnt[l[i] - 2]);
    }
}

Measured memory_bytes: 1920
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli ans [1000];

void solve()
{

    lli n, k;
    cin>>n>>k;
    for(int i = 0; i < k; i ++) {
        lli x ;
        cin>>x;
        for(int j = 0; j < x; j ++) {
            lli t;
            cin>>t;
            ans[t] ++;
        }
    }

    lli p = 0;

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

    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define SPEED ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sz size()
#define all(x) x.begin(),x.end()
#define OO 1e18
#define iOO INT_MAX
#define Mdp memset(dp,-1,sizeof dp)
#define R return
#define Test int TT;cin>>TT;for(int T=1;T<=TT;T++)
using namespace std;

ll Dp[110][300010];

int main()
{

    SPEED;

    int n,a[100010][2],W;
    cin >> n >> W;
    for(int i=0;i<n;i++)
    {
        cin >> a[i][0] >> a[i][1];
    }


    for(int i=0;i<n;i++)
    {
        int w = a[i][0], cost = a[i][1];
        for(int j=0;j<W;j++)
        {
            Dp[i+1][j] = Dp[i][j];
        }
        for(int j=0;j<W;j++)
        {
            if(j+w > W)
                break;
            Dp[i+1][j+w] = max(Dp[i+1][j+w],Dp[i][j]+cost);
        }
    }

    ll Ans = 0;
    for(int i=0;i<=W;i++)
        Ans = max(Ans,Dp[n][i]);

    cout << Ans << endl;
    R 0;
}


Measured memory_bytes: 233728
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <assert.h>
#include <deque>
#include <algorithm>
#include <string>
using namespace std;

typedef long long lli;
typedef pair<int, int> pii;

lli arr[100000];

int main() {
    int n;
    scanf("%d", &n);
    int i;
    lli s = 0;
    for (i=0; i<n; ++i) {
        scanf("%d", &arr[i]);
        s += arr[i];
    }
    lli p = (lli)n * (n + 1) / 2;
    if (s % p) {
        return puts("NO") & 0;
    }
    int sols = (int)(s / p);
    int sols_t = sols;
    arr[0] -= sols;
    for (i=1; i<n; ++i) {
        arr[i] -= (lli)sols * (i + 1);
        lli diff = arr[i-1] - arr[i];
        if (diff < 0 || diff % n) {
            return puts("NO") & 0;
        }
    }
    puts(sols_t >= 0 ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  string s;
  cin>>s;
  auto a=s.find_first_of('A');
  auto z=s.find_last_of('Z');
  cout<<z-a+1<<endl;

  return 0;
}


Measured memory_bytes: 640
from heapq import heappush, heappop

def main():
  INF = 10 ** 20
  vec = ((0, 1), (0, -1), (-1, 0), (1, 0))
  
  h, w = map(int, input().split())
  mp = [[-1] + list(map(int, input().split())) + [-1] for _ in range(h)]
  mp.insert(0, [-1] * (w + 2))
  mp.append([-1] * (w + 2))
  
  is_goal = [[False] * (w + 2) for _ in range(h + 2)]
  que = []
  heappush(que, (w, h))
  while que:
    x, y = heappop(que)
    is_goal[y][x] = True
    if mp[y][x] != 0:
        continue
  
    for dx, dy in vec:
      nx, ny =  x + dx, y + dy
      if mp[ny][nx] == -1 or is_goal[ny][nx]:
        continue
      heappush(que, (nx, ny))
  
  costs = [[[INF] * (w + 2) for _ in range(h + 2)] for _ in range(w * h)]
  que = []
  heappush(que, ((0, 0, 1, 1))) #score, dist, x, y
  costs[0][1][1] = 0
  
  while que:
    score, dist, x, y = heappop(que)
    for dx, dy in vec:
      nx, ny = x + dx, y + dy
      
      wood = mp[ny][nx]
      if wood == -1:
        continue
      if dist >= w * h - 1:
        continue
  
      new_score = score + (dist * wood * 2) + wood
      if costs[dist + 1][ny][nx] > new_score:
        costs[dist + 1][ny][nx] = new_score
        heappush(que, (new_score, dist + 1, nx, ny))
  
  ans = min([costs[d][y][x] for y in range(1, h + 1) for x in range(1, w + 1) for d in range(w * h) if is_goal[y][x]])
  print(ans)
  
main()  


Measured memory_bytes: 42000
#include <iostream>
#include <cstring>
using namespace std;
long long a[300005];
const int MOD = 1000000007;
int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> a[i];
  long long ans = 0;
  for(int j = 0; j < 60; j++)
  {
    long long u = 0, v = 0;
    for(int i = 0; i < n; i++)
    {
      if(a[i]&(1LL<<j))u++;
      else v++;
    }
    ans += u * v % MOD * ((1LL<<j) % MOD) % MOD;
  }
  cout << ans % MOD << endl;
}


Measured memory_bytes: 2688
a, b = map(int, input().split())
card = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
Alice = card.index(a)
Bob = card.index(b)
if Alice == Bob:
    print('Draw')
elif Alice > Bob:
    print('Alice')
else:
    print('Bob')

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

using namespace std;

string s;
long long ans=0;
bool dvd[10];

void dfs (int dep)
{
    if (dep==s.size()-1)
    {
        string t;
        t=s[0];
        for (int i=0; i<dep; i++)
        {
            if (dvd[i]) { ans+=stoll(t); t=s[i+1]; }
            else t+=s[i+1];
        }
        ans+=stoll(t);
        return;
    }
    dvd[dep]=true;
    dfs(dep+1);
    dvd[dep]=false;
    dfs(dep+1);
    return;
}

int main()
{
    cin>>s;
    for (int i=0; i<10; i++) dvd[i]=false;
    dfs(0);
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };

signed main() {
	int n, a, b;
	cin >>n>>a>>b;
	cout << min(n * a, b) << endl;
}

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

#define ran 22

int n, m, x;
int price[ran];
int inc[ran][ran];

int cur[ran];
int ans;

void upd(int &a, int b) {
	if(a<0 || a>b) a = b;
}

void dfs(int dep, int cost) {
	if(dep==n) {
		bool f = true;
		for(int i=0;i<m;i++)
			if(cur[i] < x) f = false;
		if(f==true) upd(ans, cost);
		return;
	}
	
	dfs(dep+1, cost);
	for(int i=0;i<m;i++)
		cur[i] += inc[dep][i];
	dfs(dep+1, cost + price[dep]);
	for(int i=0;i<m;i++)
		cur[i] -= inc[dep][i];
}

int main() {
	scanf("%d%d%d", &n, &m, &x);
	for(int i=0;i<n;i++) {
		scanf("%d", &price[i]);
		for(int j=0;j<m;j++)
			scanf("%d", &inc[i][j]);
	}
	memset(cur, 0, sizeof cur);
	ans = -1;
	dfs(0, 0);
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 3728
//template code, C343, 2019
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	private int[] completion;
	private boolean[] seen;
	private int[] indegree;

	// adjacency list of edges
	public Graph() {
		totalVertex = 0;
	}

	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		completion = new int[totalVertex];
		seen = new boolean[totalVertex];
		indegree = new int[totalVertex];
		
		int totalEdges = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		
		for(int i = 0; i < totalVertex ; i++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			adjList.add(tmp);
		}
		
		for (int i = 0; i < totalEdges; i++) {
			int vert = in.nextInt();
			int out = in.nextInt();
			adjList.get(vert).add(out);
			indegree[out]++;
		}
		
		in.close();
	}
	
	/**
	 * performs DFS on the graph, populating completion starting with 
	 * pos by order of completion and returns the next available pos
	 */
	public int topSortDFS(int start, int pos) {
		LinkedList<Integer> neighbors = adjList.get(start);
		seen[start] = true;
		
		for(Integer n : neighbors) {
			if(!seen[n]) {
			pos = topSortDFS(n, pos);
			}
		}
		
		completion[pos] = start;
		return pos + 1;
	}

	public void printTopological() {
		int pos = 0;
		for(int i = 0; i<totalVertex; i++) {
			if(!seen[i]) {
				pos = topSortDFS(i, pos);
			}
		}
		
		for(int i = totalVertex - 1; i >= 0; i--) {
			System.out.println(completion[i]);
		}
	}
	
	public void eligibleMethod() {
		Queue<Integer> eligible = new LinkedList<Integer>();
		for(int i = 0; i < totalVertex; i++) {
			if(indegree[i] == 0) {
				eligible.add(i);
			}
		}
		
		while(!eligible.isEmpty()) {
			int cur = eligible.poll();
			System.out.println(cur);
			for(Integer n : adjList.get(cur)) {
				indegree[n]--;
				if(indegree[n] == 0) {
					eligible.add(n);
				}
			}
		}
	}
}
//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		// g.updateTimes();
		// g.printTimeStamps();
		// g.printAdjMatrix();
		//g.printShortestPaths();
		g.eligibleMethod();
	}
}


Measured memory_bytes: 71352
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int a,b;
	cin >> a >> b;
	if(b >= a) cout << a << endl;
	else cout << a-1 << endl;
	return 0;
}

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

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

    vector<int> A(N);
    vector<int> plus;
    vector<int> minus;
    int M = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        if (A[i] > 0)
        {
            plus.push_back(A[i]);
            M += A[i];
        }
        else
        {
            minus.push_back(A[i]);
            M -= A[i];
        }
    }

    int current;
    if (plus.size() > 1 && minus.size() > 1)
    {
        cout << M << endl;
        current = minus.front();
        int plus_idx = 0;
        int minus_idx = 1;
        while (plus_idx < plus.size() - 1)
        {
            cout << current << " " << plus[plus_idx] << endl;
            current -= plus[plus_idx];
            plus_idx++;
        }
        cout << plus[plus_idx] << " " << current << endl;
        current = plus[plus_idx] - current;
        while (minus_idx < minus.size())
        {
            cout << current << " " << minus[minus_idx] << endl;
            current -= minus[minus_idx];
            minus_idx++;
        }
    }
    else if (plus.size() == 1 && minus.size() == 1)
    {
        cout << M << endl;
        cout << plus.front() << " " << minus.front() << endl;
    }
    else if (plus.size() == 1)
    {
        cout << M << endl;
        current = plus.front();
        for (int m : minus)
        {
            cout << current << " " << m << endl;
            current -= m;
        }
    }
    else if (minus.size() == 1)
    {
        cout << M << endl;
        current = minus.front();
        int plus_idx = 0;
        while (plus_idx < plus.size() - 1)
        {
            cout << current << " " << plus[plus_idx] << endl;
            current -= plus[plus_idx];
            plus_idx++;
        }
        cout << plus[plus_idx] << " " << current << endl;
    }
    else if (plus.size() == 0)
    {

        sort(minus.rbegin(), minus.rend());
        cout << M + 2 * minus.front() << endl;
        current = minus.front();
        int minus_idx = 1;
        while (minus_idx < minus.size())
        {
            cout << current << " " << minus[minus_idx] << endl;
            current -= minus[minus_idx];
            minus_idx++;
        }
    }
    else if (minus.size() == 0)
    {
        sort(plus.begin(), plus.end());
        cout << M - 2 * plus.front() << endl;
        current = plus.front();
        int plus_idx = 1;
        while (plus_idx < plus.size() - 1)
        {
            cout << current << " " << plus[plus_idx] << endl;
            current -= plus[plus_idx];
            plus_idx++;
        }
        cout << plus[plus_idx] << " " << current << endl;
    }
}


Measured memory_bytes: 2808
#include <stdio.h> 
 #include <ctype.h> 
 #include <string.h> 
 
  int main(){ 
     char search[21], word[21]; 
     int count=0; 
     int i; 
     
     scanf("%s", search); 
     while(1){ 
         scanf(" %s", word); 
         if(strcmp(word, "END_OF_TEXT")==0)break; 
         for(i=0;word[i]!='\0';i++){ 
             word[i]=tolower(word[i]); 
         } 
         if(strcmp(word, search)==0){ 
             count++; 
         } 
     } 
     printf("%d\n", count); 
 
 
     return 0; 
 } 



Measured memory_bytes: 2060
#include<iostream>
using namespace std;
int n,a[200001];
int sum0,sum13,sum2;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]%4==0)   sum0++;
		else if(a[i]%4==2)   sum2++;
		else            sum13++;
	}
	if(sum2==0)
	{
		if(sum13>sum0+1)  cout<<"No";
		else              cout<<"Yes";
		return 0;
	}
	if(sum13>sum0)  cout<<"No";
	else            cout<<"Yes";
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <queue>

#define ll long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){ return (a % b)? gcd(b, a%b) : b; }
template<typename T> T lcm(T a, T b){ return a * b / gcd(a, b); }

class UnionFind{
    public:
    vector<int> par;
    UnionFind(int N) : par(N){
        REP(i,N) par[i] = i;
    }

    int root(int x){
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        par[x] = y; 
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }
};

int main(void){
    int n, q;
    cin >> n >> q;
    
    UnionFind uf(n);
    REP(i,q){
        int t, u, v;
        cin >> t >> u >> v;
        if(t == 0){
            uf.unite(u, v);
        } else{
            cout << uf.same(u, v) << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3992
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する


int main() {
    vector<int> f(26, 0);
    string s;
    cin >> s;

    REP(i, 0, s.size()) {
        f[s[i] - 'a']++;
    }

    REP(i, 0, 26) {
        if (f[i] == 0) {
            cout << (char) ('a' + i) << endl;
            return 0;
        }
    }

    cout << "None" << endl;


    return 0;

}


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

int main()
{
    int A, B;
    cin >> A >> B;
    if (A < 10 && B < 10)
    {
        cout << A * B << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2 * 10 ** 5)

n = int(input())
edge = [tuple(map(int, input().split())) for _ in range(n-1)]
connect = [set() for _ in range(n)]
for a, b in edge:
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)

d1 = [0] * n
dn = [0] * n

def dfs(v, ng, dis, d):
    d[v] = dis
    ng.add(v)
    for n in connect[v]:
        if n not in ng:
            dfs(n, ng, dis+1, d)

dfs(0, set(), 0, d1)
dfs(n-1, set(), 0, dn)

black = 0
white = 0
for i in range(n):
    if d1[i] <= dn[i]:
        black += 1
    else:
        white += 1
if black > white:
    print('Fennec')
else:
    print('Snuke')

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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int n, k; cin >> n >> k;
	string s; cin >> s;
	vector<int> v;
	int cnt = 1;
	for(int i=1;i<n;i++){
		if(s[i-1]!=s[i]){
			v.push_back(cnt);
			cnt = 1;
		}else{
			cnt++;
		}
	}
	v.push_back(cnt);
	v.push_back(0);
	int vs = v.size()/2;
	if(k>=vs){
		cout << n-1 << endl;
		return 0;
	}
	int vcnt = 0;
	int org = 0;
	for(auto c: v){
		org += max(c-1, 0);
	}
	vector<pii> vk;
	for(int i=0;i<v.size();i++){
		if(i>=k*2-1 && i%2==0){
			vcnt += v[i];
			org -= max(v[i]-1, 0);
			vk.push_back(make_pair(vcnt-1, org));
			vcnt -= v[i-(k*2-1)];
		}
		else if(i>=k*2-1 && i%2==1){
			vcnt += v[i];
			org -= max(v[i]-1, 0);
			org -= max(v[i+1]-1, 0);
			vk.push_back(make_pair(vcnt-1+v[i+1], org));
			vcnt -= v[i-(k*2-1)];
		}else{
			vcnt += v[i];
			org -= max(v[i]-1, 0);
		}
	}
	int ans = 0;
	for(int i=0;i<vk.size();i++){
		ans = max(ans, vk[i].first+vk[i].second);
	}
	cout << ans << endl;
	return 0;
}

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

int main(void)
{
	char ch;
	stack<int> S1;
	stack<pair<int, int> > S2;
	pair<int, int> p;
	int i, j, sum = 0, area;
	for (i = 0; cin >> ch; i++)
	{
		if (ch == '\\')
			S1.push(i);
		else if (ch == '/')
		{
			if (!S1.empty())
			{
				j = S1.top();
				S1.pop();
				area = i - j;
				sum += area;
				while (!S2.empty())
				{
					if (S2.top().first > j)
					{
						area += S2.top().second;
						S2.pop();
					}
					else 
						break;
				}
				S2.push(make_pair(j, area));
			}
		}
	}
	
	deque<int> D;
	while (S2.size() > 0)
	{
		D.push_front(S2.top().second);
		S2.pop();
	}
	cout << sum << endl << D.size();
	for (i = 0; i < D.size(); i++)
		cout << " " << D[i];
	cout << endl;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
#define all(v)   v.begin(),v.end()
#define meow ios::sync_with_stdio(0);cin.tie(0);

typedef long long int ll;
typedef unsigned long long int ull;

int main()
{
    ll a,b,c,ans;
   // double ans;
    cin>>a>>b>>c;
    ans=c/a;
    ans*=b;
    cout<<ans;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1e5 + 5, P = 1e9 + 7;
int n, k;
ll fac[maxn], inv[maxn], a[maxn], facinv[maxn];
ll C(int n, int k) {
	return fac[n] * facinv[k] % P * facinv[n - k] % P;
}
int main() {
	scanf("%d%d", &n, &k);
	fac[0] = 1;
	inv[1] = 1;
	facinv[0] = 1;
	for(int i = 1; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % P;
		if(i != 1) {
			inv[i] = 1LL * (P - P / i) * inv[P % i] % P;
		}
		facinv[i] = facinv[i - 1] * inv[i] % P;
	}
	for(int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
	}
	sort(a + 1, a + n + 1);
	ll ans = 0;
	for(int i = k; i <= n; ++i) {
		ans = (ans + 1LL * a[i] * C(i - 1, k - 1) % P + P) % P;
	}
	for(int i = 1; i <= n - k + 1; ++i) {
		ans = (ans - 1LL * a[i] * C(n - i, k - 1) % P + P) % P;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	public static void main(String[] aegs){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int a = 0;
		
		try {
			a = Integer.parseInt(br.readLine());
		} catch (NumberFormatException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		
		System.out.println(a*a*a);
		
		
	}

}

Measured memory_bytes: 16924
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;
#define PI = 3.14159265358979323846
/*------------------------------------------------------------------------------*/

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

  s = S / 3;
  int ans = 0;
  int a, b, c;
  REP(i, 0, max(K, s)+1){
    a = i;
    REP(j, a, max(K, s)+1){
      b = j;
      c = S - a - b;
      if(a > b || b > c){
        break;
      }
      if(c <= K){
        if(a + b + c == S){
          if(a == b && b == c && c == a){
            ans++;
          } else if(a != b && b != c && c != a){
            ans += 6;
          } else {
            ans += 3;
          }
        }
      }
    }
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)

def f(x):
    if x < p:
        return True
    if a[p-1] > a[x] + m:
        return False
    else:
        res = m * v
        res -= m * (n-x)
        res -= m * (p-1)
        for i in range(p-1, x):
            res -= min(m, max(0,a[x]+m-a[i]))
        return res <= 0

ok = 0
ng = n
while ng - ok > 1:
    nw = (ok+ng) // 2
    if f(nw):
        ok = nw
    else:
        ng = nw
print(ng)


Measured memory_bytes: 20512
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (!(x % y)) return y;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) {
  return x / gcd(x, y) * y;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long t[n];
  for (int i = 0; i < n; i++) cin >> t[i];
  if (n == 1) {
    cout << t[0] << "\n";
    return 0;
  }
  long long res = lcm(t[0], t[1]);
  for (int i = 2; i <= n - 1; i++) res = lcm(res, t[i]);
  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)
vector<int> h, memo;

// int dp(int n) {
//     if (memo[n] != -1) {
//         return memo[n];
//     }
//     if (n == 0) {
//         return 0;
//     }
//     if (n == 1) {
//         return abs(h[1] - h[0]);
//     }
//     memo[n] = min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
//     return min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
// }

signed main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i = i + 2) {
        cout << s[i];
    }
}

Measured memory_bytes: 592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
using namespace std;
int a[11];
int a1[11];
int pn=0;
int Flag;
void dfs(int i)
{
    if(Flag==1)
        return;

    if(a[i]>a[a1[pn]])
    {
        a1[++pn]=i;
        for(int m=i+1;m<=10;m++)
        {
            dfs(m);
        }
    }
    else
        return;
    int flag=0;
    for(int m=i+1;m<=10;m++)
    {
        if(a[m]>a[i])
            flag=1;
    }
    int flag2;
    if(flag==0||i==10)
    {
        int a2[11];
        int pm=0;
        for(int n=1;n<=10;n++)
        {
            flag2=0;
            for(int m=1;m<=pn;m++)
            {
                if(n==a1[m])
                   flag2=1;
            }
            if(!flag2)
            {
               a2[++pm]=n;
            }
        }
        int flag3=0;
        for(int m=1;m<pm;m++)
        {
            if(a[a2[m]]>a[a2[m+1]])
                flag3=1;
        }
        if(flag3==0)
        {
            Flag=1;
            return;
        }
        else
        {
            pn--;
            return;
        }
    }

}
int main()
{
    int n;
    
    scanf("%d",&n);
    getchar();
    a[0]=-1;
    a1[0]=0;
    for(int i=1;i<=n;i++)
    {
        Flag=0;
        pn=0;
        for(int j=1;j<=10;j++)
        {
            scanf("%d ",&a[j]);
        }
        dfs(1);
        if(Flag==0)
        {
            printf("NO\n");
        }
        else
            printf("YES\n");
    }
    return 0;
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type_a,class Type_b> bool chmax(Type_a &a,const Type_b &b){if(a<b){a=b;return true;}return false;}
template<class Type_a,class Type_b> bool chmin(Type_a &a,const Type_b &b){if(a>b){a=b;return true;}return false;}
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

/*二項係数(mod付き)*/
struct Combination{
	const int max=51e4;//適宜変更.
	const int mod=1e9+7;
	vector<long long> fact,inv,finv;//階乗,逆元,逆元の階乗.
	
	Combination():fact(max),inv(max),finv(max){
		fact[0]=fact[1]=1;
		inv[1]=1;
		finv[0]=finv[1]=1;
		for(int i=2;i<max;++i){
			fact[i]=fact[i-1]*i%MOD;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	long long nCk(int n,int k){
		if(n<k) return 0;
		if(n<0 or k<0) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
};

template<class Type_k,class Type_p>
Type_p mod_pow(long long n,Type_k k,Type_p p){//n^k(mod p).
	if(k==0) return 1;
	long long res=mod_pow(n*n%p,k/2,p);
	if(k&1) res=res*n%p;
	return res;
}

int main(){
	int n,a,b;
	cin>>n>>a>>b;
	
	llong ans=mod_pow(2LL,n,MOD)-1;
	
	llong tmp=1;
	REP(i,a) tmp=tmp*(n-i)%MOD;
	llong hoge=1;
	REP(i,a) hoge=hoge*(a-i)%MOD;
	tmp=(tmp*mod_pow((llong)hoge,MOD-2,MOD))%MOD;
	
	llong tmpp=1;
	REP(i,b) tmpp=tmpp*(n-i)%MOD;
	llong hogee=1;
	REP(i,b) hogee=hogee*(b-i)%MOD;
	tmpp=(tmpp*mod_pow((llong)hogee,MOD-2,MOD))%MOD;
	
	ans=(ans-tmp-tmpp+2*MOD)%MOD;
	
	cout<<ans<<endl;
}

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

int main(){
  int count=0;
  int S;
  cin>>S;
  if((S/100<=12) and (S/100>=1)){
    count+=1;
  }
  if((S%100<=12) and (S%100>=1)){
    count+=2;
  }
  switch(count){
      case 0:
      cout<<"NA";
      break;
    case 1:
      cout<<"MMYY";
      break;
    case 2:
      cout<<"YYMM";
      break;
    case 3:
      cout<<"AMBIGUOUS";
      break;
  }
}


Measured memory_bytes: 256