akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

void push_d(queue<vector<int> > &q, int x, int y, int l) {
    vector<int> d;
    d.push_back(x);
    d.push_back(y);
    d.push_back(l);
    q.push(d);
}

int main() {
    while (1) {
        int w, h;
        cin >> w >> h;
        if (w == 0 && h == 0) break;

        vector<vector<bool> > bw, bh;
        bool c;
        for (int i = 0; i < h; i++) {
            vector<bool> _bh;
            bh.push_back(_bh);
            for (int x = 0; x < w - 1; x++) {
                cin >> c;
                bh[i].push_back(c);
            }
            if (i < h - 1) {
                vector<bool> _bw;
                bw.push_back(_bw);
                for (int y = 0; y < w; y++) {
                    cin >> c;
                    bw[i].push_back(c);
                }
            }
        }

        queue<vector<int> > q;
        vector<int> goal;
        push_d(q, 0, 0, 0);
        while (!q.empty()) {
            vector<int> d = q.front();
            q.pop();
            int x = d[0], y = d[1], l = d[2] + 1;
            if (x == w - 1 && y == h - 1) {
                goal.push_back(l);
                continue;
            }
            if (0 <= x && x < w && 0 <= y && y < h) {
                // down
                if (y < h-1 && !bw[y][x]) {
                    bw[y][x] = true;
                    push_d(q, x, y+1, l);
                }
                // up
                if (0 <= y-1 && y-1 < h-1 && !bw[y-1][x]) {
                    bw[y-1][x] = true;
                    push_d(q, x, y-1, l);
                }
                // right
                if (x < w-1 && !bh[y][x]) {
                    bh[y][x] = true;
                    push_d(q, x+1, y, l);
                }
                // left
                if (0 <= x-1 && x-1 < w-1 && !bh[y][x-1]) {
                    bh[y][x-1] = true;
                    push_d(q, x-1, y, l);
                }
            }
        }

        int route = 0;
        if (goal.size() > 0) {
            route = *min_element(goal.begin(), goal.end());
        }
        cout << route << endl;
    }
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;



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

      int n,m,x; cin >> n >> m >> x;

      vector<pair<int,vector<int>>> b(n);
      rep(i,n){
          cin >> b[i].F;
          b[i].S.resize(m);
          rep(j,m) cin >> b[i].S.at(j);
      }

      ll ans = 1000000000;
      for(int bit = 0; bit <(1<<n); ++bit){
          vector<int> S;
          for (int i = 0; i < n; ++i) {
              if (bit & (1<<i)) { // i が bit に入るかどうか
                  S.push_back(i);
              }
          }
          vector<int> cnt(m);
          ll money = 0;
          for (int i = 0; i < (int)S.size(); ++i) {
             rep(j,m){
                 cnt[j] += b[S[i]].S[j];
             }
             money += b[S[i]].F;
          }
          bool flag = false;
          rep(k,m){
              if(cnt[k]<x){
                  flag = true;
                  break;
              }
          }
          if(flag == false){
              ans = min(ans,money);
          }
      }
      if(ans==1000000000) cout << -1 << endl;
      else cout << ans << endl;

      return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int n = t.size();
  s.append(s);
  int c = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    c = 0;
    for (int j = 0; j < n; j++) {
      if (t[j] == s[i + j]) {
        c++;
      }
    }
    if (c == n) {
      ans = 1;
      break;
    }
  }
  if (ans == 1) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 256
x,y,z,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
b=sorted(list(map(int,input().split())),reverse=True)
c=sorted(list(map(int,input().split())),reverse=True)

ab=[i+j for j in b for i in a]
ab.sort(reverse=True)
abc=[i+j for j in c[:k] for i in ab[:k]]
abc.sort(reverse=True)

print(*abc[:k],sep='\n')


Measured memory_bytes: 207944
A,B,C,D = [int(v) for v in input().split()]

t_flag = True

while True:
    if A <= 0:
        t_flag = False
        break

    C -= B

    if C <= 0:
        t_flag = True
        break

    A -= D

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


Measured memory_bytes: 9172
from sys import stdin
rs = stdin.readline
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    s = rs()
    ans = 3 if "RRR" in s else 2 if "RR" in s else 1 if "R" in s else 0
    print(ans)

if __name__ == '__main__':
    main()


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

