akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define len(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>

signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  long double res = 0;
  rep(i, n) {
    long double x;
    string u;
    cin >> x >> u;
    if (u == "JPY")
      res += x;
    else
      res += x * 380000.0;
  }
  cout << fixed << setprecision(10) << res << endl;
  ret;
}


Measured memory_bytes: 3740
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

constexpr int countDivideBy2(int x) {
    int count = 0;
    while (x % 2 == 0) {
        x /= 2;
        count++;
    }
    return count;
}

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

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

    int ans = 0;

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

    cout << ans << endl;
}


Measured memory_bytes: 3716
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int N;
string S;
int ans[4];

int main(){
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> S;
		if (S == "AC"){
			ans[0]++;
		}
		else if (S == "WA"){
			ans[1]++;
		}
		else if (S == "TLE"){
			ans[2]++;
		}
		else{
			ans[3]++;
		}
	}
	cout << "AC x " << ans[0] << endl;
	cout << "WA x " << ans[1] << endl;
	cout << "TLE x " << ans[2] << endl;
	cout << "RE x " << ans[3] << endl;
	return 0;
}

Measured memory_bytes: 3608
using System;
using System.Linq;
class Program
{

    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var X = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        var sMin = X.Length * 10000;
        for (var p = X.Min(); p <= X.Max(); p++)
        {
            var s = 0;
            for (var i = 0; i < N; i++)
            {
                s += (X[i] - p) * (X[i] - p);
            }
            if (s < sMin) sMin = s;
        }
        Console.WriteLine(sMin);
    }
}


Measured memory_bytes: 13396
import sys
sys.setrecursionlimit(10**5 + 5)
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
Graph = [[] for _ in range(N+1)]
is_good = [False] + [True] * N
seen = [True] + [False] * N

def dfs(cur):
    global Graph, seen, H
    seen[cur] = True
    for nex in Graph[cur]:
        if H[nex] >= H[cur]:
            is_good[cur] = False
        if seen[nex]:
            continue
        dfs(nex)


for _ in range(M):
    a, b = map(int, input().split())
    Graph[a].append(b)
    Graph[b].append(a)

for i in range(1, N+1):
    if not seen[i]:
        dfs(i)

print(is_good.count(True))

Measured memory_bytes: 53700
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX 5000001
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
const ll INF = 10010010010001;

int main(){
  int n;
  cin>>n;
  vector<long long int> c(5);
  for(int i=0;i<5;i++) c[i]=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s[0]=='M'){
      c[0]++;
    }else if(s[0]=='A'){
      c[1]++;
    }else if(s[0]=='R'){
      c[2]++;
    }else if(s[0]=='C'){
      c[3]++;
    }else if(s[0]=='H'){
      c[4]++;
    }
  }
  
    long long int ans=0;
    for(int i=0;i<3;i++){
      for(int j=i+1;j<4;j++){
        for(int k=j+1;k<5;k++){
          ans+=c[i]*c[j]*c[k];
        }
      }
    }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int n = sc.nextInt();
            int x = sc.nextInt();
            if(n==0&&x==0) break;
            int c = 0, i, j=2, k=3;
            for (i = 1; i < j; i++) {
                for (j = i+1; j < k; j++) {
                    for (k = j+1; k <= n; k++) {
                        if ((i + j + k) == x) c++;
                    }
                }
            }
            System.out.println(c);
        }
    }
}


