akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <string>

int N, M;
std::vector<int> H;
std::vector<int> alpha;
std::vector<int> isGood;
int count;

int main() {
  std::cin >> N >> M;
  H.assign(N, 0);
  isGood.assign(N, 1);
  alpha.assign(N, 0);
  for (int i = 0; i < N; i++) {
    alpha[i] = i;
  }
  for (int i = 0; i < N; i++) {
    std::cin >> H[i];
  }
  for (int i = 0; i < M; i++) {
    int A, B;
    std::cin >> A >> B;
    --A;
    --B;
    if (H[A] > H[B]) {
      alpha[alpha[B]] = A;
      isGood[B] = 0;
    } else if (H[A] == H[B]) {
      isGood[A] = 0;
      isGood[B] = 0;
    } else {
      alpha[A] = B;
      isGood[A] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    if (isGood[i] == 1) {
      ++count;
    }
  }
  std::cout << count << std::endl;
}

Measured memory_bytes: 4552
unittest
{
	assert( [ "3", "10 10", "20 20", "30 30" ].parse.expand.solve == 20 );
	assert( [ "3", "20 10", "20 20", "20 30" ].parse.expand.solve == 20 );
	assert( [ "6", "1 1000000000", "1 1000000000", "1 1000000000", "1 1000000000", "1 1000000000", "1 1000000000" ].parse.expand.solve == -2999999997 );

	assert( [ "3", "20 10", "20 20", "10 30" ].parse.expand.solve == 10 );		// 追加ケース
	assert( [ "3", "20 10", "20 20", "10 40" ].parse.expand.solve == 10 );		// 追加ケース
	assert( [ "3", "20 10", "30 20", "10 40" ].parse.expand.solve == 10 );		// 追加ケース
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto abs = new long[ 2 ][ n ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
	}
	return tuple( abs );
}

auto solve( long[ 2 ][] abs )
{
	auto anss = [ 0L, 0L ];
	auto t = 0L;
	foreach( c; abs.map!( x => x ~ ( x[ 0 ] + x[ 1 ] ) ).array.sort!( ( x, y ) => y[ 2 ] < x[ 2 ] ) )
	{
		anss[ t ] += c[ t ];
		t = ( t + 1 ) % anss.length;
	}
	return anss[ 0 ] - anss[ 1 ];
}


Measured memory_bytes: 8572
#include<stdio.h>
#define N 100
int main(){
  int n,A[N],i,j,hoge,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
	sum++;
	hoge=A[j];
	A[j]=A[j-1];
	A[j-1]=hoge;
      }
    }
  }
  for(i=0;i<n;i++){
    if(i!=0)
      printf(" ");
    printf("%d",A[i]);
      }
  printf("\n%d\n",sum);
  return 0;
}


Measured memory_bytes: 2072
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		int h[] = new int[n];

		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(br.readLine());
		}

		Arrays.sort(h);

		long ans = Long.MAX_VALUE;
		for (int i = 0; i < n - k + 1; i++) {
			long diff = h[i + k - 1] - h[i];
			ans = Math.min(ans, diff);
		}

		System.out.println(ans);
	}
}


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

using namespace std;

int main()
{
	int n, x = 0, numM = 0;
	string s;
	cin >> n >> s;
	
	for(int i = 0; i < n; i++)
	{
		if(s[i] == 'I')
			x++;
		else if(s[i] == 'D')
			x--;
		
		numM = max(numM, x);
	}
	
	printf("%d\n", numM);
	
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>

using namespace std;

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(1) << c.at(2) << endl;
}

Measured memory_bytes: 256
from fractions import gcd
from itertools import accumulate
N = int(input())
A = tuple(map(int, input().split()))
to_right = [0] + list(accumulate(A, gcd))[:-1]
to_left = list(reversed(list(accumulate(reversed(A), gcd))))[1:] + [0]
print(max(gcd(r, l) for r, l in zip(to_right, to_left)))


Measured memory_bytes: 16244
if __name__ == "__main__":
    N = int(input())
    s = []
    for i in range(N):
        s.append(str(input()))
    M = int(input())
    t = []
    for i in range(M):
        t.append(str(input()))
    s_dict = {}
    for ele in s:
        if ele in s_dict.keys():
            s_dict[ele] += 1
        else:
            s_dict[ele] = 1
    t_dict = {}
    for ele in t:
        if ele in t_dict.keys():
            t_dict[ele] += 1
        else:
            t_dict[ele] = 1
    buf = list(set(s + t))
    max = 0
    for ele in buf:
        s_num = 0
        t_num = 0
        if ele in s_dict.keys():
            s_num = s_dict[ele]
        if ele in t_dict.keys():
            t_num = t_dict[ele]
        if (s_num - t_num) > max:
            max = s_num - t_num
    print(max)


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

int main() {
  
  int a;
  cin >> a;
  int b;
  cin >> b;
  
  if(a*b%2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}

     


Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())

h = (0.5 * (H * 60 + M)) % 360
m = M * 6

r = math.radians(abs(h - m))

res = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(r))

