akhauriyash/Code-Regression huggingface dataset:
N = int(input())
h = list(map(int, input().split()))
ans = 0
while True:
    i = 0
    if not any(h):  # hのリストがなくなるまで続ける
        break
    while i < N:
        if h[i] == 0: # 高さが0なら、次の花へ
            i += 1
        else:
            ans += 1 # 高さが1以上なら、その花の高さを1減らし、答えを1追加する
            while i < N and h[i] != 0:
                h[i] -= 1
                i += 1
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(0);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";


using namespace std;

ll cnt[100010];
ll sum=0;
ll n;

int main(){
FLASH;
cin>>n;
for(ll i=1;i<=n;i++)
{
 ll x;
 cin>>x;
 cnt[x]++;
 sum+=x;
}
ll q;
cin>>q;
while(q--)
{
  ll x,y;
  cin>>x>>y;
  sum-=cnt[x]*x;
  sum+=cnt[x]*y;
  cnt[y]+=cnt[x];
  cnt[x]=0;	
  cout<<sum<<endl;
}







return 0;
} 


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

long long solve() {
  string s, t; cin >> s >> t;
  s += s;
  const size_t n2 = s.size();
  const size_t n = n2 / 2;
  const size_t m = t.size();
  vector<vector<size_t>> pos(26);
  for (size_t i = 0; i < n2; i++) {
    pos[s[i]-'a'].push_back(i+1);
  }
  for (size_t i = 0; i < 26; i++) {
    pos[i].push_back(n2+1);
  }
  long long p = 0;
  for (size_t i = 0; i < m; i++) {
    size_t pm = p % n;
    const auto& v = pos[t[i]-'a'];
    size_t next = *upper_bound(v.cbegin(), v.cend(), pm);
    if (next == n2+1) return -1;
    p += next - pm;
  }
  return p;
}

int main() {
  cout << solve() << endl;
}

Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n, m;
    cin >> n >> m;
    int k[m], s[m][n];
    for (int i = 0; i < m; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) cin >> s[i][j];
    }
    int p[m];
    for (int i = 0; i < m; i++) cin >> p[i];
    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++) {
        bool flag = true;
        for (int i = 0; i < m; i++) {
            int cnt = 0;
            for (int j = 0; j < k[i]; j++) {
                if (bit & (1 << s[i][j] - 1)) cnt++;
            }
            if (p[i] != cnt % 2) flag = false;
        }
        if (flag) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
    int from, to, divident, count = 0;
    scanf("%d %d %d", &from, &to, &divident);
    for (int divisor = from; divisor < to + 1; ++divisor)
    {
        count += !(divident % divisor);
    }
    printf("%d\n", count);
    return 0;
}



Measured memory_bytes: 2148
import sys
import math

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

def main():
    A, B = readline().split()
    A = int(A)
    B1, B2 = B.split('.')
    B1 = int(B1)
    B2 = int(B2)

    ans = A * B1 + int(A * B2 // 100)
    print(ans)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(a-c)/(b+c)<<endl;
}

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

