akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define repp(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define popcnt __builtin_popcount
#define all(v) v.begin(),v.end()
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}

bool isprime(long long n){
    if(n < 2) return false;
    ll RT = sqrt(n);
    for(int i = 2; i <= RT; ++i){
        if(n%i == 0) return false;
    }
    return true;
}

void primes(ll n, vector<ll>& factors){
    if(isprime(n)){
        factors.push_back(n);
        return;
    }
    if(n < 2) return;
    for(int i = 2; i <= sqrt(n); ++i){
        if(n % i == 0){
            factors.push_back(i);
            n = n/i;
            primes(n,factors);
            return;
        }
    }
}

int main(){
    ll a,b; cin >> a >> b;
    vector<ll> primeFactors;

    ll GCD = gcd(a,b);
    primes(GCD,primeFactors);

    ll ans = 1;
    ll prev = -1;
    rep(i,primeFactors.size()){
        if(primeFactors[i] != prev){
            prev = primeFactors[i];
            ++ans;
        }        
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,i,max;
    scanf("%d %d", &a, &b);
    max = a+b;
    int X[3]={(a+b),(a-b),(a*b)};
    for(i=0;i<3;i++)
    {
        if(X[i]>max)
            max = X[i];
    }

    printf("%d\n", max);

    return 0;
}


Measured memory_bytes: 1700
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.function.BiFunction;
import java.math.BigInteger;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        static long MOD = (long) (1e9 + 7);

        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            long n = in.nextInt();
            long a = in.nextInt();
            long b = in.nextInt();

            long x = modpow(2, n) - 1;
            BiFunction<Long, Long, Long> func = (Long q, Long w) -> {
                long e = 1;
                long r = 1;
                for (long i = 0; i < w; i++) {
                    e = (e * (q - i)) % MOD;
                    r = (r * (i + 1)) % MOD;
                }
                r = BigInteger.valueOf(r).modInverse(BigInteger.valueOf(MOD)).longValue();
                return (long) ((e * r) % MOD);
            };
            long y = func.apply(n, a);
            long z = func.apply(n, b);
            x = (x - y - z + MOD * 2) % MOD;
            out.println(x);
        }

        private long modpow(long a, long n) {
            long r = 1;
            while (n > 0) {
                r = r * ((n % 2) != 0 ? a : 1) % MOD;
                a = a * a % MOD;
                n >>= 1;
            }
            return r;
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 26708
#include <iostream>
#include <cstdint>

using namespace std;

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

  return 0;
}
  



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

int main(void){
        int r,c;
        int** sheet;
        int* row;
        cin>>r>>c;
        sheet= new int*[r+1];
        for(int i=0; i<r+1; i++) {
                row = new int[c+1];
                sheet[i]=row;
                if(i<r) {
                        for(int j=0; j<c; j++) {
                                cin>>sheet[i][j];
                        }
                        sheet[i][c]=0;
                }
                else{
                        for(int j=0; j<c+1; j++) {
                                sheet[i][j]=0;
                        }
                }
        }


        for(int j=0; j<c; j++) {
                for(int i=0; i<r; i++) {
                        sheet[r][j]+=sheet[i][j];
                }
        }

        for(int i=0; i<r+1; i++) {
                for(int j=0; j<c; j++) {
                        sheet[i][c]+=sheet[i][j];
                }
        }

        for(int i=0; i<r+1; i++) {
                for(int j=0; j<c+1; j++) {
                        if(j<c) {
                                cout<<sheet[i][j]<<" ";
                        }
                        else{
                                cout<<sheet[i][j]<<endl;
                        }
                }

        }
        return 0;
}



Measured memory_bytes: 3092
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b, c;
    
    scanf("%d%d%d", &a, &b, &c);
    if (b-a==c-b) {
        printf("YES");
    } else {
        printf("NO");
    }
    
    return 0;
}



Measured memory_bytes: 1696
#include<algorithm>
#include<cstring>
#include<map>
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int vis[55];
int main(){
    int n,m,x,y;
    scanf("%d %d",&n,&m);
    for(int i = 1;i <= m;i++){
        scanf("%d %d",&x,&y);
        vis[x]++;
        vis[y]++;
    }
    for(int i = 1;i <= n;i++){
        printf("%d\n",vis[i]);
    }
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    set<int> se;
    rep(i, N) se.insert(A[i]);
    map<int, int> ma;
    rep(i, N) ma[A[i]] = i;

    int cnt = 0;
    int idx = 0;
    for (auto s: se) {
        if (ma[s] % 2 != idx % 2) cnt++;
        idx++;
    }

    cout << cnt / 2 << endl;
}

Measured memory_bytes: 9984
class DisjointSet:
    def __init__(self, size):
        self.parent = list(range(size))
        self.rank = [0]*size
    
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def union(self, x, y):
        xr, yr = self.find(x), self.find(y)
        
        if self.rank[xr] > self.rank[yr]:
            self.parent[yr] = xr
        elif self.rank[xr] < self.rank[yr]:
            self.parent[xr] = yr
        elif xr != yr:
            self.parent[yr] = xr
            self.rank[xr] += 1

from itertools import chain

N = int(input())
points = tuple(tuple(map(int,input().split())) for _ in range(N))
ds = DisjointSet(N)

x_i = sorted((x,i) for i,(x,y) in enumerate(points))
y_i = sorted((y,i) for i,(x,y) in enumerate(points))

