akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int  // ranges from (0 - twice of long long int)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define mod 1000000007LL
#define llpair pair<ll,ll>
#define INF 1000000000000000000ll
#define np next_permutation
#define PI acos(-1)
#define deb(x) cout<<#x<<" "<<x<<endl;
//ALWAYS USE ll DATA TYPE FOR INTEGER(FASTER THAN INTEGER AS WELL AS SOMETIMES WITHOUT USE LONG UR ANSWER WILL NOT ACCEPTED) && DOUBLE FOR DECIMAL VALUE
template<typename T> // for removing front element from the vector
void pop_front(std::vector<T> &v)
{
    if (v.size() > 0) {
        v.erase(v.begin());
    }
}
template<typename R> // for removing back element from the vector or can directly
void pop_back(std::vector<R> &v) // use vec.pop_back() function...
{
    if (v.size() > 0) {
        v.erase(v.begin()+v.size()-1);
    }
}

bool isprime(ll n)  //IN  O(sqrt(n))
{
    if(n<=1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;

    return true;
}

vector<ll> factors(ll n){    //IN  O(sqrt(n))

    vll v;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            v.pb(i);
            if((n/i)!=i)
            v.pb(n/i);
        }
    }
    return v;
}

ll power(ll a, ll n)  // using Binary Exponential in TC O(logn)
{                     // Self Written By </ME> :)
    ll res=1;
    while(1)
    {
        if(n%2){
            res=res*a; n--;
        }
        if(n==0) break;
        a=a*a; n/=2;
    }
    return res;
}

ll ts(ll arr[],int l,int r,int x) // ternary search to find x in sorted array arr
{
    
    while(l<=r)
    {
        ll mid1= l+(r-l)/3;
        ll mid2= r -(r-l)/3;
        if(arr[mid1]==x || arr[mid2]==x)
            return 1;
        if(x<arr[mid1])
            r=mid1-1;
        else if(x>arr[mid2])
            l=mid2+1;
        else
        {
            l=mid1+1;
            r=mid2-1;
        }
    }

    return -1;
}

int main() {
    auto start = chrono::high_resolution_clock::now();
    fio;
   
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll h,w; cin>>h>>w;
        if(h==1 || w==1)
            cout<<1<<"\n";
        else
        {
            ll a = h/2 + h%2;
            ll b= h/2;
        ll c = w/2 + w%2;
        ll d= w/2;

        ll res= a*c + b*d;
        cout<<res<<"\n";
        }
        

    }
    
    auto finish = chrono::high_resolution_clock::now();
    cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
    return 0;
}





Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
string get(int a, int b, int c)
{
	string s;
	if (b == 0 && c == 0)
	{
		for (int i = 0; i < a; i++)s.push_back('a');
		return s;
	}
	if (a == 0)
	{
		s = get(b, c, 0);
		for (int i = 0; i < s.size(); i++)s[i]++;
		return s;
	}
	string sa, sb, sc;
	if (c%a == 0)
	{
		s = get(0, a - b%a, b%a);
		sb.push_back('a');
		for (int i = 0; i < c / a; i++)sb.push_back('c');
		for (int i = 0; i < b / a; i++)sb.push_back('b');
		sc = sb;
		sc.push_back('b');
	}
	else
	{
		s = get(a - c%a - b % (a - c%a), b % (a - c%a), c%a);
		sa.push_back('a');
		for (int i = 0; i < c / a; i++)sa.push_back('c');
		sc = sa;
		sc.push_back('c');
		for (int i = 0; i < b / (a - c%a); i++)sa.push_back('b');
		sb = sa;
		sb.push_back('b');
	}
	string r;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'a')r += sa;
		if (s[i] == 'b')r += sb;
		if (s[i] == 'c')r += sc;
	}
	return r;
}
int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	cout << get(a, b, c) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;