int main(){
    int A, B, C, X;
    int ans = 0;
    cin >> A >> B >> C >> X;
    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            for(int k = 0; k <= C; k++){
                if(i * 500 + j * 100 +k * 50 == X){
                    ans += 1;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

mn = min(a)
mx = max(a)

ans = 10000000
for i in range(mn, mx+1):
    p = 0
    for j in a:
        p += (j-i) * (j-i)
    if ans > p:
        ans = p
print(ans)


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

void solve(int x,int y,int s){
    int ans = -1;
    for(int i=1;i<=s-1;i++){
        for(int j=1;j<=s-1;j++){
            int ii = i*(100+x)/100.0;
            int jj = j*(100+x)/100.0;
            if(ii+jj==s){
                int i3 = i*(100+y)/100;
                int j3 = j*(100+y)/100;
                ans=max(ans,i3+j3);
            }
        }
    }
    cout << ans << endl;
}


int main(){
    int x,y,s;
    while(cin>>x>>y>>s){
        if(x==0 && y==0 && s==0) break;
        solve(x,y,s);
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=1; i<=n; i++)
typedef long long ll;
 
int main() {
  int n; cin>>n;
  ll ans=0;
  rep(i,n){
      if(i%3!=0&&i%5!=0) ans+=i;
  }
  cout<<ans<<endl;
 
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 310
#define inf 1000000000000000000
long long a[N][N],s[N][N];
int vis[N][N];
void flody(int x)
{
    int i,j,k;
    for(k=1;k<=x;k++)
    for(i=1;i<=x;i++)
    for(j=1;j<=x;j++)
    if(a[i][k]+a[k][j]<=s[i][j])
    {
    s[i][j]=a[i][k]+a[k][j];
    if(i!=j&&i!=k&&j!=k)
    {vis[i][j]=1;
    vis[j][i]=1;}
    }
}
int main()
{
    int n,m,i,j,k,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
    {
        scanf("%d",&a[i][j]);
        s[i][j]=a[i][j];
    }
    flody(n);
    flag=0;
    for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
    if(a[i][j]!=s[i][j])
    flag=1;
    if(flag)
    {
        printf("-1\n");
        return 0;
    }
    long long sum=0;
    for(i=1;i<=n;i++)
    for(j=1;j<i;j++)
    if(vis[i][j]==0)
    sum=sum+s[i][j];
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

struct Stus {
    Stus(int Y, int X, int Count) {
        y = Y;
        x = X;
        count = Count;
    }
    int y, x;
    int count;
};

bool visited[50][50];

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> grid(h);
    forin(i, 0, h) cin >> grid[i];
    auto numBlacks = 0;
    forin(i, 0, h) {
        forin(j, 0, w) {
            if (grid[i][j] == '#') numBlacks++;
        }
    }
    queue<Stus> queues;
    queues.push(Stus{0, 0, 1});
    visited[0][0] = true;
    int dxy[4][2] = {
        {1, 0},
        {0, 1},
        {-1, 0},
        {0, -1}
    };
    auto count = 0;
    while (!queues.empty()) {
        auto q = queues.front();
        queues.pop();
        if (q.y == h - 1 && q.x == w - 1) {
            count = q.count;
            break;
        }
        forin(i, 0, 4) {
            auto toy = q.y + dxy[i][0];
            auto tox = q.x + dxy[i][1];
            if (toy < 0 || tox < 0 || toy >= h || tox >= w) continue;
            auto to = grid[toy][tox];
            if (to == '.' && !visited[toy][tox]) {
                cerr << toy << ' ' << tox << ' ' << visited[toy][tox] << endl;
                queues.push(Stus(toy, tox, q.count + 1));
                visited[toy][tox] = true;
            }
        }
    }
    if (count > 0) {
        cout << (h * w - count - numBlacks) << endl;
    } else {
        cout << -1 << endl;
    }
}



Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
const ll INF = 1001001001001001001;

ll maxl(ll a, ll b) {
  if (a >= b)
    return a;
  else
    return b;
}

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll ans = -INF;

  ans = maxl(a * c, ans);
  ans = maxl(a * d, ans);
  ans = maxl(b * c, ans);
  ans = maxl(b * d, ans);

  cout << ans;

  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define jizz ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) x&-x
#define F first 
#define S second 
#define pb push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9;
const int MAXN=1e6;
ll k, a, b, w, ans;
int main(){
	cin >> k >> a >> b;
	k++;
	if (a+2>=b||k<a+2) cout << k;
	else {
		k-=a+2;
		ans+=b;
		w=b-a;
		ans+=w*(k/2);
		ans+=(k%2);
		cout << ans;
	}
}

Measured memory_bytes: 256
// Problem : B - Go to Jail
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


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


#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define mem(ar,x) memset(ar,x,sizeof(ar))
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
#define maxn 1000003
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(){
	
	fastio;
	ll n,x,y;
	cin>>n;
	ll cnt=0;
	bool can=false;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		
		if(x !=y)cnt=0;
		
		else{
			if(cnt == 0){
				cnt=1;
				ct;
			}
			
			if(cnt == 1){
				cnt=2;
				ct;
			}
			if(cnt==2){
				can = true;
				break;
			}
		}
		
	}
	if(can)cout<<"Yes\n";
	else cout<<"No\n";
	
	
	}


	
	
	
	



Measured memory_bytes: 3668
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long T = lread();
    foreach (i; 0 .. T)
    {
        long N, M, A, B;
        scan(N, M, A, B);
        floor_sum(N, M, A, B).writeln();
    }
}

long floor_sum(long n, long m, long a, long b)
{
    long ans;
    if (m <= a)
    {
        ans += (n - 1) * n * (a / m) / 2;
        a %= m;
    }
    if (m <= b)
    {
        ans += n * (b / m);
        b %= m;
    }
    long y_max = (a * n + b) / m, x_max = (y_max * m - b);
    if (y_max == 0)
        return ans;
    ans += (n - (x_max + a - 1) / a) * y_max;
    ans += floor_sum(y_max, a, m, (a - x_max % a) % a);
    return ans;
}


Measured memory_bytes: 4528
#include <bits/stdc++.h>
using namespace std;
#define INF 9999999999

int main() {
    int n;
    while(cin >> n) {
        if(n == 0) break;
        n++;
        int a[5010]; a[0] = 0;
        for(int i=1; i<n; i++) {
            cin >> a[i];
            a[i] += a[i-1];
        }

        int ret = -INF;
        for(int i=0; i<n-1; i++) {
            for(int j=i+1; j<n; j++) {
                ret = max(a[j] - a[i], ret);
            }
        }

        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 1180
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    auto A = ["Christmas Eve Eve Eve", "Christmas Eve Eve", "Christmas Eve", "Christmas"];
    writeln(A[lread() - 22]);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

ll josephus(ll n, ll k, ll s) {
  ll x = k * s;
  while (x > n)
    x = ((x - n) * k - 1) / (k - 1);
  return x - 1;
}
ll josephus(ll n, ll m, ll k, ll s) {
  return ((josephus(n, k, s) - k + 1 + m) % n + n) % n;
}
int main(){
  while(true){
    ll n,k,m; cin>>n>>k>>m;
    if(n + k + m == 0) break;
    //k = (k-1) % n + 1; m = (m-1) % n + 1;
    cout << josephus(n, m-1, k, n) + 1 << endl;
  }
  return 0;
}

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

void sort(vector<int> &av, vector<int> &bv)
{
  int n = av.size() - 1;
  vector<int> p(n), av2(n), bv2(n);
  iota(p.begin(), p.end(), 0);
  sort(p.begin(), p.end(), [&](int a, int b) { return bv[a] < bv[b]; });
  for (int i = 0; i < n; i++) {
    av2[i] = av[p[i]];
    bv2[i] = bv[p[i]];
  }
  av = av2;
  bv = bv2;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  vector<int> b(n+1);

  for (int k = 0; k < n; k++) {
    cin >> a[k] >> b[k];
  }
  sort(a, b);

  int time = 0;
  for (int k = 0; k < n; k++) {
    time += a[k];
    if (time > b[k]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

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

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

    vector<int> ans(n,-1);
    int k = 0;
    for(int i = n; i > 0; i--){
        int si = 0;
        for(int j = 2*i; j <= n; j += i){
            si += ans[j-1];
        }
        if((si-a[i-1])%2 == 0) ans[i-1] = 0;
        else {
            ans[i-1] = 1;
            k++;
        }
    }

    cout << k << endl;
    int cnt = 0;
    rep(i,n){
        if(ans[i] == 1){
            if(cnt > 0) cout << " ";
            cout << i+1;
            cnt++;
        }
    }
    cout << endl;
}


Measured memory_bytes: 2432
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); 
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    
    public static int[] generatePrimes(int n) {
		boolean[] prime = new boolean[n + 1];
		Arrays.fill(prime, 2, n + 1, true);
		for (int i = 2; i * i <= n; i++)
			if (prime[i])
				for (int j = i * i; j <= n; j += i)
					prime[j] = false;
		int[] primes = new int[n + 1];
		int cnt = 0;
		for (int i = 0; i < prime.length; i++)
			if (prime[i])
				primes[cnt++] = i;
		return Arrays.copyOf(primes, cnt);
	}
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}	
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}		    
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}	    	  	
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}		
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}	
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}	    	
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}	    	
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}				
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        int a[] = new int[n];
        for(int i=0;i<n;i++)
        {
            a[i] = in.nextInt();
        }
        long sum=0L;
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                sum += 1L*a[i]*a[j];
            }
        }
        
        out.println(sum);
    }
    /************* SOLUTION ENDS HERE **********/
}

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

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

