akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int N = 1e+5 + 5;
long long int phi[N], s[N], M = 1e+9 + 7, n, k, ans;
long long int mobius[N], lpf[N];

void least_prime_factor()
{
    for (long long int i = 2; i < N; i++)

        // If it is a prime number
        if (!lpf[i])

            for (long long int j = i; j < N; j += i)

                // For all multiples which are not
                // visited yet.
                if (!lpf[j])
                    lpf[j] = i;
}

void Mobius(int n)
{
    // To store the values of Mobius function

    for (long long i = 1; i < N; i++)
    {

        // If number is one
        if (i == 1)
            mobius[i] = 1;
        else
        {

            // If number has a squared prime factor
            if (lpf[i / lpf[i]] == lpf[i])
                mobius[i] = 0;

            // Multiply -1 with the previous number
            else
                mobius[i] = -1 * mobius[i / lpf[i]];
        }
    }
}
long long int power(long long int x, int p)
{
    if (p == 0)
        return 1;
    long long int ans = power(x, p / 2);
    ans = (ans * ans) % M;
    if (p % 2 == 1)
        ans = (ans * x) % M;
    return ans;
}

int main()
{
    least_prime_factor();
    cin >> n >> k;
    Mobius(k);

    for (long long int x = 1; x <= k; x++)
    {
        long long int h = (mobius[x]+M)%M, tans = 0;
        for (long long int j = 1; j * x <= k; j++)
        {

            tans = (tans + (j * power(k / (j * x), n)) % M) % M;
        }
        tans = (tans * h) % M;
        ans = (ans + tans) % M;
    }
    cout << ans;
}

Measured memory_bytes: 5196
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from bisect import bisect_left

N,K = II()
x = III()
y = []
for i in range(N):
    if x[i]!=0:
        y.append(x[i])
    else:
        K -= 1
        N -= 1

minus = bisect_left(x,0)
ans = float('inf')

for i in range(min(minus+1,K+1)):
    if i==0: a=0
    else: a = y[minus-1-i+1]
    if K-i==0: b=0
    else:
        if minus+K-i-1<=N-1: 
            b = y[minus+K-i-1]
        else:
            continue
    temp = min(b-2*a,2*b-a)
    if temp<ans:
        ans = temp

print(ans)

Measured memory_bytes: 62576
import java.util.Stack;
import java.util.Scanner;

public class Main{
   public static void main(String[] wjy){
      Stack<String> s = new Stack<String>();
      Scanner in = new Scanner(System.in);
      String input = in.nextLine();
      in.close();
      Scanner amd = new Scanner(input);
      while (amd.hasNext()){
         String a = amd.next();
         if (a.equals("+")){
           int z = Integer.parseInt(s.pop())+Integer.parseInt(s.pop());
           s.push(z+"");
         }
         else if (a.equals("-")){
           int z = -Integer.parseInt(s.pop())+Integer.parseInt(s.pop());
           s.push(z+"");
         }
         else if (a.equals("*")){
           int z = Integer.parseInt(s.pop())*Integer.parseInt(s.pop());
           s.push(z+"");
         }
         else{
           s.push(a);
         }
    }
   amd.close();
   System.out.println(s.pop());
  }
}



Measured memory_bytes: 26252
using System;

class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		// スペース区切りの整数の入力

		// 文字列の入力
		//出力
		if (a>b)
		{
			for (int i = 0; i < a; i++)
			{
				Console.Write(b);

			}
		}
		else
		{
			for (int i = 0; i < b; i++)
			{
				Console.Write(a);

			}
		}
	}
}


Measured memory_bytes: 11092
def prime_factorize(a, n):
    now = len(a) - 1
    while n % 2 == 0:
        if now == -1:
            a.append(2)
            now += 1
        elif a[now] != 2:
            a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if now == -1:
                a.append(f)
                now += 1
            elif a[now] != f:
                a.append(f)
                now += 1
            n //= f
        else:
            f += 2

    if n != 1:
        if now == -1:

            a.append(f)
        elif a[now] != n:

            a.append(n)
    return a

n = int(input())
a = list(map(int, input().split()))
a.sort()

i = 0
ans = 0
for i in range(n - 1):
    if a[i] == a[i + 1]:
        ans = 1
        break
if ans:
    print("NO")
else:
    print("YES")

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

