akhauriyash/Code-Regression huggingface dataset:
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int dp[114514][3];
signed main() {
    int n;cin >> n;
    vvi v(n,vi(3));
    rep(i, n) cin >> v[i][0] >> v[i][1] >> v[i][2];
    // dp[1][0]=v[0][0];dp[1][1]=v[0][1];dp[1][2]=v[0][2];
    rep(i, n) {
        rep(j, 3) {
            rep(k, 3) {
                if(j==k)continue;
                chmax(dp[i+1][k],dp[i][j]+v[i][k]);
            }
        }
    }
    int ma = -1;
    rep(i, 3) {
        chmax(ma,dp[n][i]);
    }
    cout << ma << endl;
    // cout << dp[n][0] << ' ' << dp[n][1] << ' ' << dp[n][2] << endl;
    return 0;
}

Measured memory_bytes: 11160
#include<bits/stdc++.h>
using namespace std;
template<typename T>vector<T>&operator<<(vector<T>&v,const T t){v.push_back(t);return v;}
template<typename T>multiset<T>&operator<<(multiset<T>&m,const T t){m.insert(t);return m;}
template<typename T,typename U>istream&operator>>(istream&s,pair<T,U>&p){return s>>p.first>>p.second;}
template<typename T,typename U>ostream&operator<<(ostream&s,const pair<T,U>p){return s<<p.first<<" "<<p.second;}
template<typename T>ostream&operator<<(ostream&s,const vector<T>v){for(auto a:v){s<<a<<endl;}return s;}
#define all(x) x.begin(),x.end()
typedef pair<int,int>pii;

int d[41][401][401];

main(){
	int N,Ma,Mb;
	cin>>N>>Ma>>Mb;
	for(int i=0;i<=N;++i){
		for(int j=0;j<=400;++j){
			for(int k=0;k<=400;++k){
				d[i][j][k]=401;
			}
		}
	}
	d[0][0][0]=0;
	int sa=0,sb=0;
	for(int i=0;i<N;++i){
		int a,b,c;
		cin>>a>>b>>c;
		for(int j=0;j<=sa;++j){
			for(int k=0;k<=sb;++k){
				d[i+1][j][k]=min(d[i+1][j][k],d[i][j][k]);
				d[i+1][j+a][k+b]=min(d[i+1][j+a][k+b],d[i][j][k]+c);
			}
		}
		sa+=a;
		sb+=b;
	}
	int x=401;
	for(int a=1;a*Ma<=sa&&a*Mb<=sb;++a){
		x=min(x,d[N][a*Ma][a*Mb]);
	}
	cout<<(x==401?-1:x);
}


Measured memory_bytes: 25984
#include <iostream>

using namespace std;

bool isMonth(int a) {
    return a >= 1 && a <= 12;
}

int main() {
    int s1, s2;
    scanf("%02d", &s1);
    scanf("%02d", &s2);
    if (!isMonth(s1) && !isMonth(s2)) {
        cout << "NA" << endl;
    } else if (isMonth(s1) && isMonth(s2)) {
        cout << "AMBIGUOUS" << endl;
    } else if (isMonth(s1) && !isMonth(s2)) {
        cout << "MMYY" << endl;
    } else {
        cout << "YYMM" << endl;
    }

    return 0;
}

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

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: usize = iterator.next().unwrap().parse().unwrap();
    let b: usize = iterator.next().unwrap().parse().unwrap();
    let x: usize = iterator.next().unwrap().parse().unwrap();

    let ans = if a == 0 {
        b / x + 1
    } else {
        b / x - (a - 1) / x
    };

    return ans.to_string();
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<bitset>

using namespace std;

void input(int *a,int n){
  for(int i=0;i<n;i++){
    for(int j=0;j<16;j++){
      int ai;
      cin>>ai;
      a[i]=a[i]*2+ai;
    }
  }
}


int main(){
  int pop[1<<16];
  for(int i=0;i<1<<16;i++){
    pop[i]=bitset<32>(i).count();
  }
  for(int n,c;cin>>n>>c,n;){
    int a[30]={},b[30]={};
    input(a,n);
    input(b,c);
    static int dp[31][1<<16];
    fill(dp[0],dp[31],-(1<<29));
    dp[0][0]=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<1<<16;j++){
	for(int k=0;k<c;k++){
	  int l=j|a[i];
	  int &t=dp[i+1][l&~b[k]];
	  t=max<int>(t,dp[i][j]+pop[l&b[k]]);
	}
      }
    }
    cout<<*max_element(dp[0],dp[31])<<endl;
  }
}

       

Measured memory_bytes: 9356
#include <iostream>
#include <string>
#include <queue>

using namespace std;

class Process
{
public:
    string name;
	int time;
	
	Process(string n, int t) :
	name(n),
	time(t)
	{
	}
};

