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

long long MOD=1000000007;

int main(){
    long long N,K;
    cin >> N >> K;
    long long A;
    vector<long long> po,ne;
    long long i,j,k;
    for(k=0; k<N; k++){
        cin >> A;
        if(A>=0){
            po.push_back(A);
        }else if(A<0){
            ne.push_back(-A);
        }
    }
    sort(po.begin(),po.end());
    sort(ne.begin(),ne.end());
    long long ans=1;
    if(N==K){
        for(i=0; i<po.size(); i++){
            ans *= po[i];
            ans %=MOD;
        }
        for(j=0; j<ne.size(); j++){
            ans *= MOD-ne[j];
            ans %=MOD;
        }
        cout << ans << endl;
        return 0;
    }
    if((ne.size()==N)&&(K%2==1)){
        for(j=0; j<K; j++){
            ans *= MOD-ne[j];
            ans %=MOD;
        }
        cout << ans << endl;
        return 0;
    }
    i=po.size()-1;
    j=ne.size()-1;
    for(k=0; k<K; k++){
        if(k==K-1){
            ans *= po[i];
            ans %=MOD;
            i--;
        }else if(i>=1&&j>=1){
            if(po[i]*po[i-1]>ne[j]*ne[j-1]){
                ans *= po[i];
                ans %=MOD;
                i--;
            }else{
                ans *=MOD-ne[j];
                ans %=MOD;
                ans *=MOD-ne[j-1];
                ans %=MOD;
                j--;
                j--;
                k++;
            }
        }else if(j<=0){
            ans *= po[i];
            ans %=MOD;
            i--;
        }else if((K-k)%2==1){
            ans *= po[i];
            ans %=MOD;
            i--;
        }else{
            ans *=MOD-ne[j];
            ans %=MOD;
            ans *=MOD-ne[j-1];
            ans %=MOD;
            j--;
            j--;
            k++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5456
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    ans = 0
    N = len(S)
    for i in range(N):
        for j in range(i+1, N+1):
            l = 2 ** (max(0, i-1))
            r = 2 ** (max(0, N-j-1))
            ans += int(S[i:j]) * l * r
    return ans


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6724
#include <iostream>
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    for (int i=1; i<=a; i++) {
        if ((b*i+c) % a == 0) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 3548
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
 
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
 

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

int main(){
    std::ios::sync_with_stdio(false);

    int x[5] = {};
    cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];

    for(int i=0;i<5;++i)
    {
      if(x[i] == 0)
      {
        cout << (i + 1) << endl;
      }
    }    
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main() {
  string s;
  cin >> s;
  int count=0;
  for(int i=0;i<s.size();i++) {
    if(s[i]=='1') count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  long i, n;
  long x2 = 0, x5 = 0;
  scanf("%ld", &n);
  if (n % 2) { puts("0"); return 0; } // 奇数のときは0                          
  n /= 10; x5 += n;
  while (n / 5 > 0) {
    n /= 5; x5 += n;
  }
  printf("%ld\n", x5);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    int man = -1, gosen = -1, sen = -1;
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= n - i; j++) {
        int k = n - i - j;
        int tmp = 10000 * i + 5000 * j + 1000 * k;
        if (y == tmp) {
          man = i;
          gosen = j;
          sen = k;
        }
      }
    }
    System.out.println(man + " " + gosen + " " + sen);
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b>>c;
    for(i=b; i<=c; i++){
        if(i%a==0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
    return 0;
}

Measured memory_bytes: 3640
n = int(input())
A = [int(input()) for _ in range(n)]
max_id = A.index(max(A))
A = sorted(A, reverse=True)
for i in range(n):
    if i == max_id:
        # 最大値が取り除かれるので2番目に大きい数値を出力
        print(A[1])
    else:
        # 最大値が残っているので，最大値を出力
        print(A[0])

Measured memory_bytes: 13316
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int x, y, z; cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
#include <array>
#include <algorithm>
#include <bitset>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <stack>
#include <vector>

using namespace std;

int result = 0;
char Map[9][4];
bool check[9];
int t_map[3][3];
int alf[256];
// 0 1 2
// 3 4 5
// 6 7 8
void rotate(int num){
    char c = Map[num][0];
    for(int i = 0;i < 3;i++){
        Map[num][i] = Map[num][i+1];
    }
    Map[num][3] = c;
}

void dfs(int num){
    if(num == 9)result++;
    else{
        for(int i = 0;i < 9;i++){
            if(check[i])continue;
            check[i] = true;
            t_map[num/3][num%3] = i;
            for(int j = 0;j < 4;j++){
                if(num / 3 > 0 && num % 3 > 0){
                    if(alf[Map[t_map[num/3][num%3]][1]] == -alf[Map[t_map[num/3][(num%3)-1]][3]]
                       && alf[Map[t_map[num/3][num%3]][0]] == -alf[Map[t_map[(num/3)-1][num%3]][2]])dfs(num+1);
                }else if(num / 3 > 0){
                    if(alf[Map[t_map[num/3][num%3]][0]] == -alf[Map[t_map[(num/3)-1][num%3]][2]])dfs(num+1);
                }else if(num % 3 > 0){
                    if(alf[Map[t_map[num/3][num%3]][1]] == -alf[Map[t_map[num/3][(num%3)-1]][3]])dfs(num+1);
                }else{
                    dfs(num+1);
                }
                rotate(i);
            }
            check[i] = false;
        }
    }
}

int main(){
    alf['r'] = 1;alf['g'] = 2; alf['b'] = 3;alf['w'] = 4;
    alf['R'] = -1;alf['G'] = -2; alf['B'] = -3;alf['W'] = -4;
    int n;string str;
    cin >> n;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < 9;j++){
            cin >> str;
            for(int k = 0;k < 4;k++){
                Map[j][k] = str[k];
            }
        }
        result = 0;
        dfs(0);
        cout << result << endl;
    }
}

Measured memory_bytes: 3132
//Zory-2019
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<vector>
#include<algorithm>
#include<iostream>
#include<deque>
// #include<unordered_map>
using namespace std;
int bin[40],lg[1<<21];
namespace mine
{
	typedef long long ll;
	#define double long double
	const int INF=0x3f3f3f3f;
	const ll LLINF=0x3f3f3f3f3f3f3f3fll;
	ll qread()
	{
		ll ans=0;char c=getchar();int f=1;
		while(c<'0' or c>'9') {if(c=='-') f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) {num=-num;putchar('-');}
		if(num>9) write(num/10);
		putchar('0'+num%10);
	}
	void writeln(int num){write(num);puts("");}
	#define FR first
	#define SE second
	#define MP make_pair
	#define pr pair<int,int>
	#define PB push_back
	#define vc vector
	void chmax(int &x,const int y) {x=x>y?x:y;}
	void chmin(int &x,const int y) {x=x<y?x:y;}
	const int MAX_N=5e5+10;
	const int MOD=1e9+7;
	void add(int &x,int y) {x+=y;if(x>=MOD) x-=MOD;if(x<0) x+=MOD;}

	struct SegmentTree
	{
		#define lc 2*x
		#define rc 2*x+1
		#define mid ((l+r)>>1)
		pr mx[MAX_N*4];
		void change(int x,int l,int r,int p,int c)
		{
			mx[x]=max(mx[x],MP(c,p));
			if(l==r) return;
			if(p<=mid) change(lc,l,mid,p,c);
			else change(rc,mid+1,r,p,c);
		}
		pr ask(int x,int l,int r,int fl,int fr)
		{
			if(fl>fr) return MP(0,0);
			if(l==fl and r==fr) return mx[x];
			if(fr<=mid) return ask(lc,l,mid,fl,fr);
			if(fl>mid) return ask(rc,mid+1,r,fl,fr);
			return max(ask(lc,l,mid,fl,mid),ask(rc,mid+1,r,mid+1,fr));
		}
	}sgt;

	int a[MAX_N],ans[MAX_N];
	int ru[MAX_N];vector<int> to[MAX_N];
	void ins(int x,int y) {ru[y]++;to[x].PB(y);}
	priority_queue<int> q;
	void main()
	{
		int n=qread(),K=qread();
		for(int i=1;i<=n;i++) a[qread()]=i;
		for(int i=1;i<=n;i++)
		{
			int num=a[i];sgt.change(1,1,n,num,i);
			pr a=sgt.ask(1,1,n,max(1,num-K+1),num-1);if(a.FR>0) ins(num,a.SE);
			pr b=sgt.ask(1,1,n,num+1,min(num+K-1,n));if(b.FR>0) ins(num,b.SE);
		}
		for(int i=1;i<=n;i++) if(ru[i]==0) q.push(i);
		for(int now=n;now>=1;now--)
		{
			int x=q.top();q.pop();ans[x]=now;
			for(int t=0;t<(int)to[x].size();t++)
			{
				int y=to[x][t];ru[y]--;
				if(ru[y]==0) q.push(y);
			}
		}
		for(int i=1;i<=n;i++) printf("%d ",ans[i]);
	}
};
int main()
{
	srand(time(0));
	bin[0]=1;for(int i=1;i<=30;i++) bin[i]=bin[i-1]<<1;
	lg[1]=0;for(int i=2;i<(1<<21);i++) lg[i]=lg[i>>1]+1;
	mine::main();
}


Measured memory_bytes: 60544
#25 ABC128C
n,m=map(int,input().split())
ks=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
res=0
for i in range(2**n):
	t=bin(i+2**n)[3:]
	judge=True
	for j in range(m):
		l=0
		for k in ks[j][1:]:
			if t[k-1]=="1":
				l+=1
		if l%2==p[j]:
			continue
		else:
			judge=False
			break
	if judge:
		res+=1
print(res)

Measured memory_bytes: 42388
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,k,x=0;
	cin>>n>>m>>k;
	for(int i=0;i<=n&&x==0;i++) for(int j=0;j<=m;j++) if(i*(m-j)+j*(n-i)==k) x++;
	if(x==0) cout<<"No";
	else cout<<"Yes";
	return 0;
}


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

using namespace std;
#define ll long long
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;

int main (){
    int n;
    cin >> n;
    vector<int> vec2(100001);
    vector<int> vec(n);
    REP(i,n){
        cin >> vec.at(i);
        vec2.at(vec.at(i))++;
    }
    int max = 0;

    REP(i,100000){
      if(i>0){
        if(max < vec2.at(i)+vec2.at(i+1)+vec2.at(i-1)){
            max = vec2.at(i) + vec2.at(i+1) + vec2.at(i-1);
        }
      }
      else if(i=0 && max < vec2.at(i) + vec2.at(i+1)){
        max = vec2.at(i) + vec2.at(i+1);
      
    }
    }
    cout << max << endl;


    return 0;
}

//RE REの場合はどうやら快方が違うことが多いらしい
/* 全部に足さなくてもその回数の個数を数える(-1とそのままと+1を数えるだけ)ことでいけるっぽぃ
計算量の概念を考える*/

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
		if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

int a[120];
int main() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> a[i];
    LL ans = 1, res = 1;
    for(int i = 1; i <= n; i ++) {
        ans = ans * 3;
        if(a[i] % 2 == 0) res *= 2;
    }
    printf("%lld\n", ans - res);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int c1;
	int c5;
	int c10;
	int c50;
	int c100;
	int c500;
	cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
	int a = 1 * c1;
	int b = 5 * c5;
	int c = c10 * 10;
	int d = c50 * 50;
	int e = c100 * 100;
	int f = c500 * 500;
	
	if (a + b + c + d + e + f >= 1000)
	{
		cout << 1 << endl;
	}
	else if (a + b + c + d + e + f <= 1000)
	{
		cout << 0 << endl;
	}


	return 0;
}





Measured memory_bytes: 3104
@count_num_inversion = 0

def merge(left, mid, right)
    leftArr = @array[left..mid]
    rightArr = @array[mid+1..right]
    leftArr.push(1000000001) #??¶?´??????§????????§???
    rightArr.push(1000000001)
    l = 0
    r = 0
    (left..right).each do |i|
        if leftArr[l] <= rightArr[r]
            @array[i] = leftArr[l]
            l += 1
        else
            @array[i] = rightArr[r]
            r += 1
            @count_num_inversion += (mid - left) - l + 1 
        end
    end
end

def mergeSort(left, right)
    mid = (left + right)/2
    if left + 1 < right
        mergeSort(left, mid)
        mergeSort(mid+1, right)
        merge(left, mid, right)
    elsif left + 1 == right
        merge(left, mid, right)
    end
end

n = gets.chomp.to_i
@array = gets.chomp.split.map(&:to_i)
mergeSort(0,n-1)
puts @count_num_inversion

Measured memory_bytes: 35176
X,Y = gets.chomp.split.map(&:to_i)

if (4*X-Y) < 0
  puts "No"
else
if (4*X-Y)%2 == 0
if (4*X-Y)/2 <= X
  puts "Yes"
else
  puts "No"
end
else
  puts "No"
end
end

Measured memory_bytes: 14288
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<math.h>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define f first
#define s second
#define inf 1000000007

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

int main(){
    ll N,K;
    scanf("%lld%lld",&N,&K);
    pl Q[100010];
    ll ctl[100010]= {0};
    ll num = 0;
    rep(i,N) {
        scanf("%lld%lld",&Q[i].s,&Q[i].f);
        if (ctl[Q[i].s] == 0){
            num ++;
            ctl[Q[i].s]++;
        }
    }
    vector<ll>P[100010];
    rep(i,N){
        P[Q[i].s].push_back(Q[i].f);
    }
    vector<ll>P1;
    vector<ll>P2;
    repi(i,1,100010){
        if (P[i].size() != 0){
            sort(P[i].begin(),P[i].end());
            reverse(P[i].begin(),P[i].end());
            P1.push_back(P[i][0]);
            if (P[i].size() > 1) repi(j,1,P[i].size()) P2.push_back(P[i][j]);
        }
    }
    ll s1 = P1.size();
    ll s2 = P2.size();
    sort(P1.begin(),P1.end());
    reverse(P1.begin(),P1.end());
    if (s2 > 0){
        sort(P2.begin(),P2.end());
        reverse(P2.begin(),P2.end());
    }
    ll ans= -inf;
    ll Pr1[100010] = {-inf};
    ll Pr2[100010] = {-inf};
    rep(i,s1+1){
        if (i > 0) Pr1[i] = Pr1[i-1]+P1[i-1];
        else Pr1[0] = 0;
    }
    if (s2 == 0) ans = Pr1[K] + pow(K,2);
    else{
        rep(i,s2+1){
            if (i > 0) Pr2[i] = Pr2[i-1]+P2[i-1];
            else Pr2[0] = 0;
        }
        rep(i,min(s1,K)+1){
            ll temp = 0;
            if (s2 < K-i) continue;
            temp = Pr1[i] + Pr2[K-i];
            ans = max(ans,temp+pow(i,2));
        }
    }
    cout << ans << endl;
    return 0;
}






Measured memory_bytes: 9716
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // int times = Integer.parseInt(sc.nextLine());
        // int bit = 0;

        String[] s = sc.nextLine().split(" ");

        int x1 = Integer.parseInt(s[0]);
        int x2 = Integer.parseInt(s[1]);
        int x3 = Integer.parseInt(s[2]);

        int cnt = 0;
        String rtn = "No";

        if (x1 < x2) {
            cnt = x1;
            for (int i = x1; i <= x2; i++) {
                if (cnt == x3) {
                    rtn = "Yes";
                    break;
                } else {
                    cnt++;
                }
            }
        } else {
            cnt = x2;
            for (int i = x2; i <= x1; i++) {
                if (cnt == x3) {
                    rtn = "Yes";
                    break;
                } else {
                    cnt++;
                }
            }
        }

        System.out.println(rtn);
        sc.close();
    }
}