Measured memory_bytes: 26580
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int>t(5);
  rep(i,5)cin>>t[i];
  int mi=10;
  int cnt=0;
  rep(i,5)
  {
    int tt=t[i]%10;
    if(tt==0)tt+=10;
    cnt+=t[i]-tt+10;
    
    chmin(mi,tt);
  }
  cnt-=10;
  cnt+=mi;
  cout<<cnt<<endl;

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=1e9+7;
#define N 200010
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,a[N],ans; //0: 左端点；1：右端点 
char s[N];
int main(){
	n=read();
	scanf("%s",s+1);
	int rem=0;
	for(int i=1;i<=(n<<1);++i){
		a[i]=(s[i]=='W')^(rem&1);
		rem+=(a[i]?-1:1); 
		if(rem<0)return !printf("0\n");
	}
	if(rem)return !printf("0\n");
	ans=1;
	for(int i=1;i<=(n<<1);++i){
		if(a[i]){
			ans=1LL*ans*rem%mod;
			--rem;
		}
		else{
			++rem;
		}
	}
	for(int i=1;i<=n;++i){
		ans=1LL*ans*i%mod;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 4796
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  int s=0;
  s=(n-1)*n/2;
  s+=(m-1)*m/2;
  printf("%d\n",s);	
}



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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;

//mt19937 random(566);
//uniform_int_distribution<ll> distr;
//ll rnd(ll a, ll b) {return a + distr(random) % (b - a + 1);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    cout << (n+1)/2 << "\n";
    return 0;
}

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

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

  string s; cin >> s;
  int cnt = 0;
  for(int i = 0; i < s.size()-1; i++){
    if(s[i] != s[i+1]) cnt++;
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 512
def myAnswer(A:int,B:int,K:int) -> int:
   if(B - A >= K):
      ans = [i for i in range(A,A+K) ]
      for i in range(B,B-K,-1):
         ans.append(i)
   else:
      ans = [i for i in range(A,B+1)]
   ans = list(set(ans))
   ans.sort()
   for a in ans:
      print(a)

   

def modelAnswer():
   tmp=1
def main():
   A,B,K = map(int,input().split())
   myAnswer(A,B,K)

if __name__ == '__main__':
   main()

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

int main()
{
    long int X;
    cin >> X;
    long int ans = 0;
    ans += (X / 500)*1000;
    X = X - 500*(X / 500);
    ans += (X / 5)*5;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
const long double pi = 3.1415926535897932384L;
long double f(double x) {
	if (x + 1 <= 1.0e-9L) return pi;
	if (x - 1 >= -1.0e-9L) return 0.0L;
	return acos(x);
}
int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	long double ret = 0.0;
	for (int i = 1; i < 1 << n; i++) {
		vector<int> sub;
		for (int j = 0; j < n; j++) {
			if ((i >> j) & 1) sub.push_back(v[j]);
		}
		sort(sub.begin(), sub.end());
		int m = sub.size();
		if (m <= 2) continue;
		do {
			function<long double(long double) > calc = [&](long double x) {
				long double ret = 0.0;
				for (int k = 0; k < m; k++) ret += f(x / (sub[k] * sub[(k + 1) % m]));
				return ret;
			};
			long double l = -1.0e+7, r = 1.0e+7;
			for (int j = 0; j < 60; j++) {
				long double mid = (l + r) * 0.5L;
				if (calc(mid) > 2 * pi) l = mid;
				else r = mid;
			}
			long double res = 0.0, sum = 0.0;
			for (int j = 0; j < m; j++) {
				long double ang = f(l / (sub[j] * sub[(j + 1) % m])); sum += ang;
				res += sub[j] * sub[(j + 1) % m] * sin(ang);
			}
			ret = max(ret, res);
		} while (next_permutation(sub.begin(), sub.end()));
	}
	cout << fixed << setprecision(15) << ret * 0.5 << endl;
	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (c >= a && c <= b)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,k = map(int,input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A,B = [0],[0]

for i in range(n):
  A.append(a[i] + A[i])
for i in range(m):
  B.append(b[i] + B[i])

num,x = 0,m

for i in range(n+1):
  if A[i] > k:
    break
  while A[i] + B[x] > k:
    x -= 1
  num = max(num, i + x)
  
print(num)




Measured memory_bytes: 47372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main () {
   int A, B; cin >> A >> B;
 int ans = 0;
 int outlet = 1;
 while (outlet < B) {
 outlet--;
 outlet += A;
 ans++;
 }
 cout << ans << endl;
    
    
    
    
    
    
    
    
}
 

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int N;
	cin >> N;
    vector<vector<int>> F(N, vector<int>(10));
    rep(i,N)rep(j,10) cin >> F[i][j];
    vector<vector<int>> P(N, vector<int>(11));
    rep(i,N)rep(j,11) cin >> P[i][j];

    int ans = -(1<<30);
    for (int b = 1; b < (1<<10); b++) {
        int tmp = 0;
        rep(i,N) {
            int cnt = 0;
            rep(j,10) {
                if((b>>j&1)&&F[i][j]) {
                    cnt++;
                }
            }
            tmp += P[i][cnt];
        }
        ans = max(ans, tmp);
    }
    
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<queue>
#include<map>
#include<stack>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 1e5;
typedef long long LL;
int main(){
	int n,a,b;
	cin >> n >> a >> b;
	if((b-a)%2==0)
		printf("Alice\n");
	else
		printf("Borys\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, x, ans = 0;
    cin >> a >> b >> c >> x;
    rep(i, 0, a + 1){
        rep(j, 0, b + 1){
            rep(k, 0, c + 1){
                if(500 * i + 100 * j + 50 * k == x) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std ;

string s ;

int a ;

int main ()
{
    cin >> s ;
    a = s . size () ;
    string t = "AC" ;
    int b = 0 ;
    if ( s [ 0 ] != 'A' ){
        t = "WA" ;
    }
    for ( int i = 1 ; i < a ; ++ i ){
        if ( isupper ( s [ i ] ) ){
            if ( i == 1 || i == a - 1 || s [ i ] != 'C' ){
                t = "WA" ;
            }
            b ++ ;
        }
    }
    if ( b != 1 ){
        t = "WA" ;
    }
    cout << t ;
}


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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}
template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }
template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }
template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T> inline bool chkmax(T &x, const T &y){ return y > x ? x = y, 1 : 0; }
template <typename T> inline bool chkmin(T &x, const T &y){ return y < x ? x = y, 1 : 0; }

#ifdef ONLINE_JUDGE
#define debug(...) ;
#else
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG
#endif

//---------------------------------------------------------head----------------------------------------------------

const int maxn = 1e5 + 100;

int n;
LL A, B;
LL h[maxn];

bool check(LL k)
{
	static LL p[maxn];
	memcpy(p, h, sizeof(p));

	forn(i, 1, n) p[i] -= k * B;
	LL D = A - B, x = 0;
	forn(i, 1, n) if(p[i] > 0)
	{
		x += p[i] / D;
		if(p[i] % D != 0) ++x;
	}
	return x <= k;
}

int main()
{
	scf(n);
	scf(A, B);
	forn(i, 1, n) scf(h[i]);
	LL lb = 0, rb = 1000000000;
	while(lb <= rb)
	{
		LL mid = lb + rb >> 1;
		if(check(mid)) rb = mid - 1;
		else lb = mid + 1;
	}
	printf("%lld\n", lb);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
using namespace std;

typedef long long ll;

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

int main(){
  double a;
  int A[2],B[2],C[2],D[2];
  rep(i,2) A[i] = B[i] = C[i] = D[i] = 0;

  while(1){
    rep(i,2){
      if(!(cin>>a)){
        printf("%d %d\n",A[0],A[1]);
        printf("%d %d\n",B[0],B[1]);
        printf("%d %d\n",C[0],C[1]);
        printf("%d %d\n",D[0],D[1]);
        return 0;
      }

      if(a >= 1.1){
        A[i]++;
      }
      else if(a >= 0.6){
        B[i]++;
      }
      else if(a >= 0.2){
        C[i]++;
      }
      else{
        D[i]++;
      }
    }
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf (ll)1e18

struct data {
  ll a, b, c;
};

ll n, m, p;
ll dist[2600];
vector<data> edge;

bool bell() {
  bool ch = false;
  for(int i = 0; i < m; ++i) {
    data now = edge[i];
    if(dist[now.a] != inf && dist[now.b] > dist[now.a] + now.c) {
      if(now.b == n - 1) ch = true;
      dist[now.b] = dist[now.a] + now.c;
    }
  }
  return ch;
}

bool ch() {
  bool ch = false;
  for(int i = 0; i < m; ++i) {
    data now = edge[i];
    if(dist[now.a] != inf &&dist[now.b] > dist[now.a] + now.c) {
      if(now.b == n - 1) ch = true;
      dist[now.b] = -inf;
    }
  }
  return ch;
}

ll solve() {
  for(int i = 0; i < n; ++i) dist[i] = inf;
  dist[0] = 0;
  for(int i = 0; i < n - 1; ++i) bell();
  for(int i = 0; i < n; ++i) if(ch()) return -1;
  return max(-dist[n - 1], 0LL);
}

int main() {
  cin >> n >> m >> p;
  for(int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    edge.push_back({--a, --b, p - c});
  }
  cout << solve() << endl;
  return 0;
}




Measured memory_bytes: 576
N ,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
MOD = 10**9+7

def combinations_count(n, r):
    if n >= r:
        return ((fact[n] * fact_inv[n-r])%MOD) * fact_inv[r]%MOD
    else:
        return 0

fact = [1] * (N+1)
fact_inv = [1] *(N+1)
for i in range(1,N+1):
    fact[i] = (fact[i-1] * i)%MOD
    fact_inv[i] = pow(fact[i],MOD-2,MOD)

ans = 0
L = len(A)
for i,a in enumerate(A):
    MIN = combinations_count(L-1-i,K-1)
    MAX = combinations_count(i,K-1)
    ans += MAX*a - MIN*a
    ans %= MOD

print(ans)

Measured memory_bytes: 14872
#include<bits/stdc++.h>
#define int long long
#define log(x,b) (log(x)/log(b))
using namespace std;

string s[101];

int32_t main()
{
    int k,s;
    cin>>k>>s;

    int cnt=0;
    for(int i=0;i<k+1;i++){
        for(int j=0;j<k+1;j++){
            int p=s-i-j;
            if(p>=0&&p<=k)cnt++;
        }
    }

    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        var S = cin.next;
        WriteLine($"{S[0]}{S.Length - 2}{S[S.Length - 1]}");
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13264
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = x*x*x;
		
		System.out.println(ans);
		

	}

}



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

map<char,char> go,back;

string S,T;
int main () {
    cin >> S >> T;
    int l = S.size();
    bool flag = true;
    for(int i=0; i<l; i++) {
        if(go[S[i]]) {
            if(go[S[i]] != T[i]) flag = false;
        }
        if(back[T[i]]) {
            if(back[T[i]] != S[i]) flag = false;
        }
            go[S[i]] = T[i];
            back[T[i]] = S[i];
        //if(go[S[i]] != back[S[i]]) flag = false;
    }
    cout << ( flag ? "Yes" : "No" ) << endl;
    return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+5;
int n,a[N],s[N];

inline bool check(int x){
	int v=0;
	for(int i=1;i<n;i+=2){
		if(s[i]-v>=x){
			v=min(v,s[i+1]);
		}
	}
	return s[n]-v>=x;
}

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	if(!(n%2)){
		int s0=0,s1=0;
		for(int i=1;i<=n;i++)if(i&1)s0+=a[i];else s1+=a[i];
		cout << max(s0,s1) << " " << min(s0,s1) << endl;
		return 0;
	}
	for(int i=1;i<=n;i++){
		if(i&1)s[i]=s[i-1]+a[i];
		else s[i]=s[i-1]-a[i];
	}
	int l=1, r=n*1000, ans=l;
	while(l<=r){
		int mid = (l+r)>>1;
		if(check(mid))l=mid+1,ans=mid;
		else r=mid-1;
	}
	for(int i=1;i<=n;i++){
		if(i%2==0)
			ans+=a[i];
	}
	int s=0;
	for(int i=1;i<=n;i++)s+=a[i];
	cout << ans << " " << s - ans << endl;
}

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

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

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

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

    ll Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;

    ll two_l = min(D, min(2 * S, min(4 * H, 8 * Q)));
    ll one_l = min(S, min(2 * H, 4 * Q));

    ll rsl = N / 2 * two_l;
    N %= 2;
    rsl += N * one_l;
    cout << rsl << endl;
}


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

int main(){
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int maxX = -999;
  int minY =  999;

  for(int i = 0; i < N; i++){
    int x ;
    cin >> x ;
    maxX = max(maxX,x);
  }
  for(int  j = 0; j < M; j ++){
    int y;
    cin >> y;
    minY = min(minY,y);
  }
  if(X < maxX && minY <= Y && X < Y && maxX < minY){
    cout << "No War" << endl;
  }
  else{
    cout << "War" << endl;
  }
}



Measured memory_bytes: 256
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int x, n;
    cin >> x >> n;
    set<int> s;
    for(int i = 0; i <= 120; i++){
        s.insert(i);        
    }
    for(int i = 0; i < n; i++){
        int y;
        cin >> y;
        s.erase(y);
    }
    int res = 0, val = 120;
    for(auto y : s){
        if(abs(y - x) < val){
            val = abs(y - x);
            res = y;
        }
    }
    cout << res << "\n";
    return;
}

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false), cin.tie(0)
typedef long long ll;
const int maxn = 2e5 + 5;
double s[maxn];

int main()
{
    IO;
    int n, k;
    cin >> n >> k;
    s[0] = 0;
    for (int i = 1; i <= n; ++i)
    {
        int x;
        cin >> x;
        s[i] = s[i - 1] + 1.0 * (1 + x) / 2;
    }
    double maxx = 0;
    for (int i = k; i <= n; ++i)
    {
        maxx = max(maxx, s[i] - s[i - k]);
    }
    cout << fixed << setprecision(10) << maxx << endl;
}

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




int main() {
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 cout.tie(0);
  ll a,b; cin>>a>>b;
  string s;
  while(cin>>s){
    cout<<s<<endl;
    cout<<s<<endl;
  }


  return 0;
}


Measured memory_bytes: 3620
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    if p[i]>p[i-1] and p[i]<p[i+1] or p[i]<p[i-1] and p[i]>p[i+1]:
        ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll h,a; cin >> h >> a;
	cout << (h+a-1)/a << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var aList = readLine()!!.split(" ").map(String::toInt).toMutableList()

    var count = 0

    while (aList.filter { it % 2 == 0 }.size == n) {
        for (i in 0 until aList.size) {
            aList[i] = if (aList[i] % 2 == 0) aList[i]/2 else break
        }

        count ++
    }
    println(count)
}


Measured memory_bytes: 37944
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    input += chunk;
});
process.stdin.on('end', function() {
    var lines = input.split('\n');
    for (var i = 0; i < lines.length; i++) {
        var args = lines[i].split(' ').map(Number);
        if (args[0] == 0 && args[1] == 0) {
            break;
        }
        var result = args.sort(function(a, b) {
            return a - b;
        });
        console.log(result.join(' '));
    }
});

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

int main(void)
{
  int ans = 1;
  char s[3 + 1];
  if (scanf("%3s%*[^\n]%*c", s) > 0) {
    for (int i = 0; i < strlen(s); i++) {
      switch (s[i]) {
      case 'a': ans *= 2; break;
      case 'b': ans *= 3; break;
      case 'c': ans *= 5; break;
      }
    }
    puts(ans == 30 ? "Yes" : "No");
  }
}


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

int main() {
    int n;
    cin >> n;
    int ct = 0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin >> x;
        if(x == (ct + 1))
            ct++;
        
    }
    if(ct == 0)
        ct = n + 1;
    cout << (n - ct);
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,L, W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> N;
  cout << N*N*N << endl;
  


}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args)
    {
        double i,j,k=0;
        int m;
        Scanner sc =new Scanner(System.in);
        i=sc.nextLong();
        j=sc.nextLong();
        k=i/j;
        m=(int)(Math.ceil(k));
        System.out.println(m);
    }
}

