akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N;
	cin >> N;
	vector<ll> A(N);
	vector<ll> B(N);
	vector<ll> abSum(N);
	REP(i, N) {
		cin >> A[i] >> B[i];
		abSum[i] = A[i] + B[i];
 	}
	sort(ALL(abSum));
	reverse(ALL(abSum));

	ll ans = 0;
	REP(i, N) {
		if (IsEven(i)) {
			ans += abSum[i];
		}
	}

	ans -= accumulate(B.begin(), B.end(), (ll)0);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
### D

import heapq

def solve():
    N, M = map(int, input().split())
    A = []
    A = list(map(lambda x: -int(x), input().split()))
    heapq.heapify(A)
    # print(A)
    
    for _ in range(M):
        m = heapq.heappop(A)
        heapq.heappush(A, int(m/2))
        
    print(-1*sum(A))
    
solve()

Measured memory_bytes: 14252
#include<iostream>
#include<string>
using namespace std;
int main(){
	int w;
	char b[100];
	int top=0;
	cin>>w;
	while(true){
		if(w%3==0)
			b[top]='0';
		if(w%3==1){
			b[top]='+';
			w--;
		}
		if(w%3==2){
			b[top]='-';
			w++;
		}
		top++;
		w/=3;
		if(w==0)
			break;
	}
	for(int i=top-1;i>=0;i--)
		cout<<b[i];
	cout<<endl;
	return 0;
}

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