void output( string name, int time )
{
	cout << name << " " << time << endl;
	return;
}

int main(void)
{
	// Input
	int numData;
	cin >> numData;
	
	int quantum;
	cin >> quantum;
	
	queue<Process> que;
	string p;
	int num;
	for( int loopCnt=0; numData > loopCnt; loopCnt++ )
	{
		cin >> p;
		cin >> num;
	  	que.push( Process(p,num) );
	}
	
	//Process
	int time = 0;
	while( !que.empty() )
	{
		Process p = que.front();
		que.pop();
		if( p.time <= quantum )
		{
			time += p.time;
			output(p.name,time);
		}
		else
		{
			time += quantum;
			p.time -= quantum;
			que.push( p );
		}
	}
	
	return 0;
}

Measured memory_bytes: 6364
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
  int n, T, count=0; cin >> n >> T;
  int c[n], t[n], ans = 10001; for(int i = 0; i < n; i++) cin >> c[i] >> t[i];
  for(int i = 0; i < n; i++) {
    if(t[i] <=T){
      if(c[i] <= ans) ans = c[i];
      count++;
    }
  }
  if(count==0) cout << "TLE" << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
using Yorukatsu051.Questions;
using Yorukatsu051.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu051.Questions
{
    public class QuestionC : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadInt();
            var a = inputStream.ReadIntArray();

            var div2Count = a.Sum(GetDiv2Count);
            yield return div2Count >= n / 2 * 2 ? "Yes" : "No";
        }

        int GetDiv2Count(int n)
        {
            var count = 0;
            while ((n & 1) == 0)
            {
                count++;
                n >>= 1;
            }
            return Math.Min(count, 2);
        }
    }
}

namespace Yorukatsu051
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionC();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu051.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu051.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

int main() {
  int N;
  cin >> N;
  vector<int> C;
  rep(i, N) {
    int a;
    cin >> a;
    if (i == 0)
      C.push_back(a);
    else {
      if (C.back() != a)
        C.push_back(a);
    }
  }
  N = C.size();
  map<int, int> mp;
  vector<int> pre(N, -1);
  rep(i, N) {
    if (mp[C[i]]) {
      pre[i] = mp[C[i]] - 1;
    }
    mp[C[i]] = i + 1;
  }
  vector<ll> dp(N);
  dp[0] = 1;
  ll ans = 0;
  rep(i, N - 1) {
    if (pre[i + 1] == -1) {
      dp[i + 1] = dp[i];
    } else {
      dp[i + 1] = (dp[i] + dp[pre[i + 1]]) % MOD;
    }
  }
  cout << dp[N - 1] << endl;
  return 0;
}


Measured memory_bytes: 12788
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
using namespace std;
//
const int INF=1e9+7;
const int LINF=1e18;
const int MOD=1e9+7;
//
int main(){
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    int A=min(a,2*c),B=min(b,2*c),AB=min(a+b,2*c);
    int ans;
    if(x>=y){
        ans=(x-y)*A+y*AB;
    }else{
        ans=(y-x)*B+x*AB;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define int ll
    #define M 1000000007
    #define hell 998244353
    #define big 1e18
    #define pb push_back
    #define pi 3.1415926536
    #define mp make_pair
    #define ub upper_bound
    #define lb lower_bound
    #define mem0(a) memset(a,0,sizeof(a))
    #define memf(a) memset(a,false,sizeof(a))
    #define mem1(a) memset(a,1,sizeof(a))
    #define all(a) a.begin(),a.end()
    #define ll long long
    #define vec vector <int>
    #define pii pair<int,int>
    #define endl "\n"
    #define gcd __gcd
    using namespace std;
    int power(int x, unsigned int y, unsigned int m) 
	{ 
    	if (y == 0) 
        	return 1; 
    	int p = power(x, y/2, m) % m; 
    	p = (p * p) % m; 
  
 	   return (y%2 == 0)? p : (x * p) % m; 
	} 
	int modInverse(int a, int m) 
	{   
    	return power(a, m-2, m);
	}
    signed main()
    {
    	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    	ll t=1;
    	// cin >> t;
    	/*SAARE INPUTS LENA*/
    	/*VARIABLES KI RANGE DEKHLENA*/
    	while(t-->0)
    	{
    		ll a=0,b=0,c=0,s=0;
    		cin>>a>>b>>c>>s;
    		if(s<=a)
    			cout<<s;
 			else if(s<=(a+b))
 				cout<<a;
 			else 
 				cout<<a-(s-(a+b));
    	}
    	return 0;
    }

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> v) {os << "(" << v.first << ", " << v.second << ")"; return os;}


void solve() {
  int N, M;
  cin >> N >> M;
  vector<int> R(N, 0), L(N, 1);
  R[0] = 1;
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;

    R[y] |= R[x];
    if (L[x] == 1) {
      R[x] = 0;
    }
    L[x]--;
    L[y]++;
    
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (R[i]) cnt++;
  }
  cout << cnt << endl;

}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
H = list(map(int, input().split()))