xr = [x_i[0]]
yr = [y_i[0]]

for (x0,i0),(x1,i1) in zip(x_i,x_i[1:]):
    if x0 == x1:
        ds.union(i0,i1)
    else:
        xr.append((x1,i1))

for (y0,i0),(y1,i1) in zip(y_i,y_i[1:]):
    if y0 == y1:
        ds.union(i0,i1)
    else:
        yr.append((y1,i1))

deltas = sorted(
        chain(
            ((x1-x0,i0,i1) for (x0,i0), (x1,i1) in zip(xr,xr[1:])),
            ((y1-y0,i0,i1) for (y0,i0), (y1,i1) in zip(yr,yr[1:])),
        )
    )


def it():
    for d,i0,i1 in deltas:
        if ds.find(i0) != ds.find(i1):
            ds.union(i0,i1)
            yield d
print(sum(it()))

Measured memory_bytes: 81828
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())

ANS = []
c = 26
p = 97

while True:
    N -= 1
    n = N % 26
    ANS.append(chr(p + n))

    if N < 26:
        break

    N -= n
    N //= 26


print("".join(map(str, ANS[::-1])))



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

using namespace std;

#define mp make_pair
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forlr(i, l, r) for (int i = int(l); i <= int(r); i++)
#define repeat(n) for (int hjfjke = 0; hjfjke < int(n); hjfjke++)
#define all(c) c.begin(), c.end()
#define ll long long

const int mod = 1000000007;

inline int add(int a, int b);
inline int sub(int a, int b);

long long dp[1 << 16];
int a[16][16];
long long sum[1 << 16];

int32_t main() {
    std::iostream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    forn(i, n) forn(j, n) cin >> a[i][j];


    forn(m, 1 << n) {
        forn(i, n)
            forn(j, i)
                if ((m & (1 << i)) && (m & (1 << j)))
                    sum[m] += a[i][j];
    }

    forn(i, 1 << n)
        dp[i] = sum[i];

    forn(i, 1 << n) {
        if (i == 0) continue;
        for (int j = i; j > 0; j--, j &= i) {
            dp[i] = max(dp[i], dp[i ^ j] + sum[j]);
        }
    }

    cout << dp[(1 << n) - 1];

    return 0;
}

int add(int a, int b) {
    int result = a + b;
    if (result >= mod)
        result -= mod;
    return result;
}

int sub(int a, int b) {
    int result = a - b;
    if (result < 0)
        result += mod;
    return result;
}

Measured memory_bytes: 1280
#include<stdio.h>
#define MAX 100
#define INFTY 800000
#define WHITE 0
#define GRAY 1 
#define BLACK 2



int n,M[MAX][MAX];
void DIJKSTRA(void);
void DIJKSTRA()
{
int minv,v,i;
int d[MAX],color[MAX];

for(i=0;i<n;i++)
{
d[i]=INFTY;
color[i]=WHITE;
}

d[0]=0;
color[0]=GRAY;
while(1){
minv=INFTY;
int u=-1;
for(i=0;i<n;i++)
{
if(minv>d[i]&&color[i]!=BLACK)
{
u=i;
minv=d[i];
}
}
if(u==-1)break;
color[u]=BLACK;
for(v=0;v<n;v++)
{
if(color[v]!=BLACK&&M[u][v]!=INFTY)
{
if(d[v]>d[u]+M[u][v])
{
d[v]=d[u]+M[u][v];
color[v]=GRAY;
}
}
}
}
for(i=0;i<n;i++)
{
if(d[i]==INFTY)
{
printf("%d %d\n",i,-1);
}
 else printf("%d %d\n",i,d[i]);
}
}







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

int k,c,u,v;
for(i=0;i<n;i++)
{
scanf("%d%d",&u,&k);
for(j=0;j<k;j++)
{
scanf("%d%d",&v,&c);
M[u][v]=c;
}
}
DIJKSTRA();
return 0;
}



Measured memory_bytes: 2068
#include <iostream>
#include <iomanip>

using namespace std;

int main(){
    int N; //1~100
    float P=0; //確率

    //入力
    cin >> N;


    //処理
    if(N%2 == 0){
        P = 1.0/2;
    }else{
        P = ( (N-1.0)/2 + 1 ) / N;
    }



    cout << fixed << std::setprecision(6) << P << endl;

    return 0;
}

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

typedef pair<int,int> Node;
typedef long long ll;
#define rep(i,j) for(i=0;i<j;i++)
#define rev_rep(i,j) for(i=j;i>=0;i—-)

int INF=1<<30;
class Dijkstra
{
public:
  typedef struct Edge{int to,cost;}Edge;
  vector< vector<Edge> > Graph;//接続リスト

  Dijkstra(int n)
  {
    vector<Edge> temp;
    Graph.resize(n,temp);
  }

  void add_arc(int x,int y,int c)
  {
    Edge e={y,c};
    Graph[x].push_back(e);
  }

  vector<int> get_distance(int s)
  {
    priority_queue< Node ,vector<Node>,greater<Node> > que;//(sからの距離,インデックス)
    vector<int>ans;
    int i;
    ans.resize(Graph.size(),INF);
    ans[s]=0;
    que.push(Node(0,s));
    while(!que.empty()){
      Node now=que.top();que.pop();
      int now_i=now.second;
      //nowへの最小距離でないならスキップ
      if(ans[now_i]<now.first)continue;
      //nowからの辺全てをみる
      rep(i,Graph[now_i].size()){
	Edge e=Graph[now_i][i];
	//nowから行った方が近かったら更新
	if(ans[e.to]>ans[now_i]+e.cost){
	  ans[e.to]=ans[now_i]+e.cost;
	  que.push(Node(ans[e.to],e.to));
	}
      }
    }
    return ans;
  }

};

