akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <algorithm>
#include <vector>

using namespace std;

int max(int a, int b);
int min(int a, int b);
int is_prime(int n);

int main(int argc, char const* argv[])
{
    int n;
    while (cin >> n ,n) 
    {
        //if ( n==-1 && p==-1 ) { break; }
        vector<int> arr(5);
        vector<int> sum(n);
        int min_num = 0;
        int max_num = 0;
        for (int t = 0; t < n; t++) 
        {
            for (int i = 0; i < 5; i++) 
            {
                cin >> arr[i];
                sum[t] += arr[i];
            }
        }
        sort( sum.begin(), sum.end() );
        min_num = sum[0];
        max_num = sum[n-1];
        cout << max_num << " " << min_num << endl;
    }
    return 0;
}

int is_prime(int n)
{
    if (n ==1 || n== 0) 
    {
        return 0;
    }
    for (int i = 2; i*i <= n; i++) 
    {
        if (n % i == 0) 
        {
            return 0;
        }
    }
    return 1;

}


int max(int a, int b)
{
    if (a > b) 
    {
        return a;
    }
    else{
        return b;
    }
}
int min(int a, int b)
{
    if (a > b) 
    {
        return b;
    }
    else{
        return a;
    }
}

Measured memory_bytes: 1216
s = input()
s = s[::-1]
n = len(s)

cur = 0
while cur < n:
  if s[cur:cur+5:] == "maerd" or s[cur:cur+5:] == "esare":
    cur += 5
    continue
  elif s[cur:cur+6:] == "resare":
    cur += 6
    continue
  elif s[cur:cur+7:] == "remaerd":
    cur += 7
    continue
  print("NO")
  exit()
print("YES")

Measured memory_bytes: 40432
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

use std::f64::consts::PI;

fn sq(x: f64) -> f64 {
    x * x
}

fn main() {
    let mut scan = Scan::new();

    let A = scan.word::<f64>();
    let B = scan.word::<f64>();
    let H = scan.word::<f64>();
    let M = scan.word::<f64>();

    let h = 2.0 * PI * (H + M / 60.0) / 12.0;
    let m = 2.0 * PI * M / 60.0;
    let d = (sq(A * h.cos() - B * m.cos()) + sq(A * h.sin() - B * m.sin())).sqrt();

    println!("{}", d);
}


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

double p;
vector<vector<pair<int, int>>> e;
bool done[100010];

double value_dfs(int pos, double curr_p) {
    done[pos] = true;

    curr_p *= p;
    double ret = 0.;
    for (auto x : e[pos]) {
        int to = x.first;
        int cost = x.second;
        if (!done[to]) {
            ret += cost * curr_p;
            ret += value_dfs(to, curr_p);
        }
    }
    return ret;
}

double dfs2(int pos, double curr_p) {
    if (done[pos]) return 0.;
    done[pos] = true;

    double ret = curr_p;

    curr_p *= p;
    for (auto x : e[pos]) {
        int to = x.first;
        if (done[to]) continue;
        ret += dfs2(to, curr_p);
    }
    return ret;
}

int main() {
    int N;
    cin >> p >> N;
    e = vector<vector<pair<int, int>>>(N);
    for (int i = 0; i < N - 1; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        x--, y--;
        e[x].push_back({y, c});
        e[y].push_back({x, c});
    }

    memset(done, false, sizeof(done));
    double v = value_dfs(0, 1.0);
    memset(done, false, sizeof(done));
    printf("%.10lf\n", v + v * dfs2(0, 1.0));
}


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

using namespace std;
using ll = long long;

