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

#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

using namespace std;

int main()
{
    int n;
    int a;
    int color[16] = {};
    int min = 0;
    int max = 0;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        
        if (a >= 3200) {
            max++;
        } else if (color[a / 400] == 0) {
            min++;
            max++;

            color[a / 400] = 1;
        }

    }

    cout << (min == 0 ? 1 : min) << " " << max << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans[] = new int[4];
        for(int i = 0; i < N; i++){
            String S = sc.next();
            if(S.equals("AC")){
                ans[0]++;
            }else if(S.equals("WA")){
                ans[1]++;
            }else if(S.equals("TLE")){
                ans[2]++;
            }else if(S.equals("RE")){
                ans[3]++;
            }
        }
        System.out.println("AC x "+ans[0]);
        System.out.println("WA x "+ans[1]);
        System.out.println("TLE x "+ans[2]);
        System.out.println("RE x "+ans[3]);
    }
}


Measured memory_bytes: 58292
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);

		int N = scanner.nextInt();// 親機の数
		int W = scanner.nextInt();
		int H = scanner.nextInt();

		int[] width = new int[W + 1];
		int[] height = new int[H + 1];
		for (int i = 0; i < N; i++) {
			int x = scanner.nextInt();
			int y = scanner.nextInt();
			int w = scanner.nextInt();

			int lowx = Math.max(0, x - w);
			int highx = Math.min(W, x + w);

			width[lowx]++;
			width[highx]--;

			int lowy = Math.max(0, y - w);
			int highy = Math.min(H, y + w);

			height[lowy]++;
			height[highy]--;

		}
		scanner.close();

		int cover = 0;
		boolean isCovered = true;
		for (int i = 0; i < W; i++) {
			cover += width[i];
			if (cover <= 0) {
				isCovered = false;
			}
		}

		cover = 0;
		for (int i = 0; i < H; i++) {
			cover += height[i];
			if (cover <= 0 && !isCovered) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");

	}
}

Measured memory_bytes: 98544
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
/////////////////////////////////

int const N = 141;
vector<pii> a[4];
vector<pii> b;
int n, w;

void proceed(vector<pii> &v, int cnt, pll &cur){
	fi(0, cnt){
		cur.first -= v[i].first;
		cur.second += v[i].second;
	}
}

void solve(){
	cin >> n >> w;
	int mini = 1e9 + 41;
	fi(0, n){
		int wi, vi;
		cin >> wi >> vi;
		mini = min(wi, mini);
		b.pb(mp(wi, vi));
	}
	sort(b.begin(), b.end());

	for(int i=n-1;i>=0;--i){
		a[b[i].first-mini].pb(b[i]);
	}

	ll ans = 0;

	fi(0, sz(a[0]) + 1){
		fj(0, sz(a[1]) + 1){
			fk(0, sz(a[2]) + 1){
				pll cur = mp(w, 0);
				proceed(a[0], i, cur);
				proceed(a[1], j, cur);
				proceed(a[2], k, cur);
				for(int t=0;t<sz(a[3]);++t){
					if(cur.first >= 0) ans = max(ans, cur.second);
					else break;
					cur.first -= a[3][t].first;
					cur.second += a[3][t].second;
				}
				if(cur.first >= 0) ans = max(ans, cur.second);
			}
		}
	}
	cout << ans << endl;
}

int main(){
	solve();


	return 0;
}

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

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