int main(void)
{
    int N;
    string s;
    cin >> N;
    cin >> s;
    
    if (N <= 1 || N % 2 != 0)
    {
        cout << "No" << endl;
        return 0;
    }
    
    string a = s.substr(0, s.size() / 2);
    string b = s.substr(s.size() / 2, s.size() / 2);
    
    cout << (a == b ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

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

  ll ans = 0, r = 0, sumv = 0;
  rep(l, 0, n) {
    while (r < n && (sumv ^ v[r]) == (sumv + v[r])) {
      sumv += v[r];
      r++;
    }
    ans += r - l;
    if (l == r)
      r++;
    else
      sumv -= v[l];
  }

  cout << ans << endl;
}


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

int main(){
  int N,K,x,ans;
  cin>>N>>K;
  int a[N];
  for(int i=0;i<N;i++){
    cin>>a[i];
    if(a[i]==1)
      x=i;
  }
  int j=0;
  int v=K;
  for(j=0;j<=N;j++){
    if(v>=N){
      break;
    }
    v=v+K-1;
  }
  ans=j+1;
  cout<<ans<<endl;
}
    

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


int main()
{
	typedef long long ll;
	
	ll a,v;  cin>>a>>v;
	ll b,w;  cin>>b>>w;
	ll t;  cin>>t;
	
	ll s=abs(a-b);
	ll s1=(v-w)*t;
	
	if(s<=s1)
	  cout<<"YES"<<endl;
	
	else 
	cout<<"NO"<<endl;

  return 0;
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

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

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

    ll T[N];
    rep(i, N) cin >> T[i];

    ll ans = T[0];
    repd(i, 1, N) {
        ans *= (T[i] / gcd(ans, T[i]));
    }

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

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

char X[1001],Y[1001];

int LCS_Length(void){
  int i,j;
  int m = strlen(X);
  int n = strlen(Y);
  int c[m+1][n+1];

  for(i=1 ; i<=m ; i++) c[i][0] = 0;
  for(j=0 ; j<=n ; j++) c[0][j] = 0;
  
  for(i=1 ; i<=m ; i++){
    for(j=1 ; j<=n ; j++){
      if(X[i-1] == Y[j-1]) c[i][j] = c[i-1][j-1] + 1;
      else if(c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j];
      else c[i][j] = c[i][j-1];
    }
  }
  return c[m][n]; 
}

main(){
  int i,n;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%s%s",X,Y);
    printf("%d\n",LCS_Length());
  }
  return 0;
}

Measured memory_bytes: 4512
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	string s;
	cin >> s;

	rep(i, 0, s.size()) {
		if(i + 1 < s.size()) {
			if(s[i] == s[i + 1]) {
				cout << i + 1 << " " << i + 2 << endl;
				return 0;
			}
		}

		if(i + 2 < s.size()) {
			if(s[i] == s[i + 2]) {
				cout << i + 1 << " " << i + 3 << endl;
				return 0;
			}
		}
	}

	cout << -1 << " " << -1 << endl;
}


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

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

    int n, k;
    cin >> n >> k;
    if (n % k) {
            cout << 1 << endl;
    } else  {
            cout << 0 << endl;
    }
    return 0;
}


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

using namespace std;
double dp[301][301][301];
int n;
double solve(int a,int b,int c){
    if(a < 0 || b < 0 || c < 0)
    return 0;
    else if( a== 0 && (b==0 && c==0))
    return 0;
    if(dp[a][b][c] != -1)
    return dp[a][b][c];
    double res = n;
    if(a > 0)
    res += a*solve(a-1,b+1,c);
    if(b>0)
    res += b*solve(a,b-1,c+1);
    if(c>0)
    res += c*solve(a,b,c-1);
    res /= (a+b+c);
    dp[a][b][c] = res;
    return res;
}
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(NULL);
    int  i,j,k,one =0, two=0,three=0;
   for(i=0;i<=300;i++){
       for(j=0;j<=300;j++){
           for(k=0;k<=300;k++){
               dp[i][j][k]=-1;
           }
       }
   }
    cin >> n;
    int arr[n];
    for(i=0;i<n;i++){
        cin >> arr[i];
        if(arr[i]==1)
        one ++;
        else if(arr[i]==2)
        two++;
        else
        three++;
    }
    
    cout << setprecision(10) << solve(three,two,one);;
     return 0;
}

Measured memory_bytes: 213376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main
{
  public static void main(String[] args)
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    ArrayList<Integer> inputList = new ArrayList<>(50);

    try
    {
      while (input.ready())
      {
        inputList.add(Integer.valueOf(input.readLine()));
      }
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }

    for (int num : inputList)
    {
      System.out.println(getLowerPrimeNumber(num) + " " + getHigherPrimeNumber(num));
    }
  }

  private static int getLowerPrimeNumber(int number)
  {
    for (int i = number - 1; i > 3; i--)
    {
      if (isPrimeNumber(i))
      {
        return i;
      }
    }
    return 2;
  }

  private static int getHigherPrimeNumber(int number)
  {
    for (int i = number + 1; i < Integer.MAX_VALUE; i++)
    {
      if (isPrimeNumber(i))
      {
        return i;
      }
    }
    return 2;
  }

  private static boolean isPrimeNumber(int number)
  {
    if (number % 2 == 0)
    {
      return false;
    }

    final int limit = (int) Math.sqrt(number);
    for (int i = 3; i <= limit; i++)
    {
      if (number % i == 0)
        return false;

    }

    return true;
  }
}

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