int main() {
    ll n;
    cin>>n;
    vector<ll> lf(n+1);
    for(int i = 0;i <= n;++i) {
        cin>>lf[i];
    }
    vector<ll> lu(n+1,0);
    ll ti=1-lf[0];
    lu[0]=1;
    for(int i = 1;i <= n;++i) {
        ll ni=min(ti*2-lf[i-1],100000000000000LL);
        if(lf[i-1]>ti){
            cout<<-1<<endl;
            return 0;
        }
        lu[i]=ni;
        ti=ni;
    }
    if(n==0){
        if(lf[0]>=2){
            cout<<-1<<endl;
        }
        else if(lf[0]==1)cout<<1<<endl;
        return 0;
    }

    vector<ll> ld(n+1,0);
    ti=lf[n];
    ld[n]=lf[n];
    for(int i = 1;i <= n;++i) {
        ll ni=ti+lf[n-i];
        ld[n-i]=ni;
        ti=ni;
    }
    ll ans=0;
    vector<ll> la(n+1);
    for(int i = 0;i <= n;++i) {
        //cout<<lu[i]<<" "<<ld[i]<<endl;
        la[i]=min(lu[i],ld[i]);
    }
    for(int i = 1;i <= n;++i) {
        if(la[i]>=(la[i-1]-lf[i-1])*2)la[i]=(la[i-1]-lf[i-1])*2;
        //cout<<la[i]<<endl;
        if(la[i]<lf[i]){
            cout<<-1<<endl;
            return 0;
        }
        ans+=la[i];
    }
    cout<<ans+la[0]<<endl;
    return 0;
}


Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef pair<int,int> pii;
int N,A[20][2],cnt,X,Y,ans=1e9;
pii S[20];
bool ch[20],fail;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i][0];
    for(int i=0; i<N; i++) cin >> A[i][1];
    X = Y = N/2;
    if(N%2) Y++;
    for(int t=0; t<(1<<N); t++){
        vector<pii> V,Q;
        fail = 0;
        cnt = 0;
        for(int x=0; x<N; x++){
            ch[x] = t&(1<<x);
            if((x+ch[x])%2) V.emplace_back(A[x][ch[x]],x);
            else Q.emplace_back(A[x][ch[x]],x);
        }
        sort(V.begin(),V.end());
        sort(Q.begin(),Q.end());
        if(V.size()!=X||Q.size()!=Y) continue;
        for(int i=0; i<X; i++) S[2*i+1] = V[i];
        for(int i=0; i<Y; i++) S[2*i] = Q[i];
        for(int i=0; i<N-1; i++){
            if(S[i].va>S[i+1].va){
                fail = 1;
                break;
            }
        }
        if(fail) continue;
        for(int i=0; i<N; i++){
            for(int j=i+1; j<N; j++){
                if(S[i].vb>S[j].vb) cnt++;
            }
        }
        //cout << t << ' ' << cnt << '\n';
        ans = min(ans,cnt);
    }
    if(ans==1e9) cout << -1;
    else cout << ans;
}


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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  ll ans = 0, mxm = 0;
  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    if (mxm > a) {
      ans += mxm - a;
    }
    else {
      mxm = a;
    }
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 3640
def s_comb(n,k):
    s=1
    r=min(k,n-k)
    p=10**9+7
    for c in range(r):
        s=(s*(n-c)*pow(c+1,p-2,p))%p
    return s


x,y=map(int,input().split())
if (x+y)%3!=0 or 2*y<x or 2*x<y:
    print(0)
