akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  vector<P> arr;
  rep(i, n){
    cin >> a[i] >> b[i];
    arr.push_back(P(a[i], -1));
    arr.push_back(P(b[i], 1));
  }
  sort(arr.begin(), arr.end());
  int cnt=0, bend=0, ans=0;
  if(n%2==1){
    int middle=n/2;
    rep(i, 2*n){
      if(bend<middle+1 && -cnt+bend>=middle+1){
        ans+=arr[i].first-arr[i-1].first;
      }
      cnt+=arr[i].second;
      if(arr[i].second==1){
        bend++;
      }


    }
    ans++;
  } else {
    int middle1=n/2, middle2=n/2+1;
    int min1, min2, max1, max2;
    rep(i, 2*n){
      cnt+=arr[i].second;
      if(arr[i].second==1){
        bend++;
      }
      if(-cnt+bend==middle1 && arr[i].second==-1){
        min1=arr[i].first;
      }
      if(-cnt+bend==middle2 && arr[i].second==-1){
        min2=arr[i].first;
      }
      if(bend==middle1 && arr[i].second==1){
        max1=arr[i].first;
      }
      if(bend==middle2 && arr[i].second==1){
        max2=arr[i].first;
      }
    }
    ans=max1+max2-(min1+min2)+1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
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; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる





int main() {
  ll n;
  cin>>n;

  vector<ll> p(200000);
  rep(i,n){
    cin>>p[i+1];
  }

  vector<ll> ans(200000);
  ans[1]=0;
  ans[2]=abs(p[2]-p[1]);
  for(ll i=3;i<=n;i++){
    ans[i]=min(ans[i-1]+abs(p[i-1]-p[i]),ans[i-2]+abs(p[i-2]-p[i]));
  }
  cout << ans[n] << endl;
}


Measured memory_bytes: 3328
N,M = map(int,input().split())
XY = [tuple(map(int,input().split())) for i in range(M)]

rs = [0] * N
rs[0] = 1
cs = [1] * N
for x,y in XY:
    x,y = x-1,y-1
    if rs[x]:
        if cs[x]==1:
            rs[x] = 0
        rs[y] = 1
    cs[x] -= 1
    cs[y] += 1
print(sum(rs))

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

using namespace std;

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

int main() {
    int n = 0;

    cin >> n;

    bool isFour = false;

    rep(i, n) {
        char arare;
        cin >> arare;
        if(arare == 'Y'){
            isFour = true;
        }
    }


    cout <<( isFour ? "Four": "Three" )<< endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N, std::vector<long long> A){
  long long t = 0;
  long long k = 1;
  for (int i = 0; i < N; i++) {
    t += k * A[i];
    k *= -1;
  }
  vector<long long> ans;
  ans.push_back(t/2);
  for (int i = 0; i < N-1; i++) {
    ans.push_back(A[i] - ans.back());
  }
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      std::cout << ans[i] * 2;
    } else {
      std::cout << ' ' << ans[i] * 2;
    }
  }
  std::cout << std::endl;
}

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


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define repeat(i,a,b) for(int i=(a),i##__end=(b);i<i##__end;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,i##__end=(a);i>=i##__end;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define pii pair<int,int>
#define N 100010
#define mod 2147483647
//#define int ll
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	if(n%2==0)
		cout<<n/2-1<<endl;
	else
		cout<<n/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#define PB push_back

int main(){
	
	string S;
	cin >> S;
	int A = (S[0]-'0')*10 + S[1]-'0';
	int B = (S[2]-'0')*10 + S[3]-'0';
	if(1 <= A && A <= 12){
		if(1 <= B && B <= 12){
			cout << "AMBIGUOUS" << endl;
		}
		else{
			cout << "MMYY" << endl;
		}
	}
	else{
		if(1 <= B && B <= 12){
			cout << "YYMM" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		String original = scanner.nextLine();
		String target = "CODEFESTIVAL2016";
		int count=0;
		for (int i=0; i<16; i++)
		{
			if (original.charAt(i) != target.charAt(i))
				count++;
		}
		System.out.println(count);
	}
}


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

namespace AOJ
{
  class Problem0036
  {
    public static void Main(string[] args)
    {
      foreach (var field in Read())
      {
        int origX = 0, origY = 0;
        var origFound = false;
        foreach (var row in Enumerable.Range(0, 8))
        {
          foreach (var col in Enumerable.Range(0, 8))
          {
            if (field[row][col])
            {
              origX = col;
              origY = row;
              origFound = true;
              break;
            }
          }
          if (origFound)
            break;
        }

        var predicates = new List<Func<bool[][], int, int, bool>> {
          (f, x, y) => y <= 6 && x <= 6 && f[y][x + 1] && f[y + 1][x] && f[y + 1][x + 1],
          (f, x, y) => y <= 4 && f[y + 1][x] && f[y + 2][x] && f[y + 3][x],
          (f, x, y) => x <= 4 && f[y][x + 1] && f[y][x + 2] && f[y][x + 3],
          (f, x, y) => 0 < x && y <= 5 && f[y + 1][x - 1] && f[y + 1][x] && f[y + 2][x - 1],
          (f, x, y) => x <= 5 && y <= 6 && f[y][x + 1] && f[y + 1][x + 1] && f[y + 1][x + 2],
          (f, x, y) => x <= 6 && y <= 5 && f[y + 1][x] && f[y + 1][x + 1] && f[y + 2][x + 1],
          (f, x, y) => 0 < x && x < 7 && y <= 6 && f[y][x + 1] && f[y + 1][x] && f[y + 1][x - 1]
        };
        foreach (var i in Enumerable.Range(0, predicates.Count))
        {
          if (predicates[i](field, origX, origY))
          {
            Console.WriteLine(((char)('A' + i)).ToString());
            break;
          }
        }
      }
    }

    public static IEnumerable<bool[][]> Read()
    {
      foreach (var t in ReadLine().Slice(8))
        yield return t;
    }

    public static IEnumerable<bool[]> ReadLine()
    {
      string line;
      while ((line = Console.ReadLine()) != null)
      {
        if (line == "")
          continue;
        yield return line.Select(c => c == '0' ? false : true).ToArray();
      }
    }
  }

  static class EnumerableEx
  {
    public static IEnumerable<T[]> Slice<T>(this IEnumerable<T> source, int count)
    {
      return Slice<T, T[]>(source, count, x => x.ToArray());
    }

    public static IEnumerable<TResult> Slice<TSource, TResult>(this IEnumerable<TSource> source, int count, Func<IEnumerable<TSource>, TResult> selector)
    {
      var result = new List<TSource>(count);
      foreach (var v in source)
      {
        result.Add(v);
        if (result.Count == count)
        {
          yield return selector(result);
          result.Clear();
        }
      }
      if (result.Any())
        yield return selector(result);
    }
  }
}

Measured memory_bytes: 5748
package main

import (
	"fmt"
)

func main()  {
	var input int
	_, _ = fmt.Scan(&input)

	if input % 2 == 0 {
		fmt.Println(input / 2)
		return
	}

	if input % 2 == 1 {
		fmt.Println(input / 2 + 1)
		return
	}
}


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

using namespace std;

int dp[200][200] = {};
int INF = -99999999;

int main(){
	int D, N;
	int T[200] = {};
	int A[200] = {}, B[200] = {}, C[200] = {};

	cin >> D >> N;

	for (int i = 0; i < D; i++){
		cin >> T[i];
	}
	for (int i = 0; i < N; i++){
		cin >> A[i] >> B[i] >> C[i];
	}

	for (int i = 0; i < D; i++){
		for (int j = 0; j < N; j++){
			if (i == 0){
				if (A[j] < T[i] && T[i] < B[j]){
					dp[i][j] = C[j];
				}
				else{
					dp[i][j] = INF;
				}
			}
			else if (i == 1){
				if (A[j] <= T[i] && T[i] <= B[j]){
					int tmp1 = INF;
					for (int k = 0; k < N; k++){
						int tmp2 = abs(dp[i - 1][k] - C[j]);
						if (tmp1 < tmp2 && dp[i-1][k]>=0){
							tmp1 = tmp2;
						}
					}
					dp[i][j] = tmp1;
				}
				else{
					dp[i][j] = INF;
				}
			}
			else{
				if (A[j] <= T[i] && T[i] <= B[j]){
					int tmp1 = INF;
					for (int k = 0; k < N; k++){
						int tmp2 = dp[i-1][k]+abs(C[j] - C[k]);
						if (tmp1 < tmp2 && dp[i - 1][k]>=0){
							tmp1 = tmp2;
						}
					}
					dp[i][j] = tmp1;
				}
				else{
					dp[i][j] = INF;
				}
			}
		}
	}
	/*
	for (int i = 0; i < D; i++){
		for (int j = 0; j < N; j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	*/
	int tmp = 0;
	for (int i = 0; i < N; i++){
		if (tmp < dp[D - 1][i]){
			tmp = dp[D - 1][i];
		}
	}

	cout << tmp << endl;
	
}

Measured memory_bytes: 3188
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <map>
#include <set>
using namespace std;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 100000;

int n;
multiset<int> adj[MaxN + 1];

map<pair<int, int>, int> all;

queue<pair<int, int>> dup;

inline void add(int u, int v)
{
	if (u > v)
		swap(u, v);

	adj[u].insert(v);
	adj[v].insert(u);

	pair<int, int> e(u, v);
	if (++all[e] > 1)
		dup.push(e);
}

int ufs[MaxN + 1];

int ufs_find(const int &u)
{
	return ufs[u] == u ? u : ufs[u] = ufs_find(ufs[u]);
}

int main()
{
	cin >> n;
	for (int i = 2; i < 2 * n; ++i)
	{
		int u = getint(), v = getint();
	//	adj[u].insert(v);
	//	adj[v].insert(u);

		add(u, v);
	}

	for (int u = 1; u <= n; ++u)
		ufs[u] = u;

	for (int k = 1; k < n; ++k)
	{
		int u = 0, v = 0;
		while (u == v && !dup.empty())
		{
			u = ufs_find(dup.front().first);
			v = ufs_find(dup.front().second);
			dup.pop();
		}

		if (u == v && dup.empty())
		{
			cout << "NO" << endl;
			return 0;
		}

		if (adj[u].size() < adj[v].size())
			swap(u, v);

		ufs[v] = u;

		for (auto i : adj[v])
		{
			int r = ufs_find(i);
			if (r == u)
				continue;

			adj[r].erase(adj[r].find(v));

			add(u, r);
		}

		adj[u].erase(v);
		adj[v].clear();
	}

	cout << "YES" << endl;

	return 0;
}

Measured memory_bytes: 40576
// author:  Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
	fastio;
	// #ifndef ONLINE_JUDGE 
	//     freopen("input.txt","r",stdin);
	//     freopen("output.txt","w",stdout);
	// #endif
	ll n=0;
	cin>>n;
  	ll ar[n]={0};
  	ll dp[n]={0};
  	for(ll i=0;i<n;++i)
  		cin>>ar[i];
  	dp[0]=0;
  	dp[1]=abs(ar[1]-ar[0]);
  	for(ll i=2;i<n;++i){
  		dp[i]=min(dp[i-2]+abs(ar[i]-ar[i-2]),dp[i-1]+abs(ar[i]-ar[i-1]));
  	}
  	cout<<dp[n-1];
   return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int getans(bool *smap, int ls, int lt)
{
    int *check = new int[ls];
    rep(j, ls) check[j] = 0;
    int ans = 0;

    rep(j, ls)
    {
        int count = 0;
        int jj = j;
        if( smap[jj] && check[jj] == 0 )
        {
            while( smap[jj] && check[jj] == 0 ) 
            {
                check[jj] = -1;
                count++;
                jj = (jj + lt) % ls;
                if( jj == j ) return -1;
            }
            check[j] = count + check[jj];
            ans = max(ans, check[j]);
        }
    }
    return ans;
}

int main()
{
    string s, t;
    cin >> s;
    cin >> t;
    int ls = s.length();
    int lt = t.length();
    
    int *next = new int[lt + 1];
    bool *smap = new bool[ls];
    rep(j, ls) smap[j] = false;
    int lc = 1;
    rep(i, lt)
    {
        next[i] = lc;
        while( i - next[i] >= 0 && t[i] == t[i - next[i]] ) 
        {
            next[i] = next[i] + next[i - next[i]];
        }
        if( i >= lc )
        {
            if( t[i] != t[i - lc] ) lc = lc + next[i - lc];
        }
    }
    next[lt] = lc;
//    rep(i, lt + 1) cout << next[i] << endl;

    int j = 0;
    int presame = 0;
    while( j < ls )
    {
        bool flag = true;
        for(int i = presame; i < lt; i++)
        {
            if( s[(j + i) % ls] != t[i] )
            {
                j = j + next[i];
                presame = max(0, i - next[i]);
                flag = false;
                break;
            }
        }
        if( flag )
        {
            smap[j] = true;
            j = j + next[lt];
            presame = lt - next[lt];
        }        
    }

    cout << getans(smap, ls, lt);

}

Measured memory_bytes: 8732
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    LL a, b, k; cin >> a >> b >> k;

    for (int i = a; i <= min(b, a + k - 1); i++) {
        cout << i << endl;
    }
    for (int i = max(b - k + 1, a + k); i <= b; i++) {
        cout << i << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;


int main(){
int n; cin >>n;
int a[100020];
a[0]=0;a[n+1]=0;

for(int i=1;i<=n;i++)
cin >>a[i];

int sum =0;

for(int i=0;i<=n;i++)
sum+= abs(a[i]-a[i+1]);

for(int i=1;i<=n ;i++)
cout<<sum-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<endl;
}


Measured memory_bytes: 1664
n = int(input())
lia = list(map(int, input().split()))
lib = list(map(int, input().split()))
lic = list(map(int, input().split()))

sati = 0
j = lia[0]

for i in lia:
  sati += lib[i-1]
  if j == i-1:    
    sati += lic[j-1]    
  j = i
  
print(sati)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll  unsigned long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 998244353;
const double PI = 3.141592653589793238463;
const int MAXN = 1000030;

int main()
{
    FAST
   string h;
   cin>>h;
   ll sum=0;
   for(int i=0;i<h.size();i++){
    sum+=(h[i]-'0');
   }
   if(sum%9==0)cout<<"Yes"<<endl;
   else{
    cout<<"No"<<endl;
   }
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

//階乗
int factorial(int k){
    int result=1;
    for (int i=1;i<=k;++i){
        result*=i;
    }
    return result;
}

int main() {
    string n;
    cin>>n;
    if(n[0]=='7'||n[1]=='7'||n[2]=='7')cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>
#include <numeric>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  double x;
  string u;
  double ans_JPY=0;
  double ans_BTC=0;
  for(int i=0;i<N;i++){
    cin >> x >> u;
    if(u=="JPY"){
      ans_JPY+=x;
    }else if(u=="BTC"){
      ans_BTC+=x;
    }
  }
  ans_BTC*=380000.0;
  cout << ans_JPY+ans_BTC << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007


vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);

//template functions
/////////////////////////
void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}
long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}
long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}
long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

long fact(long N){
    if(N==0){
        return 1;
    }else{
        long ans=1;
        for(long i=1;i<N+1;i++){
        ans=ans*i;
        }
        return ans;
    }

}

/////////////////////////


//Answer


int main() {

Cominit();
long X,Y,x,y;
cin>>X>>Y;
if((2*Y-X)%3!=0||(2*X-Y)%3!=0){
  cout<<0<<endl;
}else{
x=(2*Y-X)/3;
y=(2*X-Y)/3;
long N=x+y;
long M=x;
long ans;
ans=facComb(N,M);
cout<<ans<<endl;
}


}



//高精度要求→しつこくlong doubleでcast　出力はprintf("20.20Lf")とかで
//printf("%a.bLf")のとき、a-b-1が整数部分の桁数。
/*配列系の書き方
long N;
cin>>N;
vector<long> p(N);
for(long i=0;i<N;i++){
cin>>p.at(i);
}

vector<int> d(102,1);

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

typedef pair<long,long> P;
vector<P> p(N);
vector<vector<vector<long>>> dp(N+1,vector<vector<long>>(W+1,vector<long>(K+1)));
vector<vector<long>> A(N,vector<long>(M));

int a='A'+2;
cout<<a<<endl;　//a=67 文字は整数型に代入して文字コード化できる。

  char c=65;
cout<<c<<endl;  //c='A' 整数は文字型に代入してその整数が文字コードとしてあらわす整数にできる。

*/

Measured memory_bytes: 237508
#include <bits/stdc++.h>
#define MAXN (int)1e5+10
#define MODN ((int)(1e9) + 7 )
using namespace std;
int N;
long long memo[MAXN];
set<int> dangr;
long long DFS(int u){
	if(u == N)return 1;
	if(memo[u]!= -1){
		return memo[u];}
	long long steps1 = 0;
	long long steps2 = 0;
	if( !dangr.count(u+1)){
		
	steps1 = (DFS(u+1))%MODN;
	}
	if(u+2 <= N && !dangr.count(u+2)){
	
	steps2 = DFS(u+2)%MODN;
	}

	return memo[u] = (steps1+ steps2)%MODN;
}
int main(){
	int M;
	cin>>N>>M;
	memset(memo,-1,sizeof(memo));
	
	for(int i=0;i<M;i++){
		int tmp;
		// cin>>dangr[i];
		cin>>tmp;
		dangr.insert(tmp);
	}
	long long steps = DFS(0);
	cout<<steps<<endl;
	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define REP(i,n,s) for (int i = (s); i < (n); i++)
using namespace std;
typedef long long int LL;

LL MOD;
int H, W, N, C;

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

	cin >> H >> W >> N >> MOD;

	LL res = 0, p = 1;
	REP(i, H, 0) {
		REP(j, W, 0) {
			cout << "? " << i << " " << j << " " << i << " " << j << endl;
			cin >> C;
			res = (res + p * C % MOD) % MOD;
			p = p * 2 % MOD;
		}
	}
	cout << "! " << res << endl;
}

Measured memory_bytes: 724
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <iomanip>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;

typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<VVD> VVVD;

/*

Dijstra
頂点を拡張して属性を持たせる
ノード番号・直前の道・速度 := 時間
終点の速度 1の状態から min_element


元・行先・距離・制限速度

*/

struct Edge
{
	int to, dist, c;
	Edge( int t, int d, int c ) : to( t ), dist( d ), c( c ) {}
};

struct State
{
	int node, prev, speed;
	State( int n, int p, int s ) : node( n ), prev( p ), speed( s ) {}

	bool operator < ( const State &a ) const
	{
		return node < a.node;
	}
};

const double INF = 1e10;

int main()
{
	cout.precision( 4 );
	cout << fixed;

	while ( true )
	{
		int n, m;
		cin >> n >> m;

		if ( !( n | m ) )
		{
			break;
		}
		
		int s, g;
		cin >> s >> g;
		s--;
		g--;

		vector< vector<Edge> > G( n );
		for ( int i = 0; i < m; i++ )
		{
			int x, y, d, c;
			cin >> x >> y >> d >> c;
			x--;
			y--;

			G[x].push_back( Edge( y, d, c ) );
			G[y].push_back( Edge( x, d, c ) );
		}

		// 現在地・直前のノード・速度
		VVVD dist( n, VVD( n, VD( 101, INF ) ) );
		dist[s][s][0] = 0;

		priority_queue< pair<double,State>, vector< pair<double,State> >, greater< pair<double,State> > > que;
		que.push( make_pair( 0, State( s, s, 0 ) ) );
		
		while ( !que.empty() )
		{
			double d = que.top().first;
			State cur = que.top().second;
			que.pop();

			if ( dist[ cur.node ][ cur.prev ][ cur.speed ] < d )
			{
				continue;
			}

			for ( int i = 0; i < G[ cur.node ].size(); i++ )
			{
				Edge &e = G[ cur.node ][i];

				if ( e.to == cur.prev )
				{
					continue;
				}

				for ( int ds = -1; ds <= 1; ds++ )
				{
					int nspeed = cur.speed + ds;

					if ( nspeed <= 0 || e.c < nspeed )
					{
						continue;
					}

					if ( dist[ cur.node ][ cur.prev ][ cur.speed ] + e.dist / (double)nspeed < dist[ e.to ][ cur.node ][ nspeed ] )
					{
						dist[ e.to ][ cur.node ][ nspeed ] = dist[ cur.node ][ cur.prev ][ cur.speed ] + e.dist / (double)nspeed;
						que.push( make_pair( dist[ e.to ][ cur.node ][ nspeed ], State( e.to, cur.node, nspeed ) ) );
					}
				}
			}
		}

		// 解候補：終点ノード・どこからでも・速度１
		double res = INF;
		for ( int i = 0; i < n; i++ )
		{
			res = min( res, dist[g][i][1] );
		}

		if ( res == INF )
		{
			cout << "unreachable" << endl;
		}
		else
		{
			cout << res << endl;
		}
	}
}

Measured memory_bytes: 2496
Q = int(input())
lr = [list(map(int, input().split())) for _ in range(Q)]

MAGIC_NUMBER = 100000
isprime = [True] * (MAGIC_NUMBER + 1)
for p in range(2, MAGIC_NUMBER + 1):
    if not isprime[p]: continue
    i_p = 2
    while p * i_p <= MAGIC_NUMBER:
        isprime[p * i_p] = False
        i_p += 1

primes = []
for p in range(2, MAGIC_NUMBER + 1):
    if isprime[p]: primes.append(p)

candidates = []
for p in primes:
    if p % 2 == 0: continue
    #
    if isprime[(p + 1) // 2]: candidates.append(p)


import bisect
    
for i, (li, ri) in enumerate(lr):
    i_l = bisect.bisect_left(candidates, li)
    i_r = bisect.bisect_left(candidates, ri)
    #
    if i_r < len(candidates) and candidates[i_r] == ri: i_r += 1
    print(i_r - i_l)

Measured memory_bytes: 31140
import math

a, b = (int(x) for x in input().split())
ans = 0
i = 0
ok = False

while i < 10000 :
    case_a = math.floor(i * 0.08)
    # print(case_a)
    case_b = math.floor(i * 0.10)
    # print(case_b)

    if case_a == a and case_b == b :
        
        ans = i
        ok = True
        break

    i = i + 1

if ok == False : 
    ans = -1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2000 + 5;
int a[105],b[15];
int main(){
	for(int i = 1; i <= 9; i++){
		int x;
		cin >> x;
		a[x] = i;
	}
	int n;
	cin >> n;
	int flag = 0;
	for(int i = 1; i <= n; i++){
		int x;
		cin >> x;
		if(a[x])
			b[a[x]] = 1;
	}
	if((b[1] == 1 && b[2] == 1 && b[3] == 1) || (b[4] == 1 && b[5] == 1 && b[6] == 1) || (b[7] == 1 && b[8] == 1 && b[9] == 1) ||(b[1] == 1 && b[4] == 1 && b[7] == 1) || (b[2] == 1 && b[5] == 1 && b[8] == 1) || (b[3] == 1 && b[6] == 1 && b[9] == 1) || (b[1] == 1 && b[5] == 1 && b[9] == 1) || (b[3] == 1 && b[5] == 1 && b[7] == 1))
		flag = 1;
	if(flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
from math import floor


def f(x, a, b):
    return floor((x * a) / b) - a * floor(x / b)


def main():
    a, b, n = map(int, input().split())
    if n < min(a, b):
        print(f(n, a, b))
    elif min(a, b) <= n < max(a, b):
        print(max(f(min(a, b) - 1, a, b), f(n, a, b)))
    else:
        print(max(f(max(a, b) - 1, a, b), f(min(a, b) - 1, a, b)))


if __name__ == '__main__':
    main()



Measured memory_bytes: 9216
class Node:
    def __init__(self, parent, left, right):
        self.parent = parent
        self.left = left
        self.right = right
        self.sibling=-1
        self.degree=2
        self.height=None

    def get_depth(self):
        if self.parent == -1:
            return 0
        else:
            depth = 1
            t = Nodes[self.parent]
            while t.parent != -1:
                t=Nodes[t.parent]
                depth += 1
            return depth
    
    def get_height(self):
        height = 0
        height2 = 0

        if self.right != -1:
            t = Nodes[self.right]
            height =t.get_height()+1

        if self.left != -1:
            t2 = Nodes[self.left]
            height2=t2.get_height()+1
            # height2 += 1

        self.height=max(height,height2)
        return self.height

    def get_type(self):
        if self.parent == -1:
            return 'root'
        elif self.left == -1 and self.right == -1:
            self.degree=0
            return 'leaf'
        else:
            return 'internal node'

    def get_degree(self):
        degree = 0
        if self.left != -1:
            degree += 1
        if self.right != -1:
            degree += 1
        return degree

def decode_node_data(n):
    '''
    n...受け取る文字列、一行ずつ
    一行ずつ、文字列からノードに変化する
    '''
    global Nodes
    num_of_elem = len(n)
    if num_of_elem < 2:
        raise ValueError
    elif num_of_elem == 2:  # leaf
        pass

    else:
        id, left,right = list(map(int,n))
        # まず、一人目の子供をとりあえず左に格納する
        Nodes[id].left = left
        if left!=-1:
            Nodes[left].sibling=right
            Nodes[left].parent=id
        
        Nodes[id].right = right
        if right !=-1 :
            Nodes[right].sibling=left
            Nodes[right].parent=id

MAX_NODES = 100001
Nodes = [Node(-1, None, None) for _ in range(MAX_NODES)]

if __name__ == "__main__":

    num_of_nodes = int(input())
    node_data = []
    for _ in range(num_of_nodes):
        node_data.append(input().split(' '))

    for n in node_data:
        decode_node_data(n)

    for node_id in range(num_of_nodes):
        type = Nodes[node_id].get_type()
        p=Nodes[node_id]

        print('''node {0}: parent = {1}, sibling = {2}, degree = {3}, depth = {4}, height = {5}, {6}'''.format(
            node_id, p.parent,p.sibling,p.get_degree(), p.get_depth(), p.get_height(), type))


Measured memory_bytes: 27172
def diff(a,b,c):
	string = [a,b,c]
	num = len(list(set(string)))
	if num == 3:
		return 2
	elif num == 2:
		return 1
	elif num == 1:
		return 0

N = int(input())
A = str(input())
B = str(input())
C = str(input())

count=0
for i in range(N):
	count += diff(A[i],B[i],C[i])

print(count)
exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
using namespace std;
const int mod=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    char c;
    cin >> c;
    char ans = c+1;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

const int MAXN = 100010;
int a[MAXN];
int main(int argc, char const *argv[])
{
	int n,k;
	while(~scanf("%d%d",&n,&k)){
		for(int i = 0; i < n; i++)
			scanf("%d",&a[i]);
		sort(a,a + n);
		//for(int i = 0; i < n; i++)
            //printf("%d\n",a[i]);
		int minn = INF;
		for(int i = 0; i < n - k + 1; i++){
		    //cout << a[i + k - 1] - a[i] << endl;
			minn = min(minn,a[i + k - 1] - a[i]);
		}
		printf("%d\n",minn);
	}
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#define rep(i,n) for(long long i=0;i<n;++i)
#define mod 1000000007
using namespace std;
typedef long long ll;

int main()
{
	int N;	cin >> N;
	string s;
	ll m = 0, a = 0, r = 0, c = 0, h = 0;
	ll num[5];
	int A[10] = { 0,0,0,0,0,0,1,1,1,2 }, B[10] = { 1,1,1,2,2,3,2,2,3,3 }, C[10] = { 2,3,4,3,4,4,3,4,4,4 };
	rep(i, N) {
		cin >> s;
		if (s[0] == 'M')++m;
		if (s[0] == 'A')++a;
		if (s[0] == 'R')++r;
		if (s[0] == 'C')++c;
		if (s[0] == 'H')++h;
	}
	num[0] = m, num[1] = a, num[2] = r, num[3] = c, num[4] = h;
	ll ans = 0;
	rep(i, 10) ans += num[A[i]] * num[B[i]] * num[C[i]];
	cout << ans << endl;
	cin >> N;
	return 0;
}

Measured memory_bytes: 256
import heapq
import copy
N=int(input())
A=list(map(int,input().split()))
ca=copy.deepcopy(A)
fsl=[0 for i in range(N+1)]
f=ca[:N]
heapq.heapify(f)
fs=sum(f)
fsl[0]=fs
for i in range(N,2*N):
    heapq.heappush(f,A[i])
    fs=fs+A[i]-heapq.heappop(f)
    fsl[i-N+1]=fs
lsl=[0 for i in range(N+1)]
l=list(map(lambda x:-x,ca[2*N:]))
heapq.heapify(l)
ls=sum(l)
lsl[-1]=ls
for i in range(N,2*N):
    heapq.heappush(l,-A[3*N-i-1])
    ls=ls-A[3*N-i-1]-heapq.heappop(l)
    lsl[2*N-i-1]=ls
ans=-10**20
for i in range(N+1):
  ans=max(ans,fsl[i]+lsl[i])
print(ans)


Measured memory_bytes: 122180
/*
×¢Òâ·¶Î§£¡
short·¶Î§£º-32768~32767
unsigned short·¶Î§£º0~65535
int·¶Î§£º-2147483648~2147483647
uint·¶Î§£º0~4294967295
INT·¶Î§£º-9223372036854775808~9223372036854775807
UINT·¶Î§£º0~18446744073709551615
float·¶Î§£º-3.4e38~3.4e38£¬¾«¶È£º6~7Î»
double·¶Î§£º-1.7e308~1.7e308£¬¾«¶È£º15~16Î»
ldouble·¶Î§£º-1.2e4932~1.2e4932£¬¾«¶È£º18~19Î»
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define LL long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define FILL(a,v) memset((void*)a,v,sizeof(a))
#define FILL0(a) FILL(a,0)
#define FILL1(a) FILL(a,-1)
#define ALL(a) (a).begin(),(a).end()
#define Inf 1e9
#define Mod 1000000007
#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define FOR(i,x) for(int i=1;i<=x;i++)
#define RFOR(i,x) for(int i=x-1;i>=0;i--)
#define FFOR(i,a,b) for(int i=a;i<b;i++)
#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second
#define OVER(a) return puts(a),0
#define fastio ios::sync_with_stdio(0)
#define filei(a) freopen(a,"r",stdin)
#define fileo(a) freopen(a,"w",stdout)
using namespace std;
using namespace __gnu_cxx;
typedef pair<int,int> pii;
typedef unsigned long long UINT;
typedef unsigned int uint;
typedef long long INT;
typedef pair<INT,INT> PII;
typedef long double ldouble;

int n,k;
int a,b;
vector<int> neigh[2007];
int shp[2007][2007],removed[2007],rm=0;
set<int> ngood[2007];
bool lgl[2007];

void bfs(int c)
{
	memset(lgl,0,sizeof(lgl));
	queue<int> q,bs;
	q.push(c);
	bs.push(0);
	shp[c][c]=0;
	lgl[c]=1;
	while(q.size())
	{
		int Q=q.front(),B=bs.front();
		q.pop(),bs.pop();
		for(int i=0;i<neigh[Q].size();i++)
		{
			if(!lgl[neigh[Q][i]])
			{
				q.push(neigh[Q][i]);
				bs.push(B+1);
				lgl[neigh[Q][i]]=1;
				shp[c][neigh[Q][i]]=B+1;
			}
		}
	}
}

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n-1;i++)
	{
		scanf("%d%d",&a,&b);
		neigh[a].push_back(b);
		neigh[b].push_back(a);
	}
	for(int i=1;i<=n;i++)
		bfs(i);
	FOR(i,n)
		FOR(j,n)
			if(shp[i][j]>k)
				ngood[i].insert(j);
	while(1)
	{
		pii maxn=mp(0,0);
		FOR(i,n)if(!removed[i])
			maxn=max(maxn,mp(SZ(ngood[i]),i));
		if(maxn.first==0)break;
		removed[maxn.second]=1;
		FOR(i,n)if(!removed[i])
			ngood[i].erase(maxn.second);
		rm++;
	}
	printf("%d\n",rm);
	return 0;
}

Measured memory_bytes: 203392
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (int)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

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

    string S;
    cin >> S;
    if(len(S) % 2 != 0){
        print("No");
        return 0;
    }

    bool flag = true;
    for (int i = 0; i < len(S) - 1; i += 2){
        if(S[i] == 'h' && S[i+1] == 'i') flag = flag;
        else flag = false; 
    }

    if(flag) print("Yes");
    else print("No");

        return 0;
}

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

using namespace std;
#define ll long long
const int N = 2e5 + 5, mod = 1e9 + 7;

ll p[N];

pair<ll, ll> inv(pair<ll, ll> x) {
    bool neg = 1;
    if (x.first < 0) neg = 0;
    pair<ll, ll> ret = {abs(x.second), abs(x.first)};
    if (neg) ret.first *= -1;
    return ret;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    p[0] = 1;
    for (int i = 1; i < N; i++) {
        p[i] = p[i - 1] * 2;
        p[i] %= mod;
    }
    map<pair<ll, ll>, ll> mp;
    int n;
    cin >> n;
    ll zeros1 = 0, zeros2 = 0, full = 0;
    for (int i = 1; i <= n; i++) {
        ll a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            full++;
            continue;
        } else if (a == 0) {
            zeros1++;
            continue;
        } else if (b == 0) {
            zeros2++;
            continue;
        }
        bool neg = 0;
        if ((a < 0) != (b < 0)) neg = 1;
        a = abs(a), b = abs(b);
        ll g = __gcd(a, b);
        pair<ll, ll> cur = {a / g, b / g};
        if (neg) cur.first *= -1;
        mp[cur]++;
//        cout << cur.first <<' ' << cur.second << endl;
    }
    ll ans = 1;
    for (auto it : mp) {
        if (it.second == 0) continue;
        ll cur = 0;
        pair<ll, ll> c = inv(it.first);
        if (mp.find(c) != mp.end()) {
            cur += p[it.second] - 1;
            cur += p[mp[c]] - 1;
            cur %= mod;
            mp[c] = 0;
            cur++;
        } else {
            cur = p[it.second];
        }
        ans *= cur;
        ans %= mod;
    }
    if (zeros1 && zeros2) {
        ll cur = 0;
        cur += p[zeros1] - 1;
        cur += p[zeros2] - 1;
        cur %= mod;
        cur++;
        ans *= cur;
        ans %= mod;
    } else if (zeros1 || zeros2) {
        ans *= p[(zeros1 + zeros2)];
        ans %= mod;
    }
    ans += full;
    ans %= mod;
    cout << (ans - 1 + mod) % mod;
    return 0;
}


Measured memory_bytes: 17676
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265359
int main(){
    int A,B,C; cin>>A>>B>>C;
    int ans=0;
    ans=C-(A-B);
    if(ans<=0){
        cout<<0;
    }
    else {
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var (
		n         int
		lastMochi int
		result    int
	)

	fmt.Scan(&n)

	mochis := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&mochis[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(mochis)))

	for i := 0; i < len(mochis); i++ {
		if lastMochi == 0 || lastMochi > mochis[i] {
			result++
			lastMochi = mochis[i]
		}
	}

	fmt.Println(result)
}


Measured memory_bytes: 512
// 043.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace  std;

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

	bool is_equal =
		a == b && a != c ||
		a == c && a != b ||
		b == c && b != a;
	cout << (is_equal ? "Yes" : "No");*/

	int n;
	cin >> n;
	vector<int> a(n);
	int ai;
	for (int i = 0; i < n; ++i)
	{
		cin >> ai;
		a[i] = ai;
	}

	bool is_approved = true;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] % 2 == 0)
		{
			if (a[i] % 3 != 0 && a[i] % 5 != 0)
			{
				is_approved = false;
				break;
			}
		}
	}

	cout << (is_approved ? "APPROVED" : "DENIED");
}



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

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

	if (a <= b)
	{
		if (b <= c)
		{
			cout << a + b << endl;
		}
		else
		{
			cout << a + c << endl;
		}
	}
	else
	{
		if (a <= c)
		{
			cout << a + b << endl;
		}
		else
		{
			cout << b + c << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    
    let mut a: u16 = read();
    let mut b: u16 = read();
    let mut sum = 0;

    let temp =std::cmp::max(a,b);
    sum += temp;
    if temp == a {
        a -= 1;
    }else if temp == b {
        b -= 1;
    }
    sum += std::cmp::max(a,b);

    println!("{}", sum);
}

Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(void)
{
    int d;
    cin >> d;
    if(d==25) cout << "Christmas";
    else if(d==24) cout << "Christmas Eve";
    else if(d==23) cout << "Christmas Eve Eve";
    else cout << "Christmas Eve Eve Eve";
    return 0;
}


Measured memory_bytes: 256
require "set"
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i)

hash = {}
a_arr.each do |a|
  hash[a] ||= 0
  hash[a] += 1
end

max = 0
set2 = Set.new
set3 = Set.new
hash.each do |k, v|
  set2 << k 
  if v == 1
    set3 << k
    max = k if k > max
  end
end

set2.each do |a|
  i = 2
  tmp = a * i
  while tmp <= max do
    set3.delete(tmp)
    i += 1
    tmp = a * i
  end
end

puts set3.size

Measured memory_bytes: 55032
import java.io.PrintWriter
val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }

fun func() {
    val (A, P) = listOfInt();
    val ans = (A * 3 + P) / 2
    println(ans)
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) } //{ it.toInt() }

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

int main() {
    int N;
    cin >> N;
    int minimum = 2000000000, maximum = 0; // 十分小さな値と十分大きな値

    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        minimum = min(minimum, tmp);
        maximum = max(maximum, tmp);
    }
    
    cout << maximum - minimum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main(void) {
  int n;
  cin >> n;

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

  int count = 0;
  while(1) {
    for(int i = 0; i < n; i++) {
      if(a[i] % 2 != 0) {
	cout << count << endl;
	return 0;
      }
      a[i] /= 2;
    }
    count++;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

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

const LL  INF=1<<31;
const LL MOD=1000000007;



int main(){
     int n;
     cin>>n;
     if(n<1200)cout<<"ABC"<<endl;
     else cout<<"ARC"<<endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
f=1
m=10**9+7
for i in range(1,n+1):
    f=(f*i)%m
c=[0]
for i in range(1,n+1):
    c.append((c[-1]+f*pow(i,m-2,m))%m)
p=0
for i in range(n):
    p=(p+(c[n-i]+c[i+1]-c[1])*a[i])%m
print(p)

Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
const long long INF=1e18;
map<long long,long long>F;
long long A,B,C,D;
long long calc(long long n)
{
	if(F.count(n))return F[n];
	long long ans=INF;
	if(n<=INF/D)ans=n*D;
	for(int i=-1;i<=1;i++)
		if(n+i>0&&(n+i)%2==0&&(n+i)/2<n)
			ans=min(ans,calc((n+i)/2)+abs(i)*D+A);
	for(int i=-2;i<=2;i++)
		if(n+i>0&&(n+i)%3==0&&(n+i)/3<n)
			ans=min(ans,calc((n+i)/3)+abs(i)*D+B);
	for(int i=-4;i<=4;i++)
		if(n+i>0&&(n+i)%5==0&&(n+i)/5<n)
			ans=min(ans,calc((n+i)/5)+abs(i)*D+C);
	return F[n]=ans;
}
int main()
{
	int t;scanf("%d",&t);
	while(t--)
	{
		long long n;
		cin>>n>>A>>B>>C>>D;
		F.clear();
		cout<<calc(n)<<"\n";
	}
	return 0;
}

Measured memory_bytes: 4512
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto s = readln.split.map!(to!int);
    auto K = s[0];
    auto N = s[1];
    auto A = readln.split.map!(to!int).array;

    int ans = 1 << 29;

    foreach (i; 0..N) {
        auto a = A[i];
        auto b = A[(i+1)%N];
        auto c = (b > a) ? b - a : b + K - a;
        ans = min(ans, K - c);
    }

    ans.writeln;
}

Measured memory_bytes: 11384
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...) std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  std::string s, t; std::cin >> s >> t;
  auto ret = 0;
  rep(i, 0, 3) ret += s.at(i) == t.at(i);
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string e,m;
int l;
int main()
{
	cin>>e;
	m=e;
	l=e.length();
	if(l%2==0)
	{
		for(int i=0;i<l/2;i++)//双数长度 
		{
			swap(e[i],e[l-i-1]);
		}
	}
	else
	{
		for(int i=0;i<l/2;i++)//单数长度 
		{
			swap(e[i],e[l-i-1]);
		}
	}
	//改b为d，改d为b，改p为q，改q为p（不要搞错对应关系）
	for(int i=0;i<l;i++)
	{
		switch(e[i])
		{
			case 'b':
			{
				e[i]='d';
				break;
			}
			case 'd':
			{
				e[i]='b';
				break;
			}
			case 'p':
			{
				e[i]='q';
				break;
			}
			case 'q':
			{
				e[i]='p';
				break;
			}
		}
	}
	if(e==m)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 512
// Problem: https://codeforces.com/contest/1285/problem/E
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
 
#define ford(i, a, b, c)        for(int i=(a); i<(b); i+=(c))
#define fori(i, a, b)           ford(i,a,b,1)
#define rep(i, n)               fori(i,0,n)
#define ifor(i, a, b)           for(int i=(a); i>=(b); i--)
#define si(x)                   ((int)x.size())
#define SS                      ({int x;scanf("%d",&x);x;})
#define pb                      push_back
#define mp                      make_pair
#define all(a)                  a.begin(),a.end()
#define inf                     (int)1e9
#define linf                    (long long)1e18
#define V                       vector
#define S                       string
#define XX                      first
#define YY                      second
#define P(x)                    cout<<x<<"\n"
#define PVI(v)                  rep(i, si(v)) cout<<v[i]<<" "; puts("")
#define PPI(p)                  cout<<"("<<p.first<<", "<<p.second<<")\n"
#define PVPI(v)                 rep(i, si(v)) cout<<"("<<v[i].first<<", "<<v[i].second<<")"<<(i==si(v)-1?"":", ");puts("")
#define PA(arr1, arr2)          for(auto it = arr1; it != arr2; it++) cout<<*it<<" "; puts("");
typedef V<int> vi;
typedef V<S> vs;
typedef long long ll;
typedef pair<int,int> pii;
const int MOD7 = 1000000000+7;
const int MOD9 = 1000000000+9;
/* ################### Program Body starts here ################ */


int solve(vs& s, int r, int c) {
    queue<pii> q;
    q.push({r, c});
    int n = si(s), m = si(s[0]);
    V<vi> vis(n);
    rep(i, n) {
        vis[i].resize(m);
        rep(j, m) vis[i][j] = -1;
    }
    vis[r][c] = 0;
    int ans = 0;
    int di[] = {0, 0, 1, -1}, dj[] = {1, -1, 0, 0};
    while (!q.empty()) {
        pii p = q.front(); q.pop();
        rep(i, 4) {
            int x = p.XX+di[i], y = p.YY + dj[i];
            if (x >=0 && x < n && y>=0 && y<m && s[x][y] == '.' && vis[x][y] == -1) {
                vis[x][y] = 1+vis[p.XX][p.YY];
                ans = max(ans, vis[x][y]);
                q.push({x, y});
            }
        }
    }
    return ans;
}

int main() {
    int n = SS, m = SS;
    vs s(n);
    rep(i, n) cin>>s[i];
    int ans = 0;
    rep(i, n) rep(j, m) {
        if (s[i][j] == '.') ans = max(ans, solve(s, i, j));
    }
    cout<<ans<<"\n";
    
    

}


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

int power[20];

int abs(int n) {
  return (n < 0) ? -n : n;
}

int main(){
  int n,sum;
  while(cin>>n, n) {
    sum = 0;
    for(int i=0; i<n; ++i) {
      cin>>power[i];
      sum += power[i];
    }

    int ans = 1<<30,tmp;
    for(int i=0; i < 1<<n; ++i) {
      tmp = 0;
      for(int j=0; j<n; ++j)
	if(i & 1<<j) tmp += power[j];
      ans = min(ans, abs(sum-tmp-tmp));
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 864
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){
/*top加1之后将元素插入
 * top所指的位置
 */
  S[++top]=x;
}

int pop(){
  top--;
  /*返回top所指的元素*/
  return S[top+1];
}

int main(){
  int a,b;
  top = 0;
  char s[100];
	while (scanf("%s",s) !=EOF){
		if(s[0]=='+'){
			a = pop();
			b = pop();
			push(a+b);
		}else if(s[0]=='-'){
			b=pop();
			a=pop();
			push(a-b);
		}else if(s[0]=='*'){
			a=pop();
			b=pop();
			push(a*b);
		}else{
			push(atoi(s));
		}
	}		
	printf("%d\n",pop());
	return 0;
}



Measured memory_bytes: 2100