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

using namespace std;
using ll = long long;
const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }

    mint &operator/=(const mint a) { return *this *= a.inv(); }

    mint operator/(const mint a) const { return mint(*this) /= a; }
};

istream &operator>>(istream &is, const mint &a) { return is >> a.x; }

ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

multiset<int> s[202020], t;

int main() {
    int n;
    cin >> n;
    vector<int> A;
    vector<bool> B(1e6 + 1);
    map<int, int> m;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        m[a]++;
        if (m[a] == 1)A.emplace_back(a);
        B[a] = true;
    }
    int cnt = 0;
    sort(A.begin(), A.end());
    for (auto x :A) {
        for (int i = 2 * x; i <= 1e6; i += x) B[i] = false;
        if (B[x] && m[x] == 1)cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 23012
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cardValues = new int[n];

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

        for (int i=0; i < n; i++){
            if (i > 0){
                int targetValue = cardValues[i];

                for (int j = i - 1; j >= 0; j--){
                    if (targetValue < cardValues[j]){
                        cardValues[j + 1] = cardValues[j];
                        cardValues[j] = targetValue;
                    }else break;
                }
            }

            StringJoiner sj = new StringJoiner(" ");
            Arrays.stream(cardValues).forEach(card -> sj.add(String.valueOf(card)));
            System.out.println(sj.toString());
        }
    }

}


Measured memory_bytes: 33096
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

h, w = map(int, input().split())

s = []
for i in range(h):
    c = input()
    s.append(c)

#print(s)