//library----------------------------------------------


int main(){
    double t,x; cin>>x>>t;
    double ans;
    ans = x/t;
    printf("%.10f\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N), v(1000010);
    rep(i,N){
        cin >> A[i];
        v[A[i]]++;
    }
    bool flag = 1;
    REP(i,2,1000010){
        ll cnt = 0;
        for(ll j=i; j<1000010; j+=i){
            cnt += v[j];
        }
        if(cnt > 1){
            flag = 0;
            break;
        }
    }
    if(flag){
        cout << "pairwise coprime" << endl;
        return 0;
    }
    ll now = A[0];
    rep(i,N){
       now =  __gcd(now,A[i]);
    }
    if(now == 1){
        cout << "setwise coprime" << endl;
        return 0;
    }
    cout << "not coprime" << endl;
}

Measured memory_bytes: 18748
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[55][55];
    int n, m;
    scanf("%d %d", &n, &m);
    bool judge = 1;
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= m; ++j)
            scanf(" %c", &a[i][j]);
    }
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= m; ++j)
            if (a[i][j] == '#'){
                if (!(a[i - 1][j] == '#' || a[i + 1][j] == '#' || a[i][j - 1] == '#' || a[i][j + 1] == '#')){
                    judge = false;
                    break;
                }
            }
    }
    puts(judge ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// make pair, tuple
// __gcd(int, int)
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }

int main(){
    string a,b;cin >> a >> b;
    int x,y;cin >> x >> y;
    string t;cin >> t;
    if(t == a)x--;
    else if(t == b)y--;
    cout << x << " " << y;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include <vector>
#include <unordered_map>

using namespace std;

#define INT_MIN     (-2147483647 - 1) // minimum (signed) int value

vector<int> arr(2000000);
int n;

void maxHeapify(int i) {
	int l = 2 * i;
	int r = 2 * i + 1;
	int large_idx = i;
	
	if (l <= n && arr[l] > arr[large_idx])
		large_idx = l;
	if (r <= n && arr[r] > arr[large_idx])
		large_idx = r;
	
	if (i != large_idx) {
		swap(arr[i], arr[large_idx]);
		maxHeapify(large_idx);
	}
}

int pop() {
	if (n < 1) 
		return INT_MIN;
	int ret = arr[1];
	arr[1] = arr[n--];
	maxHeapify(1);
	return ret;
}


int push(int v) {
	int i = ++n;
	arr[i] = v;
	while (i > 1 && arr[i / 2] < arr[i]) {
		swap(arr[i], arr[i / 2]);
		i /= 2;
	}
	return v;
}

int main()
{
			n = 0;
		int v;
		string op;
		while (true) {
			cin >> op;
			if (op == "extract")
				cout << pop() << endl;
			else if (op == "insert") {
				cin >> v;
				push(v);
			}
			else
				break;
		}
	//vector<int> keys{ 8, 2, INT_MIN, 10, INT_MIN, 11, INT_MIN, INT_MIN, INT_MIN };
	//vector<int> opts{ 1, 1, 0, 1, 0, 1, 0, 0, -1 };

	//for (int i = 0; i < opts.size(); ++i) {
	//	if (opts[i] == 1)
	//		push(keys[i]);
	//	else if (opts[i] == 0)
	//		cout << pop() << endl;
	//	else
	//		break;
	//}

	return 0;
}






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

void solve(long long N, std::vector<std::string> s){
    long long result = 0LL;
    unordered_map<string, vector<string>> cache;
    for(int n = s.size(), i=n-1; i>=0; --i){
        vector<int> chars(26, 0);
        for (auto& c: s[i]){
            chars[c-'a']++;
        }
        string tmp;
        for (auto c: chars){
            tmp += to_string(c) + "_";
        }
        result += cache[tmp].size();
        cache[tmp].push_back(s[i]);
    }
    printf("%lld", result);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> s(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> s[i];
    }
    solve(N, std::move(s));
    return 0;
}


Measured memory_bytes: 33316
# coding: utf-8
# Your code here!

# coding: utf-8
# Your code here!
n = int(input())
builds=list(map(int,input().split()))
dame = []

for i in range(n-1):
    if builds[i] >= builds[i+1]:
        dame.append(1)
    else:
        dame.append(0)
dame.insert(0,0)

maxi = 0
maxc = 0
count = 0
for i,d in enumerate(dame):
    if d == 0:
        if maxc <= count:
            maxc = count
            maxi = i-count+1
        count = 0
    else:
        count+=1
if maxc <= count:
    maxc = count
    maxi = i-count+1
#print(dame)
print(maxc)

Measured memory_bytes: 14228
#include <bits/stdc++.h>
#define xx first
#define yy second
#define ll long long
using namespace std;

struct _in {
	const _in operator , (int &a) const {
		a = 0; char k = getchar (); int f = 1;
		while (k > '9' || k < '0') { if (k == '-') f = -1; k = getchar (); }
		while (k >= '0' && k <= '9') { a = a * 10 + k - '0'; k = getchar (); }
		a *= f;
		return*this;
	}
}in;

//const int N = ;
/*const int mod = ;
inline int add (int u, int v) { return u + v >= mod ? u + v - mod : u + v; }
inline int sub (int u, int v) { return u - v < 0 ? u - v + mod : u - v; }
inline int mul (int u, int v) { return 1LL * u * v % mod; }
inline int qpow (int base, int v) {
	int tot = 1;
	while (v) {
		if (v & 1) tot = mul (tot, base);
		base = mul (base, base);
		v >>= 1;
	}
	return tot;
}*/

int main () {
	char tmp[200];
	scanf ("%s", tmp + 1);
	if (tmp[1] == 'S') {
		printf ("Cloudy\n");
	}
	else if (tmp[1] == 'C') {
		printf ("Rainy\n");
	}
	else {
		printf ("Sunny\n");
	}
	return 0;
}






























Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int N; cin >> N;
    vector<ll> c(N);
    rep(i, N) cin >> c[i];
    sort(c.begin(), c.end());

    vector<ll> pow2(N+5, 0);
    pow2[0] = 1;
    repr(i, 1, N+1) { pow2[i] = pow2[i-1]*2%mod; }

    ll ans = 0;
    rep(i, N) {
        int r = N-i-1;
        ll add = pow2[r];
        if (r) add += pow2[r-1] * r % mod;
        chmod(add);
        add *= pow2[i];
        chmod(add);
        add *= c[i];
        chmod(add);
        ans += add;
        chmod(ans);
    }
    ans *= pow2[N];
    chmod(ans);

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


Measured memory_bytes: 3456
#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);
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(all(l));

  int ans = 0;
  for (int a = 0; a < n - 2; ++a) {
    for (int b = a + 1; b < n - 1; ++b) {
      vector<int>::iterator begin = l.begin() + b + 1;
      ans += upper_bound(begin, l.end(), l[a] + l[b] - 1) - begin;
    }
  }
  out(ans);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,a[10],b=0,c=0,i,j=0,g=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		g=0;
		b=0;
		c=0;
		for(j=0;j<10;j++)
		{
			scanf("%d",&a[j]);
		}
		for(j=0;j<10;j++)
		{
			if(b<a[j])
			{
				b=a[j];
			}
			else if(c<a[j])
			{
				c=a[j];
			}
			else 
			{
				g++;
			}
		}
		if(g>=1)
		{
			printf("NO\n");
		}
		else
		{
			printf("YES\n");
		}
	}
	return 0;
}