using namespace std;



int main(){
  int a[3], A=0;

  cin >> a[0] >> a[1] >> a[2];

  for (size_t i = 0; i < 3; i++) {
    A += a[i];
  }

  if (A >= 22) {
    cout << "bust" << endl;
  }else if(A <= 21){
    cout << "win" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define ll long long
ll n,x;
ll gcd(ll a,ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
int main(){
	scanf("%lld%lld",&n,&x);
	printf("%lld",3*(n-gcd(n,x)));
}

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}
int main() {
ll a, b;
while(cin >> a >> b)
cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
}

Measured memory_bytes: 3076
#include <stdio.h>
#include <stdlib.h>
#pragma GCC optimize ("O3")

inline static int gl(void){
    int x = 0;
    for(;;){
        unsigned int c = getchar_unlocked() - 48;
        if(c < 10){
            x = x*10 + c;
        }else{
            break;
        }
    }
    return x;
}

inline static void pl(unsigned int s){
    char str[9];
    int pos=9;
    if(s==0){
        putchar_unlocked('0');
        return;
    }
    do{
        pos--;
        str[pos]=s%10+48;
        s/=10;
    }while(s!=0);
    for(; pos<9; pos++){
        putchar_unlocked(str[pos]);
    }
}

inline static int sp(char* str, unsigned short i){
    if(i>99){
        char c0 = i%10; i/=10;
        char c1 = i%10; i/=10;
        str[0] = i+48;
        str[1] = c1+48;
        str[2] = c0+48;
        return 3;
    }else if(i>9){
        char c0 = i%10; i/=10;
        str[0] = i+48;
        str[1] = c0+48;
        return 2;
    }else{
        str[0] = i+48;
        return 1;
    }
}

char a[1001];
char buffer[8*1024*1024];

int main(void){
    const int h=gl(), w=gl();
    int p = 0;
    int pos=0;
    {
        char haveCoin = 0;
        short old_y, old_x;
        for(int i=1; i<=h; i++){
            /*
            for(int j=1; j<=w; j++){
                int t = getchar_unlocked() - 48;
                getchar_unlocked();
                a[j] = t;
            }
            */
            fgets(a, 1001, stdin);
            if(i%2==1){
                for(int j=1; j<=w; j++){
                    if(haveCoin){
                        pos++;
                        p += sp(buffer+p, old_y)+1; buffer[p-1] = ' '; 
                        p += sp(buffer+p, old_x)+1; buffer[p-1] = ' '; 
                        p += sp(buffer+p, i)+1; buffer[p-1] = ' '; 
                        p += sp(buffer+p, j)+1; buffer[p-1] = '\n';
                    }
                    haveCoin ^= a[(j-1)*2]&1;
                    old_y = i;
                    old_x = j;
                }
            }else{
                for(int j=w; j>0; j--){
                    if(haveCoin){
                        pos++;
                        p += sp(buffer+p, old_y)+1; buffer[p-1] = ' '; 
                        p += sp(buffer+p, old_x)+1; buffer[p-1] = ' '; 
                        p += sp(buffer+p, i)+1; buffer[p-1] = ' '; 
                        p += sp(buffer+p, j)+1; buffer[p-1] = '\n';
                    }
                    haveCoin ^= a[(j-1)*2]&1;
                    old_y = i;
                    old_x = j;
                }
            }
        }
    }
    pl(pos); putchar_unlocked('\n');
    fwrite(buffer, p, 1, stdout);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A;
  int ans=0;
  for(int i=0;i<N+10;i++){
    A=(i*1.08)/1;
    if(A==N){
      cout<<i<<endl;
      ans*=0;
      break;
    }
    else{
      ans++;
    }
  }
  if(ans>0){
    cout<<":("<<endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
#include<string.h>
using namespace std;

typedef long long int64;
typedef int int32;
typedef char int8;

#define rep(i,j) for(int i=0;i<j;i++)
#define repeat(i,j,k) for(int i=(j),i<(k);i++)
#define repeat_eq(i,j,k) for(int i=(j),i<=(k);i++)
#define rev_rep(i,j,k) for(int i=(j)-1;i>=k;i--)
#define all(v) (v).begin(),(v).end()

const int INF=1<<30;//=10E10

void mycopy(int *out,int *in,int num){
  copy(in,in+num,out);
}

int main()
{
  while(true){
    int n,r;cin>>n>>r;
    if(!n && !r)break;
    int card[2][51];
    rep(i,n)card[0][i]=n-i;//初期化
    rep(i,r){
      int p,c;cin>>p>>c;
      
      mycopy(card[1],card[0]+p-1,c);
      mycopy(card[1]+c,card[0],p-1);
      mycopy(card[0],card[1],p+c-1);
      
    }
    cout<<card[0][0]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1184
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <climits>

const int maxN = (int)2e3 + 10;
int N, K, Q, A[maxN];

void input()
{
    scanf("%d%d%d", &N, &K, &Q);
    for (int i = 1; i <= N; i++)
        scanf("%d", A + i);
}

int bit[maxN];
inline int lowbit(int x) { return x & -x; }
void initBit() { memset(bit, 0, sizeof(bit)); }
inline void add(int pos, int val = 1)
{
    for (; pos <= N; pos += lowbit(pos))
        bit[pos] += val;
}
inline int queryPref(int pos)
{
    int ans = 0;
    for (; pos > 0; pos -= lowbit(pos))
        ans += bit[pos];
    return ans;
}
inline int queryRange(int l, int r) {
    return queryPref(r) - queryPref(l - 1);
}

struct Node { int val, pos; }node[maxN];
void initNode() {
    for (int i = 1; i <= N; i++)
        node[i] = {A[i], i};
    std::sort(node + 1, node + N + 1, [] (Node x, Node y) -> bool {
        return x.val < y.val;
    });
}

int leftMost[maxN], rightMost[maxN];
bool ban[maxN];

int solve()
{
    initNode();
    rightMost[N + 1] = N + 1;
    int ans = node[Q].val - node[1].val;

    for (int t = 1; t + Q <= N; t++) //ban first t vals
    {
        memset(ban, 0, sizeof(ban));
        for (int i = 1; i <= t; i++)
            ban[node[i].pos] = true;

        for (int i = 1; i <= N; i++)
            leftMost[i] = (ban[i] ? i : leftMost[i - 1]);
        for (int i = N; i >= 1; i--)
            rightMost[i] = ban[i] ? i : rightMost[i + 1];

        initBit();
        for (int i = 1; i <= N; i++)
            if (!ban[i])
                add(i, 1);

        int curMin = INT_MAX, curMax = 0;
        int curCnt = 0;

        for (int i = t + 1; i <= N && curCnt < Q; i++) //i-th val
        {
            int cv = node[i].val, cp = node[i].pos;
            int qn = queryRange(leftMost[cp] + 1, rightMost[cp] - 1);
            if (qn >= K) //enough for length K
            {
                curMin = std::min(curMin, cv);
                curMax = std::max(curMax, cv);
                curCnt += 1;
                add(cp, -1); //remove
            }
        }
        if (curCnt == Q)
            ans = std::min(ans, curMax - curMin);
    }

    return ans;
}

int main()
{
    input();
    printf("%d\n", solve());
    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define SIZEOF(x) sizeof(x)/sizeof(x[0])
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


template <class T>
T max(T *a , LL n){
    T maxi = a[0];
    for(LL i = 0; i < n; ++i){
        if(a[i] > maxi)maxi = a[i];
    }
    return maxi;
}
template <class T>
T min(T *a , LL n){
    T mini = a[0];
    for(LL i = 0; i < n; ++i){
        if(a[i] < mini)mini = a[i];
    }
    return mini;
}
template <class T>
T sum(T *a , LL n){
    T s=0;
    for(LL i = 0; i < n; ++i){
       s+=a[i]; 
    }
    return s;
}

#define MAX(x) max(x,SIZEOF(x))
#define MIN(x) min(x,SIZEOF(x))
#define SUM(x) sum(x,SIZEOF(x))





int main(){
    LL n , d;
    cin >> n >> d;
    LL x = 0;
    while(true){
        if(n <= x*(2*d+1)){
            cout<<x;
            break;
        }else x+=1;
    }



    return 0;

}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod =1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return res;
}
ll inv(ll x){
    return power(x,mod-2);
}
ll gcd(ll a,ll b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll a[222222],b[222222];
ll n,k;
ll sea(ll l,ll r){
    if(l==r)return l;
    ll mid=(l+r)/2;
    ll sum=0;
   // cout<<n<<endl;
    for(int i=0;i<n;i++){
        //cout<<":"<<a[i]<<" "<<b[n-i-1]<<endl;
        if(a[i]*b[n-i-1]>mid){
            sum+=a[i]-mid/b[n-i-1];
        }
    }
   // cout<<l<<" "<<r<<" "<<sum<<endl;
    if(sum>k){
        return sea(mid+1,r);
    }
    else{
        return sea(l,mid);
    }
}
int main(){
    ios::sync_with_stdio(0);cin.tie();cout.tie();
    ll i,sum=0,ss=0;
    cin>>n>>k;
    for(i=0;i<n;i++)cin>>a[i],sum+=a[i];

    for(i=0;i<n;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    for(i=0;i<n;i++)ss=max(ss,a[i]*b[n-1-i]);
    if(k>=sum){
        cout<<0;
        return 0;
    }
    ll res=sea(0,ss);
    cout<<res;
}


Measured memory_bytes: 3328
a,b,c,d = map(int, input().split())
cnta = 0
cntc = 0
while a > 0:
    a -= d
    cnta += 1

while c > 0:
    c -= b
    cntc += 1

# print(cnta, cntc)

if cnta >= cntc:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 9100
def INT_(n): return int(n)-1
def MI(): return map(int, input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_, input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n: int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split())) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')


def main():
    N = I()
    ps = LI()
    cnt = 0
    for i, p in enumerate(ps):
        if i+1 != p:
            cnt += 1

    if cnt <= 2:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            if(a*b%2==0) Console.WriteLine("Even");
            else Console.WriteLine("Odd");
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
    int N;
    cin >> N;
    cout << N/3 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdin =new Scanner(System.in);
		int n=stdin.nextInt();
		int d=stdin.nextInt();
		int x=stdin.nextInt();
		int a[]=new int[n];
		int i,j;
		int sum=0;
		for(i=0;i<n;i++)
			a[i]=stdin.nextInt();

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

Measured memory_bytes: 22100
#include <iostream>
#include <string>
#include <map>
#include <vector>
#define rep(i, n) for(int i=0 ; i<n; ++i)
using namespace std;

int main(){
    string w;
    cin >> w;
    map<char,long> count;
    rep(i, w.size()){
        count[w[i]] = 0;
    }
    rep(i, w.size()){
        count[w[i]] += 1;
    }
    int flag = 0;
    for(auto itr=count.begin(); itr != count.end(); ++itr){
        if(itr->second%2!=0)flag=1;
    }
    if(flag==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;
class Main {
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) {
        FastReader ob = new FastReader();
        int x = ob.nextInt(),y=ob.nextInt(),z=ob.nextInt();
        System.out.println(z+" "+x+" "+y);


    }
}

Measured memory_bytes: 21328
fn main() {
    let (lake, house, positions) = input();
    println!("{}", solve(lake, house, positions));
}

fn input() -> (usize, usize, Vec<usize>) {
    let mut input1 = String::from("");
    let mut input2 = String::from("");

    std::io::stdin().read_line(&mut input1).unwrap();
    std::io::stdin().read_line(&mut input2).unwrap();

    input1.pop();
    input2.pop();

    let mut iter1 = input1.split_whitespace();
    let mut iter2 = input2.split_whitespace();

    let lake: usize = iter1.next().unwrap().parse().unwrap();
    let house: usize = iter1.next().unwrap().parse().unwrap();

    let positions: Vec<usize> = iter2.map(|i| i.parse().unwrap()).collect();

    (lake, house, positions)
}

fn solve(lake: usize, house: usize, positions: Vec<usize>) -> usize {
    let mut dis = vec![0usize; house];
    for i in 0..house-1 {
        dis[i] = positions[i+1] - positions[i];
    }
    dis[house-1] = positions[0] + (lake - positions[house-1]);
    let sum: usize = dis.iter().sum();
    let max = dis.iter().max().unwrap();
    sum - max
}

Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    ll n;
    cin>>n;

    ll ans=0;
    for(ll i=1;i<=n;i++){
        for(ll j=i;j<=n;j+=i) ans+=j;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
typedef pair<int, int> P;

ll f(ll x) {
  return x * (x - 1) / 2;
}

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  map<int, int> mp;
  for (auto el : a) {
    mp[el]++;
  }
  ll sum = 0;
  for (auto el : mp) {
    sum += f(el.second);
  }
  for (int k = 1; k <= n; ++k) {
    int x = a[k - 1];
    ll sub = f(mp[x]);
    ll add = f(mp[x] - 1);
    cout << sum - sub + add << endl;
  }

  return 0;
}


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

int main() {
  int a,b,k,count;
  cin>>a>>b>>k;
  vector<int> x(0);
    
  for(int i=1;i<=100;i++){
    if(a%i==0 && b%i==0)x.push_back(i);
  }
  reverse(x.begin(),x.end());
  cout<<x.at(k-1)<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
          int a,p,i=0;
          scanf("%d",&a);
          while(a!=0)
          {
                    p=a%10;
                    a=a/10;
                    if(p==7)
                              i++;
          }
          if(i>0)
                    printf("Yes\n");
          else
                    printf("No\n");
}


Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    while (scanner.hasNext()) {
      int n = scanner.nextInt();
      int count = 0;
      for (int a = 0; a < 10; a++) {
        for (int b = 0; b < 10; b++) {
          for (int c = 0; c < 10; c++) {
            int candidateOfD = n - a - b - c;
            if (0 <= candidateOfD && candidateOfD <= 9) {
              count++;
            } else if (candidateOfD < 0) {
              break;
            }
          }
        }
      }
      System.out.println(count);
    }

  }
}



Measured memory_bytes: 26240
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int n, k, f[200009], a[200009];
int main()
{
    IO
    cin>>n>>k;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    k=min(k,500);
    while(k--)
    {
        for(int i=1; i<=n; i++)
            f[i]=0;
        for(int i=1; i<=n; i++)
        {
            int l=i-a[i], r=i+a[i];
            if(l<1)
                l=1;
            if(r>n)
                r=n;
            f[l]++, f[r+1]--;
        }
        for(int i=1; i<=n; i++)
        {
            f[i]+=f[i-1];
            a[i]=f[i];
        }
    }
    for(int i=1; i<=n; i++)
        cout<<a[i]<<" ";
}


Measured memory_bytes: 5196
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    string s;
    cin >> s;
    int len = s.size();
    char fir = s[0];
    char las = s[len - 1];
    if (fir == las) {
        if (len % 2 == 0) {
            cout << "First" << endl;
        } else {
            cout << "Second" << endl;
        }
    } else {
        if (len % 2 == 0) {
            cout << "Second" << endl;
        } else {
            cout << "First" << endl;
        }
    }
}


Measured memory_bytes: 512
A,B,C,X,Y=map(int,input().split())

def dp(num_a,num_b):
    """
    if num_a<=0 and num_b<=0:return 0
    elif num_b>0:
        if B<2*C:return B+dp(num_a,num_b-1)
        else :return C*2+dp(num_a-1,num_b-1)
    else:
        if A<2*C:return A+dp(num_a-1,num_b)
        else: return C*2+dp(num_a-1,num_b-1)
    """
    if A+B>2*C:
        if min(num_a,num_b)>0:
            if num_a > num_b:
                return num_b*2*C+dp(num_a-num_b,0)
            else :
                return num_a*2*C+dp(0,num_b-num_a)
        elif num_a==0 and num_b>0:
            if B<2*C:
                return num_b*B
            else :
                return C*2*num_b
        elif num_a>0 and num_b==0:
            if A<2*C:
                return A*num_a
            else :
                return 2*C*num_a
        else :
            return 0
    else :
        return num_a*A+num_b*B
print(dp(X,Y))

Measured memory_bytes: 3064
typedef long long ll;
// typedef long long long long;
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b)
{
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}

long long lcm(long long a, long long b)
{
    return a * b / gcd(a, b);
}

int main() {
    ll n,m;
    std::cin >> n>>m;
    vector<ll> a(n);

    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    sort(a.begin(),a.end());
    a.erase( unique(a.begin(), a.end()), a.end() );
    
    // std::cout << a.size() << std::endl;
    
    ll num = 0;
    while(a[0]%2==0){
        num++;
        for (int i = 0; i < a.size(); i++) {
            if(a[i]%2==1){
                std::cout << 0 << std::endl;
                return 0;
            }else{
                a[i]/=2;
            }
        }
    }
    
    for (int i = 0; i < a.size(); i++) {
        if(a[i]%2==0){
            std::cout << 0 << std::endl;
            return 0;
        }
    }

    ll vv = 1;
    
    for (int i = 0; i < a.size(); i++) {
        vv = lcm(a[i]*(ll)pow(2,num-1),vv);
    }
    
    m/=vv;
    
    
    std::cout << m/2+m%2 << std::endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MOD (int)(1e9 + 7)

int main()
{
    int n;
    cin >> n;
    ll nums[n];
    for (int q = 0; q < n; q++)
    {
        cin >> nums[q];
    }
    ll dp[n+3][n+3];
    for (int q = 0; q < n+3; q++)
    {
        dp[q][q]=0;
    }
    for (int q = 1; q <= n; q++)
    {
        for (int w = 0; w < n-q+1; w++)
        {
            int left = w;
            int right = w+q;
            dp[left][right] = max(nums[left]-dp[left+1][right], nums[right-1]-dp[left][right-1]);
        }
    }
    cout << dp[0][n];
    return 0;
}


Measured memory_bytes: 70272
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports, dead_code)]

use std::collections::{HashMap, BinaryHeap};

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// 十分に理解した、可愛いお手製のライブラリ達
macro_rules! p {
    ($t:expr) => {
        println!("{}", $t);
    };
}
macro_rules! debug {
    ($t:expr) => {
        println!("{:?}", $t);
    };
}
fn gcd(a:usize, b:usize) -> usize {
    if b == 0 {return a};
    gcd(b, a % b)
}
fn lcm(a:usize, b:usize) -> usize {
    a / gcd(a, b) * b
}

// エントリーポイント
fn main() {
    input! {
        N:usize,
        M:usize,
        AB:[(usize, usize);N]
    }
    let items = {
        let mut items = HashMap::new();
        for ab in AB {
            let (a, b) = ab;
            if !items.contains_key(&a) {
                items.insert(a, b);
            } else {
                *items.get_mut(&a).unwrap() += b;
            }
        }
        items
    };
    let keys = {
        let mut keys = items.keys().map(|x| *x).collect::<Vec<usize>>();
        keys.sort();
        keys
    };

    let (mut m, mut cost) = (M, 0usize);
    for price in keys {
        let count = items[&price];
        if m < count {
            cost += price * m;
            break;
        }
        cost += price * count;
        m -= count;
    }
    debug!(cost);
}


Measured memory_bytes: 12540
using System;
class Program
{
  static void Main()
  {
    var A = 0;
    var B = 0;
    var str = "";
    
    str = Console.ReadLine();
    string[] arr = str.Split(' ');
    
    A = int.Parse(arr[0]);
    B = int.Parse(arr[1]);
    
    if(A >= 1 && A <= 100 && B >= 1 && B <= 100)
    {
      var kai = A*B;
      Console.WriteLine("{0}",kai);
    }
    else
    {
      Console.WriteLine("0から100までの値を入力してください");
    }
  }
}

Measured memory_bytes: 27504
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector< vector<char> > a(n, vector<char>(n));
	vector< vector<char> > b(m, vector<char>(m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < m; j++) {
			cin >> b[i][j];
		}
	}
	bool h2 = false;
	for (int i = 0; i <= n-m; i++) {
		for (int j = 0; j <= n-m; j++) {
			bool h = true;
			for (int p = 0; p < m; p++) {
				for (int q = 0; q < m; q++) {
					if (a[i+p][j+q] != b[p][q]) {
						h = false;
					}
				}
			}
			if (h) {
				h2 = true;
			}
		}
	}
	if (h2) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)


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

	int x = a - b * 2;

	if (x >= 0) cout << x;
	else cout << 0;


}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  for(int i = k; i < n; ++i) {
    if (a[i - k] < a[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n,maxapp=-1;
    cin >>n;

    map<string,int>app;
    vector<string> most;

    rep(i,n){
        string s;
        cin >>s;

        app[s]++;
        chmax(maxapp,app[s]);
    }


    for(auto p:app){
        string s = p.first;
        int appcnt=p.second;

        if(appcnt==maxapp)cout<<s<<endl;
    }



    //cout <<fixed<<setprecision(16)<< << endl;
    //cout<<ans<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 25216
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e4+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);

void solve(){
    ll x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    ll y=(x/d);
    if(k<=y)
        cout<<x-k*d<<endl;
    else if((k-y)%2)
        cout<<abs(x-(y*d+d))<<endl;
    else
        cout<<x-y*d<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstring>
#include<vector>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll pow(int x,int y){
ll ans=1;
for(int i=1;i<=y;i++)ans*=x;
return ans;
}
int main(){
int x;
cin>>x;
if(x==1){
    cout<<0<<' '<<-1;
    return 0;
}
for(int i=0;i<sqrt(x);i++){
    for(int j=-i;j<i;j++){
        if(pow(i,5)-pow(j,5)==x){

                cout<<i<<' '<<j;

    break;}
    }
}


return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<string>
#include<cmath>
int main(){
  long long int a,b,v,w, t;
  std::cin >> a >> v >> b >> w >> t;
  unsigned long long r = std::abs(b-a), vv=std::abs(v-w);
  
  if(v>w && r<=vv*t){
    std::cout << "YES\n";
  }else{
    std::cout << "NO\n";
  }
  return 0;
}

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

//    int n=132;
//    bitset<16>binar(n);
//    int a = bitset<16>(binar).to_ulong();
//    cout<<a;

#define int long long
#define pb push_back
#define rep(i,a,b) for ( int i = a; i < b; i++)
#define all(c) (c).begin(),(c).end()

using namespace std;

signed main()
{
   int k,a,b;
   cin>>k>>a>>b;
   bool A = false;
   for(int i=a; i<=b; i++){
   	if(i%k==0){
   		A= true;
   		break;
	   }
   }
   if(A){
   	cout<<"OK";
   }
   else{
   	cout<<"NG";
   }
   
}
        
        
    

    





Measured memory_bytes: 3684
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (1LL << 31) - 1;
const ll mod = 1e9 + 7;

ll N,D,ans;


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

	cin >> N >> D;
	FOR(i, 0, N) {
		ll x, y;
		cin >> x >> y;
		if (x*x + y * y <= D * D)ans++;
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 3644
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 数字の数 */
	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int[] a = new int[N];
			IntStream.range(0, N).forEach(i -> a[i] = scanner.nextInt());
			int k = scanner.nextInt();
			Arrays.sort(a);
			a[N - 1] = a[N - 1] << k;
			System.out.println(Arrays.stream(a).sum());
		}
	}
}


Measured memory_bytes: 27732
#include<stdio.h>
int main()
{
    int a,b,d,r;
    double f,k,j;
    scanf("%d %d",&a,&b);
    d = a/b;
    r = a%b;
    k = a;
    j = b;
    f = k/j;
    printf("%d %d %lf\n",d,r,f);
    return 0;
}



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

using namespace std;



main(){
  
  string in;
  getline(cin,in);
  
  for(int i=0;i+4<=in.length();i++){
    
    if((in[i]=='a') && (in[i+1]=='p') &&( in[i+2]=='p')&&(in[i+3]=='l')&&(in[i+4]=='e')){
      in[i]='p';in[i+1]='e';in[i+2]='a';in[i+3]='c';in[i+4]='h';
    }
    else if((in[i]=='p') && (in[i+1]=='e') &&( in[i+2]=='a')&&(in[i+3]=='c')&&(in[i+4]=='h')){
      in[i]='a';in[i+1]='p';in[i+2]='p';in[i+3]='l';in[i+4]='e';
    }//{}ツづーツ湘按猟ェツつキツづゥツづづ慊づつスツつュツつスツつセツつオツつュツつ、ツつイツつゥツづ按つ「ツ！ツ！ツ！ツ！ツ！ツ！ツ！
  }
  
  cout << in << endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  ll n,c;
  cin>>n>>c;
  vector<ll> x(n+1, 0), v(n+1, 0);
  REP(i,n) cin>>x[i+1]>>v[i+1];
  vector<ll> ps(n+1);
  partial_sum(ALL(v), begin(ps));
  vector<ll> lmx(n+1), lmx2(n+1);
  ll sum = 0;
  REP(i,n) {
    sum += v[i+1];
    lmx[i+1] = max(lmx[i], sum - x[i+1]);
    lmx2[i+1] = max(lmx2[i], sum - 2*x[i+1]);
  }
  reverse(begin(v)+1, end(v));
  reverse(begin(x)+1, end(x));
  vector<ll> rps(n+1);
  partial_sum(ALL(v), begin(rps));
  vector<ll> rmx(n+1), rmx2(n+1);
  sum = 0;
  REP(i,n) {
    sum += v[i+1];
    rmx[i+1] = max(rmx[i], sum - (c-x[i+1]));
    rmx2[i+1] = max(rmx2[i], sum - 2*(c-x[i+1]));
  }
  ll mx = 0;
  REP(i,n+1) {
    mx = max(mx, rmx2[i]+lmx[n-i]);
    mx = max(mx, rmx[n-i]+lmx2[i]);
  }
  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 6532
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto s = readln.chomp;
  if (s[2] == s[3] && s[4] == s[5]) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	int x;
	std::cin >> x;
	print(10-x/200);
}


Measured memory_bytes: 3664
N, L = gets.chomp.split(' ').map(&:to_i)
sum = (L...L+N).to_a.reduce(&:+)

sum_lack = if L < 0 && L+N-1 >= 0
  sum
elsif L < 0
  sum - (L+N-1)
else
  sum - L
end

puts sum_lack


Measured memory_bytes: 1788
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
    int n;
    cin >> n;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    rep(i,n){
        string s;
        cin >> s;
        if(s == "AC") ac++;
        else if( s == "WA") wa++;
        else if(s == "TLE") tle++;
        else if(s == "RE") re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
  	int i[5],k;
  	int index = 0;
  	while(cin >> i[index])
    {
      index++;
      if(index == 5) break;
    }
  	cin >> k;
  
  	for(int p = 0; p < 5 ;p++)
    {
      for(int q = p + 1;q < 5;q++)
      {
        if(i[p] - i[q] > k || i[q] - i[p] > k)
        {
          cout << ":(" << endl;
          return 0;
        }
      }
    }
  	cout << "Yay!" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

    public static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
        long n=scanner.nextLong();
        String s="";
        while (n>0)
        {
            long i = n%26;
            if(i==0)
            {
                i=26;
            }
            char c= (char) (96+i);
            s+=c;
            if(n/26==1 && n<27)
                n=0;
            else if(n%26==0)
            {
                n=n/26-1;
            }
            else
            {
                n=n/26;
            }
        }
        for(int i=s.length()-1;i>=0;i--)
        {
            System.out.print(s.charAt(i));
        }

	// write your code here
    }
}


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

struct StSeq
{
  int m_nBgn;
  int m_nEnd;

  StSeq() : m_nBgn(0), m_nEnd(0)
  { }
};

void fnInput(vector<vector<int>>& rvvnAdjcy, vector<StSeq>& rvoDFSrch)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; ++i)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; ++j)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
  StSeq oSeq;
  rvoDFSrch.resize(nMaxSiz + 1, oSeq);
}