# 0-indexed
INF = 10 ** 15
dp = [INF] * N
dp[0] = 0

for i in range(N):
  for k in range(1, K+1):
    if i + k < N and dp[i] + abs(H[i+k] - H[i]) < dp[i+k]:
      dp[i+k] = dp[i] + abs(H[i+k] - H[i])
      
print(dp[-1])

Measured memory_bytes: 52448
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll K,A,B;
  cin>>K>>A>>B;
  if(A%K==0) {
cout<<"OK"<<endl;
    return 0;
  }
  
  else if(A/K<B/K) {
cout<<"OK"<<endl;
  }
  else {
cout<<"NG"<<endl;
  }
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  sort(A.begin(), A.end(), greater<ll>());
  deque<ll> que{};
  ll ans = 0;
  que.push_back(A[0]);
  int idr = N - 1, idl = 1;
  if (N % 2 == 1) {
    ans += max(abs(A[N / 2 - 1] - A[N / 2]), abs(A[N / 2 + 1] - A[N / 2]));
    N--;
  }
  for (int i = 1; i < N; i++) {
    if (i % 4 == 1) {
      que.push_front(A[idr]);
      idr--;
    } else if (i % 4 == 2) {
      que.push_back(A[idr]);
      idr--;
    } else if (i % 4 == 3) {
      que.push_front(A[idl]);
      idl++;
    } else if (i % 4 == 0) {
      que.push_back(A[idl]);
      idl++;
    }
  }

  ll past = que.front();
  que.pop_front();
  while (!que.empty()) {
    ans += abs(past - que.front());
    past = que.front();
    que.pop_front();
  }
  cout << ans << endl;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h> 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const LL MOD=1e9+7;

int main(){
    int N;
    cin>>N;
    vector<pair<string,int>>pi(N);
    map<int,int>pt;
    REP(i,N){
        cin>>pi[i].first>>pi[i].second;
        pi[i].second=-pi[i].second;
        pt[pi[i].second]=i+1;
    }
    SORT(pi);
    REP(i,SZ(pi)){
        //cout<<pi[i].second<<endl;
        cout<<pt[pi[i].second]<<endl;
    }
    return 0;
}


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

dp = [0] * (n+1)
dp[0] = 1
acounter = 0
if a[0] == 1:
  dp[1] = 0
  acounter = 1
else:
  dp[1] = 1

for i in range(2, n+1):
  if i == a[acounter]:
    dp[i]=0
    acounter+=1
  else:
    dp[i] = (dp[i-1]%1000000007 + dp[i-2]%1000000007)%1000000007
  
print(dp[n]%1000000007)

Measured memory_bytes: 7824
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def fact(N):
        res = {}
        tmp = N
        for i in range(2, int(N ** 0.5 + 1) + 1):
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if cnt > 0:
                res[i] = cnt
        if tmp != 1:
            res[tmp] = 1
        if res == {}:
            res[N] = 1
        return res


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    X, Y = Scanner.map_int()
    if Y % 2 == 1:
        return False
    if 2 * X <= Y <= 4 * X:
        return True
    return False


def main():
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    print('YNeos'[not solve()::2])
    # solve()


if __name__ == "__main__":
    main()


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> c(m);
    for(int i = 0; i < m; i++)  cin >> c[i];
    vector<int> dp(n+1);
    for(int i = 0; i <= n; i++) dp[i] = i;
    for(int i = 0; i < m; i++){
        for(int j = 0; j+c[i] <= n; j++){
            dp[j+c[i]] = min(dp[j+c[i]], dp[j]+1);
        }
    }
    cout << dp[n] << endl;
    return 0;
}


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

typedef long long int ll;

#define PI acos(-1)
#define MAX 1000000010
#define MOD 1000000007

//main code
int main()
{
#ifdef LOCAL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    // start code
    ll n, m;
    string s, t;
    cin >> n >> m;
    cin >> s >> t;
    ll lcm = n * m / __gcd(n, m);
    map<int, char> mp;
    bool flag = true;
    if(n < m)
    {
        int l = lcm / n;
        for(int i = 0, j = 0; i < n; i++, j += l)
        {
            mp[j] = s[i];
        }
        l = lcm / m;
        for(int i = 0, j = 0; i < m; i++, j += l)
        {
            if(mp.find(j) != mp.end() && mp[j] != t[i])
            {
                flag = false;
                break;
            }
        }
    }
    else
    {
        int l = lcm / m;
        for(int i = 0, j = 0; i < m; i++, j += l)
        {
            mp[j] = t[i];
        }
        l = lcm / n;
        for(int i = 0, j = 0; i < n; i++, j += l)
        {
            if(mp.find(j) != mp.end() && mp[j] != s[i])
            {
                flag = false;
                break;
            }
        }
    }
    if(flag)
        cout << lcm << endl;
    else
        cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 3968
MOD=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))