Measured memory_bytes: 22740
#include<stdio.h>
int main(void)
{
  int i,count=0;
  char str[4];
  
  fgets(str,sizeof(str),stdin);
  
  for(i=0;i<2;i++)
  {
    if(str[i] == '9')
      count++;
  }
  
  if(count>0)
  {
    puts("Yes");
  }else
  {
    puts("No");
  }
  
  return 0;
}

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

using namespace std;

int v[105];

int main(){
    int n,i,j,answer=INT_MAX,sum;

    cin>>n;

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

    for(i=0;i<=100;i++){
        sum=0;

        for(j=1;j<=n;j++)
            sum+=(v[j]-i)*(v[j]-i);

        if(sum<answer)
            answer=sum;
    }

    for(i=0;i<=100;i++){
        sum=0;

        for(j=1;j<=n;j++)
            sum+=(v[j]+i)*(v[j]+i);

        if(sum<answer)
            answer=sum;
    }

    cout<<answer;

    return 0;
}


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

using namespace std;

#define ll long long
#define endl '\n'
const int N = 305;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("BONUS.INP", "r")){
                freopen("BONUS.INP", "r", stdin);
                freopen("BONUS.OUT", "w", stdout);
        }
        ll t;
        cin >> t;
        while (t--){
                ll n;
                cin >> n;
                priority_queue<ll, vector<ll>, greater<ll>> usedL, usedR;
                priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> L, R;
                ll ans = 0;
                for (int i = 1; i <= n; i++){
                        ll k, l, r;
                        cin >> k >> l >> r;
                        if (l > r) {
                                L.push({k, l - r});
                                ans += r;
                        } else {
                                R.push({n - k, r - l});
                                ans += l;
                        }
                }
                ll cnt = 0;
                while (L.size()){
                        pair<ll, ll> now = L.top();
                        L.pop();
                        if (now.first > cnt){
                                cnt++;
                                ans += now.second;
                                usedL.push(now.second);
                        } else {
                                if (now.second > usedL.top()){
                                        ans = ans - usedL.top() + now.second;
                                        usedL.pop();
                                        usedL.push(now.second);
                                }
                        }
                }
                cnt = 0;
                while (R.size()){
                        pair<ll, ll> now = R.top();
                        R.pop();
                        if (now.first > cnt){
                                cnt++;
                                ans += now.second;
                                usedR.push(now.second);
                        } else {
                                if (usedR.size() == 0) continue;
                                if (now.second > usedR.top()){
                                        ans = ans - usedR.top() + now.second;
                                        usedR.pop();
                                        usedR.push(now.second);
                                }
                        }
                }
                cout << ans << endl;
        }
}
/*
*/