print(res)


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

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let s = iter.next().unwrap().as_bytes();
    let mut head: i32 = 0;
    let mut tail: i32 = (s.len() - 1) as i32;
    let mut ans = 0;
    while head <= tail {
        if s[head as usize] != s[tail as usize] {
            ans += 1;
        }
        head += 1;
        tail -= 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


#define PRINT(s) cout << (s);
#define PRINTLN(s) cout << (s) << endl;

typedef long long int ll;

using namespace std;

// #define REP(i,N) for(int i = 0; i < N; i++)

//int main() {
//    int n;
//    bool rate[9];
//
//    for (int i = 0; i < 9; i++) {
//        rate[i] = false;
//    }
//
//    cin >> n;
//    int max = 0;
//    for (int i = 0; i < n; i++) {
//        int tmp;
//        cin >> tmp;
//        int key = (tmp >= 3200) ? 8 : tmp / 400;
//        rate[key] = true;
//        if (key == 8) max++;
//    }
//    int min = 0;
//    for (int i = 0; i < 8; i++) {
//        if (rate[i]) {
//            min++;
//        }
//
//    }
//    max += min;
//    cout << min << " " << max << endl;
//}

int main() {
    int n;
    int rate[9];
    for (int i = 0; i < 9; i++) {
        rate[i] = 0;
    }
    cin >> n;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        int key = tmp / 400;
        if (key > 8) key = 8;
        rate[key]++;
    }
    int max = 0;
    int min = 0;
    for (int i = 0; i < 8; i++) {
        if (rate[i] != 0) {
            max++;
            min++;
        }
    }
    if(min == 0) min = 1;
    max += rate[8];
    cout << min << " " << max << endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize("O3")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace ::std;
// clang-format off
template<typename T> T nxt() {T res; cin >> res; return res;}
#define tests() for (int _ = nxt<int>(); _ > 0; _--)
#define nxt1(t,n) t (n); cin >> n
#define nxt2(t,n,m) t (n),(m); cin >> n >> m
#define nxt3(t,n,m,k) t (n),(m),(k); cin >> n >> m >> k
#define rep(i, A) for (int i = 0 ; i < A ; i++)
#define ll long long
typedef pair<int,int> pii;typedef pair<ll, ll> pll;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<ll> vl;typedef vector<vl> vvl;
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){for(T ti : t)s<<ti<<" ";return s; }
#define all(x) (x).begin(), (x).end()
#define last(vec) vec[vec.size()-1]
#define has(c,x) ((c).find(x) != (c).end())
// clang-format on

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

    int N = nxt<int>();
    int dublet = 0;
    bool res = false;
    rep(i, N) {
        nxt2(int, D1, D2);
        if (D1 == D2) {
            dublet++;
            if (dublet == 3)
                res = true;
        } else {
            dublet = 0;
        }
    }

    cout << (res ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3648
def solve2(arr)
  ans = { }
  ans[[0, 0]] = true
  limit = arr.inject(0) { |s, e| s + e}
  arr.each_with_index do |elem, ind|
    (0..limit).each do |sum|
      if ans[[ind, sum]] or ans[[ind, sum - elem]]
        ans[[ind + 1, sum]] = true
      end
    end
  end
  ans  
end

def main2
  n = gets.chomp.to_i
  arr = gets.chomp.split(/\s/).collect { |x| x.to_i}
  q = gets.chomp.to_i
  questions = gets.chomp.split(/\s/).collect { |x| x.to_i}
  ans = solve2(arr)
  questions.each do |question|
    if ans[[arr.size, question]]
      puts "yes"
    else
      puts "no"
    end
  end  
end

main2

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

int main(){
    int l, r;
    cin >> l >> r;
    vector<int> solve;
    for (int i = l; i <= min(l + 4037, r); i++){
        solve.push_back(i % 2019);
    }
    int ans = 1'000'000'000;
    for (int i = 0; i < solve.size(); i++){
        for (int j = i + 1; j < solve.size(); j++) ans = min(ans, solve[i] * solve[j] % 2019);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 100010;
const int inf = 0x0fffffff;
#define LL long long
const long long mod = 1000000007;

int main()
{
	int N,L,T,W,X[maxn];
	int i, cur;
	cin >> N >> L >> T;
	cur = 0;
	for (i = 0; i < N; i ++)
	{
		cin >> X[i] >> W;
		if (W == 1)
		{
			cur += (X[i] + T) / L;
			X[i] = (X[i] + T) % L;
		}
		else
		{
			cur += (X[i] - T) / L;
			X[i] = (X[i] - T) % L;
			if (X[i] < 0)
			{
				X[i] += L;
				cur --;
			}
		}
		cur %= N;
	}
	cur = (cur + N) % N;
	sort(X, X+ N);
	for (i = 0; i < N; i ++)
		cout << X[(i + cur) % N] << endl;
	return 0;
}

Measured memory_bytes: 1536
N = int(input())
A = [int(a) for a in input().split()]

if N % 2 == 1:
    print(0)
else:
    X = [0] * 100100
    for i in range(N):
        X[A[i]] += 1
    Y = [0] * 100101
    for i in range(len(X)):
        Y[i+1] = Y[i] + X[i]
    ans = 0
    for i in range(len(Y)):
        if Y[i] == N//2:
            ans += 1
    print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;

    cin >> s;

    int i;
    int len = s.rfind('F');

    for (i = 0; i < len; i++) cout << s[i];
    cout << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int n;
	cin >> n;
	vi a(n);
	repz(i, n)cin >> a[i];

	sort(a.begin(), a.end());
	cout << abs(a[n - 1] - a[0]) << endl;


	system("pause");
	return 0;
}

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


vector<int> par;

void init(int n) {
  par.resize(n);
  rep(i,n){
    par[i] = i;
  }
}

int root(int x){
  if(par[x] == x) return x;
  else{
    return par[x] = root(par[x]);
  }
}

bool same(int x, int y){
  return root(x) == root(y);
}

void unite(int x, int y){
  x = root(x);
  y = root(y);
  if(x == y) return;
  par[x] = y;
}
  
  
int main(){
  int n,m;
  cin >> n >> m;

  par.resize(n);
  rep(i,n) par[i] = i;

  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    unite(a,b);
  }

  map<int,int> mp;
  rep(i,n) mp[root(i)]++;
  int ans = 0;
  for(auto p : mp) {
    ans = max(ans,p.second);
  }
  cout << ans << endl;
}


Measured memory_bytes: 13456
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  int A=0,B=0;

  cin >> A >> B;
  if(A+B<10){
    cout << A+B << endl;
  }else{
    cout << "error" << endl;
  }

  return 0;
}

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