int main()
{
  int n,m,r;
  cin>>n>>m>>r;
  Dijkstra map(n);
  int i;
  rep(i,m)
    {
      int a,b,c;
      cin>>a>>b>>c;
      map.add_arc(a,b,c);
      //map.add_arc(b,a,c);
    }
  vector<int> ans=map.get_distance(r);
  rep(i,ans.size())
    if(ans[i]==INF)
      cout<<"INF"<<endl;
    else 
      cout<<ans[i]<<endl;
  return 0;
}

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

using namespace std;

typedef long long int ll;
#define N (int)1e5+7



int n, m, qnt[N];


int main(){

	while(scanf("%d %d", &n, &m)!=EOF){
		memset(qnt, 0, sizeof(qnt));
		int u, v;
		for(int i=0; i<m; i++){
			scanf("%d %d", &u, &v);	
			u--; v--;
			qnt[u]++;
			qnt[v]++;
		}
		bool pos=true;
		for(int i=0; i<n; i++){
			if(qnt[i]%2){
				pos=false;
			}
		}
		printf("%s\n", (pos)?"YES":"NO");
	}

	return 0;

}



Measured memory_bytes: 640
#include <stdio.h>

void rotate(int* x, int* y, int n)
{
    int i, t;
    for(i=0;i<n;++i) { t=x[i]; x[i]=-y[i]; y[i]=t; }
}
int ok(int* x, int* y, int n, int* a, int* b, int m)
{
    int i;
    if (n!=m) return 0;
    for(i=1;i<n;++i) if (x[i]!=a[i] || y[i]!=b[i]) return 0;
    return 1;
}
int main(void)
{
    int n;
    while (scanf("%d", &n), n) {
        int i, k, m;
        int x[10], y[10], a[10], b[10], rx[10], ry[10];
        scanf("%d", &m);
        for(i=0;i<m;++i) {
            scanf("%d%d", x+i, y+i);
            rx[m-1-i]=x[i];
            ry[m-1-i]=y[i];
        }

        for(i=1;i<m;++i) {
            x[i]-=x[0]; y[i]-=y[0];
            rx[i]-=rx[0]; ry[i]-=ry[0];
        }

        for(k=1;k<=n;++k) {
            int mm;
            scanf("%d", &mm);
            for(i=0;i<mm;++i) scanf("%d%d", a+i, b+i);
            for(i=1;i<mm;++i) { a[i]-=a[0]; b[i]-=b[0]; }
            for(i=0;i<4;++i) {
                if (ok(x, y, m, a, b, mm) || ok(rx, ry, m, a, b, mm)) {
                    printf("%d\n", k);
                    break;
                }
                rotate(a, b, mm);
            }
        }
        puts("+++++");
    }
    return 0;
}

Measured memory_bytes: 612
H,W = map(int,input().split())

ans = []

dp = [ list ( map(int,input().split()) )  for i in range(H)]

for i in range(H):
  for j in range(W):
    a = dp[i][j]
    if j != W -1:
      if a %  2 == 1:
        dp[i][j+1] += 1
        ans.append([i+1,j+1,i+1,j+2])
    elif i != H-1:
      if a % 2 == 1:
        dp[i+1][j] += a
        ans.append([i+1,j+1,i+2,j+1])
      
print(len(ans))
for i in range(len(ans)):
  print(ans[i][0],ans[i][1],ans[i][2],ans[i][3])

Measured memory_bytes: 30292
#include <stdio.h>
int main(void){
   int W,H,x,y,r;
   
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
   
   if(x>=r && x<=(W-r)){
       if(y>=r && y<=(H-r)) printf("Yes\n");
       else printf("No\n");
   }
   else printf("No\n");
 
    return 0;
    
}


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

using namespace std;
typedef long long ll;
const ll INF=5000000;
ll way1=0,way2=0;
ll dp[100000];
ll ans,n;

int main()
{
  ll in[100000],i;

  cin>>n;

  for (i=0; i<n; i++)
  {
    cin>>in[i];
  }
  dp[0]=0;
  dp[1]=abs(in[1]-in[0]);
    for (i=2; i<n; i++)
    {
        dp[i]=min(dp[i-1]+abs(in[i]-in[i-1]),dp[i-2]+abs(in[i]-in[i-2]));

    }
    cout<<dp[n-1];

  return 0;
}


Measured memory_bytes: 1792
n,k = map(int,input().split())
s = []
for i in range(n):
    s.append(int(input()))

def f(P):
    v = 0
    for j in range(k):
        a = 0
        while(a+s[v]<=P):
            a += s[v]
            v+=1
            if v==n:
                return v
    return v

l = 0
r = 10**9
while l!=r:
    mid = (l+r)//2
    c = f(mid)
    if c>=n:
        r = mid
    else:
        l = mid+1   
print(r)            