Measured memory_bytes: 580
S = input()
A = int(S[0:2])
B = int(S[2:])

if (A<=12 and A>0) and (B>12 or B==0):#A is between 0-12 and B is not month (=year)
    strFormat = "MMYY"
elif (A>12 or A==0) and (B<=12 and B>0):#B is between 0-12 and B is not month(=year)
    strFormat = "YYMM"
elif (A>0 and A<=12 and B>0 and B<=12 ):#both are between 1-12
    strFormat = "AMBIGUOUS"
else:
    strFormat = "NA"

print(strFormat)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int M=1e5+10;
int a[M][3],n,dp[M][3];
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
    memcpy(dp[0],a[0],sizeof(dp[0]));
    for(int i=1;i<n;i++)
        for(int j=0;j<3;j++)
            for(int k=0;k<3;k++)
                if(j!=k)
                    dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
    printf("%d\n",max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])));
    return 0;
}


Measured memory_bytes: 2560
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())

weather = ['Sunny', 'Cloudy', 'Rainy']
s = ns()

if s == weather[0]:
    print(weather[1])
elif s == weather[1]:
    print(weather[2])
else:
    print(weather[0])

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p, l, r;
};
struct Node T[MAX];
int n;

void preParse(int u){
  if(u == NIL)
    return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL)
    return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL)
    return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i, v, l, r, root;
  scanf("%d",&n);
  if(n < 1 || n > 25)
    exit(1);

  for(i = 0; i < n; i++)
    T[i].p = NIL;

  for(i = 0; i < n; i++){
    scanf("%d %d %d", &v, &l, &r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL)
      T[l].p = v;
    if(r != NIL)
      T[r].p = v;
  }

  for(i = 0; i < n; i++){
    if(T[i].p == NIL)
      root = i;
  }

  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Inorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");
}