else:
    r=min(2*y-x,2*x-y)//3
    print(s_comb((x+y)//3,r))


Measured memory_bytes: 3064
#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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 100100;
int par[MAX_N]; // 親
int rank_[MAX_N]; // 木の深さ

// n要素で初期化
void UFinit(){
    for(int i=0;i<MAX_N;i++){
        par[i] = i;
        rank_[i] = 0;
    }
}

// 木の根を求める
int find(int x){
    if(par[x] == x){
        return x;
    }else{
        return par[x] = find(par[x]);
    }
}

// xとyの属する集合を併合
void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rank_[x] < rank_[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(rank_[x] == rank_[y]) rank_[x]++;
    }
}

// xとyが同じ集合に属するか否か
bool same(int x, int y){
    return find(x) == find(y);
}

int ok[MAX_N];
int ng[MAX_N];
ll sum[MAX_N];

int main(){
    int n,m; cin >> n >> m;
    ll x[n];
    rep(i,n)cin >> x[i];
    vector<pair<ll, P>> v;
    rep(i,m){
        pair<ll,P> p;
        cin >> p.second.first >> p.second.second >> p.first;
        p.second.first--; p.second.second--;
        v.push_back(p);
    }
    sort(v.begin(), v.end());
    UFinit();

    rep(i,n)sum[i] = x[i];

    int ans = 0;
    int tmp = 0;
    rep(i,m){
        int a = v[i].second.first;
        int b = v[i].second.second;
        int y = v[i].first;
        if(find(a) == find(b)){
            int papa = find(a);
            if(sum[papa] >= y){
                ok[papa]++;
                tmp++;
                ans = max(ans,tmp);
            }else{
                ng[papa]++;
            }
        }else{
            int papa = find(a);
            int mama = find(b);
            if(sum[papa] + sum[mama] >= y){
                tmp += ng[papa] + ng[mama] + 1;
                ans = max(ans,tmp);
                unite(a,b);
                int papamama = find(a);
                sum[papamama] = sum[papa] + sum[mama];
                ok[papamama] = ok[papa] + ng[papa] + ok[mama] + ng[mama] + 1;
                ng[papamama] = 0;
            }else{
                unite(a,b);
                int papamama = find(a);
                sum[papamama] = sum[papa] + sum[mama];
                ok[papamama] = ok[papa] + ok[mama];
                ng[papamama] = ng[papa] + ng[mama] + 1;
            }
        }
    }

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

Measured memory_bytes: 5104
l,r=map(int,input().split())
L=l%2019
R=r%2019

if(r-l>=2019):
    print(0)
elif(2019<=r):
    Min=2019
    for i in range(r,l,-1):
        for j in range(i-1,l-1,-1):
            if(i*j%2019<Min):
                Min=i*j%2019
    print(Min)
else:
    print(l*r%2019)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

ll A[MAXN];
ll ans[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y;
    ll sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;

    cin>>n;

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

    sum>>=1;

    for(int i=1;i<n;i+=2)
        sum-=(A[i]);

    ans[0] = sum;

    for(int i=1;i<n;i++)
        ans[i] = A[i-1]-ans[i-1];

    for(int i=0;i<n;i++)
        cout<<ans[i]<<" ";

    return 0;
}


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

int main(){
    int n, d;
    cin >> d >> n;
    int a;
    if (n != 100)
        a = (pow(100, d) * n);
    else
    {
        switch (d)
        {
        case 0:
            a = 101;
            break;
        case 1:
            a = 10100;
            break;
        case 2:
            a = 1010000;
        default:
            break;
        }
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define MOD 1000000007

#define FOR(i, m, n) for (ll i = m; i <= n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)

ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main() {
    string S;
    cin >> S;
    cout << (S[2] == S[3] && S[4] == S[5] ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rem(i, s, n) for (int i = (s); i >= (n); --i)
using ll = long long;
const int MOD = 1e9 + 7;

int main(){
    int k, x; cin >> k >> x;

    if(k * 500 >= x) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
//BEGIN CUT HERE
struct LowestCommonAncestor{
  const int MAX_LOG_V = 50;
  
  int n;
  vector<vector<int> > G,par;
  vector<int> depth;
  LowestCommonAncestor(){}
  LowestCommonAncestor(int sz):
    n(sz),G(sz),par(MAX_LOG_V,vector<int>(n)),depth(sz){}

  void add_edge(int u,int v){
    G[u].push_back(v);
    G[v].push_back(u);
  }
  
  void dfs(int v,int p,int d){
    par[0][v]=p;
    depth[v]=d;
    for(int i=0;i<(int)G[v].size();i++){
      if(G[v][i]!=p) dfs(G[v][i],v,d+1);
    }
  }
  
  void build(int r=0){
    dfs(r,-1,0);
    for(int k=0;k+1<MAX_LOG_V;k++){
      for(int v=0;v<n;v++){
	if(par[k][v]<0) par[k+1][v]=-1;
	else par[k+1][v]=par[k][par[k][v]];
      }
    }
  }
  
  int lca(int u,int v){
    if(depth[u]>depth[v]) swap(u,v);
    for(int k=0;k<MAX_LOG_V;k++){
      if((depth[v]-depth[u])>>k&1){
	v=par[k][v];
      }
    }
    if(u==v) return u;
    for(int k=MAX_LOG_V-1;k>=0;k--){
      if(par[k][u]!=par[k][v]){
	u=par[k][u];
	v=par[k][v];
      }
    }
    return par[0][u];
  }

  int distance(int u,int v){
    return depth[u]+depth[v]-depth[lca(u,v)]*2;
  }
};
//END CUT HERE

signed main(){
  int n;
  cin>>n;
  LowestCommonAncestor lca(n);
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int c;
      cin>>c;
      lca.add_edge(i,c);
    }
  }
  lca.build();
  int q;
  cin>>q;
  while(q--){
    int u,v;
    cin>>u>>v;
    cout<<lca.lca(u,v)<<endl;
  }
  return 0;
}
/*
verified on 2017/06/29
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C&lang=jp
*/

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b+c || b==c+a || c==a+b){
    cout <<"Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <vector>
#include <iostream>
#include <set>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)
typedef long long ll;
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	long long n,k;
	cin>>n>>k;
	int ans=1;
	for(int i=1;i<=n;i++){
		if((ans*2)<(ans+k))ans*=2;
		else ans+=k;
	}
	cout<<ans;
    return 0;
}


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

int main()
{
    int H, W, K;
    cin >> H >> W >> K;

    vector<vector<char>> t(H, vector<char>(W));

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> t.at(i).at(j);
        }
    }

    int p = 0;

    for (int i = 0; i < (1 << H); i++) {
        for (int j = 0; j < (1 << W); j++) {
            int s = 0;

            for (int k = 0; k < H; k++) {
                for (int l = 0; l < W; l++) {
                    if (((i & (1 << k)) == 0) && ((j & (1 << l)) == 0)) {
                        if (t.at(k).at(l) == '#')
                            s++;
                    }
                }
            }

            if (s == K)
                p++;
        }
    }

    cout << p << endl;
}


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

using namespace std;

int main(void){
  int R;
  cin >> R;
  if(R<1200){
    cout << "ABC" << endl;
  }
  else if(R<2800){
    cout << "ARC" << endl;
  }
  else{
    cout << "AGC" << endl;
  }
}

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

int main () {
    int A,B,C,X;
    cin >> A >> B >> C >> X;

    int count = 0;

    for (int i = 0; i <= A; i++){
        for (int j = 0; j <= B; j++){
            for (int k = 0; k <= C; k++){
                if ((500 * i + 100 * j + 50 * k) == X)
                    count++;
            }
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 3596
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][2];
        for(int i = 0; i < n; i++) {
        	a[i][0] = sc.nextInt();
        	a[i][1] = i+1;
        }
        Arrays.sort(a, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return o1[0] - o2[0];    //[0] をキーにソート(昇順)
                //return o2[0] - o1[0];    //[0] をキーにソート(降順)
            }
        });

        for(int i = 0; i < n; i++) {
        	System.out.println(a[i][1]);
        }

        return;
    }


}

