akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long long a[300009];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    long long  n,i,j,ans=0LL;
    cin >> n;
    for(i=0;i<3*n;i++) cin >> a[i];
    sort(a,a+3*n,greater<long long>());
    for(i=1;i<2*n;i+=2)
    {
        ans+=a[i];

    }
    cout << ans << endl;

}


Measured memory_bytes: 2560
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	t %= mod;
	if (n % 2 == 1)t *= a;
	return t % mod;
}

const int INF = 1001001001;


int main() {
	int n;
	cin >> n;
	set<string>p;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		p.insert(s);
	}
	cout << p.size() << endl;
	return 0;
}

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

a, b = map(int, input().split())
h, w = 99, 99
g = [["." for _ in range(w)] for _ in range(h)]
white = 1
black = 0

for i in range(0, h, 3):
    for j in range(0, w, 3):
        if black < b:
            g[i+1][j+1] = "#"
            black += 1

if a > 1:
    g[1][1] = "."

for i in reversed(range(0, h, 3)):
    for j in reversed(range(0, w, 3)):
        if white < a:
            for k in range(3):
                for l in range(3):
                    g[i+k][j+l] = "#"
            g[i+1][j+1] = "."
            white += 1

print(h, w)
for i in range(h):
    print("".join(g[i]))