ll ans,mx,mn=1e8,sum;
int main(){
	int n;
	cin>>n;
	bool ok=true;
	string s[n];
	for(int i=0; i<n; i++){
		cin>>s[i];
		
	}
	for(int i=0; i<n; i++) {
		if(i>0 ){
			if(s[i][0]!=s[i-1][s[i-1].size()-1]){
				cout<<"No";
				return 0;
			}
		}
	}
	sort(s,s+n);
	for(int i=0; i<n; i++){
		if(s[i]==s[i+1]){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 384
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]

i = 0
while True:
    flag = 0
    for j in range(len(A)):
        if A[j] % 2 != 0:
            flag = 1
    if flag == 0:
        i += 1
        for j in range(len(A)):
            A[j] = A[j] / 2
    else:
        break
print(i)

Measured memory_bytes: 3060
#include <stdio.h>

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

int main(){
    int k,v,a=0,b=0;
    while(1) {
        scanf("%d", &v);
        if(v == 0) break;
        for(k = v; k > 0; k--) {
            if(isprime(k) == 1 && isprime(k-2) == 1){
                a = k - 2;
                b = k;
                break;
            }
        }
        printf("%d %d\n",a,b);
    }
    return 0;
}

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

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    bool f[h][w];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c;
            cin >> c;
            f[i][j] = c == '.';
        }
    }

    int l[4][h][w];

    for (int i = 0; i < h; i++) {
        int lj = -1;
        for (int j = 0; j < w; j++) {
            if (f[i][j]) {
                l[0][i][j] = lj;
            } else {
                lj = j;
            }
        }

        lj = w;
        for (int j = w - 1; j >= 0; j--) {
            if (f[i][j]) {
                l[1][i][j] = lj;
            } else {
                lj = j;
            }
        }
    }

    for (int j = 0; j < w; j++) {
        int li = -1;
        for (int i = 0; i < h; i++) {
            if (f[i][j]) {
                l[2][i][j] = li;
            } else {
                li = i;
            }
        }

        li = h;
        for (int i = h - 1; i >= 0; i--) {
            if (f[i][j]) {
                l[3][i][j] = li;
            } else {
                li = i;
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (f[i][j]) {
                int cur = 1;
                cur += j - 1 - l[0][i][j];
                cur += l[1][i][j] - j - 1;
                cur += i - 1 - l[2][i][j];
                cur += l[3][i][j] - i - 1;
                if (cur > ans) {
                    ans = cur;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 66688
#include<bits/stdc++.h>
using namespace std;
//typedef long long ll;
int main(){
  int x,y,z,i;
  cin>>x>>y>>z;
  int a[3];
  a[0]=z;a[1]=x;a[2]=y;
  for(i=0;i<3;i++)
    cout<<a[i]<<" ";
  return 0;
}

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

int main(void){
    int a[3][3];
    int chk[9] ={0};
    int n;
    int ii1, ii2, ii3;
    for(ii1=0; ii1<3; ii1++){
        scanf("%d %d %d", &a[ii1][0], &a[ii1][1], &a[ii1][2]);
    }
    scanf("%d", &n);
    int b[n];
    for(ii1=0; ii1<n; ii1++){
        scanf("%d", &b[ii1]);
    }

    for(ii1=0; ii1<n; ii1++){
        for(ii2=0; ii2<3; ii2++){
            for(ii3=0; ii3<3; ii3++){
                if(b[ii1] == a[ii2][ii3])
                    a[ii2][ii3] = -1;
            }
        }
    }

    if((a[0][0]==-1 && a[1][1]==-1 && a[2][2] == -1) || (a[0][2] ==-1 && a[1][1]==-1
        && a[2][0]==-1)){
            printf("Yes");
            return 0;
        }

    for(ii1=0; ii1<3; ii1++){
        for(ii2=0; ii2<3; ii2++){
            chk[ii1] += a[ii1][ii2];
        }
    }
    for(ii1=0; ii1<3; ii1++){
        for(ii2=0; ii2<3; ii2++){
            chk[3 + ii2] += a[ii1][ii2];
        }
    }

    for(ii1=0; ii1<9; ii1++){
        if(chk[ii1] == -3){
            printf("Yes");
            return 0;
        }
    }

    printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;

 	vector<vector<char>> data(N, vector<char>(M));
  for (int i=0;i<N;i++){
    for(int j=0;j<M;j++){   
     cin >> data.at(i).at(j);
    }
  }
  vector<int> check_i(N,0);
  vector<int> check_j(M,0);
  for(int i=0;i<N;i++){
    for (int j=0;j<M;j++){
    	if(data.at(i).at(j)=='#'){
          check_i.at(i) = 1;
          check_j.at(j) = 1;
        }
   	 }
  }
	for(int i=0;i<N;i++){
  		if (check_i.at(i)==1){
    		for (int j=0;j<M;j++){
    			if(check_j.at(j)==1){
      				cout<< data.at(i).at(j);
                }
            }
        }
    	cout<< endl;
    
  }
    
  
  return 0;
}

Measured memory_bytes: 3504
menu = []
for i in range(0, 5):
	menu.append(int(raw_input()))

queue = [[0, menu]]
min = 1000
while queue != []:
	now = queue.pop(0)
	if now[1] == []:
		if now[0] < min: min = now[0]
	else:
		for i in range(0, len(now[1])):
			newmenu = []
			for j in range(0, len(now[1])):
				if i != j: newmenu.append(now[1][j])
			t = now[0]
			if t % 10 != 0:
				t = (t / 10 + 1) * 10
			t += now[1][i]
			queue.append([t, newmenu])

print min

Measured memory_bytes: 2696
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
int main()
{
	long long int i,n,c=0,ans=0,x;
	cin>>n;
	int h[n];
	for(i=0;i<n;i++)
		cin>>h[i];
	for(i=0;i<n-1;i++)
		{
			if(h[i+1]-h[i]<=0)
				{
					c++;
				}
			else
				c=0;
			ans=max(ans,c);
		}
	cout<<ans<<endl;
}

Measured memory_bytes: 3884
#include<iostream>
#include<vector>
using namespace std;
int main() {
  long long N,A[3];
  cin >> N >> A[0] >> A[1] >> A[2];
  vector<char> ans(N);
  char s[5],ns[5];
  bool f = true;
  int i;
  if(A[0]+A[1]+A[2] == 0)f = false;
  else if(A[0]+A[1]+A[2] == 1) {
    for(i=0;i<N&&f;i++) {
      cin >> s;
      if(A[s[0]-'A']+A[s[1]-'A'] == 0)f = false;
      else {
        ans[i] = (A[s[0]-'A']<A[s[1]-'A']?s[0]:s[1]);
        A[s[0]-'A'] = (A[s[0]-'A']>0?0:1);
        A[s[1]-'A'] = (A[s[1]-'A']>0?0:1);
      }
    }
  }
  else {
    cin >> s;
    for(i=0;i<N&&f;i++) {
      if(i<N-1)cin >> ns;
      if(A[s[0]-'A']+A[s[1]-'A'] == 0)f = false;
      else {
        if(A[s[0]-'A'] == 0) {
          ans[i] = s[0];
          A[s[0]-'A']++;
          A[s[1]-'A']--;
        }
        else if(A[s[1]-'A'] == 0) {
          ans[i] = s[1];
          A[s[0]-'A']--;
          A[s[1]-'A']++;
        }
        else if(ns[0] == s[0] || ns[1] == s[0]) {
          ans[i] = s[0];
          A[s[0]-'A']++;
          A[s[1]-'A']--;
        }
        else {
          ans[i] = s[1];
          A[s[0]-'A']--;
          A[s[1]-'A']++;
        }
      }
      s[0] = ns[0];
      s[1] = ns[1];
    }
  }
  if(f) {
    cout << "Yes" << endl;
    for(i=0;i<N;i++)cout << ans[i] << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 3692
#define R register
#define ll long long
#include <bits/stdc++.h>

using namespace std;

int n, a, b;
int main()
{
    scanf("%d%d%d", &n, &a, &b);
    if((b - a - 1) % 2) puts("Alice");
    else puts("Borys");
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,i=0,ans=0,mx=-1,mn=99999999,p;
    while(1){
        cin>>p;
        if(p==0) break;
        for(i=0;i<p;i++){
            cin>>n;
            mx=max(mx,n);
            mn=min(mn,n);
            ans+=n;
        }
        cout<<(ans-mx-mn)/(i-2)<<endl;
        ans=0,mx=-1,mn=99999999;
    }
    return 0;
}


Measured memory_bytes: 3004
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	var a, b, k int
	fmt.Sscanf(scanner.Text(), "%d %d %d", &a, &b, &k)

	for i := 0; i < k; i++ {
		if i%2 == 0 {
			// takahashi
			b = b + a/2
			a = a / 2
		} else {
			// aoki
			a = a + b/2
			b = b / 2
		}
	}
	fmt.Println(a, b)
}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline
from collections import Counter
from itertools import chain

def readlines(n):
    for _ in range(n):
        yield map(int, input().split())

def main():
    h, w = map(int, input().split())

    C = [[int(c) for c in input().split()] for _ in range(10)]

    for k in range(10):
        for i in range(10):
            for j in range(10):
                C[i][j] = min(C[i][j], C[i][k] + C[k][j])

    counter = Counter(chain(*readlines(h)))

    for i in range(10):
        yield C[i][1] * counter[i]


print(sum(main()))


main()

Measured memory_bytes: 5868
H, W = gets.chomp.split.map(&:to_i)

arr = []
illegals = []

result = true

def search_alone(str)
  len = str.length
  counter = 0
  bads = []
  while counter < len
    if str[counter] === '#'
      if str[counter+1] === '#'
        counter += 2
      elsif str[counter-1] === '#'
        counter += 1
      else
        bads << counter
        counter += 1
      end
    else
      counter += 1
    end
  end
  bads
end

H.times do
  arr << gets.chomp
end

for el in arr
  illegals << search_alone(el)
end

illegals.each_with_index {|el, index|
  el.each do |i|
    targets = [arr[[index-1, 0].max][i], (arr[index+1] || [])[i]]
    unless targets.include?('#')
      result = false
      break
    end
  end
  next if result
}

if result
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define PB push_back
#define LL long long
using namespace std;
int matrix[1000][1000];
int main() 
{
    int n;
    cin >> n;
    int Sz = -1;
    for(int sz = 2; sz <= 1000; sz++)
    {
        if(sz * (sz - 1) / 2 == n)
            Sz = sz;
    }
    
    if(Sz == -1)
    {
        cout << "No";
        return 0;
    }
    cout << "Yes" << endl;
    cout << Sz << endl;
    int ptr = 1;
    for(int i = 1; i <= Sz; i++)
    {
        for(int j = i + 1; j <= Sz; j++)
        {
            matrix[i][j] = matrix[j][i] = ptr++;
        }
    }
    for(int i = 1; i <= Sz; i++)
    {
        cout << Sz - 1 << " ";
        for(int j = 1; j <= Sz; j++)
        {
            if(j == i)
                continue;
            cout << matrix[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
    int h,w,n=0;
    std::vector<int> vec_h,vec_w;
    while(1){
        cin >> h >> w;
        vec_h.push_back(h);
        vec_w.push_back(w);
        if(h==0&&w==0)break;
        n++;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<vec_h[i];j++){
            for(int k=0;k<vec_w[i];k++){
                if(j%2==0){
                    if(k%2==0){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }else{
                    if(j%2==1){
                        if(k%2==0){
                            cout << ".";
                        }else{
                            cout << "#";
                        }
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
int check(char*str)
{
	for(int i=1;i<strlen(str);i++)
	{
		if(str[i]!=str[i-1])
			return 1;
	}
	return 0;
}
int main(void)
{
	char str[101];
	scanf(" %s ",str);
	int ans=1e9;
	for(int i=0;i<26;i++)
	{
		char temp=(char)('a'+i);
		char str2[101];
		strcpy(str2,str);
		while(check(str2))
		{
			for(int i=0;i<strlen(str2)-1;i++)
			{
				if(str2[i]==temp||str2[i+1]==temp)
					str2[i]=temp;
			}
			str2[strlen(str2)-1]='\0';
			//printf("%s\n",str2);
		}
		ans=min(ans,(int)strlen(str)-(int)strlen(str2));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int check(int x) {
	string s = to_string(x);
	bool flag = false;
	rep(i, SZ(s)) {
		if (s[i] == '3')flag = true;
	}
	return flag;
}
int main() {
	int n;
	cin >> n;
	FOR(i, 1, n + 1) {
		bool flag = false;
		if (i % 3 == 0)flag = true;
		else if (check(i))flag = true;

		if (flag)cout << " " << i;
	}
	puts("");
}


Measured memory_bytes: 3240
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string s;
    cin >> s;
    int x = 10*(s[0]-48)  +s[1] - 48;
    int y = 10*(s[2] - 48) + s[3] - 48;
    if(x < 13 && y < 13 && x > 0 && y > 0) cout << "AMBIGUOUS";
    else if(x < 13 && x > 0) cout << "MMYY";
    else if(y < 13 && y > 0) cout << "YYMM";
    else cout << "NA";
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

 
using namespace std;

int main()
{
	long long int X,Y;
	cin>>X>>Y;
	long long int  count = 0;
	while( X <= Y){
		count++;
		X = X * 2;
	}
	cout<<count<<endl;
	return 0;
}

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

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n ;
	cin>>n ;
	int arr[n+2], pref[n+2], suff[n+2] ;
	for(int i = 1 ; i <= n ; ++i)
		cin>>arr[i] ;
	pref[0] = 0, suff[n+1] = 0 ;
	for(int i = 1 ; i <= n ; ++i)
		pref[i] = __gcd(pref[i-1], arr[i]) ;
	for(int i = n ; i >= 1 ; --i)
		suff[i] = __gcd(suff[i+1], arr[i]) ;
	int ans = 0 ;
	for(int i = 1 ; i <= n ; ++i)
		ans = max(ans, __gcd(pref[i-1], suff[i+1])) ;
	return cout<<ans<<"\n" , 0 ;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		sc.close();

		int i = 0;
		long money = 100;
		while(true) {
			i++;
			money *= 1.01;
			if(money >= X) {
				break;
			}
		}
		System.out.println(i);
	}

}


Measured memory_bytes: 27076
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;


inline vector<int> divisor(int n) 
{
    vector<int> ret;
    for(int i = 1; i * i <= n; i++) {
        if(n % i == 0) {
        ret.push_back(i);
        if(i * i != n) ret.push_back(n / i);
        }
    }
    //sort(begin(ret), end(ret));
    return (ret);
}

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    map<int ,int> a;
    
    int buf;
    for(int i=0;i<n;i++){
        cin >> buf;
        a[buf]++;
    }

    int ans=0;
    vector<int> vec;
    for(auto p1: a){
        if(p1.second>=2) continue;
        
        bool check=true;
        vec = divisor(p1.first);

        for(int i=0;i<vec.size();i++){
            if(vec[i]==p1.first) continue;
            if(a[vec[i]]>0){
                check=false;
                break;
            }
        }

        if(check) ans++;
    }

    cout << ans << endl;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */
long long  gcd(long long  a, long long  b) { return b ? gcd(b, a%b) : a; }

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

LL ans = 0LL;

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

	LL N;
	cin >> N;
	ans = lcm(2, N);


	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

struct TWO {
	long long int a, b;
};

bool cmp(TWO x, TWO y) {
	return x.a < y.a;
}

//ユークリッドの互除法　a,bは最大公約数を求めたい２つの数
long long int gcd(long long int a, long long int b) {
	long long int tmp;
	long long int r = 1;
	if (b > a) {
		tmp = a;
		a = b;
		b = tmp;
	}
	r = a % b;
	while (r != 0) {


		a = b;
		b = r;
		r = a % b;

	}
	return b;
}


int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007,INF=100000000000000;
	map<long long int, long long int>mp;
	string str,str2;
	cout << fixed << setprecision(10);
	long long int n, m, h, w, res = 0, num[200] = {}, p[300000], sum[200003] = {};
	TWO two[200001];
	cin >>n;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		sum[p[i]]++;
	}
	for (int i = 1; i < 110000; i++) {
		sum[i] =sum[i]+ sum[i - 1];
	}
	for (int i = 1; i < 110000; i++) {
		if (sum[i] == n / 2) { res++; }
	}
	cout << res;
} 


Measured memory_bytes: 3840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc, out);

		out.flush();
	}
	
	public static void solve(FastScanner sc, PrintWriter out) {
		String s = sc.next();
		
		out.println(s.replace("2017", "2018"));
		
	}
	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}



int main(){
  int N,M;cin>>N>>M;
  cout<<M*(M-1)/2+N*(N-1)/2<<endl;

  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for(auto &e : A) cin >> e;

    sort(A.begin(), A.end());

    ll ans = 0;
    if (N%2 == 0) {
        // p1 >= p2 <= p3 >= p4 ...
        // p1 + 2 * (p3+p5...) - 2 * (p2+p4+...) - pn
        // = 2 * (p1+p3+p5+...) - 2 * (p2+p4+...+pn) - p1 + pn
        // p1: 中央値、pn：中央値以下で最大値
        // (p2+p4+...) : 中央値より小さい区間の和
        // (p3+p5+...) : 中央値より大きい区間の和
        int k = N/2;
        for(int i = 0; i < k; ++i) ans -= 2LL * A[i];
        for(int i = k; i < 2*k; ++i) ans += 2LL * A[i];
        ans -= A[k];
        ans += A[k-1];
    } else {
        // p1 >= p2 <= p3 >= p4 ...
        // p1 + pn + 2 * (p3+p5...) - 2 * (p2+p4+...)
        // p1: 中央値、pn：中央値以上で最大値
        // (p2+p4+...) : 中央値より小さい区間の和
        // (p3+p5+...) : 中央値より大きい区間の和
        ll ret1 = 0;
        int k = N/2;
        for(int i = 0; i < k; ++i) ret1 -= 2LL * A[i];
        ret1 += A[k];
        ret1 += A[k+1];
        for(int i = k+2; i < k*2+1; ++i) ret1 += 2LL * A[i];

        // p1 <= p2 >= p3 <= p4 ...
        // 2 * (p2+p4+...) - (p3+p5...) - p1 - pn
        // p1: 中央値、pn：中央値以下で最大値
        // (p2+p4+...) : 中央値より大きい区間の和
        // (p3+p5+...) : 中央値より小さい区間の和
        ll ret2 = 0;
        for(int i = 0; i < k-1; ++i) ret2 -= 2LL * A[i];
        ret2 -= A[k-1];
        ret2 -= A[k];
        for(int i = k+1; i < 2*k+1; ++i) ret2 += 2LL * A[i];

        ans = max(ret1, ret2);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//最大公約数
ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}
//最小公倍数
ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}
//素因数分解
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
 
 ll mod=998244353;
 
int main() {
  int n;
  cin>>n;
  int a[n+2];
  rep(i,n+1){
    cin>>a[i+1];
  }
  a[n+1]=0;

  ll money=1000;
  ll kabu=0;

  if(a[1]<a[2]){
    /*while(money>=a[1]){
      kabu++;
      money-=a[1];
    }*/

    if(money>=a[1]){
      kabu+=money/a[1];
      money-=a[1]*kabu;
    }
  }

  for(int i=2;i<n+1;i++){
    //buy
    if(a[i]<a[i+1]&&a[i-1]>=a[i]&&money>=a[i]){
      /*while(money>=a[i]){
        kabu++;
        money-=a[i];
      }*/
      if(money>=a[i]){
        kabu+=money/a[i];
        money-=a[i]*kabu;
      }
    }

    //sell
    if(a[i]>a[i+1]&&a[i-1]<=a[i]&&kabu>0){
      money+=a[i]*kabu;
      kabu=0;
    }
  }

  cout<<money;

}



Measured memory_bytes: 3640
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const int MOD=1e9+7;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int n;
  cin >> n;

  if (n%2 == 1) {
    cout << n/2 + 1 << endl;
  } else {
    cout << n/2 << endl;
  }

  return 0;
}


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

int main(void){

  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  for (int i = 0; i < N-1; i++) cout << A.at(i) << " ";
  cout << A.at(N-1) << endl;
  
  int v = 0;
  for (int i = 1; i < N; i++)
  {
    v = A.at(i);
    int j = i - 1;
    while((j >= 0)&&(A.at(j) > v)){
      A.at(j+1) = A.at(j);
      j--;
      A.at(j+1) = v;
    }

    for(int k = 0; k < N-1; k++) cout << A.at(k) << " ";
    cout << A.at(N-1) << endl;
  }
  
  
  


  return 0;

}



Measured memory_bytes: 3084
import heapq

X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
Q = []
dic = {}
heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0))
i = 0
while i < K and len(Q) > 0:
    t = heapq.heappop(Q)
    print(-t[0])
    a, b, c = t[1:]
    if a + 1 < X and (a + 2) * (b + 1) * (c + 1) <= K and not (a + 1, b, c) in dic.keys():
        heapq.heappush(Q, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))
        dic[(a + 1, b, c)] = 1
    if b + 1 < Y and (a + 1) * (b + 2) * (c + 1) <= K and not (a, b + 1, c) in dic.keys():
        heapq.heappush(Q, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))
        dic[(a, b + 1, c)] = 1
    if c + 1 < Z and (a + 1) * (b + 1) * (c + 2) <= K and not (a, b, c + 1) in dic.keys():
        heapq.heappush(Q, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))
        dic[(a, b, c + 1)] = 1
    i += 1



Measured memory_bytes: 4832
n,x,y=map(int,input().split())
x+=-1
y+=-1
k=[]
z=0
for i in range(n):
  k.append(0)
for i in range(n-1):
  for j in range(i+1,n):
    z=min(abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x),j-i)
    k[z]+=1
    z=0
for i in range(1,n):
  print(k[i])

Measured memory_bytes: 3444
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll a = in(), b = in(), x = in();
	if (a != 0)cout << b / x - (a - 1) / x << endl;
	else cout << b / x + 1 << endl;
}

Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 051 A - Haiku
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/14
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

char s[19];

void solve() {
    for (int i=0;i<19;i++) {
        if (s[i] == ',')
            printf(" ");
        else
            printf("%c", s[i]);
    }
    printf("\n");

}

int main() {

    scanf("%s", s);

    solve();

}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    long double n,k;
    cin >> n >> k;
    cout << std::setprecision(9) << std::fixed << n/k << endl;
    cin >> n;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <float.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int n;
    int w[100];
    int sum;
    int i;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &w[i]);
    }

    sum = 0;
    for (i = 0; i < n; i++) {
        sum += w[i];
    }

    int a = 0, b;
    int min = INT_MAX;
    for (i = 0; i < n - 1; i++) {
        a += w[i];
        b = sum - a;
        int diff = abs(a - b);
        min = fmin(min, diff);
    }

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

    return 0;
}

