akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i : c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout <<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

  VAR(int, H, W);
  VEC(string, C, H);

  int cnt = 0;
  REP(hi, H) {
    OUT(C[hi])BR;
    OUT(C[hi])BR;
  }
  
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		final String LINE_SEPARATOR = System.getProperty("line.separator");
		int H, W;
		while (true) {
			StringBuilder sb = new StringBuilder();
			String[] str = in.readLine().split(" ");
			H = Integer.parseInt(str[0]);
			W = Integer.parseInt(str[1]);
			if (H == 0 && W == 0)
				break;
			for (int i = 0; i < H; i += 1) {
				for (int j = 0; j < W; j += 1) {
					sb.append("#");
				}
				sb.append(LINE_SEPARATOR);
			}
			sb.append(LINE_SEPARATOR);
			System.out.print(sb);
		}
	}
}

Measured memory_bytes: 21132
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
    ll n; cin >> n;

    string res = "";

    while (n > 0) {
        int val = n % 26;
        if (val == 0)  {
            res += ('z');
            n /= 26;
            n--;
            continue;
        }
        else val--;
        res += ('a' + val);
        n /= 26;
    }
    reverse(res.begin(), res.end());
    cout << res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3648
# coding: utf-8
# Your code here!
import fractions as f
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k>max(a):
    print('IMPOSSIBLE')
else:
    if k in a:
        print('POSSIBLE')
    else:
        a.sort()
        cnt=[]
        count=[]
        s=a[0]
        for i in range(n-1):
            cnt.append(f.gcd(a[i],a[i+1]))
        cnt=list(set(cnt))
        ans=0
        for j in range(len(cnt)):
            if k%cnt[j]==0:
                ans=1
        if ans==1:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')
        
        

Measured memory_bytes: 88172
<?php
$s = trim(fgets(STDIN));
switch ($s) {
    case "SUN":
        $res = 7;
        break;
    case "MON":
        $res = 6;
        break;
    case "TUE":
        $res = 5;
        break;
    case "WED":
        $res = 4;
        break;
    case "THU":
        $res = 3;
        break;
    case "FRI":
        $res = 2;
        break;
    case "SAT":
        $res = 1;
        break;
}

echo $res . PHP_EOL;

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

int main() {
  ll N;
  cin >> N;
  ll sum_n = 0;
  rep(i, N){
    if(((i+1)%3!=0)&&((i+1)%5!=0)) sum_n += i+1;
  }
  cout << sum_n << endl;
}


Measured memory_bytes: 3620
x = int(input())

is_prime = [True] * (10**6+1)   #全部Trueに
is_prime[0] = False
is_prime[1] = False

for i in range(2,int(10**3)+1):  
    if is_prime[i]:
        for j in range(i * 2, 10**6 + 1, i):
            is_prime[j] = False

while True:
    if is_prime[x]:
      break
    x+=1
print(x)

Measured memory_bytes: 47980
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()
p = list(map(int, input().split()))

ans_list = [i for i in range(102)]
for i in range(N):
    now = p[i]
    for j in range(len(ans_list)):
        if ans_list[j] == now:
            del ans_list[j]
            break
        
ans = 1000
k = 1000
for i in range(len(ans_list)):
    if abs(ans_list[i] - X) < ans:
        ans = abs(ans_list[i] - X)
        k = ans_list[i]

print(k)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    for (int i = 1; i <=3; i++) {
        if((a * b * i) % 2 != 0) {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;

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

int main(){
    ll N,R;
    cin>>N>>R;
    ll res;
    if(N>=10){
        res=R;
    }else{
        res=R+100*(10-N);
    }
    cout<<res<<endl;

}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int a, b;
    cin >> a >> b;
    if(a <= 9 and b <= 9){
        cout << a * b << endl;
    }else{
        cout << - 1 << endl;
    }
}


Measured memory_bytes: 256
n=gets.to_i
in1=gets.chomp.split(" ").map(&:to_i)
min=200
num1=0
num2=0
for i in 1..n-1 do
 for j in 0...i do
  num1=num1+in1[j]
 end
 for k in i...n do
  num2=num2+in1[k]
 end
 if min>(num1-num2).abs
 min=(num1-num2).abs
 end
 num1=0
 num2=0
end
puts min

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

LL mp[64][64];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		double a;
		scanf("%lf", &a);
		a *= 1e9;
		LL b = llround(a);
		int c, d;
		c = d = 0;
		while (b % 5 == 0) {
			b /= 5;
			c++;
		} 
		while (b % 2 == 0) {
			b /= 2;
			d++;
		}
		mp[c][d]++;
	}
	LL ans = 0;
	int w = 61;
	for (int i = 0; i < w ; ++i) {
		for (int j = 0; j < w; ++j) {
			for (int k = max(0, 18 - i); k < w; ++k) {
				for (int l = max(0, 18 - j); l < w; ++l) {
					if (i * w + j < k * w + l) {
						ans += mp[i][j] * mp[k][l];
					}
					if (i == k && j == l) {
						ans += mp[i][j] * (mp[i][j] - 1) / 2;
					}
				}
			}
		}
	}
	cout << ans << endl;
    return 0;
}


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