Measured memory_bytes: 26068
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		long S = scn.nextLong();
		long X1, X2=-1, X3, Y1, Y2, Y3=-1;
		X1 = 0;
		Y1 = 0;

		if (S == 1000000000000000000L) {
			X2 = 0;
			Y3 = 0;
			Y2 = 1000000000L;
			X3 = 1000000000L;
		} else {
			long T = (long) Math.sqrt(S) + 1;
			Y2 = T;
			X3 = T;

			long SS = Y2 * X3 - S;

			for(long i = 1;i <= Math.sqrt(SS);i++) {
				if(SS%i==0) {
					X2 = i;
					Y3 = SS/i;
					if((X2 <= 1000000000L) && (Y3 <= 1000000000L))break;
				}
			}

		}
			System.out.println(X1 + " " + Y1 + " " + X2 + " " + Y2 + " " + X3 + " " + Y3);
	}
}

Measured memory_bytes: 22100
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace AtCoderABC123
{
    class Program
    {
        public static void Main(string[] args)
        {
            int[] p = new int[5];
            p[0] = int.Parse(Console.ReadLine());
            p[1] = int.Parse(Console.ReadLine());
            p[2] = int.Parse(Console.ReadLine());
            p[3] = int.Parse(Console.ReadLine());
            p[4] = int.Parse(Console.ReadLine());
            int[] q = p.OrderBy(x => x % 10).ToArray();
            int res = 0;
            int resi = -1;
            for (int i = 0; i < 5; i++)
            {
                if (q[i] % 10 == 0)
                {
                    res += q[i];
                }
                else
                {
                    if (resi == -1)
                    {
                        resi = i;
                    }
                    else
                    {
                        res += q[i] - (q[i] % 10) + 10;
                    }
                }
            }
            res += (resi == -1)? 0: q[resi];
            Console.WriteLine(res);
        }
    }
}

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