Measured memory_bytes: 128
array = Array.new

while val = gets do
    array.push(val.chomp.split.map(&:to_i))
end

n,k = array[0]
sunuke = (1..n).to_a
hikaku = Array.new(n, 0)

for i in 1..(k * 2) do
    if i % 2 == 0
        icchi = sunuke & array[i]
        icchi.each do |num|
            hikaku[num - 1] = hikaku[num - 1] + 1
        end
    end
end

p(hikaku.select{|i| i == 0}.length)


Measured memory_bytes: 14368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mk make_pair
const int N=300010;

int n,m,dp[N],tmp=1;
int main()
{
    scanf("%d%d",&n,&m);
    int ans=(n-m)*100+1900*m;
    for(int i=1;i<=m;i++) tmp*=2;
    printf("%d\n",ans*tmp);
    return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
/*template <typename T>
T pow(T a, ll n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}
 
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
 
using mint = ModInt<1000000007>;
*/
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
int main(){
  int n; cin >> n;
  bool flag = true;
  rep(i, n){
    int a; cin >> a;
    if(a % 2 == 1) flag = false;
  }
  if(flag) cout << "second" << endl;
  else cout << "first" << endl;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define PI 3.14159265359
#define mod 1000000007

const long long INF = 1000000000;

int main(){
    int N,K;
    cin >> N >> K;
    double dice[N];
    double posi[N];
    for(int i = 0 ; i < N;i++){
        cin >> dice[i];
    }
    for(int i = 0; i < N;i++){
        posi[i] = (dice[i]+1) / 2; 
    }
    double maxi = 0;
    double temp = 0;
    for(int i = 0; i < N;i++){
        temp += posi[i];
        if( i >= K){
            temp -= posi[i-K];
        }
        maxi = max(maxi,temp); 
    }
    printf("%.12f\n",maxi);
    return 0;
}


Measured memory_bytes: 3328
from collections import deque

K = int(input())
D = [9999]*K
D[1] = 1
H = deque()
H.append(1)
while len(H) != 0:
    h = H.pop()
    if D[(h*10)%K] > D[h]:
        D[(h*10)%K] = D[h]
        H.append((h*10)%K)
    if D[(h+1)%K] > D[h] + 1:
        D[(h+1)%K] = D[h] + 1
        H.appendleft((h+1)%K)

print(D[0])

Measured memory_bytes: 42864
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  vector<int> a(4) ; //4は要素数
  for (int i=0; i<4; i++){
    cin >> a.at(i) ;
  }
  sort(a.begin(),a.end());
  if (a.at(0)==1 && a.at(1)==4 && a.at(2)==7 && a.at(3)==9){
  cout << "YES" << endl ;  
  }
  else{
    cout << "NO" << endl ;  
  }
}


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


int main() {
  int N; cin >> N;
  vector<string> s(N);
  map<string, int> cnt;
  int mx = -100;

  for(int i=0; i<N; i++){
    cin >> s[i];
    if(cnt.find(s[i]) != cnt.end()) cnt[s[i]] ++;
    else{
      cnt.insert(make_pair(s[i], 0));
      cnt[s[i]] ++;
    }
  }

  int M; cin >> M;
  vector<string> t(M);

  for(int i=0; i<M; i++){
    cin >> t[i];
    if(cnt.find(t[i]) != cnt.end()) cnt[t[i]] --;
  }

  for(x:cnt){
    mx = max(mx, x.second);
  }

  if(mx < 0) cout << 0 << endl;
  else cout << mx << endl;


  return 0;
}


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

int main() {

  double m,n,d;
  cin >> n >> m >> d;

  cout << fixed << setprecision(10);
  if(d == 0) cout << (m-1) / n << endl;
  else cout << 2*(n-d)*(m-1) / (n*n) << endl;
  
}


Measured memory_bytes: 256
export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp[0].split(" ")[0]);
    const a: number[] = tmp[1].split(" ").slice(0, n + 1).map(int => parseInt(int));
    const b: number[] = tmp[2].split(" ").slice(0, n).map(int => parseInt(int));
    let result: number = 0;
    let remain: number = 0;
    for (let i = 0; i < n; i++) {
      if (a[i] <= remain + b[i]) {
        result += a[i];
        remain = b[i] - (Math.max(a[i] - remain, 0));
      } else {
        result += b[i] + remain;
        remain = 0;
      }
    }
    if (a[n] <= remain) {
      result += a[n];
    } else {
      result += remain;
    }
    return `${result}`;
  }
}
 console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 30804
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