Measured memory_bytes: 9552
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	string s;
	cin >> s;

	int l = s.size();

	int mi = 1000;

	FOR(i, 0, l-2) {
		mi = min(mi, abs((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0') - 753));
	}

	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		int num = N / i;
		ans += num * (2 * i + (num - 1) * i) / 2;
	}
	cout << ans;
}

Measured memory_bytes: 3624
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define LOG
#define PRINT
#define LCERR
#include <iostream>
auto optimize_cpp_stdio = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);
    return 0;
}();
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    int monster_battle_royale(const vector<int>& hp) {
        const int N = int(hp.size());
        if (N == 0) return 0;

        int cur_gcd = hp[0];
        for (int i = 1; i < hp.size(); ++i) {
            cur_gcd = gcd(cur_gcd, hp[i]);
        }
        return cur_gcd;
    }

private:

    // only works for positive numbers
    int gcd(int x, int y) {
        if (y > x) swap(x, y);
        while (y != 0) {
            int tmp = x % y;
            x = y;
            y = tmp;
        }
        return x;
    }
};

int solve() {
    Solution solution;
    // handle IO here
    int N;
    cin >> N;
    vector<int> hp(N);
    for (int i = 0; i < N; ++i) {
        cin >> hp[i];
    }
    cout << solution.monster_battle_royale(hp) << '\n';
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 640
SOSU = (10**9 + 7)

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

#print(A)

cntall = 0
cntusiro = 0

for indexi, i in enumerate(A):
    for indexj, j in enumerate(A):
        if i > j :
            cntall += 1
            if indexi < indexj:
                cntusiro += 1
        #print("roop:",i,j,indexi,indexj,cntall,cntusiro)

anst = (k*(k -1))*cntall//2 + k * cntusiro 


ans = anst % SOSU

#print ( cntall, cntusiro)
#print(anst)
print(int(ans) )

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

void solve()
{
    int x, a, b;
    cin >> x >> a >> b;
    int A = abs(x - a);
    int B = abs(x - b);
    if (A < B)
        cout << "A" << endl;
    else
        cout << "B" << endl;
}

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

Measured memory_bytes: 3588
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	string s;
	cin >> s;
	int left = 0, right = 0;
	int rr[100001];
	queue<int> ss;
	int r_near;
	for (int i = 0; i < 100001; i++) { rr[i] = 0; }
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'L') {
			ss.push(i);
		}
	}
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'R') {
			if ((ss.front() - i) % 2 == 0) { rr[ss.front()]++; }
			else { rr[ss.front() - 1]++; }
			r_near = i;
		}
		else {
			ss.pop();
			if ((i - r_near) % 2 == 0) { rr[r_near]++; }
			else { rr[r_near + 1]++; }
		}
	}

	for (int i = 0; i < s.length(); i++) {
		cout << rr[i] << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1408
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        k: i32,
        mut a: [i64; n],
    }
    for _ in 0..std::cmp::min(k, ((n as f64).sqrt() as i32) * 3) {
        let mut t = vec![0; n + 1];
        for i in 0..n {
            let a = a[i];
            let i = i as i64;
            use std::cmp::{max, min};
            t[max(0, i - a) as usize] += 1;
            t[min(n as i64, i + a + 1) as usize] -= 1;
        }
        for i in 0..n {
            t[i + 1] += t[i];
            a[i] = t[i];
        }
        // println!("{:?}", a);
    }
    for a in a {
        print!("{} ", a);
    }
}


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

signed main() {
  int n,m;
  cin >> n >> m;

  dsu Tree(n);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    a--,b--;
    Tree.merge(a,b);
  }

  set<int> st;
  for (int i = 0; i < n; i++) {
    st.insert(Tree.leader(i));
  }
  cout << st.size() - 1 << endl;

}