Measured memory_bytes: 70740
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){
	
	char s[12000];
	
	while(scanf("%s",s)!=EOF){
		int len = strlen(s);
		int n=0,m=0;
		for(int i=0;i<len-2;i++){
			if(s[i]=='J'&&s[i+1]=='O'&&s[i+2]=='I')
				n++;
			else if(s[i]=='I'&&s[i+1]=='O'&&s[i+2]=='I')
				m++;
		}
		cout<<n<<endl;
		cout<<m<<endl;
		}
	



}

Measured memory_bytes: 1168
# In[1]:


N=int(input())
s=[]
for _ in range(N):
    s.append(input())


# In[2]:


def countAB(string):
    cnt=0
    for i in range(len(string)-1):
        if string[i]+string[i+1]=="AB":
            cnt+=1
    return cnt


# In[3]:


def endA(string):
    if string[-1]=="A" and string[0]!="B":
        return 1
    else: return 0
def initB(string):
    if string[0]=="B" and string[-1]!="A":
        return 1
    else: return 0
def endAinitB(string):
    if string[0]=="B" and string[-1]=="A":
        return 1
    else: return 0


# In[4]:


simple_AB=0
Aend=0
Binit=0
eAiB=0
for s_tmp in s:
    simple_AB+=countAB(s_tmp)
    Aend+=endA(s_tmp)
    Binit+=initB(s_tmp)
    eAiB+=endAinitB(s_tmp)
if Aend+Binit>0:
    print(simple_AB+min(Aend, Binit)+eAiB)
elif Aend+Binit==0 and eAiB>0:
    print(simple_AB+eAiB-1)
else: print(simple_AB)

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

int main () {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> L(N);
  for (int i = 0; i < N; i++) {
    string S;
    int P;
    cin >> S >> P;
    L.at(i) = make_tuple(S, - P, i);
  }
  sort(L.begin(), L.end());
  for (tuple<string, int, int> t : L) {
    string x;
    int y, z;
    tie(x, y, z) = t;
    cout << z + 1 << endl;
  }
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
#include <chrono>
#include<unordered_map>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef tuple<int, int, int> TIII;
typedef vector<int> VI;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

void fast_io() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MN = 1e9;

int main()
{
    fast_io();

    map<PII, int> M;

    int N;
    scanf("%d", &N);
    REP(i, N)
    {
        double A;
        scanf("%lf", &A);
        LL llA = llround(A * MN);

        // wylicz ile zawieraja 2 i 5
        int x = 0, y = 0;
        while (llA % 2 == 0)
        {
            x++;
            llA /= 2;
        }
        while (llA % 5 == 0)
        {
            y++;
            llA /= 5;
        }

        x = min(x, 18), y = min(y, 18);
        M[MP(x, y)]++;
    }

    LL res = 0;
    // zobacz ile jest par, ktore maja sume x >= 0 i sume y >= 0
    for (const auto &p : M)
    {
        if (p.first.first >= 9 && p.first.second >= 9)
            res += p.second*(LL)(p.second - 1) / 2;

        auto it = M.find(p.first); it++;
        while (it != M.end())
        {
            if (p.first.first + it->first.first >= 18 && p.first.second + it->first.second >= 18)
                res += p.second*(LL)it->second;

            it++;
        }
    }

    printf("%lld\n", res);

    return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

Measured memory_bytes: 3212
#include <iostream>
#include<string>
using namespace std;
int main(void){
    // Your code here!
    int ans=0;
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++){
        if(a[i]=='o'){
            ans=ans+100;
        }
    }
    cout<<ans+700<<endl;
}

Measured memory_bytes: 256
use proconio::input;

// 最大公約数を求める
fn gcd(a: usize, b: usize) -> usize {
	if b == 0 {
		a
	} else {
		gcd(b, a % b)
	}
}

fn main() {
	input! {
		n: usize,
		a: [usize; n],
	}

	const MAX: usize = 1000001;

	// min_prime_factor[n] = nの最小の素因数
	let mut min_prime_factor = vec![0; MAX+1];
	min_prime_factor[1] = 1;

	// エラトステネスの篩の変形
	let mut i = 2;
	while i < MAX {
		// iが合成数でなければ
		if min_prime_factor[i] == 0 {
			// min_prime_factor[iの倍数] = i
			let mut j = i;
			while j < MAX {
				// まだ素因数がなければiをセット
				if min_prime_factor[j] == 0 {
					min_prime_factor[j] = i;
				}
				j += i;
			}
		}

		i += 1;
	}

	// 素因数が既出か
	let mut prime_factor_set = vec![false; MAX+1];

	// 素因数分解してひとつも共通する素因数がなければpairwise coprime
	let mut pairwise_coprime = true;
	'outer: for &(mut n) in &a {

		// nを素因数分解
		let mut prime_factors: Vec<usize> = Vec::new();
		while n > 1 {
			let f = min_prime_factor[n];
			prime_factors.push(f);
			n /= f;

			// 素因数が既出だったら
			if prime_factor_set[f] {
				pairwise_coprime = false;
				break 'outer;
			}
		}

		for f in prime_factors {
			prime_factor_set[f] = true;
		}
	}

	if pairwise_coprime {
		println!("pairwise coprime");
		return;
	}

	// 全てのgcdが1になったらsetwise coprime
	let mut gcd_all = 0; // gcdの単位元
	for &x in &a {
		gcd_all = gcd(x, gcd_all);
	}

	if gcd_all == 1 {
		println!("setwise coprime");
	} else {
		println!("not coprime");
	}
}

