akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define N 200005
using ll = long long;
using namespace std;

int main(){
    ll x[N] = {}, y[N] = {};
    ll n;
    double d;
    cin >> n >> d;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    int counter(0);
    for (int i = 0; i < n; i++)
    {
        if ((double)sqrt(x[i] * x[i] + y[i] * y[i]) <= d)
        {
            counter++;
        }
    }
    cout << counter << endl;
}


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

int main() {
  string N;
  cin>>N;
  int ans =0;
  for(int i=0; i<N.size(); i++){
    if(N.at(i)!=N.at(N.size()-1-i)){
      ans++;
    }
  }
  cout<<ans/2<<endl;
}

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

int main() {
    int a[3];
    int k;
    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a, a+3);
    cout << a[0] + a[1] + a[2] * (1 << k) << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]

h = sorted(h)
ans = 10**9
for i in range(N-K+1):
    if ans > h[i+K-1] - h[i]:
        ans = h[i+K-1] - h[i]

print(ans)


Measured memory_bytes: 8280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int a, b;
  cin >> a >> b;
  if (a <= 0 && 0 <= b) {
    cout << "Zero" << endl;
    return;
  }
  if (0 < a) {
    cout << "Positive" << endl;
    return;
  }
  if ((abs(a - b) + 1)%2 == 0) cout << "Positive" << endl;
  else cout << "Negative" << endl;
}

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

Measured memory_bytes: 3624
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll k;
    cin >> n >> k;
    vll a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    V<int> bit(45, 0);
    for (int i = 0; i < n; i++) {
        for (int b = 0; b < 45; b++) {
            bit[b] += (a[i] >> b & 1);
        }
    }

    ll x = 0;
    for (int i = 44; i >= 0; i--) {
        if (bit[i] < n - bit[i]) x += (1LL << i);
        if (x > k) x -= (1LL << i);
    }

    ll ans = 0;
    for (int i = 0; i < n; i++) ans += a[i] ^ x;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3992
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, A, B, C, P, Q, R):
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort()
    P = P[:N]
    Q = Q[:M]

    S = P + Q
    heapq.heapify(S)
    for r in R:
        if r > S[0]:
            heapq.heappop(S)
            heapq.heappush(S, r)

    return sum(S)


def main():
    N, M, A, B, C = read_int_n()
    P = read_int_n()
    Q = read_int_n()
    R = read_int_n()
    print(slv(N, M, A, B, C, P, Q, R))


if __name__ == '__main__':
    main()


Measured memory_bytes: 117540
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


N, K = map(int, input().split())

result = 0
if K == 0:
    result = N * N