using namespace std;  //このネームスペースを使う

int main(){
  int a,b,k;
  int num,i,j;

  j=0;

  cin >> a ;
  cin >> b ;
  cin >> k ;
  
  num = a;
  if(a > b){
    num = b;  
  }

  //cout << "a=" << a << endl;
  //cout << "b=" << b << endl;
  //cout << "num=" << num << endl;

  for(i=num; i>=1; i--){
    //cout << "i=" << i << endl;
    //cout << "a%i=" << a%i << endl;
    //cout << "b%i=" << b%i << endl;

  	if(a%i == 0 && b % i == 0){
  	  j++;
      if(k == j){
      	cout << i << endl;
      	break;
      }
  	}
  }

  return 0;
}



Measured memory_bytes: 256
import unittest
import string


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think('a'), 'b')

    def test_2(self):
        self.assertEqual(think('y'), 'z')


def solve():
    c = read()
    result = think(c)
    write(result)


def read():
    return read_line(n=1)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(c):
    buf = string.ascii_lowercase
    index = buf.index(c)
    return buf[index + 1]


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 51948
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>

void delete_empty_rows(std::vector<std::string>& lines) {
    std::string empty_row(lines.front().size(), '.');
    lines.erase(std::remove(lines.begin(), lines.end(), empty_row), lines.end());
}

void transpose(std::vector<std::string>& lines) {
    const size_t H = lines.size(), W = lines.front().size();
    std::vector<std::string> tr_lines(W, std::string(H, '\0'));
    for (size_t i = 0; i < H; ++i) {
        for (size_t j = 0; j < W; ++j) {
            tr_lines[j][i] = lines[i][j];
        }
    }
    lines = std::move(tr_lines);
}

void print(const std::vector<std::string>& lines) {
    for (const auto& line : lines) {
        std::printf("%s\n", line.c_str());
    }
}

int main() {
    int H, W;
    std::scanf("%d %d\n", &H, &W);

    std::vector<std::string> lines(H, "");
    for (auto& line : lines) {
        line.resize(W);
        std::scanf("%s\n", &line[0]);
    }

    delete_empty_rows(lines);
    transpose(lines);
    delete_empty_rows(lines);
    transpose(lines);
    print(lines);
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) throws FileNotFoundException {

//    Scanner cin = new Scanner(new FileReader("input.txt"));
    Scanner cin = new Scanner(System.in);

    int n = cin.nextInt();
    int[] diff = new int[n];
    int[] value = new int[n];
    for (int i=0;i<n;i++) {
      value[i] = cin.nextInt();
    }
    for (int i=0;i<n;i++) {
      diff[i] = value[i] - cin.nextInt();
    }
    
//    int[] diff = new int[n];
    int sum = 0;
    
    for (int i:diff) {
      if (i>0) 
        sum+=i;
    }
    
    System.out.println(sum);
  }

}

Measured memory_bytes: 23252
#define _USE_MATH_DEFINES
//#include <bits/stdc++.h>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <complex>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<std::vector<long long>> D){
  int cnt=0;
  REP(i,N){
    if(D[i][0]==D[i][1]){
      cnt++;
      if(cnt>=3){
	cout<<YES<<endl;
	return;
      }
    }else{
      cnt=0;
    }
  }
  cout<<NO<<endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<std::vector<long long>> D(N, std::vector<long long>(2));
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < 2 ; j++){
      scanf("%lld",&D[i][j]);
    }
  }
  solve(N, std::move(D));
  return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>
int main(void){
  int a, b, sum = 0;
  int i = 0, j = 1;
  scanf("%d",&a);
  scanf("%d",&b);
  if (b == 1){
    j--;
  }
  i = i + a;
  for(; i < b;){
    j++;
    i = i + a -1;
  }
  printf("%d",j);
  return 0;
}


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