ll N,A[2*100000],a;


int main(void){
    cin >> N;
    rep(i,N){
        cin >> a;
        A[i] = a - (i+1);
    }
    //rep(i,N)cout << A[i] <<" ";
    sort(A,A+N);
    ll b = A[N/2];
    ll ans = 0;
    rep(i,N)ans +=abs(A[i]-b);
    cout << ans << endl;
}


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

from collections import deque

N = int(input())

distance = {}
edge = [[] for _ in range(N + 1)]

for _ in range(N - 1):
    u, v, w = map(int, input().split())
    edge[u].append(v)
    edge[v].append(u)
    distance[str(u) + "_" + str(v)] = w
    distance[str(v) + "_" + str(u)] = w

color = [0 for _ in range(N + 1)]
q = deque([1]) # root => 1
done = [0 for _ in range(N + 1)]
done[1] = 1

while q:
    parent = q.pop()
    for e in edge[parent]:
        if e != parent and done[e] == 0:
            d = distance[str(parent) + "_" + str(e)]
            if d % 2 == 0:
                color[e] = color[parent]
            else:
                color[e] = 0 if color[parent] == 1 else 1
            q.append(e)
            done[e] = 1

print("\n".join(map(str, color[1:])))

Measured memory_bytes: 58820
while True: #無限に繰り返す
    num = int(input()) #標準入力
    if num == 0:break #入力値が0だった場合繰り返しを強制終了する
    else: #0でなければ
        num_list = [] #空リスト作成
        for _ in range(num): #入力回繰り返す
            num_list.append(int(input())) #標準入力をし、リストに加える
        num_list.sort() #リストを小さい順に並べる
        num_list.pop(-1) #リストの最高点を削除する
        num_list.pop(0) #リストの最低点を削除する
        num = sum(num_list) #リストの値を合計する
        num1 = len(num_list) #リストの長さを取得する
        print(int(num / num1)) #リストの平均を出力する


Measured memory_bytes: 5592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		for(int i = 1;i < 10;i++) {
			for(int j = 1;j < 10;j++) {
				if(N == i*j) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}

}

Measured memory_bytes: 23892
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;

typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    string s;
    cin >> s;
    int count = 0;
    rep(i, s.size()/2){
        if(s[i] != s[s.size() - i - 1]) count++;
    }
    cout << count;
}


Measured memory_bytes: 256
import math

def prime(n):
    nlist = list(range(2,n+1))
    sosu = []
    
    while True:
        if nlist[0]>math.sqrt(n):
            sosu.extend(nlist)
            break
        else:
            nlist0 = nlist[0]
            sosu.append(nlist0)
            nlist.pop(0)
            nlist = [num for num in nlist if num%nlist0 != 0]
    
    return sosu

while True:
    n = int(input())
    
    if n==0:
        break
    
    nsosu = prime(n)       
    
    count = 0
    for i in range(len(nsosu)):
        p = n-nsosu[i]
        if p in nsosu:
            count += 1
    
    Count = int((count+1)/2)
    print(Count)
    
    continue


Measured memory_bytes: 7196
from collections import deque

N = int(input())
A = [int(i) for i in input().split()]

Q = deque()

for i, a in enumerate(A):
    if i % 2 == 0:
        Q.append(a)
    else:
        Q.appendleft(a)

if N % 2 == 1:
    Q.reverse()
print(*Q)


