akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#define maxn 100005
using namespace std;

int h[maxn], dp[maxn];

int main(){
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; ++i){
        cin >> h[i];
    }
    dp[0] = 0;
    for (int i = 1; i < n; ++i){
        int temp = 0x7fffffff, minn = min(i, k);
        for (int j = 1; j <= minn; ++j){
            temp = min(temp, dp[i - j] + abs(h[i - j] - h[i]));
        }
        dp[i] = temp;
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 45,mx = 1 << 17 + 5;
int n,x,y,z;
int lim,chk,ans = 0;
int dp[N][mx] = {0};
int fa[N][mx] = {0};
int main(){
	scanf("%d%d%d%d",&n,&x,&y,&z);
	lim = 1 << (x+y+z);
	chk = (1 << (x+y+z-1)) + (1 << (y+z-1)) + (1 << (z-1));
	fa[0][0] = 1;
	for(int i = 1;i<=n;i++){
		for(int j = 0;j<lim;j++){
			for(int k = 1;k<=10;k++){
				int res = ((j << k) + (1 << (k-1))) % lim; 
				if((res & chk) == chk) dp[i][res] += fa[i-1][j];
				else dp[i][res] += dp[i-1][j];
				dp[i][res] %= mod;
				fa[i][res] = (fa[i][res] + fa[i-1][j]) % mod;
			}
		}
	}
	for(int i = 0;i<lim;i++) ans = (ans + dp[n][i]) % mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 164096
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int A, B, C; cin >> A >> B >> C;
  cout << max(0, C-(A-B)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(void){
    int n,x;
    cin>>n>>x;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    long long ans=0;
    for(int i=0;i<n-1;i++){
        int sum=a[i]+a[i+1];
        if(sum>x){
            int def=sum-x;
            ans+=def;
            if(a[i+1]>=def){
                a[i+1]-=def;
            }
            else{
                a[i+1]=0;    
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
int n,size[100005],sa[100005],pa[100005];
ll d[100005];
bool cmp(int a,int b)
{
	return d[a]>d[b];
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&d[i]);
		sa[i]=i;
	}
	sort(sa+1,sa+n+1,cmp);
	for(int i=1;i<n;i++)
	{
		int x=sa[i];
		size[x]++;
		ll a=d[x]-n+2*size[x];
		int l=i+1,r=n;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(d[sa[mid]]<a)r=mid-1;
			else l=mid+1;
		}
		if(d[sa[r]]!=a)
		{
			printf("-1\n");
			return 0;
		}
		pa[x]=sa[r];
		size[sa[r]]+=size[x];
	}
	ll sum=0;
	for(int i=1;i<n;i++)sum+=size[sa[i]];
	if(sum!=d[sa[n]])
	{
		printf("-1\n");
		return 0;
	}
	for(int i=1;i<=n;i++)
	  if(pa[i])printf("%d %d\n",i,pa[i]);
	return 0;
}

Measured memory_bytes: 3200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _1153
{
    public class Program

    {
        public static void Main(string[] args)
        {

            while (true)
            {
                int[] line = ReadIntAr();
                if (line[0] + line[1] == 0) break;

                int[] tCards = new int[line[0]];
                int[] hCards = new int[line[1]];

                for (int i = 0 ; i < tCards.Length ; i++) tCards[i] = ReadInt();
                for (int i = 0 ; i < hCards.Length ; i++) hCards[i] = ReadInt();

                int tSum = tCards.Sum();
                int hSum = hCards.Sum();
                int changeSum = int.MaxValue;
                string res = "-1";

                for (int i = 0 ; i < tCards.Length ; i++)
                {
                    for (int j = 0 ; j < hCards.Length ; j++)
                    {
                        if (tSum - tCards[i] + hCards[j] == hSum + tCards[i] - hCards[j])
                        {
                            if (changeSum > tCards[i] + hCards[j])
                            {
                                changeSum = tCards[i] + hCards[j];
                                res = tCards[i].ToString() + " " + hCards[j].ToString();
                            }
                        }
                    }
                }

           Console.WriteLine(res);
            }
           
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 16204
#include<bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll z=1000000000+7;
ll bexp(ll a,ll b)
{
  if(b==0)
  return 1;
  if(b==1)
  return a%z;
  ll r=bexp(a,b/2);
  r=((r%z)*(r%z))%z;
  if(b%2==0)
  return r;
  else
  return ((r%z)*(a%z))%z;
}
int main()
{
  IOS;
  ll t=1;
  //cin>>t;
  while(t--)
  {
    ll i,n,k,sum=0,x,p=0,l,r,ans=0,mx,cnt=0,m,j;
    string s,y;
    cin>>s;
    cin>>y;
    p=s.length();
    for(i=0;i<p;i++)
    {
      if(s[i]!=y[i])
      {
        cnt++;
      }
    }

    cout<<cnt<<"\n";
  }
    return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

vector<ll> v;
int n;
ll dp[222222][22];
ll four[22];

ll comp(ll a,ll b){
	ll ret = 0;
	ll mul = (a + b - 1) / b;
	ll tmp = 1;
	while(tmp < mul){
		tmp *= 4;
		ret++;
	}
	return ret;
}

ll dfs(int a, int b){
	//cout << a << " " << b << " " << v[a]*four[b] << endl;
	if(dp[a][b] != -1)return dp[a][b];
	if(a == n-1)return dp[a][b] = 0;
	ll tmp = comp(four[b]*v[a],v[a+1]);
	if(tmp > 15){
		return dp[a][b] = tmp + (tmp - 15) * (n - a - 2) + dfs(a+1, 15);
	}
	else{
		return dp[a][b] = tmp + dfs(a+1,tmp);
	}
}

vector<ll> seica(){
	REP(i,222222)REP(j,22)dp[i][j] = -1;
	vector<ll> ret(n);
	for(int i = n-1;i >= 0;i--) {
	//	cout << i << endl;
		ret[i] = dfs(i, 0);
	}
	return ret;
}

int main(){
	
	cin >> n;
	four[0] = 1;
	REP(i,20)four[i+1] = four[i] * 4;
	REP(i,n){
		int tmp;cin >> tmp;
		v.EB(tmp);
	}
	
	auto A = seica();
	reverse(ALL(v));
	auto B = seica();reverse(ALL(B));
	
	//SHOW1d(A,A.size());
	//SHOW1d(B,B.size());
	
	ll ans = min(2 * A[0], 2 * B[n-1] + n);
	REP(i,n-1){
	//	cout << 2*A[i+1] << " " << 2*B[i] << " " << i+1 << " " << 2*(A[i+1]+B[i])+(i+1) << endl;
		ans = min(ans, 2*(A[i+1]+B[i])+(i+1));
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 44144
#pragma GCC optimize("Ofast")
#include"bits/stdc++.h"
using namespace std;

int main() {
	double N;
	cin >> N;
	double count = 0;
	for (int i = 0; i < N; i++) {
		if ((i + 1) % 2 != 0) {
			count++;
		}
	}
	double ans = count / N;
	cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  char c;
  cin >> c;
  set<char> A = {'a', 'e', 'i', 'o', 'u'};
  if (A.count(c)) {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
using namespace std;
const int N = 1e5+5;
void fast(){std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
string s,t;
int main()
{
	fast();
	cin>>s>>t;
	cout<<(s[0]==t[0])+(s[1]==t[1])+(s[2]==t[2]);
	return 0;
}

Measured memory_bytes: 256
# 2019-11-15 00:35:39(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, *difficulties = [int(x) for x in sys.stdin.read().split()]
    difficulties.sort()

    ans = difficulties[n // 2] - difficulties[n // 2 - 1]
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 13956
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC142D
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            long a = input[0];
            long b = input[1];

            long gcd = Gcd(a, b);
            long count = 1;
            long i = 2;
            while (i <= Math.Sqrt(gcd))
            {
                if (gcd % i == 0)
                {
                    count++;
                    while (gcd % i == 0)
                    {
                        gcd /= i;
                    }
                }
                i++;
            }
            if (gcd != 1)
            {
                count++;
            }
            Console.WriteLine(count);
        }

        public static long Gcd(long a, long b)
        {
            if (a < b)
            {
                return Gcd(b, a);　// 引数を入替えて自分を呼び出す
            }
            while (b != 0)
            {
                long remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
}


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

namespace abc168_v{
    class Program{
        static void Main(string[] args){
            var input = Console.ReadLine();
            var n = Convert.ToInt32(input.Last().ToString());
            switch(n){
                case 3:
                    System.Console.WriteLine("bon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    System.Console.WriteLine("pon");
                    break;
                default:
                    System.Console.WriteLine("hon");
                    break;
            }
        }
    }
}


Measured memory_bytes: 27596
n, m = map(int, input().split())
g = []
for _ in range(m):
    a, b, c = map(int, input().split())
    g.append([a - 1, b - 1, -c])

def bellman_ford(s):
    d = [float('inf')]*n # 各頂点への最小コスト
    d[s] = 0 # 自身への距離は0
    flg = False
    for i in range(n):
        update = False # 更新が行われたか
        for x, y, z in g:
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        if i == n - 1:
            inf_flg = d[-1]
            flg = True
    if flg:
        for i in range(n):
            update = False # 更新が行われたか
            for x, y, z in g:
                if d[y] > d[x] + z:
                    d[y] = d[x] + z
                    update = True
            if not update:
                break
            if i == n - 1:
                if inf_flg != d[-1]:
                    return "inf"
    return -1 * d[-1]

print(bellman_ford(0))

Measured memory_bytes: 74888
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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;
}

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);


//番号ズレ注意！！
int main() {
    int N, x = 0;
    cin >> N;
    int tmp = N;
    while (tmp > 0) {
        x += tmp % 10;
        tmp /= 10;
    }
    yesno(N % x == 0);
}


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

int main() {
    int N,M; cin >> N >> M;
    if(M != 1)
    cout << N-M << endl; 
    else cout << 0 << endl;

    return 0;
}

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

using ll = long long;
//print(fixed << setprecision(10));
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define repk(i,n,k) for(ll i = k; i < (n); i++)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
double PI = acos(-1.0);
int INF = 1e9;
ll LINF = 1e18;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll h,w,m;
    cin >> h >> w >> m;
    vector<ll> hsum(w+1,0),wsum(h+1,0);    
    ll hh,ww,hmax=0,wmax=0;
    set<pair<ll,ll>> mm;
    set<ll> hs,ws;
    rep(i,m){
        cin >> hh >> ww;
        mm.emplace(make_pair(hh,ww));
        hsum[ww]++; wsum[hh]++;
        if(hsum[ww]>hmax){
            hmax = hsum[ww];
            hs = {ww};
        }
        if(wsum[hh]>wmax){
            wmax = wsum[hh];
            ws= {hh};
        }
        if(hsum[ww]==hmax) hs.emplace(ww);
        if(wsum[hh]==wmax) ws.emplace(hh);
    }
    bool b=1;
    for(auto i : hs){
        for(auto j : ws){
            if(mm.count(make_pair(j,i))==0){
                b=0;
                break;
            }
        }
        if(b==0) break;
    }
    print(hmax+wmax-b);
    return 0;
}

Measured memory_bytes: 54660
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: i64 = s.next().unwrap().parse().unwrap();
	let x: i64 = s.next().unwrap().parse().unwrap();
	let m: i64 = s.next().unwrap().parse().unwrap();

	let mut to = vec![-1; m as usize];
	let l = {
		let mut a = x;
		while to[a as usize] == -1 {
			let b = a * a % m;
			to[a as usize] = b;
			a = b;
		}
		a
	};

	let ans = if n <= 300000 {
		let mut ans = 0;
		let mut a = x;
		for _ in 1..=n {
			ans += a;
			a = a * a % m;
		}
		ans
	} else {
		let mut ans = 0;
		let mut a = x;
		let mut n = n;
		while a != l {
			ans += a;
			a = to[a as usize];
			n -= 1;
		}
		let mut cycle = 0;
		let mut cs = 0;
		loop {
			cs += a;
			a = to[a as usize];
			cycle += 1;
			if a == l {
				break;
			}
		}
		let cnt = n / cycle;
		ans += cnt * cs;
		n -= cnt * cycle;
		for _ in 0..n {
			ans += a;
			a = a * a % m;
		}

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


Measured memory_bytes: 2804
#include <stdio.h>
#include <stdlib.h>
#define MAX 3

int pane[MAX][MAX];
int temp[MAX][MAX];
int d_x[4]={0,1,0,-1};
int d_y[4]={1,0,-1,0};


void empty(int *,int *);
void swap(int *,int *);
int cal();
int dfs(int ,int ,int ,int ,const int );

int main() {
  int i,j;
  int h,ans,row,col;
      
  for(i=0; i<MAX; i++){
    for(j=0; j<MAX; j++)
      scanf("%d",&pane[i][j]);
  }  
  empty(&row,&col);  
  for(h=0; h<100; h++){
    for(i=0; i<MAX; i++){
      for(j=0; j<MAX; j++)
	temp[i][j] = pane[i][j];
    }    
    ans = dfs(row,col,-1,0,h);    
    if(ans!=-1){
      printf("%d\n",ans);
      break;
    }    
    for(i=0; i<MAX; i++){
      for(j=0; j<MAX; j++)
	pane[i][j] = temp[i][j];
    }    
    ans = -1;
    if(h==99) printf("%d\n\n",ans);
  }      
  return 0;
}

void empty(int *row,int *col){
  int i,j;
  for(i=0; i<MAX; i++)
    for(j=0; j<MAX; j++)
      if(!pane[i][j]){
	*row = j;
	*col = i;
	return;
      }  
}
   
void swap(int *a,int *b){
  int temp;
  temp = *a;*a = *b;*b = temp;
}
  
int cal(){
  int i,e;
  int count=0; 
  for(i=0; i<9; i++){
    e = pane[i/3][i%3];
    if(e){
      e--;
      count += abs(i/3 - e/3) + abs(i%3 - e%3);
    }
  }   
  return count;
}
  
int dfs(int x,int y,int p,int deep,const int limt){
  int i;
  int len;
  int x_2,y_2;
  int emc;   
  len = cal();
  if(len==0) return deep;
  if(deep+len > limt) return -1; 
  for(i=0; i<4; i++){
    x_2 = x+d_x[i];
    y_2 = y+d_y[i];      
    if(~p && i==(p+2)%4) continue;
    if(!(0<=x_2 && x_2<3 && 0<=y_2 && y_2<3)) continue;    
    swap(&pane[y][x],&pane[y_2][x_2]);
    emc = dfs(x_2,y_2,i,deep+1,limt);
    if(~emc) return emc;       
    swap(&pane[y][x],&pane[y_2][x_2]);
  }   
  return -1;
}  
  



Measured memory_bytes: 2112
#include<stdio.h>

int main(void){
    int p,q,r;
    int a1,a2,a3;
    scanf("%d %d %d",&p,&q,&r);
    a1 = p + q;
    a2 = p + r;
    a3 = r + q;

    if( a1 <= a2 && a1 <= a3){
        printf("%d\n",a1);
    }else if( a2 <= a1 && a2 <= a3){
        printf("%d\n",a2);
    }else if( a3 <= a1 && a3 <= a2 )
        printf("%d\n",a3);

    return 0;
}

Measured memory_bytes: 128
x = gets.to_i
if x < 600
  puts "8"
elsif x < 800
  puts "7"
elsif x < 1000
  puts "6"
elsif x < 1200
  puts "5"
elsif x < 1400
  puts "4"
elsif x < 1600
  puts "3"
elsif x < 1800
  puts "2"
else
  puts "1"
end


Measured memory_bytes: 14436
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        x: usize,
        v: [usize; n]
    }
    let mut w = v;
    let mut ans = 0;
    for i in 0..n {
        if w[i] > x {
            ans += w[i] - x;
            w[i] = x;
        }
    }
    for i in 1..n {
        let t = w[i-1] + w[i];
        if t > x {
            ans += t - x;
            w[i] -= t - x;
        }
    }
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
    int a,b,c,i;
    int count=0;
    cin>>a >>b >>c;
    for(i=a;i<=b;i++){
        if (c % i ==0){
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3112
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, string> P;
typedef tuple<int, string, string> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;

int solve() {
    int res = 0;
    while (n > 0) {
        if (n % 10 == 2)
            res++;
        n /= 10;
    }
    return res;
}

void input() {
    cin >> n;
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3176
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    n,x,t=inar()
    print(math.ceil(n/x)*t)

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()


Measured memory_bytes: 68772
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		label:while(cin.hasNext()){
			String str = cin.next();
			String[] s = str.split(",");
			int[] a = new int[5];
			for(int i = 0; i < 5;i++){
				a[i]=Integer.parseInt(s[i]);
			}
			Arrays.sort(a);
			if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
				System.out.println("four card");
				continue;
			}
			if(a[1]==a[2]&&a[3]==a[2]&&a[4]==a[3]){
				System.out.println("four card");
				continue;
			}
			if(a[0]==a[1]&&a[0]==a[2] && a[3]==a[4]){
				System.out.println("full house");
				continue;
			}
			if(a[0]==a[1] && a[2]==a[3] && a[2] == a[4]){
				System.out.println("hull house");
				continue;
			}
			if(a[0]+1==a[1]&&a[0]+2==a[2]&&a[0]+3==a[3]&&a[0]+4==a[4]){
				System.out.println("straight");
				continue;
			}
			if(a[0]==1&&a[1]==10&&a[2]==11&&a[3]==12&&a[4]==13){
				System.out.println("straight");
				continue;
			}
			if(a[0]==a[1] && a[0]==a[2] || a[1]==a[2]&&a[1]==a[3] || 
					a[2]==a[3] && a[2] == a[4]){
				System.out.println("three card");
				continue;
			}
			for(int i = 0; i < 3;i++){
				if(a[i]==a[i+1]){
					for(int j = i+3; j < 5;j++){
						if(a[j]==a[j-1]){
							System.out.println("two pair");
							continue label;
						}
					}
				}
			}
			for(int i = 0; i < 4; i++){
				if(a[i]==a[i+1]){
					System.out.println("one pair");
					continue label;
				}
			}
			System.out.println("null");
				
		}
	}

}

Measured memory_bytes: 11000
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		string A;
		cin >> A;

		long N = A.size();
		long ans = N * (N-1) / 2 + 1;

		vector<int> c( 128 );
		for( int i = 0; i < N; ++i ) {
			c[A[i]] += 1;
		}
		for( int i = 0; i < 128; ++i ) {
			ans -= (long)c[i] * (c[i]-1) / 2;
		}

		cout << ans << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


Measured memory_bytes: 720
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

type pair struct{ x, y int }

func solve(ns [][]pair) {
	n := len(ns)
	max := 0
	for pat := 0; pat < pow(2, n); pat++ {
		// パターン単位
		// eg: 000,001,010,...,111
		fine := true
		var i uint32
		for i = 0; i < uint32(n); i++ {
			// 人間単位
			a := ns[i]
			isHonesty := pat&(1<<i) > 0
			if !isHonesty {
				continue
			}
			for _, e := range a {
				// 証言単位

				// だれのこと？
				who := uint32(e.x)
				// 正直 or 嘘つき?
				actual := e.y == 1

				// パターンでの定義は?
				expected := pat&(1<<who) > 0
				if actual != expected && isHonesty {
					// 矛盾がある.
					fine = false
					goto Exit
				}
			}
		}
	Exit:
		if fine {
			onbits := countOnBits(pat, n)
			if onbits > max {
				max = onbits
			}
		}
	}
	fmt.Println(max)
}

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	ns := make([][]pair, n)
	for i := 0; i < n; i++ {
		a := eGetInt(scanner)
		ns[i] = make([]pair, a)
		for j := 0; j < a; j++ {
			x := eGetInt(scanner)
			y := eGetInt(scanner)
			ns[i][j] = pair{x - 1, y}
		}
	}
	solve(ns)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	return int(math.Pow(float64(a), float64(n)))
}
func countOnBits(i, numbits int) int {
	count := 0
	var bit uint32
	for bit = 0; bit < uint32(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define ld long double
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=100005;
int n,k,a[N],ans=1e9;
signed main(){
	n=read(); k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	sort(&a[1],&a[n+1]);
	for(int i=1;i+k-1<=n;i++){
		if(a[i]>=0)ans=min(ans,a[i+k-1]);
		else if(a[i+k-1]<=0)ans=min(ans,-a[i]);
		else ans=min(ans,min(-a[i],a[i+k-1])*2+max(-a[i],a[i+k-1]));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
#define int long long
int n;
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cin >> n;
  int a[n + 1];
  map<int, int> cnt;
  for (int i = 0; i < n; i++){
  	cin >> a[i];
  	cnt[a[i]]++;
  }
  int ret = 0;
  for (auto& it : cnt){
  	int v = it.second;
  	ret += v * (v - 1) / 2;
  }
  for (int i = 0; i < n; i++){
  	int old_v = cnt[a[i]];
  	int curr = ret - (old_v * (old_v - 1) / 2);
  	int v = cnt[a[i]] - 1;
  	curr += v * (v - 1) / 2;
  	cout << curr << endl;
  }
  return 0;
}


Measured memory_bytes: 11136
#include<stdio.h>
int main(){
    int i,count = 0;
    char W[11],T[1001];
    scanf("%s",W);
    while(1){
        scanf("%s",T);
        if(strcmp(T,"END_OF_TEXT")==0){
            break;
        }
        for(i=0;i<strlen(T);i++){ 
            if(T[i] >= 'A' && T[i] <= 'Z')T[i] += 32;
        }
        if(strcmp(T,W) == 0){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define double long double
#define M_PI 3.14159265358979323846 
const int mod = 1e9 + 7;

int32_t main()
{
    fastio;

    int n; cin >> n;
    int val = n%10;
    if(val == 0) cout << "pon" << endl;
    if(val == 1) cout << "pon" << endl;
    if(val == 2) cout << "hon" << endl;
    if(val == 3) cout << "bon" << endl;
    if(val == 4) cout << "hon" << endl;
    if(val == 5) cout << "hon" << endl;
    if(val == 6) cout << "pon" << endl;
    if(val == 7) cout << "hon" << endl;
    if(val == 8) cout << "pon" << endl;
    if(val == 9) cout << "hon" << endl;
    
    return 0;
}

/*
3 1 2 4
1 2 3
*/

Measured memory_bytes: 3652
D,N = map(int,input().split())

ANS = pow(100,D)*N

if D==0 and N==100:
    print(ANS+pow(100,D))
elif D==1 and N==100:
    print(ANS+pow(100,D))
elif D==2 and N==100:
    print(ANS+pow(100,D))
else:
    print(ANS)

Measured memory_bytes: 3060
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    double t,x;
    std::cin >> t>>x;
    std::cout << t/x << std::endl;
}

Measured memory_bytes: 256
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 s,t,u=a*a+b*b,c*c+d*d,e*e+f*f
 x=(s*(d-f)+t*(f-b)+u*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=(s*(c-e)+t*(e-a)+u*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print('%.3f %.3f %.3f'%(x,y,((x-a)**2+(y-b)**2)**.5))


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

#define ll          long long
#define endl        "\n"
#define inf         10000000002
#define pb          push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      //freopen("inputNew.txt", "r", stdin);

      ll a,b,c,d;
      cin>>a>>b>>c>>d;

      ll ans[4];
      ans[0]=a*c;
      ans[1]=b*d;
      ans[2]=a*d;
      ans[3]=b*c;
      ll mx=ans[0];
      for(int i=1; i<4; i++){
            if(mx<ans[i]) mx=ans[i];
      }

      if(mx>=0) {cout<<mx<<endl;bye;}

      if(a<=0 && b>=0){cout<<0<<endl;bye;}
      if(c<=0 && d>=0){cout<<0<<endl;bye;}
      cout<<mx<<endl;


      bye;
}


Measured memory_bytes: 3648
n = int(input())
l = [0 for i in range(n)]
r = [0 for i in range(n)]


dat = []
dat2 = []
st = -1
for i in range(n):
    s = input()
    for ch in s:
        if ch == '(':
            r[i] += 1
            pass
        else:
            if r[i] > 0:
                r[i] -= 1
            else:
                l[i] += 1
            pass
    # print(i, l[i], r[i])
    if l[i] == 0:
        if st == -1 or r[st] < r[i]:
            st = i
    if r[i] >= l[i]:
        dat.append((l[i], i))
    else:
        dat2.append((r[i], i))

dat.sort()
dat2.sort(reverse=True)


if st == -1:
    print("No")
    exit()

now = r[st]
# print('now={}'.format(now))
for num, i in dat:
    if i == st:
        continue
    if now < l[i]:
        print("No")
        exit()
    now = now - l[i] + r[i]

for num, i in dat2:
    # print('dat2', num, i)
    if now < l[i]:
        print("No")
        exit()
    now = now - l[i] + r[i]
if now == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 171448
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int n,m;

int main() {
  INCANT;
  cin >> n >>m;
  cout << (n-1)*(m-1) << "\n";
  return 0;
}

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

int main() {
  int N,X;
  cin >> N >> X;
  int m[N];
  int number = 0;
  for(int i = 0; i < N; i++){
    cin >> m[i];
  }
  sort(m,m+N);
  for(int i = 0; i < N; i++){
    X -= m[i];
    number++;
  }
  while(m[0] <= X){
    X -= m[0];
    number++;
  }
  cout << number << endl;
  return 0;
}

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

using namespace std;

int memo[10][10][10][10][2];

int solve(int L1, int R1, int L2, int R2, int t)
{
    int &res = memo[L1][R1][L2][R2][t];
    if (res != 0) return res;
    if (L1 >= 5 && R1 >= 5) return 2;
    if (L2 >= 5 && R2 >= 5) return 1;
    if (t == 0) {
	res = 2;
	if (L1 < 5) {
	    if (L2 < 5) res = min(res, solve(L1, R1, L1 + L2, R2, 1));
	    if (R2 < 5) res = min(res, solve(L1, R1, L2, L1 + R2, 1));
	}
	if (R1 < 5) {
	    if (L2 < 5) res = min(res, solve(L1, R1, R1 + L2, R2, 1));
	    if (R2 < 5) res = min(res, solve(L1, R1, L2, R1 + R2, 1));
	}
    } else {
	res = 1;
	if (L2 < 5) {
	    if (L1 < 5) res = max(res, solve(L1 + L2, R1, L2, R2, 0));
	    if (R1 < 5) res = max(res, solve(L1, R1 + L2, L2, R2, 0));
	}
	if (R2 < 5) {
	    if (L1 < 5) res = max(res, solve(L1 + R2, R1, L2, R2, 0));
	    if (R1 < 5) res = max(res, solve(L1, R1 + R2, L2, R2, 0));
	}
    }
    return res;
}

int main()
{
    int L1, R1, L2, R2;
    cin >> L1 >> R1 >> L2 >> R2;
    cout << (solve(L1, R1, L2, R2, 0) == 1 ? "ISONO" : "NAKAJIMA") << endl;
    return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  ll base = 1;
  ll num = 1;
  ll ret = 1;
  while(true){
    if(base<=H && H < base+num) break;

    base = base + num;
    num *= 2;
    ret = 1 + 2*ret;
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
using ll = long long;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repp(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)


int main() {
  int n;  cin >> n;
  vector<int> v(n);
  rep (i, n) cin >> v[i];
  sort(all(v));
  ll ans = 0;

  rep (i, n) repp (j, i, n) repp (k, j, n) {
    if (v[i] == v[j] || v[j] == v[k] || v[k] == v[i]) continue;
    if (abs(v[i] - v[j]) < v[k] && v[i] + v[j] > v[k]) ++ans;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3628
import java.io.*;
import java.util.Arrays;

class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] numb = str.split(" ");
		
		int a = Integer.parseInt(numb[0]);
		int b = Integer.parseInt(numb[1]);
		int c = Integer.parseInt(numb[2]);
		
		int num[] = {a, b, c};
		
		Arrays.sort(num);
		
		System.out.println(num[0] + " " + num[1] + " " + num[2]);
	}
}

Measured memory_bytes: 24468
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pi 3.14159265358979323846
#define mm 1000000007
int main()
{
    IOS;
    ll a,b,c,d,e,k,count;
    cin>>a>>b>>c>>k;
    while(a>=b)
    {
        b=b*2;
        count++;
    }
    while(b>=c)
    {
        c=c*2;
        count++;
    }
    if(count<=k) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3652
import math
n, m,x,y = list(map(int, input().split())) # 整数
arrayx = list(map(int, input().strip().split()))
arrayy = list(map(int, input().strip().split()))
arrayx.sort()
arrayy.sort()
#print(arrayx[n-1])
#print(arrayy[0])
ans=0
for i in range(x+1,y+1):
    #print(i)
    if i>arrayx[n-1]:
        if i<=arrayy[0]:
            ans=1
if ans==0:
    print("War")
if ans==1:
    print("No War")

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program{
  static void Main(){
    var s = ReadLine();
    var x = s[0];
    var judge = false;
    
    judge = s.All(a => a.Equals(x));
    
    if(judge == true){
    	Write("No");
    }else{
     	Write("Yes");
    }
    
    
  }
}


Measured memory_bytes: 18144
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int A[110000];
int B[110000];
int C[110000];
int dp[110000][3];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d%d%d",A+i,B+i,C+i);
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<3;j++){
			if(i==0){
				if(j==0)dp[i][j]=A[i];
				else if(j==1)dp[i][j]=B[i];
				else dp[i][j]=C[i];
			}else{
				for(int k=0;k<3;k++){
					if(j==k)continue;
					if(j==0)dp[i][j]=max(dp[i][j],dp[i-1][k]+A[i]);
					else if(j==1)dp[i][j]=max(dp[i][j],dp[i-1][k]+B[i]);
					else dp[i][j]=max(dp[i][j],dp[i-1][k]+C[i]);
				}
			}
		}
	}
	int ret=0;
	ret=max(ret,dp[a-1][0]);
	ret=max(ret,dp[a-1][1]);
	ret=max(ret,dp[a-1][2]);
	printf("%d\n",ret);
}

Measured memory_bytes: 4096
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
t = [0]*n
for i in range(n):
    t[i] = INT()

def lcm(a,b):
    gcd = fractions.gcd(a,b)
    a//=gcd
    b//=gcd
    return a*b*gcd
    
if n == 1:
    print(t[0])
    sys.exit()

res = lcm(t[0],t[1])
for i in range(1,n-1):
    res = lcm(res, t[i+1])

print(res)




Measured memory_bytes: 64492
import java.util.*
import java.math.*

fun main(args: Array<String>) {
//    var (N,K) = readLine()!!.split(" ").map { it.toInt() }
//    var N = readLine()!!.toInt()
    val S = readLine()!!
//    val D = readLine()!!.split(" ").map { it.toLong() }
    var ans = "Good"
    var pre = 'a'
    for (c in S) {
        if (pre == c){
            println("Bad")
            return
        }
        pre = c
    }
    println(ans)
}


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

int main() {
  int n;
  cin >> n;
  vector<string> w(n);
  for (int i=0; i<n; ++i) cin >> w.at(i);
  string ans = "Yes";
  
  for (int i=0; i<n-1; ++i){
    if (w.at(i).at(w.at(i).size()-1) != w.at(i+1).at(0)) {
      ans = "No";
      break;
    }
  }
  
  if(ans == "Yes") {
    sort(w.begin(), w.end());
    for(int j=0; j<n-1; ++j) {
      if (w.at(j) == w.at(j+1)) {
        ans = "No";
        break;
      }
    }
  }

  
  cout << ans;
    
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main(){
  int n, m, ans=0;
  cin >> n >> m;
  vector<int> h(n);
  rep(i, n){
    cin >> h[i];
  }
  vector<int> a(m), b(m), c(n, 0), d(n, 0);
  rep(i, m){
    cin >> a[i] >> b[i];
  }

  rep(i, m){
    if(h[a[i]-1]>h[b[i]-1]){
      c[a[i]-1]++;
      c[b[i]-1]--;
      d[a[i]-1]++;
      d[b[i]-1]++;
    }
    if(h[b[i]-1]>h[a[i]-1]){
      c[a[i]-1]--;
      c[b[i]-1]++;
      d[a[i]-1]++;
      d[b[i]-1]++;
    }
    if(h[a[i]-1]==h[b[i]-1]){
      d[a[i]-1]+=100005;
      d[b[i]-1]+=100005;
    }
  }

  rep(i, n){
    if(c[i]==d[i]){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5036
#include <stdio.h>
int main(void){
  char c;
  scanf("%c",&c);
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    printf("vowel\n");
  }
  else{
    printf("consonant\n");
  }
  
  return 0;
}

Measured memory_bytes: 1580
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;
    //codefes 2017a b
    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), m = in.ni(), k = in.ni();
        boolean flag = false;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                if(2*i*j-j*n-i*m+m*n==k){
                    flag = true;
                    break;
                }
            }
        }
        out.println(flag?"Yes":"No");
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 22484