Measured memory_bytes: 2028
#include <iostream>
#include <vector>
#include <algorithm>
#define MAX_V 100010
#define INF 1000000000
using namespace std;
vector<int> G[MAX_V];

bool used[MAX_V];
long long V,E,a[MAX_V],l[MAX_V],r[MAX_V],cnt=0;

void dfs(int s, int p){
	used[s] = true;
	int i = 0;
	while(true){
		int e = G[s][i];
		if(e==-1){
			break;
		}
		i++;
		if(!used[e]){
			if(r[e]+1 < l[s] || r[s]<l[e]-1){
				cnt = 1;
			}else{
				l[e] = max(l[s]-1,l[e]);
				r[e] = min(r[s]+1,r[e]);
			}
			dfs(e,s);
		}
	}
	if(r[s]+1<l[p] || r[p]<l[s]-1){
		cnt = 1;
	}else{
		l[p] = max(l[p],l[s]-1);
		r[p] = min(r[p],r[s]+1);
	}
}

void dfs2(int s, int p){
	used[s] = true;
	int i = 0;
	if(s==p){
		a[s] = max((long long)0,l[s]);
	}else if(l[s]<=a[p]-1 && a[p]-1<=r[s]){
		a[s] = a[p]-1;
	}else if(l[s]<=a[p]+1 && a[p]+1<=r[s]){
		a[s] = a[p]+1;
	}else{
		cnt = 1;
	}
	while(true){
		int e = G[s][i];
		if(e==-1){
			break;
		}
		i++;
		if(!used[e]){
			dfs2(e,s);
		}
	}
}
				
int main(){
	int i,j,k,s,t;
	cin >> V;
	for(i=0;i<V-1;i++){
		cin >> s >> t;
		s--; t--;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	for(i=0;i<V;i++){
		G[i].push_back(-1);
		l[i] = -INF;
		r[i] = INF;
		used[i] = false;
	}
	cin >> k;
	for(i=0;i<k;i++){
		cin >> s >> t;
		a[s-1] = t;
		l[s-1] = t;
		r[s-1] = t;
	}
	dfs(0,0);
	for(i=0;i<V;i++){
		used[i] = false;
	}
	dfs2(0,0);
	if(cnt){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	for(i=0;i<V;i++){
		cout << a[i] << endl;
	}
}

Measured memory_bytes: 13568
N = int(input())
A = list(map(int, input().split()))

cnt = 0
for a in A :
    if a < 0 :
        cnt += 1

A = list(map(abs, A))

if cnt % 2 == 0 :
    print(sum(A))
else :
    print(sum(A) - min(A) * 2)


Measured memory_bytes: 14332
import sys
n, m, x, y = map(int, input().split())
lineA = list(map(int, input().split()))
lineB = list(map(int, input().split()))
maxA = max(lineA)
minB = min(lineB)
if maxA >= minB:
    print("War")
else:
    for i in range(x + 1, y):
        if maxA < i and i <= minB:
            print("No War")
            sys.exit(0)
    print("War")


Measured memory_bytes: 3060
n, m = map(int, input().split())
li = []
for i in range(m):
    li.append(int(input()))


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    elif dan == 0:
        return 0
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = (a1 + a2) % 1000000007
            a1 = a2 % 1000000007
            a2 = a3 % 1000000007

        return a3



if m != 0:
    ans = fib(li[0]) % 1000000007
    for i in range(m-1):
        ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

    ans = ans * fib(n - li[m-1]) % 1000000007
    print(ans)

else:
    print(fib(n+1))

Measured memory_bytes: 7080
#include <stdio.h>

int main(){
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	a -= c;
	b -= d;
	c += b;
	d -= a;
	printf("%d %d ", c, d);
	c += a;
	d += b;
	printf("%d %d\n", c, d);
}


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

int main(){
    int n;
    cin>>n;
    vector<int> a(3), dp(3);
    
    while(n--){
        cin>>a[0]>>a[1]>>a[2];
        vector<int> temp(3);
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(i != j) temp[i] = max(temp[i],dp[j]+a[i]);
            }
        }
        
        swap(temp,dp);
    }
    
    int mx = -1;
    for(int &x: dp) mx = max(mx, x);
    
    cout<<mx<<endl;
    
    return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N, W;
    cin >> N >> W;
    vector<ll> w(N + 1), v(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }

    ll dp[N + 1][W + 1];
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j < w[i])
                dp[i][j] = dp[i - 1][j];
            else
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
        }
    }

    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79104