a.sort(reverse=True)


fact = [1]
fact_inv = [1]
mod=10**9+7
for i in range(10**5+1):
    new_fact = fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))


def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod

  
c=[]
for i in range(1,n-k+1+1):
  c.append(mod_comb_k(n-i,k-1,MOD))
lc=len(c)
#print(c,a)
sum=0
for i in range(lc):
  sum+=c[i]*(a[i]-a[-i-1])%MOD
  
print(sum%MOD)


Measured memory_bytes: 17544
#include <stdio.h>
    #include <string.h>
     
    int main(void)
    {
            int a=0, b=0, c, i;
            char n[99999];
     
            scanf("%s", n);
     
            a = strlen(n);
     
            for(i=0;i<a;i++) {
                    if(n[i]=='0') b++;
                    else c++;
            }
     
            if(b>c) printf("%d\n", c*2);
            else printf("%d\n", b*2);
     
            return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	ll x;
	cin >> x;
	ll ans = x / 11;
	x -= 11 * ans;
	ans *= 2;
	if (x > 0)
	{
		if (x > 6) ans += 2;
		else ans++;
	}
	cout << ans << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int N; cin >> N;
    
    int sum = 0;
    bool is_negatives_odd = false;
    int abs_minimum = INT_MAX;
    
    rep(i,N){
        int A; cin >> A;
        if(A < 0) is_negatives_odd = !is_negatives_odd;
        sum += abs(A);
        abs_minimum = min(abs_minimum,abs(A));
    }
    
    if(is_negatives_odd) sum -= 2*abs_minimum;
    
    cout << sum << endl;
    return 0;
}

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

int main() {

    string w;

    cin >> w;

    map<char,int> m;

    for(auto i : w){
        m[i]++;
    }

    for(auto i : m){
        if(i.second%2 != 0){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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


typedef struct pp{
    char name[100];
    int t;
} P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a,int b){
    return a < b ? a : b;
}

int main(){
    int elaps = 0,c;
    int i,q;
    P u;
    scanf("%d %d",&n,&q);
    
    for(i = 1;i <= n;i++){
        scanf("%s",Q[i].name);
        scanf("%d",&Q[i].t);
    }
    head = 1;
    tail = n + 1;
    
    while(head != tail){
        u = dequeue();
        c = min(q,u.t);
        u.t -= c;
        elaps += c;
        if(u.t > 0) enqueue(u);
        else{
            printf("%s %d\n",u.name,elaps);
        }
    }
    
    return 0;
}


Measured memory_bytes: 11928
#include<stdio.h>
int main(){
  int A[101], n, i, j, t, sw = 0;

  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);

  for ( i = 1; i <= n; i++ ){
    for ( j = n; j >= i+1; j-- ){
      if ( A[j] < A[j-1] ){
	t = A[j]; A[j] = A[j-1]; A[j-1] = t;
	sw++;
      }
    }
  }

  for ( i = 1; i <= n; i++ ){
    if (i>1) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);

  return 0;
}


Measured memory_bytes: 2072
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
const int INF=1e9;
ll dp[10010][20000];
void solve()
{
	int h,n;
	cin>>h>>n;
	vector<int>a(n);
	vector<int>b(n);
	rep(i,n){
		cin>>a[i]>>b[i];
	}
	//int ma=*max_element(all(a));
	rep(i,n)rep(j,h+1)dp[i][j]=INF;
	dp[0][0]=0;
	rep(i,n)rep(j,h+1){
		dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i]);
	}
	
	cout<<dp[n][h]<<endl;

}

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