Measured memory_bytes: 25412
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main() {
    int x[3], y[3];
    for (int i = 0; i < 3; ++i) {
        cin >> x[i] >> y[i];
    }
    double a[3];
    double max = 0.0;
    double sum = 0.0;
    for (int i = 0; i < 3; ++i) {
        int j = (i + 1 == 3) ? 0 : i + 1;
        a[i] = hypot(x[i] - x[j], y[i] - y[j]);
        sum += a[i];
        if (max < a[i]) {
            max = a[i];
        }
    }
    double s = sum / 2;
    //heron's formula
    double area = sqrt(s * (s - a[0]) * (s - a[1]) * (s - a[2]));
    //内接円の半径の公式
    double r = area / s;
    double left = 0.0, right = max;
    while (right - left > 1e-10) {
        double x = (left + right) / 2;
        //内側の三角形の1番大きい辺
        if (max * (r - x) / r >= 2 * x) {
            left = x;
        } else {
            right = x;
        }
    }
    cout << fixed << setprecision(10) << left << endl;
    return 0;
}


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

int main(){
	int N;
	cin>>N;
	
	int p[N];
	for(int i=0;i<N;i++)
		cin>>p[i];
	
	int k[N]={};
	int num=0;
	for(int i=0;i<N;i++){
		if(p[i]!=i+1){
			k[i]=p[i];
			num++;
		}
	}
	
	
	if(num==0||num==2)
		cout<<"YES";
	else 
		cout<<"NO";
	
	
	
		
	
	return 0;
}

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

int main(){
  int n,i,j,k,kotae=0;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  for(i=n-1;i>=2;i--){
    for(j=i-1;j>=1;j--){
      for(k=j-1;k>=0;k--){
        if(a[i]>=a[j]+a[k]){
          break;
        }
        kotae++;
      }
    }
  }
  cout<<kotae;
}


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