#include "bits/stdc++.h"
using namespace std;

int main() {
	
	int n, k;
	cin >> n >> k;
	
	// min x such that (k-1)*x+1 >= n
	
	for (int x=1; x<=200000; x++) {
		if ((k-1)*x+1 >= n) {
			cout << x << endl;
			exit(0);
		}
	}
	cout << endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
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; }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) do{}while(0)
#endif




int main(){
	ll x;
	cin >> x;
	
	int k = 0;
	if      ( 1800 <= x ) k = 1;
	else if ( 1600 <= x ) k = 2;
	else if ( 1400 <= x ) k = 3;
	else if ( 1200 <= x ) k = 4;
	else if ( 1000 <= x ) k = 5;
	else if (  800 <= x ) k = 6;
	else if (  600 <= x ) k = 7;
	else if (  400 <= x ) k = 8;
	
	

	
	cout << k << endl;
	
	return 0;
}




Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main() 
{
   int n,m,sum=0,s,i;
   cin>>n;
   int arr[n];
   for (i = 0; i < n; i++)
   {
       cin>>arr[i];
   }
   m=*max_element(arr+0,arr+n);
   for (i = 0; i < n; i++)
   {
       sum+=arr[i];
   }
   s=sum-m;
   if(s>m)
   {
       cout<<"Yes"<<endl;
   }
   else
   {
       cout<<"No"<<endl;
   }

   return 0;
}

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

int table[5100] ;

void f(){
	for( int i=500 ; i<=5000 ; i += 100 ){
		
		for( int c=0 ; c*500<=i ; c++ ){
			for( int b=0 ; b*300+c*500<=i ; b++ ){
				for( int a=0 ; a*200+b*300+c*500<=i ; a++ ){
					
					int sum = 380*5*(a/5)*(1.00-0.2) + 380*(a%5) ;
					sum += 550*4*(b/4)*(1.00-0.15)+0.5 + 550*(b%4) ;
					sum += 850*3*(c/3)*(1.00-0.12) + 850*(c%3) ;
					
					if( sum!=0 && a*200+b*300+c*500 == i ) table[i] = min( table[i] , sum ) ;
				}
			}
		}
	}
}

main(){
	for( int i=500 ; i<=5000 ; i+=100 ) table[i] = 100000 ;
	f() ;
	
	int n ;
	while( cin >> n , n ){
		cout << table[n] << endl ;
	}
}

Measured memory_bytes: 1180
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	num, _ := getNumberAndLength(s.Text())

	words := make([]string, num)
	for i := 0; i < num; i++ {
		s.Scan()
		words[i] = s.Text()
	}

	sort.Strings(words)
	fmt.Println(strings.Join(words, ""))
}

func getNumberAndLength(text string) (int, int) {
	a := strings.Split(text, " ")
	num, _ := strconv.Atoi(a[0])
	length, _ := strconv.Atoi(a[1])
	return num, length
}


Measured memory_bytes: 1764
N=int(input())
L =  list(map(int,input().split()))	
L.sort()
counter=0
for i in range(N):
    for j in range(i+1, N):
        if L[j]>L[i]:
            for k in range(j+1, N):
                if L[k]>L[j]:
                    if L[i]+L[j]>L[k] and L[i]+L[k]>L[j] and L[k]+L[j]>L[i]:
                        counter+=1
print(counter)