Measured memory_bytes: 7500
#include <bits/stdc++.h>
//pdfの写し
using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  //int,intのペアを要素として持つsize==mのvector pを宣言。
  vector<pair<int, int> > p(m);
  //pに条件データを全部入れる
  for(int i = 0; i < m; i++){
    cin >> p[i].first >>p[i].second;
  }
  /*
  *オーダーがO(1000)と小さいので全ての要素について調べる。
  *xについて、一桁ずつvector dに入れる。
  *桁が指定と違えば次のxについて調べる
  *pに格納した条件を用いて、dに格納したxが正しいか一桁ずつ判定する。条件と違う桁があれば次のxについて調べる。
  *条件をスルーすればxを出力し、最後までループが回れば条件と一致するものは見つからなかったということなので-1を出力する。
  */
  for(int x = 0; x < 1000; x++){
    int keta = 1;
    int nx = x/10;
    vector<int> d(1,x%10);
    while(nx){
      keta++;
      //1の位から左に入れていく。例890 => 098 のようになる。
      d.push_back(nx%10);
      nx /= 10;
    }
    if(keta != n) continue;
    bool ok = true;
    //ここで正しい数字の順にしている。先の例を持ち出せば。098 => 890 のようになる。
    reverse(d.begin(), d.end());
    for(int i = 0; i < m; i++){
      if(d[p[i].first-1] != p[i].second) ok = false;
    }
    if(ok){
      cout << x << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
/*
*同じ桁に複数の指定があっても、どちらかは確実にfalseをはいてくれる。
*/

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

int main(){
  int N,X,Y; cin >> N >> X >> Y;
  int count[2790];
  for(int i=1; i<=N-1; i++){
    for(int j=i+1; j<=N; j++){
      count[min(j-i,abs(X-i)+1+abs(Y-j))]++;
    }
  }
  
  for(int k=1; k<=N-1; k++) cout << count[k] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100000;
int w[MAX_N];


bool possible(ll P,int n,int k)
{
	ll nsum=0;
	int pos=0;
	int i=0;
	while(i < k && pos < n){
		if(nsum + w[pos] <= P){
			nsum += w[pos];
			pos++;
		}else{
			nsum=0;
			i++;
		}	
	}
	if(i < k){
		return true;
	}else{
		return false;
	}
}

int main()
{
	int n,k;
	int maxw=0,sumw=0;
	cin >> n >> k;
	for(int i=0;i<n;i++){
		scanf("%d",&w[i]);
		maxw = max(maxw,w[i]);
		sumw += w[i];
	}
	ll high = (ll)maxw*n/k+1; //??????true
	ll low = sumw/k-1; //??????false
	//true??¨??????????°????P???????????¢?´¢??§?±???????
	while(1){
		ll mid = (high+low)/2;
		if(mid == low){
			break;
		}
		if(possible(mid,n,k)){
			high = mid;
		}else{
			low = mid;
		}
	}
	cout << high << "\n";
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
typedef long long ll;
using namespace std;

int main() {
	int N; 
	string S;
	int a = 0;
	cin >> N >> S;
	int x[N];
	
	for (int i = 0; i <N; ++i) {
		if (S[i] == 'I') {
			a += 1;
			x[i] = a;
		}
		if (S[i] == 'D') {
			a -= 1;
			x[i] = a;
		}
	}
	
	sort(x, x + N, greater<int>());
	if (x[0] < 0) x[0] = 0;
	cout << x[0] << endl;
	
}


Measured memory_bytes: 256
import math

a,b,c,d = map(int,input().split())

e = c*d//math.gcd(c,d)

x = b//c-a//c 

x += b//d-a//d

x -= b//e-a//e 

if a%c == 0:
    x += 1
    
if a%d == 0:
    x += 1
    
if a%e == 0:
    x -= 1
    
print(b-a-x+1)

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

#define FOR(i, l, r) for(size_t i = (l); i < (r); i = i + 1)
#define REP(i, n) FOR(i, 0, n)
using ll = long long;

int main() {
    ll X;
    cin >> X;
    ll ans = 100;
    int i = 0;
    while(1) {
        if(ans >= X) {
            break;
        }
        ans = floor(ans * 1.01);
        // cout << ans << endl;
        i++;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 3736
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

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

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll combination(ll n,ll r){
    ll sum=1;
    rrep(i,min(r,n-r)) (sum*=(n-i+1))%=mod;
    return sum;
}

//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,sum=0;
    cin>>n;
    vec<ll> a(n),b(n),c(n);
    rep(i,n) cin>>a[i];
    sort(ALL(a));
    rep(i,n) cin>>b[i];
    rep(i,n) cin>>c[i];
    sort(ALL(c));
    
    rep(i,n){
        ll lefta=-1,righta=n;
        while(abs(righta-lefta)>1){
            ll mida=(righta+lefta)/2;
            if(a[mida]>=b[i]) righta=mida;
            else lefta=mida;
        }
        ll up=lefta+1;
        
        ll leftb=-1,rightb=n;
        while(abs(rightb-leftb)>1){
            ll midb =(rightb+leftb)/2;
            if(c[midb]>b[i]) rightb=midb;
            else leftb=midb;
        }
        ll down=n-(rightb);
        
        sum+=(up*down);
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 2560
from collections import Counter
mod = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)

    # check
    if N % 2 == 1:
        if C[0] != 1:
            return 0
        for i in range(2, N, 2):
            if C[i] != 2:
                return 0
    else:
        for i in range(1, N, 2):
            if C[i] != 2:
                return 0
    return pow(2, N//2, mod)


if __name__ == "__main__":
    print(main())

Measured memory_bytes: 20688
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int ans =0;

vvi ch;
vi lvl;
vvi v_lvl;
vi dp;
vi deg;

void dfs(int v) {
    if(v_lvl.size() <= lvl[v]) v_lvl.pb(vi());
    v_lvl[lvl[v]].pb(v);
    for(auto u : ch[v]) {
        lvl[u] = lvl[v] + 1;
        dfs(u);
    }
}

int main()
{


    int n,k;
    scanf("%d %d", &n, &k);
    vi a(n);
    forn(i,0,n) scanf("%d", &a[i]);
    forn(i,0,n) a[i]--;
    if(a[0] != 0) ans++;
    if(a[0]!=0) a[0] = 0;
    ch.resize(n);
    lvl.resize(n);
    dp.resize(n);
    forn(i,1,n) ch[a[i]].pb(i);
    lvl[0] = 0;
    deg.resize(n);
    dfs(0);
    for(int i = v_lvl.size() - 1; i>=2; i--) {
        for(auto v : v_lvl[i]) {
            deg[v] = 0;
            for(auto u : ch[v]) {
                deg[v] = max(deg[v], deg[u] + 1);
            }
            if(deg[v] >= k-1) {
                ans++;
                deg[v] = - 1;
            }
        }
    }
    cout<<ans;
    
    
    
}



Measured memory_bytes: 20528
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a, s, d, f;
	a = s = d = f = 0;
	for (size_t i = 0; i < n; i++)
	{
		string x;
		cin >> x;
		if (x=="AC")
			a++;
		if (x == "WA")
			s++;
		if (x == "TLE")
			d++;
		if (x == "RE")
			f++;
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << s << endl;

	cout << "TLE x " << d << endl;
	cout << "RE x " << f << endl;

	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll                          long long
#define in(a)                       ll a; cin>>a;
#define in2(a,b)                    ll a,b; cin>>a>>b;
#define in3(a,b,c)                  ll a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                ll a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              ll a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define pb                          push_back
#define bhar(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"                       
#define ce(x)                       cout<<x<<"\n";
#define nl                          cout<<endl;
#define jaldi                       ios_base::sync_with_stdio(false);cin.tie(NULL);
#define dekh_lo                     ce("dekh_lo");
#define sz(x)                       (ll)x.size()
#define re                          return

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

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

typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;

const ll mod=1e9+7;
const ll N=4e5+5;

/*


*/

void solve(){
    in(n);
    vi a(n);
    lelo(a);

    vi dp(n+1,0);
    for(ll i=0;i<n;i++){
    	dp[i+1]=max(dp[i],a[i]);
    }



    ll ans=0;
    for(ll i=0;i<n;i++){
    	ll need=dp[i+1]-a[i];
    	if(need>0){
    		ans+=need;
    	}
    }

    ce(ans);
}

int32_t main(){
    // jaldi
    ll t; 
    // cin>>t;
    t=1;     
    while(t--){
        solve();
    }
}

/*


*/

  

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

#define N 1000000000

using namespace std;

typedef unsigned long long BigInt;

BigInt pow(BigInt n, unsigned p) {
    BigInt x = 1;
    for (unsigned i = 0; i < p; ++i) {
        x *= n;
        if (x > N) {
            throw "error";
        }
    }
    return x;
}

BigInt f(string s, BigInt n) {
    BigInt retval = 0;
    for (unsigned i = 0; i < s.length(); ++i) {
        if (s[i] == 'n') {
            i += 2;
            retval += pow(n, s[i] - '0');
            if (retval > N) {
                throw "error";
            }
        }
    }
    return retval;
}

int main() {
    BigInt n, t, ans;
    string fn;
    cin >> n >> t;
    cin >> fn;
    try {
        ans = f(fn, n) * t;
        if (ans > N) {
            throw "error";
        }
        cout << ans << endl;
    } catch (const char *s) {
        cout << "TLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 1264
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
typedef long long LL;
//typedef __int128 LL;
using namespace std;
const int maxn=52;
const int maxm=maxn*maxn*maxn;
const int IINF=1E9+77;
const LL INF=1E18+77;

int N,X,D,M[maxn],P[maxn],T;
LL DP[2][maxm];


struct NODE{
	int v;
	LL s;
	int c;
	bool operator <(const NODE &o)const{
		if(v*o.s != o.v*s){
			return v*o.s > o.v*s;
		}else{
			return s<o.s;
		}
	}
}nodes[maxn];

struct EDGE{
	int to,next;
}edges[maxn];
int cEdge=1,head[maxn];
void addEdge(int from,int to){
	edges[cEdge]=(EDGE){to,head[from]};
	head[from]=cEdge++;
}

void dfs(int u){
	nodes[u]=(NODE){1,M[u],u==1?IINF:D};
	for(int k=head[u];k;k=edges[k].next){
		int v=edges[k].to;
		dfs(v);
		nodes[u].v+=nodes[v].v;
		nodes[u].s+=nodes[v].s;
	}
}

pair<LL,int> Q[maxn][maxn*maxn];
int qh[maxn],qr[maxn];

void push(int x,LL v,int p){
	while(qh[x]!=qr[x] && v <= Q[x][qr[x]-1].first) --qr[x];
	Q[x][qr[x]++]=make_pair(v,p);
}

LL query(int x,int p){
	while(qh[x]!=qr[x] && Q[x][qh[x]].second < p) ++qh[x];
	return Q[x][qh[x]].first;
}

int main(){
	scanf("%d%d%d",&N,&X,&D);
	scanf("%d",M+1);
	for(int i=2;i<=N;++i){
		scanf("%d%d",M+i,P+i);
		addEdge(P[i],i);
	}

	dfs(1);

	//for(int i=1;i<=N;++i) cerr<<nodes[i].v<<" "<<nodes[i].s<<" "<<nodes[i].c<<endl;

	for(int i=1;i<maxm;++i){
		DP[T][i]=INF;
		//if(i<9) cerr<<"DP["<<1<<"]["<<i<<"]="<<DP[T][i]<<endl;
	}

	for(int i=1;i<=N;++i){
		T^=1;
		int v=nodes[i].v;
		LL s=nodes[i].s;
		int c=min(nodes[i].c,maxn);
		nodes[i].c-=c;
		for(int j=0;j<maxm;++j){
			push(j%v,DP[T^1][j]-(j/v)*s,j/v);
			DP[T][j]=query(j%v,(j/v)-c)+(j/v)*s;
			//if(j<9) cerr<<"DP["<<i<<"]["<<j<<"]="<<DP[T][j]<<endl;
		}
		memset(qh,0,sizeof(qh));
		memset(qr,0,sizeof(qr));
		//cerr<<endl;
	}

	for(int i=maxm-2;i>=0;--i){
		DP[T][i]=min(DP[T][i],DP[T][i+1]);
		//if(i<9) cerr<<"DP["<<i<<"]="<<DP[T][i]<<endl;
	}

	//cerr<<"??"<<endl;

	sort(nodes+1,nodes+N+1);
	int p=1,V=0,ans=0;
	LL S=0;
	for(int i=maxm-1;i>=0;--i){
		while(true){
			while(p<=N && !nodes[p].c) ++p;
			if(p<=N && DP[T][i]+S+nodes[p].s <= X){
				int t=(X-DP[T][i]-S)/nodes[p].s;
				if(t>nodes[p].c) t=nodes[p].c;

				V+=nodes[p].v*t;
				S+=nodes[p].s*t;
				nodes[p].c-=t;
			}else{
				break;
			}
		}
		if(DP[T][i]+S <= X){
			//cerr<<i<<":"<<DP[T][i]<<"  S:"<<S<<endl;
			//cerr<<"dp["<<i<<"]="<<DP[T][i]<<endl;
			//if(i+V > ans) cerr<<":"<<i<<" "<<V<<endl;
			ans=max(ans,i+V);
		}
	}

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

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M), cnt(N+1);
  for(int i=0; i<M; i++){
    cin >> a[i] >> b[i];
  }
  
  for(int i=0; i<M; i++){
    cnt[a[i]]++; cnt[b[i]]++;
  }

  for(int i=0; i<N; i++){
    cout << cnt[i+1] << endl;
  }
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<double, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v, int idx)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        if (i == idx)
        {
            cout << "[" << v[i] << "]"
                 << " \n"[i == sz - 1];
            continue;
        }
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    vector<P> v(n);
    for (int i = 0; i < n; i++)
    {
        int s, t;
        cin >> s >> t;
        v[i] = P(t, s);
    }
    sort(v.begin(), v.end());
    int res = 0, gt = 0;
    for (int i = 0; i < n; i++)
    {
        if (gt < v[i].second)
        {
            res++;
            gt = v[i].first;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 4388
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

// 標準入力
fn read_line<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
    let vec: Vec<usize> = read_line();
    let n = vec[0];
    let mut abcs: Vec<Vec<i32>> = Vec::new();
    for _ in 0..n {
        let abc: Vec<i32> = read_line();
        abcs.push(abc);
    }

    // dp用の二重ベクタを作る
    let mut dp: Vec<Vec<i32>> = Vec::new();
    dp.push(abcs[0].clone());
    for _ in 1..n {
        let dp_abc: Vec<i32> = Vec::new();
        dp.push(dp_abc);
    }

    // 日数分、各ABCごとにdp計算
    'days: for i in 1..n {
        'dp_of_abc: for j in 0..3 {
            let mut indices: Vec<usize> = vec![0, 1, 2];
            // 前のdp値を見る際、ABCが被らないようにindicesからjを除外
            indices.remove(j);
            let v1 = dp[i - 1][indices[0]] + abcs[i][j];
            let v2 = dp[i - 1][indices[1]] + abcs[i][j];
            dp[i].push(cmp::max(v1, v2));
        }
    }

    let ans = [
        dp[n - 1][0],
        dp[n - 1][1],
        dp[n - 1][2],
    ];
    println!("{}", ans.iter().max().unwrap());
}


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

using namespace std;
const int N = 1e5 + 5;
int A[N];

int main()
{
    int n; cin >> n;
    for (int i = 1; i <= n; i++) cin >> A[i];
    long long sum = 0;
    for (int i = 1; i <= n + 1; i++) sum += abs(A[i] - A[i-1]);
    for (int i = 1; i <= n; i++) {
        sum -= abs(A[i] - A[i-1]) + abs(A[i] - A[i+1]);
        sum += abs(A[i-1] - A[i+1]);
        cout << sum << "\n";
        sum += abs(A[i] - A[i-1]) + abs(A[i] - A[i+1]);
        sum -= abs(A[i-1] - A[i+1]);
    }

    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[1000];
	int x=0,y=0;
	gets(s);//scanf("%s",s);
	for(int i=0;i<=strlen(s);++i)
	{	
	if(s[i]=='C')
{	x++;
	}
	else if((x!=0)&&(s[i]=='F'))
	{
	y++;
	}
	else
	{x=x;
	y=y;
	}
	}
	if(x==0||y==0)
	cout<<"No";
	if(x>0&&y>0)
	cout<<"Yes";
	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int i,n,h,M=0,s=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&h);
    if(M<=h){
      M=h;
      s++;
    }
  }
  printf("%d\n",s);
  return 0;
}
  

Measured memory_bytes: 128
N = str(input())
N = list(N)

if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print("hon")
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '8' or N[-1] == '6':
    print("pon")
elif  N[-1] == '3':
    print("bon")


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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	int f;
	void solve() {
		int h, w;
		cin >> h >> w;
		vector<vector<int>> a(h, vector<int>(w, 0));
		vector<vector<int>> b(h, vector<int>(w, 0));
		vector<vector<int>> d(h, vector<int>(w, 0));
		for(int i=0; i<h; i++)for(int j=0; j<w; j++)cin >> a[i][j];
		for(int i=0; i<h; i++)for(int j=0; j<w; j++)cin >> b[i][j];
		for(int i=0; i<h; i++)for(int j=0; j<w; j++)d[i][j] = a[i][j] - b[i][j];
		f = (h + w - 1) * 80;
		vector<vector<vector<bool>>> x(h, vector<vector<bool>>(w, vector<bool>(f+1)));
		x[0][0][abs(d[0][0])] = true;
		for(int i=0; i < h; i++){
			for(int j=0; j < w; j++){
				for(int k=0; k <= f; k++){
					if(x[i][j][k]){
						if(i != h-1){
							x[i+1][j][abs(k + d[i+1][j])] = true;
							x[i+1][j][abs(k - d[i+1][j])] = true;
						}
						if(j != w-1){
							x[i][j+1][abs(k + d[i][j+1])] = true;
							x[i][j+1][abs(k - d[i][j+1])] = true;
						}
					}
				}
			}
		}
		int ret = 0x7f7f7f7f;
		for(int i=0; i <= f; i++)if(x[h-1][w-1][i])updmin(ret, i);
		cout << ret << "\n";
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

int main(){
  int E,Y;
  cin>>E>>Y;
  switch(E){
    case 0:
      if(1868<=Y && Y<=1911){
        cout<<"M"<<Y-1867;
      }
      else if(1912<=Y && Y<= 1925){
        cout<<"T"<<Y-1911;
      }
      else if(1926<=Y && Y<= 1988){
        cout<<"S"<<Y-1925;
      }
      else if(1989<=Y && Y<= 2016){
        cout<<"H"<<Y-1988;
      }
      cout<<endl;
      break;
  case 1:
    cout<<1867+Y<<endl;
    break;
  case 2:
    cout<<1911+Y<<endl;
    break;
  case 3:
    cout<<1925+Y<<endl;
    break;
  case 4:
    cout<<1988+Y<<endl;
    break;
  }
  return 0;
}


Measured memory_bytes: 3100
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	string o, e;

	cin >> o >> e;

	if (o.size() > e.size()) {
		REP(i, o.size() - 1) {
			cout << o[i] << e[i];
		}

		cout << o[o.size() - 1] << endl;
	}
	else {
		REP(i, o.size()) {
			cout << o[i] << e[i];
		}

		cout << endl;
	}
}

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

int main() {
    int Q;
    cin >> Q;
    const int N = 100001;
    vector<int> is_prime(N), sum(N + 1);
    REP(i, N) {
        bool p = true;
        for (int j = 2; j * j <= i; ++j) {
            if (i % j == 0) {
                p = false;
                break;
            }
        }
        is_prime[i] = p;
    }
    for (int i = 3; i < N; ++i) {
        sum[i + 1] += sum[i];
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i + 1) / 2]) ++sum[i + 1];
    }
    REP(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << sum[r + 1] - sum[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


void Main(){
    int K, X;
    cin >> K >> X;
    cout << (500*K>=X?"Yes":"No") << el;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 
int main(){

    long long int N;
    cin >> N;
    vector<long long int> A(N);
    for(int i = 0; i<N; i++){
        cin >> A[i];
    }

    sort(A.begin(), A.end(),greater<int>());

    long long int ans = 0;

    if(N%2 == 0){
        ans += A[0];
        for(int i = 1; i < (N/2);i++){
            ans += 2*A[i];
        }
    }else{
        ans += A[0];
        for(int i = 1; i < ((N-1)/2); i++){
            ans += 2*A[i];
        }
        ans += A[(N-1)/2];

    }

    cout << ans << endl;



}

Measured memory_bytes: 4848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105,M=19,p=998244353,inf=0x3f3f3f3f;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,ga[1<<(M+1)],c[1<<M],po[N];
int *g[M+1];
bitset<N> bit[N];
unordered_map<bitset<N>,int> h[N];
void check(int &x,int y){x=(x+y<p) ? (x+y) : (x+y-p);}
int pl(int x,int y){return (x+y<p) ? (x+y) : (x+y-p);}
char ch[N];
void reset(){
	n=100;
	for (int i=0;i<=M;i++) g[i]=ga+(1<<i);
	for (int i=1;i<(1<<M);i++) c[i]=c[i>>1]+(i&1);
	po[0]=1;
	for (int i=1;i<=n;i++) po[i]=po[i-1]*2%p;
	for (int i=1;i<n;i++)
	for (int j=0;j<i;j++) bit[i][j]=1;
	n=0;
}
int calc(int n,bitset<N> a){
	if (n<=M){
		int t=0;
		for (int i=0;i<n;i++)
		if (a[i]) t+=1<<i;
		return g[n][t];
	}
	if (h[n].count(a)) return h[n][a];
	int ans=calc(n-1,a>>1)*(1+a[0])%p;
	bitset<N> cur,res;
	for (int d=1;d*2<=n;d++){
		cur=a&bit[d];res=a>>d;int l=n-d;
		while (l>=d){
			l-=d;
			cur&=res;res>>=d;
			check(ans,(ll)calc(d,cur)*calc(l,res)%p);
		}
	}
	return h[n][a]=ans;
}
int main(){
	reset();
	g[0][0]=1;
	for (int i=1;i<=M;i++)
	for (int k=0;k<(1<<i);k++){
		check(g[i][k],g[i-1][k>>1]*((k&1)+1)%p);
		for (int d=1;d*2<=i;d++){
			int cur=k&((1<<d)-1),res=k>>d,l=i-d;
			while (l>=d){
				l-=d;
				cur&=res;res>>=d;
				check(g[i][k],(ll)g[d][cur]*g[l][res]%p);
			}
		}
	}
	
	scanf("%s",ch);
	n=strlen(ch);
	
	bitset<N> t;t.reset();
	for (int i=0;i<n;i++) t[i]=(ch[i]=='1');
	printf("%d\n",calc(n,t));
	return 0;
}

Measured memory_bytes: 7168