Measured memory_bytes: 157056
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
#include<set>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int ans = 0;
	int X, Y, A, B, C;
	vector<int> p, q, r;
	vector<int> a, b;
	set<pair<int,pair<int,int>>> s;
	
	cin>>X>>Y>>A>>B>>C;
	
	p.resize(A);
	q.resize(B);
	r.resize(C);
	
	for(int i = 0; i < A; i++){
		cin>>p[i];
		// s.insert({p[i],0});
	}
	
	// sort(p.begin(), p.end());
	
	for(int i = 0; i < B; i++){
		cin>>q[i];
		// s.insert({q[i],1});
	}
	
	sort(p.begin(), p.end(), greater<int>());
	sort(q.begin(), q.end(), greater<int>());
	
	for(int i = 0; i < X; i++){
		s.insert({p[i],{0,i}});
	}
	for(int i = 0; i < Y; i++){
		s.insert({q[i],{1,i}});
	}
	
	for(int i = 0; i < C; i++){
		cin>>r[i];
	}
	
	sort(r.begin(), r.end(), greater<int>());
	// sort(r.begin(), r.end(), greater<int>());
	
	for(int i = 0; i < C; i++){
		auto it = s.begin();
		// it--;
		pair<int,pair<int,int>> temp = *it;
		
		// cout<<temp.first<<" "<<temp.second<<" r = "<<r[i]<<endl;
		
		if(temp.first < r[i]) {
			s.erase(temp);
			temp.first = r[i];
			s.insert(temp);
		}
		
	}
	
	for(pair<int,pair<int,int>> p : s){
		// ans += p.first;
		// cout<<p.first<<endl;
		if(p.second.first == 0) {
			// if(A) {
				ans += p.first;
				// A--;
				// a.push_back(p.first);
			// }
		} else {
			// if(B) {
				ans += p.first;
				// B--;
			// }
			// b.push_back(p.first);
		}
	}
	// sort(a.begin(), a.end(), greater<int>());
	// sort(b.begin(), b.end(), greater<int>());
	
	// for(int i = 0; i < X; i++){
		// ans += a[i];
	// }
	// for(int i = 0; i < Y; i++){
		// ans += b[i];
	// }
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 13824
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
constexpr int INF = (numeric_limits<int>::max() == INT_MAX ? (int)1e9 : (long long)1e18);
constexpr long double eps = 1e-6;
const string el = "\n";
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;using pii = pair<int,int>;using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void fast_io(){ios::sync_with_stdio(false); cin.tie(nullptr);}
int out(int a){cout << a << el; return 0;}
int out(string s = "NO"){cout << s << el; return 0;}
template <class T>
inline int out(vector<T>&v,string c = " "){
    for(int i = 0; i < v.size(); ++i){
        if(i) cout << c; cout << v[i];
    } cout << el;return 0;
}
int solve(bool isLarge, deque<int>input){
    deque<int>u;
    if(isLarge){
        u.push_front(input.back());
        input.pop_back();
    } else {
        u.push_back(input.front());
        input.pop_front();
    }
    isLarge = !isLarge;
    int N = input.size();
    rep(i,N){
        if(isLarge){
            isLarge = false;
            int l = input.back();
            input.pop_back();
            bool is_l = false;
            if(abs(u.front() - l) > abs(u.back() - l)){
                u.push_front(l);
                is_l = true;
            }else{
                u.push_back(l);
            }
           // i += 1;
            if(input.empty()) continue;
            l = input.back();
            input.pop_back();
            if(not is_l)
                u.push_front(l);
            else
                u.push_back(l);
            i += 1;
            
        } else {
            isLarge = true;
            int l = input.front();
            input.pop_front();
            bool is_l = false;
            if(abs(u.front() - l) > abs(u.back() - l)){
                u.push_front(l);
                is_l = true;
            }else
                u.push_back(l);
            //i += 1;
            if(input.empty()) continue;
            l = input.front();
            input.pop_front();
            if(not is_l)
                u.push_front(l);
            else
                u.push_back(l);
            i += 1;
        }
    }
    int res = 0;
    for(int i = 0; i + 1 < u.size(); ++i)
        res += abs(u[i + 1] - u[i]);
    return res;
}
signed main(){
    long long K,A,B;
    cin >> K >> A >> B;
    if(K < A + 1 || B - A < 2){
        return out(K + 1);
    } else {
        long long dif = B - A;
        K -= (A + 1);
        int ans = B;
        if(dif < 2) return out(ans + K);
        ans += (K / 2) * dif;
        ans += K % 2;
        out(ans);
    }
}




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