int main() {
	int A[100] = { 0 };
	int N;
	cin >> N;
	int v;
	for (int i = 0;i < N;i++) 	cin >> A[i];
	
	for (int i = 0;i < N;i++){
		v = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
			A[j + 1] = v;
		}
		for (int k = 0;k < N;k++) {
			cout << A[k];
			if (k != N - 1) cout << ' ';
			else cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3076
import sys, re, os, math
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b, x = MAP()
s = x / a
y = s * 2 / b
if y <= a:

  sha = sqrt(b**2 + y**2)
  rad = math.acos(y/sha)
  do = math.degrees(rad)
  print(do)

  # 場合分け，三角形ver, 台形ver
else:
  s = x/a
  y = (s * 2 / a) - b
  # print(y)
  sha = sqrt(a ** 2 + (b-y) ** 2)
  rad = math.acos((b-y)/sha)
  do = math.degrees(rad)
  print(90-do)
  # print(do)





Measured memory_bytes: 5268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define p2d(v,n,m) rep(i,n){rep(j,m){pk(v[i][j]);}p("");}
#define fi first
#define se second
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll d,n,m,x,y,z,h,w,k,mi=inf,ma=-inf,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;
P pa;


// mod_tools
ll fact[500000];

ll mpow(ll x, ll y){
    //d(x)
    if(y==0) return 1;
    if(y%2==0){
        return mpow(x*x%mod,y/2)%mod;
    }
    else{
        return x*mpow(x,y-1)%mod;
    }
}

ll minv(ll x){
    // only available for mod=10^9+7
    return mpow(x,mod-2);
}

// Please run this func for preparation
void mfact(){
    //prepare fact-array
    fact[0]=1;
    rep(i,1,500000){
        fact[i]=fact[i-1]*i%mod;
    }
}

//combiの呼び出しが大きいときはこれを使う
ll combi(ll n, ll k){
    return (fact[n]*minv(fact[k])%mod)*minv(fact[n-k])%mod;
}

//combiを一回呼び出すだけなら直接計算

int main(void){
    cin>>x>>s>>t;
    p(abs(x-s)<abs(x-t)?"A":"B");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
 using namespace std;
 
int main() {
  int a,b;
  
  cin >> a >> b;

  if (a<b){
    cout << "a < b" << endl;
  } else if (a>b){
    cout << "a > b" << endl;
  } else {
    cout << "a == b" << endl;
  }

  return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	int a, b; cin >> a >> b;
	if (a == 1) a = 14;
	if (b == 1) b = 14;
	if (a == b) cout << "Draw" << endl;
	else if (a>b) cout << "Alice" << endl;
	else cout << "Bob" << endl;
}


Measured memory_bytes: 256
/*************************************************************************
	> File Name: P1.cpp
	> Author: 
	> Mail: 
	> Created Time: 2018年08月05日 星期日 13时11分46秒
 ************************************************************************/

#include<iostream>
#include<string>
using namespace std;
int main() {
    string a;
    int ans = 0;
    cin >> a;
    for (int i = 0; i < 4; i++) {
        if (a[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define rg register
#define maxn 1250000
#define inf 0x7f7f7f7f
inline ll read()
{
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            f=-1;
        }
        c=getchar();
    }
    while(c<='9'&&c>='0')
    {
        x=(x<<1)+(x<<3)+(c^48);
        c=getchar();
    }
    return x*f;
}
ll n,a[maxn];
ll ans;
int main()
{
	n=read();
	for(rg int i=1;i<=n;++i)
	{
		a[i]=read();
	}
	ans=a[1];
	for(rg int i=2;i<=n;++i)
	{
		ans^=a[i];
	}
	if(ans) cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 1024
health1, strength1, health2, strength2 = map(int, input().split())
while health1 > 0 and health2 > 0:
    health2 -= strength1
    if health2 <= 0:
        print("Yes")
        break
    health1 -= strength2
    if health1 <= 0:
        print("No")
        break

Measured memory_bytes: 9168
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    int L,R,d;
    cin>>L>>R>>d;

    int ans=0;
    for(int i=L;i<=R;i++){
        if(i%d==0){
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

int main() {
    int n; cin >> n;
    int ans = n / 1000;
    if (n % 1000) ans++;
    cout << ans*1000 - n << endl;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, r;
    cin >> n >> r;
    int i;
    if (n >= 10) i = r;
    else i = r + 100 * (10 - n);
    cout << i << "\n";    
    return 0;
}

Measured memory_bytes: 256
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

W,H,x,y = Is()
a = 1 if x == W/2 and y == H/2 else 0
print(W*H/2,a)

Measured memory_bytes: 4584
//csjosh

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //required
// #include <ext/pb_ds/tree_policy.hpp> //required
// using namespace __gnu_pbds; //required 
using namespace std;

#define ll long long 
#define loop(x) for(int i=0;i<x;i++)

#define llu unsigned long long 
#define pb push_back
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define dd fflush(stdout)
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mt make_tuple //use tie
#define eb emplace_back
typedef tuple<int,int,int> State;//use in dijkstra
ll mod=1e9+7;
// ll power(ll x,ll y,ll mod){
//  ll ans=1;
//  while(y>0){
//   if(y&1){
//     ans=ans*x;
//   }
//   x=x*x;
//   y=y/2;
//  }
//  return ans;
// }

// typedef tree<
// pair<int, int>,
// null_type,
// less<pair<int, int>>,
// rb_tree_tag,
// tree_order_statistics_node_update> ordered_set;
 
 
int main(){
    IOS;  
    //what a level of clarity they have, you can suppose
    //while they are coding
    int n;
    cin>>n;
    int a[n+1][n+1];
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        cin>>a[i][j];
      }
    }
    ll fixed[(1<<n)+4]={0};
  ll dp[(1<<n)+4]={0};
    memset(dp,0,sizeof dp);
    // here i have to take the mask as hole set no further subsets
    for(int i=0;i<(1<<n);i++){
      vector<int>vv;
      for(int j=0;j<n;j++){
        if(i&(1<<j))vv.pb(j);
      }
      // for every pair of bits we have
      for(int j=0;j<vv.size();j++){
        for(int k=j+1;k<vv.size();k++){
          fixed[i]+=a[vv[j]][vv[k]];
        }
      }
    }
    // its time to consider all of the subsets of a mask
    //here complaxity is 3^n
    for(int mask=0;mask<(1<<n);mask++){
      dp[mask]=fixed[mask];
      for(int x=mask;x>0;x=mask&(x-1)){
        dp[mask]=max(dp[x]+dp[mask^x],dp[mask]);
      }
    }
    cout<<dp[(1<<n)-1]<<endl;
}
 

// https://codeforces.com/contest/1132/problem/C
// https://codeforces.com/contest/1132/problem/F


Measured memory_bytes: 1280
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

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

    for (int i = N; i < 1000; i++) {
        if (i % 111 == 0) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


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

public class Main {
	public static void main(String[] args) {
		FastScanner br = new FastScanner();
		ArrayList<Integer> caca = new ArrayList<Integer>();
		int min = Integer.MAX_VALUE;
		for(int i = br.ni();i>0;i--) {
			int n = br.ni();
			if(Math.abs(n)<min)min=Math.abs(n);
			caca.add(n);
		}
		long total = 0;
		for(int i = 0;i<caca.size()-1;i++) {
			if(caca.get(i)<0) {
				caca.set(i, caca.get(i)*-1);
				caca.set(i+1, caca.get(i+1)*-1);
			}
			total+=caca.get(i);
		}
		if(caca.get(caca.size()-1)>=0) {
			total+=caca.get(caca.size()-1);
			System.out.println(total);
			System.exit(0);
		}
		if(min==Math.abs(caca.get(caca.size()-1))) {
			System.out.println(total+caca.get(caca.size()-1));
		} else {
			System.out.println((total-caca.get(caca.size()-1))-min*2);
		}
	}
}

class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner(String s) {
		try {
			br = new BufferedReader(new FileReader(s));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	public FastScanner() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	ArrayList<Integer>[] ng(int n, int e) {
		ArrayList<Integer>[] adj = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < e; i++) {
			int a = ni() - 1;
			int b = ni() - 1;
			adj[a].add(b);
			adj[b].add(a);
		}
		return adj;
	}

	Integer[] nIa(int n) {
		Integer[] arr = new Integer[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	int[] nia(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	Long[] nLa(int n) {
		Long[] arr = new Long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	long[] nla(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	String[] nsa(int n) {
		String[] arr = new String[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nt();
		}
		return arr;
	}

	String nt() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int ni() {
		return Integer.parseInt(nt());
	}

	long nl() {
		return Long.parseLong(nt());
	}

	double nd() {
		return Double.parseDouble(nt());
	}

}

Measured memory_bytes: 43092
#include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int main()
{
    int h, w;
    cin>>h>>w;
    char a[h+1][w+1];
    int dp[h+1][w+1];
    for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) cin>>a[i][j];
    dp[1][1]=1;
    for(int i=2;i<=h;i++) 
    {
        dp[i][1]=0;
        if(a[i-1][1]=='.') dp[i][1]+=dp[i-1][1];
    }
    for(int j=2;j<=w;j++)
    {
        dp[1][j]=0;
        if(a[1][j-1]=='.') dp[1][j]+=dp[1][j-1];
    }
    for(int i=2;i<=h;i++) for(int j=2;j<=w;j++)
    {
        dp[i][j]=0;
        if(a[i][j-1]=='.') { dp[i][j]+=dp[i][j-1]; dp[i][j]%=mod; }
        if(a[i-1][j]=='.') { dp[i][j]+=dp[i-1][j]; dp[i][j]%=mod; }
    }
    cout<<dp[h][w];
}

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

bool dfs(ll u, vector<ll> &graph, vector<vector<ll>> &side) {
  ll Gu = graph.at(u);
  for(ll i = 0; i < side.at(u).size(); i++) {
    ll v = side.at(u).at(i);
    if(graph.at(v) != -1) {
      if(graph.at(v) == Gu) return false;
      continue;
    }
    graph.at(v) = abs(graph.at(u) - 1);
    if(!dfs(v, graph, side)) return false;
  }
  return true;
}

int main() {
  ll N, M; cin >> N >> M;
  vector<vector<ll>> side(N, vector<ll> (0));
  vector<ll> graph(N, -1);
  for(ll i = 0; i < M; i++) {
    ll A, B; cin >> A >> B; A--; B--;
    side.at(A).push_back(B);
    side.at(B).push_back(A);
  }
  graph.at(0) = 0;
  bool judge = dfs(0, graph, side);
  ll w = 0, b = 0;
  for(ll i = 0; i < N; i++) {
    if(graph.at(i) == 0) w++;
    if(graph.at(i) == 1) b++;
  }
  if(judge) cout << 1LL *b * w - M << endl;
  else cout << 1LL * N * (N - 1) / 2 - M << endl;
}

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

int main() {
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll cnt=0;
	char pre=s[0];
	for(ll i=1;i<n;i++){
		if(s[i]!=pre){
			pre=s[i];
			cnt++;
		}
	}
	cnt++;
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <stack>

using namespace std;

int
main(int argc, const char *argv[])
{
    stack<int> si;
    int n;
    cin >> n;
    while (n--) {
        int a;
        cin >> a;
        si.push(a);
    }
    bool first = true;
    while (!si.empty()) {
        int x = si.top();
        si.pop();
        if (first) { first = false; cout << x; }
        else cout << " " << x;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.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; }

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n; cin >> n;
    vector<ll> count(4,0);
    rep(i,n){
        string s; cin >> s;
        if(s == "AC") count[0]++;
        else if(s == "TLE") count[2]++;
        else if(s == "WA") count[1]++;
        else count[3]++;
    }
    cout << "AC x " << count[0] << endl;
    cout << "WA x " << count[1] << endl;
    cout << "TLE x " << count[2] << endl;
    cout << "RE x " << count[3] << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;

    if(c < d) {
        for(int i = a; i <= d-2; i++) {
            if(s[i] == '#' && s[i+1] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }

    for(int i = b-2; i <= d-2; i++) {
        if(s[i] == '.' && s[i+1] == '.' && s[i+2] == '.') {
            cout << "Yes" << endl;
            return 0; 
        }
    }

    cout << "No" << endl;
    return 0;
}

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

int main(void) {
    int a, b;
    char op;
    while (1) {
        cin >> a >> op >> b;
        if (op == '?') break;
        if (op == '+') cout << a + b << endl;
        if (op == '-') cout << a - b << endl;
        if (op == '*') cout << a * b << endl;
        if (op == '/') cout << a / b << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int n,arr[100005][3],ans,DP[100005][3],k;

int dp(int id, int tipe){
	if(id == n) return 0;
	if(DP[id][tipe]!=-1) return DP[id][tipe];
	int ret =0;
	for(int i = 0;i<3;i++){
		if(i!=tipe){
			ret = max(dp(id+1,i),ret);
		}
	}
	return DP[id][tipe] = ret+arr[id][tipe];
}

int main(){
	memset(DP, -1, sizeof DP);
	scanf("%d",&n);
	for (int i =0; i<n;i++){
		scanf("%d%d%d",&arr[i][0],&arr[i][1],&arr[i][2]);

	}
	int ans=0;
	for (int i = 0;i<3;i++)ans = max(ans,dp(0,i));
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <stack>
#include <iomanip>
#include <ctime>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    char c[8][8];
    int w, h, k;
    cin >> h >> w >> k;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            cin >> c[i][j];
    int ans = 0;
    for (int m = 0; m < (1 << (h + w)); m++) {
        int cnt = 0;
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++) {
                if (c[i][j] != '#')
                    continue;
                if ((m & ((1 << j) | (1 << (i + w)))) == 0)
                    cnt++;
            }
        if (cnt == k)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int X[ 10 ];

int main()
{
int A;
int B;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> X[ 0 ];
	cin >> X[ 1 ];
	cin >> X[ 2 ];

	sort( X, X + 3 );

	cout << X[ 0 ] * X[ 1 ] / 2 << endl;

	return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,y,a;
  int k;
  a=1;
  cin>>n>>y;
  for(int i=0; i<=n; i++){
    for(int j=0; i+j<=n; j++){
      if(i*10000+j*5000+(n-i-j)*1000==y && a==1){
        cout<<i<<" "<<j<<" "<<n-i-j;
        a=0;
      }
    }
  }
  if(a==1){
    k=-1;
    cout<<k<<" "<<k<<" "<<k;
  }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		ArrayList<String> list = new ArrayList<String>();

		int i = 0;
		int j = 0;
		int k = 0;

		for (i = 0; i < s.length(); i++) {
			list.add("");
			for (j = k; j < s.length(); j++) {
				String tmp = String.valueOf(s.charAt(j));
				if (tmp.equals("A") || tmp.equals("C") || tmp.equals("G") || tmp.equals("T")) {
					list.set(i, list.get(i) + tmp);
				} else {
					k = j + 1;
					break;
				}
			}
			if (j == s.length()) {
				break;
			}
		}

		String ans = "";
		int max = 0;

		for (i = 0; i < list.size(); i++) {
			if (ans.length() < list.get(i).length()) {
				ans = list.get(i);
				max = ans.length();
			}
		}

		System.out.println(max);

	}

}


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

int main() {
  int n,x;
  cin >> n >> x;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a+n);
  int min = a[0], count = 0;
  if (x<min)
    cout << 0 << endl;
  else if (x==min)
    cout << 1 << endl;
  else {
    for (int i = 0; i < n; i++) {
      if (a[i] <= x) {
        x-= a[i];
        count++;
        if (i == n-1&&x>0)
            count--;
      }
      else
        break;
    }
    cout << count << endl;
  }
  return 0;
}


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

int main()
{
    string S;
    cin >> S;
    int size = S.size();
    int ans = 0;
    int tmp = 0;

    vector<int> list(2019);//余りリスト
    vector<int> keta(size);//各桁

    list[0] = 1;

    for (int i = 0; i < size; i++)
        keta[i] = S[i] - 48;

    reverse(keta.begin(), keta.end());

    int ten = 1;

    for (int i = 0; i < size; i++)
    {
        tmp = (keta[i] * ten + tmp) % 2019;
        ten *= 10;
        ten %= 2019;
        list[tmp]++;
    }

    for (int i = 0; i < 2019; i++)
    {
        ans += list[i] * (list[i] - 1) / 2;
    }

    cout << ans;
}

Measured memory_bytes: 4376
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N; cin >> N;
    vector<int> as(N); for (auto &ai : as) cin >> ai;
    // rems[i]:iより大きいiの倍数の箱に入れた玉の総数を２で割った余り; 0 or 1
    vector<int> rems(N, 0);
    // boxes[i]:i番目の箱に入れる玉の数; 0 or 1
    vector<int> boxes(N, 0);
    for (int i = N; i > 0; --i)
    {
        boxes[i - 1] = (rems[i - 1] + as[i - 1]) % 2;
        // iの箱に玉を入れることにより影響を受ける箱（iの約数dの箱）について
        // rems[d]を更新しておく:O(sqrt(N))
        for (int d = 1; d * d <= i; ++d)
        {
            if (i % d == 0)
            {
                rems[d - 1] = (rems[d - 1] + boxes[i - 1]) % 2;
                // 二重更新を回避する
                // 下式中のi/d=dなので，更新したrems[d-1]を使って再更新してしまう
                if (d < i / d)
                {
                    rems[i / d - 1] = (rems[i / d - 1] + boxes[i - 1]) % 2;
                }
            }
        }
    }
    int M = count(boxes.begin(), boxes.end(), 1);
    cout << M << endl;
    for (int i = 1; i <= N; ++i)
    {
        if (boxes[i - 1] == 1)
        {
            cout << i;
            --M;
            if (M > 0) cout << ' ';
        }
    }
    cout << endl;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

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

	double a;
	cin >> a;

	cout.setf(ios::fixed);		
	cout.setf(ios::showpoint);	

	cout << (a * a * a) / 27;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<string>A(N);
    vector<string>B(N);
    for(int i = 0; i < N; i++) {
        string S;
        cin >> S;
        string T = "",R = "";
        for(int j = 0; j < S.size(); j++) {
            if(S[j] == '?') {
                T+='a';
                R+='z';
            }
            else {
                T+=S[j];
                R+=S[j];
            }
        }
        A[i] = T;
        B[i] = R;
    }
    string T;
    cin >> T;
    A.push_back(T);
    B.push_back(T);
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int cnt1 = 0,cnt2 = 0;
    for(int i = 0; i < N+1; i++) {
        if(A[i] == T) {
            cnt1 = i+1;
            break;
        }
    }
    for(int i = N; i >= 0; i--) {
        if(B[i] == T) {
            cnt2 = i+1;
            break;
        }
    }
    for(int i = min(cnt1,cnt2); i <= max(cnt1,cnt2); i++) {
        cout << i << ((i == max(cnt1,cnt2))?"":" ");
    }
    cout << endl;
}


Measured memory_bytes: 4316
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list);
        int ans = 0;
        while(true) {
            if(list.size() == 0) {
                System.out.println(ans);
                return;
            }
            int min = list.get(0);
            int max = list.get(list.size() - 1);
            if(min < k - max) {
                ans += min * 2;
                list.remove(0);
            } else if(min > k - max){
                ans += (k - max) * 2;
                list.remove(list.size() - 1);
            } else {
                ans += min * 2;
                list.remove(0);
            }
        }
    }
}

Measured memory_bytes: 35880
#include <bits/stdc++.h>
#include <string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pii pair<int, int>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define jai_shree_ram  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, a, b, d) for (int i = a; i <= b; i += d)
#define brep(i, a, b, d) for (int i = a; i >= b; i -= d)
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n'
int MAX = 1e5 + 5;
int MOD = 1e9 + 7;
////////////////////////////////

double n;
int ax;
double dp[305][305][305];


double solve(int a, int b, int c){
    if(dp[a][b][c]) return dp[a][b][c];
    if(!(a+b+c)) return 0;

    double z = n - (a+b+c);
    double aa = a, bb = b, cc = c, ans = 0, nn = (aa + bb + cc);
    
    if(c-1>=0) ans += ((solve(a, b+1, c-1) + 1) * (cc/nn));
    if(b-1>=0) ans += ((solve(a+1, b-1, c) + 1) * (bb/nn));
    if(a-1>=0) ans += ((solve(a-1, b, c) + 1) * (aa/nn));
    
    double wv = 0;
    if(z > 0) wv = n/(n-z);
    ans = ans + wv*(z/n);

    dp[a][b][c] = ans;
    return ans;
}


int32_t main(){
    jai_shree_ram 
    cin >> n;
    int ta=0, tb=0, tc=0;
    rep(i,1,n,1){
        cin >> ax;
        if(ax == 1) ta++;
        if(ax == 2) tb++;
        if(ax == 3) tc++;
    }
    double ans = solve(ta, tb, tc);
    cout << setprecision(20) << ans << '\n';
    cout << fixed;
    return 0; 
}

Measured memory_bytes: 219392
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf = 1e10;
typedef pair<mp,mp> mmp; //cost left-right-state(0,1)

int main(){
    while(1){
	int w,h;
	cin>>w>>h;
	if(w==0)break;
	vector<vector<ll> > s(h+8,vector<ll>(w+8,inf) );
	vector<vector<vector<bool> > > used(h+8,vector<vector<bool> >(w+8,vector<bool>(2,false) ) );
	vector<vector<bool> > goal(h+8,vector<bool>(w+8,false) );
	priority_queue<mmp,vector<mmp>,greater<mmp> > q;
	for(int i=4;i<h+4;i++){
	    for(int j=4;j<w+4;j++){
		char tmp;
		cin>>tmp;
		if(tmp=='S'){
		    s[i][j] = 0;
		    q.push(mmp( mp(0,0),mp(i,j) ) );
		    q.push(mmp( mp(0,1),mp(i,j) ) );
		}else if(tmp=='T'){
		    s[i][j] = 0;
		    goal[i][j] = true;
		}else if(tmp=='X'){
		    used[i][j][0] = true;
		    used[i][j][1] = true;
		}else{
		    s[i][j] = tmp-'0';
		}
	    }
	}
	bool flag = true;
	while(!q.empty() ){
	    mmp now = q.top();
	    q.pop();
	    ll cost = now.first.first;
	    ll state = now.first.second;
	    ll x = now.second.first;
	    ll y = now.second.second;
	    if(goal[x][y]){
		cout<<cost<<endl;
		flag  = false;
		break;
	    }
	    if(s[x][y] == inf) continue;
	    if(used[x][y][state])continue;
	    used[x][y][state] = true;
	    ll ddx = 1;
	    if(state == 1)ddx *= -1;
	    state = (state+1)%2;
	    for(int i=1;i<=3;i++){
		for(int j=-3+i ; j <= 3-i  ;j++){
		    ll nx = x + j;
		    ll ny = y + i*ddx;
		    ll nc = cost + s[nx][ny];
		    if(used[nx][ny][state])continue;
		    q.push( mmp( mp( nc , state ), mp( nx,ny ) )  );
		}
	    }
	}
	if(flag) cout<<-1<<endl;
    }
    return 0;
}



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


int main() {
  int N;
  cin>>N;
  
  vector<int> vec(N+1);
  for(int i=1;i<=N;i++){
    cin>>vec.at(i);
  }
  int sum=0;
  for(int i=0;i<100;i++){
    for(int j=1;j<=N;j++){
      if(vec.at(j)>=1){
        if(vec.at(j-1)==0){
          sum++;
        }
      }
    }
    for(int k=1;k<=N;k++){
      vec.at(k)=max(vec.at(k)-1,0);
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define int long long
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
string as, bs;
int n, m;
int fdp[3001][3001];
int ffun(int i, int j){
    if(i == n || j == m){
        return 0;
    }
    if(fdp[i][j] != -1){
        return fdp[i][j];
    }
    if(as[i] == bs[j]){
        fdp[i][j] = 1 + ffun(i+1, j+1);
        return fdp[i][j];
    }
    fdp[i][j] = max(ffun(i+1, j), ffun(i, j+1));
    return fdp[i][j];
}
string dp[3001][3001];

string fun(int i, int j){
    if(i == n || j == m){
        return "";
    }
    if(dp[i][j] != "-"){
        return dp[i][j];
    }
    if(as[i] == bs[j]){
        dp[i][j] = as[i] + fun(i+1, j+1);
        return dp[i][j];
    }
    if(fdp[i+1][j] > fdp[i][j+1]){
        dp[i][j] = fun(i+1, j);
        return dp[i][j];
    }
    dp[i][j] = fun(i, j+1);
    return dp[i][j];
}
signed main(){
    for(int i=0;3001>i;i++){
        for(int j=0;3001>j;j++){
            dp[i][j] = "-";
            fdp[i][j] = -1;
        }
    }
    cin >> as >> bs;
    n = as.length();
    m = bs.length();
    ffun(0, 0);
    cout << fun(0, 0) << endl;
}










Measured memory_bytes: 571520
// Problem Code: abc174_e

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int logs(int N, int K, vector<int>& A) {
	int low, mid, high;
	low = 1;
	high = *max_element(A.begin(), A.end());

	// helper function
	auto good = [&](int len) {
		long long cuts = 0;
		for (int& log: A)
			cuts += (log - 1) / len;
		return cuts <= K;
	};

	// binary search
	while (low < high) {
		mid = low + (high - low) / 2;
		if (good(mid))
			high = mid;
		else
			low = mid + 1;
	}

	return high;
}

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];
	cout << logs(N, K, A);
	return 0;
}

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>> g(n);
    vector<set<int>> par(n);
    rep(i,n+m-1){
        int a,b;
        cin>>a>>b;
        a--; b--;
        g[a].pb(b);    
        par[b].insert(a);
    }

    int r;
    rep(i,n){
        if(par[i].empty()){
            r=i;
            break;
        }
    }

    queue<int> que;
    vector<int> ans(n);

    que.push(r);
    ans[r]=-1;

    while(!que.empty()){
        int x=que.front();
        que.pop();

        for(auto nx:g[x]){
            if(par[nx].size()==1){
                ans[nx]=x;
                que.push(nx);
            }
            if(par[nx].empty()) continue;        
            par[nx].erase(x);
        }
    }

    rep(i,n) cout<<ans[i]+1<<endl;
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int cond[3];

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	ll ans = 1;
	for( int i = 0; i < n; ++i ){
		int cnt = 0;
		for( int k = 0; k < 3; ++k ){
			if( cond[k] == a[i] ){
				++cnt;
			}
		}
		if( cnt == 3 ) ans *= 3;
		else if( cnt == 2 ) ans *= 2;
		else if ( cnt == 0 ) ans *= 0;
		ans %= mod;
		for( int k = 0; k < 3; ++k ){
			if( cond[k] == a[i] ){
				++cond[k];
				break;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
/*
    Washief Hossain Mugdho
    19 September 2020
    Educational DP Slimes
*/

#ifndef DEBUG
#pragma GCC optimize("O3")
#endif

#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
ull memo[405][405];
ull a[405];
ull dp(int x, int y)
{
    if (x == y)
        return 0;
    if (memo[x][y])
        return memo[x][y];
    ull res = INT64_MAX;
    for (int i = x; i < y; i++)
        res = min(res, dp(x, i) + dp(i + 1, y) + a[y] - a[x - 1]);
    return memo[x][y] = res;
}
int main()
{
#ifdef LOCAL_OUTPUT
    freopen(LOCAL_OUTPUT, "w", stdout);
#endif
#ifdef LOCAL_INPUT
    freopen(LOCAL_INPUT, "r", stdin);
#endif
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    cout << dp(1, n) << endl;
}


Measured memory_bytes: 4888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long double a,b,c;
int main()
{
    cin>>a>>b>>c;
    c=c-a-b;
    if(c<0) printf("No\n");
    else
    {
        c*=c;
        a=4*a*b;
        if(a<c) printf("Yes\n");
        else printf("No\n");
    }
}


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

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

int main() {

    int N,M;

    cin >> N >> M;
    vector<vector<int>> a(M,vector<int>(N,0));
    vector<vector<int>> b(M,vector<int>(N,0));
    vector<int> p(M);

    rep(i,M){
        int k,s;
        cin >> k;
        rep(j,k){
            cin >> s;
            a[i][s-1] = 1;
        }
    }

    rep(i,M){
        cin >> p[i];
    }

    int ans = 0;

    rep(k,pow(2,N)){
        
        rep(i,M){
            rep(j,N)    b[i][j] = a[i][j];
        }

        rep(i,N){
            if(((k>>i)&1) == 0){
                rep(j,M){
                    b[j][i] = 0;
                }
            }
        }

        int flag = 1;
        rep(i,M){
            if((accumulate(b[i].begin(),b[i].end(),0) % 2) != p[i]){
                flag = 0;
                break;
            };
        }
        if(flag){
            ans++;
        };
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int in[402],fa[402];
bool vis[402],qwq[402];
int h;
int getf(int x){
	return fa[x]==x?x:fa[x]=getf(fa[x]);
}
void add(int l,int r){
	l+=h;
	r+=h;
	in[r]++;
	in[l]--;
	qwq[l]=qwq[r]=1;
	int x=getf(l),y=getf(r);
	fa[x]=y;
}
int main(){
	int n;
	scanf("%d%d",&n,&h);
	for(int i=0;i<=2*h;i++)
		fa[i]=i;
	while(n--){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		add(c?-c:a,d?d:-b);
	}
	for(int i=0;i<h;i++)
		if (in[i]<0)
			return puts("NO"),0;
	for(int i=h+1;i<=2*h;i++)
		if (in[i]>0)
			return puts("NO"),0;
	//puts("WTF");
	for(int i=0;i<=2*h;i++)
		if (in[i])
			vis[getf(i)]=1;
	//puts("WTF");
	for(int i=0;i<=2*h;i++)
		if (qwq[i] && !vis[getf(i)])
			return puts("NO"),0;
	puts("YES");
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<math.h>

int main(void)
{
  int a,b,c,d,n,i;
  while(scanf("%d",&n)!=EOF){
    i=0;
    for(a=0;a<=9;a++)
      for(b=0;b<=9;b++)
	for(c=0;c<=9;c++)
	  for(d=0;d<=9;d++)
	    if(a+b+c+d==n)
	      i++;
    printf("%d\n",i);  
  }

  return 0;
}

Measured memory_bytes: 596
# --------------------------------------
# 関数定義
# --------------------------------------


def chmin(a, b):
    if a > b:
        a = b
    return a

# --------------------------------------
# メイン処理
# --------------------------------------


def main():
    INF = 10 ** 10
    N, K = map(int, input().split())
    h = list(map(int, input().split()))

    dp = [INF] * N
    dp[0] = 0

    for i in range(1, N):
        for j in range(1, K + 1):
            if i - j < 0:
                continue
            dp[i] = chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

    print(dp[N-1])


# --------------------------------------
# 実行
# --------------------------------------
if __name__ == "__main__":
    main()


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

using namespace std;

int main()
{
  string weather[3] = {"Sunny", "Cloudy","Rainy"};
  char c;
  scanf("%c",&c);
  if(c=='S') cout<<weather[1]<<endl;
  else if(c=='C') cout<<weather[2]<<endl;
  else cout<<weather[0]<<endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
*A, = map(int, input().split())
cnt = Counter(A)
ans = N
duplicates = sorted([(a, d) for a, d in cnt.items() if d > 1], key=lambda x: x[0])
offset = 0
for _, d in duplicates:
    if offset: d -= offset; offset = 0;
    if d == 1: continue
    elif d % 2 == 0: ans -= d; offset = 1;
    else: ans -= d-1
print(ans)

Measured memory_bytes: 18656
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

typedef complex<double> Point;

double cross(Point a, Point b) {
	return (conj(a) * b).imag();
}

Point crosspoint(Point aa, Point ab, Point ba, Point bb) {
	double A = cross(ab - aa, bb - ba), B = cross(ab - aa, ab - ba);
	return ba + B / A * (bb - ba);
}

double area(Point a, Point b, Point c) {
	return abs(cross(a, b) + cross(b, c) + cross(c, a)) / 2;
}

int main() {
	const double PI = acos(-1.);
	int N; int K;
	while(~scanf("%d%d", &N, &K)) {
		double theta = 2 * PI / N;
		Point A = polar(1.0, 0 * theta), B = polar(1.0, 1 * theta);
		Point C = polar(1.0, K * theta), D = polar(1.0, (1 - K) * theta);
		Point E = crosspoint(A, C, B, D);
		double T = area(Point(0, 0), A, E);
		double P = PI / N - T * 2;
		double ans = PI - P * N;
		printf("%.10f\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<" ----------------------------------- "<<endl
#define LL long long
#define DB double
#define LDB long double
#define ULL unsigned long long
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
using namespace std;
inline LL read(){
	LL nm=0; bool fh=true; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-');
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return fh?nm:-nm;
}
#define M 200020
#define mod 1000000007
#define inv2 500000004
namespace CALC{
	inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
	inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
	inline int mul(int x,int y){return (LL)x*(LL)y%mod;}
	inline void upd(int &x,int y){x=((x+y>=mod)?(x+y-mod):(x+y));}
	inline void dec(int &x,int y){x=((x-y<0)?(x-y+mod):(x-y));}
	inline int qpow(int x,int sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;}
}using namespace CALC;
int n,m,tmp,A[M],cnt[M],All,ans;
int las[M],c[M],iv[M],pre[M],inv_pre[M];
inline void mdf(int l,int r,int val){
	if(l>r) return;
	for(int k=l;k<=n;k+=(k&-k)) upd(c[k],val);
	for(int k=r+1;k<=n;k+=(k&-k)) dec(c[k],val);
}
inline int qry(int k,int res=0){for(;k;k-=(k&-k))upd(res,c[k]);return res;}
int main(){
	n=read(),iv[1]=iv[0]=All=1;
	for(int i=2;i<=n;i++) iv[i]=mul(mns(mod,mod/i),iv[mod%i]),assert(mul(iv[i],i)==1);
	for(int i=1;i<=n;i++) ++cnt[A[i]=read()];
	for(int i=n;i>=1;i--) cnt[i]+=cnt[i+1]; pre[0]=inv_pre[0]=1;
	for(int i=1;i<=n;i++) if((cnt[i]=cnt[i]-(n-i))<=0){puts("0");return 0;}
	for(int i=1;i<=n;i++){
		if(cnt[i]>1) pre[i]=mul(mul(pre[i-1],cnt[i]-1),iv[cnt[i]]),las[i]=las[i-1];
		else pre[i]=pre[i-1],las[i]=i; All=mul(All,cnt[i]),inv_pre[i]=qpow(pre[i],mod-2);
	}
	for(int i=n;i>=1;i--){
		upd(ans,mul(inv_pre[A[i]],qry(A[i])));
		mdf(las[A[i]]+1,A[i],mul(All,pre[A[i]]));
	} memset(c,0,sizeof(c));
	for(int i=1;i<=n;i++){
		dec(ans,mul(inv_pre[A[i]],qry(A[i])));
		mdf(las[A[i]]+1,A[i]-1,mul(All,pre[A[i]]));
	} ans=mul(ans,inv2),memset(c,0,sizeof(c)); int rem=0;
	for(int i=1;i<=n;i++) upd(rem,qry(A[i])),mdf(1,A[i]-1,1);
	upd(ans,mul(rem,All)),printf("%d\n",ans); return 0;
}

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

ifstream fin("pentagon.in");
ofstream fout("pentagon.out");

#define NMAX 100005

int main()
{
   int a,b,c;
   cin>>a>>b>>c;
   swap(a,b);
   swap(a,c);
   
   cout<<a<<" "<<b<<" "<<c;

    return 0;
}


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

int main() {
  int N,K;
  int x = 1;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
    int y,z;
    y = x * 2;
    z = x + K;
    if (y >= z){
      x = z;
    }
    else {
      x = y;
    }
  }
  cout << x << endl;
}

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

#define      pb    push_back
#define      ff    first
#define      ss    second
#define      ll    long long int
#define      endl  "\n"
#define      FASTIO        ios_base::sync_with_stdio(false);cin.tie(NULL);//cout.tie(NULL);
#define      TEST    ll t ; cin >> t ; while( t -- )
#define      pii     pair < int , int >

//------------------------------------------------------------------------//

#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)

//------------------------------------------------------------------------//

const ll Max = 10e18 ;
const int SIZE = 2 * 10e5 ;

int  main (  ) {

    FASTIO ;

    int n , k ;

    cin >> n >> k ;

    vector < int > v( n ) ;

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

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

    int ans = 0 ;

    for( int i = 0 ; i < k ; i++ )
        ans += v[ i ] ;

    cout << ans <<   endl ;

    return  0 ;
}


Measured memory_bytes: 3596
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  
  int a,b;cin>>a>>b;
  if(a < 10 && b < 10)cout << a*b << endl;
  else cout << -1 << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#pragma warning(disable:4996)


int main() {

	long long a, b, n;
	scanf("%lld %lld %lld", &a, &b, &n);
	long long max = 0;
	long long temp;

	max = (a * n) / b - a * (n / b);
	temp = n / b * b - 1;
	if ((a * temp) / b - a * (temp / b) > max)
		max = (a * temp) / b - a * (temp / b);

	printf("%lld", max);

	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
//#define mp make_pair
#define eps 1e-9
#define pp pair < pair<ll,ll> , ll> 
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define foll(i,j,k) for(ll i=j;i<=k;i++)
#define clr(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vll vector<ll>
#define sz(a) a.size()
#define len(a) a.length()
#define all(a) a.begin(),a.end()
#define io_file freopen("Contest/input_file.in", "r", stdin); freopen("Contest/output_file.in", "w", stdout)


const int MAXN = 2e5+5;
using namespace std;
ll power(ll x, ll y)
{
  ll res = 1;
  while(y>0)
  {
    if(y&1)
       {
         res = (res*x)%mod;
        }
     x = (x*x)%mod;
     y = y>>1;
  }
    return res;
}
std::vector<ll> divi[1000004];

void divisor(int n)
{
   for(ll i=1;i<=n;i++)
   {
     for(ll j=i;j<=n;j+=i)
     {
       divi[j].pb(i);
     }
   }
}

int n;


ll a[252];
int coins[6] = {0,1,5,10,25,50};
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin>>n;
    int cnt = 1;
    int ans =0;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    	if(i>=2)
    	{
    		if(a[i]==a[i-1])
    		{
    			cnt++;
    		}
    		else{
    			ans = ans + cnt/2;
    			cnt=1;
    		}
    	}
    }
    ans = ans + cnt/2;
    cout<<ans<<endl;
   	return 0;


}


Measured memory_bytes: 23680