Measured memory_bytes: 25500
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  double n,m;
  if(a%2==0){
    b=a/2;
  }
  else{
    b=a/2+1;
  }
  n=a,m=b;
  printf("%lf\n",m/n);
}

Measured memory_bytes: 764
def get_ans(ans_init, sum_init, A):
    ans = ans_init
    sum = sum_init
    for i in range(1, len(A)):
        a = A[i]
        prev_sum = sum
        sum += a
        if sum * prev_sum >= 0:
            ans += abs(prev_sum+a)+1
            if prev_sum > 0:
                sum = -1
            else:
                sum = 1
    return ans


n = int(input())
A = list(map(int, input().split()))

ans_1 = 0
sum_1 = A[0]
if A[0] <= 0:
    ans_1 += abs(A[0])+1
    sum_1 = 1

ans_1 = get_ans(ans_1, sum_1, A)

ans_2 = 0
sum_2 = A[0]
if A[0] >= 0:
    ans_2 += abs(A[0])+1
    sum_2 = -1

ans_2 = get_ans(ans_2, sum_2, A)

print(min(ans_1, ans_2))


Measured memory_bytes: 14468
#include <iostream>
#include <algorithm>
#include<functional>
#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#include<vector>
#include<cmath>
using namespace std;
int a[1000000];
int b[1000000];
int main() {
	int max = 0;
	int max2 = 0;
	int N;
	cin >> N;
	int a[200020];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N; i++) {
		if (a[i] > max) {
			max = a[i];
		}
		else if (a[i] > max2) {
			max2 = a[i];
		}
	}
	for (int i = 0; i < N; i++) {
		if (a[i] == max) {
			cout << max2 << endl;
		}
		else {
			cout << max << endl;
		}
	}
}


Measured memory_bytes: 2432
import java.util.ArrayList;
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		ArrayList<String> result = new ArrayList<String>();
		Scanner insert = new Scanner(System.in);
		outside:while(true) {
			String line = insert.nextLine();
			if(line.equals(".")) {
				break outside;
			}
			int beginindex = 0;
			int endindex = 0;
			ArrayList<String> input1 = new ArrayList<String>();
			while(true) {
				endindex = line.indexOf("\"", beginindex);
				if(endindex==-1) {
					input1.add(line.substring(beginindex));
					break;
				}
				input1.add(line.substring(beginindex, endindex));
				beginindex = endindex + 1;
			}
			String line2 = insert.nextLine();
			beginindex = 0;
			endindex = 0;
			ArrayList<String> input2 = new ArrayList<String>();
			while(true) {
				endindex = line2.indexOf("\"", beginindex);
				if(endindex==-1) {
					input2.add(line2.substring(beginindex));
					break;
				}
				input2.add(line2.substring(beginindex, endindex));
				beginindex = endindex + 1;
			}
//			for(int i = 0; i < input1.size(); i ++) {
//				if((i % 2) ==0) {
//					System.out.println(input1.get(i));
//				}
//			}
//			for(int i = 0; i < input2.size(); i ++) {
//				if((i % 2) ==0) {
//					System.out.println(input2.get(i));
//				}
//			}
			if(line.equals(line2)) {
				result.add("IDENTICAL");
			}
			else {
				boolean t = true;
				if(input1.size() != input2.size()) {
					result.add("DIFFERENT");
				}
				else {
					int n = 0;
					outside2:for(int i = 0; i < input1.size(); i ++) {
						if((i % 2) ==0) {
							if(!input1.get(i).equals(input2.get(i))) {
								result.add("DIFFERENT");
								t = false;
								break outside2;
							}
						}
						else {
							if(!input1.get(i).equals(input2.get(i))) {
								n++;
								if(n > 1) {
									result.add("DIFFERENT");
									t = false;
									break outside2;
								}
							}
						}
					}
					if(t) {
						if(n==1) {
							result.add("CLOSE");
						}
						else {
							result.add("DIFFERENT");
						}
					}
				}
			}

		}
		for(int i = 0;i < (result.size());i++) {
			System.out.println(result.get(i));
		}
	}
}


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