using ll = long long;
using P = pair<int,int>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main() {
    ll N;
    cin>>N;
    vector<ll> v(N);
    rep(i,N) cin>>v[i];
    ll cnt = 0;
    rep(i,N-2){
        for(int j = i+1; j<N-1; j++){
            for(int k = j+1; k < N; k++){
                if(v[i]+v[j]>v[k]&&v[i]+v[k]>v[j]&&v[j]+v[k]>v[i]&&v[i]!=v[j]&&v[j]!=v[k]&&v[k]!=v[i]) cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}

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


int main()
{
	long long n, x;
	long long max = -1000000;
	long long min = 1000000;
	long long sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		if (max<x)
		{
			max = x;
		}
		if (x < min)
		{
			min = x;
		}
		sum = sum + x;
	}
	
	cout << min << ' ' << max << ' ' << sum << endl;
	return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
  int n, m, ans, p[1000];
  while(1)
  {
    ans = 0;

    cin >> n >> m;
    if(m == n && !m)
      break;

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

    sort(p, p + n);
    reverse(p, p + n);

    for(int i = 0; i < n; i++)
    {
      if((i + 1) % m)
	ans += p[i];
    }

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

Measured memory_bytes: 1180
#include<stdio.h>

int main(){
  int w,a,b;
  scanf("%d %d %d",&w,&a,&b);
  if((b<=a+w&&b>=a)||(b+w<=a+w&&b+w>=a)||(a<=b+w&&a>=b)||(a+w<=b+w&&a+w>=b))
    printf("0\n");
  else if(a>b)
    printf("%d\n",a-(b+w));
  else
    printf("%d\n",b-(a+w));
}
    

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).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;}

int h,w;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>h>>w;
    vector<string> s;
    rep(i, h){
        string t; cin>>t;
        s.push_back(t);
    }
    int dx[] = {1,0,-1,0};
    int dy[] = {0,-1,0,1};
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            char c = s[i][j];
            if(c == '.') continue;
            else{
                bool isng = true;
                rep(k, 4){
                    if(i+dx[k]>=h || i+dx[k]<0 || j+dy[k]>=w || j+dy[k]<0) continue;
                    if(s[i+dx[k]][j+dy[k]] == '#') {
                        isng = false;
                        break;
                    }
                }
                if(isng){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

int main(){
	int N, M, X, Y;
	bool ans = false;
	cin >> N >> M >> X >> Y;
	int x[N], y[M];
	for(int i = 0; i < N; i++)
		cin >> x[i];
	for(int i = 0; i < M; i++)
		cin >> y[i];
	sort(x,x+N);
	sort(y,y+M);
	for(int z = X+1; z <= Y; z++){
		if(x[N-1] < z && y[0] >= z){
			ans = true;
			break;
		}
	}
	cout << (ans ? "No War" : "War") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N, K, v[300009];
int main() {
	cin >> K >> N;
	if (K == 1) {
		for (int i = 0; i < (N + 1) / 2; i++) cout << 1 << ' ';
	}
	else if(K % 2 == 0) {
		cout << K / 2 << ' ';
		for (int i = 1; i < N; i++) cout << K << ' ';
	}
	else {
		for (int i = 0; i < N; i++) v[i] = (K + 1) / 2;
		int len = N;
		for (int i = 0; i < N - ((N + 1) / 2); i++) {
			if (v[len - 1] == 1) len--;
			else {
				v[len - 1]--;
				for (int i = len; i < N; i++) v[i] = K;
				len = N;
			}
		}
		for (int i = 0; i < len; i++) cout << v[i] << ' ';
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
ll A[MAX_N] = {};
ll dist[MAX_N][2] = {};

signed main()
{
    cin >> N;

    REP(i, N) { cin >> A[i]; }

    // 全部行ったときのお金
    ll all = 0;
    ll cur = 0;
    REP(i, N) {
        all += abs(cur - A[i]);
        cur = A[i];
    }
    all += abs(cur);

    REP(i, N) {
        ll cur = (i == 0) ? 0 : A[i-1];
        ll next = A[i];
        ll next2 = (i == N-1) ? 0 : A[i+1];
        ll dist1 = abs(cur - next) + abs(next - next2);
        ll dist2 = abs(cur - next2);
        printf("%lld\n", all - (dist1 - dist2));
    }
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

int main() {
	int H, N;
	cin >> H >> N;
	vector<int>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int sum = 0;
	rep(i, N) {
		sum += A[i];
	}
	if (sum >= H) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 640
//BELIEVE IN YOURSELF
//next_permutation

#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 100005
#define se second
#define fi first
#define be begin()
#define en end()
#define sortv(v) sort(v.begin(),v.end());
#define w() ll _;cin>>_;while(_--)
#define edge pair<ll,ll>
#define pq priority_queue<ll>
#define mod 1000000007
#define Endl "\n"
#define cy cout<<"YES"<<endl;
#define cn cout<<"NO"<<endl;
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;


     
int main()
{
	fast;
		
	ll n;
	
	ll i;
	cin>>n;
	ll a[n+1];
	
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		a[i]%=mod;
	}
	ll pre[n+1]={0};
	pre[0]=a[0];
	ll sum=a[0];
	for(i=1;i<n;i++)
	{
		sum+=a[i];
		sum%=mod;
		pre[i]=(a[i]+pre[i-1])%mod;
	}
	ll ans=0;
	for(i=0;i<n;i++)
	{
		ans=(ans%mod + (a[i]*(mod+sum-pre[i]))%mod )%mod;
	}
	
	
	cout<<ans<<endl;
	
	return 0;
}
     
     
     
     
     
     
     
     
     
     
     
     

Measured memory_bytes: 6604
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;


int main(){
  
  int n; cin>>n;
  ll ans{},ans0{},ans9{},ans09{};
  ll anso{1},ans0o{},ans9o{},ans09o{};
  for(int i=0; i<n; i++){
    ans09 = ans0o+ans9o;
    ans09 += ans09o*10;
    
    ans0 = anso;
    ans0 += ans0o*9;
    
    ans9 = anso;
    ans9 += ans9o*9;
    
    ans = anso*8;
    
    ans09 %= MOD;
    ans0 %= MOD;
    ans9 %= MOD;
    ans %= MOD;
    
    ans09o = ans09;
    ans0o = ans0;
    ans9o = ans9;
    anso = ans;
  }
  cout << ans09 << endl;
  
  
}


Measured memory_bytes: 3616
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List

main = do
  li <- BS.getLine
  let [n,k] = unfoldr (BS.readInt . BS.dropWhile isSpace) li
  li <- BS.getLine
  let as = unfoldr (BS.readInt . BS.dropWhile isSpace) li
  let ans = compute n k as
  print ans

compute :: Int -> Int -> [Int] -> Int
compute n k = sum . drop k . sortBy (flip compare) . map length . group . sort

Measured memory_bytes: 34324
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int ans;
int fastpow(int x,int a){
	int ret=1;
	while(a){
		if(a&1) ret=ret*1LL*x%mod;
		x=x*1LL*x%mod;a>>=1;
	}
	return ret;
}

int ys[50005],yscnt;
int num[50005];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			ys[++yscnt]=i;
			if(i*i!=n) ys[++yscnt]=n/i;
		}
	}
	sort(ys+1,ys+yscnt+1);
	for(int i=1;i<=yscnt;i++){
		num[i]=(num[i]+fastpow(k,(ys[i]+1)/2) )%mod;
		for(int j=i+1;j<=yscnt;j++) if(ys[j]%ys[i]==0) num[j]=(num[j]-num[i])%mod;
	}
	for(int i=1;i<=yscnt;i++){
		//if(n%2==0&&ys[i]%2!=0) continue;
		ans=(ans+num[i]*1LL*(ys[i]%2==0? ys[i]/2:ys[i]))%mod;
	}
	cout<<(ans+mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  string s;
  cin >> s;
  if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans;

int main() {
	//freopen("x.in", "r", stdin);

	ans = inf;
	string s;
	cin >> s;

	for (char c = 'a'; c <= 'z'; c++) {
		string p = s;
		int cnt = 0;
		while (1) {
			bool same = true;
			F0(k, SZ(p)) if (p[k] != p[0]) same = false;
			if (same) break;

			string q;
			F0(i, SZ(p) - 1) {
				if (p[i] == c) q += p[i]; else q += p[i + 1];
			}
			p = q;
			cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
void main()
{
    string s = rdStr;

    bool[] alpha = new bool[26];
    if (s.length == 26)
    {
        alpha[s[$-1]-'a'] = true;
        foreach_reverse (i; 0 .. 25)
        {
            if (s[i] < s[i+1])
            {
                s[0..i].write;
                long idx;
                foreach (j; s[i]-'a'+1 .. 26)
                {
                    if (alpha[j])
                    {
                        idx = j;
                        break;
                    }
                }
                (idx + 'a').to!dchar.writeln;
                return;
            }

            alpha[s[i]-'a'] = true;
        }

        writeln(-1);
    }
    else
    {
        alpha[] = true;
        foreach (x; s)
        {
            alpha[x-'a'] = false;
        }
        writeln(s, (alpha.countUntil(true) + 'a').to!dchar);
    }
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
	int A,B;
	scanf("%d %d",&A,&B);
	if(B%A==0) printf("%d\n",A+B);
	else printf("%d\n",abs(A-B));
	
	return 0;
}

Measured memory_bytes: 1696
#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy 2333333
#define bql 2147483647
using namespace std;
int n,b[105],a[105],sum;
int main()
{
	fast;
	cin>>n;
	for (int i=1;i<=n-1;i++)
	   cin>>b[i];
	a[1]=b[1],a[2]=b[1];
	for (int i=2;i<=n-1;i++)
	   a[i+1]=b[i],a[i]=min(b[i],b[i-1]);
	for (int i=1;i<=n;i++)
	   sum+=a[i];
	cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

  int n, a, b; cin >> n >> a >> b;
  cout << min(n*a, b) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
char s[100005];
int dp[100005][13]; //dp[i][j]表示到第i个字符为止，除以13余j(j表示的是到i-1为止模13余j)有多少种情况
// 难在找出状态转移方程
int main()
{
   // cout<<mod<<'\n';
    
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        if (s[i] != '?')
        {
            s[i] -= '0';
            for (int j = 0; j < 13; j++)
            {
                dp[i][(j * 10 + s[i]) % 13] = (dp[i][(j * 10 + s[i]) % 13] + dp[i - 1][j]) % mod;
            }
        }
        else
        {
            for (int k = 0; k < 10; k++)
            {
                for (int j = 0; j < 13; j++)
                {
                    dp[i][(j * 10 + k) % 13] = (dp[i][(j * 10 + k) % 13] + dp[i - 1][j]) % mod;
                }
            }
        }
    }
    printf("%d\n", dp[n][5]);
}

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

int main(void)
{
  std::vector<int> candy(3);
  for (int i = 0; i < 3; i++) {
    std::cin >> candy.at(i);
  }

  std::sort(candy.begin(), candy.end());

  if (candy.at(2) == (candy.at(0) + candy.at(1))) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int board[1500][1500];
int dp[1500][1500];

struct Rectangle {
    int height, pos;
    Rectangle(int a, int b) : height(a), pos(b) {}
};

signed main() {
    int H, W; cin >> H >> W;
    memset(dp, 0, sizeof(dp));
    rep(i,0,H) rep(j,0,W) cin >> board[i][j];

    rep(i,0,H) rep(j,0,W) {
        if(board[i][j] == 1) dp[i][j] = 0;
        else {
            if(i == 0) dp[i][j] = 1;
            else dp[i][j] = dp[i-1][j] + 1;
        }
    }

    int ans = 0;
    rep(i,0,H) {
        stack<Rectangle> S;
        repq(j,0,W) {
            // printf("%lld ", dp[i][j]);
            Rectangle Rect = Rectangle(dp[i][j], j);
            if(S.empty()) S.push(Rect);
            else {
                if(S.top().height < dp[i][j]) S.push(Rect);
                else if(S.top().height > dp[i][j]) {
                    int target = j;
                    while(!S.empty() && S.top().height >= dp[i][j]) {
                        Rectangle TopRect = S.top(); S.pop();
                        int temp = (j-TopRect.pos) * TopRect.height;
                        // printf("j = %lld, pos = %lld, height = %lld, temp = %lld\n", j, TopRect.pos, TopRect.height, temp);
                        ans = max(ans, temp);
                        target = TopRect.pos;
                    }
                    Rect.pos = target;
                    S.push(Rect);
                }
            }
        }
        // cout << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 37060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  bool ok = false;
  while(n>0)
  {
    ll r = n%10;
    if(r==7)
      ok = true;
     n/=10;
    
  }
  if(ok)
    cout<<"Yes";
  else
    cout<<"No";
  
  return 0;
}

Measured memory_bytes: 3584
open Printf
open Scanf

let is_palindrome s =
  let l = String.length s in
  let rec loop i =
    if i = l / 2 then true
    else if s.[i] = s.[l-1-i] then loop (i + 1)
    else false
  in loop 0

let solve s =
  if is_palindrome s && is_palindrome (String.sub s 0 (String.length s / 2)) then "Yes" else "No"

let () =
  scanf "%s " solve |> printf "%s\n"


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

using namespace std;

int main(){

	string cad;

	cin >> cad;

	if(cad[2] == cad[3] and cad[4] == cad[5]){
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
	return 0;
}

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

int main() {
  int N,A;
  cin>>N;
    A=N;
    for (int i = 0; i < N; i++){
      int a,b;
      cin>>a>>b;
        A+=b-a;
    }
  cout<<A<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

int main() {
  int A, B;
  cin >> A >> B;
  int res = (B - 1 + (A - 1 - 1)) / (A - 1);
  cout << res << endl;
}
// 1 4 7 10
// 1 8 15

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {	
		Scanner sc = new Scanner(System.in);
		int[] pos = new int[5];
		for(int i=0;i<pos.length;i++) {
			pos[i] = Integer.parseInt(sc.next());
		}
		
		int k = Integer.parseInt(sc.next());
		
		boolean judge = true;
		int search=4;
		for(;0<search;search--) {
			for(int i=search-1;0<=i;i--) {
				if(k<(pos[search]-pos[i])) {
					judge = false;
				}

			}
		}
		
		if(judge) {
			System.out.println("Yay!");
		}else {
			System.out.println(":(");
		}
		

	}
}


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

int N, A, B, C;
vector<int> L;
int score = 1000000000;

void dfs(int i, int a, int b, int c, int point) {
    if (i == L.size()) {
        if (a == 0 || b == 0 || c == 0) return;
        point += abs(a - A) + abs(b - B) + abs(c - C);
        score = min(score, point);
        return;
    }
    dfs(i + 1, a, b, c, point);
    dfs(i + 1, a + L[i], b, c, point + 10 * (a != 0));
    dfs(i + 1, a, b + L[i], c, point + 10 * (b != 0));
    dfs(i + 1, a, b, c + L[i], point + 10 * (c != 0));
}

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

    cin >> N >> A >> B >> C;
    L.resize(N);
    for (int i = 0; i < N; i++) cin >> L[i];
    dfs(0, 0, 0, 0, 0);
    cout << score << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#include<unordered_map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;


int main() {


	int k;
	string s;
	cin >> k >> s;
	int a = s.size();
	if (k >= a) {
		cout << s << endl;
	}
	else {
		int x = a - k;
		rep(i, x)s.pop_back();
		cout << s << "..." << endl;
	}

	return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <vector>

int main(){
  int n;
  std::cin >> n;
  std::vector<int> a, b ,c;
  int temp;
  for(int i=0; i<n; ++i){
    std::cin >> temp;
    a.push_back(temp);
  }
  for(int i=0; i<n; ++i){
    std::cin >> temp;
    b.push_back(temp);
  }
  for(int i=0; i<n-1; ++i){
    std::cin >> temp;
    c.push_back(temp);
  }
  long satis = 0;
  for(auto i : b)
    satis += i;
  for(int i=0; i<n-1; ++i)
    if(a[i]+1 == a[i+1])
      satis += c[a[i]-1];
  std::cout << satis << std::endl;
  return 0;
}


Measured memory_bytes: 256
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    ls = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    N = int(input()) - 1

    print(ls[N])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
### SNIPPET
  # array = [*1..q].map { |_| gets.split.map(&:to_i) }
  # n = gets.split.map(&:to_i)
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さh = a * Math.sin(w / 180.0 * Math::PI)
  # 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

n = gets.to_i
# a,b,c = gets.split.map(&:to_i)

s = [*1..n].map { |_| gets.chomp }
g = s.group_by(&:itself).map{|k,v| [k,v.count]}.to_h


max_count = 0
max_res = []
g.each do |k,v|
  if v > max_count
    max_res = [k]
    max_count = v
  elsif v == max_count
    max_res.push(k)
  end
end

max_res.sort.each do |ele|
  puts ele
end


Measured memory_bytes: 82788
//----> bismillahir rahmanir rahim <---- -- { ^ _ ^ }
///     { ^_^ }   { ^ _ ^ }



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


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi; ///VECTOR<VECTOR<INT>NAME>NAME 2
typedef vector<vl> vvl;///LONG LONG
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;///VECTOR WITH PAIR
typedef vector<pll> vll;
typedef double dl;

#define endl "\n"
#define PB push_back
#define F first
#define S second
#define as(a) (a).begin(),(a).end()
#define ras(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define over return 0;

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

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


///--------> YOUR JOURNEY STARTS HERE <-------



int main(){


    string h;
    cin>>h;
    int z=h.size();
    vector<int>vec;
    int c=0;
    for(int i=0;i<z;i++){
            if(h[i]=='R'){
                c++;
            }
            if(h[i]=='S' || i==h.size()-1){
                    vec.push_back(c);
                    c=0;

            }
    }
    sort(vec.begin(),vec.end(),greater<int>());
    cout<<vec[0]<<endl;

over
}


Measured memory_bytes: 3636
def main():
    q, h, s, d = map(int, input().split())
    n = int(input())
    
    x, y = n // 2, n % 2
    p_x = min(8*q, 4*h, 2*s, d) * x
    p_y = min(4*q, 2*h, s) * y
    
    print(p_x+p_y)
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

int lcm(int x, int y){
  return x/__gcd(x, y)*y;
}

signed main() {
  int N, M;
  cin >> N >> M;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  int l = 1;
  REP(i, N) l = lcm(l, A[i]/2);

  int cnt = 0;
  while(A[0]%2 == 0){
    cnt++; A[0] /= 2;
  }
  FOR(i, 1, N){
    int c = 0;
    while(A[i]%2 == 0){
      c++; A[i] /= 2;
    }
    if(c != cnt){
      cout << 0 << "\n";
      return 0;
    }
  }

  cout << M/l-M/(l*2) << "\n";

  return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
#define MAXN 10005
#define MAXM 1000005
int n,m;
struct Edge
{
	int id;
	double val;
	Edge *nxt;
	Edge(){nxt=NULL;}
	Edge(int i,double v){id=i;val=v;nxt=NULL;}
}E[MAXM],*V[MAXN],*cur;
void add_edge(int x,int y,double val)
{
	*cur=Edge(y,val);
	cur->nxt=V[x];
	V[x]=cur++;
	*cur=Edge(x,val);
	cur->nxt=V[y];
	V[y]=cur++;
}
struct cmp
{
	bool operator () (Edge *a,Edge *b)
	{return a->val<b->val;}
};
bool used[MAXN];
double Prim(int s)
{
	double ans=0;
	priority_queue<Edge*,vector<Edge*>,cmp>Q;
	used[s]=1;
	for(Edge *p=V[s];p;p=p->nxt)
		if(!used[p->id])
			Q.push(p);
	while(!Q.empty())
	{
		Edge *t=Q.top();
		Q.pop();
		if(used[t->id])
			continue;
		ans+=t->val;
		used[t->id]=1;
		for(Edge *p=V[t->id];p;p=p->nxt)
			if(!used[p->id])
				Q.push(p);
	}
	return ans;
}
pair<int,int>pile[MAXN];
double dis(int a,int b)
{
	return sqrt((pile[a].first-pile[b].first)*(pile[a].first-pile[b].first)+
	(pile[a].second-pile[b].second)*(pile[a].second-pile[b].second));
}
int main()
{
	int N,M;
	scanf("%d%d",&N,&M);
	for(int i=1;i<=N;i++)
		scanf("%d%d",&pile[i].first,&pile[i].second);
	cur=E;
	double sum=0;
	for(int j=1,p,q;j<=M;j++)
	{
		scanf("%d%d",&p,&q);
		double tmp=dis(p,q);
		add_edge(p,q,tmp);
		sum+=tmp;
	}
	for(int i=1;i<=N;i++)
		if(!used[i])
			sum-=Prim(i);
	printf("%.3lf\n",sum);
	return 0;
}

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

long long  n;

int main(){
  cin >> n;
  long long sum = 0;
  for(long long  i = 1; i <= sqrt(n) + 100; i++){
    if(n % i == 0){
      long long num = n / i - 1;
      if(num <= i) break;
      sum += n / i - 1;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>
#define rep(i,n) for(int i=0; i < (n); i++)
const int INF = 1001001001;
int main(){
  int n,m,x;
  scanf("%d%d%d",&n,&m,&x);
  int c[13];
  int a[13][13];
  rep(i,n){
    scanf("%d",&c[i]);
    //printf("%d",c[i]);
    rep(j,m){
      scanf("%d",&a[i][j]);
      //printf("%d",a[i][j]);
    }
  }
  int ans =INF;
  rep(s,1<<n){//便宜的にsを使用し、2^nの探索をするforを作成している
    int cost=0;//金額
    int d[13]={0};//選択した参考書のm個の理解度を格納する箱
    rep(i,n){
      if(s>>i&1){//iビット目が１だった場合
        cost+=c[i];//c[i]のコストを足している
        rep(j,m){
          d[j]+=a[i][j];//m個の理解度を足している
        }
      }
    }
    //printf("%d\n",cost);

    bool ok =true;
    rep(j,m){
      //printf("%d",d[j]);
      if(d[j]<x){
        ok = false;
        break;
      }
    }
    if(ok==true){
      if(ans>cost){
        ans = cost;
      }
    }
  }
  if(ans==INF){
    printf("%d",-1);
  }
  else{
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1732
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  int s[N];//各点にとって最適な位置
  for(int i=0;i<N;i++){
    cin >> a[i];
    s[i] = a[i] - i - 1;
  }

  sort(s,s+N);
  int b = s[N/2];

  ll ans = 0;
  for(int i=0;i<N;i++){
    ans += abs(a[i]-b-i-1);
  }

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

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        //宣言
        Scanner sc = new Scanner(System.in);
        long cnt;

        //入力情報取得
        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();


        cnt=Math.min(a,k);
        a = a-cnt;
        k = k-cnt;
        
        cnt=Math.min(b,k);
        
        b= b-cnt;
        
        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
    }
}


Measured memory_bytes: 23764
import java.util.*;

public class Main {
    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        int N = in.nextInt();
        int K = in.nextInt();
        int res = 0;
        for (int i = 0; i < N; i++) {
            int hi = in.nextInt();
            if (hi >= K) {
                res++;
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 47060
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
const int64 MOD = 1000000007;

template<class T>
T mod_pow(T x, T n, const T mod) {
    T res = 1;
    while(n > 0) {
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n = n >> 1;
    }
    return res;
}

int main() {
    int N; cin >> N;
    vector<int64> C(N);
    for(int i = 0; i < N; ++i) cin >> C[i];
    sort(C.begin(), C.end(), greater<int64>());
    int64 ans = 0, A = mod_pow(4LL, (int64)N - 1, MOD);
    for(int i = 1; i <= N; ++i) {
        ans += A * C[i - 1] % MOD * (i + 1);
        ans %= MOD;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, M;
  cin>>N>>M;
  ll ans = min(N, M/2);
  N -= ans;
  M -= 2*ans;
  if(M>1) {
    ans += M/4;
  }
  cout<<ans<<endl;
}



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

double r;

void solve(){
    cin>>r;
    double L=r*sin(15*acos(-1)/180)*2;
    double d=r*cos(15*acos(-1)/180);
    cout<<6*L*d<<endl;
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
string = gets.chomp
newstring=String.new
for i in (0..2)
  numberi = string[i].to_i
  newnumberi=numberi
  if numberi == 1
     newnumberi =9
  end

  if numberi == 9
    newnumberi =1
  end

  newstring.concat(newnumberi.to_s)
end

puts newstring.to_i


Measured memory_bytes: 1788
using System;

class Factorial {
    static void Main() {
        long input;

        input = long.Parse(Console.ReadLine());

        Console.WriteLine(Fact(input));
    }

    static long Fact(long num) {
        if (num == 0)
        {
            return 1;
        }
        else {
            return num * Fact(num - 1);
        }
    }

}

Measured memory_bytes: 19932
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
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 (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

//#define double long double
const double PI = 3.141592653589793238462643383279;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);
	long long N; cin >> N;
	int L; cin >> L;
	vector<int> T(N); rep(i, 0, N) {
		cin >> T[i];
	}
	const double m = 2 * PI / L;

	double ansx = 0, ansy = 0;
	rep(i, 0, N)rep(j, i + 1, N) {
		double x = m * (T[i] + T[j]) / 2.;
		ansx += std::cos(x) * (N - (j - i - 1) - 2);
		ansy += std::sin(x) * (N - (j - i - 1) - 2);
		x += PI;
		ansx += std::cos(x) * (j - i - 1);
		ansy += std::sin(x) * (j - i - 1);
	}
	ansx /= N * (N - 1) * (N - 2) / 3 / 2;
	ansy /= N * (N - 1) * (N - 2) / 3 / 2;
	cout << ansx << " " << ansy << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
using namespace std;
using namespace std::chrono;
int main(){
    int n;
    cin >> n;
    int w[110];
    for(int i = 0; i < n; i++) cin >> w[i];
    int min = 10000000;
    for(int i = 0; i < n-1; i++){
        int totala = 0;
        int totalb = 0;
        for(int j = 0; j <= i; j++) totala += w[j];
        for(int j = i+1; j < n; j++) totalb += w[j];
        //cout << abs(totala - totalb) << endl;
        if(abs(totala - totalb) < min) min = abs(totala - totalb);
    }
    cout << min << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int N,M;
vector<vector<ll>> dist(15, vector<ll>(15, INF));
// dist[i][j] := 辺 i -> j の距離
vector<vector<ll>> dp(1<<15, vector<ll>(15, INF));
// dp[S][v] := 今までに訪れた頂点集合 S と今いる v に対して、それ以降の最短距離。dp[0][0]
////  := それまでの最短距離。dp[(1<<M)-1][0]

void input(){
  cin >>N >>M;
  rep(i, M){
    int s,t,d; cin >>s >>t >>d;
    dist[s][t] = d;
  }
}

int main() {
  input();
  // dp[0][0]を求めたい
  dp[(1<<N)-1][0] = 0;
  
  for (int S=(1<<N)-1; S>=0; S--){
    for (int nv=0; nv<N; nv++){
      if (S & (1<<nv)) continue;
      for (int v=0; v<N; v++){
        // if (S & (1<<v)){
          chmin(dp[S][v], dp[S | (1<<nv)][nv] + dist[v][nv]);
        // }
      }
    }
  }

  ll res = dp[0][0];
  cout <<(res == INF ? -1 : res) <<endl;
}


Measured memory_bytes: 7468
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,i,sum=0;
	long long int a[100005],b[100005];
	scanf("%lld",&n);
	for(i=0;i<n+1;i++) scanf("%lld",&a[i]);
	for(i=0;i<n;i++) scanf("%lld",&b[i]);
//	for(i=0;i<n+1;i++) printf("%lld    ",a[i]);
//	for(i=0;i<n;i++) printf("%lld\n",b[i]);
	for(i=0;i<n;i++){
		if(a[i]>=b[i]) sum=sum+b[i];
		else {sum=sum+a[i];
		if(b[i]-a[i]>=a[i+1]) {
			sum=sum+a[i+1];
			a[i+1]=0;
		}
		else {
			sum=sum+b[i]-a[i];
			a[i+1]=a[i+1]-b[i]+a[i];
		}
		}
	}
	printf("%lld",sum);
	return 0;
}


Measured memory_bytes: 1792
use proconio::derive_readable;
use proconio::input;

#[derive_readable]
#[derive(Debug, Clone, Copy)]
struct Query {
    a: usize,
    b: usize,
    c: usize,
    d: i32,
}

fn dfs(i:usize, n:usize, m:usize, mut seq: &mut [usize;11], qu: &Vec<Query>) -> i32 {
    if i > n {
        qu.iter().fold(0,|s,q|{
            if seq[q.b] - seq[q.a] == q.c {
                s + q.d
            } else {
                s
            }
        })
    } else {
        (seq[i - 1] ..= m).map(|j|{
            seq[i] = j;
            dfs(i + 1, n, m, &mut seq, qu)
        }).max().unwrap()
    }
}

fn main() {
    input! {
        n: usize,
        m: usize,
        q: usize,
        qu: [Query; q]
    };
    let ans = dfs(1,n,m, &mut [1;11], &qu);
    println!("{:?}", ans);
}


Measured memory_bytes: 2196
#include <stdio.h>
int dp[50];
int f(int n){
	if(n==0||n==1) return dp[n] = 1;
	if(dp[n]) return dp[n];
	return dp[n] = f(n-1) + f(n-2);
}
int main(){
	int n;
	scanf("%d",&n);
	printf("%d\n",f(n));
	return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <vector>

using namespace std;

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

	vector<vector<char>> S;
	S = vector<vector<char>>(N, vector<char>(N, 0));
	S = vector<vector<char>>(N, vector<char>(N, 0));

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> S[i][j];
		}
	}

	int count = 0;

	int A = 0;
		for (int B = 0; B < N; B++) {

			int flag = 0;

			for (int i = 0; i < N && flag == 0; i++) {
				for (int j = i; j < N; j++) {
					if (S[i-A >= 0 ? i - A : i - A + N][j-B >= 0 ? j - B : j - B + N] != S[j-A >= 0 ? j - A : j - A + N][i-B >= 0 ? i - B : i - B + N]) {
						flag = -1;
						break;
					}
				}
			}

			if (flag == 0) {
				count++;
			}
		}
	

	cout << N*count << endl;

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
	int n, d[50], ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	for (int j = 0; j < n-1; j++) {
		for (int k = j + 1; k < n; k++) {
			ans += d[j] * d[k];
		}
	}
	cout << ans << endl;
}



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

int main()
{
    unordered_map<string, int> x;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        x[s]++;
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        string t;
        cin >> t;
        x[t]--;
    }
    int max = 0;
    for (auto&& i : x) {
        if (max < i.second) {
            max = i.second;
        }
    }
    cout << max << endl;
}


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




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

    long long int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;

    cin>>n>>a;
    cout<<n-a+1<<"\n";


    return 0;


}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
def fib(num):
    d = defaultdict(int)
    d[0] = 1
    d[1] = 1
    if num <= 1:
        return d[num]
    else:
        for i in range(1,num):
            d[i+1] = d[i]+d[i-1]
        return d[num]
    
    
    
def main():
    num = I()
    print(fib(num))
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf=1e9+7;

int main(){
    int n;cin>>n;
    vin a(n);
    vin b(n);
    rep(i,n){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(all(b),greater<int>());
    if(b[0]==b[1]){
        rep(i,n)cout<<b[0]<<endl;
        return 0;
    }
    else{
        rep(i,n){
            if(a[i]<b[0])cout<<b[0]<<endl;
            else cout<<b[1]<<endl;
        }
    }

}

Measured memory_bytes: 3200