akhauriyash/Code-Regression huggingface dataset:
//https://atcoder.jp/contests/abc125/tasks/abc125_d
#include<iostream>
using namespace std;

int main(){
    int N;
    cin >> N;
    int *A = new int[N];
    for(int i = 0; i<N;i++){
    cin >> A[i];
    }

    int ncount=0;
    bool zeroex=false;
    for(int i=0;i<N;i++){
        if(A[i]<0){
            ncount++;
        }else if(A[i]==0){
            zeroex=true;
            break;
        }
    }

    int *B = new int[N];
    //if(ncount%2==0||zeroex){
        for(int i=0;i<N;i++){
            if (A[i]<0){
                B[i]=A[i]*-1;
            }else{
                B[i]=A[i];
            }
        }
    //}
    int nMax=0;
    if(ncount%2==1&&!zeroex){//絶対値の最小値を見つける
        nMax=B[0];
        for(int i=0;i<N;i++){
            if(nMax>B[i]){
                nMax=B[i];
            }
        }
        //cout<<nMax<<endl;
    }
    long long Bsum=0;
    for(int i=0;i<N;i++){
        Bsum+=B[i];
    }
    //cout<<Bsum<<endl;
    Bsum-=nMax*2;
    
    cout<<Bsum<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;

    int ans[N + 1] = {};
    REP(i, 1, 101) {
        REP(j, 1, 101) {
            REP(k, 1, 101) {
                int num = i * i + j * j + k * k + i * j + j * k + i * k;
                if (num < N + 1) ans[num]++;
            }
        }
    }

    REP(i, 1, N + 1) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3648
namespace VainZero.Procon.FSharp

open System
open System.Collections.Generic

[<AutoOpen>]
module Operators =
  let read f = Console.ReadLine().Split([|' '|]) |> Array.map f

module Program =
  type Color =
    | Gray
    | Brown
    | Green
    | LightBlue
    | Blue
    | Yellow
    | Orange
    | Red

  let colorFromRate rate =
    if 1 <= rate && rate <= 399 then
      Some Gray
    else if 400 <= rate && rate <= 799 then
      Some Brown
    else if 800 <= rate && rate <= 1199 then
      Some Green
    else if 1200 <= rate && rate <= 1599 then
      Some LightBlue
    else if 1600 <= rate && rate <= 1999 then
      Some Blue
    else if 2000 <= rate && rate <= 2399 then
      Some Yellow
    else if 2400 <= rate && rate <= 2799 then
      Some Orange
    else if 2800 <= rate && rate <= 3199 then
      Some Red
    else
      None

  [<EntryPoint>]
  let main _ =
    let [|n|] = read int
    let rs = read int
    let calc () =
      let colors = rs |> Array.map colorFromRate
      let distinctColors = colors |> Array.choose id |> Array.distinct
      let anyColorPlayerCount = colors |> Seq.filter ((=) None) |> Seq.length
      let minColorCount = distinctColors.Length |> max 1
      let maxColorCount = distinctColors.Length + anyColorPlayerCount
      (minColorCount, maxColorCount)

    let (min, max) = calc ()
    printfn "%d %d" min max
    0


Measured memory_bytes: 13272
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const long long INF = 1LL << 60;
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
using P=pair<int,int>;
signed _main(){
  int N; cin >> N;
  v<P> ts(N);
  rep(i,N){
    int x,l; cin >> x >> l;
    ts[i].first=x+l;
    ts[i].second=x-l;
  }
  sort(ts.begin(),ts.end());
  int ans=0,t=-1*INF;
  for(int i=0;i<N;i++){
    if(t<=ts[i].second){
      ans++;
      t=ts[i].first;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import sys
readline = sys.stdin.readline

MOD = 10**9+7

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

res = 0
res2 = 0
for a in A:
    res = (res + a)%MOD
    res2 = (res2 + a*a)%MOD


print(pow(2, MOD-2, MOD)*(res**2 - res2)%MOD)

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

    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        int payment = Integer.valueOf(scanner.nextLine());
        
        int change = 0;
        
        while(payment > 0) {
            
            payment -= 1000;
            
        }
        
        change = payment * -1;
        System.out.println(change);
        
    }
}

Measured memory_bytes: 35604
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define vi vector<int>
#define pb push_back
#define SZ(x) (int) x.size()
using namespace std;
const int MAXN = 310;
int n, m, l, q, dis[MAXN][MAXN], f[MAXN][MAXN];
void work() {
  scanf("%d%d%d", &n, &m, &l), memset(dis, 0x3f, sizeof(dis));
  for(reg int i = 1; i <= m; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c), dis[a][b] = dis[b][a] = c;
  }
  for(reg int k = 1; k <= n; ++k) for(reg int i = 1; i <= n; ++i) for(reg int j = 1; j <= n; ++j) dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
  for(reg int i = 1; i <= n; ++i) for(reg int j = 1; j <= n; ++j) {
    if(dis[i][j] <= l) f[i][j] = f[j][i] = 1;
    else f[i][j] = 0x3f3f3f3f;
  }
  for(reg int k = 1; k <= n; ++k) for(reg int i = 1; i <= n; ++i) for(reg int j = 1; j <= n; ++j) f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
  scanf("%d", &q);
  for(reg int i = 1; i <= q; ++i) {
    int s, t;
    scanf("%d%d", &s, &t);
    if(f[s][t] != 0x3f3f3f3f) printf("%d\n", f[s][t] - 1);
    else puts("-1");
  }
}
int main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) work();
  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{
	int N, X, Y;
	scanf("%d %d %d", &N, &X, &Y);
	
	int Ans[2000];
	for(int i = 0; i < N; i++){
		Ans[i] = 0;
	}
	
	for(int i = 1; i < N; i++){
		for(int j = i+1; j < N+1; j++){
			int d;
			if(i < X){
				if(j < X){
					d = j - i;
				}
				else if(j < Y){
					d = min(j - i, X-i + 1 + Y-j);
				}else{
					d = X-i + 1 + j-Y;
				}
			}else if(i < Y){
				if(j < Y){
					d = min(j - i, i - X + 1 + Y - j);
				}
				else{
					d = min(j - i, i - X + 1 + j - Y);
				}
			}else{
				d = j - i;
			}
			
			//printf("%d %d %d\n", i, j, d);
			
			Ans[d]++;
		}
	}
	
	for(int i = 1; i < N; i++){
		printf("%d\n", Ans[i]);
	}
	
	return 0;
}

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