int main() {
  int N;
  cin >> N;
  vector<int64_t>data(N);
  for(int i=0;i<N;i++){
    int x=i;
    while(x<N){
      data.at(x)++;
      x+=i+1;
    }
  }
  int64_t ans=0;
  for(int i=0;i<N;i++){
    ans+=(i+1)*data.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 81396
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

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

  ll ans = 0;
  string k = "3";

  while (true) {
    if (stol(k) > stol(n)) break;

    if (k.find('3') != k.npos && k.find('5') != k.npos &&
        k.find('7') != k.npos) {
      ans++;
    }

    int l = k.length();
    for (int i = l - 1; i >= 0; i--) {
      if (k[i] == '3') {
        k[i] = '5';
        break;
      } else if (k[i] == '5') {
        k[i] = '7';
        break;
      } else {
        if (i == 0) {
          k = "";
          rep(j, l + 1) k += "3";
        }
        k[i] = '3';
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
import Control.Monad
import qualified Data.IntMap.Strict as IntMap
 
main = do
  n <- readLn
  as <- map read <$> replicateM n getLine
  print $ f n n 1 (mkd 1 as)
 
mkd _ [] = IntMap.empty
mkd k (a:as) = IntMap.insert k a (mkd (k+1) as)
 
f n t x d
  | t == -1 = -1
  | x == 2 = n - t
  | otherwise = f n (t-1) (d IntMap.! x) d

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

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

	string s = "";
	if (a > b) {
		for (int i = 0; i < a; i++) {
			s += to_string(b);
		}
		cout << s << endl;
	}
	else {
		for (int i = 0; i < b; i++) {
			s += to_string(a);
		}
		cout << s << endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n;
    cin >> n;

    int64_t prev = -1;
    int64_t current = 0, ans = 0;
    for (auto _ : irange(0L, n)) {
        int64_t h;
        cin >> h;
        if (h > prev) {
            current = 0;
        } else {
            ++current;
            ans = max(ans, current);
        }
        prev = h;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

int a,b,c,aa,bb,cc;

int main(){
	int i;
	scanf("%d%d%d",&a,&b,&c);
	if ((a&1)||(b&1)||(c&1)){
		printf("%d\n",i);
		return 0;
	}
	for (i=1;i<=100000;i++){
		aa=a; bb=b; cc=c;
		a=bb/2+cc/2;
		b=aa/2+cc/2;
		c=aa/2+bb/2;
		if ((a&1)||(b&1)||(c&1)){
			printf("%d\n",i);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}

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

int main()
{
   int h, w;
   cin >> h >> w;
   vector<vector<char>>a(h,vector<char>(w));
   for(int i = 0;i < h; i++){
      for(int j = 0; j < w; j++)cin >> a[i][j];
   }
   for(int i = 0; i < w+2; i++)cout << "#";
   cout << endl;
   for(int i = 0; i < h; i++){
      cout << "#";
      for(int j = 0; j < w; j++)cout << a[i][j];
      cout << "#";
      cout << endl;
   }
   for(int i = 0; i < w+2; i++)cout << "#";
   cout << endl;

}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;
  cin>>N;
  
  vector<long long> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  long long ans=0;
  
  
  for(int i=1;i<N;i++){
    if(A[i-1]>=A[i]){
      long long x=A[i-1]-A[i];
      A[i]+=x;
      ans+=x;
    }
  }
  
  cout<<ans<<endl;
}

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin>>x;
    if(x >= 30){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

Measured memory_bytes: 3620
//
// 
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define is_in(i, s) (s.find(i) != s.end())
#define all(x) (x).begin(),(x).end()
#define outl(x) cout<<x<<endl
#define outsp(x) cout<<x<<" "
typedef long long ll;
typedef pair<int,int> P;


#define MAX_N 100005
int h[MAX_N];
vector<int> edge[MAX_N];

int main() {
	int n,m;
	cin >> n >> m;
	rep(i,n)cin>>h[i];
	rep(i,m){
		int a,b;
		cin >> a >> b;
		a--;b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	int ans = 0;
	rep(i,n){
		bool good=true;
		rep(j,edge[i].size()){
			if(h[i]<=h[edge[i][j]]){
				good = false;
				break;
			}
		}
		ans += good;
	}
	outl(ans);


    return 0;
}



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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N, A, B;
	string S;
	cin >>N >>A >>B >>S;
	int a=0;
	int b=0;
	for (int i=0; i<N; i++) {
		if (A+B==a+b) {
			cout <<"No" <<endl;
			continue;
		}
		if ('a'==S.at(i)) {
			cout <<"Yes" <<endl;
			a++;
			continue;
		}
		if ('b'==S.at(i)) {
			if (B>b) {
				cout <<"Yes" <<endl;
				b++;
				continue;
			} 
		}
		cout <<"No" <<endl;
	}
	return 0;
}



Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

typedef pair<int, int> P;
struct UF {
  vector<int> u;
  vector<int> r;
  UF(int n) {
    for (int i=0; i<n; i++) {
      u.push_back(i);
      r.push_back(1);
    }
  }

  int find(int x) {
    if (u[x] == x) return x;
    return u[x] = find(u[x]);
  }

  void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return;
    if (r[x] < r[y]) swap(x, y);
    u[y] = x;
    r[x] += r[y];
    r[y] = 0;
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

int N, K, L;

int main() {
  cin >> N >> K >> L;
  UF x(N), y(N);
  for (int i=0; i<K; i++) {
    int a, b;
    cin >> a >> b;
    x.unite(a-1, b-1);
  }
  for (int i=0; i<L; i++) {
    int a, b;
    cin >> a >> b;
    y.unite(a-1, b-1);
  }

  map<P, int> m;
  for (int i=0; i<N; i++) {
    m[P(x.find(i), y.find(i))]++;
  }
  for (int i=0; i<N; i++) {
    cout << m[P(x.find(i), y.find(i))] << (i==N-1?"\n":" ");
  }
  return 0;
}


Measured memory_bytes: 12312
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <iomanip>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;

// a と b の最大公約数を返す
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}


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



// 素数判定
bool is_prime(ll N) {
    if (N == 1) return false;
    for (ll i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}


// 約数列挙
vector<ll> enum_divisors(ll N) {
    vector<ll> res;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            if (N/i != i) res.push_back(N/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}


// 素因数分解
vector<pair<ll, ll>> prime_factorize(ll N){
    vector<pair<ll, ll>> res;
    for(ll i = 2; i * i <= N; i++){
        if(N % i != 0)  continue;
        ll ex = 0;

        while(N % i == 0){
            ex++;
            N /= i;
        }

        res.push_back({i, ex});
    }

    if(N != 1)  res.push_back({N, 1});
    return res;
};



int main(){
    ll x;   cin >> x;
    ll y = lcm(360, x);
    cout << y / x << endl;


    return 0;
}


Measured memory_bytes: 3628
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	d = Dict{Int,Int}()
	for i in 1:n
		if haskey(d,a[i])
			d[a[i]]+=1
		else
			d[a[i]] = 1
		end
	end
	q = readline() |> parseInt
	s = sum(a)
	for i in 1:q
		b,c = readline() |> split |> parseMap
		k = 0
		if haskey(d,b)
			k = d[b]
		end
		println(s+(c-b)*k)
		s += (c-b)*k
		d[b] = 0
		if haskey(d,c)
			d[c]+=k
		else
			d[c] = k
		end
	end
end

main()

Measured memory_bytes: 206600
N, M = map(int, input().split())
# ab = [int(x) for _ in range(N) for x in input().split()]
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for st in range(len(ab)):
    dis = [abs(ab[st][0] - cd[cp][0]) + abs(ab[st][1] - cd[cp][1])  for cp in range(len(cd))]
    print(dis.index(min(dis))+1)

Measured memory_bytes: 9024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1000000007;
ll n,k,ans;
int main()
{
	scanf("%lld%lld",&n,&k);
	for(ll i=k;i<=n+1;++i) ans+=(n-i+1+n)*i/2-(i-1)*i/2+1,ans%=MOD;
	printf("%lld",ans%MOD);
	return 0;
}

Measured memory_bytes: 3824
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

void merge(int arr[], int l, int m, int r, int arr2[]) {
    int i, j, k;
    int n1 = m - l + 1;
    int n2 = r - m;
    int L[n1];
    int R[n2];
    int L2[n1];
    int R2[n2];
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1 + j];
    for (i = 0; i < n1; i++)
        L2[i] = arr2[l + i];
    for (j = 0; j < n2; j++)
        R2[j] = arr2[m + 1 + j];
    i = 0;
    j = 0;
    k = l;
    while (i < n1 && j < n2) {
        if (L[i] <= R[j]) {
            arr[k] = L[i];
            arr2[k] = L2[i];
            i++;
        } else {
            arr[k] = R[j];
            arr2[k] = R2[j];
            j++;
        }
        k++;
    }
    while (i < n1) {
        arr[k] = L[i];
        arr2[k] = L2[i];
        i++;
        k++;
    }
    while (j < n2) {
        arr[k] = R[j];
        arr2[k] = R2[j];
        j++;
        k++;
    }
}
void mergeSort(int array[], int l, int r, int array2[]) {
    if (l < r) {
        int m = l + (r - l) / 2;
        mergeSort(array, l, m, array2);
        mergeSort(array, m + 1, r, array2);
        merge(array, l, m, r, array2);
    }
}

int main(void)
{
    int N;
    cin >> N;
    int X[N], L[N], s[N], f[N];
    for(int i = 0; i < N; i++){
        cin >> X[i] >> L[i];
        s[i] = X[i]-L[i];
        f[i] = X[i]+L[i];
    }
    mergeSort(f, 0, N-1, s);
/*
    for(int i = 0; i < N; i++){
        cout << f[i] << " ,";
    }
    cout << endl;
    for(int i = 0; i < N; i++){
        cout << s[i] << " ,";
    }
    cout << endl;
*/
    int count = 0;
    int F = -1e9;
    for(int i = 0; i < N; i++){
        if(s[i] >= F){
            F = f[i];
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main()
{
	int n, d, x; cin >> n >> d >> x;
	vector<int> a(n);
	for (auto& e : a) cin >> e;

	int ans = x;
	for (int i = 0; i < n; i++) {
		ans++;
		int j = 1;
		while (a[i] * j + 1 <= d) ans++, j++;
	}

	cout << ans << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



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

	int n;
	cin >> n;

	int a[n+1];
	ll p[n+1];
	p[0] = 0;
	For(i,n) {
		cin >> a[i];
		p[i+1] = p[i] + a[i];
	}

	ll dp[n+1][n+1];
	for (int d=0; d<n; d++) {
		for (int i=1; i+d<=n; i++) {
			if (d == 0) {
				dp[i][i] = 0;
			} else {
				dp[i][i+d] = INFLL;
				for (int j=0; j<d; j++) {
					dp[i][i+d] = min(dp[i][i+d], dp[i][i+j] + dp[i+j+1][i+d] + p[i+d]-p[i-1]);
				}
			}
		}
	}
	cout << dp[1][n] << nl;

	return 0;
}


Measured memory_bytes: 1536
#include <cstdio>
#include <algorithm>
#include <cmath>

using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
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; }
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)

int main() {
	int n;
	int dam[100000];
	int mtn[100000];
	scanf("%d", &n);
	REP(i, n) {
		scanf("%d", &dam[i]);
	}

	int val = dam[0];
	FOR(i,1,n-1) {
		if (i % 2 == 1) {
			val -= dam[i];
		}
		else {
			val += dam[i];
		}
	}
	mtn[0] = val;
	FOR(i, 1, n - 1) {
		mtn[i] = (dam[i - 1] - mtn[i - 1] / 2) * 2;
	}

	printf("%d", mtn[0]);
	FOR(i,1,n-1) {
		printf(" %d", mtn[i]);
	}
	printf("\n");
}

Measured memory_bytes: 2048
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m,b;
    int point[101]={0};
    int target[101]={0};
    int target_point;
    cin>>n;
    cin>>m;
    for(int j=1;j<=m;j++){
        cin>>target[j];
    }
    for(int j=1;j<=m;j++){
        target_point=n;
        for(int i=1;i<=n;i++){
            cin>>b;
            if(i!=target[j]&&b==target[j]){
                point[i]++;
                target_point--;
            }
        }
        point[target[j]]+=target_point;
    }
    for(int i=1;i<=n;i++){
        cout<<point[i]<<endl;
    }
}


Measured memory_bytes: 3088
N, A, B = map(int, input().split())

if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    exit()

if A > B:
    print(0)
    exit()

# 全部A〜全部Bまでの範囲
ans = B * (N - 2) - A * (N - 2) + 1
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define mkpr(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()

typedef long long int ll;

ll general,total;
//ll chk[55];
//ll num[55];
//ll num2[55];
//ll num[ten5];
//ll num2[ten5];
//char cmap[10][10];
//priority_queue<ll> pqll;   //decrease
priority_queue<double> pqd;
//stack<int> stk;
//vector<pair<ll,ll>> vpll;
//vector<ll> vll;
//vector<double> vd;
//deque<ll> deq[55];
//list<int> li;
//set<int> sint;
//set<ll> sll;
//map<ll,ll> mp;

/*ll cmp(pair<ll,ll> a,pair<ll,ll> b)
{
    return a.first<b.first;
    //arrising
}*/

int main()
{
    double ans=0.0,half,d,d1,d2;
    //float f,g,h;
    long long int sum,sum2,n1,n2,n3;
    long long int m,n,o,i,j,k=1;
    long long int a,a1,a2,a3,a4,a5,a6;
    sum=sum2=n1=n2=n3=0;
    a=a1=a2=a3=a4=a5=a6=0;
    //string s,s1;
    //char now,pre,c;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>d;
        pqd.push(d);
    }
    a=2;
    while(pqd.size()>2)
    {
        ans+=pqd.top()/a;
        pqd.pop();
        a*=2;
    }
    d1=pqd.top();pqd.pop();
    d2=pqd.top();pqd.pop();
    ans+=(d1+d2)/a;
    cout<<ans;
    return 0;
}





Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
double pi = 3.141592653589793;
ll mod = 1000000007;
 
int main() {
    int N, K;
    cin >> N >> K;
    ll a[N];
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    ll ans = 9223372036854775807;
    for (int i = 0; i < (1 << (N - 1)); i++) {
        int count = 0;
        ll nowht = a[0];
        ll cost = 0;
        for(int j = 0; j < (N - 1); j++) {
            if ((i >> j) % 2 == 1){
                count++;
                if(a[j + 1] <= nowht) {
                    cost += (nowht - a[j + 1] + 1);
                    nowht++;
                }
            }
            if(a[j + 1] > nowht) {
                nowht = a[j + 1];
            }
        }
        if(count == K - 1) {
            if(cost < ans) {
                ans = cost;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

namespace {
    /** whole range */
    #define whole(xs) (xs).begin(), (xs).end()
    /** unique vector(erase duplicates) */
    #define uniq(xs) ((xs).erase(unique((xs).begin(), (xs).end()), (xs).end()))

    /** output whole vector. ex) vector<int>{1, 2, 3} -> '1 2 3'. */
    template<typename T>
    ostream& operator<<(ostream& os, const vector<T>& xs) {
       if (xs.empty()) return os;
       os << xs[0];
       for (auto i = 1; i < xs.size(); i++) os << ' ' << xs[i];
       return os;
    }
    
    int N;
    vector<int> D;
    void input() {
        cin >> N;
        D.resize(N);
        for (int i = 0; i < N; i++) cin >> D[i];
        D.push_back(0);
    }

    void solve() {
        vector<int> count(13, 0);
        for (int i = 0; i < D.size(); i++) {
            count[D[i]]++;
        }
        vector<int> X;
        for (int i = 0; i < 13; i++) {
            if (count[i] >= 3) {
                cout << 0 << endl;
                return;
            }
            if (count[i] >= 2 && (i == 0 || i == 12)) {
                cout << 0 << endl;
                return;
            }
        }
        if (count[1] >= 1) {
            cout << 1 << endl;
            return;
        }
        for (int i = 0; i < 13; i++) {
            for (int j = 0; j < min(count[i], 2); j++) {
                X.push_back(i);
            }
        }
        sort(whole(X));
        auto n = X.size();
        auto ans = 0;

        auto f = [&](int bit) {
            vector<int> d(n, 0);
            for (int i = 0; i < n; i++) {
                if (bit & (1 << i)) {
                    d[i] = X[i];
                } else {
                    d[i] = 24 - X[i];
                }
                if (d[i] < ans) return;
                if (i >= 1) {
                    int t = abs(d[i] - d[i - 1]);
                    if (min(t, 24 - t) < ans) return;
                }
            }
            sort(whole(d));
            int ret = 12;
            for (int i = 0; i < n; i++) {
                int j = (i + 1) % n;
                auto t = abs(d[i] - d[j]);
                ret = min(ret, min(t, 24 - t));
                if (ret < ans) return;
            }
            ans = max(ans, ret);
        };

        for (int bit = 0; bit < (1<<n); bit++) {
            f(bit);
        }
        cout << ans << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}



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

int main()
{
  long long n, k;
  cin >> n >> k;
  if (k % 2 == 0)
  {
    long long a = n / k;             //1からnのなかでkの倍数の個数
    long long b = (n + (k / 2)) / k; //
    cout << a * a * a + b * b * b << endl;
  }
  else
  {
    long long a = n / k;
    cout << a * a * a << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main(){
	int a, b, ans = 0;
	cin >> a >> b;
	for(int i = 0; i < 2; i++){
		if(a > b){
			ans += a;
			a--;
		}else{
			ans += b;
			b--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    auto T = sread();
    foreach (i; 0 .. S.length)
    {
        if (S[i .. $] ~ S[0 .. i] == T)
        {
            writeln("Yes");
            return;
        }
    }
    writeln("No");
}


Measured memory_bytes: 256
import sys

l = []
for i in sys.stdin:
    l.append(i)

for i in range(0,len(l)):
    l[i] = l[i].split()

for i in range(0,len(l)):
    if l[i][0] == '0' and l[i][1] == '0':
        continue
    x = l[i][0]
    y = l[i][1]
    if int(y) < int(x):
        temp = x
        x = y
        y = temp
    print(x,y)


Measured memory_bytes: 6244
n,m = map(int,input().split())
h = list(map(int,input().split()))
t = [True for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] <= h[b-1]:
        t[a-1] = False
    if h[a-1] >= h[b-1]:
        t[b-1] = False
count = 0
for i in t:
    if i:
        count+=1
print(count)


Measured memory_bytes: 19960
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    int n,c=0;
    n = s.length();
    for (int i = 0; i < n; i++) {
        if (s[i] == t[i]) {
            c++;
        }
    }
    if (c == n) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define ld long double
#define s second
#define vec vector<int>

using namespace std;

const int N = (int) 2e5 + 100;
const int M = (int) 2e6 + 100;
const int K = (int) 200;
const int INF = (int) 1e9 + 7;
const int mod = (int) 998244353;
const ld EPS = (ld) 1e-9;
const ll LINF = (ll) 1e15;

int n, m;
int a[N], b[N];
int robots[N], exits[N];
ll dp[N];
pii p[N];
map<int, int> t;

void upd(int x, ll val) {
    x += INF;
    while (x < 2 * INF) {
        (t[x] += val % INF) %= INF;
        x |= x  + 1;
    }
}
int get(int x) {
    x += INF;
    int ans = 0;
    while (x >= 0) {
        ans += t[x];
        ans %= INF;
        x &= x + 1;
        x--;
    }
    return ans;
}
int main() {
	srand(time(0));
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> robots[i];
    }
    for (int i = 1; i <= m; i++) {
        cin >> exits[i];
    }
    for (int i = 1; i <= n; i++) {
        int id_left = upper_bound(exits + 1, exits + m + 1, robots[i]) - exits - 1;
        int id_right = lower_bound(exits + 1, exits + m + 1, robots[i]) - exits;
        if (id_left == 0) {
            a[i] = INF;
        } else {
            a[i] = robots[i] - exits[id_left];
        }
        if (id_right == m + 1) {
            b[i] = INF;
        } else {
            b[i] = exits[id_right] - robots[i];
        }
    }
    vector<pii> p;
    int sz = 0;
    for (int i = 1; i <= n; i++) {
        a[i] *= -1;
        if (a[i] != -INF && b[i] != INF)
        p.pb(mp( a[i],b[i]));
    }
    sort(all(p));
    p.resize(unique(all(p)) - p.begin());
    ll anas = 0;
    int ptr = 0;
    for (int i = 0; i < sz(p); i++) {
        dp[i] = 1;
        while (p[i].f > p[ptr].f) {
            upd(INF-p[ptr].s, dp[ptr]);
            ptr++;
        }
        (dp[i] += get(INF-p[i].s - 1)) %= INF;
        anas += dp[i];
    }
    cout << (anas + 1) % INF;
	return 0;
}


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

int main(){
  int N;
  string S;
  cin>>N>>S;
  
  for(int i=0;i<S.size();i++){
    S.at(i)=S.at(i)+N;
    if(S.at(i)>'Z'){
      S.at(i)-=26;
    }
  }
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max({x,y,z})
#define MX4(x,y,z,p) max({x,y,z,p})
#define MX5(x,y,z,p,q) max({x,y,z,p,q})
#define MN3(x,y,z) min({x,y,z})
#define MN4(x,y,z,p) min({x,y,z,p})
#define MN5(x,y,z,p,q) min({x,y,z,p,q})
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################

const int MAX = 300 + 10;
char arr[MAX][MAX];
int ans[MAX][MAX];

void solve() {

    int n, m, k;
    SI(n);
    SI(m);
    SI(k);
    REP(i, n) scanf("%s", arr[i]);
    int cnt = 0;

    for(int i = 0 ; i < n ; i++) {
        bool has = false;
        for(int j = 0 ; j < m ; j++) {
            has |= arr[i][j] == '#';
        }
        if(has == false) {
            if(i > 0) {
                REP(j, m) {
                    ans[i][j] = ans[i-1][j];
                }
            }
        } else {
            int last = -1;
            REP(j, m) {
                if(arr[i][j] == '#') {
                    cnt++;
                    for(int z = last+1 ; z <= j ; z++){
                        ans[i][z] = cnt;
                    }
                    last = j;
                }
            }
            for(int j = last+1 ; j < m ; j++) {
                ans[i][j] = cnt;
            }
        }
    }

    int first = 0;
    for(int i = 0 ; i < n ; i++) {
        if(ans[i][0] == 0) continue;
        first = i;
        break;
    }

    for(int i = 0 ; i < n ; i++) {
        if(ans[i][0] == 0) {
            REP(j, m) {
                printf("%d ", ans[first][j]);
            }
        } else {
            for (int j = 0; j < m; j++)
            {
                printf("%d ", ans[i][j]);
            }
        }
        puts("");
    }

}

void init() {
    


}

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


Measured memory_bytes: 1152