int main() {
  int A, B, C, D, X, Y;
  cin >> A >> B >> C >> D;
  X = A + B;
  Y = C + D;
  
  if (X > Y) {
    cout << "Left" << endl;
  }
  
  if (X == Y) {
    cout << "Balanced" << endl;
  }
  
  if (X < Y) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
const int INF = 1000 * 1000 * 1000;
const ll LINF = (ll)INF * INF;
using namespace std;

string s;
int cnt[26];
int lastPos;
int main() {
	cin >> s;
	if(s.size() == 26)
	{
		string t = s;
		if(!next_permutation(s.begin() , s.end()))
		{
			cout << -1;
			return 0;
		}
		for(int i = 0; i < s.size(); i++)
		{
			cout << s[i];
			if(s[i] != t[i])
				break;
		}
		return 0;
	}
	for(int i = 0; i < s.size(); i++)
		cnt[s[i] - 'a']++;
	cout << s;
	for(int i = 0; i < 26; i++)
	{
		if(!cnt[i])
		{
			cout << (char)(i + 'a');
			return 0;
		}
	}
    return 0;
}






Measured memory_bytes: 256
N, A, B, C, D = map(int, input().split())
S = input()

if S[A-1:C].find('##') != -1 or S[B-1:D].find('##') != -1:
    print('No')
    exit()

ans = 'Yes'
if C > D and S[B-2:D+1].find('...') == -1:
    ans = 'No'
print(ans)


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

int main() 
{
    int N;
    cin >> N;
    vector<int> A(N),B(N),C(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> B[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> C[i];
    }
    sort(A.begin(), A.end());
    sort(C.begin(), C.end());
    
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        int x = B[i];
        auto sum1 = lower_bound(A.begin(), A.end(), x) - A.begin();
        auto sum2 = N - (upper_bound(C.begin(), C.begin()+N, x) - C.begin());
        ans += sum1 * sum2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#define N 55
int main(void)
{
	const char *tar = "AKIHABARA";
	char str[N];
	scanf("%s", str);
	int len = strlen(str);
	int i, j = 0;
	for (i = 0; tar[i]; ++i) {
		if (j == len || str[j] != tar[i]) {
			if (tar[i] != 'A') return !printf("NO");
		}
		else ++j;
	}
	printf("%s", j != len ? "NO" : "YES");
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

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

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

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string o,e;
    cin >> o >> e;
    REP(i,0,e.size()) cout << o[i] << e[i];
    if (o.size() > e.size()) cout << o[o.size()-1];
    cout << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
 
typedef long long int lli;
 
const lli maxn = lli(2e5)+5, inf = lli(1e18)+5, MOD = lli(1e9)+7;
 
lli n, D[maxn][2], W[maxn][2];
vector<pair<lli, lli>> graph[maxn];
 
inline lli lliMOD(lli a, lli b)
{
	return ((a%b)+b)%b;
}
 
void dijkstra(lli node, lli t)
{
	for(lli i = 0;i < n;i++) D[i][t] = inf, W[i][t] = 0;
	D[node][t] = 0, W[node][t] = 1;
	set<pair<lli, lli>> Q;
	Q.insert({D[node][t], node});
 
	while(!Q.empty())
	{
		pair<lli, lli> top = *Q.begin();
		Q.erase(Q.begin());
 
		for(auto it: graph[top.second])
		{
			if(D[it.first][t] > D[top.second][t]+it.second)
			{
				if(D[it.first][t] != inf) Q.erase({D[it.first][t], it.first});
				D[it.first][t] = D[top.second][t]+it.second;
				W[it.first][t] = W[top.second][t]%MOD;
				Q.insert({D[it.first][t], it.first});
			}
			else if(D[it.first][t] == D[top.second][t]+it.second)
			{
				W[it.first][t] += W[top.second][t]%MOD;
				W[it.first][t] %= MOD;
			}
		}
	}
}
 
int main(void)
{
	lli m, s, t, u, v, d;
	scanf("%lld%lld%lld%lld", &n, &m, &s, &t);
	s--, t--;
 
	for(lli i = 0;i < m;i++)
	{
		scanf("%lld%lld%lld", &u, &v, &d);
		u--, v--, d *= 2ll;
		graph[u].push_back({v, d}), graph[v].push_back({u, d});
	}
 
	dijkstra(s, 0), dijkstra(t, 1);
	lli dis = D[t][0], ans = 0;
 
	for(lli i = 0;i < n;i++) W[i][0] %= MOD, W[i][1] %= MOD;
 
	for(lli i = 0;i < n;i++)
	{
		//cout << i << " " << D[i][0] << ":" << W[i][0] << " " << D[i][1] << ":" << W[i][1] << "\n";
		if(D[i][0]+D[i][1] == dis && D[i][0] == dis/2ll)
		{
			ans += (((W[i][0]*W[i][1])%MOD)*((W[i][0]*W[i][1])%MOD))%MOD;
			ans %= MOD;
		}
		for(auto it: graph[i])
		{
			if(D[i][0]+it.second+D[it.first][1] == dis && D[i][0] < dis/2 && D[it.first][1] < dis/2)
			{
				ans += (((W[i][0]*W[it.first][1])%MOD)*((W[i][0]*W[it.first][1])%MOD))%MOD;
				ans %= MOD;
			}
		}
	}
 
	printf("%lld\n", lliMOD((W[t][0]*W[t][0])%MOD-ans%MOD, MOD));
}

Measured memory_bytes: 25968
use proconio::*;
use std::cmp::max;
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d],
    };

    let mut lasts = [-1; 26];
    let mut t = vec![26; d];
    let depth = 25;
    for i in 0..d {
        let mut max_score = -10000000;
        for j in 0..26 {
            let tmp = search(i, j, &c, &s, &mut lasts, depth, d, 0, 6);
            if tmp > max_score {
                max_score = tmp;
                t[i] = j;
            }
        }
        lasts[t[i]] = i as i64;
    }

    for &a in &t {
        println!("{}", a + 1);
    }
}

fn calc_score(i: usize, j: usize, c: &Vec<i64>, s: &Vec<Vec<i64>>, lasts: &mut [i64; 26]) -> i64 {
    let mut res = s[i][j];
    let tmp = lasts[j];
    lasts[j] = i as i64;

    for j in 0..26 {
        let i = i as i64;
        let last = lasts[j];
        res -= c[j] * (i - last);
    }

    lasts[j] = tmp;
    res
}

fn search(
    i: usize,
    t: usize,
    c: &Vec<i64>,
    s: &Vec<Vec<i64>>,
    lasts: &mut [i64; 26],
    depth: usize,
    d: usize,
    cscore: i64,
    l: usize,
) -> i64 {
    if depth == 0 || i == d - 1 {
        return calc_score(i, t, &c, &s, lasts) + cscore;
    }

    let l = max(1, l - 1);
    let mut max_score = -1000000;
    let tmp_last = lasts[t];
    lasts[t] = i as i64;
    let tmp_score = calc_score(i, t, &c, &s, lasts);
    let mut cands = BinaryHeap::new();
    cands.reserve(26);
    for j in 0..26 {
        let tmp_score = calc_score(i + 1, j, &c, &s, lasts);
        cands.push((tmp_score, j));
    }
    let w = if l > 1 { 2 } else { 1 };
    for &(_, j) in cands.iter().take(w) {
        let tmp = search(i + 1, j, &c, &s, lasts, depth - 1, d, cscore + tmp_score, l);

        if tmp > max_score {
            max_score = tmp;
        }
    }

    lasts[t] = tmp_last;
    max_score + cscore
}


Measured memory_bytes: 2332
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, L, sum=0, MIN=INF;
  cin >> N >> L;
  for(int i=1;i<=N;i++) {
    sum+=L+i-1;
    if(abs(L+i-1)<=abs(MIN)) MIN=L+i-1;
  }
  if(sum>=0) {
    if(MIN>=0) cout << sum-MIN << endl;
    else cout << sum+MIN << endl;
  }
  else {
    if(MIN>=0) cout << sum+MIN << endl;
    else cout << sum-MIN << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int j,n,flag,count;
    char w[100]={0},i;
    scanf("%s",w);
    flag=0;
    n=strlen(w);
    for(i=97;i<='z';i++)
    {
        count=0;
        for(j=0;j<n;j++)
            if(w[j]==i)
                count++;
        if(count%2!=0)
        {
            flag=1;
            break;
        }
    }
        if(flag==1)
        printf("No\n");
        else
    printf("Yes\n");
    return 0;
}


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

int main() {
 int a,b,c; cin >> a >> b >> c;
  int abmin=min(a,b);
  int abmax=max(a,b);
  if(c<=abmax && c>=abmin)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3624
N,M = map(int, input().split())
A = list(map(float, input().split()))
sum_A = sum(A)
cout = 0
flag = False
for i in range(N):
  if A[i] >= sum_A / (4 * M):
    cout += 1
    if cout >= M:
      flag = True
      break
      
if flag:
  print('Yes')
else:
  print('No')

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

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

    int flag = 0;

    int len = s.length();

    if(s[0] != 'A'){
        flag = 1;
    }

    int cou_c = 0;

    if(flag == 0){
        for(int i = 2; i < len - 1; i++){
            if(s[i] == 'C'){
                cou_c++;
                s.erase(i, 1);
                len--;
                i--;
            }
        }
    }

    if(cou_c != 1){
        flag = 1;
    }

    if(flag == 0){
        for(int i = 1; i < len; i++){
            if(isupper(s[i])){
                flag = 1;
                break;
            }
        }
    }

    if(flag == 0){
        cout << "AC" << endl;
    }else{
        cout << "WA" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second
#define mod 1000000007
#define pi acos(-1.0)
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

void c_p_c()
{
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
}

int main(int argc, char const *argv[])
{
    //c_p_c();
    FastIO;
int n;
   cin>>n;
   double r = 2*pi*n;
   cout<<ps(r,16)<<endl;

}



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

int main() {
    int N;
    cin>>N;
    vector<long> A;
    long ansarr[N];
    long ansarr1[N], ansarr2[N];
    long tmp;
    long ans=0;
    long ans1=0;
    for(int i=0;i<N;++i){
        cin>>tmp;
        A.push_back(tmp);
    }

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

    if (N%2==0){
        for(int i=0;i<N/2;++i){
            if(i%2==0){
                ansarr[N/2-i-1] = A[i];
                ansarr[N/2+i] = A[A.size()-i-1];
            }
            else{
                ansarr[N/2-i-1] = A[A.size()-i-1];
                ansarr[N/2+i] = A[i];
            }
        }
        for(int i=0;i<N-1;++i){
            ans += abs(ansarr[i+1] - ansarr[i]);
        }
        cout<<ans<<endl;
    }
    else {
        for(int i=0;i<(N-1)/2;++i){
            if(i%2==0){
                ansarr1[(N-1)/2+i] = A[A.size()-i-1];
                ansarr1[(N-1)/2-i-1] = A[i];
                ansarr2[(N-1)/2+i+1] = A[A.size()-i-1];
                ansarr2[(N-1)/2-i] = A[i];
            }
            else {
                ansarr1[(N-1)/2+i] = A[i];
                ansarr1[(N-1)/2-i-1] = A[A.size()-i-1];
                ansarr2[(N-1)/2+i+1] = A[i];
                ansarr2[(N-1)/2-i] = A[A.size()-i-1];
            }
        }
        ansarr1[N-1] = A[(A.size()-1)/2];
        ansarr2[0] = A[(A.size()-1)/2];
        for(int i=0;i<N-1;++i){
            ans += abs(ansarr1[i+1] - ansarr1[i]);
            ans1 += abs(ansarr2[i+1] - ansarr2[i]);
        }
        if(ans>ans1){
            cout<<ans<<endl;
        }
        else{
            cout<<ans1<<endl;
        }
    }
}


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;


int main()
{
    char a, b;
    while(scanf("%c %c", &a, &b) != EOF)
    {
        getchar();
        if(a == 'H')
        {
            if(b == 'H')
                printf("H\n");
            else
                printf("D\n");
        }
        else if(a == 'D')
        {
            if(b == 'H')
                printf("D\n");
            else
                printf("H\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

int main(){
    int N, M;
    cin >> N >> M;
    vector<ll> X;
    for(int i = 0; i < M; ++i){
        ll tmp;
        cin >> tmp;
        X.push_back(tmp);
    }
    if(N>=M){
        cout << 0 << endl;
        return 0;
    }
    sort(X.begin(), X.end());
    vector<ll> diff;
    for(int i = 1; i < M; ++i){
        ll tmp_diff = abs(X[i]-X[i-1]);
        diff.push_back(tmp_diff);
    }
    sort(diff.begin(), diff.end());
    ll sum = 0;
    for(int i = 0; i < M-N; ++i){
        sum += diff[i];
    }
    cout << sum << endl;
    return 0;
}

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

#define INF 100000000



int main(){
    ll n;
    cin>>n;
    vector<ll> a(n+1), b(n);
    rep(i,n+1) cin >> a[i];
    rep(i,n) cin >> b[i];

    ll ans = 0;

    vector<vector<ll>> c(n, vector<ll>(2));
    c[0][0] = min(a[0], b[0]);
    c[0][1] = min(a[1], b[0] - c[0][0]);

    ans += c[0][0] + c[0][1];

    rep2(i,1,n){
        c[i][0] = min(a[i] - c[i-1][1], b[i]);
        c[i][1] = min(a[i+1], b[i] - c[i][0]);
        ans += c[i][0] + c[i][1];
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

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

    int a, b;
    cin >> a >> b;

    for (int i=0; i<max(a,b); i++)
        cout << min(a,b);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	

	
	public static class Sushi{
		int t;
		int d;
		
		public Sushi(int t, int d) {
			this.t = t;
			this.d = d;
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		Sushi[] sushis = new Sushi[N];
		
		for (int i = 0; i < N; i++) {
			int t = sc.nextInt();
			int d = sc.nextInt();
			sushis[i] = new Sushi(t, d);
		}
		
		Arrays.sort(sushis, new Comparator<Sushi>() {
			public int compare(Sushi s1, Sushi s2) {
				return s2.d - s1.d;
			}
		});
		
		ArrayList<Sushi> extras = new ArrayList<Sushi>();
		HashMap<Integer, Boolean> types = new HashMap<Integer, Boolean>();
		
		long typeCount = 0;
		long deliciousness = 0;
		for (int i = 0; i < K; i++) {
			Sushi s = sushis[i];
			if (!types.containsKey(s.t)) {
				types.put(s.t, true);
				typeCount++;
			} else {
				extras.add(s);
			}
			deliciousness += s.d;
		}
		
		long satisfaction = typeCount*typeCount + deliciousness;
		
		for (int i = K; i < N && extras.size() > 0; i++) {
			Sushi s = sushis[i];
			if (!types.containsKey(s.t)) {
				types.put(s.t, true);
				typeCount++;
				deliciousness -= extras.get(extras.size()-1).d;
				deliciousness += s.d;
				extras.remove(extras.size()-1);
				satisfaction = Math.max(satisfaction, typeCount*typeCount + deliciousness);
			}
		}
		
		System.out.println(satisfaction);
	}
}


Measured memory_bytes: 95816