akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b){
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


int factorial(int n){
  if(n == 0) return 1;
  return n*factorial(n-1);
}

int divisor(int a){
  int cnt = 0;
  for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
  return cnt;
}

int comb(int n, int k){
  return factorial(n) / (factorial(n-k)*factorial(k));
}

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



int main(){
  int r;
  cin >> r;
  cout << r*r << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Graph vector<vector<int>>;
#define iterG(next_v, G, v) for(auto next_v : G[v]
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cin >> r;
    cout << 2 * r * M_PI << endl;
    return 0;
}



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

int main()
{
    string s;
    cin >> s;
    s[3] = '8';
    cout << s;
    return 0;
}


Measured memory_bytes: 256
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()


Measured memory_bytes: 9100
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

int n;
int r,c;
int pt[5];
pair<int,int> top[5][100005];

int isedge(int x,int y){
  if(x == 0) return 1;
  if(y == 0) return 4;
  if(x == r) return 3;
  if(y == c) return 2;
  return 0;
}

int main(){
  cin>>r>>c;
  cin>>n;
  for(int i=0;i<n;i++){
    int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
    if((isedge(x1,y1)>0) && (isedge(x2,y2))){
      if(isedge(x1,y1) == 1) top[1][pt[1]++] = make_pair(y1,i);
      if(isedge(x1,y1) == 2) top[2][pt[2]++] = make_pair(x1,i);
      if(isedge(x1,y1) == 3) top[3][pt[3]++] = make_pair(y1,i);
      if(isedge(x1,y1) == 4) top[4][pt[4]++] = make_pair(x1,i);
      if(isedge(x2,y2) == 1) top[1][pt[1]++] = make_pair(y2,i);
      if(isedge(x2,y2) == 2) top[2][pt[2]++] = make_pair(x2,i);
      if(isedge(x2,y2) == 3) top[3][pt[3]++] = make_pair(y2,i);
      if(isedge(x2,y2) == 4) top[4][pt[4]++] = make_pair(x2,i);
    }
  }
  for(int i=0;i<5;i++){
    sort(top[i],top[i]+pt[i]);
  }
  /*for(int i=0;i<5;i++){
    for(int j=0;j<pt[i];j++)cout<<top[i][j].first<<" "<<top[i][j].second<<endl;
  }*/
  bool ans = true;
  int pp=0;
  pair<int,int> stack[100005];
  for(int i=0;i<pt[1];i++){
    if(pp == 0){
      stack[pp++] = top[1][i];
    } else {
      if(stack[pp-1].second == top[1][i].second){
        pp--;
      } else {
        stack[pp++] = top[1][i];
      }
    }
  }
  for(int i=0;i<pt[2];i++){
    if(pp == 0){
      stack[pp++] = top[2][i];
    } else {
      if(stack[pp-1].second == top[2][i].second){
        pp--;
      } else {
        stack[pp++] = top[2][i];
      }
    }
  }
  for(int i=pt[3]-1;i>=0;i--){
    if(pp == 0){
      stack[pp++] = top[3][i];
    } else {
      if(stack[pp-1].second == top[3][i].second){
        pp--;
      } else {
        stack[pp++] = top[3][i];
      }
    }
  }
  for(int i=pt[4]-1;i>=0;i--){
    if(pp == 0){
      stack[pp++] = top[4][i];
    } else {
      if(stack[pp-1].second == top[4][i].second){
        pp--;
      } else {
        stack[pp++] = top[4][i];
      }
    }
  }
  if(pp == 0){
    cout<<"YES"<<endl;
  } else {
    cout<<"NO"<<endl;
  }
  //cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;
 
int main(){

    int x,y,z,k;

    cin >> x >> y >> z >> k;

    vector<long long> a;
    vector<long long> b;
    vector<long long> c;

    priority_queue<pair<long long, pair<int, pair<int, int>>>> q;
    map<pair<int, pair<int, int>> , int> m;

    for(int i = 0; i < x; i++){
        long long tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    for(int i = 0; i < y; i++){
        long long tmp;
        cin >> tmp;
        b.push_back(tmp);
    }

    for(int i = 0; i < z; i++){
        long long tmp;
        cin >> tmp;
        c.push_back(tmp);
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());

    q.push(make_pair(a[x - 1] + b[y - 1] + c[z - 1], make_pair(x - 1, make_pair(y - 1, z - 1))));
    m[make_pair(x - 1, make_pair(y - 1, z - 1))]++;

    while(k > 0){
        cout << q.top().first << endl;

        int tx = q.top().second.first;
        int ty = q.top().second.second.first;
        int tz = q.top().second.second.second;

        if(tx - 1 > - 1 && m[make_pair(tx - 1, make_pair(ty, tz))] == 0){
            q.push(make_pair(a[tx - 1] + b[ty] + c[tz], make_pair(tx - 1, make_pair(ty,tz))));
            m[make_pair(tx - 1, make_pair(ty,tz))]++;
        }

        if(ty - 1 > - 1 && m[make_pair(tx, make_pair(ty - 1, tz))] == 0){
            q.push(make_pair(a[tx] + b[ty - 1] + c[tz], make_pair(tx, make_pair(ty - 1,tz))));
            m[make_pair(tx, make_pair(ty - 1,tz))]++;
        }

        if(tz - 1 > - 1 && m[make_pair(tx, make_pair(ty, tz - 1))] == 0){
            q.push(make_pair(a[tx] + b[ty] + c[tz - 1], make_pair(tx, make_pair(ty,tz - 1))));
            m[make_pair(tx, make_pair(ty,tz - 1))]++;
        }
        
        q.pop();
        k--;
    }

    return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	for (int n; cin >> n && n;) {
		int c = 0, d = 0, C = 0;
		while (n--) {
			string f;
			cin >> f;
			if (f == "lu")c += 1;
			else if (f == "ru")c += 2;
			else if (f == "ld")c -= 1;
			else if (f == "rd")c -= 2;

			if ((c == 3 || c == 0) && C != c) {
				d++;
				C = c;
			}
		}
		cout << d << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
// In the name of Allah the Most Merciful. 

import java.util.*;
import java.math.*;

public class Main{
   
    public static void main(String arg[]){
        
        Scanner sc = new Scanner(System.in);
        
        long n , k , x , y;
        n = sc.nextLong();
        k = sc.nextLong();
        x = sc.nextLong();
        y = sc.nextLong();
        
        System.out.println(Math.min(k , n)*x+Math.max((long)0 , n-k)*y);
        
    }
}

Measured memory_bytes: 22100
n,a,b=map(int,input().split())
c=b-a
if c%2==0:
    print(c//2)
else:
    if b-1<=n-a:
        print(a+(b-a)//2)
    else:
        b=n-b+1
        a=n-a+1
        print(a+(b-a)//2)

Measured memory_bytes: 2940
//山の高さをメートル単位の整数で表した 10 個のデータがあります。
//その 10 個のデータを読み込み、その中で、高い順から３つ出力する
//プログラムを作成して下さい。 

#include <stdio.h>
#include <stdlib.h>

int main(){
	int n;
	int i,a,b,c;  //a,b,cは上位3つの山の高さ
	a=b=c=0;
	for(i=0;i<10;i++){
		scanf("%d",&n);
		if(n>=a){
			c=b,b=a,a=n; //aは最も高い山
		}
		else if(n>=b){
			c=b,b=n;  //bは2番目に高い山
		}
		else if(n>c){
			c=n;  //cは3番目に高い山
		}
	}
		printf("%d\n%d\n%d\n",a,b,c);
		return 0;
}


Measured memory_bytes: 2112
K= int(input())
A, B = map(int, input().split())
i = 0
while A <= B:
  if A / K == A // K:
    i = i + 1
    A = A + 1
  else:
    i = i + 0
    A = A + 1
    
if i == 0:
  print("NG")
else:
  print("OK")

Measured memory_bytes: 9184
import sys
input = sys.stdin.readline

def get_sieve_of_eratosthenes_new(n):
    import math
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def get_count(beki) :
    count = 0
    for i in range(1,beki+1) :
        tmp = beki - i
        if (0 <= tmp) :
            count += 1
            beki = tmp
        else :
            return count
    
    return 1

def main() :
    N = int(input())
    count = 0
    if (N == 1) :
        print(0)
        return

    factorized = factorization(N)
    # print(factorized)
    for fact in factorized :
        fact_c = fact[1]
        count += get_count(fact_c)


    # primes = get_sieve_of_eratosthenes_new(N)
    # for prime in primes :
    #     if (N < prime) :
    #         # 判定する素数よりもNが小さければ今後割り切れることはない
    #         break
        
    #     beki = 1
    #     while (True) :
    #         z = prime
    #         if (beki > 1) :
    #             z = pow(prime,beki)
    #         if (N % z == 0) :
    #             count += 1
    #             N = N // z
    #             beki += 1
    #             if (N < prime) :
                    
    #                 break
    #         else :
    #             # わりきれなくなったら終了
    #             break

    print(count)
main()

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

int main (){
    int n, cont = 0;
    cin >> n;
    string s;
    cin >> s;
    int j = n - 1, i = 0;
    while(i < j){
        while(s[i] == 'R') i++;
        while(s[j] == 'W') j--;

        if(i < j){
            s[i] = 'R';
            s[j] = 'W';
            cont++;
        }
    }   

    cout << cont << endl;

    return 0;
}

Measured memory_bytes: 3760
N=int(input())
if N==3:
  print("2 5 63")
  exit()
if N<=15000:
  L=list(range(2,2*(N-1),2))
  if N<=10000:
    if (N-1)%2==0:
      k=N-2
    else:
      k=N-1
    L.append(k)
    L.append(k*3)
    R=list()
  else:
    if (N-1)%2==0:
      k=N-1
    else:
      k=N-2
    while k%2==0:
      k//=2
    L.append(k)
    L.append(k*3)
    R=list()
else:
  if N%2==0:
    L=list(range(2,30002,2))
    N-=15000
    R=list(range(3,3+6*N,6))
  else:
    L=list(range(2,30000,2))
    N-=15000
    R=list(range(3,3+6*(N+1),6))
s=L+R
print(" ".join(list(map(str,s))))

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

constexpr int LEN = 305;
bool check[LEN][LEN][LEN];
double dp[LEN][LEN][LEN];

double calc_e(int c1, int c2, int c3, const int n){
    if(check[c1][c2][c3]) return dp[c1][c2][c3];
    check[c1][c2][c3] = true;
    double nc0 = double(c1 + c2 + c3);
    double tmp = double(n)/nc0;
    if(c1 > 0) tmp += calc_e(c1-1, c2, c3, n)*double(c1)/nc0;
    if(c2 > 0) tmp += calc_e(c1+1, c2-1, c3, n)*double(c2)/nc0;
    if(c3 > 0) tmp += calc_e(c1, c2+1, c3-1, n)*double(c3)/nc0;
    return dp[c1][c2][c3] = tmp;
}

int main(){
    memset(dp, 0, sizeof(dp));
    memset(check, 0, sizeof(check));
    dp[0][0][0] = 0;
    check[0][0][0] = true;
    int n; cin >> n;
    int cnt[4] = {0};
    rep(i, n) {
        int c; cin >> c;
        cnt[c]++;
    }

    printf("%.15lf\n", calc_e(cnt[1], cnt[2], cnt[3], n));
    return 0;
}

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

int main() {
  long n,k,ans=4000000000000000010;
  cin >> n >> k;
  vector<vector<long>> xy(n,vector<long>(2));
  for(long i=0;i<n;i++) cin >> xy[i][0] >> xy[i][1];
  sort(xy.begin(),xy.end());

  for(long i=0;i<n;i++) {
    for(long j=i+k-1;j<n;j++) {
      vector<long> y;
      for(long i2=i;i2<=j;i2++) y.push_back(xy[i2][1]);
      sort(y.begin(),y.end());
      for(long i2=0;i2<=j-i+1-k;i2++) ans=min(ans,(xy[j][0]-xy[i][0])*(y[i2+k-1]-y[i2]));
    }
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

/* ----------- ANSWER ----------- */
/* ------------------------------ */

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n, x;
        cin >> n >> x;
        vl l(n);
        rep(i, n) cin >> l[i];

        ll now = 0;
        ll ans = 1;
        rep(i, n) {
            now += l[i];
            if (now <= x)ans++;
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
n=int(input())
n=str(n)
if n[-1]=='2' or n[-1]=='4' or n[-1]=='5' or n[-1]=='7' or n[-1]=='9':
  print('hon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
  print('pon')
else:
  print('bon')

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

int n, ans;
string s;
bool flag[50][2];

int main()
{
	cin >> n >> s;
	for(int i = 0; i < n; i++)
	{
		memset(flag, false, sizeof(flag));
		int cnt = 0;
		for(int j = 0; j <= i; j++)
		{
			flag[s[j] - 'a'][0] = true;	
	    }
		for(int j = i + 1; j < n; j++)
		{
			flag[s[j] - 'a'][1] = true;	
		}
		for(int j = 0; j < 26; j++)
		{
			if(flag[j][0] and flag[j][1])
				cnt++;
		}
		 ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

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

  ll n;
  string s;
  cin >> n >> s;
  char prev = s[0];
  ll ans = 0, idx = 0;
  while (idx < n) {
    while (idx < n && s[idx] == prev) {
      idx++;
    }
    ans++;
    if (idx < n) {
      prev = s[idx];
    }
  }
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k=0;
string s, t;


int main()
{
	cin >> n >> k;
  if(k!=1)
	cout << n - k << endl;
  else
    cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
B=list(map(int,input().split()))
a=[B[0],B[0]]

for i in range(1,N-1):
    if B[i] <= B[i-1]:
        a[i]=B[i]
        a.append(B[i])
    else:
        a[i]=B[i-1]
        a.append(B[i])

print(sum(a))


Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
class Main{
	public static void main(String[]args){
		Scanner in=new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out, true);
		int n = in.nextInt();
		long max = Integer.MIN_VALUE;
		long a[]=new long[n];
		long sum = 0;
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
			max = Math.max(max, a[i]);
			sum += (a[i] < max) ? (max - a[i]) : 0;
		}
		out.println(sum);
	}
}



Measured memory_bytes: 63140
//
// Created by yamunaku on 2019/09/07.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    ll n;
    cin >> n;
    cout << n*(n-1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
cnt = 0
while sum(h)>0:
    flag = 0
    for i in range(n):
        if h[i] > 0 and flag == 0:
            cnt += 1
            flag = 1
        if h[i] == 0 and flag == 1:
            flag = 0
    for j in range(n):
        if h[j] > 0:
            h[j] -= 1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <complex>
#include <set>
#include <map>

using namespace std;

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

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

const D EPS = 1e-10;
const D INF = 1e12;

#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define EX P(INF, INF)

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

D cs(P a, P b) {
	return (conj(a) * b).Y;
}
bool ispol(P a, P b, P c) {
	return abs(a - c) + abs(c - b) < abs(a - b) + EPS;
}

P cpLL(P a1, P a2, P b1, P b2) {
	D d1 = cs(b2 - b1, b1 - a1);
	D d2 = cs(b2 - b1, a2 - a1);
	if (EQ(d2, 0))return EX;
	return a1 + d1 / d2 * (a2 - a1);
}

P cpSS(P a1, P a2, P b1, P b2) {
	P r = cpLL(a1, a2, b1, b2);
	if (ispol(a1, a2, r) && ispol(b1, b2, r))return r;
	return EX;
}

int main() {
	int n;
	while (cin >> n && n) {

		int ans = 1;
		vector<L> vl;
		vl.push_back(L(P(-100,-100), P(-100, 100)));
		vl.push_back(L(P(-100, 100), P( 100, 100)));
		vl.push_back(L(P( 100, 100), P( 100,-100)));
		vl.push_back(L(P( 100,-100), P(-100,-100)));
		
		rep(i, n) {
			double px, py, tx, ty;
			cin >> px >> py >> tx >> ty;
			vl.push_back(L(P(px, py), P(tx, ty)));
			
			ans--;
			set<P> sp;
			for (int j = 0; j < vl.size() - 1; j++) {
				auto p = cpSS(vl[j].first, vl[j].second, vl.back().first, vl.back().second);
				if (p != EX) {
					sp.insert(p);
				}
			}
			for (auto ip : sp) {
				int cnt = 0;
				for (auto jp : sp) {
					if (EQ(ip.X, jp.X) && EQ(ip.Y, jp.Y))cnt++;
				}
				if (cnt >= 2) {
					sp.erase(ip);
				}
			}
			ans += sp.size();
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  rep(i, N)
  {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  int ans = 0;
  rep(i, K)
  {
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
local mfl, mce, mmi = math.floor, math.ceil, math.min
local SegTree = {}
SegTree.updateAll = function(self)
  for i = self.stagenum - 1, 1, -1 do
    for j = 1, self.cnt[i] do
      self.stage[i][j] = self.func(self.stage[i + 1][j * 2 - 1], self.stage[i + 1][j * 2])
    end
  end
end
SegTree.create = function(self, n, func)
  self.func = func
  local empty = {0, 0LL}
  local stagenum, mul = 1, 1
  self.cnt, self.stage, self.size = {1}, {{}}, {}
  while mul < n do
    mul, stagenum = mul * 2, stagenum + 1
    self.cnt[stagenum], self.stage[stagenum] = mul, {}
  end
  for i = 1, stagenum do self.size[i] = self.cnt[stagenum + 1 - i] end
  self.stagenum = stagenum
  for i = 1, mul do self.stage[stagenum][i] = empty end
  self:updateAll()
end
SegTree.setValue = function(self, idx, value)
  self.stage[self.stagenum][idx] = value
  for i = self.stagenum - 1, 1, -1 do
    local dst = mce(idx / 2)
    local rem = dst * 4 - 1 - idx
    self.stage[i][dst] = self.func(self.stage[i + 1][idx], self.stage[i + 1][rem])
    idx = dst
  end
end
SegTree.new = function(n, func)
  local obj = {}
  setmetatable(obj, {__index = SegTree})
  obj:create(n, func)
  return obj
end

SegTree.lower_bound = function(self, val)
  local ret, retpos = {0, 0LL}, 0
  local t1, t2, t3 = {1}, {1}, {self.size[1]}
  while 0 < #t1 do
    local stage, l, r = t1[#t1], t2[#t1], t3[#t1]
    table.remove(t1) table.remove(t2) table.remove(t3)
    local sz = self.size[stage]
    if sz <= r + 1 - l then
      local tmp = self.func(ret, self.stage[stage][mce(l / sz)])
      if tmp[1] < val then
        ret, retpos = tmp, l + sz - 1
        if sz ~= 1 then table.insert(t1, stage + 1) table.insert(t2, l + sz) table.insert(t3, r) end
      else
        if sz ~= 1 then table.insert(t1, stage + 1) table.insert(t2, l) table.insert(t3, l + sz - 2) end
      end
    else
      table.insert(t1, stage + 1) table.insert(t2, l) table.insert(t3, r)
    end
  end
  return retpos + 1, ret[2]
end

local q = io.read("*n")
local qlist = {}
local alist = {}
for i = 1, q do
  local tp = io.read("*n")
  if tp == 1 then
    local a, b = io.read("*n", "*n")
    qlist[i] = {a, b}
    table.insert(alist, a)
  else
    qlist[i] = false
  end
end
table.sort(alist)
local amap = {}
local asum = {}
local addcnt = {}
for i = 1, #alist do
  if not amap[alist[i]] then
    amap[alist[i]] = i
  end
  if i == 1 then asum[i] = alist[i]
  else asum[i] = asum[i - 1] + alist[i]
  end
  addcnt[alist[i]] = 0
end
local tree = SegTree.new(#alist, function(x, y) return {x[1] + y[1], x[2] + y[2]} end)
local acnt = 0
local bsum = 0
for i = 1, q do
  local query = qlist[i]
  if query then
    local a = query[1]
    local tmp = addcnt[a]
    local addpos = amap[query[1]] + tmp
    addcnt[a] = tmp + 1
    tree:setValue(addpos, {1, 0LL + a})
    bsum = bsum + query[2]
    acnt = acnt + 1
  else
    local half = mfl((acnt + 1) / 2)
    local calcpos, preval = tree:lower_bound(half)
    local src = alist[calcpos]
    preval = preval + src
    local result = bsum + half * src - preval
      + (tree.stage[1][1][2] - preval) - (acnt - half) * src
    print(src .. " " .. tostring(result):gsub("LL", ""))
  end
end


Measured memory_bytes: 161884
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    s=input()
    if s in ("a","i","u","o","e"):
        print("vowel")
    else:
        print("consonant")




if __name__ == "__main__":
    main()

Measured memory_bytes: 77472
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int t, a;
    cin >> t >> a;

    double m = 1e+100;
    int r = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        double s = abs(t - h * 0.006 - a);
        if (s < m) {
            m = s;
            r = i + 1;
        }
    }

    cout << r << endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;
using str = string;

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

long int M = 1e+9+7;
int inf = 1e+9;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int ans=0;
    vi abc(3),tmp(3);
    cin >> abc[0] >> abc[1] >> abc[2];
    sort(rng(abc));
    tmp[0] = abc[0];
    tmp[1] = abc[1];
    tmp[2] = abc[2];
    while(1){
        if(tmp[0]%2 || tmp[1]%2 || tmp[2]%2) break;
        ans++;
        int a=tmp[0];
        int b=tmp[1];
        int c=tmp[2];

        tmp[0] = b/2+c/2;
        tmp[1] = a/2+c/2;
        tmp[2] = a/2+b/2;
        sort(rng(tmp));
        bool flag = true;
        rep(i,3){
            if(!flag){
                flag=false;
                break;
            }
            if(abc[i]==tmp[i]) continue;
            flag=false;
        }
        if(flag){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

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

//解説見た

int main(){
    string S;
    cin >> S;
    
    int len = S.length();
    
    int ans = len;
    
    for(int i = 0; i < len - 1; ++i){
        if(S[i] != S[i + 1]){
            ans = min(ans, max(len - i - 1, i + 1));
        }
    }
    
    cout << ans << endl;
}


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

#define  __  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define  int  long long
#define  endl  '\n'
const double pi = acos(-1);
const int mod = 1e9 + 7;
//______________________



int32_t main()
{ 
  __
 
  
  
  int a,b;
  cin>>a>>b;

  if(a>=13)
    cout<<b<<endl;
else if(a<6)
    cout<<0;
else
    cout<<b/2;

 return 0;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())

i = 1
while i <=k:
    if i%2 == 1:
        if a%2 == 1:
            a -=1
            a //=2
            b +=a
        else:
            a //=2
            b +=a

    else:
        if b%2 == 1:
            b -=1
            b //=2
            a +=b
        else:
            b //=2
            a +=b

    i +=1

print(a,b)

Measured memory_bytes: 9196
#include<stdio.h>
#include<math.h>
typedef double D;
const D pi=3.14159265358979323846264338327950288419716939937510L;
signed main(void)
{
  int A,B,H,M;
  if(~scanf("%d %d %d %d",&A,&B,&H,&M))
  {
    D theta=((H*60+M)/2.0-6*M)*pi/180.0,x,y;
    x=(A-B*cos(theta)),y=B*sin(theta);
    return printf("%.20lf",pow(x*x+y*y,0.5)),0;
  }
}

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

using namespace std;

#define int long long
#define f(i, n) for(ll i=0;i<n;i++)
#define fr(i, n) for(ll i=n-1;i>=0;i--)
#define fa(i, a, n) for(ll i=a;i<n;i++)
#define fra(i, a, n) for(ll i=a-1;i>=n;i--)
#define MOD 998244353
#define pb push_back
#define lb lower_bound
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef vector<long long> vi;
typedef pair<ll, ll> pii;
typedef vector<string> vs;
typedef map<int, int> mii;
typedef map<int, vi> miv;

class Solution {
public:
    void pre() {}

    void solve() {
        double n;
        cin >> n;
        double k = n / 3.0;
        cout.setf(ios::fixed);
        cout << setprecision(12) << (k * k * k) << endl;
    }
};

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
//    cin >> t;
    Solution solver;
    //solver.pre();
    for (int i = 0; i < t; i++) {
        //cout << "Case #" << i + 1 << ": ";
        solver.solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int n; cin >> n;
  vector<ll> a(n), sum(n+1);
  sum[0] = 0;
  ll mmax = -1;
  rep(i,n) {
    cin >> a[i];
  }
  sorti(a);
  ll res = 0, tmp = a.back();
  a.pb(tmp);
  rep(i,n) {
    sum[i+1] = a[i] + sum[i];
    if (a[i+1] > sum[i+1] * 2) {
      res = 0;
    } else {
      res++;
    }
  }

  if (res == 0) res = 1;

  cout << res << endl;
}


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

int  main()
{
	int  a,b,x;
	cin>>a>>b;
	
	x=(a+b)/2;
	
	if((a+b)%2==1)
	   cout<<x+1<<endl;
	else
	   cout<<x<<endl;
	   
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int[] weight = new int[10];
		int c = 1;
		for(int i = 0; i < weight.length; ++i)
		{
			weight[i] = c;
			c *= 2;
		}
		while(stdIn.hasNext())
		{
			int w = stdIn.nextInt();
			boolean[] useWeight = new boolean[weight.length];
			for(int i = 0; i < useWeight.length; ++i)
			{
				useWeight[i] = false;
			}
			int lastPoint = 0;
			for(int i = weight.length - 1; i >= 0; --i)
			{
				if(w >= weight[i])
				{
					w -= weight[i];
					useWeight[i] = true;
					if(lastPoint < i)
					{
						lastPoint = i;
					}
				}
			}
			for(int i = 0; i < lastPoint; ++i)
			{
				if(useWeight[i])
				{
					System.out.print(weight[i] + " ");
				}
			}
			System.out.println(weight[lastPoint]);
		}
	}
}

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

int main() {
    int n, k; cin >> n >> k;
    string s; cin >> s;
    int same = 0, diff = n - 1;
    for (int i = 0; i + 1 < n; i++) if (s[i] == s[i + 1]) same++, diff--;
    cout << same + min(diff, k * 2) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

vector<vector<int>> mp(501, vector<int>(501,0));

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, H;
    ll amax = 0;
    cin >> N >> H;
    vector<ll> bv(N);
    ll ans = 0;
    REP(i, N){
        ll a, b;
        cin >> a >> b;
        amax = max(amax,a);
        bv[i] = b;
    }
    sort(bv.begin(), bv.end(), greater<>());
    REP(i, N){
        if(bv[i] > amax){
            H -= bv[i];
            ans++;
            if(H <= 0){
                printf("%lld\n", ans);
                return 0;
            }
        }
    }
    ans += H/amax;
    ans += H % amax == 0 ? 0 : 1;
    printf("%lld\n" , ans);
    return 0;
}


Measured memory_bytes: 2048
a, b = map(int, input().split())
count = 0

for i in range(a, b+1):
    i_str = str(i)
    length= len(i_str)
    list1 = []
    list2 = []
    for j in range(length):
        list1.append(i_str[j])
    for k in range(length):
        list2.append(i_str[-k-1])
    if list1 == list2:
        count += 1

print(count)

Measured memory_bytes: 3060
import math
pi=math.pi
a,b,h,m=map(int,input().split())
ra=((60*h+m)/360)*180
rb=(180/30)*m
r=abs(ra-rb)
if r>2*180:
    r=2*180-r
ans=math.sqrt(a**2+b**2-2*a*b*math.cos(r*2*pi/360))
print(f'{ans:.20f}')

Measured memory_bytes: 9400
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const long long N=100100;
long long a[N],n,ans;
bool f;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(long long i=1;i<=n;++i)
        cin>>a[i];
    sort(a+1,a+n+1,greater<long long>());
    for(long long i=1;i<=n;++i)
    {
        if(a[i]==a[i+1])
        {
            if(f)
            {
                cout<<a[i]*ans<<endl;
                return 0;
            }
            else
            {
                f=true;
                ++i;
                ans=a[i];
            }
        }
    }
    cout<<0<<endl;
    return 0;
}

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

typedef long long ll;
using namespace std;

void solve(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    ll ans = min(a, k);
    k -= min(a, k);
    ans += min(b, k) * 0;
    k -= min(b, k);
    ans += min(c, k) * (-1);
    cout << ans << endl;
}

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

    solve();

    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i=0 ; i<n ; i++)
    cin >> p.at(i);
  
  int ans = 0;
  for (int i=1 ; i<n-1 ; i++){
    if (p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1))
      ans++;
    else if (p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1))
      ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> b(m);
    REP(i,m) cin >> b[i];
    int ans = 0;
    REP(i,n) {
        int x = c;
        REP(j,m) {
            int a; cin >> a;
            x += a * b[j];
        }
        if (x > 0) ans++;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int N;
    cin>>N;
    vector<long int> h(N),dp(N);
    rep(i,N) cin>>h[i];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for (int i=2;i<N;i++){
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }
    cout<<dp[N-1]<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(int argc, char* argv[]){
  long long int n,nn;
  multiset<long long int> m;
  long long int maxn = 0;
  long long int total = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> nn;
    m.insert(nn);
  }
  for(auto itr = m.begin(); itr != m.end(); ++itr){
    if(maxn < *itr)maxn=*itr;
  }
  for(auto itr = m.begin(); itr != m.end(); ++itr){
    total += *itr;
  }
  if(total - maxn > maxn){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int64
	fmt.Scan(&n)
	var al, i int64
	al = int64(26)
	pw := 1
	var arr []int64
	alphabet := []string{"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"}
	for  {
		if n > al{
			n -= al
			al = al * int64(26)
			pw ++
		}else{
			n -= 1
			for i:=0; i< pw; i++{
				div := n / 26
				am := n % 26
				arr = append(arr, am)
				n = div
			}
			break
		}
	}
	len := int64(len(arr))
	ans := ""
	for i = len - 1; i >= 0; i-- {
		if i == len {
			ans = alphabet[arr[i]]
		}else if i == 0{
			ans += alphabet[arr[i]]			
		}else{
			ans += alphabet[arr[i]]
		}
	}
	fmt.Print(ans)
}


Measured memory_bytes: 1836
n=gets.to_i
a=b=p=0
puts (0...n).all?{
	t,x,y=gets.split.map &:to_i
	w=(a-x).abs+(b-y).abs
	u=t-p
	a,b,p=x,y,t
	w<=u && w%2==u%2
} ? :Yes : :No


Measured memory_bytes: 3836
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int G[12][12];
int n, m;
int ans = 0;

int main() {
	cin >> n >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		G[a][b] = G[b][a] = true;
	}
	vector<int> v;
	REP(i, n)v.emplace_back(i + 1);
	do {
		if (v[0] != 1)continue;
		bool used[12] = {};
		REP(i, n) {
			used[v[i]] = true;
			if (i) {
				if (!G[v[i - 1]][v[i]])break;
			}
			if (i == n - 1) {
				REP(j, n) {
					if (!used[j + 1])break;
					if (j == n - 1) {
						ans++;
					}
				}
			}
		}

	} while (next_permutation(ALL(v)));
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys, re
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
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K, X = MAP()

if 500*K >= X:
	print("Yes")
else:
	print("No")
	

Measured memory_bytes: 5712
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
template <class T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
template <class T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main(void) {
	lint a, b; cin >> a >> b;
	if (a <= 0 && b >= 0) {
		printf("Zero");
		return 0;
	}
	if (a > 0) {
		printf("Positive");
		return 0;
	}
	if (b <= -1) {
		if (abs(a - b) % 2 == 0) {
			printf("Negative");
			return 0;
		}
		printf("Positive");
		return 0;
	}
	printf("Positive");

    return 0;
}

Measured memory_bytes: 3648
//by shubham_bitsg

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector <string> vs;
 
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define sort(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vi x(5,8);
    int ans;
    forl(i,0,5) {
        cin>>x[i];
        if(x[i]==0)
            ans = i+1;
    }
    cout<<ans<<"\n";
}
    
    

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i=0;i<n;i++){
    cin >> s[i];
    if(s[i] == "Y"){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

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

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    private static int fact(int n) { int ans=1; for(int i=2;i<=n;i++) ans*=i; return ans; }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int x = in.nextInt();
        int gd  = gcd(360, x);
        int ans = 360/gd;
        out.println(ans);
        
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

#define int long long
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; }

signed main(){
	int n;
	cin >> n;

	int a[200010];
	int b[200010];
	for(int i = 0;i < n;i++){
		cin >> a[i] >> b[i];
	}

	sort(a, a+n);
	sort(b, b+n);

	if(n % 2 == 1){
		cout << b[n/2] - a[n/2] + 1 << endl;
	}else{
		int t1 = a[n/2] + a[n/2-1];
		int t2 = b[n/2] + b[n/2-1];
		int ans = t2 - t1;
		cout << ans + 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 6756