S = input()

len = 0
if 'R' in S:
    len = 1
if 'RR' in S:
    len = 2
if 'RRR' in S:
    len = 3

print(len)


Measured memory_bytes: 8972
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	long long int n,m,i,j=26;
	string s="";
	cin>>n;
	n--;
	m=n*25/26+1;
	m=log(m)/log(26);
	m++;
	for(i=0;i<m;i++)
    {
        s+=(char)(n%j+'a');
        n/=j;
        n--;
    }
    string w(s.rbegin(),s.rend());
    cout<<w<<endl;
	return 0;
}


Measured memory_bytes: 3808
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>

using namespace std;
typedef long long ll;
typedef pair<int, int> p_ii;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;



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

	ll sumx = 0, sumy = 0;
	for (int i = 0; i < n; i++)
	{
		sumx += (2 * i - n + 1)*x[i] % MOD;
		sumx %= MOD;
	}
	for (int i = 0; i < m; i++)
	{
		sumy += (2 * i - m + 1)*y[i] % MOD;
		sumy %= MOD;
	}

	cout << sumx * sumy % MOD << endl;

	return 0;
}

Measured memory_bytes: 1792
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

exist = True
ans = 0
ls = []
for i in range(n - 1):
    for j in range(i + 1, n):
        ls.append((a[i][j], i, j))