int main() {
  int n , m;
  cin >> n >> m;
  vector<int> g(n,1);
  int minl = 1;
  int maxr = n;
  for(int i = 0;i<m;i++){
    int l,r;
    cin >> l >> r;
    if( minl <l ){
      minl =l;
    }
    if( maxr >r){
      maxr = r;
    }
  }
  if(maxr - minl +1 > 0){
    cout << maxr - minl +1;
  }
  else{
    cout << "0" ;
  }
 
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
     int i,n,c=0;
    cin>>n;
    
    while(n>0){
        if(n%10==7){
            cout<<"Yes";
            return 0;
            break;
            
        }
        n=n/10;
        
    }
    
    cout<<"No";
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
#define SQ 320
//#define N 1000005
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,z,m,q,h,r,timer,mx;
ll a[100500];
int main() {
    //freopen("input.txt","r",stdin);
    ll N, h, n, w;
    cin >> N;
    for (h = 1; h <= 3500; h++)
        for (n = 1; n <= 3500; n++)
        {
            ll up = N*h*n;
            ll down = 4*h*n - N*n - N*h;
            if (down > 0 && up % down == 0 && up/down <= 3500)
            {
                cout << h << " " << n << " " << up/down << endl;
                return 0;
            }
        }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////

int main(){
    int n,m;
    cin >> n >> m;
    double ans = (1900*m + 100*(n-m)) * pow(2, m) * 1.0;
    cout << ans << endl;
}

Measured memory_bytes: 4160
import sys
from io import StringIO
import unittest

modn=1000000007

def resolve():
    n = input()
    inputs = list(map(int, input().split()))
    sum_value = sum(inputs)% modn
    ans=0
    for i in range(len(inputs)-1):
        v = inputs[i]
        sum_value = sum_value - v
        add_value = (v * sum_value) % modn
        ans+=add_value
        ans = ans%modn
    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1 2 3"""
        output = """11"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4
141421356 17320508 22360679 244949"""
        output = """437235829"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 104616
/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;

int n, a, b;

int main(){
	scanf("%d%d%d", &n, &a, &b);
	printf("%d\n", min(n * a, b));
	return 0;
}



Measured memory_bytes: 256
n = gets.to_i
b = gets.split(' ').map(&:to_i)


sum = b[0]
for i in 1..n-2 do

  if b[i] <= b[i-1] then
    sum += b[i]
  else
    sum += b[i-1]
  end
end
sum+=b[n-2]

puts sum

  

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
#include <iomanip>
using namespace std;

int main(){
    int a,b,c; cin >> a >> b >> c;
    if (c-(a-b) >= 0) cout << c-(a-b) << endl;
    else cout << 0 << endl;    
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
}


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

#define N 500000
#define INFTY 1000000001

void mergeSort(int, int);
void merge(int, int, int);

int A[N], c = 0;

int main(){
  
  int i, n, left, mid, right;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &A[i]);
  
  left = 0;
  right = n;

  mergeSort(left, right);

  for(i = 0; i < n; i++){
    if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  
  printf("\n%d\n", c);

  return 0;
  
}

void merge(int left, int mid, int right){
  
  int n1, n2, i, j, k;
  int L[N], R[N];
  
  n1 = mid - left;
  n2 = right - mid;
  
  for(i = 0; i < n1; i++) L[i] = A[left + i];
  for(i = 0; i < n2; i++) R[i] = A[mid + i];
  
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  
  for(k = left; k < right; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      c++;
    }
    else {
      A[k] = R[j];
      j = j + 1;
      c++;
    }
  }
}

void mergeSort(int left, int right){
  
  int mid;
  
  if(left + 1 < right){
    mid = (left + right)/2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}

Measured memory_bytes: 5488
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
#include<math.h>
#include<list>

using namespace std;

int main() {
	int  X, N, M;
	cin >> X >> N >> M;

	if (abs(X-N)>abs(X-M))	cout << "B" << endl;
	else cout << "A" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
const int MAXN = 100500;

int arr[MAXN];
int n;


int main()
{                                                     
	ios_base::sync_with_stdio(0);
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
		arr[i]--;
	}	

	int ans = 0;

	for (int i = 0; i < n; i++)
	{
		if (arr[i] == i)
		{
			swap(arr[i], arr[i + 1]);
			ans++;
		}
	}
	

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<vector>

using namespace std;



int main(){
  int N; cin >> N;
       if(100 <= N && N <= 111){cout << 111;}
  else if(112 <= N && N <= 222){cout << 222;}
  else if(223 <= N && N <= 333){cout << 333;}
  else if(334 <= N && N <= 444){cout << 444;}
  else if(445 <= N && N <= 555){cout << 555;}
  else if(556 <= N && N <= 666){cout << 666;}
  else if(667 <= N && N <= 777){cout << 777;}
  else if(778 <= N && N <= 888){cout << 888;}
  else if(889 <= N && N <= 999){cout << 999;}
  
  return 0;}
  

Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;



int n;
long long a[100005], dp[100005];

int main(int argc, const char * argv[]) {
//    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (i > 1) {
            dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
            if (i > 2) dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]));
        }
    }
    cout << dp[n] << '\n';
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int N,Y;
int main()
{
	cin>>N>>Y;
	for(int i=0;i<=N;i++)
	{
		for(int j=0;j<=N;j++)
		{
			int k=N-i-j;
			if(k>=0&&10000*i+5000*j+1000*k==Y)
			{
				cout<<i<<' '<<j<<' '<<k;
				return 0;
			}
		}
	}
	cout<<-1<<' '<<-1<<' '<<-1;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <iostream>
#include <cstring>
#include <cstdio>


#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define f(n) for (ll i = 0; i < n; i++)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	ll l, r;
	cin >> l >> r;
	int m = l * (l + 1) % 2019;
	for (ll i = l; i <= (l / 2019 + 1) * 2019 && i <= r; i++) for (ll j = l; j < i; j++) if (i * j % 2019 < m) m = i * j % 2019;
	cout << m << '\n';
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 1;
    char c = s.at(0);
    for (int i = 1; i < n; ++i) {
        if (s.at(i) != c) {
            ++ans;
        }
        c = s.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
function main(input) {
    var inputs = input.split('\n');
    var num = parseInt(inputs[0],10);
    var str = inputs[1];
    var strhalf = str.substring(0,num/2);
    if(str == (strhalf + strhalf))
        console.log('Yes');
    else
        console.log('No');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
const int dh[8] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dw[8] = {1, 0, -1, 0, 1, 1, -1, -1};

inline void solve(int n, const string& s, int k) {
    long long d = 0, m = 0, dm = 0, dmc = 0;
    
    auto add = [&] (int i) {
        if (s[i] == 'D') d++;
        if (s[i] == 'M') m++, dm += d;
        if (s[i] == 'C') dmc += dm;
    };
    auto erase = [&] (int i) {
        if (s[i] == 'D') d--, dm -= m;
        if (s[i] == 'M') m--;
    };
    
    int l = 0;
    for (int r = 0; r < n; r++) {
        while (l < n && abs(l - r) < k) add(l++);
        erase(r);
    }
    
    cout << dmc << endl;
    return;
}


int main() {
    int n, q;
    string s;
    cin >> n >> s >> q;
    while (q--) {
        int k;
        cin >> k;
        solve(n, s, k);
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N+2; i++) {
    double j = i*1.08;
    if ((int)j == N) {
      cout << i << endl;
      break;
    } else if (i == N+1) {
      cout << ":(" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>

#define REP(i, b) for (int i = 0 ; i < b ; i++ )
typedef long long ll;
using namespace std;

int main() {
    int N, D, A;
    cin >> N >> D >> A;
    vector<pair<int, int>> monsters;
    int coordinates[N + 1];
    ll boms[N + 1];
    fill(boms, boms + (N + 1), 0);

    REP(i, N) {
        int x, h;
        cin >> x >> h;
        monsters.emplace_back(x, h);
    }
    sort(monsters.begin(), monsters.end());
    REP(i, N) {
        coordinates[i] = monsters[i].first;
    }
    ll ans = 0;
    REP(i, N) {
//        printf("monster on  %d is damaged %lld\n", monsters[i].first, boms[i]);

        if (boms[i] >= monsters[i].second) {
  //          printf("monster on  %d is already dead\n", monsters[i].first);
            boms[i + 1] += boms[i];

            continue;
        }
        ll resthp = monsters[i].second - boms[i];
        ll restboms = (resthp + A - 1) / A;
//        printf("put %lld boms at %d\n", restboms, coordinates[i]);

        ans += restboms;
        int boundary = coordinates[i] + D * 2;
        int left = 0, right = N ;
        while ((right - left) > 1) {
            int mid = (left + right) / 2;
            if (coordinates[mid] <= boundary) {
                left = mid;
            } else {
                right = mid;
            }
        }
//        printf("this bomb will affect on monster on %d\n", monsters[left].first);
        boms[i] += restboms * A;
        boms[right] -= restboms * A;

        boms[i + 1] += boms[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4724
#include <stdio.h>
int main(void){
	int a,b,c;
	int cont=0, valor;
	scanf("%d %d %d",&a,&b,&c);
	for(int i=100;i>0;i--){
		if(a%i==0 && b%i==0){
			cont++;
			if(cont==c){printf("%d\n", i);break;}
	}
	}
	return 0;}


Measured memory_bytes: 128
s = input()
q = int(input())
mode = False
mae = ""
usiro = ""

for i in range(q):
  q_list = list(input().split())
  if q_list[0] == "1":
    mode = not mode
  else:
    if mode:
      if q_list[1] == "1":
        usiro = usiro + q_list[2]
      else:
        mae = q_list[2] + mae
    else:
      if q_list[1] == "1":
        mae = q_list[2] + mae  
      else:
        usiro = usiro + q_list[2]
if mode:
  print(usiro[::-1]+s[::-1]+mae[::-1])
else:
  print(mae+s+usiro)

Measured memory_bytes: 4452
#include <bitset>
#include <tuple>
#include <string>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <utility>
#ifdef LOCAL
  #include <iostream>
#endif
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define all(v) v.begin(), v.end()

typedef long long ll;

#ifdef LOCAL
  #define debug_echo(e) cout << "L" << __LINE__ << ": " << e << "\n"
  #define debug_repr(e) cout << "L" << __LINE__ << ": " << #e << " -> " << e << "\n"
#else
  #define debug_echo(e)
  #define debug_repr(e)
#endif

#define defread(T, fmt) \
  inline T read_ ## T() { \
    T result; \
    scanf(fmt, &result); \
    return result; \
  }
defread(int, "%d")
defread(ll, "%lld")
defread(float, "%f")
defread(double, "%lf")

int gcd(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n) m -= n;
    else       n -= m;
  }
  return m;
}
int lcm(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  return (m / gcd(m, n)) * n;
}

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

  rep1(k, M) {
    rep(i, N-1) {
      if (A[i] % k > A[i+1] % k) {
        swap(A[i], A[i+1]);
      }
    }
  }
  rep(i, N) printf("%d\n", A[i]);
}

Measured memory_bytes: 2708
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
    R int res,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
const int N=3005,P=1e9+7,inv2=500000004;
inline void Add(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))if(y&1)res=mul(res,x);
	return res;
}
struct node{int x,y;}p[N];
int f[N][N],ans[2][N][N],a[N];
int n,q,res;
void solve(int pos){
	int tag=1;
	fd(t,q,1){
		tag=mul(tag,2);
		int x=p[t].x,y=p[t].y;
		int c=f[x][y],d=f[y][x];
		fp(i,1,n)if(i!=x&&i!=y){
			f[x][i]=f[y][i]=mul(add(f[x][i],f[y][i]),inv2),
			f[i][x]=f[i][y]=mul(add(f[i][x],f[i][y]),inv2);
		}
		f[x][y]=f[y][x]=mul(add(c,d),inv2),f[x][x]=f[y][y]=0;
	}
	fp(i,1,n)fp(j,1,n)ans[pos][i][j]=mul(f[i][j],tag);
}
void init(){
	fp(i,1,n)fp(j,1,n)f[i][j]=0;
	fp(i,1,n)fp(j,i+1,n)f[i][j]=1;
	solve(0);
	fp(i,1,n)fp(j,1,n)f[i][j]=0;
	fp(i,1,n)fp(j,1,i-1)f[i][j]=1;
	solve(1);
}
int main(){
//	freopen("testdata.in","r",stdin);
	n=read(),q=read();
	fp(i,1,n)a[i]=read();
	fp(i,1,q)p[i].x=read(),p[i].y=read();
	init();
	fp(i,1,n)fp(j,i+1,n)Add(res,a[i]==a[j]?0:a[i]>a[j]?ans[0][i][j]:ans[1][i][j]);
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 106752
#include <stdio.h>
int main(void)
{
  int i,j;
  int A,B;

  scanf("%d %d",&A,&B);

  if ( A - B < A + B ){
    if ( A + B < A * B)
      printf("%d\n", A * B);
    else 
      printf("%d\n", A + B);
  }
  else{
    if ( A - B < A * B)
      printf("%d\n", A * B);
    else
      printf("%d\n", A - B);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b; string s;
    cin >> a >> b >> s;
    bool check = true;
    if(s.size() != a+b+1) check = false;
    if(s[a]!='-') check = false;
    rep(i,a){
        char c = s[i];
        if(c < '0' || '9' < c) check = false;
    }
    for(int i=a+1;i<=a+b;i++){
        char c = s[i];
        if(c < '0' || '9' < c) check = false;
    }
    cout << (check ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		long min = 2018;
		for (long i = l; i < r; i++) {
			if (min == 0)
				break;
			for (long j = i + 1; j <= r; j++) {
				if (i * j % 2019 < min)
					min = i * j % 2019;
				if (min == 0)
					break;
			}
		}

		System.out.println(min);
	}
}


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

signed main(){
    ll h;
    cin >> h;
    ll ans=0;
    int save=1;
    while(h>0){
        ans+=save;
        save*=2;
        h>>=1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n=gets.to_i
fs=[0]*n
1.upto(100){|x|
  s1=x*x
  break if s1>=n
  1.upto(100){|y|
    s2=s1+y*y+x*y
    xpy=x+y
    break if s2>=n
    1.upto(100){|z|
      s=s2+z*z+z*xpy
      break if s>n
      fs[s-1]+=1
    }
  }
}
puts fs

Measured memory_bytes: 14288
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

import sys
from itertools import accumulate


def main():
    input = sys.stdin.readline
    n, q = [int(i) for i in input().split()]
    s = input().strip()
    qs = [[int(i) for i in input().split()] for _ in range(q)]
    hoges = [0] + [1 if s[i : i + 2] == "AC" else 0 for i in range(n - 1)]
    hoges = list(accumulate(hoges))
    for (l, r) in qs:
        print(hoges[r - 1] - hoges[l - 1])


if __name__ == "__main__":
    main()

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 100 + 5;
const int MAX_N = 1e7 + 5;

long long dp[MAX_N][3];
long long nCr(int n, int r) {
    if (n == r) return dp[n][r] = 1;
    if (r == 0) return dp[n][r] = 1;
    if (r == 1) return dp[n][r] = n;
    if (dp[n][r]) return dp[n][r];
    return dp[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1)) % M;
}

int main() {
    int n;
    cin >> n;
    unordered_map<string, int> mp;
    ll ans = 0;
    rep(i, n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ans += mp[s];
        mp[s]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 10660
#include<iostream>
#include<vector>

using namespace std;

bool check(string s, string t, int top){
    for (int i = 0; i < t.length(); i++){
        if((s[top + i] == t[i]) || (s[top + i] == '?')){
            continue;
        }else{
            return false;
        }
    }
    return true;
}
int main(){
    string S, T;
    int top = -1;

    cin >> S;
    cin >> T;

    for (int i = 0; i < S.length() - T.length() + 1; i++){
        if(check(S, T, i)){
            top = i;
        }
    }

    if (top == -1)
    {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    
    for (int i = 0; i < T.length(); i++){
        S[top + i] = T[i];
    }

    for (int i = 0; i < S.length(); i++){
        if(S[i] == '?'){
            S[i] = 'a';
        }
    }

    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <numeric>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par; 
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i; 
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e,H, W,Q;
long long A[200000]= {};
long long B[200][205] = {};
long long C[20][200] = {};
bool f;
bool ff;
string S[200];
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <pl>vpl[100005];
vector <string> vs;

struct ST
{
	long long hajime;
	long long owari;
	long long zahyou;
	int bangou;

	bool operator<(const ST& another) const
	{
		return hajime < another.hajime;//年齢を比較
	};

};



vector <ST> vst;
ST st[200005];



int main() {

	cin >> a>>b>>c>>K;


	if (K%2==0) {
		cout << a - b << endl;
	}
	else {
		cout << b - a << endl;
	}
	
	return 0;

}


Measured memory_bytes: 6400
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int int_vector_find(std::vector<int> vec, int num) {
	auto itr = std::find(vec.begin(), vec.end(), num);
	int index = std::distance(vec.begin(), itr);

	if (index != vec.size()) {
		return 1;
	}
	else {
		return 0;
	}
}

int main() {
	bool m = true;
	bool y = true;
	char c[4];
	for (int i = 0; i < 4; ++i) {
		std::cin >> c[i];
	}

	if ((c[2] - 48) * 10 + (c[3] - 48) > 12 || (c[2] - 48) * 10 + (c[3] - 48) == 0) {
		m = false;
	}
	if ((c[0] - 48) * 10 + (c[1] - 48) > 12 || (c[0] - 48) * 10 + (c[1] - 48) == 0) {
		y = false;
	}
	if (m) {
		if (y) {
			std::cout << "AMBIGUOUS" << std::endl;
		}
		else {
			std::cout << "YYMM" << std::endl;
		}
	}
	else if (y) {
		if (m) {
			std::cout << "AMBIGUOUS" << std::endl;
		}
		else {
			std::cout << "MMYY" << std::endl;
		}
	}
	else {
		std::cout << "NA" << std::endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
string s;
main()
{
	cin>>s;
	if(s.size()<26)
	{
		for(char i='a';i<='z';i++)
		{
			bool f=1;
			for(int j=0;j<s.size();j++)f&=s[j]!=i;
			if(f)
			{
				cout<<s<<i<<endl;
				return 0;
			}
		}
	}
	else
	{
		vector<string>A;
		for(int i=0;i<26;i++)
		{
			for(int j=i+1;j<26;j++)
			{
				if(s[i]<s[j])
				{
					A.push_back(s.substr(0,i)+s[j]);
				}
			}
		}
		sort(A.begin(),A.end());
		if(A.size())cout<<A[0]<<endl;
		else cout<<-1<<endl;
	}
}

Measured memory_bytes: 256
//	-*- mode: C++ -*-
//	How Many Divisors?
//		Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b.
//
//	Input
//		Three integers a, b and c are given in a line separated by a single space.
//
//	Output
//		Print the number of divisors in a line.
//
//	Constraints
//		1 ≤ a, b, c ≤ 10000
//		a ≤ b
//	Sample Input 1
//		5 14 80
//	Sample Output 1
//		3

#include <iostream>

int	main(int	argc,
		 char*	argv[])
{
	int	a	= 0;
	int	b	= 0;
	int	c	= 0;

	std::cin >> a >> b >> c;

	int	divCount	= 0;

	for(int i = a; i <= b; i++){
		if((c % i) == 0){
			divCount++;
		}
	}

	std::cout << divCount << '\n';
}



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

template <std::size_t N>
class Era {
public:
	int prime_array[ N + 1 ];

	constexpr Era() : prime_array() {
		prime_array[ 0 ] = 0;
		prime_array[ 1 ] = 0;
		rep( i, 2, N + 1 ){
			prime_array[ i ] = 1;
		}
		int lim = N;
		rep( i, 2, lim ){
			if (prime_array[ i ] == 0)
				continue;
			lim = N / i;
			for(int j = i * 2; j < N + 1; j += i){
				prime_array[ j ] = 0;
			}
		};
		rep_d( i, N, 0 ){
			if (prime_array[ i ] == 1 && prime_array[ ( i + 1 ) / 2 ] == 1)
				prime_array[ i ] = 1;
			else
				prime_array[ i ] = 0;
		}
		rep( i, 1, N ){
			prime_array[ i ] += prime_array[ i - 1 ];
		}
	}
};

const int MaxN = 1e5 + 5;
int main( void ){
	constexpr Era<MaxN> era;
	int Q; cin >> Q;
	rep( i, 0, Q ){
		int l, r;
		scanf ( "%d %d", &l, &r );
		printf( "%d\n", era.prime_array[ r ] - era.prime_array[ l - 1 ] );
	}
}


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

#define INF 1234567890
#define ll long long

int N, M;
vector<int> g[100101];
bool vis[100101];

void DFS(int n)
{
	vis[n] = true;
	for(int next : g[n])
	{
		if (vis[next]) continue;
		DFS(next);
	}
}

int main()
{
	scanf("%d %d", &N, &M);
	for(int i=1; i<=M; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int cnt = 0;
	for(int i=1; i<=N; i++)
		if (!vis[i])
			DFS(i), cnt++;
	printf("%d", cnt-1);
	return 0;
}

Measured memory_bytes: 9816
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    a[i] = -a[i];
  }
  vector<int> A;
  for (int i = 0; i < n; ++i) {
    int k = upper_bound(A.begin(), A.end(), a[i]) - A.begin();
    if (k == A.size()) {
      A.push_back(a[i]);
    } else {
      A[k] = min(A[k], a[i]);
    }
  }
  printf("%d\n", (int)A.size());
  return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, k, q;
  cin >> n >> k >> q;
  vector<int> xs(n);
  for (int i = 0; i < q; i++) {
    int id;
    cin >> id;
    id--;
    xs[id]++;
  }
  for (int i = 0; i < n; i++) {
    if (k - q + xs[i] > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  
}

Measured memory_bytes: 1024
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int vis[222222],a[222222];
int main()
{
	int now,mx,i,n,tmp,j,k;
	long long ans=0;
	scanf("%d",&n);
	now=0;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		mx=0;
		for(j=1;j<=20;j++)
		{
			tmp=((1<<j-1)&a[i])==(1<<j-1);
			if(tmp==1)
			{
				mx=max(vis[j-1],mx);
				vis[j-1]=i;
			}
		}
		for(j=now+1;j<=mx;j++)
		{
			for(k=1;k<=20;k++)
			{	
				tmp=((1<<k-1)&a[j])==(1<<k-1);
				if(tmp==1)
				{
					if(vis[k-1]==j)
						vis[k-1]=0;
				}
			}
		}
		now=max(now,mx);
		ans+=i-now;
	}
	printf("%lld\n",ans);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
 	return 0;
}


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

int main(){

    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);

    rep(i,n){
        cin >> h[i];
    }

    sort(h.begin(),h.end());
    ll ans=0L;
    rep(i,max((ll)0,n-k)){
        ans+=h[i];
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main()
{
  string s, t; cin >> s >> t;
  int a, b; cin >> a >> b;
  map<string, int> mapp;
  mapp[s] = a;
  mapp[t] = b;
  string u; cin >> u;
  mapp[u]--;
  cout << mapp[s] << ' ' << mapp[t];

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    while (true) {
        C -= B;
        if (C < 1) {
            cout << "Yes" << endl;
            break;
        }

        A -= D;
        if (A < 1) {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3624
s = input()
count = 0

if s[:int((len(s)-1)/2)] == s[int((len(s)+1)/2):]:
    for j in range(len(s)):
        if s[j] == s[-(j+1)]:
            count += 1
    
    if count == len(s):
      	print('Yes')
    else:
      	print('No')
else:
    print('No')


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int main(void){
  LL w, h, x, y;
  cin >> w >> h >> x >> y;

  double area = (double)w * (double)h / 2;
  if (x*2 == w && y*2 == h) {
    cout << area << ' ' << 1 << endl;
  } else {
    cout << area << ' ' << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;

typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<int> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;

void solve() {
    ld r;
    cin >> r;
    put(3.141592 * r * 2);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

//    freopen("input.txt", "r", stdin);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}


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

now, max = 1, [None] * (n + 1)
for i in range(n + 1):
  if a[i] > now:
    print(-1)
    exit(0)
  max[i] = now
  now = min((now - a[i]) * 2, 2000000000000000000)

ans, up = 0, 0
for i in range(n, -1, -1):
  count = min(max[i], up + a[i])
  ans += count
  up = count
print(ans)

Measured memory_bytes: 83500
#include <stdio.h>
#define LIMIT 100

int main(void){
    int row,col,i,j,rowjudge[LIMIT]={0},coljudge[LIMIT]={0};
    char matrix[LIMIT][LIMIT];
    scanf("%d %d",&row,&col);

    // 初期化
    for(i=0; i<LIMIT; i++){
        for(j=0; j<LIMIT; j++){
            matrix[i][j]='\0';
        }
    }

    // 入力
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            scanf(" %c",&matrix[i][j]);
        }
    }

    // 各行、各列に黒が１つでもあるかを判別
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            if(matrix[i][j]=='#'){
                rowjudge[i]=1;
            }
        }
    }
    for(j=0; j<col; j++){
        for(i=0; i<row; i++){
            if(matrix[i][j]=='#'){
                coljudge[j]=1;
            }
        }
    }

    // 黒が１つでもある行と列の重なる要素のみを出力
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            if(rowjudge[i]==1 && coljudge[j]==1){
                printf("%c",matrix[i][j]);
            }
        }
        if(rowjudge[i]==1){
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1628
#include <iostream>
#include <vector>

int main(){
    std::vector<int> list(9 * 9);
    int index = 0;
    for(int i = 1; i <= 9; ++i){
        for(int j = 1; j <= 9; ++j){
            list.at(index++) = i * j;
        }
    }

    int n;
    std::cin >> n;
    std::string ans = "Yes";
    if(list.end() == std::find(list.begin(), list.end(), n)){
        ans = "No";
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N; cin>>N;
  int ans=0,mi=1e9;
  rep(i,N){
    int P; cin>>P;
    if(P<=mi){
      ans++;
      mi=P;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
//killer_R@$tog!
#include<bits/stdc++.h>
using namespace std;
#define hell 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define mp make_pair
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define ll long long int
#define N 100009
#define all(b) b.begin(),b.end()
#define sz sizeof
#define shuru(h) memset(h,0,sz(h))
//int pr[N];
//int seg[N];
/*int query(int l,int r,int sl,int sr,int p)
{
    if(r<sl || l>sr)
        return 0;
    if(sr<=r && sl>=l)
        return seg[p];
    int m=sl+(sr-sl)/2;
    return (__gcd(query(l,r,sl,m,2*p+1),query(l,r,m+1,sr,2*p+2)));
}

int build(int l,int r,int p,int arr[])
{
    if(l==r)
    {
        seg[p]=arr[l];
        return seg[p];
    }
    int m=l+(r-l)/2;
    seg[p]=__gcd(build(l,m,2*p+1,arr),build(m+1,r,2*p+2,arr));
    return seg[p];
}
void isprime()
{
    memset(pr,1,sizeof(pr));
    pr[1]=0;
    for(int i=2;i*i<=N;i++)
    {
        if(pr[i])
        {
            for(j=i*i;j<=N;j+=i)
            {
                pr[j]=0;
            }
        }
    }
}*/
void killer()
{
    ll n;cin>>n;ll a[n+1],b[n+1]={0},dp[n+1][n+1];shuru(dp);
    rep(i,1,n+1){cin>>a[i];b[i]=b[i-1]+a[i];}
    rep(i,1,n+1)
    {

        rep(j,i,n+1)
        {
            if(i==1)
            {
            dp[1][j]=0;continue;
            }
            ll t=10000000000000000;
            rep(k,1,i)
            {
               
                t=min(t,dp[k][j]+dp[i-k][j-k]+b[j]-b[j-i]);
            }
            dp[i][j]=t;
        }
    }
    cout<<dp[n][n];
    return;
}
int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    //int h=(int)ceil(log2(n));
    //h=2*(int)pow(2,h)-1;
    //build(0,n-1,0,a);

    ll t;
    t=1;
    while(t--)
        killer();

    return 0;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(){
	
	long long int N;
	
	cin >> N;
	
	for(long long int i = 1; i <= 3500; i++){
		for(long long int j = 1; j <= 3500; j++){
			long long int num = N * i * j;
			long long int den = 4 * i * j - N * i - N * j;
			if(den > 0 && num % den == 0){
				cout << i << " " << j << " " << num / den << endl;
				return 0;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{

        int n;
        int k;
        int x;
        int y;
        int sum1;
        int i;


	// 個数のの入力
        sum1 = 0;
        scanf("%d %d %d %d",&n,&k,&x,&y);

        for (i = 0;i < n; i++) {
          if (i < k ) {
           sum1 = sum1 + x;
          }
          else {
           sum1 = sum1 + y;
          }  
        } 

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

        
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	H, _ := ReadInt(), ReadInt()
	for i := 0; i < H; i++ {
		c := ReadString()
		fmt.Println(c)
		fmt.Println(c)
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 1856