#define Pair make_pair
#define Push push_back
typedef long long lli;
typedef pair<lli,lli> pll;
typedef vector<lli> vcL;
typedef vector<pll> vPL;


void solve() {
	lli n, m;
	cin >> n >> m;

	vPL num( m, Pair( 0, 0 ) );
	lli _min = 1, _max = n;

	for (auto &x : num) {
		cin >> x.first >> x.second;
		_min = max( _min, x.first );
		_max = min( _max, x.second );
	}
	
	cout << max( 0LL, _max-_min+1 ) << '\n';
	
	return;
}

int main() {
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve();
	}
	return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================





int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================


	ll N;
	string S;
	cin >> N >> S;

	if (N == 1)
	{
		cout << 0 << endl;
		return 0;
	}


	ll ans = LLINF;
	// iまでを城にする
	vll to_white(N);
	to_white[0] = S[0] == '#';
	for (int i = 1; i < N; i++)
	{
		to_white[i] = to_white[i - 1] + (S[i] == '#');
	}


	// i以降をすべて黒にする
	vll to_black(N);
	to_black[N - 1] = S[N - 1] != '#';

	for (int i = N-2; i >= 0; i--)
	{
		to_black[i] = to_black[i + 1] + (S[i] != '#');
	}
	
	ll first_black = -1;
	for (int i = 0; i < N; i++)
	{
		if (S[i] == '#')
		{
			first_black = i;
			break;
		}
	}

	if (first_black == -1)
	{
		cout << 0 << endl;
		return 0;
	}

	to_black.emplace_back(0);
	// i文字目までを白にして、i+1以降を黒にする
	for (int i = 0; i < N; i++)
	{
		ans = min(ans, to_white[i] + to_black[i + 1]);
	}

	ans = min(ans, to_black[0]);

	cout << ans;

}





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

int main(){
    string S;
    cin >> S;
    int cnt = 0;
    for(int i = 0; i < S.size(); i++) {
        if(S[i] == 'o') {
            cnt++;
        }
    }
    if(cnt+(15-S.size()) >= 8) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
} 


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int llint;

const int N = 1e5 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;

vector < int > v1,v2;
int n,x;

int main(){
    scanf("%d",&n);
    for(int i = 0;i<n;i++){
        scanf("%d",&x);
        v1.push_back(x);
    }
    sort(v1.begin(),v1.end());
    for(int i = 0;i<n;i++){
        v2.push_back(abs(i - (n-i-1)));
    }
    sort(v2.begin(),v2.end());
    for(int i = 0;i<n;i++){
        if(v1[i] != v2[i]){
            printf("0\n");
            return 0;
        }
    }
    llint sol = 1;
    for(int i = 0;i<n/2;i++){
        sol *= 2;
        sol %= MOD;
    }
    printf("%lld\n",sol);
}


Measured memory_bytes: 1400
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    char ch;
	cin>>ch;
	if(ch>='A' && ch<='Z')
	cout<<"A";
	else
	{
		cout<<"a";
	}
	
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 10644
s = input()
before = s[0:2]
after = s[2:4]

b = 0<int(before)<13
a = 0<int(after)<13

if a and b:
    print('AMBIGUOUS')
elif a and not b:
    print('YYMM')
elif b and not a:
    print('MMYY')
else:
    print('NA')

Measured memory_bytes: 3060
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    h,a = mi()
    print(ceil(h/a))

        



main()