int main(){
	int N;
	cin >> N;
	vector<vector<pair<int,bool>>> A(N);
	for(int i=0;i<N;i++){
		int a;
		cin >> a;
		for(int j=0;j<a;j++){
			int x,y;
			cin >> x >> y;
			x--;
			A[i].push_back(make_pair(x,(y==1)));
		}
	}
	
	int ans=0;
	
	int S=pow(2,N);
	
	for(int k=0;k<S;k++){
		vector<bool> p(N);
		int tmp=k;
		int c=0;
		for(int i=0;i<N;i++){
			p[i]=tmp%2;
			tmp/=2;
			if(p[i])c++;
		}
		bool flag=true;
		for(int i=0;i<N;i++){
			if(p[i]){
				for(auto xy:A[i]){
					if(p[xy.first]^xy.second)flag=false;
				}
			}
		}
		if(flag){
			ans=max(ans,c);
			//cout << k << endl;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		for(;;){		
			int a = scanner.nextInt();
			String op = scanner.next();
			int b = scanner.nextInt();
			
			if ( op.equals("+")){
				 System.out.println(a+b);
			} 
			else if ( op.equals("-")){
				 System.out.println(a-b);
		    } 
		    else if ( op.equals("*")){
				 System.out.println(a*b);
		    } 
			else if ( op.equals("/")){
				 System.out.println(a/b);
		    } 
   		    else {
				break;
			}	
	    }
	}
}

Measured memory_bytes: 26048
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

int H, W, N, sx, sy;
string S, T;

bool solve() {
    // LR
    int left = 1;
    int right = W;
    REV(i, N - 1, 0) {
        if (T[i] == 'L') {
            right = min(right + 1, W);
        } else if (T[i] == 'R') {
            left = max(left - 1, 1LL);
        }
        if (S[i] == 'L') {
            left++;
        } else if (S[i] == 'R') {
            right--;
        }
        if (left > right) return false;
    }
    if (sy < left || right < sy) return false;

    left = 1;
    right = H;
    REV(i, N - 1, 0) {
        if (T[i] == 'U') {
            right = min(right + 1, H);
        } else if (T[i] == 'D') {
            left = max(left - 1, 1LL);
        }
        if (S[i] == 'U') {
            left++;
        } else if (S[i] == 'D') {
            right--;
        }
        if (left > right) return false;
    }
    if (sx < left || right < sx) return false;

    return true;
}

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

    cin >> H >> W >> N >> sx >> sy;
    cin >> S >> T;

    cout << (solve() ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 1020
def Roll(c, lst) :
    if c == 'N' :
        lst[0], lst[1], lst[5], lst[4] = lst[1], lst[5], lst[4], lst[0]
    elif c == 'S' :
        lst[0], lst[1], lst[5], lst[4] = lst[4], lst[0], lst[1], lst[5]
    elif c == 'E' :
        lst[0], lst[2], lst[5], lst[3] = lst[3], lst[0], lst[2], lst[5]
    elif c == 'W' :
        lst[0], lst[2], lst[5], lst[3] = lst[2], lst[5], lst[3], lst[0]
    return lst
    
import copy
dice_A = list(map(int, input().split()))
dice_B = list(map(int, input().split()))

for i in range(4) :
    if dice_B[1] == dice_A[1] :
        break
    else :
        Roll('S', dice_B)
if dice_B[1] != dice_A[1] :
    Roll('E', dice_B)
    for i in range(4) :
        if dice_B[1] == dice_A[1] :
            break
        else :
            Roll('S', dice_B)
for i in range(4) :
    if dice_B[0] == dice_A[0] :
        break
    else :
        Roll('E', dice_B)

if dice_B[2] == dice_A[2] and dice_B[3] == dice_A[3] and dice_B[4] == dice_A[4] and dice_B[5] == dice_A[5] :
    print("Yes")
else :
    print("No")


Measured memory_bytes: 6344
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll h,w,k,q,q1;
char a[100][100];
//<<-----Implement Functions Here---->>//
string decToBinary(ll n) 
{
    string s;
    while(n>0){
  		if(n&1)s+='1';else s+='0';
  		n/=2;
 	}
 	ll len = s.size();
 	while(len<q1){s+='0';len++;}reverse(all(s));
 	return s;
} 

//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>h>>w>>k;ll ans = 0;
		for(ll i=0;i<h;i++)
		{
			for(ll j=0;j<w;j++)cin>>a[i][j];
		}
		q = pow(2,h+w);q1 = h+w;
		for(ll i=0;i<q;i++)
		{
			set<ll> v1,v2;
			string s = decToBinary(i);
			for(ll j=0;j<h;j++)if(s[j]=='1')v1.insert(j);
			for(ll j=h;j<h+w;j++)if(s[j]=='1')v2.insert(j-h);
			ll count1 = 0;
			for(ll k=0;k<h;k++)
			{
				for(ll j=0;j<w;j++)
				{
					ll f1 = 0,f2 = 0;
					if(v1.find(k)!=v1.end())f1 = 1;
					if(v2.find(j)!=v2.end())f2 = 1;
					if(a[k][j]=='#'){
						if(f1==0&&f2==0)count1++;
					}
				}
			}
			if(count1==k)ans++;

		}
		cout<<ans<<endl;


}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 6420
#include<bits/stdc++.h>
#include<cstdio>
int ara[300000];
using namespace std;
int main()
{
     int n,c=0,t=1,i;
    //vector<long long int>v;
    cin>>n;

    for(i=0;i<n;i++)
    {
        cin>>ara[i];
    }
    i=0;
   while(i<n)
   {
       if(ara[i]==t)
       {
           i++;
           t++;
           c++;
       }
       else
       {
           i++;
       }
   }
  if(c==0)
  {
      cout<<"-1"<<endl;
  }
  else
    cout<<n-c<<endl;
        return 0;
}



Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
  int n;
  int a[101];
  cin >> n;
  cin >> a[0];
  int max=a[0];
  int min=a[0];
  
  for(int i=1;i<n;i++){
    cin >> a[i];
    if(a[i]>=max)max=a[i];
    if(a[i]<=min)min=a[i];
  }
  
  cout << max-min;
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = 26;
long long pm[20] = {};
void init() {
    pm[0] = 1;
    for (int i = 1; i <= 13; i++)
        pm[i] = pm[i - 1] * mod;
    for (int i = 1; i <= 13; i++)
        pm[i] += pm[i - 1];
}
int main() {
    long long x;
    init();
    while (cin >> x) {
        string str;
        for (int i = 1; i <= 13; i++)
            if (pm[i - 1] <= x && x < pm[i]) {
                x -= pm[i - 1];
                int t = i;
                while (t--) {
                    str.push_back(x % mod + 'a');
                    x /= mod;
                }
            }
        reverse(str.begin(), str.end());
        cout << str << '\n';
    }
}