Measured memory_bytes: 9192
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] r = new int[n+1];
		
		for(int i=0; i<n+1; i++) {
			r[i] = sc.nextInt();
			if(i < n-1) {
				sc.nextInt();
			}
		}
		
		int[][] A = new int[n][n];
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {	
				A[i][j] = Integer.MAX_VALUE;
			}
		}
		
		for(int i=1; i<=n-1; i++) {
			for(int j=0; j<n-i; j++) {
				for(int k=j; k<j+i; k++) {
					int temp = A[j][k] + A[k+1][j+i] + r[j]*r[k+1]*r[j+i+1];
					if(temp < A[j][j+i]) {
						A[j][j+i] = temp;
					}
					
//					System.out.println(j + " " + (j+i) + " " + k + " " + temp + " " + A[j][j+i]);
				}
			}
		}
		
		System.out.println(A[0][n-1]);
	}

	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}
}

Measured memory_bytes: 24544
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	String s = scan.next();
	int[] count = new int[26];
	for (int i = 0; i < s.length(); i++) {
	    count[s.charAt(i) - 'a']++;
	}

	boolean isEven = true;
	for (int i = 0; i < 26; i++) {
	    if(count[i] % 2 != 0) {
		isEven = false;
		break;
	    }
	}

	System.out.println(isEven ? "Yes" : "No");
	scan.close();
    }
}


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

def solve():
    m = A.pop(0)
    ans = B[m-1]
    for i, a in enumerate(A):
        ans += B[a-1]
        if a == m + 1:
            ans += C[m-1]
        m = a
    print(ans)

if __name__ == "__main__":
    solve()

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

int main(){
  int D, G;
  cin >> D >> G;
  vector<int> p(D);
  vector<int> c(D);
  for(int i = 0; i < D; i++){
    cin >> p.at(i) >> c.at(i);
  }
  int pos;
  int sum;
  int count;
  int left;
  int minimum = 99999;
  for(int i = 0; i < (1<<D); i++){
    pos = 1;
    sum = 0;
    count = 0;
    left = -1;
    for(int j = 0; j < D; j++){
      if(1 & (i >> j)){
        sum += (j+1) * 100 * p.at(j) + c.at(j);
        count += p.at(j);
      }else{
        left = j;
      }
    }
    //cout << endl;
    //cout << sum << ":" << count << "   " << (G - sum)/((left+1)*100) << endl;
    if(sum < G){
      int a = (left+1)*100;
      int b = (G - sum + a -1)/a;
      if(b >= p.at(left)){
        continue;
      }
      count += b;
    }
    minimum = min(minimum, count);
  }
  cout << minimum << endl; 
  return 0;
}

Measured memory_bytes: 256
N=int(input())
num_list=list(map(int,input().split()))
def partition(A,p,r):
    x=A[r-1]
    i=p-1
    for j in range(p,r-1):
        if A[j]<=x:
            i+=1
            A[i],A[j]=A[j],A[i]
    A[i+1],A[r-1]=A[r-1],A[i+1]
    return i+1
x=partition(num_list,0,N)
for i in range(N):
    if i==x:
        print([num_list[i]],end=" ")
    elif i==N-1:
        print(num_list[i],end="\n")
    else:print(num_list[i],end=" ")



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

int main() {
  vector<float> D(5);
  float temp;
  for (int i = 0; i < 5; i++) {
  	cin >> temp;
    D.at(i) = temp / 10.;
  }
  
  float i, f_min = 1.;
  int ind;
  for (int j = 0; j < 5; j++) {
    float f = modf(D.at(j), &i);
    if (f > 0 && f < f_min) {
      ind = j;
      f_min = f;
    }
  }
  int s = 0;
  for (int j = 0; j < 5; j++) {
    if (j == ind) {
      s += D.at(j) * 10;
    } else {
      s += ceil(D.at(j)) * 10;
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
using namespace std;


struct comb {
	int x, y;
};

bool cmp(comb a, comb b) {
	if (a.x < b.x) {
		return true;
	}

	if (a.x > b.x) {
		return false;
	}

}

bool cmp2(comb a, comb b) {
	if (a.y < b.y) {
		return true;
	}

	if (a.y > b.y) {
		return false;
	}

}


int main() {

	//cout << fixed << setprecision(10);
	comb a[1000],b[1000];
	int n,sum=0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].x >> a[i].y;
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i].x >> b[i].y;
	}
	sort(a, a + n, cmp2);
	sort(b, b + n, cmp);
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j >= 0; j--) {
			if (b[i].x > a[j].x&&b[i].y > a[j].y) {
				sum++;
				a[j].x = 9999999;
				break;
			}
		}
	}
	cout << sum;
}


Measured memory_bytes: 256