for i in range(2*h):
    print(s[i//2])



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

using namespace std;

int main()
{
    int A,B,C,D;
    int n;

    cin >> A >> B >> C >> D;

    while(1)
    {
        C -= B;
        if( C <= 0)
        {
            cout << "Yes" << endl;
            break;
        }

        A -= D;

        if( A <= 0)
        {
            cout << "No" << endl;
            break;
        }

    }

    return 0;
}

Measured memory_bytes: 3640
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 17:09:47 2020

@author: sd18016
"""   

import sys
from itertools import groupby


S = list(input())

ans = len(list(groupby(S)))-1
print(ans)
    
    


"""
for i in range(N):
    if list_x[i][2] == 1:
        de = list_x[i][0]
        S -= de*H
        W -= de
    elif list_x[i][2] == 2:
        de = W - list_x[i][0]
        S -= de*H
        W -= de
    elif list_x[i][2] == 3:
        de = list_x[i][1]
        S -= de*W
        H -= de
    else:
        de = H - list_x[i][1]
        S -= de*W
        H -= de

print(S)
"""

Measured memory_bytes: 16552
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

    if(op == '+') {
        cout << a+b;
    }
    else {
        cout << a-b;
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int N,M;
    cin>>N>>M;
    int a[60],b[60];
    for(int i=0;i<M;i++)cin>>a[i]>>b[i];
    int cnt[60]={0};
    for(int i=0;i<M;i++){
        cnt[a[i]-1]++;
        cnt[b[i]-1]++;
    }
    for(int i=0;i<N;i++){
        cout<<cnt[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    //これは最小二乗法だな...
    int N; cin>>N;
    vector<int> A(N);
    rep(i,N){
        cin>>A.at(i);
    }
    int A_total = accumulate(A.begin(),A.end(),0);
    double A_mean = (double)A_total/(double)N;
    double A_mean_int = round(A_mean);

    int sum_of_squares=0;    
    rep(i,N){
        sum_of_squares += pow((A.at(i)-A_mean_int),2);
    }
    cout<<sum_of_squares<<endl;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e18;
template<typename T> void cmax(T &a, T b) {a = max(a, b);}
template<typename T> void cmin(T &a, T b) {a = min(a, b);}
using ll=long long;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

  int ans=0;
  rep(i,n)ans+=a[i]-1;
  cout<<ans<<endl;



  // int LCM=a[0];
  // loop(i,1,n){
  //   LCM=lcm(LCM,a[i]);
  // }
  // int ans=0;
  // rep(i,n)ans+=(LCM-1)%a[i];
  // cout<<ans<<endl;
  //cout<<LCM<<endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np

N,M,C = [int(i) for i in input().split()]
B = np.array([int(i) for i in input().split()])
ans = 0

for i in range(N):
    A = np.array([int(i) for i in input().split()])
    if sum(B*A) + C > 0:
        ans += 1


print(ans)

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n, a, b);
  out(min(n * a, b));
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef map<int, int> mi;
typedef pair<int, int> pi;
typedef long long ll;

void solve() {
  int X;
  cin >> X;
  int div = X / 100;
  int tmp = X % 100;
  for (int i = 0; i < div; i++) {
    if (tmp >= 5) {
      tmp -= 5;
    } else {
      tmp -= tmp;
    }
  }
  if (tmp <= 0) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

void b_around_square(void) {
	int n;
	cin >> n;

	int sqr_int;
	double sqr_duble;
	int max_sqr;
	for (int i = n; i >= 0; i--) {
		sqr_duble = sqrt(i);
		if (sqr_duble - int(sqr_duble) == 0) {
			max_sqr = i;
			break;
		}
	}
	cout << max_sqr << endl;
}

int main()
{
	b_around_square();
    return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String r1 = scan.next();
        String r2 = scan.next();

        if (r1.charAt(0) == r2.charAt(2) &&
            r1.charAt(1) == r2.charAt(1) &&
            r1.charAt(2) == r2.charAt(0)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>  
using namespace std;
int a,b,c,i,j,n,s;  
int main()
{
    cin>>a>>b>>c>>n; 
    for(i=0;i<=a;i++)  
     for(j=0;j<=b;j++)
      if((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50))s++; 
    cout<<s;
    return 0;
}

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

int n,ou,ans1=1,ans2=1;
int a[12];

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		if (a[i]%2==0) ou++;
	}
	
	for (int i=1;i<=n;i++) ans1*=3;
	for (int i=1;i<=ou;i++) ans2*=2;
	printf("%d\n",ans1-ans2);
	return 0;
}

Measured memory_bytes: 384
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
m = sorted(m)
cnt = 0
i = 0
while x >= m[0]:
  cnt += 1
  x -= m[i]
  if i < n-1:
    i += 1
  else:
    i = 0
    m = [m[0] for i in range(n)]
print(cnt)

Measured memory_bytes: 3064
N = int(input())
a = list(map(int, input().split()))

l = [0] * 9
for i in a:
    if i <= 399:
        l[0]=1
    elif i<=799:
        l[1]=1
    elif i<=1199:
        l[2]=1
    elif i<=1599:
        l[3]=1
    elif i<=1999:
        l[4]=1
    elif i<=2399:
        l[5]=1
    elif i<=2799:
        l[6]=1
    elif i<=3199:
        l[7]=1
    else:
        l[8] += 1
if sum(l[:8])==0:
    print(1, l[8])
else:
    print(sum(l[:8]), sum(l))


Measured memory_bytes: 3064
N = int(input())
V_ = list(map(int,input().split()))
C_ = list(map(int,input().split()))

d_ = [V_[i] - C_[i] for i in range(N) if V_[i]-C_[i] > 0]
#print(V_)
#print(C_)
#print(d_)
print(sum(d_))




Measured memory_bytes: 2940
#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 BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define unq(v) v.erase(unique(v.begin(),v.end()),v.end());
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int K, A, B;

int main() {
    cin >> K >> A >> B;
    
    bool trade = A + 1 < B;
    if (A + 1 >= B || (A - 1 + 2 > K)) {
        write(1 + K);
        return 0;
    }

    int i = K;
    ll b = 1;
    while (b < A) {
        b++; i--;
    }

    ll t_cycle = i / 2;
    if (t_cycle > 0) {
        b += (B - A) * t_cycle;
        i -= t_cycle * 2;
    }
    if (i > 0) {
        b += i;
    }
    write(b);
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<int, int> > vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef pair<int, int> pii;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax], arr1[nax];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> arr[i];
      int cur = 1;
    int r = (n / 2) + 1;
    int l = (n / 2);
    if(n % 2 == 1)
        arr1[r] = arr[cur], cur++, r++;

    while(r <= n)
    {
        arr1[r] = arr[cur];
        cur++;
        arr1[l] = arr[cur];
        cur++;
        r++, l--;
    }
    for(int i = 1; i <= n; i++)
        cout << arr1[i] << " ";
    return 0;
}


Measured memory_bytes: 7040
#include <stdio.h>

int main(void)
{
    long int n=0,k=0;
    long int extra=0,ans=0;

    scanf("%ld %ld",&n,&k);
    extra=n%k;
    if(extra>k-extra){
        ans=k-extra;
    } else {
        ans=extra;
    }

    printf("%ld",ans);

    return 0;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=1;
  for(int i=0;i<n;i++){
    ans=(ans*(k-i))%mod;
  }
  cout<<ans<<endl;
  return 0;
}



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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

class Combination
{
public:
    Combination(ll N)
    {
        f.resize(N + 10);
        invf.resize(N + 10);
        f[0] = 1;
        invf[0] = 1;
        REP(i, N)
        {
            f[i + 1] = (f[i] * (i + 1)) % MOD;
            invf[i + 1] = f[i + 1];
        }
        REP(i, N)
        {
            invf[i + 1] = modpow(invf[i + 1], MOD - 2);
        }
    }

    ll get(ll n, ll r)
    {
        if (n < r)
            return 0;
        if (n == r)
            return 1;
        if (r == 0)
            return 1;
        return ((f[n] * invf[r]) % MOD) * invf[n - r] % MOD;
    }

    ll modpow(ll n, ll p)
    {
        ll m = 1;
        REP(i, 35)
        {
            if (((p >> i) & 1) == 1)
            {
                m = (m * n) % MOD;
            }
            n = (n * n) % MOD;
        }
        return m;
    }

private:
    vector<ll> f;
    vector<ll> invf;
};

int main()
{
    ll H, W, A, B;
    cin >> H >> W >> A >> B;
    Combination cmb(H + W);
    ll h = H - A, w = W - B;
    ll ans = 0;
    while (h > 0 && w > 0)
    {
        ll bh = h - 1, bw = W - w;
        ll ah = H - h, aw = w - 1;
        ans += (cmb.get(bh + bw, bh) * cmb.get(ah + aw, ah)) % MOD;
        ans %= MOD;
        h--;
        w--;
    }

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

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 200003
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int N,K;
  cin>>N>>K;
  vector<ll> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }

  vector<vector<ll>> dp(N,vector<ll>(N+1,INF));
  for(int i=0;i<N;i++){
    dp.at(i).at(0)=0;
    dp.at(i).at(1)=H.at(i);
  }
  for(int j=2;j<=N;j++){
    for(int i=1;i<N;i++){
      for(int k=0;k<i;k++){
        dp.at(i).at(j)=min<ll>(dp.at(i).at(j),dp.at(k).at(j-1)+max<ll>(0,H.at(i)-H.at(k)));
      }
    }
  }

  ll ans=INF;
  for(int i=0;i<N;i++){
    ans=min<ll>(dp.at(i).at(N-K),ans);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lop ios; ll t; cin>>t; while(t--)
#define pb push_back
#define vi vector<ll>
#define vivi vector<vector<ll>> 
#define vipa vector<pair<ll,ll>>
#define F first
#define S second
#define M 1000000007
#define kl "\n"
typedef long long ll;
ll lcm(ll x, ll y){ll k=x*y; k/=(__gcd(x,y)); return k;}
ll power(ll x,ll y){ ll r= 1;x = x % M;if(x==0) return 0; while(y>0) {if(y&1) r=(r*x)%M; y=y>>1; x=(x*x)%M;} return r;}  
void solve()
{ 
 ll n;
 cin>>n;
 string s;
 cin>>s;
 ll ans=0;
 ll a=0,b=0;
 for(auto i:s){
    if(i=='R') a++;
    else b++;
 }
 ans=min(a,b);
 string ss;
 for(ll i=1;i<=a;i++) ss+='R';
 for(ll i=1;i<=b;i++) ss+='W';
 ll cnt=0;
 for(ll i=0;i<n;i++){
     if(ss[i]=='R' and s[i]=='W') cnt++;
 }
 cout<<min(ans,cnt);
}
int main() 
{ 
    // lop
    solve();
	return 0; 
} 




Measured memory_bytes: 3900
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  double ans=0;
  double x;
  string u;
  for(int i=0;i<N;i++){
    cin>>x>>u;
    if(u=="JPY")ans+=x;
    else if(u=="BTC")ans+=x*380000.0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3752
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  string t = s.substr(0, 2);
  string r = s.substr(2);
  int a = stoi(t);
  int b = stoi(r);
  cerr << a << " " << b << endl;
  if (a == 0 && b == 0) {
    cout << "NA" << endl;
  } else if (a == 0) {
    if (b > 12) cout << "NA" << endl;
    else cout << "YYMM" << endl;
  } else if (b == 0) {
    if (a > 12) cout << "NA" << endl;
    else cout << "MMYY" << endl;
  } else {
    if (a > 12 && b > 12) cout << "NA" << endl;
    else if (a > 12) cout << "YYMM" << endl;
    else if (b > 12) cout << "MMYY" << endl;
    else cout << "AMBIGUOUS" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using static System.Math;

class Program
{
  static void Main(string[] args)
  {
    string[] abcd = Console.ReadLine().Split(' ');
    int a = int.Parse(abcd[0]);
    int b = int.Parse(abcd[1]);
    int c = int.Parse(abcd[2]);
    int d = int.Parse(abcd[3]);
    if(Abs(a-c) <= d)
    {
      Console.WriteLine("Yes");
    }
    else
    {
      if(Abs(a-b) <= d && Abs(b-c) <= d)
      {
        Console.WriteLine("Yes");
      }
      else
      {
      Console.WriteLine("No");
      }
    }
  }
}


Measured memory_bytes: 13140
#include<stdio.h>
int main(void){
	int a,b,c,t,i,x;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	x=0;
	for(i=a;i<=b;i++){
		if((c%i)==0){
			x++;
		}
	}
	printf("%d\n",x);
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;

int MOD=1e9+7;
ll INF=1e18;

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

int dp[50][410][410];

int main(){
    int n, ma, mb; cin>>n>>ma>>mb;
    vector<int> a(410, 0), b(410, 0), c(410, 0);
    for(int i=0; i<n; i++) cin>>a[i]>>b[i]>>c[i];

    for(int i=0; i<=40; i++){
        for(int ca=0; ca<=400; ca++){
            for(int cb=0; cb<=400; cb++){
                dp[i][ca][cb]=1e9;
            }
        }
    }

    dp[0][0][0]=0;
    for(int i=0; i<n; i++){
        for(int ca=0; ca<=400; ca++){
            for(int cb=0; cb<=400; cb++){
                if(dp[i][ca][cb] == 1e9) continue;
                dp[i+1][ca][cb]=min(dp[i+1][ca][cb], dp[i][ca][cb]);
                dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i]);
            }
        }
    }

    int ans=1e9;
    for(int ca=1; ca<=400; ca++){
        for(int cb=1; cb<=400; cb++){
            if(ca*mb == cb*ma){
                ans=min(ans, dp[n][ca][cb]);
            }
        }
    }

    if(ans != 1e9) cout << ans << endl;
    else cout << -1 << endl;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  int x = 800*n;
  int y = n/15*200;
  int ans = x-y;

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


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n"

int main()
{
    ll n,k;
    cin>>n>>k;
    ll dp[100010],h[100010];
    for(ll i=0;i<n;i++)
        cin>>h[i];
    if(n<k)k =n;
    for(ll i=0;i<=k;i++)
        dp[i] = abs(h[i]-h[0]);
    for(ll i=k+1;i<n;i++)
    {
        dp[i] = (ll)1e9+7;
        for(ll j=1;j<=k;j++)
        {
           // if(i==n-1)dp[i-j]+abs(h[i]-h[i-j];
            dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    cout<<dp[n-1]<<"\n";
}


Measured memory_bytes: 1792
import * as fs from 'fs'
let input: string[] = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
let n:number = parseInt(input[0]);
let a:number[] = input[1].split(' ').map(Number);

// 5
// 6 7 9 10 31
// APPROVED
// DENIED


for (let i:number=0;i<n;i++) {
    if (a[i] % 2 ===0) {
        // 偶数
        // 3または5で割り切れる
        if (a[i] %3 ===0 || a[i] %5 ===0){
        } else {
            console.log('DENIED');
            break;
        }
    }

    if (i===n-1) {
        console.log('APPROVED');
    }
}

Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> isMax(n + 1, false);
  int tmp = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (tmp < a[i]) {
      tmp = a[i];
      isMax[i] = true;
    }
  }
  map<int, int> mp;
  int prv = n - 1;
  vector<long long> ret(n, 0);
  for (int i = n - 1; i >= 0; i--) {
    int crr = a[i];
    mp[crr]++;
    if (isMax[i]) {
      auto bgn = mp.upper_bound(crr);
      for (auto it = bgn; it != mp.end(); it++) {
        int val = it->first;
        int mlt = it->second;
        ret[prv] += (long long)(val - crr) * mlt;
        mp[crr] += mlt;
      }
      mp.erase(bgn, mp.end());
      prv = i;
    }
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    int val = it->first;
    int mlt = it->second;
    ret[prv] += (long long)val * mlt;
  }
  for (int i = 0; i < n; i++) {
    cout << ret[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 6656
import math
m = 10000
s = [1 for i in range(m+1)]
s[0] = 0
for i in range(2, int(math.sqrt(m))+1):
    if s[i] != 0:
        for j in range(i*2, m, i):
            s[j] = 0

ss = []
for i in range(m+1):
    if s[i] == 1:
      ss.append(i)
ss.reverse()

while True:
    n = int(input())
    if n == 0:
        quit()
    for i in range(len(ss)):
        if ss[i] <= n and ss[i] - ss[i+1] == 2:
            print(ss[i+1], ss[i])
            break



Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <cstdio>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i <= n ; i++)

using namespace std;

int n;
void CountingSort(int x[],int b[] ,int max){
    int c[max+10];

    rep(i,max+2) c[i] = 0;

    rep1(i,n){
        c[x[i]]++;
    }

    rep1(i,max){
        c[i] = c[i] + c[i-1];
    }

    for(int i=n ; i > 0 ; i--){
        b[c[x[i]]] = x[i];
        c[x[i]]--;
    }

}

int main(){
    cin >> n;
    int a[n+10],b[n+10];
    int maxn = 0;
    rep1(i,n) {
        cin >> a[i];
        maxn = max(maxn,a[i]);
    }

    CountingSort(a,b,maxn);

    rep1(i,n){
        cout << b[i] << (i != n ? ' ' : '\n');
    }
}


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

int i, j;
bool a = 0;
int main(){
	string S;

	cin >> S;
	size_t size = S.length();
	
	for (i = 0; i < size; i++){
		if (S[i] <= 'Z') j++;
	}

	size--;
	while (S[0] == 'A' && j == 2){
		
		for (i = 2; i < size; i++){
			if (S[i] == 'C'){
				a = !a;
				break;
			}
		}
		i++;
		for (i; i < size; i++){
			if (S[i] == 'C'){
				a = !a;
				break;
			}
		}
		break;
	}

	if (a == 1) cout << "AC" << endl;
	else cout << "WA" << endl;
	return 0;
}


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

int main(){
  string s;
  cin >> s;
  rep(i, s.size()){
    if (i % 2 == 1){
      if (s[i] == 'R'){
        cout << "No" << endl;
        return 0;
      }
    }

    if (i % 2 == 0){
      if (s[i] == 'L'){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3628
// 問題の URL を書いておく
// https://atcoder.jp/contests/dp/tasks/dp_a

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n)
    {
        cin >> h[i];
    }
    vector<ll> dp(n + 10, numeric_limits<ll>::max());
    dp[0] = 0;
    rep(i, n)
    {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 4564
#include <cstdio>

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int s[] = {a,b,c};
    int max = a;
    int others = 0;
    for(int i = 1; i < 3; i++){
        if(max <= s[i]){
            others += max;
            max = s[i];
        }
        else{
            others += s[i];
        }
    }

    if(max == others){
        printf("Yes");
    }
    else{
        printf("No");
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;

int main() {
    ll a,b;
    cin >> a >> b;
    cout << a*b/__gcd(a,b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    while(1){
        ll h,w;cin>>h>>w;
        if(h==0&&w==0)return;
        rep(i,h){
            rep(j,w){
                if(0<i&&i<h-1&&0<j&&j<w-1)cout<<'.';
                else cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
}

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



Measured memory_bytes: 3120
#include <stdio.h>
#include <math.h>
int main(){
	int data[5],sum=0,i,ave;
	for(i = 0;i < 5;i++){
		scanf("%d",&data[i]);
		if(data[i] < 40){
			data[i] = 40;
		}
		sum = sum + data[i];
	}
	ave = sum/5;
	printf("%d\n",ave);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;
// const int INF = 1e9;

int N;
string S;
vector<int> a,b;

int main()
{
  cin >> N >> S;
  a.resize(N);
  b.resize(N);
  // a[i+1]: i個目までの#の個数
  a[0] = 0;
  REP(i,0,N) {
    if(S[i] == '#') a[i+1] = a[i] + 1;
    else a[i+1] = a[i];
  }

  // b[i]: i個目以降の.の数
  b[N] = 0;
  for(int i=N-1; i>=0; --i) {
    if(S[i] == '.') b[i] = b[i+1] + 1;
    else b[i] = b[i+1];
  }

  // 色を変更する必要のある石の個数の最小値
  int ans = b[0]; //すべて#に
  REP(i,0,N) {
    //i番目まで.で，i+1番目以降を#にする
    chmin(ans, a[i+1] + b[i+1]);
  }
  cout << ans << endl;

  return 0;
}


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

int main(void)
{
	int n, l; cin >> n >> l;
	vector<string> s(n);
	rep(i, n) cin >> s[i];
	sort(s.begin(), s.end());
	rep(i, n) cout << s[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void InsertionSort(int* a, int n){
	int i,j,key;
	for(i=1;i<n;i++){
		key=a[i];
		j=i-1;
		while(j>=0 && a[j]>key){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=key;
		for(j=0;j<n;j++){
			if(j)printf(" ");
			printf("%d",a[j]);
		}printf("\n");
	}
}

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

	for(i=0;i<n;i++){
		if(i)printf(" ");
		printf("%d",array[i]);
	}printf("\n");
	InsertionSort(array,n);

	return 0;
}



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

int main(){
  int x, ans = 0;
  cin >> x;
  rep(i, 7){
    if(pow(2, i) <= x && x < pow(2, i+1)){
      ans = pow(2, i);
      break;
    } else {
      ans = pow(2, i);
    }
  }
  cout << ans << endl;
}

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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;cin>>s;
    int k; cin>>k;
    int l = s.size();
    vector<string> top;
    for(int i=0; i<l; i++){
        for(int j=i; j<l&&j<i+k; j++){
            string st = s.substr(i,j-i+1);
            bool flag = true;
            for(string a:top)flag&=(a!=st);
            if(flag){
                top.push_back(st);
                sort(top.begin(),top.end());
                if(top.size()==k+1) top.resize(k);
            }
        }
    }
    cout<<top[k-1]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    lli n,v,g=0,k=0,gkey,kkey,ans;
    map<lli,lli> ki,gu;
    lli i,j;
    cin>>n;
    rep(i,0,n){
        cin>>v;
        if(i%2==0){
            ki[v]++;
            if(k!=max(k,ki[v])){
                k=max(k,ki[v]);
                kkey=v;
            }
        }
        else{
            gu[v]++;
            if(g!=max(g,gu[v])){
                g=max(g,gu[v]);
                gkey=v;
            }
        }
    }
    ans=n-g-k;
    if(kkey==gkey){
        gu.erase(gkey);
        lli g2=0;
        for(auto itr=gu.begin();itr!=gu.end();itr++){
            g2=max(g2,itr->second);
        }
        ans=n-g2-k;
        ki.erase(kkey);
        lli k2=0;
        for(auto itr=ki.begin();itr!=ki.end();itr++){
            k2=max(k2,itr->second);
        }
        ans=min(ans,n-k2-g);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18

priority_queue<int,vector<int>,greater<int>> que;

llint a[5];

void solve(){
	for(int i=0;i<5;i++)cin >> a[i];
	llint mxdif=0,ans=0,mxidx=-1;
	for(int i=0;i<5;i++){
		if(a[i]%10==0) ans+=a[i];
		else ans+=((10-(a[i]%10))+a[i]);

		if(10-a[i]%10>mxdif && a[i]%10!=0){
			mxdif=10-a[i]%10;
			mxidx=i;
		}
	}

	if(mxidx!=-1){
		ans-=(10-(a[mxidx]%10))+a[mxidx];
		ans+=a[mxidx];

	}
	cout << ans << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
 
int main(){
 int N;
 cin >> N;
 vector<int> vec(N);
 rep(i,N){
  cin >> vec.at(i);
 }
 int num = 1;
 int ka = vec.at(0);
for (int j = 1; j < N; j++) {
  if(vec[j] <= ka){
    ka = vec[j];
    num++;
  }
  else{continue;}
 }
  cout <<  num << endl;
}

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

int main() {
	string s;
	cin >> s;
	if (s == "Sunny") cout << "Cloudy" << endl;
	if (s == "Cloudy") cout << "Rainy" << endl;
	if (s == "Rainy") cout << "Sunny" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

template<typename T>
map<T, ll> factorize(T x) {
	map<T, ll> res;
	for (int i = 2; i * i <= x; i++) {
		while (x % i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1) res[x]++;
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	ll ans = 1;
	map<int, ll> res;
	for (int i = 2; i <= n; ++i) {
		map<int, ll> mp = factorize(i);
		for (auto& c : mp) {
			res[c.first] += c.second;
		}
	}
	for (auto& c : res) {
		(ans *= (c.second + 1)) %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define Maxn 100010
#define INF 10010
inline int read()
{
    char c=getchar();re ll f=1,s=0;
    while(!isdigit(c)){if(c=='-')f=-1,c=getchar();}
    while(isdigit(c)){s=s*10+c-48;c=getchar();}
    return f*s;
}
ll f[1000001],ans,n,a,b;
int main()
{
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++) cin>>f[i];
    for(int i=2;i<=n;i++) ans+=min(a*(f[i]-f[i-1]),b);
    cout<<ans<<endl;
    return 0;
}     

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}

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

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,c;cin>>n>>c;
    vector<ll> a(n), b(n);
    rep(i,n){cin>>a[i];}
    rep(i,n){cin>>b[i];}
    ll lim = 401;
    vector<vector<ll>> dp(n+1, vector<ll>(c+1, 0));
    vector<vector<ll>> sum(n+1,vector<ll>(c+1, 0));
    rep(i,n){
        rep(j,c+1){
            repr(k,a[i], b[i]+1){
                sum[i][j] += modpow(k, j, MOD);
                sum[i][j] %= MOD;
            }
        }
    }
    dp[0][0]=1;
    rep(i,n){
        rep(j,c+1){
            for(int k=0;j+k<=c;k++){
                dp[i+1][j+k] += dp[i][j]*sum[i][k];
                dp[i+1][j+k] %= MOD;
            }
        }
    }
    cout << dp[n][c] << endl;
    return 0;
}


Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

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

        final int n = sc.nextInt();

        long ans = 0;

        for (int i = 0; i <= n; i++) {
            if (i % 3 != 0 && i % 5 != 0) ans += i;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 35648
#include<iostream>
using namespace std;
int main()
{
    int a, max = 0, sum = 0;
    for (int i=0;i<3;i++){
        cin >> a;
        sum += a;
        if (max < a){
            max = a;
        }
    };
    cout << sum-max << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

signed main() {
	ios::sync_with_stdio(false);
	int n, i;
	int x;
	cin >> n >> x;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(ALL(a));
	int ans = 0;
	int sum = 0;
	rep(i, n)
		sum += a[i];
	if (sum == x) {
		cout << n << endl;
		return 0;
	}
	int s = 0;
	rep(i, n) {
		if (s <= x) {
			s += a[i];
			ans++;
		}
		else {
			break;
		}
	}
	cout << ans - 1<< '\n';
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
namespace AtCoder_Beginner_Contest_127
{
    class Program
    {
        static public int[] SIn() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static void Main(string[] args)
        {
            var NM = SIn();
            var N = NM[0];
            var M = NM[1];
            long maxL = long.MinValue;
            long minR = N;
            
            for(var i=0;i<M;++i)
            {
                var LR=SIn();
                maxL = Math.Max(maxL, LR[0]);
                minR = Math.Min(minR, LR[1]);
            }
            var num = minR - maxL + 1;
            if (num <= 0) WriteLine(0);
            else WriteLine(num);
        }
    }
}


Measured memory_bytes: 17456
/*

                                  In the name of Allah, Most Gracious, Most Merciful


*/
#include<bits/stdc++.h>
#include<numeric>
using namespace std;

//*** constant value ***
const long double PI = 3.141592653589793238;
const double EPS = 1e-6 ;
//*** constant value ***

//****** define ********
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define dd double
#define vll vector<ll>
#define vs vector<string>
#define fn(i,n) for(ll i = 0; i<n; i++)
#define f(i,a,b) for(i=a;i<b;i++)
#define f1(i,a,b) for(i=b-1;i>=a;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define vpl vector<pll>
#define pb push_back
#define mk make_pair
#define x first
#define y second
#define tt cout<<"Came here"<<endl;
//****** define ********

int main()
{
    IOS;
    string s;
    ll sum = 0;
    cin>>s;
    fn(i,s.length())
     sum += ( s[i] - '0' );

    if(sum%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;


return 0;
}



Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    int n, t;
    //scanf("%d %d", &n, &t);
    cin >> n >> t;
    vector<pair<int,int>> v_pair(n);
    for(int i = 0; i < n; i++){
        int c_i, t_i;
        //scanf("%d %d", &c_i, &t_i);
        cin >> c_i >> t_i;
        v_pair[i] = make_pair(c_i, t_i);
    }
    sort(v_pair.begin(), v_pair.end());
    bool found = false;
    for(auto it = v_pair.begin(); it != v_pair.end() && found == false; it++){
        if((*it).second <= t){
            cout << (*it).first << endl;
            found = true;
        }
    }
    if(found == false){
        cout << "TLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 22 14:29:49 2018

@author: maezawa
"""

n = int(input())

p0 = [0, 0]
p1 = [100, 0]

def koch(edge):
    #print(edge)
    p0 = edge[0]
    p1 = edge[1]
    s = [0,0]
    t = [0,0]
    u = [0,0]
    u1 = [0,0]
    u2 = [0,0]
    s[0] = (p1[0] - p0[0])/3 + p0[0] 
    s[1] = (p1[1] - p0[1])/3 + p0[1]
    t[0] = (p1[0] - p0[0])*2/3 +p0[0]
    t[1] = (p1[1] - p0[1])*2/3 +p0[1]
    u1[0] = (p0[0] + p1[0])/2
    u1[1] = (p0[1] + p1[1])/2
    u2[0] = p0[1]-s[1]
    u2[1] = s[0]-p0[0]
    u[0] = u1[0] + u2[0]*3**0.5/2
    u[1] = u1[1] + u2[1]*3**0.5/2
    return([p0,s,u,t,p1])

points = [p0, p1]

for i in range(n):
    nextpoints = []
    for edge in zip(points, points[1:]):
        k = koch(edge)
        kl = k.pop(-1)
        nextpoints.extend(k)
    nextpoints.append(kl)   
    points = nextpoints

for i in range(len(points)):
    print(*points[i], sep=' ')


Measured memory_bytes: 6280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int n,a[300000];
ll val (ll b){
    ll sum = 0;
    for(int i=1;i<=n;i++)sum += abs (a[i] - (b+i));
    return sum;
}
ll src (){
    ll l = -1000000000;
    ll r = 1000000000;
    ll res = 0;
    while(l<=r){
        ll mid = (l+r)/2;
        ll now = val(mid);
        ll ki = val (mid-1);
        ll ka = val (mid+1);

        if(now<=ki && now<=ka){res = now;break;}
        else if(now<=ki){l=mid+1;}
        else if(now<=ka){r=mid-1;}

    }
    return res;

}
ll ans;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    ans = src();
    cout<<ans<<newl;
}


Measured memory_bytes: 1024
s=input()
a='YES'
while len(s)!=0:
  if s[len(s)-5:len(s)]=='dream':
    s=s[0:len(s)-5]
  elif s[len(s)-7:len(s)]=='dreamer':
    s=s[0:len(s)-7]
  elif s[len(s)-5:len(s)]=='erase':
    s=s[0:len(s)-5]
  elif s[len(s)-6:len(s)]=='eraser':
    s=s[0:len(s)-6]
  else:
    a='NO'
    break
print(a)

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

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

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

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, k; std::cin >> n >> k;
  vi h(n); rep(i, n) std::cin >> h[i];
  vi dp(n, inf);
  dp[0] = 0;
  rep(i, n) {
    rrep(j, k) if (i+j < n) chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
  }
  std::cout << dp[n-1] << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll cur, n, x, ans, cnt[100001];

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> cnt[i];
	}
	for(int i = 0; i < n-1; i++){
		ans+=cnt[i]/2;
		cnt[i]%=2;
		if(cnt[i]&&cnt[i+1]){
			ans++;
			cnt[i]--;
			cnt[i+1]--;
		}
	}
	ans+=cnt[n-1]/2;
	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll a,b,c,d;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);

    ll x1=a*c;
    ll x2=a*d;
    ll x3=b*c;
    ll x4=b*d;

    ll ans=max(max(x1,x2),max(x3,x4));

    printf("%lld\n",ans);
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <sstream>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

long long ans = INF;

int main() {
  long long n;
  cin >> n;
  for(long long i = 1; i <= 1000000; i++) {
    long long a,b;
    a = i;
    if(n % a == 0) {
      b = n/a;
      ans = min(ans,a+b-2);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
cnt = 0

sb = len(S) // 2
fs = S[:sb]
bs = S[-sb:]

if fs == bs[::-1]:
  cnt = 0
else:
  for i in range(len(fs)):
    if fs[i:i+1] != bs[::-1][i:i+1]:
      cnt += 1
      
print(cnt)

Measured memory_bytes: 3060