Measured memory_bytes: 9064
//
// Created by corol
//
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    int cnt=0;
    for (int i=0;i<n;i++) {
        cin >> a[i];
    }
    for (int i=0;i<n;i++) {
        if (a[i]%2!=0 && (i+1)%2!=0) cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3576
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Storable as V
import qualified Data.Vector.Storable.Mutable as MV

findUF :: MV.IOVector Int -> Int -> IO Int
findUF uf x = do
    p <- MV.unsafeRead uf x
    if p == -1
        then return x
        else do
                f <- findUF uf p
                MV.unsafeWrite uf x f
                return f

main = do
    [n,m] <- map read.words <$> getLine

    -- 順列読込 / ByteString -> Vector.Storable
    ps <- V.unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine

    -- (xi, yi)をUnionFind -> Vector.Storable.Mutable
    uf <- MV.replicate (n+1) (-1)
    replicateM_ m $ do
        [x,y] <- unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
        px <- findUF uf x
        py <- findUF uf y
        when (px /= py) $ MV.unsafeWrite uf py px

    -- (i == pi)の数
    (print.length.filter id) =<< mapM (chk uf ps) [1..n]

chk uf ps i = do
    ri <- findUF uf i
    pi <- findUF uf $ ps V.! (i-1)
    return $ ri == pi

Measured memory_bytes: 15996
n, m, d = gets.chomp.split.map(&:to_i)
arr = []
n.times{arr << gets.chomp.split("")}

sum = 0
for y in 0..(arr.length - 1)
    for x in 0..(arr[0].length - d)
        sum += 1 if arr[y][x, d].join == "." * d
    end
end

arr = arr.transpose
arr.map!{|ar| ar.reverse}
for y in 0..(arr.length - 1)
    for x in 0..(arr[0].length - d)
        sum += 1 if arr[y][x, d].join == "." * d
    end
end
puts sum


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

class Program
{
    static void Main(string[] args)
    {
        var N = long.Parse(ReadLine());

        static long GetPow(int n) => (n == 0) ? 1 : -2 * GetPow(n - 1);
        var pow = Enumerable.Range(0, 40).Select(i => GetPow(i)).ToArray();

        long GetValue(bool[] bits) => bits.Select((v, i) => v ? pow[i] : 0).Sum();
        var bits = new bool[pow.Length];

        if (0 < N)
        {
            bits = pow.Select(v => 0 < v).ToArray();
            foreach (var (v, i) in pow.Select((v, i) => (v, i)).Reverse())
            {
                var isM = (v < 0);
                var value = GetValue(bits);
                if (value == N)
                    break;
                else if(value - (isM ? -v : v) >= N)
                    bits[i] = isM;
            }
        }
        else if(0 > N)
        {
            bits = pow.Select(v => 0 > v).ToArray();
            foreach (var (v, i) in pow.Select((v, i) => (v, i)).Reverse())
            {
                var isP = (v > 0);
                var value = GetValue(bits);
                if (value == N)
                    break;
                else if (value - (isP ? -v : v) <= N)
                    bits[i] = isP;
            }
        }

        var ans = new string(bits.Reverse().Select(x => x ? '1' : '0').ToArray());
        ans = ans.TrimStart('0');
        ans = ans == "" ? "0" : ans;
        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 28356
#include <cstdio>
#include <cstring>

const int N = 100010;
int a[N*2 + 10];
bool f[N*2 + 10];

int main() {
    int n, x;
    while (scanf("%d%d", &n, &x) == 2) {
        if (x == 1 || x == 2 * n - 1) {
            puts("No");
            continue;
        }
        memset(a, -1, sizeof(a));
        memset(f, 0, sizeof(f));
        a[n] = x;
        f[x] = f[x-1] = f[x+1] = 1;
        a[n-1] = x - 1;
        a[n+1] = x + 1;
        if (x + 2 < 2 * n)
        a[n-2] = x + 2, f[x+2] = 1;
        else a[n+2] = x - 2, f[x-2] = 1;
        int now = 1;
        int pos = 1;
        while (pos < 2 * n)  {
            if (a[pos] != -1) pos++;
            else if (f[now]) now++;
            //if (pos >= n - 2 && pos <= n + 1) pos = n + 2;
            else {
                //if (now >= x - 1 && now <= x + 2) now = x + 3;
                a[pos++] = now++;
            }
        }
        puts("Yes");
        for (int i = 1; i < 2 * n; ++i) printf("%d\n", a[i]);
    }
    return 0;
}


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


int main(){
  int a,b;
  cin>>a>>b;
  int x =0;
  int y =0;

  while(y!=a){
    x+=1;
    y =x*(0.08);
  }
  int x8min =x;
  while(y==a){
    x +=1;
    y =x*(0.08);
  }
  int x8max = x-1;
  int x10 = -1;
//  cout<<x8min<<" : "<<x8max<<endl;

  for(int i =x8min;i<=x8max;i++){
    int y10=i*(0.1);
//    cout<<"i "<<i<<"y10  "<<y10<<endl;
    if(y10==b){
      x10 =i;
      break;
    }
  }
  cout<<x10<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++) {
        if(i & 1) {
            if(s[i] == 'L' ||s[i] == 'U'||s[i] == 'D')
                continue;
            else {
                cout<<"No"<<endl;
                return 0;
            }
        }
        else {
            if(s[i] == 'R' ||s[i] == 'U'||s[i] == 'D')
                continue;
            else {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

mod = 10**9 + 7

b = set(a)

if n%2==0:
    check = len([ i for i in a if i%2==1 ])
    if check==n and len(b)==(n//2):
        ans = 2**(n//2) % mod
        print(ans)
        exit()
    else:
        print(0)
        exit()
else:
    check = len([ i for i in a if i%2==0 ])
    if check==n and len(b)==((n+1)//2) and a.count(0)==1:
        ans = 2**((n-1)//2) % mod
        print(ans)
        exit()
    else:
        print(0)
        exit()

Measured memory_bytes: 14008
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  char c;
  cin >> c;
  char ans = (int)c + 1;
  cout << ans << endl;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> v(5);
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    // ll tmp = v[i];
    // if(tmp % 10 != 0){
    //   tmp = (tmp / 10 + 1) * 10;
    // }
    // res += tmp;
  }
  ll res = INT_MAX;
  for (int i = 0; i < 5; i++) {
    ll tmp = 0;
    for (int j = 0; j < 5; j++) {
      if(j == i) continue;
      if(v[j] % 10 != 0)tmp += (v[j] / 10 + 1) * 10;
      else tmp += v[j];
    }
    tmp += v[i];
    // cout << tmp << endl;
    res = min(res, tmp);
  }

  cout << res << endl;

}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
ng = False
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      pass
    else:
      ng = True
if ng:
  print("DENIED")
else:
  print("APPROVED")

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

int main() {
    int n,m;
    cin>>n>>m;
    int v[n];
    rep(i,n) cin>>v[i];

    sort(v, v+n, std::greater<>());

    int flag = 0;
    int sm = 0;
    sm = std::accumulate(v,v+n,0);

    for(int i = 0; i < m; ++i){
        if (v[i] < sm/(4.0*m) ){
            flag = 1;
            break;
        }
    }

    if(flag==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
N = gets.to_i
A = [] 
N.times do
  A << gets.split(' ')
end

total = 0.0

A.each do |a|
  if a[1].to_s == 'JPY'
    total += a[0].to_f
  else
    total += (a[0].to_f * 380000)
  end
end

puts total

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a;
    cin>>a;
    cout<<48-a<<endl;

    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<cmath>

#define vint vector<int>
#define vstr vector<string>
#define vll vector<long long>
#define ll long long
#define pf printf
#define sf scanf
#define pft	printf("\t")
#define pfn printf("\n")
#define pfk printf(" ")

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	for( int i=0; i<n; i++ ) {
		cin >> a[i];
	}
	sort(a, a+n);
	cout << a[n-1]-a[0] << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;

signed main() {
  int N,K;
  cin >> N >> K;
  int ans;
  if (N==K) {
    cout << 0 << endl;
    return 0;
  }
  N %= K;
  ans = min(N, abs(N-K));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from math import sin,cos,radians,sqrt
A,B,H,M = map(int,input().split())
a = H*(360/12) + M*(360/12/60)
b = M*(360/60)

A = [A*cos(radians(a)),A*sin(radians(a))]
B = [B*cos(radians(b)),B*sin(radians(b))]
x,y = A[0]-B[0],A[1]-B[1]

print(sqrt(pow(x,2)+pow(y,2)))

Measured memory_bytes: 9588