void fnDepthFirstSearch(const vector<vector<int>>& cnrvvnAdjcy, vector<StSeq>& rvoDFSrch, int nx)
{
  static int stnCnt = 0;

  if (rvoDFSrch[nx].m_nBgn)  return;
  rvoDFSrch[nx].m_nBgn = ++stnCnt;

  for (int ny = 1; ny < cnrvvnAdjcy.size(); ++ny)
    if (cnrvvnAdjcy[nx][ny] == 1  &&
        nx != ny                )
      fnDepthFirstSearch(cnrvvnAdjcy, rvoDFSrch, ny);

  rvoDFSrch[nx].m_nEnd = ++stnCnt;
}

void fnResult(const vector<StSeq>& cnrvoDFSrch)
{
  for (int i = 1; i < cnrvoDFSrch.size(); ++i)
    cout << i <<  " " << cnrvoDFSrch[i].m_nBgn << " " << cnrvoDFSrch[i].m_nEnd << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;
  vector<StSeq> voDFSrch;

  fnInput(vvnAdjcy, voDFSrch);
  for (int nx = 1; nx < voDFSrch.size(); ++nx)
    fnDepthFirstSearch(vvnAdjcy, voDFSrch, nx);
  fnResult(voDFSrch);

  return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int X, A;
  cin >> X >> A;
  if (X < A) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

Measured memory_bytes: 3192