int main() {
    int n; cin >> n;
    vector<ll> b(n,0),v(n+1,0);
    rep2(i,n){
        cin >> b.at(i);
    }
    b.at(0)=b.at(1);
    rep2(i,n){
        v.at(i)=min(b.at(i),b.at(i-1));
    }
    v.at(n)=b.at(n-1);
    ll ans=0;
    rep2(i,n+1){
        ans+=v.at(i);
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define ll long long
#define ar array
const int SIZE = 1<<20;
int an[SIZE];
void solve() {
    FOR(x,1,100)
        FOR(y,1,100)
            FOR(z,1,100){
                an[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }
    int N;
    cin>>N;
    FOR(i,1,N)cout<<(an[i])<<endl;
}
int main() {
    solve();
}
   


Measured memory_bytes: 3796
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

#define NIL NULL

Node root;

Node treeMax(Node a){
  while(a->right!=NIL)a=a->right;
  return a;

}

Node treeMini(Node a){
  while(a->left!=NIL){
      a=a->left;
  }
  return a;

}



Node treeSearch(Node a, int b){
  while(a!=NIL&&b!=a->key){
    if(b<a->key)a=a->left;
    else a=a->right;
  }
  return b;
}

Node treeSuccess(Node a){
  Node b;
  if(a->right!=NIL)return treeMini(a->right);

  b=a->parent;
  while(b!=NIL && a==b->right){
    a=b;
    a=b->parent;
  }
  return a;
}

void treeDel(Node a){
  Node b;
  Node c; 
  if(a->left==NIL||a->right==NIL)b=a;
  else b=treeSuccess(a);

  if(b->left!=NIL)c=b->left;
  else c=b->right;

  if(c!=NIL)c->parent=b->parent;

  if(b->parent!=NIL)root=c;
  else if(b==b->parent->left)b->parent->left=c;
  else b->parent->right=c;

  if(b!=a)a->key=b->key;
  
}

void insert(int a){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = a;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key)
      x=x->left;
    else x=x->right;
  }
  z->parent=y;

  if(y==NIL)
    root=z;
  else if(z->key<y->key)
    y->left=z;
  else
    y->right=z;
    
}

void inorder(Node a){
  if(a==NIL)return;
  inorder(a->left);
  printf(" %d",a->key);
  inorder(a->right);
}
void preorder(Node a){
  if(a==NIL)return;
  printf(" %d",a->key);
  preorder(a->left);
  preorder(a->right);
}


int main(){
  int n, i, a;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &a);
      Node t = treeSearch(root, a);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &a);
      insert(a);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &a);
      treeDel(treeSearch(root, a));
    }
  }

  return 0;
}