using namespace std;

int main(void){
    int a, b;
    cin >> a >> b;
    if(1 <= a && a <= 9 && 1 <= b&& b <= 9){
        cout << a * b << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

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

int main() {
    int n, c, d, x;
    deque<int> dq;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> c;
        if(c == 0) {
            cin >> d >> x;
            if(d == 0) {
                dq.push_front(x);
            } else {
                dq.push_back(x);
            }
        } else if(c == 1) {
            cin >> x;
            cout << dq[x] << '\n';
        } else {
            cin >> d;
            if(d == 0) {
                dq.pop_front();
            } else {
                dq.pop_back();
            }
        }
    }
}



Measured memory_bytes: 4564
n=int(input())

ans = 1
tmp_max = 0

for i in range(1,n+1):
    # iを何回2で割れるか？
    flag = True
    tmp_cnt = 0
    tmp_i = i
    while(flag):
        if tmp_i%2==0:
            tmp_cnt += 1
            tmp_i=int(tmp_i/2)
        else:
            flag = False
    if tmp_cnt >= tmp_max:
        tmp_max = tmp_cnt
        ans = i
        
print(ans)

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

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  int a,b=0,cnt=0;
  map<int,int> map;
  rep(i,8)map[i]=0;
  rep(i,n){
    cin>>a;
    if(a/400<8){
      map[a/400]++;
    }else{
      cnt++;
    }
  }
  rep(i,8)if(map[i])b++;
  if(b==0){
    cout<<1<<" "<<n<<endl;
  }else{
    cout<<b<<" "<<b+cnt<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;

#define rep(i,x) for(Int i = 0; i < (Int)(x); i++)
#define rrep(i,x) for(Int i = ((Int)(x) - 1); i >= 0; i--)
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

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

Int dx[4] = {1,0,-1,0};
Int dy[4] = {0,1,0,-1};
const Int INF = 1001002003004005006ll;
const Int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//








int main(){


        int n;
        cin >> n;
        vector<int> d(n);
        rep(i,n) cin >> d[i];

        sort(all(d));

        int mid = d[n/2];
        int mid2 = d[n/2-1];

        if(n%2 == 1 || mid == mid2){
                cout << 0 << endl;
                return 0;
        }

        cout << mid - mid2 << endl;
        return 0;






}

























Measured memory_bytes: 640
n = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(1, n-1):
    if p[i-1] > p[i] and p[i] > p[i+1]:
        count += 1
        continue
    if p[i-1] < p[i] and p[i] < p[i+1]:
        count += 1
print(count)

Measured memory_bytes: 38612
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int x[n+1];
  for(int i=1;i<=n;i++) cin>>x[i];
  x[0]=-1;
  int ans=1,s1=0,s2=1,MOD=1000000007LL;
  for(int i=1;i<=n;i++){
    if(x[i-1]+2<=x[i]) x[i]=x[i-1]+2,s2++;
    (ans*=min(i-s1,s2))%=MOD;
    if(x[i-1]+2>x[i]) s1++,x[i]=x[i-1];
  }
  cout<<ans<<endl;
  return 0;
}



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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  
  vector<int> koyaku;
  for( int i = 1; i <= 100; i++ ){
    if( A % i == 0 && B % i == 0 ){
      koyaku.push_back(i);
    }
  }
  reverse( koyaku.begin(), koyaku.end() );
  cout << koyaku.at(K-1) << endl;
  
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

r = INT()

print(3*r**2)


Measured memory_bytes: 5844
#include <iostream>
#include <vector>
using namespace std;
int count = 0;

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

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



int main(){
    int A[600000];
    int n;
    cin >> n;
    for(int i=0; i < n; i++){
        cin >> A[i];
    }
    mergeSort(A,0,n);
    for(int i=0; i < n; i++){
        cout << A[i];
        if(i != n-1) cout << " ";
    }
    cout << endl;
    cout << count << endl;

    return 0;

}


Measured memory_bytes: 6880
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    bool pos = 1;
    string s;
    cin >> s;
    if(s.size() % 2 == 1){
       cout << "No";
       return 0;
    }
    for(int i = 0; i < s.size()/2; i++){
        if(s[i] == 'b' && s[s.size() - i - 1] != 'd'){
            cout << "No";
            return 0;
        }
        if(s[i] == 'd' && s[s.size() - i - 1] != 'b'){
            cout << "No";
            return 0;
        }
        if(s[i] == 'p' && s[s.size() - i - 1] != 'q'){
            cout << "No";
            return 0;
        }
        if(s[i] == 'q' && s[s.size() - i - 1] != 'p'){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <iomanip>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>

#define int64 long long
using namespace std;

int main()
{
	int64 nn, ans = 0, tmp, count = 2;
	cin >> nn;
	while(nn >= count * count)
	{
		tmp = count;
		while(nn % tmp == 0)
		{
			nn /= tmp;
			ans++;
			tmp *= count;
		}
		while(nn % count == 0)
		{
			nn = nn / count;
		}
		count++;
	}
	if(nn != 1)
	{
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        String s = sc.next();

        if(s.charAt(2) == s.charAt(3) && s.charAt(4)==s.charAt(5)){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)
#define FIN(x) freopen(x, "r", stdin);
#define FOUT(x) freopen(x, "w", stdout);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<ll, ll>;

const int MAXN = 1010;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clzll(x) - 1;	}

ll n, m, dp[MAXN][MAXN];
char g[MAXN][MAXN];

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

	cin >> n >> m;

	for (int i = 1 ; i <= n ; ++i) {
		for (int j = 1 ; j <= m ; ++j) {
			cin >> g[i][j];
		}
	}

	dp[1][1] = 1;

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m ; ++j) {
			if(g[i][j] == '#') continue;
			if(g[i + 1][j] == '.') dp[i + 1][j] = add(dp[i + 1][j], dp[i][j]);
			if(g[i][j + 1] == '.') dp[i][j + 1] = add(dp[i][j + 1], dp[i][j]);
		}
	}

	cout << dp[n][m] << endl;

	return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

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

  int N,M;
  cin>>N>>M;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  if(N==1){
    int ans=A[0];
    for(int i=0;i<M;i++)ans/=2;
    cout<<ans<<endl;
    return 0;
  }
  sort(rng(A));
  reverse(rng(A));
  priority_queue<int>q;
  for(int i=0;i<N;i++)q.push(A[i]);
  for(int i=0;i<M;i++){
    int a=q.top();
    q.pop();
    a/=2;
    q.push(a);
  }
  int ans=0;
  for(int i=0;i<N;i++)ans+=q.top(),q.pop();
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2168
#include <iostream>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
#define ld long double


int main(){

ll n;
cin>>n;

vector<ll> t(n+1,0), x(n+1,0),y(n+1,0);
for(int i=1;i<=n;i++){
    cin>>t[i]>>x[i]>>y[i];
}

for(int i=1;i<=n;i++){
    ll sum =(abs(x[i]-x[i-1])+ abs(y[i]-y[i-1]));
    if((t[i]-t[i-1])< sum)
        {
            cout<<"No";
            return 0;
        }
    if(sum%2!=(t[i]-t[i-1])%2){
        cout<<"No";
        return 0;
    }
}

cout<<"Yes";

}

Measured memory_bytes: 5136
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;

const int MAX_N=500;

struct edge{
	int to,cap,rev;
};

vector<edge> G[MAX_N];
vector<int> check(MAX_N,0);

int dfs(int v,int t, int f ){
	if(v==t){return f;}
	check[v]=1;
	for(int i=0;i<G[v].size();i++){
		if(check[G[v][i].to]==0 && G[v][i].cap > 0){
			int ff =dfs(G[v][i].to,t,min(f,G[v][i].cap));
			if(ff>0){
				G[v][i].cap -= ff;
				G[G[v][i].to][G[v][i].rev].cap += ff;
				return ff;
			}
		}
	}
	return 0;
}

int maxflow(int s,int t){
	int flow = 0;
	while(1){
		fill(check.begin(),check.end(),0);
		int f = dfs(s,t,INT_MAX);
		if(f==0){return flow;}
		flow += f;
	}
}

int main(){
	int X,Y,E,s,t;
	cin >> X >> Y >> E ;
	
	for(int i=0;i<E;i++){
		cin >> s >> t ;
		G[s].push_back((edge){X+t,1,G[X+t].size()});
		G[X+t].push_back((edge){s,0,G[s].size()-1});
	}
	
	for(int i=0;i<X;i++){
		G[X+Y].push_back((edge){i,1,G[i].size()});
		G[i].push_back((edge){X+Y,0,G[X+Y].size()-1});
	}
	
	for(int i=X;i<X+Y;i++){
		G[i].push_back((edge){X+Y+1,1,G[X+Y+1].size()});
		G[X+Y+1].push_back((edge){i,0,G[i].size()-1});
	}
	
	cout << maxflow(X+Y,X+Y+1) << endl;
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Data{
public:
	int index,height;
};

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

	int N=in();
	set<string> S;
	REP(i,N){
		string Q=in<string>();
		if(Q=="insert"){
			S.emplace(in<string>());
		}
		else{
			S.find(in<string>())==S.end() ? out("no") : out("yes");
		}
	}
	
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265
#define endl '\n'
#define MAX 501


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n , x;
    cin >> n >> x;
    vector<int> vec;
    int v;
    for (int i = 0; i < n; i++) {
        cin >> v;
        vec.pb(v);
    }
    vec.pb(x);
    n = vec.size();
    int ans = 0;
    sort(all(vec));
    for (int i = 1; i < n; i++) {
        ans = __gcd(ans , vec[i] - vec[i - 1]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

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

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






int main() {
   ll d,n;
   cin >> d >> n;
    if (n == 100) n++;
   if (d == 0){
        cout << n << endl;
   }
   if (d == 1) cout << n * 100 << endl;
   if (d == 2){
     cout << n * 10000 << endl;
   }
}

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

int main() {
	int s[14], h[14], c[14], d[14];
	int n, x;
	char ch;
	for (int i = 1; i < 14; i++) {
		s[i] = 0;
		h[i] = 0;
		c[i] = 0;
		d[i] = 0;
	}
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("\n%c %d", &ch, &x);
		if (ch == 'S') {
			s[x] = x;
		}
		if (ch == 'H') {
			h[x] = x;
		}
		if (ch == 'C') {
			c[x] = x;
		}
		if (ch == 'D') {
			d[x] = x;
		}
	}


	for (int i = 1; i < 14; i++) {
		if (s[i] == 0)
			printf("S %d\n", i);
	}
	for (int i = 1; i < 14; i++) {
		if (h[i] == 0)
			printf("H %d\n", i);
	}
	for (int i = 1; i < 14; i++) {
		if (c[i] == 0)
			printf("C %d\n", i);
	}
	for (int i = 1; i < 14; i++) {
		if (d[i] == 0)
			printf("D %d\n", i);
	}
	return 0;

}



Measured memory_bytes: 2064
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n;
double x;
string u;
signed main(){
	cin>>n;
	double ans=0;
	rep(i,n){
		cin>>x>>u;
		if(u=="BTC")ans+=x*380000;
		else ans+=x;
	}
	printf("%.12lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int ALP='z'-'a'+1,N=100;
string S;
ll l,r;
string gs;
ll len[N];
ll sch[N][ALP];
ll ans[ALP];
ll dfs(int n,int c,ll ub){
	ll ret=0;
	if (n==0){
		REP(i,min(ub,(ll)S.size())){
			if (S[i]==c+'a'){
				ret++;
			}
		}
	}else if (n==1){
		REP(i,min(ub,(ll)gs.size())){
			if (gs[i]==c+'a'){
				ret++;
			}
		}
	}else{
		if (ub<=len[n-1]){
			ret=dfs(n-1,c,ub);
		}else{
			ret+=sch[n-1][c]+dfs(n-2,c,ub-len[n-1]);
		}
	}
	return ret;
}
int main(){
	cin>>S>>l>>r;
	S.resize((int)S.size()/2);
	{
		vector<ll> kmp(S.size()+1);
		kmp[0]=-1;
		int j=-1;
		REP(i,(int)S.size()){
			while(j>=0 && S[j]!=S[i]) j=kmp[j];
			j++;
			kmp[i+1]=j;
		}
		int per=(int)S.size()-kmp[(int)S.size()];
		gs=S+S.substr(0,per);
	}
	len[0]=(int)S.size();
	len[1]=(int)gs.size();
	REP(j,len[0]){
		sch[0][S[j]-'a']++;
	}
	REP(i,len[1]){
		sch[1][gs[i]-'a']++;
	}
	{
		int i=1;
		do{
			i++;
			len[i]=len[i-1]+len[i-2];
			REP(c,ALP){
				sch[i][c]=sch[i-1][c]+sch[i-2][c];
			}
		}while(len[i]<r);
		REP(c,ALP){
			ans[c]=dfs(i,c,r);
		}
		REP(c,ALP){
			ans[c]-=dfs(i,c,l-1);
		}
	}
	REP(c,ALP){
		if (c){
			cout<<" ";
		}
		cout<<ans[c];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1540
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>


using namespace std;

#define debug false

int main(int argc, char *argv[]){
  long long N, M;
  cin >> N >> M;
  long long mcd;
  for(mcd = M / N; mcd > 0; mcd--){
    if((M % mcd) == 0 && M >= mcd*N){
      cout << mcd << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res%mod;}


long modPow(long a, long x, long p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

long modInverse(long a, long p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return powmod(a, mod-2);
}
long modBinomial(long n, long k, long p) {
// calculates C(n,k) mod p (assuming p is prime).

    long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator=mul(numerator,n-i);
    }

    long denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = mul(denominator,i);
    }

    // numerator / denominator mod p.
    ll res=mul(numerator,modInverse(denominator,mod));
    res=(res+mod)%mod;
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    ll res=powmod(2,n);
    ll ans2=modBinomial(n,b,mod);
    ll ans1=modBinomial(n,a,mod);
    res--;
    res+=mod;
    res%=mod;
    ll ans3=(ans1+ans2)%mod;
    res=(res-ans3)%mod;
    res=(res+mod)%mod;
    cout<<res<<endl;

    return 0;
    }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cm[51][51];
ll comb(ll n,ll r){
  if(cm[n][r]!=-1) return cm[n][r];
  if(r==0||r==n) return cm[n][r]=1;
  return cm[n][r]=(comb(n-1,r-1)+comb(n-1,r));
}
int main(){
  ll n,a,b,max_n=0,cnt=0,tmp_num,bc,ac;
  cin >> n >> a >> b;
  vector<ll> v(n);
  for(int i=0;i<=50;i++){
    for(int j=0;j<=50;j++){
      cm[i][j]=-1;
    }
  }
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end(),greater<ll>());
  for(int i=0;i<a;i++){
    max_n+=v[i];
  }
  tmp_num=max_n;
  tmp_num-=v[a-1];
  printf("%.7lf\n",(double)max_n/a);
  for(int i=0;i<=b-a;i++){
    tmp_num+=v[a+i-1];
    if(tmp_num*a==max_n*(a+i)){
      bc=ac=0;
      for(int k=0;k<n;k++){
        if(v[a+i-1]==v[k]){
          if(k<=a+i-1)bc++;
          else ac++;
        }
      }
      cnt+=comb(ac+bc,ac);
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		digitSum();
	}
	
	public static void digitSum() {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int a = num/2, b = a;
		if (num % 2 != 0) a += 1;
		int res = Integer.MAX_VALUE;
		while (a < num && b > 0) {
			res = Math.min(res, digit(a) + digit(b));
			a++;
			b--;
		}
		System.out.println(res);
	}
	
	public static int digit(int a) {
		int res = 0;
		while (a > 0) {
			res += a % 10;
			a /= 10;
		}
		return res;
	}
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w; cin >> h >> w;
  int cnt = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      char a; cin >> a;
      if(a == '#') cnt++;
    }
  }
  if(cnt == h + w -1)
    cout << "Possible";
  else
    cout << "Impossible";
}

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

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

	if (a == 1) {
		cout << "YES" << endl;
		return 0;
	}

	string ans = "NO";
	
	for (int i = 1 ; i <= b; i++) {
		if (a * i % b == c) ans = "YES";
	}

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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define MOD (1000000007ll)

bool conccomp(int x, int y, int p, int q){
	return (p*y>x*q);
}

int main(void){
	ll n,m,ans;
	cin >> n >> m;
	ans = min(n,m/2);
	m -= 2*n;
	ans += max(0ll,m/4);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <utility>
#include <queue>
#include <tuple>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;
using VI = vector<int>;

constexpr ll INF = 1000000007;

int main() {
    int s, w;
    cin >> s >> w;
    if (w >= s) {
        cout << "unsafe\n";
    }
    else {
        cout << "safe\n";
    }
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<(a!=c)<<endl;


}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad
import Data.Complex

type Vector = Complex Double

eps :: Double
eps = 1e-7

dot :: Vector -> Vector -> Double
dot a b = realPart $ conjugate a * b

cross :: Vector -> Vector -> Double
cross a b = imagPart $ conjugate a * b

readWords :: Read a => IO [a]
readWords = map read . words <$> getLine

main :: IO ()
main = do
  [x1,y1,x2,y2] <- readWords :: IO [Double]
  let
    p0 = x1:+y1
    p1 = x2:+y2

  q <- readLn

  ps <- replicateM q $ do
    [x,y] <- readWords :: IO [Double]
    return $ x:+y

  forM_ ps $ \p2 -> do
    let sgn = (p1-p0)`cross`(p2-p0)

    when (sgn > eps) $ putStrLn "COUNTER_CLOCKWISE"
    when (sgn < -eps) $ putStrLn "CLOCKWISE"

    when (abs sgn < eps) $ do
      if (p1-p0)`dot`(p2-p0) < 0
        then putStrLn "ONLINE_BACK"
        else if magnitude (p2-p0) > magnitude (p1-p0)
          then putStrLn "ONLINE_FRONT"
          else putStrLn "ON_SEGMENT"

Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;


int main() {
    int n, m;
    cin >> n >> m;
    V l(m), r(m);
    rep(i, 0, m) cin >> l[i] >> r[i];

    int Ml = 0, mr = 1001001;
    rep(i, 0, m){
        Ml = max(Ml, l[i]);
        mr = min(mr, r[i]);
    }

    //mr < Ml　となる場合も考えられる
    int ans = mr - Ml + 1;
    if(ans > 0) cout << ans << "\n";
    else cout << 0 << "\n";
}

Measured memory_bytes: 1024
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
f = 0
count = 0
for i in range(1, n):
    if t[i] > t[f] + k or c == i - f:
        count += 1
        f = i
else:
    count += 1
print(count)

Measured memory_bytes: 7384
#define rep(i, n) for (int i=0; i<(int)(n); ++i)

#include<bits/stdc++.h>
using namespace std;

int main(){
    int N, K; cin >> N >> K;
    vector<int> ev(N); // expected value：期待値

    // 期待値の分子であるev[i]+1を配列evに格納する
    rep(i, N) cin >> ev[i], ++ev[i];

    // 累積和
    // (N+1)個の配列を初期値0で初期化
    vector<int> S(N+1, 0);
    rep(i, N) S[i+1] = S[i] + ev[i];

    // K個分の合計を比較して最大値を求める
    int res = 0;
    rep(i, N-K+1) res = max(res, S[i+K]-S[i]);

    cout << fixed << setprecision(12) << (double)res/2 << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long

int x, n, p[200];

bool present(int m) {
	for(int i = 0; i < n; ++i) {
		if (p[i] == m) {
			return true;
		}
	}
	return false;
}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> x >> n;
	if (n == 0) {
		cout << x;
		return 0;
	}
	for(int i = 0; i < n; ++i) {
		cin >> p[i];
	}
	int l = x, s = x;
	while(present(l)) {
		l++;
	}
	while(present(s)) {
		s--;
	}
	if (abs(x-s) <= abs(x-l)) cout << s;
	else cout << l;
}

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

int main() {
	int X, Y;
	cin >> X >> Y;

	for (int i = 0; i <= X; i++) {
		for (int j = 0; j <= Y; j++) {
			if (j + i == X) {
				if (2 * i + 4 * j == Y) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}

	cout << "No" << endl;
	return 0;
}

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

using namespace std;

int main(){
    int N;
    string s;
    cin >> N >> s;
    
    int R_cnt = 0;
    int B_cnt = 0;
    
    for(int i = 0; i < N; i++){
        if(s[i] == 'R'){
            R_cnt++;
        }
        else{
            B_cnt++;
        }
    }
    
    if(R_cnt > B_cnt){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using vpii = vector<pii>;

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

  cout << max(0, A - 2*B) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

ll n,k;
vector<pair<ll, ll>> ab(100001);

void input(){
  cin >> n >> k;
  for(int i=0;i<n;++i){
    ll x, y;
    cin >> x >> y;
    ab.push_back(make_pair(x, y));
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  input();
  sort(ab.begin(), ab.end());
  int index = 0;
  ll sum = 0;
  while(sum < k){
    //cout << ab[index].second << endl;
    sum += ab[index].second;
    index++;
  }
  cout << ab[index-1].first << endl;
  return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define EPS 0.0000000001
typedef long long ll;

ll n, q;
vector<vector<ll>> edge;
vector<ll> cost(n, 0);
vector<bool> check(n);

void dfs(ll now)
{
    check[now] = true;
    for (ll next : edge[now])
    {
        if (check[next])
        {
            continue;
        }
        cost[next] += cost[now];
        dfs(next);
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    cin >> n >> q;
    ll a, b, p, x;
    cost.resize(n);
    edge.resize(n);
    rep(i, n - 1)
    {
        cin >> a >> b,a--,b--;
        edge[a].pb(b);
        edge[b].pb(a);
    }
    rep(i, q)
    {
        cin >> p >> x;
        cost[p - 1] += x;
    }
    check.resize(n);
    dfs(0); //dfs

    rep(i, n)
    {
        cout << cost[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 24320
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cassert>
#include <string.h>

using namespace std;
#define  rep(i,n) for(int i=0;i<n;i++)
#define  REP(i,a,b) for(int i=a;i<b;i++)
typedef long long int lld;
typedef vector<lld> vl;
typedef vector<int> vi;
typedef vector<char> vc;



//int arr[N]
////sort(arr,arr +N)

//vector <int> hoge
////sort(hoge.begin(),hoge.end());

int main(){
	long int N;
	string S;
	cin>>S;
	int len,ans=100000000,tmp;
	len=int(S.size());
	rep(i,len-2){
		tmp=abs((S[i]-'0')*100+(S[i+1]-'0')*10+(S[i+2]-'0')-753);
		if(ans>tmp) ans=tmp;
	}
	cout<<ans;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long i=1; i<=n; i++)
using namespace std;
int main(void){
    long n;
    double tmp;
    long ans = 1000000000005;
    cin >> n;
    rep(i, sqrt(n)+1){
        tmp = (double)n/i;
        if (floor(tmp) !=(tmp)) continue;
        if(ans > i+tmp-2) ans = i+tmp-2;
        }
    cout << ans;
}

Measured memory_bytes: 256
#三井住友信託銀行プログラミングコンテスト2019-C
dp = [0] * 100104
dp[0] = 1
X = int(input())

for i in range(100, 100104):
    for j in range(100, 106):
        if dp[i-j]:
            dp[i] = 1
            
print(dp[X])

Measured memory_bytes: 3828
from heapq import heappop, heappush

nv,ne=map(int,input().split())
pair_lst = [i for i in range(nv)]
que=[]
for i in range(ne):
    si,ti,wi=map(int,input().split())
    heappush(que,(wi,si,ti))

def find(x):
    if x == pair_lst[x]:
        return x
    else:
        tmp = find(pair_lst[x])
        pair_lst[x] = tmp
        return tmp

length_sum = 0
while que:
    w, s, t = heappop(que)
    root_s = find(s)
    root_t = find(t)
    if root_s != root_t:
        pair_lst[root_s] = root_t
        length_sum += w

print(length_sum)




Measured memory_bytes: 23248
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#define mp  make_pair
using namespace std;

typedef long long  LL;
typedef pair <int,LL>  PIL;
typedef set <PIL>::iterator  Iter;
int n,q;
set <PIL> S;

Iter pre(Iter x){x--;  return x;}

void work()
{
	scanf("%d %d",&n,&q);
	S.insert(mp(0,1LL<<45)),S.insert(mp(1,0)),S.insert(mp(n+1,-1));
	for (int i=1,a,l; i<=q; i++)
		{
			LL b;
			scanf("%d %lld",&a,&b),a++;
			Iter x=pre(S.upper_bound(mp(a,1LL<<60))),y;
			x=(S.insert(mp(a,(*x).second))).first;
			while (b>0)
				{
					y=pre(x),l=a-(*y).first;
					if (((*pre(y)).second-(*y).second)*l>=b)
						{
							if (b%l)  S.insert(mp((*y).first+b%l,(*y).second+b/l));
							S.erase(y),y=S.insert(mp((*y).first,(*y).second+(b+l-1)/l)).first;
							if ((*pre(y)).second==(*y).second)  S.erase(y);
							b=0;
						}else  b-=((*pre(y)).second-(*y).second)*l,S.erase(y);
				}
			if ((*pre(x)).second==(*x).second)  S.erase(x);
		}
	for (Iter x=S.begin(),y; x!=S.end(); y=x,x++)
		if ((*x).first>1)
			for (int i=(*y).first; i<(*x).first; i++)
				printf("%lld\n",(*y).second);
}

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


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

int main()
{
    int n;
    cin >> n;
    int v[n], c[n], s = 0;
    for (int i = 0; i < n; i++)
        cin >> v[i];
    for (int i = 0; i < n; i++)
        cin >> c[i];
    for (int i = 0; i < n; i++)
    {
        if (v[i] - c[i] > 0)
            s += v[i] - c[i];
    }
    cout << s << endl;
}

Measured memory_bytes: 888