Measured memory_bytes: 5628
#include<iostream>
using namespace std;
int a[100000];
int n, t;
int main()
{
	cin >> n >> t;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	int minn = 2000000000;
	int maxn = 0;
	int cnt = 0;
	for(int i = 0; i < n; i++)
	{
		if(minn > a[i]) minn = a[i];
		else if(a[i] - minn > maxn) maxn = a[i] - minn, cnt = 1;
		else if(a[i] - minn == maxn) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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


static class NagataKanaIsAGenius {
    public static void Main() {
        long[]lr=Console.ReadLine().Split().Select(long.Parse).ToArray();
        long l=lr[0]-1;
        long r=lr[1];
        long ans=0;
        for(long i=l/4*4;i<=l;i++)ans^=i;
        for(long i=r/4*4;i<=r;i++)ans^=i;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13396
import java.util.Scanner
import java.util.concurrent.TimeUnit
 
object Main {
  def main (args: Array[String]) = {
    val in = new Scanner(System.in)
    val s = in.nextInt
    val hh = TimeUnit.SECONDS.toHours(s)
    val mm = TimeUnit.SECONDS.toMinutes(s) - TimeUnit.HOURS.toMinutes(hh)
    val ss = TimeUnit.SECONDS.toSeconds(s) - TimeUnit.HOURS.toSeconds(hh) - TimeUnit.MINUTES.toSeconds(mm)
 
    println("%d:%d:%d" format(hh, mm, ss))
  }
}

Measured memory_bytes: 45172
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxd = 1e5+10;
int t[maxd],flag,v[maxd];
vector<int> g[maxd];
int n,m;
const int mod =1e9+7;
void dfs(int x,int fa = 0,int d = 1)
{
    int now = m-1; 
    if(d > 2) v[x]--;
    if(v[x]<=0) 
    {
        flag=1;
        return;
    }
    //printf("%d %d\n",x,v[x]);
    for(int i=0;i<g[x].size();i++)
    {
        int k = g[x][i];
        if(k==fa) continue;
        v[k] = now;
        //printf("    %d %d\n",k,v[x]);
        dfs(k,x,d+1);
        now--;
    }
}
int main()
{
    // freopen("a.in","r",stdin);
    // freopen("k.out","w",stdout);
    scanf("%d %d",&n,&m);
    for(int i=1;i<n;i++)
    {
        int a,b;
        scanf("%d %d",&a,&b);
        g[a].push_back(b);
        g[b].push_back(a);
    }
    v[1] = m;dfs(1);
    long long ans = 1ll;
    // for(int i=1;i<=n;i++)
    // {
    //     printf("%d ",v[i]);
    // }
    if(flag) printf("0\n");
    else 
    {
        for(int i=1;i<=n;i++)
            ans = 1ll*ans * v[i] %mod;
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 10752
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>


int main()
{
	long long n, y;

	std::cin >> n >> y;

	for (long long i_10000 = 0; i_10000 <= n; i_10000++)
	{
		for (long long i_5000 = 0; i_5000 <= n - i_10000; i_5000++)
		{
			int remain = (y - (i_10000 * 10000 + i_5000 * 5000)) / 1000;
			if (remain == n - i_10000 - i_5000) {
				std::cout << i_10000 << " " << i_5000 << " " << remain << std::endl;
				return 0;
			}
		}
	}

	std::cout << -1 << " " << -1 << " " << -1 << std::endl;

	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i<N; i++)
#define RVROOP(i, N) for(int i=N; i>=0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int gcd(int a,int b){
  while(b!=0){
    a%=b;
    swap(a,b);
  }
  return a;
}
int main() {
  ll A, B; cin>>A>>B;
  ll ans=A*B;
  ans/=gcd(A,B);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

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

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a,b,x;
  cin >> a >> b >> x;
  if(x>=b*a*a/2){
    cout << fixed << setprecision(15) << atan(2*(a*a*b-x)/a/a/a)*180/3.14159265358979323846 << endl;
  }
  else{
    cout << fixed << setprecision(15) << atan(a*b*b/2/x)*180/3.14159265358979323846 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
#define rall(x) (x).rbegin(),(x).rend()
#define accum(x) accumulate((x).begin(),(x).end(),0)

int main(){
	int n; cin>>n;
	vector<int> v;
	rep(i,n){
		int a; cin>>a;
		if(a%2==0) v.push_back(a);
	}
	if(v.size()==0){cout<<0<<endl; return 0;}
	sort(rall(v));
	int cnt=0;
	while(!v.empty()){
		cnt++;
		int mx=v.size()-1;
		for(int i=0; i<mx-1; i++) v[i]*=3;
		if((v[mx]/2)%2==0) v[mx]/=2;
		else v.pop_back();
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3688
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))

int dp1[5010][5010];
int dp2[5010][5010];
int a[5010];
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	rep(i,1,n+1)scanf("%lld",a+i);
	
	dp1[0][1]=1;
	//dp1[i][j]=a[1..i]でj-1が作れるか？
	rep(i,1,n+1){
		rep(x,0,5005)dp1[i][x]|=dp1[i-1][x];
		rep(x,0,max(0,5005-a[i]))dp1[i][x+a[i]]|=dp1[i-1][x];
	}
	//dp1[i][j]=[0..j)のうちa[1..i]で作れるものがいくつあるか？
	rep(i,0,n)rep(x,1,5005)dp1[i][x]+=dp1[i][x-1];
	
	dp2[n+1][0]=1;
	//dp2[i][j]=a[i..n]でjが作れるか？
	for(ll i=n;i>=1;i--){
		rep(x,0,5005)dp2[i][x]|=dp2[i+1][x];
		rep(x,0,max(0,5005-a[i]))dp2[i][x+a[i]]|=dp2[i+1][x];
	}
	
	ll ans=0;
	rep(i,1,n+1){
		//a[i]が必要か？
		//⇔a[i]を使わずに[k-a[i],k)が作れるか？
		//⇔a[i+1..n]で作れるxとa[1..i-1]で作れるyであって、x+y∈[k-a[i],k)となるものがあるか？
		//⇔a[i+1..n]で作れるxであって、a[1..i-1]で[k-a[i]-x,k-x)が作れるものがあるか？
		rep(x,0,k)if(dp2[i+1][x]){
			if(dp1[i-1][max(0,k-x)]-dp1[i-1][max(0,k-x-a[i])]){
				ans++;
				break;
			}
		}
	}
	printf("%lld\n",n-ans);
	return 0;
}

Measured memory_bytes: 196096
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%d\n", a - b + 1);
	
	Please AC;
}


Measured memory_bytes: 256
fun main(args: Array<String>){
    val n = readLine()!!.toInt()
    val ll = mutableListOf<List<Long>>()
    for(i in 0..(n - 1)){
        val (a, b) = readLine()!!.split(" ").map(String::toLong)
        val l = listOf(a, b, a + b)
        ll.add(l)
    }
    ll.sortBy{it[2] * -1}
    var aSum = 0L
    var bSum = 0L
    for(i in 0..(n - 1)){
        if(i % 2 == 0) aSum += ll[i][0]
        else bSum += ll[i][1]
    }
    println(aSum - bSum)
}

Measured memory_bytes: 66800
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;

const int MAX_N = 2005;

class Edge {
public:
  int nxt, to;
} e[MAX_N * MAX_N << 1];

int head[MAX_N], cnt;
void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
}

priority_queue<int> q;

int N, A[MAX_N], vis[MAX_N], deg[MAX_N];
vector<int> G[MAX_N];

void dfs(int u, int v) {
  static int tot = 0;
  vis[u] = ++tot;
  sort(G[u].begin(), G[u].end());

  for (int i = 0; i < G[u].size(); ++i)
    if (!vis[G[u][i]]) {
      deg[G[u][i]]++, addedge(u, G[u][i]);
      dfs(G[u][i], u);
    } else if (G[u][i] != v && vis[G[u][i]] < vis[u]) {
      deg[u]++;
      addedge(G[u][i], u);
    }
}

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
  sort(A + 1, A + N + 1);
  
  for (int i = 1; i <= N; ++i)
    for (int j = i + 1; j <= N; ++j)
      if (__gcd(A[i], A[j]) != 1) {
	G[i].push_back(j);
	G[j].push_back(i);
      }
  
  for (int i = 1; i <= N; ++i) 
    if (!vis[i])
      dfs(i, 0);

  for (int i = 1; i <= N; ++i)
    if (!deg[i]) 
      q.push(i);

  while (!q.empty()) {
    int u = q.top();
    q.pop();
    printf("%d ", A[u]);
    for (int i = head[u]; i; i = e[i].nxt) {
      deg[e[i].to]--;
      if (!deg[e[i].to]) q.push(e[i].to);
    }
  }
  puts("");
  return 0;
}


Measured memory_bytes: 27904
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

typedef long long ll;

int v[100001];
int numEven[100001];
int numOdd[100001];

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

  for ( int i = 1; i <= n; i++ ) {
    cin >> v[i];
    if ( i % 2 == 0 ) {
      numEven[v[i]]++;
    } else {
      numOdd[v[i]]++;
    }
  }
  
  bool f = true;
  int top = v[1];
  for ( int i = 2; i <= n; i++ ) {
    if( top != v[i] ) f = false;
  }

  if (f) {
    cout << n/2 << endl;
    return 0;
  }
  
  int maxNumEven = 0;
  int Even;
  int maxNumOdd = 0;
  int Odd;
  
  for ( int i = 1; i <= 100000; i++ ) {
    if ( numEven[v[i]] > maxNumEven ) {
      maxNumEven = numEven[v[i]];
      Even = v[i];
    }
  }

  for ( int i = 1; i <= 100000; i++ ) {
    if ( numOdd[v[i]] > maxNumOdd && v[i]  ) {
      maxNumOdd = numOdd[v[i]];
      Odd = v[i];
    }
  }
  
  if ( Even != Odd ) f = true;

  if (f) {
    int cnt = 0;

    for ( int i = 2; i <= n; i+=2 ) {
      if ( v[i] != Even ) cnt++;
    }
    
    for ( int i = 1; i <= n; i+=2 ) {
      if ( v[i] != Odd ) cnt++;
    }
    
    cout << cnt << endl;
    return 0;
  } else {
    ///
    int tmpEven = Even;
    int tmpOdd = Odd;
 
    maxNumEven = 0;
    maxNumOdd = 0;
    
    for ( int i = 1; i <= 100000; i++ ) {
      if ( numEven[v[i]] > maxNumEven && v[i] != tmpEven ) {
	maxNumEven = numEven[v[i]];
	Even = v[i];
      }
    }

    for ( int i = 1; i <= 100000; i++ ) {
      if ( numOdd[v[i]] > maxNumOdd   ) {
	maxNumOdd = numOdd[v[i]];
	Odd = v[i];
      }
    }

    int cnt1 = 0;

    for ( int i = 2; i <= n; i+=2 ) {
      if ( v[i] != Even ) cnt1++;
    }
    
    for ( int i = 1; i <= n; i+=2 ) {
      if ( v[i] != Odd ) cnt1++;
    }
    


    ///
    maxNumEven = 0;
    maxNumOdd = 0;
    
    for ( int i = 1; i <= 100000; i++ ) {
      if ( numEven[v[i]] > maxNumEven  ) {
	maxNumEven = numEven[v[i]];
	Even = v[i];
      }
    }

    for ( int i = 1; i <= 100000; i++ ) {
      if ( numOdd[v[i]] > maxNumOdd && v[i] != tmpOdd ) {
	maxNumOdd = numOdd[v[i]];
	Odd = v[i];
      }
    }
  
    int cnt2 = 0;

    for ( int i = 2; i <= n; i+=2 ) {
      if ( v[i] != Even ) cnt2++;
    }
    
    for ( int i = 1; i <= n; i+=2 ) {
      if ( v[i] != Odd ) cnt2++;
    }
    
    cout << min(cnt1,cnt2) << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int Mod=2019;
typedef long long lol;
lol ans,c[2020],a[200005];
char s[200005];
int n,pow10;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	pow10=1;
	for (int i=n-1;i>=0;i--)
	{
		a[i]=(a[i+1]+(s[i]-'0')*pow10%Mod)%Mod;
		pow10=pow10*10%Mod;
	}
	c[0]++;
	for (int i=n-1;i>=0;i--)
	{
		ans+=c[a[i]];
		//printf("%d %d %d\n",i,a[i],c[a[i]]);
		c[a[i]]++;
	}
	cout<<ans;
} 

Measured memory_bytes: 5412
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    int2(n, m);
    vector < i_i > s(n), t(m);
    rep(i, n) {
        cin >> s[i].first >> s[i].second;
    }
    rep(i, m) {
        cin >> t[i].first >> t[i].second;
    }
    rep(i, n) {
        int ans = 0, ans_t = INF;
        rep(j, m) {
            int tmp = abs(s[i].first - t[j].first) +
                abs(s[i].second - t[j].second);
            if (tmp < ans_t) {
                ans_t = tmp;
                ans = j;
            }
        }
        cout << ans+1 << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class A {
	int r, g;
public:
	A()
	{
		cin >> r >> g;
	}
	void solve()
	{
		cout << 2 * g - r << endl;
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
arr, numbers, result = Array.new(n + 1, 0), [], []
m.times{
    numbers << gets.to_i
    arr[numbers.last] += 1
}
numbers.each{|x|
    arr[x] -= 1
    if arr[x] == 0
        arr[x] = -1
        result << x
    end
}
puts result.reverse
1.upto(n+1){|i| puts i if arr[i] == 0}



Measured memory_bytes: 10904
#include <iostream>
using namespace std;
const int M = 200005;

int mleft[M],mright[M];
int A[M];

int main()
{
	int n;
	cin >> n;
	//vector<int> A(n);
	//int A[M];
	for (int i = 0; i < n; ++i)
	{
		cin >> A[i];
	}

	//vector<int> left(n),right(n);
	//int left[M],right[M];

	for (int i = 0; i < n; ++i)
	{
		if (i == 0)
		{
			mleft[i] = A[i];
		}
		else
		{
			mleft[i] = max(A[i],mleft[i-1]);
		}
	}

	for (int i = n-1; i >= 0; --i)
	{
		if (i == n-1)
		{
			mright[i] = A[n-1];
		}
		else
		{
			mright[i] = max(A[i],mright[i+1]);
		}
	}

	for (int i = 0; i < n; ++i)
	{
		if (i == 0)
		{
			cout << mright[i+1] << endl;
		}
		else if(i == n-1)
		{
			cout << mleft[i-1] << endl;
		}
		else
		{
			cout << max(mleft[i-1],mright[i+1]) << endl;
		}
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 3968
using System;
class A {
  public static void Main(string[] _) {
    var input = Console.ReadLine().Split();
    var a = int.Parse(input[0]);
    var b = int.Parse(input[1]);
    var c = int.Parse(input[2]);
    var d = int.Parse(input[3]);
    var answer = Math.Max(a * b, c * d);
    Console.WriteLine(answer);
  }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
	int n,i=0,count=0;
	char a[101],b[101],c[101];
	scanf("%d",&n);
	scanf("%s %s %s",&a,&b,&c);
	for(i;i<n;i++){
		
		if(a[i]==b[i]&&b[i]!=c[i])count=count+1;
		else if(a[i]==c[i]&&b[i]!=c[i])count=count+1;
		else if(c[i]==b[i]&&a[i]!=c[i])count=count+1;
		else if(a[i]!=b[i]&&b[i]!=c[i])count=count+2;
	}
	
	printf("%d\n",count);
	
	return 0;
}

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

using namespace std;

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

  vector<int> v(n);
  int all = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    v[i] = x;
    all ^= x;
  }

  string delim = "";
  for (int i = 0; i < n; ++i) {
    cout << delim << (v[i] ^ all);
    delim = " ";
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 4044
def C():
    x, n = list(map(int, input().split()))
    p = list(map(int, input().split()))
    for i in range(1000):
        if not (x-i) in p:
            print(x-i)
            break
        elif not (x+i) in p:
            print(x+i)
            break
C()


Measured memory_bytes: 9112
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define MAX_N 200000

int main() {
    int n;
    vector<int> a(MAX_N+10);
    cin >> n;

    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.begin() + n, greater<int>());

    long long ans = a[0];
    for (int i = 2; i < n; i++) {
        if (i % 2 == 0) ans += a[i/2];
        else ans += a[(i-1)/2];
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 3876
def solve(a, b, c, d, s):
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    ss = s[a:c + 1]
    fs = s[b:d + 1]
    if '##' in ss or '##' in fs:
        return False

    if c < d:
        return True

    fs2 = s[b - 1:d + 2]
    if '...' in ss and '...' in fs2:
        return True

    return False


n, a, b, c, d = list(map(int, input().split()))
s = input()
print('Yes' if solve(a, b, c, d, s) else 'No')


Measured memory_bytes: 3572
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

if c[0]-b[0]==c[1]-b[1]==c[2]-b[2] and b[0]-a[0]==b[1]-a[1]==b[2]-a[2] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1] and a[1]-a[0]==b[1]-b[0]==c[1]-c[0]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9112
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll Maxx=1e18+500;
const int sz=1e3+100;
 
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    while(cin>>n)
    {
        ll ara[n+2];
        for(i=0;i<n;i++) cin>>ara[i];
        ll last=0;
        ara[n]=0ll;
        ll sum=0;
        ll mn=Maxx;
        ll ct=0;
        for(i=0;i<=n;i++){
            if(ara[i]>=0){
                if(ct>0){
                    if((ct+last)%2==0) last=0;
                    else last=1;
                }
                ct=0;
            }
            else{
                ++ct;
            }
            sum+=abs(ara[i]);
            if(i<n) mn=min(mn,abs(ara[i]));
        }
        if(last>0) sum-=(2*mn);
        cout<<sum<<endl;
    } 
 
 
 
 
 
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstring>
#include <functional>
#include <bits/stdc++.h>
using namespace std;
int n,c,dp[100001];
vector<int> h;
int cost(int i)
{
    if(i==n-1)
        return 0;
    if(dp[i]!=-1)
        return dp[i];
    else
    {
        if(i+2<n)
            dp[i]=min(abs(h[i]-h[i+1])+cost(i+1),abs(h[i]-h[i+2])+cost(i+2));
        else
            dp[i]=abs(abs(h[i]-h[i+1])+cost(i+1));
        return dp[i];
    }
}
int main()
{
    std::ios::sync_with_stdio(false);
    memset(dp,-1,sizeof dp);
    int x;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>x;
        h.push_back(x);
    }
    cout<<cost(0)<<endl;
    return 0;
}


Measured memory_bytes: 3576
x, y = map(int,input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
elif x in c and y in c:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n;
  int v[100005];
  map<int, int> odd, even;
  cin >> n;
  rep(i, n) cin >> v[i];

  for(int i = 0; i < n; i++){
    if(i % 2) odd[v[i]]++;
    else even[v[i]]++;
  }

  vector<pair<int,int>> v_odd, v_even;
  for(auto itr : even){
    v_even.pb(mp(itr.second,itr.first));
  }
  for(auto itr : odd){
    v_odd.pb(mp(itr.second,itr.first));
  }

  sort(all(v_even),greater<pair<int,int>>());
  sort(all(v_odd),greater<pair<int,int>>());
  v_even.insert(v_even.begin(), mp(0,0));
  v_odd.insert(v_odd.begin(), mp(0,0));
  
  int ans = INT_MAX;
  for(int i = 0; i < min(3, (int)v_even.size()); i++){
    for(int j = 0; j < min(3, (int)v_odd.size()); j++){
      if(v_even[i] == v_odd[j])continue;
      int cnt = 0;
      // cout << "check: " << v_even[i].second << " " << v_odd[j].second << endl; 
      for(int k = 0; k < n; k++){
	if(k % 2 == 0 && v[k] != v_even[i].second) cnt++;
	else if(k % 2 == 1 && v[k] != v_odd[j].second) cnt++;
      }
      ans = min(cnt, ans);
    }
  }

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


Measured memory_bytes: 6520
#include <stdio.h>
#define c 1000000000

int main(void)
{
	int xa,xb,xc,ya,yb,yc;
	long int S;
	scanf("%ld",&S);
	xa = 0,ya = 0,xb = c;yb = 1;
	
	
	yc = S/c;
	yc++;
	xc = yc*c-S;
	
	
	if(S/c==c&&S%c==0)
	{
		printf("0 0 1000000000 0 0 1000000000");
		return 0;
	}
	printf("%d %d %d %d %d %d",xa,ya,xb,yb,xc,yc);
	
	return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
map<int,int> m;
signed main(){
	m[1]=1;
	m[3]=1;
	m[5]=1;
	m[7]=1;
	m[8]=1;
	m[10]=1;
	m[12]=1;
	m[4]=2;
	m[6]=2;m[9]=2;m[11]=2;
	m[2]=3;
	int a,b;
	cin>>a>>b;
	if(m[a]==m[b]) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int X10=1024,X11=2048,X12=4096,X13=8196,X14=16392,X15=32786,X16=65536,X17=131072,X18=262144,X19=524288,X20=1048576;

pair<int,int> f(int a1,int a2,int a3){
    return {a1-a2,a2-a3};
};
int A[3];
void _(){
    int a1,a2,a3;
    cin >> a1>> a2>>a3;
    A[0]=abs(a1-a2);
    A[1]=abs(a2-a3);
    A[2]=abs(a1-a3);
    sort(A,A+3);
    cout << A[1]+A[0];
}






int main() {
#ifdef Debug
    freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin);
    freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}








Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

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

    vector<int> p(N + 1);
    for (int i = 1; i <= N; i++) {
        int num;
        cin >> num;
        p[num] = i;
    }
   
    int cnt = 1;
    int mx = 1;
    for (int num = 1; num < N; num++) {

        if (p[num] <= p[num + 1]) cnt++;
        else cnt = 1;
               
        mx = max(mx, cnt);
    }
    cout << N - mx << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int a, b, c; scanf("%d%d%d", &a, &b, &c);
	
	if(a == b and b != c) printf("Yes\n");
	else if(b == c and c != a) printf("Yes\n");
	else if(c == a and a != b) printf("Yes\n");
	else printf("No\n");
	return 0;
}


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

public class Main {

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

      String[] str = br.readLine().split(" ");
      int x = Integer.parseInt( str[0] );
      int y = Integer.parseInt( str[1] );

      System.out.println( gcd(x,y) );
    }
  }

  static int gcd(int x, int y) {
    if( x<y ){
      int tmp = x; x = y; y = tmp;
    }

    int r;
    while( y>0 ) {
      r = x%y;
      x = y; y = r;
    }

    return x;
  }
}


Measured memory_bytes: 24344
def int_multiple():
    return  [int(c) for c in input().split()]

def int_single():
    return int(input())

def str_multiple():
    return [c for c in input().split()]

def str_single():
    return input()

# start

n = int_single()

r = 0
for i in range(1, n+1):
    if (len(str(i)) % 2 == 1):
        r += 1

print(r)


Measured memory_bytes: 3060
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int N;
    cin >> N;
    vector<int> A(N, 0);
    vector<vector<int>> x(N), y(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        for (int j = 0; j < A[i]; j++) {
            int X, Y;
            cin >> X >> Y;
            x[i].push_back(X);
            y[i].push_back(Y);
        }
    }

    int ans = 0;
    for (int bit = 0; bit < (1<<N); bit++) {
        int hon = 0;
        int ok = 1;
        for (int i = 0; i < N; i++) {
            if (bit & (1<<i)) {
                hon++;
                for (int j = 0; j < A[i]; j++) {
                    int t, u;
                    t = y[i][j];
                    (bit & (1 << (x[i][j] - 1))) ? (u = 1) : (u = 0);
                    if (t - u) ok = 0;
                }
            }
        }
        if (ok > 0 && hon > ans) ans = hon;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
 
	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
   
   ll n,r;
   
   cin >> n >> r;
   
   if(n>=10){
   	 
	cout << r << endl;
   }else{
   	cout << r+(100*(10-n)) << endl;
   }
   
return 0;   
}


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

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

Measured memory_bytes: 3588