else:
    for i in range(K+1, N+1):
        result += (N//i * (i - K) + max(N%i-K+1, 0))

print(result)


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

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  // main procedure

  // output
  cout << (((N / 1000 + 1) * 1000) - N) % 1000 << endl;

  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
ll n,m,k,ans=0;
ll a[210000],b[210000];

int main(){
    ll n,m,k,ans=0;
    cin >> n >> m >> k;
    ll a[n],b[m];
    for (ll i=0;i<n;i++)cin >> a[i];
    for (ll i=0;i<m;i++)cin >> b[i];
    vector<ll> ruix(n+2);
    vector<ll> ruiy(m+2);
    ruix[0]=0;
    ruiy[0]=0;
    ruix[n+1]=INF;
    ruiy[m+1]=INF;
    for (ll i=0;i<n;i++){
        ruix[i+1]=ruix[i]+a[i];
    }
    for (ll i=0;i<m;i++){
        ruiy[i+1]=ruiy[i]+b[i];
    }
    for (ll i=0;i<=n;i++){
        if (k-ruix[i]<0)continue;
        auto ite=upper_bound(ruiy.begin(),ruiy.end(),k-ruix[i]);
        ll p=ite-ruiy.begin();
        ans=max(ans,p+i-1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9548
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN


int main(void){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>b){
		printf("%d\n",a-1);
	}else{
		printf("%d\n",a);
	}
	return 0;
}

Measured memory_bytes: 256
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
a = readints()
# print(a)
tmp = []
for i in range(n):
    if 1 <= a[i] and a[i] <= 399:
        tmp.append('ha')
    if 400 <= a[i] and a[i] <= 799:
        tmp.append('cha')
    if 800 <= a[i] and a[i] <= 1199:
        tmp.append('mi')
    if 1200 <= a[i] and a[i] <= 1599:
        tmp.append('mizu')
    if 1600 <= a[i] and a[i] <= 1999:
        tmp.append('ao')
    if 2000 <= a[i] and a[i] <= 2399:
        tmp.append('ki')
    if 2400 <= a[i] and a[i] <= 2799:
        tmp.append('da')
    if 2800 <= a[i] and a[i] <= 3199:
        tmp.append('aka')
    if 3200 <= a[i]:
        tmp.append('nanndemo')
# print(tmp)
z = 0
for i in range(len(tmp)):
    if tmp[i] == 'nanndemo':
        z += 1
if z == len(tmp):
    print(1, len(tmp))
    exit()

cnt = 0
tmp2 = list(set(tmp))
for i in range(len(tmp2)):
    if tmp2[i] != 'nanndemo':
        cnt += 1
min_x = cnt
#print('min', min_x)
cnt2 = 0
for i in range(len(tmp)):
    if tmp[i] == 'nanndemo':
        cnt2 += 1
# print(cnt2)
if cnt2 == 0:
    max_x = len(set(tmp))
    print(min_x, max_x)
    exit()
cnt3 = 0
if cnt2 != 0:
    for i in range(len(tmp2)):
        if tmp2[i] != 'nanndemo':
            cnt3 += 1
max_xx = cnt3+cnt2
print(min_x, max_xx)


Measured memory_bytes: 59884
#include<iostream>
#include<string>
using namespace std;
main(){
  int f,i,m;
  string s;
  for(cin>>f;cin>>s;f?puts(f-2?"A":"B"):puts("NA")){
    f=0;
    if(s[0]+s[1]==101){
      if((m=s.find(35))!=string::npos)
	for(i=1;s[m-i]==s[m+i];)
	  if(m-++i==1 && m+i==s.size()-1 && s[m+i]=='~')f=1;
    }else if(s[0]+s[1]==156){
      for(i=2;s[i]=='Q'&&s[i+1]=='=';)
	if(++++i==s.size()-2 && s[i]+s[i+1]==252)f=2;
    }
  }
}

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

int main(int argc, char const *argv[])
{
	int n, k; cin >> n >> k;
	int mx = (n - 1) * (n - 2) / 2;
	if (mx < k) {
		printf("-1\n");
		return 0;
	}

	int cnt  = mx - k;
	vector<pair<int, int>> g; // (u, v)
	for (int i = 1; i < n; ++i) {
		g.push_back(make_pair(0, i));
	}

	int add_cnt = 0;
	for (int i = 1; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (add_cnt < cnt) {
				g.push_back(make_pair(i, j));
				add_cnt++;
			}
		}
	}

	printf("%d\n", (int)g.size());
	for (auto d : g) {
		printf("%d %d\n", d.first + 1, d.second + 1);
	}

	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int i,n;
    char s[100];
      
    scanf("%s",s);
  
    n=strlen(s);
  
    for(i=0;i<n;i++) printf("x");
    printf("\n");
  
    return 0;
}  

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
string s;

int main() {
    cin >> n;
    MSG(pow(n, 3))
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

int n,m;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	int sum=0;
	for(int i=0;i<n;i++) sum+=a[i];
	cin>>m;
	for(int i=0;i<m;i++){
		int p,x;
		cin>>p>>x;
		cout<<sum-a[p-1]+x<<endl;
	}
}

Measured memory_bytes: 256
from collections import deque
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for _ in range(d)]
ans=10**7
for i in range(2**d):
  cnt=0
  c=0
  l=deque([])
  for j in range(d):
    if (i>>j)&1:
      cnt+=(j+1)*100*pc[j][0]+pc[j][1]
      c+=pc[j][0]
      l.appendleft([1,j])
    else:
      l.appendleft([0,j])
  if cnt<g:
    for n,m in l:
      if n==0:
        if g-(cnt+pc[m][0]*(m+1)*100)<=0:
          if (g-cnt)%((m+1)*100)==0:     
            c+=(g-cnt)//((m+1)*100)
            cnt=g
          else:
            c+=(g-cnt)//((m+1)*100)+1
            cnt=g
        break
  if cnt>=g:
    ans=min(ans,c)
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
char s[105];
bool flag;
int main(){
	scanf("%s", s + 1);
	int l = strlen(s + 1);
	for(int i = 1; i <= l; i++){
		if(s[i] == 'C') flag = true;
		if(s[i] == 'F' && flag){
			printf("Yes\n");
			return 0;
		} 
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;
 
int main(){
    int n,m,x,sum_a=0,sum_b=0;
    cin >> n >> m >> x;
    vector<int> a(n);
    for(int i=0;i<m;i++){
        cin >> a[i];
    }
    for(int i=x;i<=n;i++){
        for(int j=0;j<m;j++){
            if(a[j] == i) sum_a++;
        }
    }
    for(int i=0;i<=x;i++){
        for(int j=0;j<m;j++){
            if(a[j] == i) sum_b++;
            //cout << a[j] << endl;
        }
    }
    if(sum_a >= sum_b){
        cout << sum_b << endl;
        return 0;
    }else{
        cout << sum_a << endl;
        return 0;
    }
}

Measured memory_bytes: 256
using System;

namespace AtCoderSnippet
{
    class Program
    {
        static void Main(string[] args)
        {

            var nxt = Console.ReadLine().Split(" ");
            var N = int.Parse(nxt[0]);
            var X = int.Parse(nxt[1]);
            var T = int.Parse(nxt[2]);

            var x = N / X;
            
            var y = x * T;
            if (N % X > 0) y += T;

            Console.WriteLine(y);
        }
    }
}


Measured memory_bytes: 27508
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ii pair < int, int >
#define Iii pair < int, ii >
#define INF 987654321
#define LINF 987654321987654321

int main()
{
	int x;
	scanf("%d", &x);

	if (x >= 30)
		printf("Yes");
	else
		printf("No");
}

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


int main(){
  ll n,m;cin >> n >> m;
  if( abs(n-m) >= 2 ){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1;
  for(ll i=1;i<=n;++i){
    ans *= i;
    ans %= dv;
  }
  for(ll i=1;i<=m;++i){
    ans *= i;
    ans %= dv;
  }
  if( n == m ){
    ans *= 2;
    ans %= dv;
  }
  cout << ans << endl;
  return 0;
}
// 1530123484
// 530123477

Measured memory_bytes: 3556
H, W = map(int, input().split())
S = [input() for _ in range(H)]
for h, line in enumerate(S):
    before = "."
    result = []
    for w, s in enumerate(line):
        if before == "." and s == ".":
            result.append(True)
        if before == "." and s == "#":
            result.append((h != 0 and S[h - 1][w] == "#") or (h != H - 1 and S[h + 1][w] == "#"))
        if before == "#" and s == ".":
            result.append(True)
        if before == "#" and s == "#":
            result[-1] = True
            result.append(True)
        before = s
    if not all(result):
        print("No")
        break
else:
    print("Yes")


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

using namespace std;

int main(){
  int N;
  cin >> N;
  if( N < 3 ){
    cout << 1 << endl;
    return 0;
  }

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

  int ans = 1;
  bool up =   false;
  bool down = false;
  for(int i = 1; i < N; i++){
    if(A[i-1] < A[i]) up = true;
    if(A[i-1] > A[i]) down = true;
    if(down && up){
      up = false;
      down = false;
      ans++;
    }
  }
  cout << ans << endl;
}


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

int a, b, c, d;
int main() {
	cin >> a >> b >> c >> d;
	a += b;
	c += d;
	cout << (a==c ? "Balanced" : a>c ? "Left" : "Right");
	return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <algorithm>

const int INF = 0x3f3f3f3f;
const int kN = 200000 + 5;
char s[kN];
int n;
int next[kN][26];
int dp[kN], from[kN];

void work()
{
    n = strlen(s + 1);
    int w[26] = {};
    for (int i = n; i >= 0; -- i) {
        memcpy(next[i], w, sizeof(w));
        w[s[i] - 'a'] = i;
    }

    for (int i = n; i >= 0; -- i) {
        dp[i] = INF;
        for (int j = 25; j >= 0; -- j) {
            int val = i != 0;
            if (next[i][j] == 0)
                val += 1;
            else
                val += dp[next[i][j]];
            if (val <= dp[i])
                dp[i] = val, from[i] = j;
        }
    }
    for (int at = 0; ;) {
        putchar(from[at] + 'a');
        at = next[at][from[at]];
        if (at == 0) break;
    }
    puts("");
}

int main()
{
    scanf("%s", s + 1);
    work();
}

Measured memory_bytes: 22272
#include <bits/stdc++.h>
using namespace std;
double dp[3000][3000];

long double f(int n,int k,double *p)
{
  if(k>n) return 0;
  if(n==0 && k==0) return 1;
  if(n==0 && k!=0) return 0;
  if(dp[n][k] !=-1) return dp[n][k];
  double ans;
  if(n!=0 && k==0)
  {
    ans = (1-p[n])*f(n-1,k,p);
    dp[n][k] = ans;
    return ans;
  }  
  //
  ans = p[n]*f(n-1,k-1,p) + (1-p[n])*f(n-1,k,p);
  dp[n][k] = ans;
  return ans;
}

long double helper(double *p,int n)
{
  double ans = 0;
  for(int k=n/2+1;k<=n;k++)
  {
    ans = ans+f(n,k,p);
  }
  return ans;
}

int main() {
  for(int i=0;i<3000;i++)
  {
    for(int j=0;j<3000;j++)
    {
      dp[i][j] = -1;
    }
  }
  int n;
  cin>>n;
  double p[n+1];
  for(int i=1;i<=n;i++)
    cin>>p[i];
  cout << fixed << setprecision(10) << helper(p,n);
  return 0;
}

Measured memory_bytes: 70912
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
  static const double pi = 3.141592653589793;
  int a, b, C;
  double S, c, h;

  cin >> a >> b >> C;

  S = a * b * sin(C * pi / 180) / 2;
  c = sqrt(a*a + b*b - 2*a*b*cos(C * pi / 180));
  cout << setprecision(10);
  cout << S << endl;
  cout << a + b + c << endl;
  cout << 2 * S / a << endl;

  return 0;
}
  


Measured memory_bytes: 3576
def solve():
    from bisect import bisect_left
    from sys import stdin
    f_i = stdin
    
    while True:
        n = int(f_i.readline())
        if n == 0:
            break
        
        b = [[0] for i in range(5)]
        for i in range(n):
            d, p, q = map(int, f_i.readline().split())
            q -= 1
            if d == 1:
                if p == 5:
                    continue
                
                h = 0
                for c in b[q:q+p]:
                    if c[-1] > h:
                        h = c[-1]
                
                h += 1
                for c in b[:q] + b[q+p:]:
                    if h not in c:
                        for c in b[q:q+p]:
                            c.append(h)
                        break
                else:
                    for c in b[:q] + b[q+p:]:
                        idx = bisect_left(c, h)
                        c.pop(idx)
                        for j in range(idx, len(c)):
                            c[j] -= 1
            else:
                h = b[q][-1] + 1
                b[q] += list(range(h, h + p))
                diff = 0
                for x in range(h, h + p):
                    x += diff
                    for c in b[:q] + b[q+1:]:
                        if x not in c:
                            break
                    else:
                        for c in b:
                            idx = bisect_left(c, x)
                            c.pop(idx)
                            for j in range(idx, len(c)):
                                c[j] -= 1
                        diff -= 1
        
        print(sum(map(len, b)) - 5)

solve()


Measured memory_bytes: 5692
# coding=utf-8

if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    cnt = 0

    for i in range(A + 1):
        for n in range(B + 1):
            for m in range(C + 1):
                if (i * 500 + n * 100 + m * 50 == X):
                    cnt += 1

    print(cnt)


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

int main() {
    int n, m;
    cin >> n >> m;
    
    vector<int> data(n);
    for(int i = 0; i < n; i++){
        data.at(i) = -1;
    }

    bool ret = true;

    for (int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;

        if (data.at(a - 1) == -1 || data.at(a - 1) == b){
            data.at(a - 1) = b;
        }
        else{
            ret = false;
        }
    }

    int num = -1;
    if (ret == true){
        if (n == 1){
            if (data.at(0) == -1){
                data.at(0) = 0;
            }
            num = data.at(0);
        }

        if (n == 2){
            if(data.at(0) == -1){
                data.at(0) = 1;
            }
            if(data.at(1) == -1){
                data.at(1) = 0;
            }
            
            if(data.at(0) != 0){
                num = data.at(0) * 10 + data.at(1);
            }
        }

        if (n == 3){
            if (data.at(0) == -1){
                data.at(0) =1;
            }
            if(data.at(1) == -1){
                data.at(1) = 0;
            }
            if (data.at(2) == -1){
                data.at(2) = 0;
            }

            if (data.at(0) != 0){
                num = data.at(0) * 100+data.at(1)*10+data.at(2);
            }
        }

    }
    
    cout << num << endl;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int n;
LL memo[31];

LL solve(int cnt){
	if(cnt >= n) return cnt > n? 0 : memo[cnt] = cnt == n;
	if(memo[cnt] != -1) return memo[cnt];
	LL res1 = solve(cnt + 1);
	LL res2 = solve(cnt + 2);
	LL res3 = solve(cnt + 3);
	return memo[cnt] = res1 + res2 + res3;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	while(1){
		rep(i,31)
			memo[i] = -1;
		cin >> n;
		if(n == 0) break;
		LL ans = solve(0);
		ans = (ans + 10 - 1) / 10;
		ans = (ans + 365 - 1) / 365;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#define llint long long

using namespace std;

llint n, k;
llint v[55];

int main(void)
{
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> v[i];
	
	llint ans = 0;
	for(int l = 0; l <= n; l++){
		for(int r = n+1; r >= 1; r--){
			if(l >= r) continue;
			int rem = k - (l+n+1-r);
			if(rem < 0) continue;
			
			llint tmp = 0;
			vector<llint> vec;
			for(int i = 1; i <= l; i++){
				tmp += v[i];
				vec.push_back(v[i]);
			}
			for(int i = n; i >= r; i--){
				tmp += v[i];
				vec.push_back(v[i]);
			}
			sort(vec.begin(), vec.end());
			for(int i = 0; i < min(rem, (int)vec.size()); i++){
				if(vec[i] < 0) tmp -= vec[i];
			}
			//cout << l << " " << r << " " << tmp << endl;
			ans = max(ans, tmp);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define NMAX 50
#define MMAX 50
int N,M;
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
int direction;
int count4,t,y,x;
typedef struct{
    char c[NMAX+1][MMAX+1];
    int id[NMAX+1][MMAX+1];
}MZ;
MZ maze;
int check(int y, int x){
    if(0>y || y>=N || 0>x || x>=M){//枠外
        return 0;
    }
    else if(maze.c[y][x]=='#'){//壁
        maze.id[y][x]=0;
        return 0;
    }
    else if(maze.id[y][x]>0 && maze.id[y][x]<t){//すでに通った
        return 0;
    }
    return 1;
}
void change(int n){
    if(n==0){//右折
        int x=dx[3],y=dy[3];
        for(int i=2;i>=0;i--){
            dx[i+1]=dx[i]; dy[i+1]=dy[i];
        }
        dx[0]=x; dy[0]=y;
    }
    else{//左折
        int x=dx[0],y=dy[0];
        for(int i=0;i<3;i++){
            dx[i]=dx[i+1]; dy[i]=dy[i+1];
        }
        dx[3]=x; dy[3]=y;
    }
}
int main(void){
    int i,j;
    while(1){
        scanf("%d%d",&N,&M);
        if(N==0 && M==0) break;
        for(i=0;i<N;i++) scanf("%s",maze.c[i]);
        rep(i,NMAX) rep(j,MMAX) maze.id[i][j]=-1;
        y=x=0; t=1;
        dx[0]=-1; dx[1]=0; dx[2]=1; dx[3]=0;
        dy[0]=0;  dy[1]=1; dy[2]=0; dy[3]=-1;
        int starty=0,startx=0;
        while(1){
            //int tmpy=y+dy[right],tmpx=x+dx[right];
            //printf("%d %d\n",x,y);
            if(check(y+dy[0],x+dx[0])){//右折
                change(0); y+=dy[1]; x+=dx[1];
            }
            else if(check(y+dy[1],x+dx[1])){//直進
                y+=dy[1]; x+=dx[1];
            }
            else if(check(y+dy[2],x+dx[2])){//左折
                change(1); y+=dy[1]; x+=dx[1];
            }
            else if(check(y+dy[3],x+dx[3])){//引き返す
                change(0); change(0); y+=dy[1]; x+=dx[1];
            }
            else{printf("NO\n"); break;}//閉じ込め
            
            if(t==4&&x==0&&y==0){printf("YES\n"); break;}
            if(y==starty && x==startx){printf("NO\n"); break;}//スタート地点
            else if(t==1&&y==N-1&&x==0){//宝
                t++; maze.id[y][x]=t;
                starty=N-1; startx=0;
            }
            else if(t==2&&y==N-1&&x==M-1){
                t++; maze.id[y][x]=t;
                starty=N-1; startx=M-1;
            }
            else if(t==3&&y==0&&x==M-1){
                t++; maze.id[y][x]=t;
                starty=0; startx=M-1;
            }
            else{
                maze.id[y][x]=t;
            }
        }
        /*rep(i,N){
            rep(j,M){
                printf("%2d ",maze.id[i][j]);
            }
            puts("");
        }*/
    }
    return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl


int main() {
    ll N;
    cin >> N;
    ll a[N];
    for (int i = 0; i < N; ++i) cin >> a[i]; 

    for(ll i = N - 1; i >= 0; i--){
        cout << a[i];
        if(i != 0){
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>

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

Measured memory_bytes: 128
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let v : Vec<i32> = get_vec();
    let x = v[0] * 100 + v[1] * 10 + v[2];
    let ans = if x % 4 == 0 { "YES" } else { "NO" };
    println!("{}", ans );
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt() - 1;
		int B = sc.nextInt() - 1;
		if (B == 1) {
			System.out.println(0);
			System.exit(0);
		}
		if ((B % A) != 0) {
			System.out.println(B / A + 1);
		} else {
			System.out.println(B / A);
		}
	}
}


Measured memory_bytes: 35708
#!/usr/bin/env python3

import functools


@functools.lru_cache(maxsize=None)
def lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return lucas(n - 1) + lucas(n - 2)


def main():
    n = int(input())
    print(lucas(n))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4196
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int i,j,k,n,m,l,x,y,build[1001][2],assign[1001],assign2[1001],prev[1001][1001];
double route[11][1001][1001];

void backtrack(int from,int to){
	int z=prev[from][to];

	if(from==to)return;
	if(z==from){
		printf("%d ",assign[from]);
		return;
	}
	backtrack(from,z);
	backtrack(z,to);
	
}

int main(){
	while(scanf("%d",&n)*n){
		for(i=0;i<n;i++){
			scanf("%d %d %d",&assign[i],&build[i][0],&build[i][1]);
			assign2[assign[i]]=i;
		}
		for(i=0;i<n;i++){
			for(j=i;j<n;j++){
				l=(build[i][0]-build[j][0])*(build[i][0]-build[j][0])+(build[i][1]-build[j][1])*(build[i][1]-build[j][1]);
				if(l<=2500){
					route[0][i][j]=sqrt((double)l);
					route[0][j][i]=sqrt((double)l);
					prev[i][j]=i;
					prev[j][i]=j;
				}
				else{
					route[0][i][j]=999999999;
					route[0][j][i]=999999999;
				}
			}
		}

		for(l=1;pow(2.0,l)<n-1;l++){
			for(i=0;i<n;i++){
				for(j=0;j<n;j++){
					route[l][i][j]=route[l-1][i][j];
					for(k=0;k<n;k++){
						if(route[l][i][j]>route[l-1][i][k]+route[l-1][k][j]){
							route[l][i][j]=route[l-1][i][k]+route[l-1][k][j];
							prev[i][j]=k;
						}
					}
				}
			}
		}

		l--;

		for(scanf("%d",&m);m>0;m--){
			scanf("%d %d",&x,&y);
			x=assign2[x];
			y=assign2[y];
			if(x==y){
				printf("%d\n",assign[y]);
			}
			else if(route[l][x][y]<999999999){
				backtrack(x,y);
				printf("%d\n",assign[y]);
			}
			else printf("NA\n");
		}

	}
	return 0;
}

Measured memory_bytes: 21524
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define fi first
#define se second
#define mod 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
ll a[105];
int main()
{
	ios;
	ll n,m,i,sum=0,g=0;
	double val;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	sort(a+1,a+n+1,greater<ll>());
	val=(sum*1.0d)/(4*m);
	for(i=1;i<=m;i++)
	{
		if(a[i]<val)
		{
			g=1;
			break;
		}
	}
	if(g!=1)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    readint;
    auto ts = readints;
    int sum = ts.sum;
    int m = readint;
    for (int i = 0; i < m; i++) {
        auto px = readints;
        int p = px[0] - 1;
        int x = px[1];
        writeln(sum - ts[p] + x);
    }
}


Measured memory_bytes: 256
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
mod = 1000000007
dp = [1] + [1] * m
for i in range(n):
    newdp = [1] + [0] * m
    for j in range(m):
        if s[i] == t[j]:
            newdp[j + 1] = (newdp[j] + dp[j + 1]) % mod
        else:
            newdp[j + 1] = (newdp[j] + dp[j + 1] - dp[j] + mod) % mod
    dp = newdp
print(dp[-1])

Measured memory_bytes: 41964
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <map>

using namespace std;
using lli = long long int;
using ll = long long;

int main() {
    lli N, R;
    cin >> N >> R;
    if (N > 9) {
        cout << R << endl;
    } else {
        cout << R + (10 - N) * 100;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
#define int long long

signed main() {
	int n, k; scanf("%lld%lld", &n, &k);
	vector<P>v;
	rep(i, n) {
		int a, b; scanf("%lld%lld", &a, &b);
		v.push_back(P(a, b));
	}
	sort(v.begin(), v.end());
	int cnt = 0;
	for (auto p : v) {
		if (cnt + p.second >= k) {
			cout << p.first << endl;
			return 0;
		}
		cnt += p.second;
	}
}

Measured memory_bytes: 1400
#include<stdio.h>
long f(long L, long S) {
    if (S == 0) return -L;
    return 2L * S * (L / S) + f(S, L % S);
}
int main()
{
    long N, X;
    scanf("%ld %ld", &N, &X);
    long L = X > N - X ? X : N - X;
    long S = N - L;
    printf("%ld\n",(f(L, S) + N));
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 220000
#define offset 
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    ll x;
    cin>>x;
    forr(i,-2500,2500)
    {
        forr(j,-2500,2500)
        {
            ll ans=(i*i*i*i*i-j*j*j*j*j);
            if (ans==x)
            {
                cout<<i<<" "<<j<<endl;
                exit(0);
            }
        }
    }
}
// PLUS ULTRA!
    


Measured memory_bytes: 3628
S = str(input())
T = str(input())

ans = 10**9
for i in range(len(S)-len(T)+1):
  s = S[i:i+len(T)]
  tmp = 0
  for j in range(len(T)):
    if s[j] != T[j]:
      tmp += 1
  ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 9056
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

long long int a[200001];
long long int result[200001][5] = {};

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	result[0][0] = result[0][4] = a[0];
	result[0][1] = result[0][3] = ((a[0] == 0) ? 2 : a[0] % 2);
	result[0][2] = (a[0] + 1) % 2;
	for(int i = 1; i < n; i++){
		result[i][0] = result[i - 1][0] + a[i];
		result[i][1] = min(result[i - 1][0], result[i - 1][1]) + ((a[i] == 0) ? 2 : a[i] % 2);
		result[i][2] = min(result[i - 1][0], min(result[i - 1][1], result[i - 1][2])) + (a[i] + 1) % 2;
		result[i][3] = min(result[i - 1][0], min(result[i - 1][1], min(result[i - 1][2], result[i - 1][3]))) + ((a[i] == 0) ? 2 : a[i] % 2);
		result[i][4] = min(result[i - 1][0], min(result[i - 1][1], min(result[i - 1][2], min(result[i - 1][3], result[i - 1][4])))) + a[i];
	}
	// for(int i = 0; i < n; i++){
	// 	for(int j = 0; j < 5; j++){
	// 		cout << i << " " << j << " " << result[i][j] << endl;
	// 	}
	// }
	long long int ans = (long long int)mod * n;
	for(int i = 0; i < 5; i++){
		ans = min(ans, result[n - 1][i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int num = n / 100;
		int mod = n % 100;
		if (num * 5 < mod) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	}

}

Measured memory_bytes: 21844
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 210000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
char in[210];
int main(){
	int a;scanf("%d",&a);
	scanf("%s",in);
	if(a%2){
		printf("No\n");return 0;
	}
	for(int i=0;i<a/2;i++){
		if(in[i]!=in[i+a/2]){
			printf("No\n");return 0;
		}
	}
	printf("Yes\n");
}

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

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

    string s;
    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s[i] == s[i + 1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <limits.h>
 
#define DEF_ELEM_MAX 200000
 
typedef long long llong;
 
int S[DEF_ELEM_MAX];
int L[DEF_ELEM_MAX/2+2];
int R[DEF_ELEM_MAX/2+2];
    int N;
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
llong merge(int *A, int left, int mid, int right)
{
    llong cnt = 0;
    int i;
    int j;
    int k;
    int n1 = mid - left;
    int n2 = right - mid;
 
//  L[0...n1], R[0...n2] ?????????
 
    for ( i = 0 ; i < n1 ; i++ ) {
        L[i] = A[left + i];
    }
 
    for ( i = 0 ; i < n2 ; i++ ) {
        R[i] = A[mid + i];
    }
 
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;
    i = 0;
    j = 0;
    for ( k = left ; k < right ; k++ ) {
        if ( L[i] <= R[j] ) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
            cnt += n1 - i; // = mid + j - k -1
        }
    }
    return cnt;
}
 
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
llong mergeSort(int *A, int left, int right)
{
    llong v1;
    llong v2;
    llong v3;
    int mid;
    if (left+1 < right) {
        mid = (left + right)/2;
        v1 = mergeSort(A, left, mid);
        v2 = mergeSort(A, mid, right);
        v3 = merge(A, left, mid, right);
        return v1+v2+v3;
    } else {
        return 0;
    }
}
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void)
{
    llong ans;
    int i;
//
    scanf("%d", &N);
    for ( i = 0 ; i < N ; i++ ) {
        scanf("%d", &S[i] );
    }
 
    ans = mergeSort(S, 0, N);
 
    printf("%ld\n", ans);
 
    return 0;
}

Measured memory_bytes: 2156
use std::collections::HashMap;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let v: Vec<i32> = (0..n).map(|_| read()).collect();

    let mut map = HashMap::new();
    for x in v {
        *map.entry(x).or_insert(0) += 1;
    }

    let mut ans = 0;
    for (k, v) in map {
        if v >= k {
            ans += v - k;
        } else {
            ans += v;
        }
    }

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

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 8444
#include<iostream>
#include<string>
#include <iostream>

using namespace std;

int main(){
  int a,b;
  cin >> a >>b;
  int c = a*b;
  // cout << c%2 << endl;
  if(c%2 == 0){
    cout << "Even" << endl;
  }
  else{
    cout << "Odd" << endl;
  }
}


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

void solve(){
	string inp, res = "";
	cin >> inp;
	
	int n = (int)inp.size();
	for(int i = 0, j = 0; i < n; i = j){
		while(j < n and inp[j] == inp[i])
			++j;
		res.push_back(inp[i]);
	}
	
	int ans = res.size()-1;
	cout << ans << "\n";
}

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

Measured memory_bytes: 512
a,b = map(int,input().split())
y = abs(abs(a)-abs(b))
if 0 < b < a or b < a < 0:
    print(y+2)
elif a*b < 0 or (a == 0 and b < 0) or (a > 0 and b == 0):
    print(y+1)
else:
    print(y)

Measured memory_bytes: 3060
N,K=map(int, input().split())
h=[]
for i in range(N):
  h.append(int(input()))
h=sorted(h)
min_tree=max(h)
for i in range(N-K+1):
  if h[i+K-1]-h[i]<min_tree:
    min_tree=h[i+K-1]-h[i]
print(min_tree)

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e15;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 1e5 + 100;
const int LOG = 20;
const int mod = 1e9 + 7;
const int MX = 1e6 + 100;
typedef long long li;
const li MOD = 1000000000949747713ll;

ll dp[3100][3100];
int a[3100];

ll get(int l, int r, int step) {
    if (dp[l][r] != -1)
        return dp[l][r];
    ll &res = dp[l][r];
    if(l==r){
        if(step==0){
            res = a[l];
        } else{
            res = -a[l];
        }
        return res;
    }
    if (step == 0) {
        res = -inf_ll;
        res = max(res, get(l + 1, r, step ^ 1) + a[l]);
        res = max(res, get(l, r - 1, step ^ 1) + a[r]);
    } else {
        res = inf_ll;
        res = min(res, get(l+1,r, step^1) - a[l]);
        res = min(res, get(l,r-1,step^1) - a[r]);
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    for(int i=1;i<=n;++i){
        cin >> a[i];
    }
    memset(dp,-1,sizeof dp);

    cout << get(1,n,0)<<"\n";
}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;

    while (t--)
        solve();
    dout << endl << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 75520
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  for(int i=0; i<N; i++){
    if (A[i]%2==0){
      if (A[i]%3!=0 && A[i]%5!=0){
        cout <<"DENIED"<<endl;
        return 0;
      }
    }
  }
  cout <<"APPROVED"<<endl;
}

Measured memory_bytes: 256