Measured memory_bytes: 3188
#include <iostream>
#include <cstdlib>
#include <array>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main()
{
    vector<int> s, t;
    bool flag;
    flag = true;
    s.resize(26);
    t.resize(26);
    for (int i=0; i<26; ++i){
        s[i] = 0;
        t[i] = 0;
    }
    string s_letter, t_letter;
    cin >> s_letter >> t_letter;
    int l = s_letter.length();
    int count_s, count_t;
    for (int i=0; i<l; ++i){
        count_s = (int)(s_letter[i] - 'a');
        count_t = (int)(t_letter[i] - 'a');
        //cout << count_s << ":" << count_t << endl;
        s[count_s]++;
        t[count_t]++;
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    for (int i=0; i<26; ++i){
        if(s[i] != t[i]){
            flag = false;
            break;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 776
#include <cstdio>
using namespace std;

int n;
int m;
int ts[10000000];
int hs[10000000];

int main() {
  while (1) {
    scanf("%d%d", &n, &m);
    if (n == 0 && m == 0) return 0;

    int tsum = 0;
    for (int i=0; i<n; i++) {
      scanf("%d", &ts[i]);
      tsum += ts[i];
    }

    int hsum = 0;
    for (int i=0; i<m; i++) {
      scanf("%d", &hs[i]);
      hsum += hs[i];
    }

    int mini = 100000000;
    int ans1 = -1;
    int ans2 = -1;
    for (int i=0; i<n; i++) {
      for (int j=0; j<m; j++) {
        if (tsum-ts[i]+hs[j] == hsum-hs[j]+ts[i]) {
          if (mini > ts[i]+hs[j]) {
            mini = ts[i] + hs[j];
            ans1 = ts[i];
            ans2 = hs[j];
          }
        }
      }
    }

    if (ans1 == -1) puts("-1");
    else printf("%d %d\n", ans1, ans2);
  }
}

Measured memory_bytes: 2728
bingoboard = list()
for x in range(3):
    bingoboard.append([int(x) for x in input().split()])
trials = int(input())

for t in range(trials):
    bingno = int(input())
    for i in range(3):
        for j in range(3):
            if bingno == bingoboard[i][j]:
                bingoboard[i][j] = 0

bingoBool = False
diag = 0
diag2 = 0
for i in range(3):
    col= 0
    row = 0
    for j in range(3):
        row += bingoboard[i][j]
        col += bingoboard[j][i]
        diag += bingoboard[i][i]
        diag2 += bingoboard[i][2-i]
    if row == 0 or col == 0:
        bingoBool = True
        break

if diag == 0 or diag2 == 0:
    bingoBool = True

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


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef int64_t intl;


int main(){
 int N;
  cin >>N;
  vector<intl> A(N);
  Rep(i,N){
    cin >>A.at(i);
  }
  sort (A.begin(),A.end() );
  bool ANS=1;
  Rep(i,N-1){
    if (A.at(i) == A.at(i+1) ){ ANS = 0;}
  }
  if (ANS){ cout << "YES";}
  else { cout <<"NO";}
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    bool flag;
    bool blue[200][200];
    bool red[200][200];
    int N,x,y,count=0,pointy=199,pointx=199;
    cin >> N;
    for(int i=0;i<200;i++){
        for(int j=0;j<200;j++){
            blue[j][i] = false;
            red[j][i] = false;
        }
    }
    for(int i=0;i<N;i++){
        cin >> x >> y;
        red[y][x] = true;
    }
    for(int i=0;i<N;i++){
        cin >> x >> y;
        blue[y][x] = true;
    }
    for(int y=199;y>=0;y--){
        for(int x=199;x>=0;x--){
            flag = true;
            if(red[y][x]==true){
                for(int x2=0;x2<200;x2++){
                    for(int y2=0;y2<200;y2++){
                        if(blue[y2][x2]==true&&y2>y&&x2>x){
                            blue[y2][x2]=false;
                            count++;
                            flag = false;
                            break;
                        }
                    }
                    if(flag==false) break;
                }
            }
        }
    }
    cout << count << endl;
}

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

int main()
{
   ll n,d,a,b,cnt=0;
   cin>>n>>d;
   d*=d;
   while(n--)
   {
     cin>>a>>b;
     a=(a*a)+(b*b);
     if(a<=d)cnt++;
   }
   cout<<cnt<<endl;
   return 0;
}

Measured memory_bytes: 3604
n=int(input())
l=list(map(int,input().split()))
l.sort()
p=[1]*(l[-1]+1)
ans=0
for i in range(n):
  a=l[i]
  if p[a]==1:
    b=a
    while a<=l[-1]:
      p[a]=0
      a+=b
    if i<n-1:
      if l[i]==l[i+1]:
        pass
      else:
        ans+=1
    else:
      ans+=1
print(ans)

Measured memory_bytes: 32168
'use strict';

const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
let S = input[0];
let ans = "Yes";
for(let i = 0; i < S.length; i++){
  // 偶数の方
  if(i%2){
    if(S[i] == "R"){
    	ans = "No";
      	break;
    }
  }
  else {
  	// 奇数の方
    if(S[i] == "L"){
    	ans = "No";
      	break;
    }
  }
}

console.log(ans);

Measured memory_bytes: 21956
#include <stdio.h>

int main()
{
	int i, j, N, x[50], S = 0;

	scanf("%d", &N);
	
	for (i = 0; i < N; i++) {
		scanf("%d", &x[i]);
	}

	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			S += (x[i] * x[j]);
		}
	}

	printf("%d", S);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000;
const int MOD = (int)1e9 + 7;
template <class T>
inline T in()
{
    T x;
    cin >> x;
    return x;
}

signed main()
{
    int n = in<int>();
    int r = 0;
    for (int i = 0; i < n; i++)
    {
        int x = in<int>();
        r += x - 1;
    }
    cout << r << "\n";
}

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

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

  cin >> a >> b >> c >> d;

  while(1){
    c -= b;
    a -= d;

    if(c <= 0) {
      cout << "Yes";
      return 0;
    }
    if(a <= 0){
      cout << "No";
      return 0;
    }
  }
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_N = 100050;
int N, M;
int128_t A[MAX_N], B[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N >> M;
    
    
    for (int i = 1; i <= N; i++) {
        std::cin >> A[i] >> B[i];
    }

    std::vector<int> vec;
    for (int i = 1; i <= N; i++) {
        vec.push_back(i);
    }


    std::sort(vec.begin(), vec.end(),
        [&](const int i, const int j) { return A[i] < A[j]; }
    );

    //std::cout << vec[0] << " " << vec[1] << std::endl;

    int128_t num = 0;
    int128_t ret = 0;

    for (int i : vec) {
        if (M - num <= B[i]) {
            ret += A[i] * (M - num);
            num = M;
            break;
        } else {
            ret += A[i] * B[i];
            num += B[i];
        }
        //std::cout << i << " " << ret << std::endl;
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 3964
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int N;
    long long D, K;
    cin >> N >> D >> K;
    vector<pair<long long, long long>> data(N);
    for (int i = 0; i < N; i++) {
        cin >> data[i].first >> data[i].second;
    }
    
    sort(data.begin(), data.end());
    long long hoge = data[0].first;
    for (int i = 0; i < N; i++) data[i].first -= hoge;
    //for (auto d : data) cout << d.first << " " << d.second << endl;
    
    vector<long long> damage(N+2, 0), ans(N+2, 0);
    //long long now = D;
    long long right = 0;
    
    for (int left = 0; left < N; left++) {
        //区間[left, right) で考える
        while (right < N && abs(data[left].first - data[right].first) <= 2 * D) right++;
        data[left].second -= damage[left];
        //cout << data[left].first << " " << data[left].second << " " << damage[left] << endl;
        if (data[left].second > 0) {
            long long cnt = ((data[left].second + K - 1) / K);
            damage[left] += K * cnt;
            damage[right] -= K * cnt;
            ans[left] += cnt;
        }
        damage[left+1] += damage[left];
        //damage[right+1] += damage[right];
    }
    
    long long res = 0;
    for (int i = 0; i < N; i++) res += ans[i];
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
#include <unordered_map>
using namespace std;

int main(void){
    int N,T;
    cin >> N >> T;
    int c[N],t[N];
    for(int i=0;i<N;i++){
        cin >> c[i] >> t[i];
    }
    int ans = 100000000;
    for(int i=0;i<N;i++){
        if(t[i] <= T){
            ans = min(ans,c[i]);
        }
    }
    if(ans == 100000000){
        cout << "TLE" << endl;
        return 0;
    }
    cout << ans << endl;;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)
#define all(V) V.begin(), V.end()
using i64 = int_fast64_t;
using P = pair<int,int>;

int main(){
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;

    int left = 0, right = 0;
    while(right < N){
        while(S[left] == S[right] && right < N) right++;
        ans++;
        if(left == right) right++;
        left = right; 
    }

    cout << ans << endl;

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=2e5+10;
const int mod=1e9+7;
main(){
    int n,k;
    cin>>n>>k;
    int a[maxn];
    for(int i=1;i<=n;++i)cin>>a[i];
    for(int i=k+1;i<=n;++i){
        if(a[i]>a[i-k])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 5156
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<queue>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
#define M 1000000007
int n;
lld a[1000009];
lld m;
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		lld res = 0;
		scanf("%d", &n);
		for (i = 0; i < n; i++) {
			scanf("%lld", &a[i]);
		}
		m = a[0];
		for (i = 1; i < n; i++) {
			if (m < a[i]) {
				m = a[i];
			}
			else {
				res += m - a[i];
			}
		}
		printf("%lld\n", res);
	}
	return 0;
}

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

int main()
{
	long long n, m, ans;
	// n:S m:c 
	cin >> n >> m;
	if (m > n) {
		ans = n;
		m = m - n * 2;

		ans = ans + m / 4;
	}
	else {
		ans = m / 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N=int(input())
a_list=[int(i) for i in input().split()]

if 0 in a_list:
    print(0)
    
else:
    
    ans=1
    for i in range(N):
        ans*=a_list[i]
        if ans>10**18:
            ans=-1
            break
    print(ans)


Measured memory_bytes: 21548
S = input()
mod = 13
mp = 10**9+7
n = len(S)
dp = [[0]*13 for i in range(n+1)]
dp[-1][0] = 1
d = 1
for i in range(n):
    s = S[-i-1]
    if s=="?":
        for k in range(10):
            for j in range(13):
                l = (k*d + j)%mod
                if dp[i-1][j] !=0:
                    dp[i][l] +=dp[i-1][j]
                    dp[i][l] %=mp
    else:
        for j in range(13):
            l = (int(s)*d + j)%mod
            if dp[i-1][j] !=0:
                dp[i][l] = dp[i-1][j]
    d = d*10 %mod
print(dp[n-1][5])


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

int main(){

    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  static int n;
  static int[][] dist;

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

    n = sc.nextInt();
    dist = new int[n][n];
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
        dist[i][j] = sc.nextInt();
      }
    }

    long sum = 0;
    for(int i = 0; i < n; i++){
      for(int j = i + 1; j < n; j++){
        sum += (long)dist[i][j];
      }
    }

    boolean[][] subtracted = new boolean[n][n];
    for(int i = 0; i < n; i++){
      for(int j = i + 1; j < n; j++){
        for(int k = 0; k < n; k++){
          if(k == i || k == j){
            continue;
          }
          if(dist[i][j] > dist[i][k] + dist[k][j]){
            System.out.println(-1);
            return;
          }
          if(!subtracted[i][j] && 
            dist[i][j] == dist[i][k] + dist[k][j]){
            sum -= (long)dist[i][j];
            subtracted[i][j] = true;
          }
        }
      }
    }

    System.out.println(sum);
  }
}


Measured memory_bytes: 50148
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define int long long
#define moder 1000000007
#define P std::pair<int,int>
using namespace std;

int mypow(int a,int b){
	if(!b)return 1;
	if(b%2)return mypow(a,b-1)*a%moder;
	return mypow(a,b/2)*mypow(a,b/2)%moder;
}
int kaijo(int s){
	int ans=1;
	for(int i=2;i<=s;i++){
		ans*=i;
		ans%=moder;
	}
	return ans;
}
int n,m;
vector<int> vec;
void makevec(){
	int s=sqrt(m);
	for(int i=2;i<=s;i++){
		int cnt=0;
		while(m%i==0){
			m/=i;
			cnt++;
		}
		if(cnt)vec.push_back(cnt);
	}
	if(m!=1)vec.push_back(1);
}

int comb(int a,int b){
	b=a+b-1;
	return kaijo(b)*mypow(kaijo(b-a),moder-2)%moder*mypow(kaijo(a),moder-2)%moder;
}
signed main(){
	cin>>n>>m;
	makevec();
	int ans=1;
	for(int i:vec){
		ans*=comb(i,n);
		ans%=moder;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 n,l, sum = 0; cin >> n >> l;
    vi apple;
    rep(i,n) apple.push_back(l + i);
    rep(i,n) sum += apple[i];
    i32 ans, min_diff = inf;
    rep(i,n) {
        if(chmin(min_diff, abs(apple[i]))) ans = (sum-apple[i]);
    }

    cout << ans << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
int n;
string s;
unordered_map<string, int> m;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    while(n--) {
        cin>>s;
        m[s]++;
    }
    cout<<m.size();
}
/*
 4
 -2 2 3 5
 3 10 21 5
 */


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

using namespace std;

int A[234567];

int main() {
    int N;
    cin >> N;
    int ma = A[0], ma2 = A[0];
    for (int i = 0; i < N; i++) {
            cin >> A[i];
            if (A[i] >= ma) {
                ma2 = ma;
                ma = A[i];
            } else if (A[i] > ma2) {
                ma2 = A[i];
            }
    }
    for (int i = 0; i < N; i++) {
        if (A[i] == ma) {
            cout << ma2;
        }
        else {
                cout << ma;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second

bitset<10001> dp;

int main()
{
	dp[0]=1;
	
	int n; read(n); for(;n--;){
		int x; read(x);
		dp |= (dp<<x);
	}
	int ans=0;
	for(int i=0; i<=10000; ++i) if(dp[i]){
		if(i%10 == 0)continue;
		ans=max(ans, i);
	}
	printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>a>>b>>c;
    tmp=a-b;
    ans=c-tmp;
    Cout(max(ans,0LL));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000
#define MOD 1000000007

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

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

Measured memory_bytes: 3124
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
int g[8][8];
 
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		g[u][v] = true;
		g[v][u] = true;
	}
 
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		p[i] = i;
	}
	int ans = 0;
	do {
		if (p[0] != 0) continue;
		bool ok = true;
		for (int i = 0; i < n - 1; i++) {
			if (!g[p[i]][p[i + 1]]) {
				ok = false;
			}
		}
		if (ok) {
			ans++;
		}
	} while (next_permutation(p.begin(), p.end()));
	cout << ans << endl;
}
 

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

int a,b;
char s[20];
int main(){
	scanf("%d %d", &a, &b);
	scanf("%s", s);
	int l = strlen(s);
	int bisa = 1;
	for (int i=0;i<l;i++){
		if (i== a ){
			if (s[i]!= '-'){
				bisa = 0;
				break;
			}
		}
		else{
			if (s[i] < 48 || s[i] > 57){
				bisa =0;
				break;
			}
		}
	}
	if (bisa)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#define INF 2<<28

using namespace std;

class Edge {
public:
	int v, u, d;
};

class Node {
public:
	int t = 0, d = -1, e = 0;
	vector<Edge> E;
};

int n, e = 0;
Node V[10000];

void Path() {
	int m = 0, v = 0, u;

	V[0].t = 1; V[0].d = 0;

	while (true) {
		if (v == n) break;

		int min = INF;
		for (int i = 0; i < n; i++) {
			if (V[i].t == 1 && V[i].d < min) { u = i; min = V[i].d; }
		}

		V[u].t = 2; v++;

		for (int i = 0; i < V[u].e; i++) {
			int j = V[u].E[i].u;
			if (V[j].t == 0) { V[j].t = 1; V[j].d = V[u].d + V[u].E[i].d; }
			if (V[j].t == 1 && V[j].d > V[u].d + V[u].E[i].d) V[j].d = V[u].d + V[u].E[i].d;
		}
	}
}

int main() {
	int u, k, v, c;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			Edge e;
			cin >> v >> c;
			e.v = u; e.u = v; e.d = c;
			V[u].E.push_back(e); V[u].e++;
		}
	}

	Path();

	for (int i = 0; i < n; i++) cout << i << " " << V[i].d << endl;
}


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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n; cin >> n;
    int t[n + 1], x[n + 1], y[n + 1];
    t[0] = 0, x[0] = 0, y[0] = 0;
    for (int i = 1; i <= n; i++) cin >> t[i] >> x[i] >> y[i];

    bool flag = true;
    for (int i = 0; i < n; i++) {
        int dt = t[i + 1] - t[i];
        int dx = x[i + 1] - x[i];
        int dy = y[i + 1] - y[i];
        int dl = abs(dx) + abs(dy);

        if ((dt < dl) || ((dt & 1) != (dl & 1))) flag = false;
    }

    cout << ((flag) ? "Yes" : "No") << endl;
    return 0;
}

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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int i = cin.nextInt();
        Console.WriteLine(N - i + 1);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}






Measured memory_bytes: 11092
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main() {
	int n;
	long long l[87];
	cin >> n;
	l[0] = 2;	l[1] = 1;
	for (int i = 2; i <= n; i++) {
		l[i] = l[i - 1] + l[i - 2];
	}
	cout << l[n] << endl;
	return 0;
}

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

#define int long long
#define ll long long
#define vll vector<int>
#define mset(a) memset(a,0,sizeof(a))
#define pb push_back
#define range(c) c.begin() , c.end()
#define forn(i,n) for(ll i=0; i<(int)n; ++i)
#define for1(i,n) for(ll i=1; i<(int)n; ++i)
#define endl '\n'
#define MOD 1000000007
#define pii pair<int,int>
#define test ll t;cin>>t;while(t--)
using namespace std;

vector<bool> sieve(ll n){
    vector<bool>prime(n+1,true);
    prime[0]=prime[1]=false;
    for(ll i=2; i<=n; ++i){
        if(prime[i]&&(i*i)<=n)
        for(ll j=i*i; j<=n; j+=i)prime[j]=false;
    }
    return prime;
}

ll power(ll a, ll b, ll m = MOD) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

//////////////////////////////////////////////////////////////

bool isPali(string s) {
    int n = s.size();
    forn(i,n/2){
        if(s[i] != s[n-i-1])
        return 0;
    }
    return 1;
}

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

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif

    string s;cin>>s;
    int n = s.size();
    string temp1 = "",temp2 = "";
    for(int i=0; i<n/2; ++i)
    temp1+=s[i];

    for(int i=n/2+1; i<n; ++i)
    temp2+=s[i];

    // cout<<temp1<<" "<<s<<" "<<temp2<<endl;

    if(isPali(s) && isPali(temp1) && isPali(temp2))
    cout<<"Yes";
    else cout<<"No";    

    return 0;
}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end());
    int sum = 0;
    for (int i = 0; i < n; i++) sum += l[i];
    sum -= l[n-1];
    cout << (l[n-1] < sum ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
 
using namespace std;
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 
 
 

int main()
{
    int n;
    cin>>n;
    vector <int> v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    bool flag=1;
    for(int i=0;i<n;i++)
        if(v[i]%3!=0&&v[i]%5!=0&&v[i]%2==0)
        {
            flag=0;
            break;
        }
    if(flag)
        cout<<"APPROVED\n";
    else
        cout<<"DENIED\n";

    return 0;   
}
 
 

Measured memory_bytes: 256
/*
@author: @sancodemonster
*/
 
#include <bits/stdc++.h>
 
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#define ld long double
#define pb push_back 
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end() 
using namespace std;
string s,t;
ll dp[3010][3010] ;
ll parentDP[3010][3010] = {0};
string ansStr = "";
std::vector<ll> v;
 ll rec(ll i,ll j,string &s,string &t)
 {

        if(i == s.size() || j == t.size())
        {
        	return 0;
        }
 	ll one = INT_MIN,two = INT_MIN ,three = INT_MIN ;

       if(dp[i][j] != -1)
       	return dp[i][j];

 	if(s[i] == t[j])
 	{
 	  one = 1 + rec(i+1,j+1,s,t);
 	}

 	else
 	{
 		//if(i<s.size())
 		two = rec(i+1,j,s,t);

 	       // if(j<t.size())
 	         three = rec(i,j+1,s,t);
 	}

 	ll maxi = INT_MIN; 
 	
        maxi = max(one,two);
        if(maxi == one)
        {
            parentDP[i][j] = 1;
            dp[i][j] = one;
        }         	
        else{
        	 parentDP[i][j] = 2;
            dp[i][j] = two;
        }

        maxi = max(maxi,three);
        if(maxi == three)
        {
        	parentDP[i][j] = 3;
        	dp[i][j] = three;
        }
 

 	return dp[i][j];
 }


 void backtrack(ll i,ll j,string &s,string &t)
 {
 	if(i == s.size() || j == t.size())
        {
        	return ;
        }

    if(parentDP[i][j] == 1)
    {
        v.push_back(i);
        backtrack(i+1,j+1,s,t);
    }

    if(parentDP[i][j] == 2)
    {
    	backtrack(i+1,j,s,t);
    }

    if(parentDP[i][j] == 3)
    	backtrack(i,j+1,s,t);
 }


int main()
{


     flash;
     /////////////////////////////////////////////////////////////////////////////////////////////////////
      cin>>s;
      cin>>t;

      ll i,j;
      f(i,0,3010)
      {
      	f(j,0,3010)
      	{
      	   dp[i][j] = -1;
      	}

      }
     ll str =  rec(0,0,s,t);
    // cout<<str;
      backtrack(0,0,s,t);
      f(i,0,v.size())
      {
      	cout<<s[v[i]];
      }
  //   cout<<ansStr;
     /////////////////////////////////////////////////////////////////////////////////////////////////////

     return 0;
}


Measured memory_bytes: 142080
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

mina = a[-1]
ok = True

for ai in a[::-1]:
    mina = min(ai, mina)
    if ai - mina >= 2:
        ok = False
        break

print("Yes" if ok else "No")

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

int main (void) {
  std::string str;
  std::cin >> str;
  
  bool a = false;
  bool b = false;
  
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == 'A') a = true;
    if (str.at(i) == 'B') b = true;
  }
  
  std::cout << (a && b ? "Yes" : "No") << std::endl;
  
  return 0;
}



Measured memory_bytes: 256
#if 1
  #include <bits/stdc++.h>
#else
  #include "../../bits/stdc++.h"
#endif

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

using namespace std;

typedef pair<int, int> P;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second

int x, y, s;

bool input(){
  cin>>x>>y>>s;
  return x|y|s;
}

void solve(){
  int m=0;
  FOR(i, 1, s) {
    FOR(j, 1, s) {
      int a=i*(100+x)/100;
      a+=j*(100+x)/100;
      if(a==s) {
      int b=i*(100+y)/100;
      b+=j*(100+y)/100;
      m = max(m, b);
      }

    }
  }
  cout<<m<<endl;
}

int main(){
  cin.tie(0);
  
  while (input()){
      solve();
  }
  
  return 0;
}

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

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
    mint choose(int n, int a){
        mint x = 1 ,y = 1;
        for(int i=0; i<a; ++i){
            x *= n-i;
            y *= i+1;
        }
        return x / y;
    }
    friend istream& operator>>(istream& is, mint& m){
        is >> m.x;
        return is;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

const int INF=1001001001,mx=1000005;
map<int,int>mp;
vector<int>memo(mx,INF);

void fact(int x){
    if(memo[x]==INF){
        mp[x]++;
        return;
    }
    mp[memo[x]]++;
    fact(x/memo[x]);
};

int main(){
    int n;
    cin>>n;
    vector<bool>ok(mx);
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    for(int i=2; i<=mx; ++i){
        if(ok[i])continue;
        ok[i]=true;
        for(int j=i+i; j<=mx; j+=i){
            if(memo[j]==INF){
                memo[j]=i;
                ok[j]=true;
            }
        }
    }
    vector<int>cnt(mx,0);
    rep(i,n){
        mp=map<int,int>();
        fact(a[i]);
        for(auto&p:mp){
            cnt[p.first]=max(cnt[p.first],p.second);
        }
    }
    mint lcm=1;
    rep(i,mx){
        rep(j,cnt[i]){
            lcm*=i;
        }
    }
    mint ans=0;
    rep(i,n)ans+=lcm/a[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 11140
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 20:39:55 2019

@author: Yamazaki Kenichi
"""
import math

N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

neck = min(a,b,c,d,e)
t = math.ceil(N/neck)

print(t + 4)

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <bitset>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 100000;
int R, C, n;
vector<pair<pair<int, int>, pair<int, int> > > pts;
vector<pair<int,int> > ed;
int id(int r, int c) {
	if (r == 0)
		return c;
	if (c == C)
		return r + C;
	if (r == R)
		return C - c + C + R;
	return R - r + C + C + R;
}
vector<pair<int,int> > v;
bool comp(const pair<int,int> &a, const pair<int,int> &b) {
	return abs(a.first) < abs(b.first);
}
bool check() {
	v.clear();
	for (int i = 0; i < ed.size(); ++i) {
		v.push_back(make_pair(ed[i].first + 1, i));
		v.push_back(make_pair(-(ed[i].second + 1), i));
	}
	sort(v.begin(), v.end(), comp);
	stack<int> s;
	for (int i = 0; i < v.size(); ++i) {
		if (s.empty() || v[i].first> 0)
			s.push(v[i].second);
		else {
			if (s.top() != v[i].second)
				return false;
			s.pop();
		}
	}
	return s.empty();
}
int main() {
	scanf("%d%d%d", &R, &C, &n);
	for (int i = 0; i < n; ++i) {
		int r1, c1, r2, c2;
		scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
		int on = 0;
		if (r1 == 0 || r1 == R || c1 == 0 || c1 == C)
			++on;
		if (r2 == 0 || r2 == R || c2 == 0 || c2 == C)
			++on;
		if (on == 2)
			pts.push_back(make_pair(make_pair(r1, c1), make_pair(r2, c2)));
	}
	for (int it = 0; it < 1; ++it) {
		ed.clear();
		for (int i = 0; i < pts.size(); ++i) {
			int r1 = pts[i].first.first;
			int c1 = pts[i].first.second;
			int r2 = pts[i].second.first;
			int c2 = pts[i].second.second;
			int A = id(r1, c1);
			int B = id(r2, c2);
			if (A > B)
				swap(A, B);
			ed.push_back(make_pair(A, B));
			swap(r1, c1);
			swap(r2, c2);
			c1 = R - c1;
			c2 = R - c2;
			pts[i] = make_pair(make_pair(r1, c1), make_pair(r2, c2));
		}
		if (!check()) {
			puts("NO");
			return 0;
		}
		swap(R, C);
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 6256
#include <cstdio>

int N, C;
char s[105];

int main() {
  scanf("%d", &N);
  scanf("%s", s + 1);
  for (int i = 1; i <= N; ++i)
    C += s[i] == 'R' ? 1 : -1;
  puts(C > 0 ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	if (N == 1) {
		printf("YES\n");
		return 0;
	}

	int A[100000];
	int saisho = getint();
	ll goukei = saisho;
	int mae = saisho;
	rep(i, N - 1) {
		int tugi = getint();
		A[i] = tugi - mae;
		goukei += tugi;
		mae = tugi;
	}
	A[N - 1] = saisho - mae;
	
	ll n = ll(N) * (N + 1) / 2;
	if (goukei % n) {
		printf("NO\n");
		return 0;
	}

	int k = goukei / n;

	rep(i, N) {
		int tmp = A[i] - k;
		if (tmp > 0) {
			printf("NO\n");
			return 0;
		}
		int watta = tmp / N;
		if (watta * N != tmp) {
			printf("NO\n");
			return 0;
		}
	}

	printf("YES\n");


	Would you please return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod =1'000'000'007;

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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    REP(i,1,n+1)REP(j,1,n+1)REP(k,1,n+1){
        int index = gcd(i, j);
        ans += gcd(index, k);
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{ int n;
	int max,min;
	double sum;
	scanf("%d",&n);
	int num;
	int pointer=0;
	scanf("%d",&num);
	min=max=sum=num;
	for (int i=0;i<n-1;i++)
	{
		scanf("%d",&num);
		if(min>num)min=num;
		if(max<num)max=num;
		sum+=num;}
	printf("%d %d %.0lf\n",min,max,sum);
	return 0;
	
}

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

int main(void){
    int n;
    string s;
    std::cin >> n >>s;
    rep(i,s.length()){
        int t=s[i]+n;
        if(t>90){
            t-=26;
        }
        std::cout << ((char)t);
    }
}

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

main(){
    int n;
    cin>>n;
    int color[n];
    for(int i=0;i<n;i++)
        cin>>color[i];
    int cur = 1,ans=0;
    for(int i=0;i<n-1;i++){
        if(color[i]==color[i+1]){
            cur++;
        }
        else{
            ans+=(cur/2);
            cur = 1;
        }
    }
    ans+=(cur/2);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect
import statistics
mod = 10**9+7

K = input()
D = int(input())

n = len(K)

dp = [[[0 for k in range(D)] for j in range(2)] for i in range(n+1)]
dp[0][0][0] = 1

for i in range(1,n+1):
    for k in range(D):
        for j in range(10):
            dp[i][1][k] = (dp[i][1][k] + dp[i-1][1][(k-j) % D]) % mod
        for j in range(int(K[i-1])):
            dp[i][1][k] = (dp[i][1][k] + dp[i-1][0][(k-j) % D]) % mod
        dp[i][0][k] = (dp[i][0][k] + dp[i-1][0][(k-int(K[i-1])) % D]) % mod

print((dp[n][1][0] + dp[n][0][0] -1) % mod)


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

int main()
{
    int h,n;
    cin >> h >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    i64 sum = 0;
    rep(i,n) sum += a[i];
    cout << (sum>=h ? "Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
import os
import fractions

MOD = 10 ** 9 + 7


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, X = list(map(int, sys.stdin.readline().split()))
    M = [int(sys.stdin.readline().rstrip()) for _ in range(N)]
    print((X - sum(M)) // min(M) + N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5340
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e5 + 5;


int32_t main()
{
   IOS;
   int n,k;
   cin >> n >> k;
   int a[n];
   int sum[n]={0};

   for(int i=0; i<n; i++)
   {
   		cin >> a[i];
   }

   sort(a,a+n);

   for(int i=1; i<=k; i++)
   {
   		sum[i]= sum[i-1]+a[i-1];
         //cout << sum[i];
   }

   cout << sum[k] << endl;




   return 0;
}
 

Measured memory_bytes: 3660
#include <stdio.h>
#include <iostream>
#include <stack>
#include <vector>
#include <utility>
using namespace std;
int main()
{
    int count = 0;
    int n;
    cin >> n;
    int S[n];
    for (int i = 0; i < n; i++)
        cin >> S[i];
    int q;
    cin >> q;
    int T[q];
    for (int i = 0; i < q; i++)
        cin >> T[i];

    for (int i = 0; i < q; i++)
        for (int j = 0; j < n; j++)
            if (T[i] == S[j])
            {
                count++;
                break;
            }
    cout << count << "\n";
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <limits>
#include <set>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
int main()
{
    int N; cin >> N;
    set<int> S;
    REP(i, N) {
        int a; cin >> a;
        auto t = S.find(a);
        if (t == S.end()) {
            S.insert(a);
        } else {
            S.erase(t);
        }
    }
    cout << S.size() << endl;
}

Measured memory_bytes: 4864
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();

		if (input.length() < 4) {
			System.out.println("No");
			return;
		}

		System.out.println(input.substring(0,4).equals("YAKI")? "Yes" : "No");
	}
}


Measured memory_bytes: 23124