Measured memory_bytes: 3624
#include<stdio.h>

int main()
{
	int n;
	scanf("%d", &n);
	int zero = 0;
	long long a[n];
	
		int over = 0;
	for (int i = 0; i < n; i++)
	{
		scanf("%lld", &a[i]);
		if (a[i] == 0) zero = 1;
		if (a[i] > 1000000000000000000) over = 1;
	}
	if (zero) printf("0\n");
	else 
	{
		long long result = 1;
		for(int i = 0; i < n; i++)
		{
			if(a[i] > 1000000000000000000 / result)
			{
				printf("-1\n");
				return 0;
			}
			result *= a[i];
		}
		if (over) printf("-1\n");
		else printf("%lld\n", result);
	}
	return 0;
}

Measured memory_bytes: 2456
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  
  ll n;
  cin >>n;
  if(n%2 == 1){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  for(ll divisor = 5; divisor <= n; divisor *= 5){
    ans += n/(divisor*2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import collections

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = dict(collections.Counter(A))
A = sorted(A.items(), key=lambda x: x[1], reverse=True)

cnt = 0

for i in range(N):
    if len(A) > K:
        cnt += A[-1][1]
        A.pop()
    else:
        break

print(cnt)


Measured memory_bytes: 41428
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,n;
  cin>>a>>b>>n;
  if(n<b)
  {
    cout<<(a*n)/b<<endl;
  }
  else 
  {
    ll d=n/b;
    d*=b;
    d--;
    cout<<(d*a)/b-(a*(d/b))<<endl;
    
  }
  return 0;
}

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

const int maxn = 1e5 + 5;
int h[maxn];
int dp[maxn];

int main() {
    int n, k; scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) scanf("%d", &h[i]);
    for (int i = 0; i < n; ++i) dp[i] = 2e9;
    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        for (int j = 1; j <= k; ++j) {
            if (i - j >= 0) dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]));
            else break;
        }
    }
    printf("%d\n", dp[n - 1]);
}


Measured memory_bytes: 1024
x, y = (int(i) for i in input().split())
point=0
if x==1:
    point+=300000
elif x==2:
    point+=200000
elif x==3:
    point+=100000

if y==1:
    point+=300000
elif y==2:
    point+=200000
elif y==3:
    point+=100000

if x==1 and y==1:
    point+=400000

print(point)

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string S;
    cin >> S;
    iter(c, S) cout << 'x';
    cout << endl;
    return 0;
}