ls = list(reversed(sorted(ls)))
for (d, u, v) in ls:
    use = True
    for w in range(n):
        if u == w or v == w:
            continue
        if a[u][v] == a[u][w] + a[w][v]:
            use = False
        elif a[u][w] + a[w][v] < a[u][v]:
            exist = False
    if use:
        ans += d
if not exist:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 51292
use std::io::Read;

fn far(g: &Vec<Vec<usize>>, pos: usize, prev: usize, cur: usize) -> (usize, usize) {
    let mut res = (cur, pos);
    for &t in &g[pos] {
        if t == prev { continue }
        res = std::cmp::max(res, far(g, t, pos, cur+1));
    }
    res
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let mut it = buf.split_whitespace();
    let n = it.next().unwrap().parse::<usize>().unwrap();
    let mut g = vec![Vec::new(); n];
    for _ in 0..n-1 {
        let a = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let b = it.next().unwrap().parse::<usize>().unwrap() - 1;
        g[a].push(b);
        g[b].push(a);
    }
    let d = far(&g, far(&g, 0, !0, 1).1, !0, 1).0;
    println!("{}", if d%3 == 2 { "Second" } else { "First" });
}


Measured memory_bytes: 42612
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

int main() {
	fastio;
	int h1, s1, h2, s2; cin >> h1 >> s1 >> h2 >> s2;
	int f = 0;
	while(h1 > 0 and h2 > 0) {
		if(!f) h2 -= s1;
		else
			h1 -= s2;
		f = 1 - f;
	}	
	if(h1 <= 0) cout << "No\n";
	else
		cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 3656
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int cnt[11] = {}, a;
	for (int i = 0; i < 3; ++i) {
		cin >> a;
		cnt[a]++;
	}

	if (cnt[5] == 2 && cnt[7] == 1)
		YES();
	else
		NO();

	return 0;
}

Measured memory_bytes: 256