Measured memory_bytes: 25128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int m=0,b,m2=0;
	for(int i=0;i<n;i++){
		if(m<=a[i]){
			m2=m;
			m=a[i];
			b=i;
		}
		else if(m2<=a[i]){
			m2=a[i];
		}
	}

	for(int i=0;i<n;i++){
		if(b==i) cout<<m2<<endl;
		else cout<<m<<endl;
	}
	
}

Measured memory_bytes: 2432
from collections import deque

n, m = map(int, input().split())
eg = [[] for _ in range(n + 1)]

al = [0] * m
bl = [0] * m

for i in range(m):
    a, b = map(int, input().split())
    eg[a].append(b)
    eg[b].append(a)
    al[i], bl[i] = a, b

ans = 0
for i in range(m):
    x, y = al[i], bl[i]
    q = deque()
    q.append(1)
    seen = {1}
    while q:
        v = q.pop()
        for t in eg[v]:
            if t in seen:
                continue
            elif (v == x and t == y) or (v == y and t == x):
                continue
            q.append(t)
            seen.add(t)
    if len(seen) != n:
        ans += 1
print(ans)


Measured memory_bytes: 70320
unittest
{
	assert( [ "2 2 2" ].parse.expand.solve == "Yes" );
	assert( [ "2 2 1" ].parse.expand.solve == "No" );
	assert( [ "3 5 8" ].parse.expand.solve == "Yes" );
	assert( [ "7 9 20" ].parse.expand.solve == "No" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nmk = input.front.split.to!( long[] );
	return tuple( nmk[ 0 ], nmk[ 1 ], nmk[ 2 ] );
}

auto solve( long n, long m, long k )
{
	for( auto h = 0L; h <= n; h++ )
	{
		for( auto w = 0L; w <= m; w++ )
		{
			if( h * ( m - w ) + w * ( n - h ) == k ) return "Yes";
		}
	}
	return "No";
}


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

#include <boost/operators.hpp>

class modint : private boost::operators<modint>, private boost::equivalent<modint> {
  modint(const long long x, const bool y)
      : x(x) {}

 public:
  static long long M;
  long long x;
  modint(const long long x = 0)
      : x((x % M + M) % M) {}
  modint operator-() const { return modint(x ? M - x : 0, true); }
  modint& operator+=(const modint& b) { return ((x += b.x) >= M ? x -= M : 0), *this; }
  modint& operator++() { return (++x >= M ? x -= M : 0), *this; }
  modint& operator-=(const modint& b) { return ((x -= b.x) < 0 ? x += M : 0), *this; }
  modint& operator--() { return (--x < 0 ? x += M : 0), *this; }
  modint& operator*=(const modint& b) { return x = x * b.x % M, *this; }
  modint& operator/=(const modint& b) { return *this *= b.pow(-1); }
  modint pow(long long b) const {
    long long r = 1, a = x;
    b = (b % (M - 1) + (M - 1)) % (M - 1);
    while (b) {
      if (b & 1) r = r * a % M;
      b = b >> 1;
      a = a * a % M;
    }
    return modint(r, true);
  }
  friend bool operator<(const modint& a, const modint& b) { return a.x < b.x; }
  friend std::istream& operator>>(std::istream& s, modint& a) { return s >> a.x, a = a.x, s; }
  friend std::ostream& operator<<(std::ostream& s, const modint& a) { return s << a.x; }
};
long long modint::M = 1000000007;

// #LIB#

using namespace std;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> a(m);
  rep(i, m) cin >> a[i];
  set<ll> as;
  rep(i, m) as.insert(a[i]);
  vector<modint> dp(n + 2);
  dp[0] = 1;
  rep(i, n) {
    if (as.find(i + 1) == as.end()) dp[i + 1] += dp[i];
    if (as.find(i + 2) == as.end()) dp[i + 2] += dp[i];
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 9408
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
long long a[100000];
long long gcd(long long a,long long b)
{
	return b?gcd(b,a%b):a;
}

int cmp(const long long &a,const long long &b)
{
	if (a%2==0 && b%2==1) return 1;
	else if (a%2==1 && b%2==0) return 0;
	else return a<b;
}
int main()
{
	int N,n;
	while(1)
	{
		long long x,y,z,tmp,r1,r2,d2,yh;
		unsigned long long m,p,q;

		scanf("%d",&n);
		if (n==0) break;
		N=(n+1)*n/2;
		for (int i=1;i<=N;i++) scanf("%lld",a+i);

		sort(a+1,a+N+1,cmp);
		x=a[n+1]; y=a[1];	z=a[2];

		tmp=gcd(y,z);	r1=y/tmp;	r2=z/tmp;
		d2=x/r1/r2;

		p=1;q=2147483640;
		while (p<=q)
		{
			m=(p+q)>>1;
			if (m*m==d2) break;
			else if (m*m<d2) p=m+1;
			else q=m-1;
		}
		tmp/=m;
		yh=tmp;
		tmp*=m;

		p=1;q=d2;

		printf("%lld\n",yh);
		for (int i=1;i<=n;i++)
			{
				if (i<n) printf("%lld ",a[i]/yh);
				else printf("%lld\n",a[i]/yh);
			}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iomanip>
using namespace std;
 
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
 
class Point{
    public:
        double x, y;
 
        Point(double x = 0, double y = 0): x(x), y(y) {}
 
        Point operator + (Point p){ return Point(x + p.x, y + p.y);}
        Point operator - (Point p){ return Point(x - p.x, y - p.y);}
        Point operator * (double a){ return Point(a * x, a * y);}
        Point operator / (double a){ return Point(x / a, y / a);}
 
        double abs(){ return sqrt(norm());}
        double norm(){ return x * x + y * y;}
 
        bool operator < (const Point &p) const{
            return x != p.x ? x < p.x : y < p.y;
        }
 
        bool operator == (const Point &p) const{
            return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
        }
};
 
class Circle{
    public:
        Point c;
        double r;
        Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};
 
double getDistance(Point a, Point b){
    return (a - b).abs();
}
 
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        Circle a, b;
        cin >> a.c.x >> a.c.y >> a.r >> b.c.x >> b.c.y >> b.r;
        if(a.r > (b.r + getDistance(a.c, b.c))) cout << 2 << endl;
        else if(b.r > (a.r + getDistance(a.c, b.c))) cout << -2 << endl;
        else if(a.r + b.r < getDistance(a.c, b.c)) cout << 0 << endl;
        else cout << 1 << endl;
    }
    return 0;
}


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

int main()
{
  int n,k;
  long long int sum=0;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  for(int i=0;i<n-k;i++)
  {
    sum+=a[i];
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>

int main(int argc, char const* argv[]) {
  using namespace std;

  int n;
  int h[100000];

  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> h[i];

  int max = 0;
  int count = 0;

  for (int i = n - 1; i > 0; i--) {
    if (h[i] <= h[i - 1]) {
      count++;
      if (count > max)
        max = count;
    }
	else
		count = 0;
  }

  cout << max;

  return 0;
}


Measured memory_bytes: 640
import sys

n_list = []
while True:
    try:
        n_list.append(int(input()))
    except:
        break
for n in n_list:
    sum_list = list(range(1, 1001)) + list(range(1001, 0, -1))
    ans = 0
    for i in range(min(n+1, 2001)):
        if 0<= (n-i) <= 2000:
            ans += sum_list[i]*sum_list[n-i]
    print(ans)



Measured memory_bytes: 5724
#include <stdio.h>

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

int main(){
	int n,i,prime[10000];
	for(i=3;i<10000;i++){
		prime[i]=isprime(i);
	}
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=n;i>=3;i--){
			if(prime[i]==1&&prime[i-2]==1){
				printf("%d %d\n",i-2,i);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1068
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
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 * b / gcd(a, b);
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int n, m;
	cin >> n >> m;
	if (n == m)cout << "Yes"<< endl;
	else cout << "No" << endl;
}
int main() {
	solve();
}

Measured memory_bytes: 256
import math
N = int(input())
temp = N
total = 0
for n in range(2,int(-(-math.sqrt(N)//1))+1):
  count1 = 1
  count2 = 0
  while temp%n==0:
    temp = temp//n
    count2+=1
    if count2 == count1:
      count2 = 0
      count1 += 1
      total += 1
if temp != 1:
  total += 1
print(total)

Measured memory_bytes: 9200
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a, b, c, d = map(int, input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		Random r = new Random();
		int N = sc.nextInt();
		long L = sc.nextLong();
		long T = sc.nextLong();
//		int N = 3;
//		long L = r.nextInt(100);
//		long T = r.nextInt(1000);
		int[] x = new int[N];
		boolean[] w = new boolean[N];
		ArrayList<Integer> cw = new ArrayList<>();
		ArrayList<Integer> ccw = new ArrayList<>();
		for(int i=0; i<N; i++) {
			x[i] = sc.nextInt();
			w[i] = sc.nextInt()==1;
//			x[i] = (i==0 ? 0 : x[i-1]) + r.nextInt(9) + 1;
//			w[i] = r.nextInt(2)==1;
			if(w[i])
				cw.add(x[i]);
			else
				ccw.add(x[i]);
		}
		Collections.reverse(cw);
		
		if(cw.size()==0 || ccw.size()==0) {
			for(int i=0; i<N; i++) {
				pw.println((x[i]+(w[i]? T%L : L-(T%L)))%L);
			}
		} else {
			long t=0;
			boolean dirCW = true;
			int cwIdx=0;
			int ccwIdx=(-1-Collections.binarySearch(ccw, cw.get(0)))%ccw.size();
			int lane1 = -1, lane2 = -1;
			boolean dir1=false;
			boolean init = true;
			while(t<2*L) {
				if(init) {
					t += (ccw.get(ccwIdx)-cw.get(cwIdx)+L) % L;
					cwIdx++;
					ccwIdx++;
					init = false;
				} else if(dirCW) {
					int next = ccw.get(ccwIdx%ccw.size()) - ccw.get((ccwIdx-1)%ccw.size());
					if(next<=0)
						next += L;
					t += next;
					ccwIdx++;
				} else {
					int next = cw.get((cwIdx-1)%cw.size()) - cw.get(cwIdx%cw.size());
					if(next<=0)
						next += L;
					t += next;
					cwIdx++;
				}
				if(lane1==-1 && t>=2*(T%L)) {
					lane1 = dirCW ? cw.get((cwIdx-1)%cw.size()) : ccw.get((ccwIdx-1)%ccw.size());
					dir1 = dirCW;
				}
				if(lane2==-1 && t>=2*L) {
					lane2 = dirCW ? cw.get((cwIdx-1)%cw.size()) : ccw.get((ccwIdx-1)%ccw.size());
				}
				dirCW ^= true;
			}
			int gap2 = Arrays.binarySearch(x, lane2) - Arrays.binarySearch(x, cw.get(0));
			
			int[] pos = new int[N];
			for(int i=0; i<N; i++)
				pos[i] = (int)((x[i]+(w[i]? T%L : L-(T%L)))%L);
			Arrays.sort(pos);
			
			lane1 = (int)((lane1 + (dir1 ? T : L-(T%L)))%L);
			int idx = Arrays.binarySearch(pos, lane1);
			if(idx>0 && pos[idx-1]==pos[idx])
				idx--;
			if(idx<N-1 && pos[idx]==pos[idx+1] && !dir1)
				idx++;
			idx = (idx - Arrays.binarySearch(x, cw.get(0)) + N)%N;
			idx = (int)((idx + ((long)gap2+N)*(T/L))%N);
			
			
			long cnt = 0;
			for(int ccwx : ccw) {
				long dis = (ccwx-cw.get(0)+L)%L;
				cnt = (cnt + (2*T + L-dis-1)/L)%N;
			}
			
			int a = Arrays.binarySearch(pos, (int)((cw.get(0)+T)%L));
			if(a>0 && pos[a-1]==pos[a])
				a--;
			int cidx = (a - Arrays.binarySearch(x, cw.get(0)) - (int)cnt + N + N)%N;
			
			for(int i=0; i<N; i++)
				pw.println(pos[(idx+i)%N]);
//			if(cidx!=idx) {
//				pw.println("OK :"+cidx);
//				pw.println("NG :"+idx);
//			}
		}
		
		sc.close();
		pw.close();
	}
}


Measured memory_bytes: 90384
#!/usr/bin/env python3
#ABC102 C

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

B = [A[i]-(i+1) for i in range(N)]
B.sort()
b = B[N//2]
ans = 0
for i in range(N):
    ans += abs(A[i]-(b+i+1))
print(ans)


Measured memory_bytes: 99796
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')
# ----------------------------------------------------------- #

n, A, B, C = Is()
L = IR(n)

def dfs(i, a, b, c):
    if i == n:
        return abs(A-a) + abs(B-b) + abs(C-c) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(i+1, a, b, c)
    ret1 = dfs(i+1, a+L[i], b, c) + 10
    ret2 = dfs(i+1, a, b+L[i], c) + 10
    ret3 = dfs(i+1, a, b, c+L[i]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))


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

#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)

namespace solver {
  using namespace std;
  typedef long long ll;

  // static const ll MAX = 100010LL;
  ll N, X, Y, sz[2020];
  // ll xs[MAX], ys[MAX];

  void init() {
    scanf("%lld %lld %lld", &N, &X, &Y);
    // rep(i, N) scanf("%lld %lld", &xs[i], &ys[i]);
  }

  void solve() {
    rep1c(i, N-1) {
      for(ll j=i+1; j<=N; j++) {
        ll k = min(abs(i-j), min(abs(i-X)+abs(j-Y)+1, abs(i-Y)+abs(j-X)+1));
        sz[k]++;
      }
    }
    rep1c(k, N-1) printf("%lld\n", sz[k]);
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()

wcount = [0 for i in range(N)]
ecount = [0 for i in range(N)]
sumcount = [0 for i in range(N)]

for i in range(1,N):
    if i == 0:
        continue
    elif i > 0 and S[i-1] == "W":
        wcount[i] = wcount[i-1] + 1
    elif i > 0:
        wcount[i] = wcount[i-1]
 
for i in reversed(range(N)):
    if i == N:
        continue
    elif i < N-1 and S[i+1] == "E":
        ecount[i] = ecount[i+1] + 1
    elif i < N-1:
        ecount[i] = ecount[i+1]
    

for i in range(N):
    sumcount[i] = wcount[i] + ecount[i]

print(min(sumcount))

Measured memory_bytes: 29728
#include<bits/stdc++.h>
#include<bitset>
#include<string>
using namespace std;
#include <numeric> 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using pi=pair<long long,long long>;
#define pii 3.1415926536
#define binary
#define mod 1000000007
typedef long long ll;
typedef long double ld;
bool sortbysec(const pair<long long,long long> &a, 
              const pair<long long,long long> &b) 
{ 
    return (a.first < b.first); 
}
bool compare(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll>&b)
{
    if(a.first.first==b.first.first)return (a.first.second<b.first.second);
    return (a.first.first < b.first.first); 
}
 int lcm(int a, int b)  
 {  
    return (a*b)/__gcd(a, b);  
 }  
 int Kad(ll dp[],ll n)
{
  ll curr_max=0,maxx=INT_MIN;
  for(int i=0;i<n;i++)
  {
    curr_max=curr_max+dp[i];
    if(curr_max>maxx)
      maxx=curr_max;

    if(curr_max<0)
      curr_max=0;
   
  }

  return maxx;
}

/*void dfs(int u)
{
    vis[u]=true;
    //cout<<u<<" ";
    std::vector<ll> ::iterator i;
     for (i = g[u].begin(); i != g[u].end(); ++i) 
        if (!vis[*i]) 
            dfs(*i); 
    for(int i=1;i<g[u].size();i++)
    {
        if(!vis[g[u][i]])
        {
            dfs(i);
        }
    }
}*/
/*void build_tree(ll tree[],ll a[],ll start,ll end,ll node)
{
    if(start==end)
    {
        tree[node]=a[start];
        return;
    }
    int mid=(start+end)/2;
    build_tree(tree,a,start,mid,2*node);
    build_tree(tree,a,mid+1,end,2*node+1);
    tree[node]=min(tree[2*node],tree[2*node+1]);
}
ll query_tree(ll tree[],ll a[],ll qs,ll qe,ll start,ll end,ll node)
{
    if(start>=qs && end<=qe)
    {
        return tree[node];
    }
    if(start>qe || end<qs)
        return INT_MAX;
    int mid=(start+end)/2;
    int left_tree=query_tree(tree,a,qs,qe,start,mid,2*node);
    int right_tree=query_tree(tree,a,qs,qe,mid+1,end,2*node+1);

    return min(left_tree,right_tree);
}*/


int main()
{

 #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
  #endif  
  IOS;
  ld d,t,s;
  cin>>d>>t>>s;
  if((d/s)<=t)
  {
    cout<<"Yes"<<endl;
  }
  else
    cout<<"No"<<endl;

}
                                  
   

  

Measured memory_bytes: 3736
n,m = gets.split.map(&:to_i)
students = []
checkpoints = []

inf = 10 ** 9

n.times do
  students << gets.split.map(&:to_i)
end

m.times do
  checkpoints << gets.split.map(&:to_i)
end

students.each do |x, y|
  min = inf
  min_point = inf
  checkpoints.each.with_index(1) do |(px, py), i|
    dis = (x-px).abs + (y-py).abs
    if dis < min
      min = dis
      min_point = i
    end
  end
  puts min_point
end

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long x, y;
    cin >> x >> y;
    int res = 1;
    while (powl(2, res) * x <= y) res++;
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int flag=0;
  int si=s.size();
  rep(i,si){
    if(s[i]=='A'){
      if(s[i+1]=='C'){
	flag=1;
      }
    }
  }
  if(flag==1){
    cout<<"Yes"<<'\n';
  }
  else{
    cout<<"No"<<'\n';
  }
  return(0);
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  for (i64 i = 0; i < 5; i++)
  {
    i64 x;
    cin >> x;
    if (x == 0)
    {
      cout << i + 1 << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        System.out.println(a==b?"a == b":a<b?"a < b":"a > b");
    }
}


Measured memory_bytes: 26324
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
using namespace std;
const int N = 55;
int vis[N];
int a[N];
int ans;
void dfs(int minans, int d){

	if(a[d] == 0 && d != 0){
		ans = max(minans, ans);
//		cout << " ans  = " << ans << endl;
		return;
	}
	int tmp;
	if(vis[a[d]] == 1){
		tmp = 13;
		for(int i = 0; i < d; i++){
			if(a[d] > a[i]){
				tmp = min(tmp, a[d] - a[i]);	
				tmp = min(tmp, 24 - a[d] + a[i]);
			}
			else {
				tmp = min(tmp, a[i] - a[d]);
				tmp = min(tmp, 24 - a[i] + a[d]); 
			} 
		}
//		system("pause");
//		cout << d << "  " << minans  << " " <<  tmp  << " now is a[d] " << a[d] << endl;  
		dfs(min(tmp, minans), d + 1);//a[d]
		tmp = 13;
		for(int i = 0; i < d; i++){
			if(24 - a[d] > a[i]){
				tmp = min(tmp, 24 - a[d] - a[i]);	
				tmp = min(tmp, a[d] + a[i]);
			}
			else {
				tmp = min(tmp, a[i] - 24 + a[d]);
				tmp = min(tmp, 48 - a[i] - a[d]); 
			} 
		}
		a[d] = 24 - a[d];
//		system("pause");
//		cout << d << "  " << minans  << " " <<  tmp << " now is 24-a[d] " << a[d] << endl;  
		dfs(min(tmp, minans), d + 1);//24-a[d]
		
		a[d] = 24 - a[d];	
	}
	else {
		tmp = 13;
		for(int i = 0; i < d; i++){
			if(a[d] > a[i]){
				tmp = min(tmp, a[d] - a[i]);	
				tmp = min(tmp, 24 - a[d] + a[i]);
			}
			else {
				tmp = min(tmp, a[i] - a[d]);
				tmp = min(tmp, 24 - a[i] + a[d]); 
			} 
		}
		dfs(min(tmp, minans), d + 1);//24-a[d]
	}
}
int main(){
	int n;
	while(~scanf("%d", &n)){
		ans = 13;
		memset(vis, 0, sizeof(vis));
		memset(a, 0, sizeof(a));
		vis[0] = 1;
		int x;
		a[0] = 0;
		for(int i = 1; i <= n; i++){
			scanf("%d", &x);
			a[i] = x;
			vis[x]++;
		}
		if(n > 26){
			puts("0");
			continue;
		}
		for(int i = 0; i <= 12; i++){
			if(vis[i] >= 3){
				ans = 0;
				break;
			}
		}
		if(ans != 0){
			for(int i = 0; i <= 12; i++){
				if(vis[i] == 2){
					int flag = 0;
					for(int j = 0; j <= n; j++){
						if(a[j] == i){
							if(!flag){
								flag = 1;
							}
							else{
								a[j] = 24 - i;
								break;
							}							
							
						}
					}
				}
			}
			ans = 0;
			dfs(13, 1);	
		}
		printf("%d\n", ans);
		 
	}
}

Measured memory_bytes: 256
// ABC097 
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
if(abs(b-a)<=d&&abs(b-c)<=d){
    cout<<"Yes"<<endl;
}
    else if(abs(c-a)<=d){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
}
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define MAX 1000007
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
	int n, a, b;
	cin >> n >> a >> b;
	int c = 0;
	if((b-a)%2 == 0)
		cout << (b-a)/2;
	else {
			if(a == 1) {
				cout << (b-1)/2 + 1;
			}
			else if(b == n) {
				cout << (n-a)/2 + 1;
			}
			else {
				int z1 = b-1; // left
				int z2 = n-a; // right
				if(z2 > z1) {	//left < right
					c += a-1;
					b = b-(a-1);
					a = 1;
					c += (b-a)/2 + 1;
					cout << c;
				}
				else {	// left > right
					c += n-b;
					a += n-b;
					b = n;
					c += (b-a)/2 + 1;
					cout << c;
				}
			}
	}
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}


Measured memory_bytes: 256