Measured memory_bytes: 3592
# 柱の高さ（aメートル,bメートル,cメートル）を整数で入力
a,b,c = map(int,input().split())
# b-aとc-bが同じなら美しい（YES）、そうでなければNO
if  b - a == c - b:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit; //単位元 a * e = a
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }

  void init(int n_, Fn func_, T unit_)
  {
    func = func_, unit = unit_;
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }

  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]); //
    }
  }

  T query(int a, int b, int k = 0, int l = 0, int r = -1)
  {
    if (r < 0)
      r = N;
    if (r <= a || b <= l)
      return unit;
    if (a <= l && r <= b)
      return dat[k];
    else
    {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return func(vl, vr);
    }
  }
};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  auto my_max = [](ll a, ll b) { return max(a, b); };
  int n;
  cin >> n;
  SegmentTree<int> sg[26];
  rep(i, 26) sg[i].init(n, my_max, 0);
  string s;
  cin >> s;
  rep(i, s.length()) sg[s[i] - 'a'].update(i, 1);
  int q;
  cin >> q;
  rep(qi, q)
  {
    int type;
    cin >> type;
    if (type == 1)
    {
      int i;
      char c;
      cin >> i >> c;
      i--;
      rep(j, 26) sg[j].update(i, 0);
      sg[c - 'a'].update(i, 1);
    }
    else
    {
      int l, r;
      cin >> l >> r;
      l--, r--;
      int ans = 0;
      rep(i, 26) ans += sg[i].query(l, r + 1);
      cout << ans << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 107796
const w = ['SUN','MON','TUE','WED','THU','FRI','SAT'];
function main(input: string[]): void {
    console.log(7 - w.indexOf(input.shift()))
}

import { readFileSync } from 'fs';
if (process.argv[1] == __filename) {
    const path = process.argv[2] || '/dev/stdin';
    const input = readFileSync(path, 'utf-8');
    main(input.split(/\s+/));
}

Measured memory_bytes: 7372
<?php

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%d %d %d %d", $Q, $H, $S, $D);
fscanf(STDIN, "%d", $N);

$lit1 = min($Q * 4, $H * 2, $S);

if ($lit1 < $D / 2) {
    // $lit1ベースで買った方が安い
    ans($N * $lit1);
} else {
    if ($N % 2 == 0) {
        ans($N / 2 * $D);
    } else {
        ans(($N - 1) / 2 * $D + $lit1);
        // exit("$N $D $lit1\n");
    }
}

function ans($ans) {
    printf("%d\n", $ans);
}

Measured memory_bytes: 5112
#include<stdio.h>
int main(void){
    int w,a,b,temp;
    scanf("%d %d %d",&w,&a,&b);
    if(a>b){
        temp=a;
        a=b;
        b=temp;
    }else if(a==b){
        printf("0\n");
        return 0;
    }
    if(a+w>b){
        printf("0\n");
    }else{
        printf("%d\n",b-(a+w));
    }
    return 0;
}



Measured memory_bytes: 128
N = int(input())
M = list(map(int, input().split()))
Y = list(map(int, input().split()))
mtotal = sum(M)


for idx in range(len(Y)):
  if Y[idx] >= M[idx]:
    Y[idx] -= M[idx]
    M[idx] = 0
    M[idx+1] = max(M[idx+1] - Y[idx], 0)
  else:
    M[idx] -= Y[idx]
    Y[idx] = 0
    
  #print(M)
  #print(Y)

print(mtotal - sum(M))

Measured memory_bytes: 18624
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

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

const double INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

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


int main() {
	ll i, j;
	ll N, D;
	cin >> N >> D;
	vector<vector<double>> X;
	for (i = 0; i < N; i++) {
		vector<double> x;
		for (j = 0; j < D; j++) {
			double xj;
			cin >> xj;
			x.push_back(xj);
		}
		X.push_back(x);
	}

	ll ans = 0;
	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			double d = 0;
			for (ll k = 0; k < D; k++) {
				double dabs = fabs(X[i][k] - X[j][k]);
				d += pow(dabs, (int)2);
			}
			d = sqrt(d);
			double e;
			if (modf(d, &e) < 1e-5) {
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}


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

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

using ll = long long;
ll INF = 1LL << 60;
 
using vc = vector<char>;
using vi = vector<int>;
using pii = pair<int, int>;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N; cin >> N;
    vector<pii> arr (N);
    F0R(i, N) {int a, b; cin >> a >> b; arr[i] = {a, b};}

    ll ans = 0;
    ll small = INF;
    for (auto pr : arr) {
        ans += pr.first;
        if (pr.first > pr.second) small = min(small, (ll) pr.second);
    }

    bool valdiff = false;
    for (auto pr : arr) valdiff |= (pr.first != pr.second);
    cout << ((valdiff) ? ans - small: 0) << endl;
}

Measured memory_bytes: 384
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,K = MI()
A = LI()

from itertools import accumulate

for _ in range(min(K,41)):
    B = [0]*(N+1)
    for i in range(N):
        a = A[i]
        B[max(i-a,0)] += 1
        B[min(N,i+a+1)] -= 1
    C = list(accumulate(B))
    A = C

print(*[A[i] for i in range(N)])


Measured memory_bytes: 208868
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int INF = 987654321;
const int MOD = 1000000007;

int main(){
  int H,W,h,w;
  scanf("%d %d %d %d",&H,&W,&h,&w);
  printf("%d\n",(H-h)*(W-w));
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	int a[100000];
	int b[100000];
	int c, d;
	int k;
	int n, m;
	int s, t;
	int x, y, z;
	int ans;


	scanf("%d %d %d %d", &n,&m,&s,&t);

	if (n < s)x = s;
	else x = n;

	if (m < t)y = m;
	else y = t;
	if(y-x>0)printf("%d\n",y-x);
	else printf("0\n");

	return 0;
}



Measured memory_bytes: 128